From 7cceb05d839bd845e987c5bbdf8df83b3a37ffdc Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 17:48:49 +1000 Subject: [PATCH 001/104] build: turn on LTO and tidy up release build flags --- meson.build | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 72e6294dc..84f6e6fac 100644 --- a/meson.build +++ b/meson.build @@ -6,10 +6,11 @@ project( default_options: [ 'cpp_std=c++23', 'warning_level=0', - 'buildtype=debugoptimized', # for now 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this 'b_pch=true', # precompiled headers + 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) + 'b_ndebug=if-release', # drop assert() in --buildtype=release ], ) @@ -22,12 +23,20 @@ global_cpp_defs = [ '-DSPLIT_SAVES', '-D_LARGE_WORLDS', '-D_EXTENDED_ACHIEVEMENTS', - '-D_DEBUG_MENUS_ENABLED', - '-D_DEBUG', '-D_FORTIFY_SOURCE=2', - '-DDEBUG', ] +# Debug-only defines: keep for debug + debugoptimized so iteration is unchanged. +# --buildtype=release strips them so shipping builds don't carry debug logging, +# debug menu UI, or assert-driven sanity checks. +if get_option('buildtype') in ['debug', 'debugoptimized'] + global_cpp_defs += [ + '-D_DEBUG', + '-DDEBUG', + '-D_DEBUG_MENUS_ENABLED', + ] +endif + if host_machine.system() == 'linux' global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__'] endif From 875039a6dd79bcef27af9eabc078d06a1c927be6 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 17:49:17 +1000 Subject: [PATCH 002/104] refactor: use unique_ptr in ImageFileBuffer instead of malloc/free --- targets/platform/PlatformTypes.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index ee942a9b5..52ff5074b 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -1,25 +1,39 @@ #pragma once +#include #include -#include +#include // Shared value types used by platform interfaces. These are NOT interfaces // themselves — they are data carriers that cross the platform boundary. struct ImageFileBuffer { enum EImageType { e_typePNG, e_typeJPG }; - EImageType m_type; - void* m_pBuffer = nullptr; - int m_bufferSize = 0; - [[nodiscard]] int GetType() const { return m_type; } - [[nodiscard]] void* GetBufferPointer() const { return m_pBuffer; } + ImageFileBuffer() = default; + ImageFileBuffer(EImageType type, std::size_t size) + : m_type(type), + m_pBuffer(size > 0 ? std::make_unique(size) : nullptr), + m_bufferSize(static_cast(size)) {} + + // move-only + ImageFileBuffer(ImageFileBuffer&&) noexcept = default; + ImageFileBuffer& operator=(ImageFileBuffer&&) noexcept = default; + ImageFileBuffer(const ImageFileBuffer&) = delete; + ImageFileBuffer& operator=(const ImageFileBuffer&) = delete; + + [[nodiscard]] EImageType GetType() const { return m_type; } + [[nodiscard]] std::byte* GetBufferPointer() const { return m_pBuffer.get(); } [[nodiscard]] int GetBufferSize() const { return m_bufferSize; } [[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; } void Release() { - std::free(m_pBuffer); - m_pBuffer = nullptr; + m_pBuffer.reset(); + m_bufferSize = 0; } + + EImageType m_type{e_typePNG}; + std::unique_ptr m_pBuffer; + int m_bufferSize = 0; }; struct D3DXIMAGE_INFO { From d7eca58551d635f5fa7ae46e354c2d3b4b987b4f Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 17:55:04 +1000 Subject: [PATCH 003/104] refactor: split App_Defines.h up by concern and drop the umbrella --- meson.build | 1 + targets/app/common/App_Defines.h | 135 ------------------ targets/app/common/App_structs.h | 3 +- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 4 +- targets/app/common/Game_XuiActions.cpp | 2 +- targets/app/common/Tutorial/TutorialEnum.h | 8 +- .../app/common/UI/All Platforms/UIStructs.h | 2 +- .../UIScene_CreateWorldMenu.cpp | 3 +- .../Frontend Menu screens/UIScene_EULA.cpp | 2 +- .../UIScene_JoinMenu.cpp | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 3 +- .../UIScene_LoadMenu.cpp | 3 +- .../UIScene_LoadOrJoinMenu.cpp | 2 +- .../UIScene_MainMenu.cpp | 3 +- .../UIScene_NewUpdateMessage.cpp | 2 +- .../UIScene_SaveMessage.cpp | 3 +- .../UIScene_TrialExitUpsell.cpp | 2 +- .../Help & Options/UIScene_LanguageSelector.h | 2 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 2 +- targets/app/linux/Linux_Minecraft.cpp | 2 +- targets/minecraft/GameHostOptions.h | 49 ++++++- targets/minecraft/GameTypes.h | 17 ++- .../minecraft/client/renderer/GameRenderer.h | 1 - .../world/level/storage/LevelData.cpp | 2 +- targets/platform/PlatformTypes.h | 5 + targets/platform/profile/ProfileConstants.h | 64 +++++++++ targets/platform/profile/stub/StubProfile.cpp | 2 - 31 files changed, 163 insertions(+), 171 deletions(-) delete mode 100644 targets/app/common/App_Defines.h diff --git a/meson.build b/meson.build index 84f6e6fac..2c4817142 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,7 @@ global_cpp_defs = [ '-D_LARGE_WORLDS', '-D_EXTENDED_ACHIEVEMENTS', '-D_FORTIFY_SOURCE=2', + '-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h) ] # Debug-only defines: keep for debug + debugoptimized so iteration is unchanged. diff --git a/targets/app/common/App_Defines.h b/targets/app/common/App_Defines.h deleted file mode 100644 index f5d301268..000000000 --- a/targets/app/common/App_Defines.h +++ /dev/null @@ -1,135 +0,0 @@ -#pragma once - -// 4J Stu - For non-splitscreen menus, default to this screen -#define DEFAULT_XUI_MENU_USER 0 -#define MULTITHREAD_ENABLE -#define MAX_CAPENAME_SIZE 32 -#define MAX_BANNERNAME_SIZE 32 -#define MAX_TMSFILENAME_SIZE 40 -#define MAX_TYPE_SIZE 32 -#define MAX_EXTENSION_TYPES 3 - -#define MAX_LOCAL_PLAYERS 4 - -// 4J Stu - Required for sentient reporting of whether the volume level has been -// changed or not -#define DEFAULT_VOLUME_LEVEL 100 - -#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3 -#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004 -#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008 -#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030 -#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040 -#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080 -#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100 -#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200 -#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400 -#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800 -#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000 -#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000 -#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000 -#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000 -#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000 -#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000 -#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000 -#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000 -#define GAME_HOST_OPTION_BITMASK_WORLDSIZE \ - 0x00700000 // 3 bits, 5 values (unset(0), classic(1), small(2), medium(3), - // large(4)) -#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000 -#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000 -#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000 -#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000 -#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000 -#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000 -#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000 -#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF - -#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20 - -enum EGameHostOptionWorldSize { - e_worldSize_Unknown = 0, - e_worldSize_Classic, - e_worldSize_Small, - e_worldSize_Medium, - e_worldSize_Large -}; - -#define PROFILE_VERSION_8 10 -#define PROFILE_VERSION_9 11 - -#define PROFILE_VERSION_10 12 - -// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms. -#define PROFILE_VERSION_11 13 - -// Java 1.6.4 -#define PROFILE_VERSION_12 14 - -#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12 - -#define MAX_FAVORITE_SKINS \ - 10 // these are stored in the profile data so keep it small - -// defines for game settings - uiBitmaskValues - -#define GAMESETTING_CLOUDS 0x00000001 -#define GAMESETTING_ONLINE 0x00000002 -#define GAMESETTING_INVITEONLY 0x00000004 -#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008 -#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030 -#define GAMESETTING_BEDROCKFOG 0x00000040 -#define GAMESETTING_DISPLAYHUD 0x00000080 -#define GAMESETTING_DISPLAYHAND 0x00000100 -#define GAMESETTING_CUSTOMSKINANIM 0x00000200 -#define GAMESETTING_DEATHMESSAGES 0x00000400 -#define GAMESETTING_UISIZE 0x00001800 -#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000 -#define GAMESETTING_ANIMATEDCHARACTER 0x00008000 -#define GAMESETTING_PS3EULAREAD 0x00010000 -#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 - -// defines for languages - -#define MINECRAFT_LANGUAGE_DEFAULT 0x00 -#define MINECRAFT_LANGUAGE_ENGLISH 0x01 -#define MINECRAFT_LANGUAGE_JAPANESE 0x02 -#define MINECRAFT_LANGUAGE_GERMAN 0x03 -#define MINECRAFT_LANGUAGE_FRENCH 0x04 -#define MINECRAFT_LANGUAGE_SPANISH 0x05 -#define MINECRAFT_LANGUAGE_ITALIAN 0x06 -#define MINECRAFT_LANGUAGE_KOREAN 0x07 -#define MINECRAFT_LANGUAGE_TCHINESE 0x08 -#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09 -#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A -#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B -#define MINECRAFT_LANGUAGE_DUTCH 0x0C -#define MINECRAFT_LANGUAGE_FINISH 0x0D -#define MINECRAFT_LANGUAGE_SWEDISH 0x0E -#define MINECRAFT_LANGUAGE_DANISH 0x0F -#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10 -#define MINECRAFT_LANGUAGE_POLISH 0x11 -#define MINECRAFT_LANGUAGE_TURKISH 0x12 -#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 -#define MINECRAFT_LANGUAGE_GREEK 0x14 - -/* Match these - -const int XC_LANGUAGE_ENGLISH =1; const int XC_LANGUAGE_JAPANESE -=2; const int XC_LANGUAGE_GERMAN -=3; const int XC_LANGUAGE_FRENCH -=4; const int XC_LANGUAGE_SPANISH -=5; const int XC_LANGUAGE_ITALIAN -=6; const int XC_LANGUAGE_KOREAN -=7; const int XC_LANGUAGE_TCHINESE -=8; const int XC_LANGUAGE_PORTUGUESE =9; const int XC_LANGUAGE_BRAZILIAN -=10; const int XC_LANGUAGE_RUSSIAN -=11; const int XC_LANGUAGE_DUTCH -=12; const int XC_LANGUAGE_FINISH -=13; const int XC_LANGUAGE_SWEDISH -=14; const int XC_LANGUAGE_DANISH -=15; const int XC_LANGUAGE_NORWEGIAN =16; const int XC_LANGUAGE_POLISH -=17; const int XC_LANGUAGE_TURKISH -=18; const int XC_LANGUAGE_LATINAMERICANSPANISH =19; -const int XC_LANGUAGE_GREEK =20; -*/ diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index a128211e7..537048244 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -3,7 +3,8 @@ #include #include "platform/storage/storage.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" +#include "platform/profile/ProfileConstants.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "app/common/Tutorial/TutorialEnum.h" diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 9be84139d..ea647e328 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -11,7 +11,7 @@ #include #include "platform/PlatformTypes.h" -#include "app/common/App_Defines.h" +#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index 91b4ad585..d6b49b4af 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -6,7 +6,7 @@ class Random; #include -#include "app/common/App_Defines.h" +#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 88b29a8d1..68aaa8b6a 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -5,7 +5,7 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/common/Console_Debug_enum.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 7cdafeeb8..1e09c6770 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -1,7 +1,9 @@ #include "app/common/GameSettingsManager.h" #include "app/common/Game.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" +#include "platform/profile/ProfileConstants.h" #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 909b0fdd9..e6e9bd8e0 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -1,4 +1,4 @@ -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" diff --git a/targets/app/common/Tutorial/TutorialEnum.h b/targets/app/common/Tutorial/TutorialEnum.h index c5cadb0a7..7d9e569eb 100644 --- a/targets/app/common/Tutorial/TutorialEnum.h +++ b/targets/app/common/Tutorial/TutorialEnum.h @@ -17,11 +17,9 @@ typedef struct { #define TUTORIAL_NO_TEXT -1 #define TUTORIAL_NO_ICON -1 -// If you want to make these bigger, be aware that that will affect what is -// stored after the tutorial data in the profile data See Xbox_App.h for the -// struct -#define TUTORIAL_PROFILE_STORAGE_BITS 512 -#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS / 8) +// TUTORIAL_PROFILE_STORAGE_BITS / TUTORIAL_PROFILE_STORAGE_BYTES moved to +// platform/profile/ProfileConstants.h since they describe profile data +// layout. Anything that needs them should include that header directly. // 4J Stu - The total number of eTutorial_State and eTutorial_Hint must be less // than 512, as we only have 512 bits of profile data to flag whether or not the diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 32a1f1950..4a51fa239 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -7,7 +7,7 @@ #include #include "platform/storage/storage.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameHostOptions.h" #include "UIEnums.h" #include "platform/C4JThread.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 4e90a5ab0..f5fd6afc8 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,8 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.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 f54343940..3737ca710 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/input.h" #include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.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 b846bb591..791c2c9dc 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 @@ -4,7 +4,7 @@ #include #include -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/SessionInfo.h" #include "app/common/UI/All Platforms/UIStructs.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 444d53517..076b50bb8 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 @@ -7,7 +7,8 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.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 71015957d..5688fb328 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 @@ -7,7 +7,8 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.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 a45cf9f2f..42627d430 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/input.h" #include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.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 46f40fe3b..4beac9a53 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 @@ -9,7 +9,8 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" +#include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.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 1edae7b8c..8c28db506 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 "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.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 5b36680b5..e078d407f 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,8 @@ #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" +#include "platform/profile/ProfileConstants.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.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 408edb982..959d93e4a 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/profile/profile.h" -#include "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index e183a6e9f..0101fe73c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -2,7 +2,7 @@ #include -#include "app/common/App_Defines.h" +#include "platform/profile/ProfileConstants.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.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 810830562..2312fda10 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -7,7 +7,7 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" -#include "app/common/App_Defines.h" +#include "platform/profile/ProfileConstants.h" #include "app/common/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 96eee7240..23bdd0aec 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 "app/common/App_Defines.h" +#include "minecraft/GameTypes.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index c9d5d3c5e..acacabad6 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -58,7 +58,7 @@ static void sigsegv_handler(int sig) { #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" -#include "app/common/App_Defines.h" +#include "platform/profile/ProfileConstants.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" diff --git a/targets/minecraft/GameHostOptions.h b/targets/minecraft/GameHostOptions.h index 0d27f5dae..100ca67e1 100644 --- a/targets/minecraft/GameHostOptions.h +++ b/targets/minecraft/GameHostOptions.h @@ -2,12 +2,53 @@ #include -#include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" -// Stateless bitfield utilities - no app dependency. -// The global-state overloads (get/set with no settings arg) have moved -// to IgameServices().getGameHostOption / setGameHostOption. +// Bitmask layout for the game host option settings word, plus the +// stateless bitfield utilities used to read and write it. +// +// The global-state overloads (get/set with no settings arg) have moved to +// IGameServices::getGameHostOption / setGameHostOption. + +#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3 +#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004 +#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008 +#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030 +#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040 +#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080 +#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100 +#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200 +#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400 +#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800 +#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000 +#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000 +#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000 +#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000 +#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000 +#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000 +#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000 +#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000 +// 3 bits, 5 values: unset(0), classic(1), small(2), medium(3), large(4) +#define GAME_HOST_OPTION_BITMASK_WORLDSIZE 0x00700000 +#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000 +#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000 +#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000 +#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000 +#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000 +#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000 +#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000 +#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF + +#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20 + +enum EGameHostOptionWorldSize { + e_worldSize_Unknown = 0, + e_worldSize_Classic, + e_worldSize_Small, + e_worldSize_Medium, + e_worldSize_Large +}; + namespace GameHostOptions { unsigned int get(unsigned int settings, eGameHostOption option); diff --git a/targets/minecraft/GameTypes.h b/targets/minecraft/GameTypes.h index b233aa461..b95591a0c 100644 --- a/targets/minecraft/GameTypes.h +++ b/targets/minecraft/GameTypes.h @@ -4,9 +4,22 @@ #include "minecraft/GameEnums.h" -#ifndef MAX_CAPENAME_SIZE +// Vocabulary types and small game constants shared across minecraft/. +// Anything that used to live in app/common/App_Defines.h and represents a +// game-side concept (asset name sizes, default control indices, etc.) lives +// here. + #define MAX_CAPENAME_SIZE 32 -#endif +#define MAX_BANNERNAME_SIZE 32 +#define MAX_TMSFILENAME_SIZE 40 +#define MAX_TYPE_SIZE 32 +#define MAX_EXTENSION_TYPES 3 + +// Default UI controller index for non-splitscreen menus. +#define DEFAULT_XUI_MENU_USER 0 + +// Default sound/music volume level (0-100). +#define DEFAULT_VOLUME_LEVEL 100 struct MOJANG_DATA { eXUID eXuid; diff --git a/targets/minecraft/client/renderer/GameRenderer.h b/targets/minecraft/client/renderer/GameRenderer.h index 708e078dd..cc4302a0c 100644 --- a/targets/minecraft/client/renderer/GameRenderer.h +++ b/targets/minecraft/client/renderer/GameRenderer.h @@ -6,7 +6,6 @@ #include #include -#include "app/common/App_Defines.h" #include "platform/C4JThread.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/SmoothFloat.h" diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index f92f56ea8..6aa119ecf 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -6,8 +6,8 @@ #include #include -#include "app/common/App_Defines.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" #include "app/linux/LinuxGame.h" #include "java/System.h" #include "minecraft/world/level/GameRules.h" diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index 52ff5074b..33b74fdbd 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -74,6 +74,11 @@ inline constexpr int XUSER_MAX_COUNT = 4; inline constexpr int XUSER_NAME_SIZE = 32; inline constexpr int XUSER_INDEX_FOCUS = 254; +// Maximum local (split-screen) players. Same as XUSER_MAX_COUNT; kept as a +// separate name because gameplay code talks about "local players" rather +// than Xbox user slots. +#define MAX_LOCAL_PLAYERS 4 + using PlayerUID = unsigned long long; using PPlayerUID = PlayerUID*; inline constexpr PlayerUID INVALID_XUID = 0; diff --git a/targets/platform/profile/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h index 6ae5cec98..4c90ceab1 100644 --- a/targets/platform/profile/ProfileConstants.h +++ b/targets/platform/profile/ProfileConstants.h @@ -1,7 +1,71 @@ #pragma once +// Profile data storage layout, schema versioning, and game settings stored +// in profile data. Owned by the platform/profile layer because the profile +// data structure is what defines these. + #define TITLEID_MINECRAFT 0x584111F7 +// Tutorial completion bits stored in profile data. The exact byte count is +// load-bearing for ProfileGameSettings layout in StubProfile.cpp. +#define TUTORIAL_PROFILE_STORAGE_BITS 512 +#define TUTORIAL_PROFILE_STORAGE_BYTES (TUTORIAL_PROFILE_STORAGE_BITS / 8) + +// Profile data schema versions +#define PROFILE_VERSION_8 10 +#define PROFILE_VERSION_9 11 +#define PROFILE_VERSION_10 12 +// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms. +#define PROFILE_VERSION_11 13 +// Java 1.6.4 +#define PROFILE_VERSION_12 14 +#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12 + +// Maximum favourite skins stored in profile data; keep small. +#define MAX_FAVORITE_SKINS 10 + +// Bitmask values for ProfileGameSettings::uiBitmaskValues. +#define GAMESETTING_CLOUDS 0x00000001 +#define GAMESETTING_ONLINE 0x00000002 +#define GAMESETTING_INVITEONLY 0x00000004 +#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008 +#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030 +#define GAMESETTING_BEDROCKFOG 0x00000040 +#define GAMESETTING_DISPLAYHUD 0x00000080 +#define GAMESETTING_DISPLAYHAND 0x00000100 +#define GAMESETTING_CUSTOMSKINANIM 0x00000200 +#define GAMESETTING_DEATHMESSAGES 0x00000400 +#define GAMESETTING_UISIZE 0x00001800 +#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000 +#define GAMESETTING_ANIMATEDCHARACTER 0x00008000 +#define GAMESETTING_PS3EULAREAD 0x00010000 +#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 + +// Profile-stored language IDs (ucLanguage). Match the Xbox XC_LANGUAGE_* +// values defined in XboxStubs.h. +#define MINECRAFT_LANGUAGE_DEFAULT 0x00 +#define MINECRAFT_LANGUAGE_ENGLISH 0x01 +#define MINECRAFT_LANGUAGE_JAPANESE 0x02 +#define MINECRAFT_LANGUAGE_GERMAN 0x03 +#define MINECRAFT_LANGUAGE_FRENCH 0x04 +#define MINECRAFT_LANGUAGE_SPANISH 0x05 +#define MINECRAFT_LANGUAGE_ITALIAN 0x06 +#define MINECRAFT_LANGUAGE_KOREAN 0x07 +#define MINECRAFT_LANGUAGE_TCHINESE 0x08 +#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09 +#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A +#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B +#define MINECRAFT_LANGUAGE_DUTCH 0x0C +#define MINECRAFT_LANGUAGE_FINISH 0x0D +#define MINECRAFT_LANGUAGE_SWEDISH 0x0E +#define MINECRAFT_LANGUAGE_DANISH 0x0F +#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10 +#define MINECRAFT_LANGUAGE_POLISH 0x11 +#define MINECRAFT_LANGUAGE_TURKISH 0x12 +#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 +#define MINECRAFT_LANGUAGE_GREEK 0x14 + + #define CONTEXT_GAME_STATE 0 #define CONTEXT_GAME_STATE_BLANK 0 #define CONTEXT_GAME_STATE_RIDING_PIG 1 diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index 9b019e519..0cff91666 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -6,8 +6,6 @@ #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 6b3b0134cf62b2311e1bdf10dac9563f96328264 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:20:43 +1000 Subject: [PATCH 004/104] build: list sources explicitly in meson.build instead of shelling out --- scripts/list_sources.py | 97 +++ targets/app/common_sources.txt | 225 +++++++ targets/app/linux_sources.txt | 5 + targets/app/meson.build | 27 +- targets/minecraft/meson.build | 36 +- targets/minecraft/sources.txt | 1052 ++++++++++++++++++++++++++++++++ 6 files changed, 1391 insertions(+), 51 deletions(-) create mode 100644 scripts/list_sources.py create mode 100644 targets/app/common_sources.txt create mode 100644 targets/app/linux_sources.txt create mode 100644 targets/minecraft/sources.txt diff --git a/scripts/list_sources.py b/scripts/list_sources.py new file mode 100644 index 000000000..f0e8ebbe8 --- /dev/null +++ b/scripts/list_sources.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Enumerate C/C++ source files for a meson target. + +Replaces the run_command('sh', '-c', 'find ...') hack in +targets/{minecraft,app}/meson.build. Run this whenever source files are +added or removed and commit the regenerated *_sources.txt files. + +Usage: + python3 scripts/list_sources.py + +Each module's sources.txt is generated relative to its meson source dir. +""" + +import os +import sys +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent + +# Module configuration: (output_path, scan_root, [exclude_basenames]). +# Paths in the output file are relative to the directory containing the +# meson.build that reads it. +MODULES = [ + { + "name": "minecraft", + "output": REPO_ROOT / "targets" / "minecraft" / "sources.txt", + "scan_root": REPO_ROOT / "targets" / "minecraft", + "rel_to": REPO_ROOT / "targets" / "minecraft", + "exclude": { + "DurangoStats.cpp", # Durango-specific + # Incomplete / unused + "SkyIslandDimension.cpp", + "MemoryChunkStorage.cpp", + "MemoryLevelStorage.cpp", + "MemoryLevelStorageSource.cpp", + "NbtSlotFile.cpp", + "ZonedChunkStorage.cpp", + "ZoneFile.cpp", + "ZoneIo.cpp", + "LevelConflictException.cpp", + "SurvivalMode.cpp", + "CreativeMode.cpp", + "GameMode.cpp", + "DemoMode.cpp", + }, + }, + { + "name": "app_common", + "output": REPO_ROOT / "targets" / "app" / "common_sources.txt", + "scan_root": REPO_ROOT / "targets" / "app" / "common", + "rel_to": REPO_ROOT / "targets" / "app", + "exclude": { + "UIScene_InGameSaveManagementMenu.cpp", + }, + }, + { + "name": "app_linux", + "output": REPO_ROOT / "targets" / "app" / "linux_sources.txt", + "scan_root": REPO_ROOT / "targets" / "app" / "linux", + "rel_to": REPO_ROOT / "targets" / "app", + "exclude": set(), + }, +] + +EXTENSIONS = (".cpp", ".c") + + +def collect(scan_root: Path, rel_to: Path, exclude: set[str]) -> list[str]: + out: list[str] = [] + for dirpath, _dirnames, filenames in os.walk(scan_root): + for name in filenames: + if not name.endswith(EXTENSIONS): + continue + if name in exclude: + continue + full = Path(dirpath) / name + out.append(str(full.relative_to(rel_to))) + out.sort() + return out + + +def main() -> int: + for mod in MODULES: + sources = collect(mod["scan_root"], mod["rel_to"], mod["exclude"]) + body = "\n".join(sources) + "\n" + out_path: Path = mod["output"] + previous = out_path.read_text() if out_path.exists() else "" + if previous == body: + print(f"{mod['name']}: {len(sources)} files (unchanged)") + else: + out_path.write_text(body) + print(f"{mod['name']}: {len(sources)} files (regenerated {out_path.relative_to(REPO_ROOT)})") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt new file mode 100644 index 000000000..b34508a53 --- /dev/null +++ b/targets/app/common_sources.txt @@ -0,0 +1,225 @@ +common/AppGameServices.cpp +common/ArchiveManager.cpp +common/Audio/Consoles_SoundEngine.cpp +common/Audio/SoundEngine.cpp +common/Audio/SoundNames.cpp +common/BannedListManager.cpp +common/Colours/ColourTable.cpp +common/ConsoleGameMode.cpp +common/DLC/DLCAudioFile.cpp +common/DLC/DLCCapeFile.cpp +common/DLC/DLCColourTableFile.cpp +common/DLC/DLCFile.cpp +common/DLC/DLCGameRulesFile.cpp +common/DLC/DLCGameRulesHeader.cpp +common/DLC/DLCLocalisationFile.cpp +common/DLC/DLCManager.cpp +common/DLC/DLCPack.cpp +common/DLC/DLCSkinFile.cpp +common/DLC/DLCTextureFile.cpp +common/DLC/DLCUIDataFile.cpp +common/DLCController.cpp +common/DebugOptions.cpp +common/Game.cpp +common/GameMenuService.cpp +common/GameRules/GameRuleManager.cpp +common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +common/GameRules/LevelGeneration/BiomeOverride.cpp +common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +common/GameRules/LevelGeneration/LevelGenerators.cpp +common/GameRules/LevelGeneration/StartFeature.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +common/GameRules/LevelRules/LevelRules.cpp +common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +common/GameRules/LevelRules/Rules/GameRule.cpp +common/GameRules/WstringLookup.cpp +common/GameSettingsManager.cpp +common/Game_XuiActions.cpp +common/Leaderboards/LeaderboardInterface.cpp +common/Leaderboards/LeaderboardManager.cpp +common/Localisation/StringTable.cpp +common/LocalizationManager.cpp +common/MenuController.cpp +common/Network/GameNetworkManager.cpp +common/Network/NetworkPlayerQNet.cpp +common/Network/PlatformNetworkManagerStub.cpp +common/Network/QNetStubs.cpp +common/Network/Socket.cpp +common/NetworkController.cpp +common/SaveManager.cpp +common/SkinManager.cpp +common/TerrainFeatureManager.cpp +common/Trial/TrialMode.cpp +common/Tutorial/Constraints/AreaConstraint.cpp +common/Tutorial/Constraints/ChangeStateConstraint.cpp +common/Tutorial/Constraints/InputConstraint.cpp +common/Tutorial/FullTutorial.cpp +common/Tutorial/FullTutorialMode.cpp +common/Tutorial/Hints/AreaHint.cpp +common/Tutorial/Hints/DiggerItemHint.cpp +common/Tutorial/Hints/LookAtEntityHint.cpp +common/Tutorial/Hints/LookAtTileHint.cpp +common/Tutorial/Hints/TakeItemHint.cpp +common/Tutorial/Hints/TutorialHint.cpp +common/Tutorial/Tasks/AreaTask.cpp +common/Tutorial/Tasks/ChoiceTask.cpp +common/Tutorial/Tasks/CompleteUsingItemTask.cpp +common/Tutorial/Tasks/ControllerTask.cpp +common/Tutorial/Tasks/CraftTask.cpp +common/Tutorial/Tasks/EffectChangedTask.cpp +common/Tutorial/Tasks/FullTutorialActiveTask.cpp +common/Tutorial/Tasks/HorseChoiceTask.cpp +common/Tutorial/Tasks/InfoTask.cpp +common/Tutorial/Tasks/PickupTask.cpp +common/Tutorial/Tasks/ProcedureCompoundTask.cpp +common/Tutorial/Tasks/ProgressFlagTask.cpp +common/Tutorial/Tasks/RideEntityTask.cpp +common/Tutorial/Tasks/StatTask.cpp +common/Tutorial/Tasks/TutorialTask.cpp +common/Tutorial/Tasks/UseItemTask.cpp +common/Tutorial/Tasks/UseTileTask.cpp +common/Tutorial/Tasks/XuiCraftingTask.cpp +common/Tutorial/Tutorial.cpp +common/Tutorial/TutorialMessage.cpp +common/Tutorial/TutorialMode.cpp +common/UI/All Platforms/ArchiveFile.cpp +common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +common/UI/All Platforms/IUIScene_AnvilMenu.cpp +common/UI/All Platforms/IUIScene_BeaconMenu.cpp +common/UI/All Platforms/IUIScene_BrewingMenu.cpp +common/UI/All Platforms/IUIScene_CommandBlockMenu.cpp +common/UI/All Platforms/IUIScene_ContainerMenu.cpp +common/UI/All Platforms/IUIScene_CraftingMenu.cpp +common/UI/All Platforms/IUIScene_CreativeMenu.cpp +common/UI/All Platforms/IUIScene_DispenserMenu.cpp +common/UI/All Platforms/IUIScene_EnchantingMenu.cpp +common/UI/All Platforms/IUIScene_FireworksMenu.cpp +common/UI/All Platforms/IUIScene_FurnaceMenu.cpp +common/UI/All Platforms/IUIScene_HUD.cpp +common/UI/All Platforms/IUIScene_HopperMenu.cpp +common/UI/All Platforms/IUIScene_HorseInventoryMenu.cpp +common/UI/All Platforms/IUIScene_InventoryMenu.cpp +common/UI/All Platforms/IUIScene_PauseMenu.cpp +common/UI/All Platforms/IUIScene_TradingMenu.cpp +common/UI/Components/UIComponent_Chat.cpp +common/UI/Components/UIComponent_DebugUIConsole.cpp +common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +common/UI/Components/UIComponent_Logo.cpp +common/UI/Components/UIComponent_MenuBackground.cpp +common/UI/Components/UIComponent_Panorama.cpp +common/UI/Components/UIComponent_PressStartToPlay.cpp +common/UI/Components/UIComponent_Tooltips.cpp +common/UI/Components/UIComponent_TutorialPopup.cpp +common/UI/Components/UIScene_HUD.cpp +common/UI/Controls/UIControl.cpp +common/UI/Controls/UIControl_Base.cpp +common/UI/Controls/UIControl_BeaconEffectButton.cpp +common/UI/Controls/UIControl_BitmapIcon.cpp +common/UI/Controls/UIControl_Button.cpp +common/UI/Controls/UIControl_ButtonList.cpp +common/UI/Controls/UIControl_CheckBox.cpp +common/UI/Controls/UIControl_Cursor.cpp +common/UI/Controls/UIControl_DLCList.cpp +common/UI/Controls/UIControl_DynamicLabel.cpp +common/UI/Controls/UIControl_EnchantmentBook.cpp +common/UI/Controls/UIControl_EnchantmentButton.cpp +common/UI/Controls/UIControl_HTMLLabel.cpp +common/UI/Controls/UIControl_Label.cpp +common/UI/Controls/UIControl_LeaderboardList.cpp +common/UI/Controls/UIControl_MinecraftHorse.cpp +common/UI/Controls/UIControl_MinecraftPlayer.cpp +common/UI/Controls/UIControl_PlayerList.cpp +common/UI/Controls/UIControl_PlayerSkinPreview.cpp +common/UI/Controls/UIControl_Progress.cpp +common/UI/Controls/UIControl_SaveList.cpp +common/UI/Controls/UIControl_Slider.cpp +common/UI/Controls/UIControl_SlotList.cpp +common/UI/Controls/UIControl_SpaceIndicatorBar.cpp +common/UI/Controls/UIControl_TextInput.cpp +common/UI/Controls/UIControl_TexturePackList.cpp +common/UI/Controls/UIControl_Touch.cpp +common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_DLCMainMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_DLCOffersMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp +common/UI/Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp +common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_Credits.cpp +common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AnvilMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp +common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp +common/UI/Scenes/UIScene_ConnectingProgress.cpp +common/UI/Scenes/UIScene_FullscreenProgress.cpp +common/UI/Scenes/UIScene_Keyboard.cpp +common/UI/Scenes/UIScene_MessageBox.cpp +common/UI/Scenes/UIScene_QuadrantSignin.cpp +common/UI/Scenes/UIScene_Timer.cpp +common/UI/UIBitmapFont.cpp +common/UI/UIController.cpp +common/UI/UIFontData.cpp +common/UI/UIGroup.cpp +common/UI/UILayer.cpp +common/UI/UIScene.cpp +common/UI/UIString.cpp +common/UI/UITTFFont.cpp +common/XboxStubs.cpp diff --git a/targets/app/linux_sources.txt b/targets/app/linux_sources.txt new file mode 100644 index 000000000..209dba15b --- /dev/null +++ b/targets/app/linux_sources.txt @@ -0,0 +1,5 @@ +linux/Iggy/gdraw/gdraw.c +linux/Leaderboards/LinuxLeaderboardManager.cpp +linux/LinuxGame.cpp +linux/Linux_Minecraft.cpp +linux/Linux_UIController.cpp diff --git a/targets/app/meson.build b/targets/app/meson.build index 7047eaef0..7fd687740 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -1,26 +1,11 @@ -exclude_platform_common_sources = [ - ' ! -name "UIScene_InGameSaveManagementMenu.cpp"', -] +# Source lists live in common_sources.txt / linux_sources.txt and are +# regenerated by scripts/list_sources.py whenever files are added or +# removed. +fs = import('fs') +platform_sources = files(fs.read('common_sources.txt').strip().split('\n')) -# all sources in common/ -platform_sources = run_command( - 'sh', - '-c', 'find "' - + meson.current_source_dir() / 'common' - + '" \\( -name "*.cpp" -o -name "*.c" \\)' - + ' '.join(exclude_platform_common_sources), - check: true, -).stdout().strip().split('\n') - -# linux-specific files if host_machine.system() == 'linux' - platform_sources += run_command( - 'sh', - '-c', 'find "' - + meson.current_source_dir() / 'linux' - + '" \\( -name "*.cpp" -o -name "*.c" \\) ', - check: true, - ).stdout().strip().split('\n') + platform_sources += files(fs.read('linux_sources.txt').strip().split('\n')) endif client_dependencies = [ diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index a01210c79..76e7f3fc6 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -1,33 +1,9 @@ -# sources that shouldn't be compiled for whatever reason -exclude_sources = [ - '! -name DurangoStats.cpp', # Durango-specific - - # Incomplete/Unused - '! -name SkyIslandDimension.cpp', - '! -name MemoryChunkStorage.cpp', - '! -name MemoryLevelStorage.cpp', - '! -name MemoryLevelStorageSource.cpp', - '! -name NbtSlotFile.cpp', - '! -name ZonedChunkStorage.cpp', - '! -name ZoneFile.cpp', - '! -name ZoneIo.cpp', - '! -name LevelConflictException.cpp', - '! -name "SurvivalMode.cpp"', - '! -name "CreativeMode.cpp"', - '! -name "GameMode.cpp"', - '! -name "DemoMode.cpp"', -] - -# GET IT ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL -# TODO: make this process more portable using a python script :3 -minecraft_sources = run_command( - 'sh', '-c', - 'find "' - + meson.current_source_dir() - + '" \\( -name "*.cpp" -o -name "*.c" \\) ' - + ' '.join(exclude_sources), - check : true, -).stdout().strip().split('\n') +# Source list lives in sources.txt and is regenerated by +# scripts/list_sources.py whenever files are added or removed. Reading +# the committed file means meson reconfigures only when the list itself +# changes, which is what we want. +fs = import('fs') +minecraft_sources = files(fs.read('sources.txt').strip().split('\n')) occlusion_mode = get_option('occlusion_culling') if occlusion_mode == 'off' diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt new file mode 100644 index 000000000..514d291a5 --- /dev/null +++ b/targets/minecraft/sources.txt @@ -0,0 +1,1052 @@ +Direction.cpp +Facing.cpp +GameHostOptions.cpp +IGameServices.cpp +Pos.cpp +SharedConstants.cpp +StaticConstructors.cpp +client/BufferedImage.cpp +client/Camera.cpp +client/ClientConstants.cpp +client/DemoUser.cpp +client/GuiMessage.cpp +client/KeyMapping.cpp +client/Lighting.cpp +client/MemoryTracker.cpp +client/Minecraft.cpp +client/Options.cpp +client/ProgressRenderer.cpp +client/Timer.cpp +client/User.cpp +client/gui/Button.cpp +client/gui/ChatScreen.cpp +client/gui/ConfirmScreen.cpp +client/gui/ControlsScreen.cpp +client/gui/CreateWorldScreen.cpp +client/gui/DeathScreen.cpp +client/gui/EditBox.cpp +client/gui/ErrorScreen.cpp +client/gui/Font.cpp +client/gui/Gui.cpp +client/gui/GuiComponent.cpp +client/gui/InBedChatScreen.cpp +client/gui/JoinMultiplayerScreen.cpp +client/gui/MessageScreen.cpp +client/gui/Minimap.cpp +client/gui/NameEntryScreen.cpp +client/gui/OptionsScreen.cpp +client/gui/PauseScreen.cpp +client/gui/RenameWorldScreen.cpp +client/gui/Screen.cpp +client/gui/ScreenSizeCalculator.cpp +client/gui/ScrolledSelectionList.cpp +client/gui/SelectWorldScreen.cpp +client/gui/SlideButton.cpp +client/gui/SmallButton.cpp +client/gui/TradeSwitchButton.cpp +client/gui/VideoSettingsScreen.cpp +client/gui/achievement/AchievementPopup.cpp +client/gui/achievement/AchievementScreen.cpp +client/gui/achievement/StatsScreen.cpp +client/gui/inventory/AbstractBeaconButton.cpp +client/gui/inventory/AbstractContainerScreen.cpp +client/gui/inventory/BeaconCancelButton.cpp +client/gui/inventory/BeaconConfirmButton.cpp +client/gui/inventory/BeaconPowerButton.cpp +client/gui/inventory/BeaconScreen.cpp +client/gui/inventory/BrewingStandScreen.cpp +client/gui/inventory/ContainerScreen.cpp +client/gui/inventory/CraftingScreen.cpp +client/gui/inventory/CreativeInventoryScreen.cpp +client/gui/inventory/EnchantmentScreen.cpp +client/gui/inventory/FurnaceScreen.cpp +client/gui/inventory/HopperScreen.cpp +client/gui/inventory/HorseInventoryScreen.cpp +client/gui/inventory/InventoryScreen.cpp +client/gui/inventory/MerchantScreen.cpp +client/gui/inventory/RepairScreen.cpp +client/gui/inventory/TextEditScreen.cpp +client/gui/inventory/TrapScreen.cpp +client/gui/particle/GuiParticle.cpp +client/gui/particle/GuiParticles.cpp +client/level/DemoLevel.cpp +client/model/BatModel.cpp +client/model/BlazeModel.cpp +client/model/BoatModel.cpp +client/model/BookModel.cpp +client/model/ChestModel.cpp +client/model/ChickenModel.cpp +client/model/CowModel.cpp +client/model/CreeperModel.cpp +client/model/EndermanModel.cpp +client/model/GhastModel.cpp +client/model/HumanoidModel.cpp +client/model/LargeChestModel.cpp +client/model/LavaSlimeModel.cpp +client/model/LeashKnotModel.cpp +client/model/MinecartModel.cpp +client/model/ModelHorse.cpp +client/model/OcelotModel.cpp +client/model/PigModel.cpp +client/model/Polygon.cpp +client/model/QuadrupedModel.cpp +client/model/SheepFurModel.cpp +client/model/SheepModel.cpp +client/model/SignModel.cpp +client/model/SilverfishModel.cpp +client/model/SkeletonHeadModel.cpp +client/model/SkeletonModel.cpp +client/model/SkiModel.cpp +client/model/SlimeModel.cpp +client/model/SnowManModel.cpp +client/model/SpiderModel.cpp +client/model/SquidModel.cpp +client/model/Vertex.cpp +client/model/VillagerGolemModel.cpp +client/model/VillagerModel.cpp +client/model/VillagerZombieModel.cpp +client/model/WitchModel.cpp +client/model/WitherBossModel.cpp +client/model/WolfModel.cpp +client/model/ZombieModel.cpp +client/model/dragon/DragonModel.cpp +client/model/dragon/EnderCrystalModel.cpp +client/model/geom/Cube.cpp +client/model/geom/Model.cpp +client/model/geom/ModelPart.cpp +client/model/geom/TexOffs.cpp +client/multiplayer/ClientConnection.cpp +client/multiplayer/ConnectScreen.cpp +client/multiplayer/DisconnectedScreen.cpp +client/multiplayer/MultiPlayerChunkCache.cpp +client/multiplayer/MultiPlayerGameMode.cpp +client/multiplayer/MultiPlayerLevel.cpp +client/multiplayer/MultiPlayerLocalPlayer.cpp +client/multiplayer/ReceivingLevelScreen.cpp +client/particle/BreakingItemParticle.cpp +client/particle/BubbleParticle.cpp +client/particle/CritParticle.cpp +client/particle/CritParticle2.cpp +client/particle/DragonBreathParticle.cpp +client/particle/DripParticle.cpp +client/particle/EnchantmentTableParticle.cpp +client/particle/EnderParticle.cpp +client/particle/ExplodeParticle.cpp +client/particle/FireworksParticles.cpp +client/particle/FlameParticle.cpp +client/particle/FootstepParticle.cpp +client/particle/HeartParticle.cpp +client/particle/HugeExplosionParticle.cpp +client/particle/HugeExplosionSeedParticle.cpp +client/particle/LavaParticle.cpp +client/particle/NetherPortalParticle.cpp +client/particle/NoteParticle.cpp +client/particle/Particle.cpp +client/particle/ParticleEngine.cpp +client/particle/PlayerCloudParticle.cpp +client/particle/RedDustParticle.cpp +client/particle/SmokeParticle.cpp +client/particle/SnowShovelParticle.cpp +client/particle/SpellParticle.cpp +client/particle/SplashParticle.cpp +client/particle/SuspendedParticle.cpp +client/particle/SuspendedTownParticle.cpp +client/particle/TakeAnimationParticle.cpp +client/particle/TerrainParticle.cpp +client/particle/WaterDropParticle.cpp +client/player/Input.cpp +client/player/LocalPlayer.cpp +client/player/RemotePlayer.cpp +client/renderer/BossMobGuiInfo.cpp +client/renderer/Chunk.cpp +client/renderer/DirtyChunkSorter.cpp +client/renderer/DistanceChunkSorter.cpp +client/renderer/EntityTileRenderer.cpp +client/renderer/GameRenderer.cpp +client/renderer/HttpTexture.cpp +client/renderer/ItemInHandRenderer.cpp +client/renderer/LevelRenderer.cpp +client/renderer/MemTexture.cpp +client/renderer/MobSkinMemTextureProcessor.cpp +client/renderer/MobSkinTextureProcessor.cpp +client/renderer/OffsettedRenderList.cpp +client/renderer/Rect2i.cpp +client/renderer/Tesselator.cpp +client/renderer/Textures.cpp +client/renderer/TileRenderer.cpp +client/renderer/culling/AllowAllCuller.cpp +client/renderer/culling/Frustum.cpp +client/renderer/culling/FrustumCuller.cpp +client/renderer/culling/FrustumData.cpp +client/renderer/culling/ViewportCuller.cpp +client/renderer/entity/ArrowRenderer.cpp +client/renderer/entity/BatRenderer.cpp +client/renderer/entity/BlazeRenderer.cpp +client/renderer/entity/BoatRenderer.cpp +client/renderer/entity/CaveSpiderRenderer.cpp +client/renderer/entity/ChickenRenderer.cpp +client/renderer/entity/CowRenderer.cpp +client/renderer/entity/CreeperRenderer.cpp +client/renderer/entity/DefaultRenderer.cpp +client/renderer/entity/EnderCrystalRenderer.cpp +client/renderer/entity/EnderDragonRenderer.cpp +client/renderer/entity/EndermanRenderer.cpp +client/renderer/entity/EntityRenderDispatcher.cpp +client/renderer/entity/EntityRenderer.cpp +client/renderer/entity/ExperienceOrbRenderer.cpp +client/renderer/entity/FallingTileRenderer.cpp +client/renderer/entity/FireballRenderer.cpp +client/renderer/entity/FishingHookRenderer.cpp +client/renderer/entity/GhastRenderer.cpp +client/renderer/entity/GiantMobRenderer.cpp +client/renderer/entity/HorseRenderer.cpp +client/renderer/entity/HumanoidMobRenderer.cpp +client/renderer/entity/ItemFrameRenderer.cpp +client/renderer/entity/ItemRenderer.cpp +client/renderer/entity/ItemSpriteRenderer.cpp +client/renderer/entity/LavaSlimeRenderer.cpp +client/renderer/entity/LeashKnotRenderer.cpp +client/renderer/entity/LightningBoltRenderer.cpp +client/renderer/entity/LivingEntityRenderer.cpp +client/renderer/entity/MinecartRenderer.cpp +client/renderer/entity/MinecartSpawnerRenderer.cpp +client/renderer/entity/MobRenderer.cpp +client/renderer/entity/MushroomCowRenderer.cpp +client/renderer/entity/OcelotRenderer.cpp +client/renderer/entity/PaintingRenderer.cpp +client/renderer/entity/PigRenderer.cpp +client/renderer/entity/PlayerRenderer.cpp +client/renderer/entity/SheepRenderer.cpp +client/renderer/entity/SilverfishRenderer.cpp +client/renderer/entity/SkeletonRenderer.cpp +client/renderer/entity/SlimeRenderer.cpp +client/renderer/entity/SnowManRenderer.cpp +client/renderer/entity/SpiderRenderer.cpp +client/renderer/entity/SquidRenderer.cpp +client/renderer/entity/TntMinecartRenderer.cpp +client/renderer/entity/TntRenderer.cpp +client/renderer/entity/VillagerGolemRenderer.cpp +client/renderer/entity/VillagerRenderer.cpp +client/renderer/entity/WitchRenderer.cpp +client/renderer/entity/WitherBossRenderer.cpp +client/renderer/entity/WitherSkullRenderer.cpp +client/renderer/entity/WolfRenderer.cpp +client/renderer/entity/ZombieRenderer.cpp +client/renderer/texture/PreStitchedTextureMap.cpp +client/renderer/texture/SimpleIcon.cpp +client/renderer/texture/StitchSlot.cpp +client/renderer/texture/StitchedTexture.cpp +client/renderer/texture/Stitcher.cpp +client/renderer/texture/Texture.cpp +client/renderer/texture/TextureAtlas.cpp +client/renderer/texture/TextureHolder.cpp +client/renderer/texture/TextureManager.cpp +client/renderer/texture/TextureMap.cpp +client/renderer/texture/custom/ClockTexture.cpp +client/renderer/texture/custom/CompassTexture.cpp +client/renderer/tileentity/BeaconRenderer.cpp +client/renderer/tileentity/ChestRenderer.cpp +client/renderer/tileentity/EnchantTableRenderer.cpp +client/renderer/tileentity/EnderChestRenderer.cpp +client/renderer/tileentity/MobSpawnerRenderer.cpp +client/renderer/tileentity/PistonPieceRenderer.cpp +client/renderer/tileentity/SignRenderer.cpp +client/renderer/tileentity/SkullTileRenderer.cpp +client/renderer/tileentity/TheEndPortalRenderer.cpp +client/renderer/tileentity/TileEntityRenderDispatcher.cpp +client/renderer/tileentity/TileEntityRenderer.cpp +client/skins/AbstractTexturePack.cpp +client/skins/DLCTexturePack.cpp +client/skins/DefaultTexturePack.cpp +client/skins/FileTexturePack.cpp +client/skins/FolderTexturePack.cpp +client/skins/TexturePack.cpp +client/skins/TexturePackRepository.cpp +client/title/TitleScreen.cpp +commands/Command.cpp +commands/CommandDispatcher.cpp +commands/common/DefaultGameModeCommand.cpp +commands/common/EffectCommand.cpp +commands/common/EnchantItemCommand.cpp +commands/common/ExperienceCommand.cpp +commands/common/GameModeCommand.cpp +commands/common/GiveItemCommand.cpp +commands/common/KillCommand.cpp +commands/common/TimeCommand.cpp +commands/common/ToggleDownfallCommand.cpp +core/AbstractProjectileDispenseBehavior.cpp +core/BehaviorRegistry.cpp +core/BlockSourceImpl.cpp +core/DefaultDispenseItemBehavior.cpp +core/DispenseItemBehavior.cpp +core/FacingEnum.cpp +core/ItemDispenseBehaviors.cpp +locale/I18n.cpp +locale/Language.cpp +network/Connection.cpp +network/packet/AddEntityPacket.cpp +network/packet/AddExperienceOrbPacket.cpp +network/packet/AddGlobalEntityPacket.cpp +network/packet/AddMobPacket.cpp +network/packet/AddPaintingPacket.cpp +network/packet/AddPlayerPacket.cpp +network/packet/AnimatePacket.cpp +network/packet/AwardStatPacket.cpp +network/packet/BlockRegionUpdatePacket.cpp +network/packet/ChatPacket.cpp +network/packet/ChunkTilesUpdatePacket.cpp +network/packet/ChunkVisibilityAreaPacket.cpp +network/packet/ChunkVisibilityPacket.cpp +network/packet/ClientCommandPacket.cpp +network/packet/ComplexItemDataPacket.cpp +network/packet/ContainerAckPacket.cpp +network/packet/ContainerButtonClickPacket.cpp +network/packet/ContainerClickPacket.cpp +network/packet/ContainerClosePacket.cpp +network/packet/ContainerOpenPacket.cpp +network/packet/ContainerSetContentPacket.cpp +network/packet/ContainerSetDataPacket.cpp +network/packet/ContainerSetSlotPacket.cpp +network/packet/CraftItemPacket.cpp +network/packet/CustomPayloadPacket.cpp +network/packet/DebugOptionsPacket.cpp +network/packet/DisconnectPacket.cpp +network/packet/EntityActionAtPositionPacket.cpp +network/packet/EntityEventPacket.cpp +network/packet/ExplodePacket.cpp +network/packet/GameCommandPacket.cpp +network/packet/GameEventPacket.cpp +network/packet/GetInfoPacket.cpp +network/packet/InteractPacket.cpp +network/packet/KeepAlivePacket.cpp +network/packet/KickPlayerPacket.cpp +network/packet/LevelEventPacket.cpp +network/packet/LevelParticlesPacket.cpp +network/packet/LevelSoundPacket.cpp +network/packet/LoginPacket.cpp +network/packet/MoveEntityPacket.cpp +network/packet/MoveEntityPacketSmall.cpp +network/packet/MovePlayerPacket.cpp +network/packet/Packet.cpp +network/packet/PacketListener.cpp +network/packet/PlayerAbilitiesPacket.cpp +network/packet/PlayerActionPacket.cpp +network/packet/PlayerCommandPacket.cpp +network/packet/PlayerInfoPacket.cpp +network/packet/PlayerInputPacket.cpp +network/packet/PreLoginPacket.cpp +network/packet/RemoveEntitiesPacket.cpp +network/packet/RemoveMobEffectPacket.cpp +network/packet/RespawnPacket.cpp +network/packet/RotateHeadPacket.cpp +network/packet/ServerSettingsChangedPacket.cpp +network/packet/SetCarriedItemPacket.cpp +network/packet/SetCreativeModeSlotPacket.cpp +network/packet/SetDisplayObjectivePacket.cpp +network/packet/SetEntityDataPacket.cpp +network/packet/SetEntityLinkPacket.cpp +network/packet/SetEntityMotionPacket.cpp +network/packet/SetEquippedItemPacket.cpp +network/packet/SetExperiencePacket.cpp +network/packet/SetHealthPacket.cpp +network/packet/SetObjectivePacket.cpp +network/packet/SetPlayerTeamPacket.cpp +network/packet/SetScorePacket.cpp +network/packet/SetSpawnPositionPacket.cpp +network/packet/SetTimePacket.cpp +network/packet/SignUpdatePacket.cpp +network/packet/TakeItemEntityPacket.cpp +network/packet/TeleportEntityPacket.cpp +network/packet/TextureAndGeometryChangePacket.cpp +network/packet/TextureAndGeometryPacket.cpp +network/packet/TextureChangePacket.cpp +network/packet/TexturePacket.cpp +network/packet/TileDestructionPacket.cpp +network/packet/TileEditorOpenPacket.cpp +network/packet/TileEntityDataPacket.cpp +network/packet/TileEventPacket.cpp +network/packet/TileUpdatePacket.cpp +network/packet/TradeItemPacket.cpp +network/packet/UpdateAttributesPacket.cpp +network/packet/UpdateGameRuleProgressPacket.cpp +network/packet/UpdateMobEffectPacket.cpp +network/packet/UpdateProgressPacket.cpp +network/packet/UseItemPacket.cpp +network/packet/XZPacket.cpp +server/ConsoleInput.cpp +server/DispenserBootstrap.cpp +server/MinecraftServer.cpp +server/PlayerList.cpp +server/ServerScoreboard.cpp +server/Settings.cpp +server/commands/ServerCommandDispatcher.cpp +server/commands/TeleportCommand.cpp +server/level/DerivedServerLevel.cpp +server/level/EntityTracker.cpp +server/level/PlayerChunkMap.cpp +server/level/ServerChunkCache.cpp +server/level/ServerLevel.cpp +server/level/ServerLevelListener.cpp +server/level/ServerPlayer.cpp +server/level/ServerPlayerGameMode.cpp +server/level/TrackedEntity.cpp +server/network/PendingConnection.cpp +server/network/PlayerConnection.cpp +server/network/ServerConnection.cpp +stats/Achievement.cpp +stats/Achievements.cpp +stats/CommonStats.cpp +stats/GeneralStat.cpp +stats/GenericStats.cpp +stats/ItemStat.cpp +stats/Stat.cpp +stats/Stats.cpp +stats/StatsCounter.cpp +stats/StatsSyncer.cpp +util/Hasher.cpp +util/HtmlString.cpp +util/Mth.cpp +util/SmoothFloat.cpp +util/WeighedRandom.cpp +util/WeighedTreasure.cpp +world/CompoundContainer.cpp +world/FlippedIcon.cpp +world/SimpleContainer.cpp +world/damageSource/CombatEntry.cpp +world/damageSource/CombatTracker.cpp +world/damageSource/DamageSource.cpp +world/damageSource/EntityDamageSource.cpp +world/damageSource/IndirectEntityDamageSource.cpp +world/effect/AbsoptionMobEffect.cpp +world/effect/AttackDamageMobEffect.cpp +world/effect/HealthBoostMobEffect.cpp +world/effect/InstantaneousMobEffect.cpp +world/effect/MobEffect.cpp +world/effect/MobEffectInstance.cpp +world/entity/AgeableMob.cpp +world/entity/Creature.cpp +world/entity/DelayedRelease.cpp +world/entity/Entity.cpp +world/entity/EntityIO.cpp +world/entity/EntityPos.cpp +world/entity/EntitySelector.cpp +world/entity/ExperienceOrb.cpp +world/entity/FlyingMob.cpp +world/entity/HangingEntity.cpp +world/entity/ItemFrame.cpp +world/entity/LeashFenceKnotEntity.cpp +world/entity/LivingEntity.cpp +world/entity/Mob.cpp +world/entity/MobCategory.cpp +world/entity/Painting.cpp +world/entity/PathfinderMob.cpp +world/entity/SyncedEntityData.cpp +world/entity/TamableAnimal.cpp +world/entity/ai/attributes/Attribute.cpp +world/entity/ai/attributes/AttributeModifier.cpp +world/entity/ai/attributes/BaseAttribute.cpp +world/entity/ai/attributes/BaseAttributeMap.cpp +world/entity/ai/attributes/ModifiableAttributeInstance.cpp +world/entity/ai/attributes/RangedAttribute.cpp +world/entity/ai/attributes/ServersideAttributeMap.cpp +world/entity/ai/control/BodyControl.cpp +world/entity/ai/control/JumpControl.cpp +world/entity/ai/control/LookControl.cpp +world/entity/ai/control/MoveControl.cpp +world/entity/ai/goal/AvoidPlayerGoal.cpp +world/entity/ai/goal/BegGoal.cpp +world/entity/ai/goal/BreakDoorGoal.cpp +world/entity/ai/goal/BreedGoal.cpp +world/entity/ai/goal/ControlledByPlayerGoal.cpp +world/entity/ai/goal/DoorInteractGoal.cpp +world/entity/ai/goal/EatTileGoal.cpp +world/entity/ai/goal/FleeSunGoal.cpp +world/entity/ai/goal/FloatGoal.cpp +world/entity/ai/goal/FollowOwnerGoal.cpp +world/entity/ai/goal/FollowParentGoal.cpp +world/entity/ai/goal/Goal.cpp +world/entity/ai/goal/GoalSelector.cpp +world/entity/ai/goal/InteractGoal.cpp +world/entity/ai/goal/LeapAtTargetGoal.cpp +world/entity/ai/goal/LookAtPlayerGoal.cpp +world/entity/ai/goal/LookAtTradingPlayerGoal.cpp +world/entity/ai/goal/MakeLoveGoal.cpp +world/entity/ai/goal/MeleeAttackGoal.cpp +world/entity/ai/goal/MoveIndoorsGoal.cpp +world/entity/ai/goal/MoveThroughVillageGoal.cpp +world/entity/ai/goal/MoveTowardsRestrictionGoal.cpp +world/entity/ai/goal/MoveTowardsTargetGoal.cpp +world/entity/ai/goal/OcelotAttackGoal.cpp +world/entity/ai/goal/OcelotSitOnTileGoal.cpp +world/entity/ai/goal/OfferFlowerGoal.cpp +world/entity/ai/goal/OpenDoorGoal.cpp +world/entity/ai/goal/PanicGoal.cpp +world/entity/ai/goal/PlayGoal.cpp +world/entity/ai/goal/RandomLookAroundGoal.cpp +world/entity/ai/goal/RandomStrollGoal.cpp +world/entity/ai/goal/RangedAttackGoal.cpp +world/entity/ai/goal/RestrictOpenDoorGoal.cpp +world/entity/ai/goal/RestrictSunGoal.cpp +world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp +world/entity/ai/goal/SitGoal.cpp +world/entity/ai/goal/SwellGoal.cpp +world/entity/ai/goal/TakeFlowerGoal.cpp +world/entity/ai/goal/TemptGoal.cpp +world/entity/ai/goal/TradeWithPlayerGoal.cpp +world/entity/ai/goal/target/DefendVillageTargetGoal.cpp +world/entity/ai/goal/target/HurtByTargetGoal.cpp +world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp +world/entity/ai/goal/target/NonTameRandomTargetGoal.cpp +world/entity/ai/goal/target/OwnerHurtByTargetGoal.cpp +world/entity/ai/goal/target/OwnerHurtTargetGoal.cpp +world/entity/ai/goal/target/TargetGoal.cpp +world/entity/ai/navigation/PathNavigation.cpp +world/entity/ai/sensing/Sensing.cpp +world/entity/ai/util/RandomPos.cpp +world/entity/ai/village/DoorInfo.cpp +world/entity/ai/village/Village.cpp +world/entity/ai/village/VillageSiege.cpp +world/entity/ai/village/Villages.cpp +world/entity/ambient/AmbientCreature.cpp +world/entity/ambient/Bat.cpp +world/entity/animal/Animal.cpp +world/entity/animal/Chicken.cpp +world/entity/animal/Cow.cpp +world/entity/animal/EntityHorse.cpp +world/entity/animal/Golem.cpp +world/entity/animal/MushroomCow.cpp +world/entity/animal/Ocelot.cpp +world/entity/animal/Pig.cpp +world/entity/animal/Sheep.cpp +world/entity/animal/SnowMan.cpp +world/entity/animal/Squid.cpp +world/entity/animal/VillagerGolem.cpp +world/entity/animal/WaterAnimal.cpp +world/entity/animal/Wolf.cpp +world/entity/boss/MultiEntityMobPart.cpp +world/entity/boss/enderdragon/EnderCrystal.cpp +world/entity/boss/enderdragon/EnderDragon.cpp +world/entity/boss/wither/WitherBoss.cpp +world/entity/global/GlobalEntity.cpp +world/entity/global/LightningBolt.cpp +world/entity/item/Boat.cpp +world/entity/item/FallingTile.cpp +world/entity/item/ItemEntity.cpp +world/entity/item/Minecart.cpp +world/entity/item/MinecartChest.cpp +world/entity/item/MinecartContainer.cpp +world/entity/item/MinecartFurnace.cpp +world/entity/item/MinecartHopper.cpp +world/entity/item/MinecartRideable.cpp +world/entity/item/MinecartSpawner.cpp +world/entity/item/MinecartTNT.cpp +world/entity/item/PrimedTnt.cpp +world/entity/monster/Blaze.cpp +world/entity/monster/CaveSpider.cpp +world/entity/monster/Creeper.cpp +world/entity/monster/EnderMan.cpp +world/entity/monster/Enemy.cpp +world/entity/monster/Ghast.cpp +world/entity/monster/Giant.cpp +world/entity/monster/LavaSlime.cpp +world/entity/monster/Monster.cpp +world/entity/monster/PigZombie.cpp +world/entity/monster/SharedMonsterAttributes.cpp +world/entity/monster/Silverfish.cpp +world/entity/monster/Skeleton.cpp +world/entity/monster/Slime.cpp +world/entity/monster/Spider.cpp +world/entity/monster/Witch.cpp +world/entity/monster/Zombie.cpp +world/entity/npc/ClientSideMerchant.cpp +world/entity/npc/Npc.cpp +world/entity/npc/Villager.cpp +world/entity/player/Abilities.cpp +world/entity/player/Inventory.cpp +world/entity/player/Player.cpp +world/entity/projectile/Arrow.cpp +world/entity/projectile/DragonFireball.cpp +world/entity/projectile/EyeOfEnderSignal.cpp +world/entity/projectile/Fireball.cpp +world/entity/projectile/FireworksRocketEntity.cpp +world/entity/projectile/FishingHook.cpp +world/entity/projectile/LargeFireball.cpp +world/entity/projectile/SmallFireball.cpp +world/entity/projectile/Snowball.cpp +world/entity/projectile/Throwable.cpp +world/entity/projectile/ThrownEgg.cpp +world/entity/projectile/ThrownEnderpearl.cpp +world/entity/projectile/ThrownExpBottle.cpp +world/entity/projectile/ThrownPotion.cpp +world/entity/projectile/WitherSkull.cpp +world/food/FoodConstants.cpp +world/food/FoodData.cpp +world/inventory/AbstractContainerMenu.cpp +world/inventory/AnimalChest.cpp +world/inventory/AnvilMenu.cpp +world/inventory/ArmorSlot.cpp +world/inventory/BeaconMenu.cpp +world/inventory/BrewingStandMenu.cpp +world/inventory/ContainerMenu.cpp +world/inventory/CraftingContainer.cpp +world/inventory/CraftingMenu.cpp +world/inventory/EnchantmentContainer.cpp +world/inventory/EnchantmentMenu.cpp +world/inventory/FireworksMenu.cpp +world/inventory/FurnaceMenu.cpp +world/inventory/FurnaceResultSlot.cpp +world/inventory/HopperMenu.cpp +world/inventory/HorseInventoryMenu.cpp +world/inventory/InventoryMenu.cpp +world/inventory/MenuBackup.cpp +world/inventory/MerchantContainer.cpp +world/inventory/MerchantMenu.cpp +world/inventory/MerchantResultSlot.cpp +world/inventory/PlayerEnderChestContainer.cpp +world/inventory/RepairContainer.cpp +world/inventory/RepairResultSlot.cpp +world/inventory/ResultContainer.cpp +world/inventory/ResultSlot.cpp +world/inventory/Slot.cpp +world/inventory/TrapMenu.cpp +world/item/AnvilTileItem.cpp +world/item/ArmorItem.cpp +world/item/AuxDataTileItem.cpp +world/item/BedItem.cpp +world/item/BoatItem.cpp +world/item/BookItem.cpp +world/item/BottleItem.cpp +world/item/BowItem.cpp +world/item/BowlFoodItem.cpp +world/item/BucketItem.cpp +world/item/CarrotOnAStickItem.cpp +world/item/ClockItem.cpp +world/item/CoalItem.cpp +world/item/ColoredTileItem.cpp +world/item/CompassItem.cpp +world/item/ComplexItem.cpp +world/item/DiggerItem.cpp +world/item/DoorItem.cpp +world/item/DyePowderItem.cpp +world/item/EggItem.cpp +world/item/EmptyMapItem.cpp +world/item/EnchantedBookItem.cpp +world/item/EnderEyeItem.cpp +world/item/EnderpearlItem.cpp +world/item/ExperienceItem.cpp +world/item/FireChargeItem.cpp +world/item/FireworksChargeItem.cpp +world/item/FireworksItem.cpp +world/item/FishingRodItem.cpp +world/item/FlintAndSteelItem.cpp +world/item/FoodItem.cpp +world/item/GoldenAppleItem.cpp +world/item/HangingEntityItem.cpp +world/item/HatchetItem.cpp +world/item/HoeItem.cpp +world/item/Item.cpp +world/item/ItemInstance.cpp +world/item/LeafTileItem.cpp +world/item/LeashItem.cpp +world/item/MapItem.cpp +world/item/MilkBucketItem.cpp +world/item/MinecartItem.cpp +world/item/MultiTextureTileItem.cpp +world/item/NameTagItem.cpp +world/item/PickaxeItem.cpp +world/item/PistonTileItem.cpp +world/item/PlanterTileItem.cpp +world/item/PotionItem.cpp +world/item/Rarity.cpp +world/item/RecordingItem.cpp +world/item/RedStoneItem.cpp +world/item/SaddleItem.cpp +world/item/SaplingTileItem.cpp +world/item/SeedFoodItem.cpp +world/item/SeedItem.cpp +world/item/ShearsItem.cpp +world/item/ShovelItem.cpp +world/item/SignItem.cpp +world/item/SimpleFoiledItem.cpp +world/item/SkullItem.cpp +world/item/SnowItem.cpp +world/item/SnowballItem.cpp +world/item/SpawnEggItem.cpp +world/item/StoneSlabTileItem.cpp +world/item/TileItem.cpp +world/item/WaterLilyTileItem.cpp +world/item/WeaponItem.cpp +world/item/WoolTileItem.cpp +world/item/alchemy/PotionBrewing.cpp +world/item/crafting/ArmorDyeRecipe.cpp +world/item/crafting/ArmorRecipes.cpp +world/item/crafting/ClothDyeRecipes.cpp +world/item/crafting/FireworksRecipe.cpp +world/item/crafting/FoodRecipes.cpp +world/item/crafting/FurnaceRecipes.cpp +world/item/crafting/OreRecipes.cpp +world/item/crafting/Recipes.cpp +world/item/crafting/ShapedRecipy.cpp +world/item/crafting/ShapelessRecipy.cpp +world/item/crafting/StructureRecipes.cpp +world/item/crafting/ToolRecipes.cpp +world/item/crafting/WeaponRecipes.cpp +world/item/enchantment/ArrowDamageEnchantment.cpp +world/item/enchantment/ArrowFireEnchantment.cpp +world/item/enchantment/ArrowInfiniteEnchantment.cpp +world/item/enchantment/ArrowKnockbackEnchantment.cpp +world/item/enchantment/DamageEnchantment.cpp +world/item/enchantment/DigDurabilityEnchantment.cpp +world/item/enchantment/DiggingEnchantment.cpp +world/item/enchantment/Enchantment.cpp +world/item/enchantment/EnchantmentCategory.cpp +world/item/enchantment/EnchantmentHelper.cpp +world/item/enchantment/EnchantmentInstance.cpp +world/item/enchantment/FireAspectEnchantment.cpp +world/item/enchantment/KnockbackEnchantment.cpp +world/item/enchantment/LootBonusEnchantment.cpp +world/item/enchantment/OxygenEnchantment.cpp +world/item/enchantment/ProtectionEnchantment.cpp +world/item/enchantment/ThornsEnchantment.cpp +world/item/enchantment/UntouchingEnchantment.cpp +world/item/enchantment/WaterWorkerEnchantment.cpp +world/item/trading/MerchantRecipe.cpp +world/item/trading/MerchantRecipeList.cpp +world/level/BaseMobSpawner.cpp +world/level/BlockDestructionProgress.cpp +world/level/Calendar.cpp +world/level/ChunkPos.cpp +world/level/Explosion.cpp +world/level/FoliageColor.cpp +world/level/GameRules.cpp +world/level/GrassColor.cpp +world/level/Level.cpp +world/level/LevelSettings.cpp +world/level/LevelType.cpp +world/level/MobSpawner.cpp +world/level/PortalForcer.cpp +world/level/Region.cpp +world/level/TickNextTickData.cpp +world/level/TileEventData.cpp +world/level/TilePos.cpp +world/level/WaterColor.cpp +world/level/biome/BeachBiome.cpp +world/level/biome/Biome.cpp +world/level/biome/BiomeCache.cpp +world/level/biome/BiomeDecorator.cpp +world/level/biome/BiomeSource.cpp +world/level/biome/DesertBiome.cpp +world/level/biome/ExtremeHillsBiome.cpp +world/level/biome/FixedBiomeSource.cpp +world/level/biome/ForestBiome.cpp +world/level/biome/HellBiome.cpp +world/level/biome/IceBiome.cpp +world/level/biome/JungleBiome.cpp +world/level/biome/MushroomIslandBiome.cpp +world/level/biome/PlainsBiome.cpp +world/level/biome/RainforestBiome.cpp +world/level/biome/SwampBiome.cpp +world/level/biome/TaigaBiome.cpp +world/level/biome/TheEndBiome.cpp +world/level/biome/TheEndBiomeDecorator.cpp +world/level/biome/WaterlilyFeature.cpp +world/level/chunk/BlockReplacements.cpp +world/level/chunk/CompressedTileStorage.cpp +world/level/chunk/DataLayer.cpp +world/level/chunk/EmptyLevelChunk.cpp +world/level/chunk/LevelChunk.cpp +world/level/chunk/ReadOnlyChunkCache.cpp +world/level/chunk/SparseDataStorage.cpp +world/level/chunk/SparseLightStorage.cpp +world/level/chunk/WaterLevelChunk.cpp +world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +world/level/chunk/storage/McRegionChunkStorage.cpp +world/level/chunk/storage/OldChunkStorage.cpp +world/level/chunk/storage/RegionFile.cpp +world/level/chunk/storage/RegionFileCache.cpp +world/level/dimension/Dimension.cpp +world/level/dimension/HellDimension.cpp +world/level/dimension/TheEndDimension.cpp +world/level/levelgen/CanyonFeature.cpp +world/level/levelgen/CustomLevelSource.cpp +world/level/levelgen/DungeonFeature.cpp +world/level/levelgen/FlatLevelSource.cpp +world/level/levelgen/HellFlatLevelSource.cpp +world/level/levelgen/HellRandomLevelSource.cpp +world/level/levelgen/LargeCaveFeature.cpp +world/level/levelgen/LargeFeature.cpp +world/level/levelgen/LargeHellCaveFeature.cpp +world/level/levelgen/RandomLevelSource.cpp +world/level/levelgen/TheEndLevelRandomLevelSource.cpp +world/level/levelgen/feature/BasicTreeFeature.cpp +world/level/levelgen/feature/BirchFeature.cpp +world/level/levelgen/feature/BonusChestFeature.cpp +world/level/levelgen/feature/CactusFeature.cpp +world/level/levelgen/feature/CaveFeature.cpp +world/level/levelgen/feature/ClayFeature.cpp +world/level/levelgen/feature/DeadBushFeature.cpp +world/level/levelgen/feature/DesertWellFeature.cpp +world/level/levelgen/feature/EndPodiumFeature.cpp +world/level/levelgen/feature/Feature.cpp +world/level/levelgen/feature/FlowerFeature.cpp +world/level/levelgen/feature/GroundBushFeature.cpp +world/level/levelgen/feature/HellFireFeature.cpp +world/level/levelgen/feature/HellPortalFeature.cpp +world/level/levelgen/feature/HellSpringFeature.cpp +world/level/levelgen/feature/HouseFeature.cpp +world/level/levelgen/feature/HugeMushroomFeature.cpp +world/level/levelgen/feature/LakeFeature.cpp +world/level/levelgen/feature/LightGemFeature.cpp +world/level/levelgen/feature/MegaTreeFeature.cpp +world/level/levelgen/feature/MonsterRoomFeature.cpp +world/level/levelgen/feature/NetherSphereFeature.cpp +world/level/levelgen/feature/OreFeature.cpp +world/level/levelgen/feature/PineFeature.cpp +world/level/levelgen/feature/PumpkinFeature.cpp +world/level/levelgen/feature/ReedsFeature.cpp +world/level/levelgen/feature/SandFeature.cpp +world/level/levelgen/feature/SpikeFeature.cpp +world/level/levelgen/feature/SpringFeature.cpp +world/level/levelgen/feature/SpruceFeature.cpp +world/level/levelgen/feature/SwampTreeFeature.cpp +world/level/levelgen/feature/TallGrassFeature.cpp +world/level/levelgen/feature/TreeFeature.cpp +world/level/levelgen/feature/VinesFeature.cpp +world/level/levelgen/flat/FlatGeneratorInfo.cpp +world/level/levelgen/flat/FlatLayerInfo.cpp +world/level/levelgen/structure/BlockGenMethods.cpp +world/level/levelgen/structure/BoundingBox.cpp +world/level/levelgen/structure/MineShaftFeature.cpp +world/level/levelgen/structure/MineShaftPieces.cpp +world/level/levelgen/structure/MineShaftStart.cpp +world/level/levelgen/structure/NetherBridgeFeature.cpp +world/level/levelgen/structure/NetherBridgePieces.cpp +world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +world/level/levelgen/structure/ScatteredFeaturePieces.cpp +world/level/levelgen/structure/StrongholdFeature.cpp +world/level/levelgen/structure/StrongholdPieces.cpp +world/level/levelgen/structure/StructureFeature.cpp +world/level/levelgen/structure/StructureFeatureIO.cpp +world/level/levelgen/structure/StructureFeatureSavedData.cpp +world/level/levelgen/structure/StructurePiece.cpp +world/level/levelgen/structure/StructureStart.cpp +world/level/levelgen/structure/VillageFeature.cpp +world/level/levelgen/structure/VillagePieces.cpp +world/level/levelgen/synth/Distort.cpp +world/level/levelgen/synth/Emboss.cpp +world/level/levelgen/synth/FastNoise.cpp +world/level/levelgen/synth/ImprovedNoise.cpp +world/level/levelgen/synth/PerlinNoise.cpp +world/level/levelgen/synth/PerlinSimplexNoise.cpp +world/level/levelgen/synth/Rotate.cpp +world/level/levelgen/synth/Scale.cpp +world/level/levelgen/synth/SimplexNoise.cpp +world/level/levelgen/synth/Synth.cpp +world/level/material/Material.cpp +world/level/material/MaterialColor.cpp +world/level/newbiome/layer/AddIslandLayer.cpp +world/level/newbiome/layer/AddMushroomIslandLayer.cpp +world/level/newbiome/layer/AddSnowLayer.cpp +world/level/newbiome/layer/BiomeInitLayer.cpp +world/level/newbiome/layer/BiomeOverrideLayer.cpp +world/level/newbiome/layer/DownfallLayer.cpp +world/level/newbiome/layer/DownfallMixerLayer.cpp +world/level/newbiome/layer/FlatLayer.cpp +world/level/newbiome/layer/FuzzyZoomLayer.cpp +world/level/newbiome/layer/GrowMushroomIslandLayer.cpp +world/level/newbiome/layer/IslandLayer.cpp +world/level/newbiome/layer/Layer.cpp +world/level/newbiome/layer/RegionHillsLayer.cpp +world/level/newbiome/layer/RiverInitLayer.cpp +world/level/newbiome/layer/RiverLayer.cpp +world/level/newbiome/layer/RiverMixerLayer.cpp +world/level/newbiome/layer/ShoreLayer.cpp +world/level/newbiome/layer/SmoothLayer.cpp +world/level/newbiome/layer/SmoothZoomLayer.cpp +world/level/newbiome/layer/SwampRiversLayer.cpp +world/level/newbiome/layer/TemperatureLayer.cpp +world/level/newbiome/layer/TemperatureMixerLayer.cpp +world/level/newbiome/layer/VoronoiZoom.cpp +world/level/newbiome/layer/ZoomLayer.cpp +world/level/pathfinder/BinaryHeap.cpp +world/level/pathfinder/Node.cpp +world/level/pathfinder/Path.cpp +world/level/pathfinder/PathFinder.cpp +world/level/redstone/Redstone.cpp +world/level/saveddata/MapItemSavedData.cpp +world/level/saveddata/SavedData.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileInputStream.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOutputStream.cpp +world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +world/level/storage/ConsoleSaveFileIO/compression.cpp +world/level/storage/DerivedLevelData.cpp +world/level/storage/DirectoryLevelStorage.cpp +world/level/storage/DirectoryLevelStorageSource.cpp +world/level/storage/LevelData.cpp +world/level/storage/LevelStorage.cpp +world/level/storage/LevelStorageProfilerDecorator.cpp +world/level/storage/LevelSummary.cpp +world/level/storage/McRegionLevelStorage.cpp +world/level/storage/McRegionLevelStorageSource.cpp +world/level/storage/MockedLevelStorage.cpp +world/level/storage/SavedDataStorage.cpp +world/level/tile/AirTile.cpp +world/level/tile/AnvilTile.cpp +world/level/tile/BaseEntityTile.cpp +world/level/tile/BasePressurePlateTile.cpp +world/level/tile/BaseRailTile.cpp +world/level/tile/BeaconTile.cpp +world/level/tile/BedTile.cpp +world/level/tile/BookshelfTile.cpp +world/level/tile/BrewingStandTile.cpp +world/level/tile/ButtonTile.cpp +world/level/tile/CactusTile.cpp +world/level/tile/CakeTile.cpp +world/level/tile/CarrotTile.cpp +world/level/tile/CauldronTile.cpp +world/level/tile/ChestTile.cpp +world/level/tile/ClayTile.cpp +world/level/tile/CocoaTile.cpp +world/level/tile/ColoredTile.cpp +world/level/tile/CommandBlock.cpp +world/level/tile/ComparatorTile.cpp +world/level/tile/CoralTile.cpp +world/level/tile/CropTile.cpp +world/level/tile/DaylightDetectorTile.cpp +world/level/tile/DeadBushTile.cpp +world/level/tile/DetectorRailTile.cpp +world/level/tile/DiodeTile.cpp +world/level/tile/DirectionalTile.cpp +world/level/tile/DirtTile.cpp +world/level/tile/DispenserTile.cpp +world/level/tile/DoorTile.cpp +world/level/tile/DropperTile.cpp +world/level/tile/EggTile.cpp +world/level/tile/EnchantmentTableTile.cpp +world/level/tile/EnderChestTile.cpp +world/level/tile/FarmTile.cpp +world/level/tile/FenceGateTile.cpp +world/level/tile/FenceTile.cpp +world/level/tile/FireTile.cpp +world/level/tile/FlowerPotTile.cpp +world/level/tile/FurnaceTile.cpp +world/level/tile/GlassTile.cpp +world/level/tile/GlowstoneTile.cpp +world/level/tile/GrassTile.cpp +world/level/tile/GravelTile.cpp +world/level/tile/HalfSlabTile.cpp +world/level/tile/HalfTransparentTile.cpp +world/level/tile/HayBlockTile.cpp +world/level/tile/HeavyTile.cpp +world/level/tile/HopperTile.cpp +world/level/tile/HugeMushroomTile.cpp +world/level/tile/IceTile.cpp +world/level/tile/JukeboxTile.cpp +world/level/tile/LadderTile.cpp +world/level/tile/LeafTile.cpp +world/level/tile/LeverTile.cpp +world/level/tile/LiquidTile.cpp +world/level/tile/LiquidTileDynamic.cpp +world/level/tile/LiquidTileStatic.cpp +world/level/tile/LockedChestTile.cpp +world/level/tile/MelonTile.cpp +world/level/tile/MetalTile.cpp +world/level/tile/MobSpawnerTile.cpp +world/level/tile/MushroomPlantTile.cpp +world/level/tile/MycelTile.cpp +world/level/tile/NetherWartTile.cpp +world/level/tile/NetherrackTile.cpp +world/level/tile/NotGateTile.cpp +world/level/tile/NoteBlockTile.cpp +world/level/tile/ObsidianTile.cpp +world/level/tile/OreTile.cpp +world/level/tile/PlantTile.cpp +world/level/tile/PortalTile.cpp +world/level/tile/PotatoTile.cpp +world/level/tile/PoweredMetalTile.cpp +world/level/tile/PoweredRailTile.cpp +world/level/tile/PressurePlateTile.cpp +world/level/tile/PumpkinTile.cpp +world/level/tile/QuartzBlockTile.cpp +world/level/tile/RailTile.cpp +world/level/tile/RedStoneDustTile.cpp +world/level/tile/RedStoneOreTile.cpp +world/level/tile/RedlightTile.cpp +world/level/tile/ReedTile.cpp +world/level/tile/RepeaterTile.cpp +world/level/tile/RotatedPillarTile.cpp +world/level/tile/SandStoneTile.cpp +world/level/tile/SaplingPlantTile.cpp +world/level/tile/SignTile.cpp +world/level/tile/SkullTile.cpp +world/level/tile/SmoothStoneBrickTile.cpp +world/level/tile/SnowTile.cpp +world/level/tile/SoulSandTile.cpp +world/level/tile/SpongeTile.cpp +world/level/tile/StainedGlassBlock.cpp +world/level/tile/StainedGlassPaneBlock.cpp +world/level/tile/StairTile.cpp +world/level/tile/StemTile.cpp +world/level/tile/StoneButtonTile.cpp +world/level/tile/StoneMonsterTile.cpp +world/level/tile/StoneSlabTile.cpp +world/level/tile/StoneTile.cpp +world/level/tile/TallGrassPlantTile.cpp +world/level/tile/TheEndPortalFrameTile.cpp +world/level/tile/ThinFenceTile.cpp +world/level/tile/Tile.cpp +world/level/tile/TntTile.cpp +world/level/tile/TopSnowTile.cpp +world/level/tile/TorchTile.cpp +world/level/tile/TransparentTile.cpp +world/level/tile/TrapDoorTile.cpp +world/level/tile/TreeTile.cpp +world/level/tile/TripWireSourceTile.cpp +world/level/tile/TripWireTile.cpp +world/level/tile/VineTile.cpp +world/level/tile/WallTile.cpp +world/level/tile/WaterLilyTile.cpp +world/level/tile/WebTile.cpp +world/level/tile/WeightedPressurePlateTile.cpp +world/level/tile/WoodButtonTile.cpp +world/level/tile/WoodSlabTile.cpp +world/level/tile/WoodTile.cpp +world/level/tile/WoolCarpetTile.cpp +world/level/tile/WorkbenchTile.cpp +world/level/tile/entity/BeaconTileEntity.cpp +world/level/tile/entity/BrewingStandTileEntity.cpp +world/level/tile/entity/ChestTileEntity.cpp +world/level/tile/entity/CommandBlockEntity.cpp +world/level/tile/entity/ComparatorTileEntity.cpp +world/level/tile/entity/DaylightDetectorTileEntity.cpp +world/level/tile/entity/DispenserTileEntity.cpp +world/level/tile/entity/DropperTileEntity.cpp +world/level/tile/entity/EnchantmentTableTileEntity.cpp +world/level/tile/entity/EnderChestTileEntity.cpp +world/level/tile/entity/FurnaceTileEntity.cpp +world/level/tile/entity/HopperTileEntity.cpp +world/level/tile/entity/MobSpawnerTileEntity.cpp +world/level/tile/entity/MusicTileEntity.cpp +world/level/tile/entity/PistonMovingTileEntity.cpp +world/level/tile/entity/PistonPieceTileEntity.cpp +world/level/tile/entity/SignTileEntity.cpp +world/level/tile/entity/SkullTileEntity.cpp +world/level/tile/entity/TheEndPortalTile.cpp +world/level/tile/entity/TheEndPortalTileEntity.cpp +world/level/tile/entity/TileEntity.cpp +world/level/tile/piston/PistonBaseTile.cpp +world/level/tile/piston/PistonExtensionTile.cpp +world/phys/AABB.cpp +world/phys/HitResult.cpp +world/phys/Vec3.cpp +world/scores/Objective.cpp +world/scores/PlayerTeam.cpp +world/scores/Score.cpp +world/scores/Scoreboard.cpp +world/scores/Team.cpp +world/scores/criteria/DummyCriteria.cpp +world/scores/criteria/HealthCriteria.cpp +world/scores/criteria/ObjectiveCriteria.cpp From 8084ec7857d049d57c0788b12532aa0c6df56201 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:23:56 +1000 Subject: [PATCH 005/104] chore: delete unused IPlatformUIController and Platform aggregator --- targets/platform/IPlatformUIController.h | 106 ----------------------- targets/platform/Platform.h | 12 --- 2 files changed, 118 deletions(-) delete mode 100644 targets/platform/IPlatformUIController.h delete mode 100644 targets/platform/Platform.h diff --git a/targets/platform/IPlatformUIController.h b/targets/platform/IPlatformUIController.h deleted file mode 100644 index 2223546c0..000000000 --- a/targets/platform/IPlatformUIController.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once - -#include - -#include "IPlatformStorage.h" - -// Forward declarations for game types used by the UI interface. -// Full definitions live in the Client module. -enum EUIScene : int; -enum EUILayer : int; -enum EUIGroup : int; -enum ESoundEffect : int; -struct TutorialPopupInfo; - -class IPlatformUIController { -public: - virtual ~IPlatformUIController() = default; - - virtual void tick() = 0; - virtual void render() = 0; - - // Skin - virtual void StartReloadSkinThread() = 0; - virtual bool IsReloadingSkin() = 0; - virtual void CleanUpSkinReload() = 0; - - // Navigation - virtual bool NavigateToScene(int iPad, EUIScene scene, - void* initData = nullptr, - EUILayer layer = static_cast(0), - EUIGroup group = static_cast(0)) = 0; - virtual bool NavigateBack(int iPad, bool forceUsePad = false, - EUIScene eScene = static_cast(-1), - EUILayer eLayer = static_cast(-1)) = 0; - virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; - virtual void CloseAllPlayersScenes() = 0; - - // Menu state - virtual bool IsPauseMenuDisplayed(int iPad) = 0; - virtual bool IsContainerMenuDisplayed(int iPad) = 0; - virtual bool IsIgnorePlayerJoinMenuDisplayed(int iPad) = 0; - virtual bool IsIgnoreAutosaveMenuDisplayed(int iPad) = 0; - virtual void SetIgnoreAutosaveMenuDisplayed(int iPad, bool displayed) = 0; - virtual bool IsSceneInStack(int iPad, EUIScene eScene) = 0; - virtual bool GetMenuDisplayed(int iPad) = 0; - virtual void CheckMenuDisplayed() = 0; - - // Tooltips - virtual void SetTooltipText(unsigned int iPad, unsigned int tooltip, - int iTextID) = 0; - virtual void SetEnableTooltips(unsigned int iPad, bool bVal) = 0; - virtual void ShowTooltip(unsigned int iPad, unsigned int tooltip, - bool show) = 0; - virtual void SetTooltips(unsigned int iPad, int iA, int iB = -1, - int iX = -1, int iY = -1, int iLT = -1, - int iRT = -1, int iLB = -1, int iRB = -1, - int iLS = -1, int iRS = -1, int iBack = -1, - bool forceUpdate = false) = 0; - virtual void EnableTooltip(unsigned int iPad, unsigned int tooltip, - bool enable) = 0; - virtual void RefreshTooltips(unsigned int iPad) = 0; - - // Sound - virtual void PlayUISFX(ESoundEffect eSound) = 0; - - // Debug - virtual void ShowUIDebugConsole(bool show) {} - virtual void ShowUIDebugMarketingGuide(bool show) {} - - // HUD - virtual void DisplayGamertag(unsigned int iPad, bool show) = 0; - virtual void SetSelectedItem(unsigned int iPad, - const std::string& name) = 0; - virtual void UpdateSelectedItemPos(unsigned int iPad) = 0; - - // Events - virtual void HandleDLCMountingComplete() = 0; - virtual void HandleDLCInstalled(int iPad) = 0; - virtual void HandleTMSDLCFileRetrieved(int iPad) = 0; - virtual void HandleTMSBanFileRetrieved(int iPad) = 0; - virtual void HandleInventoryUpdated(int iPad) = 0; - virtual void HandleGameTick() = 0; - - // Tutorial - virtual void SetTutorialDescription(int iPad, TutorialPopupInfo* info) = 0; - virtual void SetTutorialVisible(int iPad, bool visible) = 0; - virtual bool IsTutorialVisible(int iPad) = 0; - - // Layout - virtual void UpdatePlayerBasePositions() = 0; - virtual void SetEmptyQuadrantLogo(int iSection) = 0; - virtual void HideAllGameUIElements() = 0; - virtual void ShowOtherPlayersBaseScene(unsigned int iPad, bool show) = 0; - - // Autosave - virtual void ShowAutosaveCountdownTimer(bool show) = 0; - virtual void UpdateAutosaveCountdownTimer(unsigned int uiSeconds) = 0; - virtual void ShowSavingMessage(unsigned int iPad, - IPlatformStorage::ESavingMessage eVal) = 0; - - // Start screen - virtual bool PressStartPlaying(unsigned int iPad) = 0; - virtual void ShowPressStart(unsigned int iPad) = 0; - - virtual void SetWinUserIndex(unsigned int iPad) = 0; -}; diff --git a/targets/platform/Platform.h b/targets/platform/Platform.h deleted file mode 100644 index d5e66025a..000000000 --- a/targets/platform/Platform.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "IPlatformFilesystem.h" -#include "platform/input/input.h" -#include "IPlatformLeaderboard.h" -#include "IPlatformNetwork.h" -#include "IPlatformProfile.h" -#include "platform/renderer/renderer.h" -#include "IPlatformSound.h" -#include "IPlatformStorage.h" -#include "IPlatformUIController.h" -#include "PlatformTypes.h" From 52b4ccaea2db1304aeee6455a9117218f7bcbbc6 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:40:20 +1000 Subject: [PATCH 006/104] refactor: type the IGameServices payload as a variant instead of void* --- targets/app/common/AppGameServices.cpp | 6 +- targets/app/common/AppGameServices.h | 4 +- targets/app/common/Game.h | 6 +- .../LevelGeneration/ConsoleSchematicFile.h | 8 +- targets/app/common/MenuController.h | 9 +- .../app/common/Network/GameNetworkManager.cpp | 4 +- targets/app/common/SaveManager.cpp | 6 +- .../app/common/UI/All Platforms/UIStructs.h | 9 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 4 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 6 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 9 +- .../UIScene_PauseMenu.cpp | 8 +- targets/minecraft/IGameServices.h | 6 +- targets/minecraft/XuiActionPayload.h | 27 ++++ targets/minecraft/client/gui/PauseScreen.cpp | 4 +- targets/minecraft/client/gui/Screen.cpp | 2 +- targets/minecraft/server/MinecraftServer.cpp | 115 ++++++++++-------- 17 files changed, 141 insertions(+), 92 deletions(-) create mode 100644 targets/minecraft/XuiActionPayload.h diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index e181f1b02..b18b8e986 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -178,8 +178,8 @@ void AppGameServices::setAction(int iPad, eXuiAction action, void* param) { } void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action, - void* param) { - game_.SetXuiServerAction(iPad, action, param); + XuiActionPayload param) { + game_.SetXuiServerAction(iPad, action, std::move(param)); } eXuiAction AppGameServices::getXuiAction(int iPad) { @@ -190,7 +190,7 @@ eXuiServerAction AppGameServices::getXuiServerAction(int iPad) { return game_.GetXuiServerAction(iPad); } -void* AppGameServices::getXuiServerActionParam(int iPad) { +const XuiActionPayload& AppGameServices::getXuiServerActionParam(int iPad) { return game_.GetXuiServerActionParam(iPad); } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index 51891379d..dfa10d396 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -77,10 +77,10 @@ public: // -- UI dispatch -- void setAction(int iPad, eXuiAction action, void* param) override; void setXuiServerAction(int iPad, eXuiServerAction action, - void* param) override; + XuiActionPayload param) override; eXuiAction getXuiAction(int iPad) override; eXuiServerAction getXuiServerAction(int iPad) override; - void* getXuiServerActionParam(int iPad) override; + const XuiActionPayload& getXuiServerActionParam(int iPad) override; void setGlobalXuiAction(eXuiAction action) override; void handleButtonPresses() override; void setTMSAction(int iPad, eTMSAction action) override; diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index f87d3cd04..0a19a83b0 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -260,12 +260,12 @@ public: eXuiServerAction GetXuiServerAction(int iPad) { return m_menuController.getXuiServerAction(iPad); } - void* GetXuiServerActionParam(int iPad) { + const XuiActionPayload& GetXuiServerActionParam(int iPad) { return m_menuController.getXuiServerActionParam(iPad); } void SetXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr) { - m_menuController.setXuiServerAction(iPad, action, param); + XuiActionPayload param = {}) { + m_menuController.setXuiServerAction(iPad, action, std::move(param)); } eXuiServerAction GetGlobalXuiServerAction() { return m_menuController.getGlobalXuiServerAction(); diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h index 7e638f17d..6c788f700 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -13,6 +13,8 @@ #include #include +#include "minecraft/XuiActionPayload.h" + #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" @@ -43,7 +45,7 @@ public: void decrementRefCount() { --m_refCount; } bool shouldDelete() { return m_refCount <= 0; } - typedef struct _XboxSchematicInitParam { + struct XboxSchematicInitParam : minecraft::XuiActionOwnedPayload { char name[64]; int startX; int startY; @@ -55,13 +57,13 @@ public: Compression::ECompressionTypes compressionType; - _XboxSchematicInitParam() { + XboxSchematicInitParam() { memset(name, 0, 64 * (sizeof(char))); startX = startY = startZ = endX = endY = endZ = 0; bSaveMobs = false; compressionType = Compression::eCompressionType_None; } - } XboxSchematicInitParam; + }; private: int m_xSize, m_ySize, m_zSize; diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index a5f157a63..626824520 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -5,6 +5,7 @@ #include #include "app/common/App_structs.h" +#include "minecraft/XuiActionPayload.h" #include "platform/storage/storage.h" #include "platform/XboxStubs.h" @@ -70,14 +71,14 @@ public: void setAction(int iPad, eXuiAction action, void* param = nullptr); eXuiAction getXuiAction(int iPad) { return m_eXuiAction[iPad]; } void setXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr) { + XuiActionPayload param = {}) { m_eXuiServerAction[iPad] = action; - m_eXuiServerActionParam[iPad] = param; + m_eXuiServerActionParam[iPad] = std::move(param); } eXuiServerAction getXuiServerAction(int iPad) { return m_eXuiServerAction[iPad]; } - void* getXuiServerActionParam(int iPad) { + const XuiActionPayload& getXuiServerActionParam(int iPad) { return m_eXuiServerActionParam[iPad]; } eXuiAction getGlobalXuiAction() { return m_eGlobalXuiAction; } @@ -141,7 +142,7 @@ private: void* m_eXuiActionParam[XUSER_MAX_COUNT]; eXuiAction m_eGlobalXuiAction; eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - void* m_eXuiServerActionParam[XUSER_MAX_COUNT]; + XuiActionPayload m_eXuiServerActionParam[XUSER_MAX_COUNT]; eXuiServerAction m_eGlobalXuiServerAction; unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 2a9dce74d..e844beae6 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -881,7 +881,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); } app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + eXuiServerAction_PauseServer, true); // wait for the server to be in a non-ticking state pServer->m_serverPausedEvent->waitForSignal(C4JThread::kInfiniteTimeout); @@ -1009,7 +1009,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // Start the game again app.SetGameStarted(true); app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + eXuiServerAction_PauseServer, false); app.SetChangingSessionType(false); app.SetReallyChangingSessionType(false); diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index 2af9ec1ff..fa846850b 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -36,8 +36,7 @@ void SaveManager::lock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)true); + eXuiServerAction_PauseServer, true); } } } @@ -55,8 +54,7 @@ void SaveManager::unlock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + eXuiServerAction_PauseServer, false); } } } diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 4a51fa239..d8d695266 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,10 +6,11 @@ #include #include -#include "platform/storage/storage.h" #include "minecraft/GameHostOptions.h" -#include "UIEnums.h" +#include "minecraft/XuiActionPayload.h" #include "platform/C4JThread.h" +#include "platform/storage/storage.h" +#include "UIEnums.h" class Container; class Inventory; @@ -417,10 +418,10 @@ typedef struct _InGamePlayerOptionsInitData { unsigned int playerPrivileges; } InGamePlayerOptionsInitData; -typedef struct _DebugSetCameraPosition { +struct DebugSetCameraPosition : minecraft::XuiActionOwnedPayload { int player; double m_camX, m_camY, m_camZ, m_yRot, m_elev; -} DebugSetCameraPosition; +}; typedef struct _TeleportMenuInitData { int iPad; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index cddc30b87..7a3575fa9 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -115,9 +115,11 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { else if (m_data->endZ < 0 && m_data->endZ % 2 == 0) m_data->endZ += 1; + std::unique_ptr payload(m_data); + m_data = nullptr; // ownership transferred to the action app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_ExportSchematic, - (void*)m_data); + std::move(payload)); navigateBack(); } break; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 40a9c1de6..805a4c2c2 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -208,9 +208,9 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { case eControl_Mobs: { int id = childId; if (id < m_mobFactories.size()) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SpawnMob, - (void*)m_mobFactories[id]); + app.SetXuiServerAction( + PlatformProfile.GetPrimaryPad(), eXuiServerAction_SpawnMob, + static_cast(m_mobFactories[id])); } } break; case eControl_Enchantments: { diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 730e86c4e..435bd2cd3 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -107,11 +107,14 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { - case eControl_Teleport: + case eControl_Teleport: { + std::unique_ptr payload( + currentPosition); + currentPosition = nullptr; // ownership transferred app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), eXuiServerAction_SetCameraLocation, - (void*)currentPosition); - break; + std::move(payload)); + } break; case eControl_CamX: case eControl_CamY: case eControl_CamZ: 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 371facf6b..dbac8c9f1 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 @@ -65,7 +65,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, if (/*g_NetworkManager.IsLocalGame() &&*/ g_NetworkManager .GetPlayerCount() == 1) { app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + eXuiServerAction_PauseServer, true); } Minecraft* pMinecraft = Minecraft::GetInstance(); @@ -195,8 +195,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + eXuiServerAction_PauseServer, false); } ui.PlayUISFX(eSFX_Back); @@ -264,8 +263,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, - (void*)false); + eXuiServerAction_PauseServer, false); } navigateBack(); break; diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index 8e53f54ee..da3193b8e 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -17,6 +17,7 @@ class DLCPack; #include "minecraft/client/model/SkinBox.h" #include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" +#include "minecraft/XuiActionPayload.h" #include "platform/PlatformTypes.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/client/IMenuService.h" @@ -109,10 +110,11 @@ public: virtual void setAction(int iPad, eXuiAction action, void* param = nullptr) = 0; virtual void setXuiServerAction(int iPad, eXuiServerAction action, - void* param = nullptr) = 0; + XuiActionPayload param = {}) = 0; [[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0; [[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0; - [[nodiscard]] virtual void* getXuiServerActionParam(int iPad) = 0; + [[nodiscard]] virtual const XuiActionPayload& getXuiServerActionParam( + int iPad) = 0; virtual void setGlobalXuiAction(eXuiAction action) = 0; virtual void handleButtonPresses() = 0; virtual void setTMSAction(int iPad, eTMSAction action) = 0; diff --git a/targets/minecraft/XuiActionPayload.h b/targets/minecraft/XuiActionPayload.h new file mode 100644 index 000000000..34e6989e4 --- /dev/null +++ b/targets/minecraft/XuiActionPayload.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include + +// Type-safe payload carried by IGameServices::setAction / +// setXuiServerAction. Replaces the old `void* param` which mixed +// integers, booleans, and heap-allocated pointers without ownership +// tracking. Concrete heap-allocated payload types (e.g. +// _DebugSetCameraPosition, _XboxSchematicInitParam) inherit from +// XuiActionOwnedPayload so they can be destroyed polymorphically through +// the unique_ptr alternative inside the variant. + +namespace minecraft { + +struct XuiActionOwnedPayload { + virtual ~XuiActionOwnedPayload() = default; +}; + +} // namespace minecraft + +using XuiActionPayload = std::variant< + std::monostate, + bool, + std::int64_t, + std::unique_ptr>; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 941edff8f..769477092 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -34,7 +34,7 @@ void PauseScreen::init() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)true); + eXuiServerAction_PauseServer, true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); if (!g_NetworkManager.IsHost()) { @@ -92,7 +92,7 @@ void PauseScreen::buttonClicked(Button* button) { } if (button->id == 4) { gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + eXuiServerAction_PauseServer, 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 9c681564d..009ddb970 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -44,7 +44,7 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, (void*)false); + eXuiServerAction_PauseServer, false); } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index d1f984d39..3c1add964 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1180,10 +1180,10 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { // Process delayed actions eXuiServerAction eAction; - void* param; for (int i = 0; i < XUSER_MAX_COUNT; i++) { eAction = gameServices().getXuiServerAction(i); - param = gameServices().getXuiServerActionParam(i); + const XuiActionPayload& param = + gameServices().getXuiServerActionParam(i); switch (eAction) { case eXuiServerAction_AutoSaveGame: @@ -1227,18 +1227,20 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet - { + if (auto* id = std::get_if(¶m)) { std::shared_ptr player = players->players.at(0); - size_t id = (size_t)param; player->drop(std::shared_ptr( - new ItemInstance(id, 1, 0))); + new ItemInstance(static_cast(*id), 1, 0))); } break; case eXuiServerAction_SpawnMob: { + auto* id = std::get_if(¶m); + if (!id) break; std::shared_ptr player = players->players.at(0); - eINSTANCEOF factory = (eINSTANCEOF)((size_t)param); + eINSTANCEOF factory = + static_cast(*id); std::shared_ptr mob = std::dynamic_pointer_cast( EntityIO::newByEnumType(factory, @@ -1254,9 +1256,11 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { player->level->addEntity(mob); } break; case eXuiServerAction_PauseServer: - m_isServerPaused = ((size_t)param == true); - if (m_isServerPaused) { - m_serverPausedEvent->set(); + if (auto* val = std::get_if(¶m)) { + m_isServerPaused = *val; + if (m_isServerPaused) { + m_serverPausedEvent->set(); + } } break; case eXuiServerAction_ToggleRain: { @@ -1311,32 +1315,42 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { // UpdateProgressPacket(20) ) ); if (!s_bServerHalted) { + auto* owned = std::get_if< + std::unique_ptr>( + ¶m); ConsoleSchematicFile::XboxSchematicInitParam* - initData = (ConsoleSchematicFile:: - XboxSchematicInitParam*)param; - File targetFileDir("Schematics"); - if (!targetFileDir.exists()) targetFileDir.mkdir(); + initData = owned ? dynamic_cast< + ConsoleSchematicFile::XboxSchematicInitParam*>( + owned->get()) + : nullptr; + if (initData) { + File targetFileDir("Schematics"); + if (!targetFileDir.exists()) + targetFileDir.mkdir(); - char filename[128]; - snprintf(filename, 128, "%s%dx%dx%d.sch", - initData->name, - (initData->endX - initData->startX + 1), - (initData->endY - initData->startY + 1), - (initData->endZ - initData->startZ + 1)); + char filename[128]; + snprintf( + filename, 128, "%s%dx%dx%d.sch", + initData->name, + (initData->endX - initData->startX + 1), + (initData->endY - initData->startY + 1), + (initData->endZ - initData->startZ + 1)); - File dataFile = - File(targetFileDir, std::string(filename)); - if (dataFile.exists()) dataFile._delete(); - FileOutputStream fos = FileOutputStream(dataFile); - DataOutputStream dos = DataOutputStream(&fos); - ConsoleSchematicFile::generateSchematicFile( - &dos, levels[0], initData->startX, - initData->startY, initData->startZ, - initData->endX, initData->endY, initData->endZ, - initData->bSaveMobs, initData->compressionType); - dos.close(); - - delete initData; + File dataFile = + File(targetFileDir, std::string(filename)); + if (dataFile.exists()) dataFile._delete(); + FileOutputStream fos = FileOutputStream(dataFile); + DataOutputStream dos = DataOutputStream(&fos); + ConsoleSchematicFile::generateSchematicFile( + &dos, levels[0], initData->startX, + initData->startY, initData->startZ, + initData->endX, initData->endY, + initData->endZ, initData->bSaveMobs, + initData->compressionType); + dos.close(); + // owned unique_ptr is destroyed when the + // payload is overwritten on the next setXuiServerAction + } } gameServices().unlockSaveNotification(); #endif @@ -1344,26 +1358,27 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { case eXuiServerAction_SetCameraLocation: #if !defined(_CONTENT_PACKAGE) { + auto* owned = std::get_if< + std::unique_ptr>( + ¶m); DebugSetCameraPosition* pos = - (DebugSetCameraPosition*)param; + owned ? dynamic_cast( + owned->get()) + : nullptr; + if (pos) { + Log::info("DEBUG: Player=%i\n", pos->player); + Log::info( + "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), " + "looking at=(%f.2,%f.2)\n", + pos->m_camX, pos->m_camY, pos->m_camZ, + pos->m_yRot, pos->m_elev); - Log::info("DEBUG: Player=%i\n", pos->player); - Log::info( - "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), " - "looking at=(%f.2,%f.2)\n", - pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, - pos->m_elev); - - std::shared_ptr player = - players->players.at(pos->player); - player->debug_setPosition(pos->m_camX, pos->m_camY, - pos->m_camZ, pos->m_yRot, - pos->m_elev); - - // Doesn't work - // player->setYHeadRot(pos->m_yRot); - // player->absMoveTo(pos->m_camX, pos->m_camY, - // pos->m_camZ, pos->m_yRot, pos->m_elev); + std::shared_ptr player = + players->players.at(pos->player); + player->debug_setPosition(pos->m_camX, pos->m_camY, + pos->m_camZ, pos->m_yRot, + pos->m_elev); + } } #endif break; From 6e1964adb302178035a2fa16a4e498fc6a8eeaca Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:50:19 +1000 Subject: [PATCH 007/104] chore: drop dead LinuxGame.h includes across minecraft --- scripts/find_dead_app_includes.py | 182 ++++++++++++++++++ scripts/sweep_linuxgame_includes.py | 100 ++++++++++ targets/minecraft/client/Options.cpp | 1 - .../client/gui/CreateWorldScreen.cpp | 1 - targets/minecraft/client/gui/Gui.cpp | 1 - targets/minecraft/client/gui/PauseScreen.cpp | 1 - targets/minecraft/client/gui/Screen.cpp | 1 - .../client/gui/SelectWorldScreen.cpp | 1 - .../gui/inventory/AbstractContainerScreen.cpp | 1 - .../gui/inventory/BeaconPowerButton.cpp | 1 - .../gui/inventory/CreativeInventoryScreen.cpp | 1 - .../minecraft/client/model/HumanoidModel.cpp | 1 - .../client/multiplayer/ClientConnection.cpp | 1 - .../client/multiplayer/MultiPlayerLevel.cpp | 1 - targets/minecraft/client/player/Input.cpp | 1 - .../minecraft/client/player/RemotePlayer.cpp | 1 - .../client/renderer/GameRenderer.cpp | 1 - .../client/renderer/ItemInHandRenderer.cpp | 1 - .../client/renderer/LevelRenderer.cpp | 1 - .../minecraft/client/renderer/Tesselator.cpp | 1 - .../minecraft/client/renderer/Textures.cpp | 1 - .../entity/EntityRenderDispatcher.cpp | 1 - .../renderer/entity/LivingEntityRenderer.cpp | 1 - .../client/renderer/entity/PlayerRenderer.cpp | 1 - .../texture/PreStitchedTextureMap.cpp | 1 - .../client/renderer/texture/Stitcher.cpp | 1 - .../client/renderer/texture/Texture.cpp | 1 - .../renderer/texture/TextureManager.cpp | 1 - .../client/renderer/texture/TextureMap.cpp | 1 - .../renderer/tileentity/SignRenderer.cpp | 1 - .../minecraft/client/skins/DLCTexturePack.cpp | 1 - .../client/skins/TexturePackRepository.cpp | 1 - .../minecraft/client/title/TitleScreen.cpp | 1 - .../minecraft/commands/CommandDispatcher.cpp | 1 - .../minecraft/core/ItemDispenseBehaviors.cpp | 1 - .../packet/BlockRegionUpdatePacket.cpp | 1 - .../network/packet/CustomPayloadPacket.cpp | 1 - .../network/packet/GameCommandPacket.cpp | 1 - .../minecraft/network/packet/LoginPacket.cpp | 1 - targets/minecraft/network/packet/Packet.cpp | 1 - .../network/packet/RespawnPacket.cpp | 1 - .../network/packet/SetPlayerTeamPacket.cpp | 1 - targets/minecraft/server/MinecraftServer.cpp | 1 - targets/minecraft/server/PlayerList.cpp | 1 - .../minecraft/server/level/PlayerChunkMap.cpp | 1 - .../minecraft/server/level/ServerLevel.cpp | 1 - .../server/level/ServerLevelListener.cpp | 1 - .../minecraft/server/level/ServerPlayer.cpp | 1 - .../minecraft/server/level/TrackedEntity.cpp | 1 - .../server/network/PendingConnection.cpp | 1 - .../server/network/PlayerConnection.cpp | 1 - .../server/network/ServerConnection.cpp | 1 - targets/minecraft/stats/Stat.h | 1 - targets/minecraft/world/CompoundContainer.cpp | 1 - targets/minecraft/world/SimpleContainer.cpp | 1 - .../world/effect/MobEffectInstance.cpp | 1 - targets/minecraft/world/entity/Entity.cpp | 1 - targets/minecraft/world/entity/EntityIO.cpp | 1 - .../minecraft/world/entity/LivingEntity.cpp | 1 - targets/minecraft/world/entity/Painting.cpp | 1 - .../world/entity/SyncedEntityData.cpp | 1 - .../ai/attributes/AttributeModifier.cpp | 1 - .../world/entity/animal/EntityHorse.cpp | 1 - .../minecraft/world/entity/animal/Ocelot.cpp | 1 - .../world/entity/item/ItemEntity.cpp | 1 - .../world/entity/item/MinecartContainer.cpp | 1 - .../world/entity/monster/EnderMan.cpp | 1 - .../world/entity/monster/Monster.cpp | 1 - .../world/entity/monster/PigZombie.cpp | 1 - .../monster/SharedMonsterAttributes.cpp | 1 - .../world/entity/monster/Silverfish.cpp | 1 - .../minecraft/world/entity/monster/Spider.cpp | 1 - .../minecraft/world/entity/npc/Villager.cpp | 1 - .../world/entity/player/Inventory.cpp | 1 - .../world/entity/projectile/Arrow.cpp | 1 - .../world/entity/projectile/Fireball.cpp | 1 - .../minecraft/world/inventory/AnvilMenu.cpp | 1 - targets/minecraft/world/item/BucketItem.cpp | 1 - .../world/item/FireworksChargeItem.cpp | 1 - .../minecraft/world/item/FireworksItem.cpp | 1 - .../world/item/HangingEntityItem.cpp | 1 - targets/minecraft/world/item/Item.cpp | 1 - .../minecraft/world/item/PlanterTileItem.cpp | 1 - targets/minecraft/world/item/PotionItem.cpp | 1 - targets/minecraft/world/item/SpawnEggItem.cpp | 1 - targets/minecraft/world/item/TileItem.cpp | 1 - .../minecraft/world/item/crafting/Recipes.cpp | 1 - .../world/item/crafting/ShapedRecipy.cpp | 1 - targets/minecraft/world/level/Explosion.cpp | 1 - targets/minecraft/world/level/GameRules.cpp | 1 - targets/minecraft/world/level/Level.cpp | 1 - .../minecraft/world/level/PortalForcer.cpp | 1 - .../world/level/biome/BiomeCache.cpp | 1 - .../world/level/biome/BiomeDecorator.cpp | 1 - .../world/level/biome/BiomeSource.cpp | 1 - .../world/level/chunk/LevelChunk.cpp | 1 - .../storage/ChunkStorageProfileDecorator.cpp | 1 - .../chunk/storage/McRegionChunkStorage.cpp | 1 - .../level/chunk/storage/OldChunkStorage.cpp | 1 - .../world/level/dimension/Dimension.cpp | 1 - .../world/level/dimension/HellDimension.cpp | 1 - .../world/level/levelgen/CanyonFeature.cpp | 1 - .../level/levelgen/CustomLevelSource.cpp | 1 - .../world/level/levelgen/FlatLevelSource.cpp | 1 - .../level/levelgen/HellFlatLevelSource.cpp | 1 - .../level/levelgen/HellRandomLevelSource.cpp | 1 - .../level/levelgen/RandomLevelSource.cpp | 1 - .../levelgen/TheEndLevelRandomLevelSource.cpp | 1 - .../levelgen/feature/BasicTreeFeature.cpp | 1 - .../level/levelgen/feature/BirchFeature.cpp | 1 - .../level/levelgen/feature/CaveFeature.cpp | 1 - .../level/levelgen/feature/FlowerFeature.cpp | 1 - .../level/levelgen/feature/LakeFeature.cpp | 1 - .../levelgen/feature/MegaTreeFeature.cpp | 1 - .../level/levelgen/feature/OreFeature.cpp | 1 - .../level/levelgen/feature/PineFeature.cpp | 1 - .../level/levelgen/feature/ReedsFeature.cpp | 1 - .../level/levelgen/feature/SandFeature.cpp | 1 - .../level/levelgen/feature/SpikeFeature.cpp | 1 - .../level/levelgen/feature/SpringFeature.cpp | 1 - .../level/levelgen/feature/SpruceFeature.cpp | 1 - .../levelgen/feature/SwampTreeFeature.cpp | 1 - .../level/levelgen/feature/TreeFeature.cpp | 1 - .../levelgen/structure/MineShaftFeature.cpp | 1 - .../structure/NetherBridgeFeature.cpp | 1 - .../structure/RandomScatteredLargeFeature.cpp | 1 - .../structure/ScatteredFeaturePieces.cpp | 1 - .../levelgen/structure/StrongholdFeature.cpp | 1 - .../levelgen/structure/StrongholdPieces.cpp | 1 - .../levelgen/structure/StructureFeatureIO.cpp | 1 - .../levelgen/structure/VillageFeature.cpp | 1 - .../world/level/newbiome/layer/Layer.cpp | 1 - .../ConsoleSaveFileOriginal.cpp | 1 - .../ConsoleSaveFileSplit.cpp | 1 - .../level/storage/DirectoryLevelStorage.cpp | 1 - .../world/level/storage/LevelData.cpp | 1 - .../level/storage/McRegionLevelStorage.cpp | 1 - .../minecraft/world/level/tile/FireTile.cpp | 1 - .../world/level/tile/NotGateTile.cpp | 1 - .../world/level/tile/NoteBlockTile.cpp | 1 - .../world/level/tile/StoneMonsterTile.cpp | 1 - targets/minecraft/world/level/tile/Tile.cpp | 1 - .../minecraft/world/level/tile/TntTile.cpp | 1 - .../level/tile/entity/BeaconTileEntity.cpp | 1 - .../tile/entity/BrewingStandTileEntity.cpp | 1 - .../level/tile/entity/ChestTileEntity.cpp | 1 - .../level/tile/entity/DispenserTileEntity.cpp | 1 - .../level/tile/entity/DropperTileEntity.cpp | 1 - .../entity/EnchantmentTableTileEntity.cpp | 1 - .../level/tile/entity/FurnaceTileEntity.cpp | 1 - .../level/tile/entity/HopperTileEntity.cpp | 1 - .../world/level/tile/entity/TileEntity.cpp | 1 - 152 files changed, 282 insertions(+), 150 deletions(-) create mode 100644 scripts/find_dead_app_includes.py create mode 100644 scripts/sweep_linuxgame_includes.py diff --git a/scripts/find_dead_app_includes.py b/scripts/find_dead_app_includes.py new file mode 100644 index 000000000..649cc518c --- /dev/null +++ b/scripts/find_dead_app_includes.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 +"""Heuristic dead-include detector for app/ includes in minecraft/. + +For each minecraft/ source file that includes a header from app/, check +whether the file references any of the top-level identifiers that header +defines. If zero references, the include is a candidate for removal. + +Usage: + python3 scripts/find_dead_app_includes.py [--apply] [DIR ...] + +Without --apply, prints candidates only. With --apply, removes them. +DIR is one or more subdirectories of targets/minecraft/ to scope the +sweep (e.g. world/entity, server). Defaults to all of targets/minecraft/. + +Caveats: +- The "identifiers a header defines" heuristic catches type names, + function names, struct/class/enum names, and macros. It can miss + constants used through unusual paths and is fooled by includes that + are needed only for transitive type completion. Always build clean + after applying. +- Comments and strings are not stripped from the consumer scan, so a + file that mentions an app symbol only in a comment will look "live" + and the include is conservatively kept. +""" + +from __future__ import annotations + +import argparse +import os +import re +import sys +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent +MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" +APP_ROOT = REPO_ROOT / "targets" / "app" + +INCLUDE_RE = re.compile(r'^\s*#\s*include\s*"(app/[^"]+)"\s*$', re.MULTILINE) + +# Identifier-extracting regexes for header analysis. Best-effort. +IDENT_RES = [ + # class/struct/union/enum tag definitions + re.compile(r'\b(?:class|struct|union|enum(?:\s+class)?)\s+([A-Za-z_]\w*)'), + # typedef NAME or typedef ... NAME; + re.compile(r'\btypedef\b[^;]*?\b([A-Za-z_]\w*)\s*(?:\[|;)'), + # using NAME = ... + re.compile(r'\busing\s+([A-Za-z_]\w*)\s*='), + # function declarations: WORD WORD ( where second WORD is identifier + # this is too loose; skip in favour of usage by name + # #define MACRO + re.compile(r'^\s*#\s*define\s+([A-Za-z_]\w*)', re.MULTILINE), + # extern variable declarations + re.compile(r'\bextern\b[^;]*?\b([A-Za-z_]\w*)\s*[;\[(]'), +] + +CXX_KEYWORDS = { + "if", "else", "while", "for", "do", "switch", "case", "default", + "break", "continue", "return", "void", "int", "char", "short", "long", + "float", "double", "bool", "true", "false", "nullptr", "class", "struct", + "union", "enum", "namespace", "using", "typedef", "template", "typename", + "const", "constexpr", "static", "extern", "inline", "virtual", "override", + "final", "public", "private", "protected", "friend", "this", "new", + "delete", "sizeof", "auto", "decltype", "operator", "throw", "try", + "catch", "noexcept", "mutable", "volatile", "register", "explicit", + "signed", "unsigned", "wchar_t", "char8_t", "char16_t", "char32_t", + "size_t", "ptrdiff_t", "nullptr_t", "ifndef", "ifdef", "endif", "define", + "include", "pragma", "elif", "error", "warning", "line", "undef", + "alignas", "alignof", "concept", "requires", "co_await", "co_yield", + "co_return", "consteval", "constinit", "static_cast", "dynamic_cast", + "reinterpret_cast", "const_cast", +} + + +def extract_header_identifiers(header_path: Path) -> set[str]: + """Best-effort extraction of identifiers a header defines.""" + if not header_path.exists(): + return set() + try: + text = header_path.read_text(encoding="utf-8", errors="surrogateescape") + except OSError: + return set() + idents: set[str] = set() + for regex in IDENT_RES: + for match in regex.finditer(text): + name = match.group(1) + if name and name not in CXX_KEYWORDS and not name.startswith("_"): + idents.add(name) + return idents + + +def file_references_any(file_text: str, idents: set[str]) -> bool: + """Check if any identifier appears as a whole-word match in the file.""" + if not idents: + return False + # Build one big alternation + pattern = r'\b(?:' + '|'.join(re.escape(i) for i in idents) + r')\b' + return re.search(pattern, file_text) is not None + + +def collect_minecraft_files(roots: list[Path]) -> list[Path]: + files: list[Path] = [] + for root in roots: + for dirpath, _dirnames, filenames in os.walk(root): + for name in filenames: + if name.endswith((".cpp", ".c", ".h", ".hpp")): + files.append(Path(dirpath) / name) + files.sort() + return files + + +def analyse(roots: list[Path], apply: bool) -> int: + files = collect_minecraft_files(roots) + header_cache: dict[str, set[str]] = {} + candidate_count = 0 + + for path in files: + try: + text = path.read_text(encoding="utf-8", errors="surrogateescape") + except OSError: + continue + includes = INCLUDE_RE.findall(text) + if not includes: + continue + # Strip the include lines from the text we scan for symbols, so we + # don't false-positive on the include path itself mentioning the + # symbol name (e.g. ColourTable.h). + scan_text = INCLUDE_RE.sub("", text) + dead_includes: list[str] = [] + for include_path in includes: + cache_key = include_path + if cache_key not in header_cache: + header_path = REPO_ROOT / "targets" / include_path + header_cache[cache_key] = extract_header_identifiers(header_path) + idents = header_cache[cache_key] + if not idents: + # Header has no extractable identifiers (or doesn't exist). + # Conservatively skip - don't claim it's dead. + continue + if not file_references_any(scan_text, idents): + dead_includes.append(include_path) + if dead_includes: + candidate_count += len(dead_includes) + rel = path.relative_to(REPO_ROOT) + for inc in dead_includes: + print(f"{rel}: {inc}") + if apply: + new_text = text + for inc in dead_includes: + pattern = re.compile( + r'^\s*#\s*include\s*"' + re.escape(inc) + r'"\s*\n', + re.MULTILINE, + ) + new_text = pattern.sub("", new_text) + path.write_text(new_text, encoding="utf-8", errors="surrogateescape") + + print(f"\n{candidate_count} candidate dead include lines" + f" {'removed' if apply else 'identified'}") + return 0 + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--apply", action="store_true", + help="Actually remove the candidate includes") + parser.add_argument("dirs", nargs="*", + help="Subdirectories of targets/minecraft/ to scan") + args = parser.parse_args() + + if args.dirs: + roots = [MINECRAFT_ROOT / d for d in args.dirs] + for r in roots: + if not r.exists(): + print(f"error: {r} does not exist", file=sys.stderr) + return 1 + else: + roots = [MINECRAFT_ROOT] + + return analyse(roots, args.apply) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/sweep_linuxgame_includes.py b/scripts/sweep_linuxgame_includes.py new file mode 100644 index 000000000..9a13424f1 --- /dev/null +++ b/scripts/sweep_linuxgame_includes.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Conservative sweep: remove dead app/linux/LinuxGame.h includes from minecraft/. + +LinuxGame.h is included by 155 files in targets/minecraft/ but most of +those are leftover from before the IGameServices refactor. The only real +reasons to include it are: + - to use the global `LinuxGame app;` extern + - to use the LinuxGame class type by name + - to use C4JStringTable (forward-declared in the header) + +For each minecraft/ file that includes LinuxGame.h, this script checks +whether the file references any of: LinuxGame, C4JStringTable, or +contains `app.`/`app::`. If none of those appear, the include is dead +and removed. + +Usage: + python3 scripts/sweep_linuxgame_includes.py [--apply] +""" + +from __future__ import annotations + +import argparse +import os +import re +import sys +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent +MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" + +INCLUDE_RE = re.compile( + r'^[ \t]*#[ \t]*include[ \t]*"app/linux/LinuxGame\.h"[ \t]*\n', + re.MULTILINE, +) + +# Patterns that mean the include is genuinely needed. +# LinuxGame.h transitively pulls in Game.h (LinuxGame : public Game), so any +# reference to the Game class also keeps the include alive. +USAGE_PATTERNS = [ + re.compile(r'\bLinuxGame\b'), + re.compile(r'\bC4JStringTable\b'), + re.compile(r'\bapp\s*\.'), + re.compile(r'\bapp\s*::'), + re.compile(r'\bGame\s*::'), + re.compile(r'\bGame\s*\*'), + re.compile(r'\bGame\s*&'), + re.compile(r'class\s+\w+\s*:\s*(?:public|private|protected)?\s*Game\b'), +] + + +def file_needs_linuxgame(text: str) -> bool: + # Strip the LinuxGame.h include line itself before checking, to avoid + # the include path matching `LinuxGame`. + scan = INCLUDE_RE.sub("", text) + for pat in USAGE_PATTERNS: + if pat.search(scan): + return True + return False + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--apply", action="store_true", + help="Actually remove the dead includes") + args = parser.parse_args() + + candidates: list[Path] = [] + for dirpath, _dirnames, filenames in os.walk(MINECRAFT_ROOT): + for name in filenames: + if not name.endswith((".cpp", ".c", ".h", ".hpp")): + continue + path = Path(dirpath) / name + try: + text = path.read_text(encoding="utf-8", errors="surrogateescape") + except OSError: + continue + if not INCLUDE_RE.search(text): + continue + if file_needs_linuxgame(text): + continue + candidates.append(path) + + candidates.sort() + for path in candidates: + print(path.relative_to(REPO_ROOT)) + + print(f"\n{len(candidates)} files have a dead LinuxGame.h include") + + if args.apply: + for path in candidates: + text = path.read_text(encoding="utf-8", errors="surrogateescape") + new_text = INCLUDE_RE.sub("", text) + path.write_text(new_text, encoding="utf-8", errors="surrogateescape") + print(f"Removed from {len(candidates)} files") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index a02461ef7..8b4a83a75 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -3,7 +3,6 @@ #include "KeyMapping.h" #include "app/common/Audio/SoundEngine.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index a423d9c9c..fc2299b3e 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -16,7 +16,6 @@ #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "platform/NetTypes.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index b967cf608..b650252ba 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -10,7 +10,6 @@ #include "Facing.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "platform/XboxStubs.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 769477092..03abe500a 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -13,7 +13,6 @@ #include "MessageScreen.h" #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "OptionsScreen.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 009ddb970..78cb896c0 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -7,7 +7,6 @@ #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index edcefd9c0..8f927fe86 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -9,7 +9,6 @@ #include "Button.h" #include "ConfirmScreen.h" #include "CreateWorldScreen.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "RenameWorldScreen.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index a9a53c044..0618c0a9d 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -5,7 +5,6 @@ #include -#include "app/linux/LinuxGame.h" #include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Lighting.h" diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp index 14f9d2198..597eb7e18 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -4,7 +4,6 @@ #include #include "BeaconScreen.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/gui/inventory/AbstractBeaconButton.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index 028578462..cff4ed82d 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -10,7 +10,6 @@ #include "platform/renderer/renderer.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "app/linux/LinuxGame.h" #include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Lighting.h" diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index 436183517..cf451287d 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -6,7 +6,6 @@ #include #include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.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/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index fbc53d387..6cd6c0603 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -32,7 +32,6 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "MultiPlayerLevel.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 12ae6a211..fa7482299 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -16,7 +16,6 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" #include "java/JavaMath.h" diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index 3dded71b6..ef03d38ed 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -6,7 +6,6 @@ #include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/minecraft/client/player/RemotePlayer.cpp b/targets/minecraft/client/player/RemotePlayer.cpp index 2f447a4ad..4d5a51c5f 100644 --- a/targets/minecraft/client/player/RemotePlayer.cpp +++ b/targets/minecraft/client/player/RemotePlayer.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "Pos.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 91a2ee532..4b29b322b 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -18,7 +18,6 @@ #include "minecraft/GameEnums.h" #include "platform/ShutdownManager.h" #include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "util/FrameProfiler.h" diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 3a868f133..fd4afe9d5 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -11,7 +11,6 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" #include "Tesselator.h" #include "Textures.h" #include "TileRenderer.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index de14d43a0..c785d827c 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -24,7 +24,6 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "util/FrameProfiler.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "Tesselator.h" diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 9bdc09508..6abdf4b28 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -6,7 +6,6 @@ #include #include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" #include "platform/stubs.h" #include "minecraft/client/MemoryTracker.h" diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index a76612b4b..6ae27ca29 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -11,7 +11,6 @@ #include "platform/renderer/renderer.h" #include "HttpTexture.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/MemTexture.h" #include "minecraft/client/renderer/MemTextureProcessor.h" diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 31bda5f4f..762582729 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -35,7 +35,6 @@ #include "LightningBoltRenderer.h" #include "MinecartRenderer.h" #include "MinecartSpawnerRenderer.h" -#include "app/linux/LinuxGame.h" #include "MobRenderer.h" #include "MushroomCowRenderer.h" #include "OcelotRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index 806435813..736fb0e45 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -8,7 +8,6 @@ #include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index f9f573919..e2042ba0d 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -10,7 +10,6 @@ #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index 969bf9473..7be953540 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 6ccc29570..b8f0d4a80 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "StitchSlot.h" #include "Texture.h" diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index 1db756dcd..d4b2694df 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -7,7 +7,6 @@ #include #include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/BufferedImage.h" #include "TextureManager.h" #include "java/Buffer.h" diff --git a/targets/minecraft/client/renderer/texture/TextureManager.cpp b/targets/minecraft/client/renderer/texture/TextureManager.cpp index 9c076aefc..8f12f48db 100644 --- a/targets/minecraft/client/renderer/texture/TextureManager.cpp +++ b/targets/minecraft/client/renderer/texture/TextureManager.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/client/BufferedImage.h" #include "Stitcher.h" #include "Texture.h" diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index c74a3d57f..67ee136bf 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 0751a1db3..ee9b663f0 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -8,7 +8,6 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" #include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 930a40ecc..741d2ade0 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -25,7 +25,6 @@ #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Localisation/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index dc7005742..37ad9b795 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -13,7 +13,6 @@ #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 0e9f08a5d..1cfb80097 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -8,7 +8,6 @@ #include #include "platform/renderer/renderer.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/commands/CommandDispatcher.cpp b/targets/minecraft/commands/CommandDispatcher.cpp index 175b3dd94..3fd03819e 100644 --- a/targets/minecraft/commands/CommandDispatcher.cpp +++ b/targets/minecraft/commands/CommandDispatcher.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/commands/CommandsEnum.h" diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index f3754bfee..8939f5437 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -5,7 +5,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/AbstractProjectileDispenseBehavior.h" diff --git a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp index 035cfdb9a..77f05c36c 100644 --- a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp +++ b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "PacketListener.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 9baf33da4..d0384eea4 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 2410169f7..693decb7d 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/network/packet/LoginPacket.cpp b/targets/minecraft/network/packet/LoginPacket.cpp index cd180e13d..957240210 100644 --- a/targets/minecraft/network/packet/LoginPacket.cpp +++ b/targets/minecraft/network/packet/LoginPacket.cpp @@ -1,7 +1,6 @@ #include "minecraft/util/Log.h" #include "LoginPacket.h" -#include "app/linux/LinuxGame.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 9a1946392..56b75aebe 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -13,7 +13,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/Exceptions.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/network/packet/RespawnPacket.cpp b/targets/minecraft/network/packet/RespawnPacket.cpp index 01a0eeb68..5302dc749 100644 --- a/targets/minecraft/network/packet/RespawnPacket.cpp +++ b/targets/minecraft/network/packet/RespawnPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 246ae4e95..14796f459 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 3c1add964..ec321d02e 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -22,7 +22,6 @@ #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "PlayerList.h" #include "Settings.h" #include "util/Timer.h" diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index a177ad9fc..6b549d60f 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -20,7 +20,6 @@ #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "MinecraftServer.h" diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index a420c8b25..746292478 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -12,7 +12,6 @@ #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerChunkCache.h" #include "ServerLevel.h" #include "ServerPlayer.h" diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index fd310d273..77a16c7f5 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -15,7 +15,6 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "PlayerChunkMap.h" #include "Pos.h" #include "ServerChunkCache.h" diff --git a/targets/minecraft/server/level/ServerLevelListener.cpp b/targets/minecraft/server/level/ServerLevelListener.cpp index 15f7f2ffd..23bec4f7a 100644 --- a/targets/minecraft/server/level/ServerLevelListener.cpp +++ b/targets/minecraft/server/level/ServerLevelListener.cpp @@ -5,7 +5,6 @@ #include #include "EntityTracker.h" -#include "app/linux/LinuxGame.h" #include "PlayerChunkMap.h" #include "ServerLevel.h" #include "ServerPlayer.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index d50593678..d6778ea81 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -16,7 +16,6 @@ #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" #include "java/InputOutputStream/ByteArrayInputStream.h" diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index f7eb9b3b4..aa4e8518c 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -12,7 +12,6 @@ #include "platform/PlatformTypes.h" #include "EntityTracker.h" #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" #include "ServerPlayer.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 62c26afd1..0ca0b077e 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -13,7 +13,6 @@ #include "app/common/BuildVer/BuildVer.h" #include "app/common/Network/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "PlayerConnection.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 184f4264e..79644d33f 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -18,7 +18,6 @@ #include "app/common/Network/GameNetworkManager.h" #include "app/common/Network/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" #include "java/Class.h" diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 6648b7a2b..7a62aac35 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -4,7 +4,6 @@ #include -#include "app/linux/LinuxGame.h" #include "PendingConnection.h" #include "PlayerConnection.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index e7ef7339e..f6e953515 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -9,7 +9,6 @@ #include "GenericStats.h" #include "minecraft/IGameServices.h" -#include "app/linux/LinuxGame.h" #include "StatFormatter.h" class DecimalFormat; diff --git a/targets/minecraft/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index 8672c3384..568ff54cd 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,7 +1,6 @@ #include "minecraft/IGameServices.h" #include "CompoundContainer.h" -#include "app/linux/LinuxGame.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/world/Container.h" diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 4d62020c0..469fbe7db 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/Container.h" #include "minecraft/world/item/ItemInstance.h" #include "net.minecraft.world.ContainerListener.h" diff --git a/targets/minecraft/world/effect/MobEffectInstance.cpp b/targets/minecraft/world/effect/MobEffectInstance.cpp index 9363619a0..29a5aca77 100644 --- a/targets/minecraft/world/effect/MobEffectInstance.cpp +++ b/targets/minecraft/world/effect/MobEffectInstance.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/effect/MobEffect.h" #include "nbt/CompoundTag.h" diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 129aaa98d..5a1ba6fe1 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -18,7 +18,6 @@ #include "EntityPos.h" #include "SyncedEntityData.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/entity/EntityIO.cpp b/targets/minecraft/world/entity/EntityIO.cpp index d98e58ad2..598f676cf 100644 --- a/targets/minecraft/world/entity/EntityIO.cpp +++ b/targets/minecraft/world/entity/EntityIO.cpp @@ -4,7 +4,6 @@ #include #include "Entity.h" -#include "app/linux/LinuxGame.h" #include "Painting.h" #include "java/Class.h" #include "java/JavaIntHash.h" diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 3720cb360..54fed9788 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -14,7 +14,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 7c48a5455..1f70f23c1 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/HangingEntity.h" diff --git a/targets/minecraft/world/entity/SyncedEntityData.cpp b/targets/minecraft/world/entity/SyncedEntityData.cpp index ba2034f53..e688c554a 100644 --- a/targets/minecraft/world/entity/SyncedEntityData.cpp +++ b/targets/minecraft/world/entity/SyncedEntityData.cpp @@ -5,7 +5,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index a01a153d1..b8f844b97 100644 --- a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp +++ b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp @@ -5,7 +5,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index de5831f7e..e85b371c1 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index df9299bf7..235866317 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -7,7 +7,6 @@ #include #include "platform/input/input.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 9c3901bb2..98935d20c 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/entity/item/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 6806f0070..08294dbd2 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/ItemEntity.h" diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index 92c7d094c..0f7362210 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -8,7 +8,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index b2cbfaf04..f67789c4d 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 5cf607f37..33181d774 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" diff --git a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp index a8c66793c..22e54d356 100644 --- a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp +++ b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/attributes/AttributeModifier.h" diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index c2ad4f2b1..deb93e43b 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index 3e2e1f27a..ba3ef339d 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 2b2e26511..2685626b2 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "Pos.h" #include "SharedConstants.h" #include "java/Random.h" diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index 043f96f45..21a59b055 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -6,7 +6,6 @@ #include -#include "app/linux/LinuxGame.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index 4775c8443..2882947bd 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -9,7 +9,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/packet/GameEventPacket.h" diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index f89d0ccd0..ff55f7155 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -10,7 +10,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" diff --git a/targets/minecraft/world/inventory/AnvilMenu.cpp b/targets/minecraft/world/inventory/AnvilMenu.cpp index 57725a460..43852607f 100644 --- a/targets/minecraft/world/inventory/AnvilMenu.cpp +++ b/targets/minecraft/world/inventory/AnvilMenu.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index ed17ba6e2..2e22034d0 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/item/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 07f5a8c6f..8b55f3b6a 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/DyePowderItem.h" diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 71e2086bd..3f4041a50 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/minecraft/world/item/HangingEntityItem.cpp b/targets/minecraft/world/item/HangingEntityItem.cpp index 0e4fea560..ef2238b72 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -10,7 +10,6 @@ #include "Direction.h" #include "Facing.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/HangingEntity.h" diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index fc7b424ff..20f6dc92d 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -9,7 +9,6 @@ #include "HangingEntityItem.h" #include "MapItem.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/stats/Stats.h" diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 4561dba92..3008d77c5 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -4,7 +4,6 @@ #include #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "minecraft/Facing.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index 16e084eb5..a89a80dce 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -4,7 +4,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index a4261b0d7..acaaf79b0 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -6,7 +6,6 @@ #include "Facing.h" #include "app/common/Colours/ColourTable.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index 12b042728..c5421886a 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -7,7 +7,6 @@ #include #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/Facing.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/world/item/crafting/Recipes.cpp b/targets/minecraft/world/item/crafting/Recipes.cpp index b8d432582..68509e580 100644 --- a/targets/minecraft/world/item/crafting/Recipes.cpp +++ b/targets/minecraft/world/item/crafting/Recipes.cpp @@ -9,7 +9,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp index 70380f05b..c66fc3fe4 100644 --- a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -9,7 +9,6 @@ #include #include "platform/PlatformTypes.h" -#include "app/linux/LinuxGame.h" #include "Recipes.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 099c3b33c..16516e658 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index 41943618e..b3682d251 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -4,7 +4,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" // 4J: GameRules isn't in use anymore, just routes any requests to app game host // options, kept things commented out for context diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 5dfb7be27..53298953f 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -21,7 +21,6 @@ #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/FrameProfiler.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/PortalForcer.cpp b/targets/minecraft/world/level/PortalForcer.cpp index 6998269d6..505b37645 100644 --- a/targets/minecraft/world/level/PortalForcer.cpp +++ b/targets/minecraft/world/level/PortalForcer.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "Pos.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/level/biome/BiomeCache.cpp b/targets/minecraft/world/level/biome/BiomeCache.cpp index 79ecc3acf..65a8f3b3e 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -4,7 +4,6 @@ #include #include "BiomeSource.h" -#include "app/linux/LinuxGame.h" #include "minecraft/world/level/biome/Biome.h" BiomeCache::Block::Block(int x, int z, BiomeCache* parent) { diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index ac352882c..d84f7e423 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -2,7 +2,6 @@ #include "minecraft/world/level/biome/BiomeDecorator.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 21eb3d0aa..e43e9d730 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -8,7 +8,6 @@ #include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index 8cf7e6b07..e7de983fa 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -10,7 +10,6 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" #include "SparseLightStorage.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 36f89b42e..4fc2e4e70 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/System.h" #include "minecraft/world/level/chunk/storage/ChunkStorage.h" diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 784abea6c..1df454504 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -12,7 +12,6 @@ #include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "platform/C4JThread.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 40cb60a7c..0f31e795e 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -14,7 +14,6 @@ #include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "util/Definitions.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index dab92411b..0700a9fee 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -10,7 +10,6 @@ #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "NormalDimension.h" #include "TheEndDimension.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index 27e5f97e5..6b7694c4d 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -7,7 +7,6 @@ #include "minecraft/GameEnums.h" #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index 21f98b440..e3931d2e8 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -5,7 +5,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 1fe5a7f3f..8c8737b28 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -7,7 +7,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "platform/fs/fs.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp index c5281f80a..5c4db433b 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -6,7 +6,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index f4d8feb11..b63f9a61f 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index 420d4bf5a..47c1ad8f0 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -8,7 +8,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index d7cba474e..d671e1aa0 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -7,7 +7,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "util/Timer.h" #include "java/Random.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index c13ef9a67..e7d49ab9e 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -6,7 +6,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index 087eefc0a..d0c906150 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -8,7 +8,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index 9cc463d87..4b532dffd 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index f106f7c6c..4c81dcc9c 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -8,7 +8,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index cfd5b65e3..56f96c109 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -3,7 +3,6 @@ #include "FlowerFeature.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index c13c1d68a..4a83a4fd5 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -3,7 +3,6 @@ #include "LakeFeature.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LightLayer.h" diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index a2d426b29..439692288 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index 4068466f4..b1e5a75d3 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index 468438eec..68f36eda9 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index 9006cc7af..bbe7132ad 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -3,7 +3,6 @@ #include "ReedsFeature.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index 2e8307244..eaa4d1178 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -3,7 +3,6 @@ #include "SandFeature.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp index f24fbc8fd..78f0a89f4 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index 34833deb5..d72bf90b9 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -3,7 +3,6 @@ #include "SpringFeature.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index eeebb62fa..aa18a51c9 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 79c962cca..5cb5b2359 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 5ebcfa2b2..2d40cc922 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index ab45ebf0a..c0e2b7a13 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -11,7 +11,6 @@ #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index a80b781a2..8e56d4c20 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "NetherBridgePieces.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp index 2c2d41041..43ce8248e 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -5,7 +5,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp index 7204abd45..57a74a67b 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -7,7 +7,6 @@ #include #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index ee429ebb7..22db4633b 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -12,7 +12,6 @@ #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index d3c1590ef..3b4f25cbd 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -8,7 +8,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp index b2da6a4a4..17741eb9f 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/level/levelgen/structure/MineShaftPieces.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" #include "minecraft/world/level/levelgen/structure/NetherBridgeFeature.h" diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index b1ba967a9..aa6d0e78e 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -8,7 +8,6 @@ #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "VillagePieces.h" #include "java/Random.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index c2605e23a..b7cb4c1c0 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -9,7 +9,6 @@ #include "BiomeOverrideLayer.h" #include "platform/input/input.h" #include "app/common/Console_Debug_enum.h" -#include "app/linux/LinuxGame.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" #include "minecraft/world/level/newbiome/layer/AddMushroomIslandLayer.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 2e071866e..c9f431205 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -18,7 +18,6 @@ #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 134178e25..2445e6b8f 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -20,7 +20,6 @@ #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/Timer.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 44e804b71..ee4dfbcde 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -16,7 +16,6 @@ #include "LevelData.h" #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" #include "java/File.h" diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index 6aa119ecf..6c2070685 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -8,7 +8,6 @@ #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" -#include "app/linux/LinuxGame.h" #include "java/System.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/LevelSettings.h" diff --git a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp index a8292a53c..1d23e0831 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -8,7 +8,6 @@ #include #include "LevelData.h" -#include "app/linux/LinuxGame.h" #include "java/File.h" #include "minecraft/world/level/chunk/storage/McRegionChunkStorage.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index da189ff2a..75552e023 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -6,7 +6,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index f813da13e..8185e35a1 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,7 +1,6 @@ #include "minecraft/util/Log.h" #include "NotGateTile.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index d51fca491..81fa73386 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 63e367005..8f5f79554 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "minecraft/world/entity/monster/Silverfish.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 215f17f20..cc772c83a 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -6,7 +6,6 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 4b007ebb0..164b88a44 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -4,7 +4,6 @@ #include #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index 7f6776c20..b48dc9fe2 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" #include "minecraft/network/packet/TileEntityDataPacket.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 69e07f88e..37e4b5077 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -7,7 +7,6 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index f9f03704e..0c25656e0 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -6,7 +6,6 @@ #include #include "Direction.h" -#include "app/linux/LinuxGame.h" #include "SharedConstants.h" #include "TileEntity.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp index ac6bc5d44..b8a62f988 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "TileEntity.h" #include "java/Random.h" #include "minecraft/world/Container.h" diff --git a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp index 8fda024dd..5fce7b32d 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "strings.h" diff --git a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 7667fa6c6..61ad6a322 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp index 3b4bb3836..0e4afcf8e 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -4,7 +4,6 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/CoalItem.h" diff --git a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp index fc64a992a..a2aaeb1c2 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -7,7 +7,6 @@ #include #include "Facing.h" -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/WorldlyContainer.h" diff --git a/targets/minecraft/world/level/tile/entity/TileEntity.cpp b/targets/minecraft/world/level/tile/entity/TileEntity.cpp index 89de391e5..1f13b4f89 100644 --- a/targets/minecraft/world/level/tile/entity/TileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/TileEntity.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "PistonPieceTileEntity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/JukeboxTile.h" From 95efdb54dd32179c7e65b9d4cfcb1340610482a2 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:52:50 +1000 Subject: [PATCH 008/104] chore: drop dead winapi_stubs.h includes across minecraft --- scripts/sweep_winapi_stubs_includes.py | 114 ++++++++++++++++++ .../minecraft/client/particle/Particle.cpp | 1 - .../minecraft/client/player/LocalPlayer.cpp | 1 - targets/minecraft/client/renderer/Chunk.cpp | 1 - .../client/renderer/GameRenderer.cpp | 1 - .../texture/PreStitchedTextureMap.cpp | 1 - .../client/renderer/texture/Stitcher.cpp | 1 - .../client/renderer/texture/TextureMap.cpp | 1 - .../client/skins/AbstractTexturePack.cpp | 1 - targets/minecraft/network/Connection.h | 1 - .../network/packet/CustomPayloadPacket.cpp | 1 - .../network/packet/GameCommandPacket.cpp | 1 - .../network/packet/MoveEntityPacket.cpp | 1 - .../network/packet/MoveEntityPacketSmall.cpp | 1 - .../network/packet/PreLoginPacket.cpp | 1 - .../network/packet/SetPlayerTeamPacket.cpp | 1 - targets/minecraft/server/PlayerList.cpp | 1 - .../minecraft/server/level/EntityTracker.cpp | 1 - .../server/network/PendingConnection.cpp | 1 - targets/minecraft/util/WeighedRandom.cpp | 1 - targets/minecraft/world/entity/Entity.cpp | 1 - targets/minecraft/world/item/ArmorItem.cpp | 1 - targets/minecraft/world/level/Level.cpp | 1 - .../world/level/biome/BiomeDecorator.cpp | 1 - .../level/levelgen/CustomLevelSource.cpp | 1 - .../levelgen/structure/StrongholdFeature.cpp | 1 - .../newbiome/layer/BiomeOverrideLayer.cpp | 1 - .../level/storage/DirectoryLevelStorage.cpp | 1 - .../world/level/storage/SavedDataStorage.cpp | 1 - .../world/level/tile/PressurePlateTile.cpp | 1 - 30 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 scripts/sweep_winapi_stubs_includes.py diff --git a/scripts/sweep_winapi_stubs_includes.py b/scripts/sweep_winapi_stubs_includes.py new file mode 100644 index 000000000..e1151e232 --- /dev/null +++ b/scripts/sweep_winapi_stubs_includes.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +"""Conservative sweep: remove dead app/linux/Stubs/winapi_stubs.h includes. + +winapi_stubs.h provides Windows API typedefs and constants for Linux +(LARGE_INTEGER, FILETIME, ERROR_*, etc.). Many minecraft/ files include +it as transitive leftovers and never actually reference any of those +symbols. + +Usage: + python3 scripts/sweep_winapi_stubs_includes.py [--apply] +""" + +from __future__ import annotations + +import argparse +import os +import re +import sys +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent +MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" + +INCLUDE_RE = re.compile( + r'^[ \t]*#[ \t]*include[ \t]*"app/linux/Stubs/winapi_stubs\.h"[ \t]*\n', + re.MULTILINE, +) + +# Symbols defined by winapi_stubs.h. If any appear in the consumer, the +# include is needed. +USAGE_PATTERNS = [ + re.compile(r'\bLARGE_INTEGER\b'), + re.compile(r'\bULARGE_INTEGER\b'), + re.compile(r'\bFILETIME\b'), + re.compile(r'\bSYSTEMTIME\b'), + re.compile(r'\bERROR_SUCCESS\b'), + re.compile(r'\bERROR_IO_PENDING\b'), + re.compile(r'\bERROR_CANCELLED\b'), + re.compile(r'\bMEM_COMMIT\b'), + re.compile(r'\bMEM_RESERVE\b'), + re.compile(r'\bMEM_DECOMMIT\b'), + re.compile(r'\bPAGE_READWRITE\b'), + re.compile(r'\bDWORD\b'), + re.compile(r'\bBYTE\b'), + re.compile(r'\bWORD\b'), + re.compile(r'\bHANDLE\b'), + re.compile(r'\bHRESULT\b'), + re.compile(r'\bGetLastError\b'), + re.compile(r'\bGetFileSize\b'), + re.compile(r'\bGetSystemTime\b'), + re.compile(r'\bSystemTimeToFileTime\b'), + re.compile(r'\bMakeAbsoluteSD\b'), + re.compile(r'\bSetFilePointer\b'), + re.compile(r'\bReadFile\b'), + re.compile(r'\bWriteFile\b'), + re.compile(r'\bCloseHandle\b'), + re.compile(r'\bCreateFile\b'), + re.compile(r'\bVirtualAlloc\b'), + re.compile(r'\bVirtualFree\b'), + re.compile(r'\bSleep\s*\('), + re.compile(r'\bWaitForSingleObject\b'), + re.compile(r'\bSetEvent\b'), + re.compile(r'\bResetEvent\b'), + re.compile(r'\bInterlocked'), + re.compile(r'\bOutputDebugString\b'), + re.compile(r'\bMessageBox\b'), +] + + +def needs_winapi(text: str) -> bool: + scan = INCLUDE_RE.sub("", text) + return any(p.search(scan) for p in USAGE_PATTERNS) + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--apply", action="store_true", + help="Actually remove the dead includes") + args = parser.parse_args() + + candidates: list[Path] = [] + for dirpath, _dirnames, filenames in os.walk(MINECRAFT_ROOT): + for name in filenames: + if not name.endswith((".cpp", ".c", ".h", ".hpp")): + continue + path = Path(dirpath) / name + try: + text = path.read_text(encoding="utf-8", errors="surrogateescape") + except OSError: + continue + if not INCLUDE_RE.search(text): + continue + if needs_winapi(text): + continue + candidates.append(path) + + candidates.sort() + for path in candidates: + print(path.relative_to(REPO_ROOT)) + + print(f"\n{len(candidates)} files have a dead winapi_stubs.h include") + + if args.apply: + for path in candidates: + text = path.read_text(encoding="utf-8", errors="surrogateescape") + new_text = INCLUDE_RE.sub("", text) + path.write_text(new_text, encoding="utf-8", errors="surrogateescape") + print(f"Removed from {len(candidates)} files") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/targets/minecraft/client/particle/Particle.cpp b/targets/minecraft/client/particle/Particle.cpp index 2713ce19f..28a23095c 100644 --- a/targets/minecraft/client/particle/Particle.cpp +++ b/targets/minecraft/client/particle/Particle.cpp @@ -4,7 +4,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index ab5d556bf..a25fed902 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -38,7 +38,6 @@ #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" #include "Pos.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 454700b87..b3c305f62 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -11,7 +11,6 @@ #include "platform/renderer/renderer.h" #include "LevelRenderer.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/FrameProfiler.h" #include "TileRenderer.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 4b29b322b..0df0927e9 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -18,7 +18,6 @@ #include "minecraft/GameEnums.h" #include "platform/ShutdownManager.h" #include "app/common/Colours/ColourTable.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "util/FrameProfiler.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index 7be953540..e8706b262 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" #include "StitchedTexture.h" diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index b8f0d4a80..514c2273b 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "StitchSlot.h" #include "Texture.h" #include "TextureHolder.h" diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index 67ee136bf..2856ca086 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" #include "StitchedTexture.h" diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index cf6b240e3..92463a4ef 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -9,7 +9,6 @@ #include "app/common/Colours/ColourTable.h" #include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/File.h" diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index cdac099b3..8fc94a926 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -8,7 +8,6 @@ #include #include "app/common/Network/Socket.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/C4JThread.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index d0384eea4..78ff7c704 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 693decb7d..0f05da553 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/MoveEntityPacket.cpp b/targets/minecraft/network/packet/MoveEntityPacket.cpp index 1f3bdadd4..91525d759 100644 --- a/targets/minecraft/network/packet/MoveEntityPacket.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacket.cpp @@ -2,7 +2,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp index 97410a0fe..3677770a1 100644 --- a/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp +++ b/targets/minecraft/network/packet/MoveEntityPacketSmall.cpp @@ -2,7 +2,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 4d4de72b9..7b8513093 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -7,7 +7,6 @@ #include "app/common/BuildVer/BuildVer.h" #include "platform/IPlatformNetwork.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 14796f459..8befc915a 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 6b549d60f..20efba2eb 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -20,7 +20,6 @@ #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "MinecraftServer.h" #include "Settings.h" diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 0ee2a9d84..cfe112c3a 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -8,7 +8,6 @@ #include #include "app/common/Network/NetworkPlayerInterface.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "TrackedEntity.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 0ca0b077e..0784be2d0 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -13,7 +13,6 @@ #include "app/common/BuildVer/BuildVer.h" #include "app/common/Network/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" diff --git a/targets/minecraft/util/WeighedRandom.cpp b/targets/minecraft/util/WeighedRandom.cpp index 07a99f54d..60c1a9bed 100644 --- a/targets/minecraft/util/WeighedRandom.cpp +++ b/targets/minecraft/util/WeighedRandom.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" int WeighedRandom::getTotalWeight(std::vector* items) { diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 5a1ba6fe1..42c04844b 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -18,7 +18,6 @@ #include "EntityPos.h" #include "SyncedEntityData.h" #include "minecraft/GameEnums.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 0ef001e3e..5559d51ad 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -6,7 +6,6 @@ #include #include "app/common/Colours/ColourTable.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" #include "minecraft/core/BehaviorRegistry.h" diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 53298953f..dbf3d0c22 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -21,7 +21,6 @@ #include "app/common/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/FrameProfiler.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index d84f7e423..a02a9a159 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -2,7 +2,6 @@ #include "minecraft/world/level/biome/BiomeDecorator.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 8c8737b28..cc9d7aeb0 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -11,7 +11,6 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #if defined(__linux__) -#include "app/linux/Stubs/winapi_stubs.h" #endif #include "java/Random.h" #include "minecraft/world/entity/MobCategory.h" diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 22db4633b..5bbeedf0d 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -12,7 +12,6 @@ #include "minecraft/GameEnums.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index 784dfccf6..ac5c7ba22 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -7,7 +7,6 @@ #include "platform/fs/fs.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #if defined(__linux__) -#include "app/linux/Stubs/winapi_stubs.h" #endif #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index ee4dfbcde..f4910edbd 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -16,7 +16,6 @@ #include "LevelData.h" #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.cpp b/targets/minecraft/world/level/storage/SavedDataStorage.cpp index c39f5140b..eee2f488b 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.cpp +++ b/targets/minecraft/world/level/storage/SavedDataStorage.cpp @@ -5,7 +5,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/entity/ai/village/Villages.h" diff --git a/targets/minecraft/world/level/tile/PressurePlateTile.cpp b/targets/minecraft/world/level/tile/PressurePlateTile.cpp index fc1b59016..f231bd67d 100644 --- a/targets/minecraft/world/level/tile/PressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/PressurePlateTile.cpp @@ -4,7 +4,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" From 5f7e4ab7037bcbe580bc1f2deef9204ff2abcc96 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:55:45 +1000 Subject: [PATCH 009/104] refactor: move Console_Awards_enum.h into minecraft --- targets/minecraft/stats/Achievements.cpp | 2 +- targets/minecraft/stats/CommonStats.h | 2 +- targets/{app/common => minecraft/stats}/Console_Awards_enum.h | 0 targets/minecraft/stats/GenericStats.h | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename targets/{app/common => minecraft/stats}/Console_Awards_enum.h (100%) diff --git a/targets/minecraft/stats/Achievements.cpp b/targets/minecraft/stats/Achievements.cpp index 767edebbc..121912f1e 100644 --- a/targets/minecraft/stats/Achievements.cpp +++ b/targets/minecraft/stats/Achievements.cpp @@ -5,7 +5,7 @@ #include #include "Achievement.h" -#include "app/common/Console_Awards_enum.h" +#include "minecraft/stats/Console_Awards_enum.h" #include "minecraft/world/item/BowItem.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" diff --git a/targets/minecraft/stats/CommonStats.h b/targets/minecraft/stats/CommonStats.h index 47eacd2d4..41b2f053b 100644 --- a/targets/minecraft/stats/CommonStats.h +++ b/targets/minecraft/stats/CommonStats.h @@ -6,7 +6,7 @@ #include #include "GenericStats.h" -#include "app/common/Console_Awards_enum.h" +#include "minecraft/stats/Console_Awards_enum.h" #include "java/Class.h" class CommonStats : public GenericStats { diff --git a/targets/app/common/Console_Awards_enum.h b/targets/minecraft/stats/Console_Awards_enum.h similarity index 100% rename from targets/app/common/Console_Awards_enum.h rename to targets/minecraft/stats/Console_Awards_enum.h diff --git a/targets/minecraft/stats/GenericStats.h b/targets/minecraft/stats/GenericStats.h index 6d25d356a..9e45171bc 100644 --- a/targets/minecraft/stats/GenericStats.h +++ b/targets/minecraft/stats/GenericStats.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/Console_Awards_enum.h" +#include "minecraft/stats/Console_Awards_enum.h" #include "Stat.h" #include "Stats.h" #include "java/Class.h" @@ -19,7 +19,7 @@ class Stat; // #include "minecraft/world/damageSource/DamageSource.h" -// #include "app/common/Console_Awards_enum.h" +// #include "minecraft/stats/Console_Awards_enum.h" /** 4J-JEV: From 016b2d91b409549b45111c96169935c693151ced Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:59:26 +1000 Subject: [PATCH 010/104] refactor: move StringTable.h into minecraft (impl stays for now) --- targets/app/common/DLC/DLCLocalisationFile.cpp | 2 +- targets/app/common/DLC/DLCPack.cpp | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/Game.h | 2 +- targets/app/common/GameRules/GameRuleManager.cpp | 2 +- .../common/GameRules/LevelGeneration/LevelGenerationOptions.cpp | 2 +- .../common/GameRules/LevelGeneration/LevelGenerationOptions.h | 2 +- .../GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp | 2 +- targets/app/common/Localisation/StringTable.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 2 +- targets/minecraft/client/skins/DLCTexturePack.cpp | 2 +- targets/minecraft/client/skins/DLCTexturePack.h | 2 +- .../{app/common/Localisation => minecraft/locale}/StringTable.h | 0 13 files changed, 12 insertions(+), 12 deletions(-) rename targets/{app/common/Localisation => minecraft/locale}/StringTable.h (100%) diff --git a/targets/app/common/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp index 2c79dca26..2a66aaafd 100644 --- a/targets/app/common/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" DLCLocalisationFile::DLCLocalisationFile(const std::string& path) : DLCFile(DLCManager::e_DLCType_LocalisationData, path) { diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 27630c9e6..4660e6b0a 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -19,7 +19,7 @@ #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 68aaa8b6a..8d7a67455 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -76,7 +76,7 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Colours/ColourTable.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "Minecraft_Macros.h" diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 0a19a83b0..9e7be771b 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -26,7 +26,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 9994fbd10..29c31bf94 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -18,7 +18,7 @@ #include "app/common/GameRules/LevelRules/LevelRules.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 8abce74f1..76fc4aa4f 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -17,7 +17,7 @@ #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/File.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h index 0c0fdbfa3..d197644a3 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h @@ -11,7 +11,7 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class ApplySchematicRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index fe50e6dff..c103bbaa4 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -3,7 +3,7 @@ #include "app/common/GameRules/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" class AABB; diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp index 2c14c763b..beb418cbc 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/app/common/Localisation/StringTable.cpp @@ -1,4 +1,4 @@ -#include "StringTable.h" +#include "minecraft/locale/StringTable.h" #include #include diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 761d1c628..85bb26c4f 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -8,7 +8,7 @@ #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/common/Colours/ColourTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/LinuxGame.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 741d2ade0..aca47c4dd 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -23,7 +23,7 @@ #include "app/common/DLC/DLCUIDataFile.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index 29914cddc..a7d8c067b 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -5,7 +5,7 @@ #include "platform/PlatformTypes.h" #include "AbstractTexturePack.h" -#include "app/common/Localisation/StringTable.h" +#include "minecraft/locale/StringTable.h" class DLCPack; class StringTable; diff --git a/targets/app/common/Localisation/StringTable.h b/targets/minecraft/locale/StringTable.h similarity index 100% rename from targets/app/common/Localisation/StringTable.h rename to targets/minecraft/locale/StringTable.h From 7b28bcbcb6b06d082b0a8790ba8509d37f45b7b5 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:02:14 +1000 Subject: [PATCH 011/104] refactor: move ColourTable into minecraft --- targets/app/common/DLC/DLCColourTableFile.cpp | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 2 +- targets/app/common_sources.txt | 1 - targets/minecraft/client/Minecraft.cpp | 2 +- targets/minecraft/client/gui/Minimap.cpp | 2 +- targets/minecraft/client/particle/DragonBreathParticle.cpp | 2 +- targets/minecraft/client/particle/DripParticle.cpp | 2 +- targets/minecraft/client/particle/EnchantmentTableParticle.cpp | 2 +- targets/minecraft/client/particle/EnderParticle.cpp | 2 +- targets/minecraft/client/particle/ExplodeParticle.cpp | 2 +- targets/minecraft/client/particle/HugeExplosionParticle.cpp | 2 +- targets/minecraft/client/particle/NetherPortalParticle.cpp | 2 +- targets/minecraft/client/particle/NoteParticle.cpp | 2 +- targets/minecraft/client/particle/SmokeParticle.cpp | 2 +- targets/minecraft/client/particle/SuspendedParticle.cpp | 2 +- targets/minecraft/client/renderer/GameRenderer.cpp | 2 +- targets/minecraft/client/renderer/ItemInHandRenderer.cpp | 2 +- targets/minecraft/client/renderer/LevelRenderer.cpp | 2 +- targets/minecraft/client/renderer/TileRenderer.cpp | 2 +- targets/minecraft/client/renderer/entity/MobRenderer.cpp | 2 +- targets/minecraft/client/renderer/tileentity/SignRenderer.cpp | 2 +- .../client/resources}/Colours/ColourTable.cpp | 2 +- .../common => minecraft/client/resources}/Colours/ColourTable.h | 0 targets/minecraft/client/skins/AbstractTexturePack.cpp | 2 +- targets/minecraft/client/skins/DLCTexturePack.cpp | 2 +- targets/minecraft/sources.txt | 1 + targets/minecraft/world/entity/EntityIO.h | 2 +- targets/minecraft/world/item/ArmorItem.cpp | 2 +- targets/minecraft/world/item/SpawnEggItem.cpp | 2 +- targets/minecraft/world/item/alchemy/PotionBrewing.cpp | 2 +- targets/minecraft/world/level/FoliageColor.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 2 +- targets/minecraft/world/level/biome/Biome.cpp | 2 +- targets/minecraft/world/level/dimension/Dimension.cpp | 2 +- targets/minecraft/world/level/dimension/HellDimension.cpp | 2 +- targets/minecraft/world/level/dimension/TheEndDimension.cpp | 2 +- targets/minecraft/world/level/tile/GrassTile.cpp | 2 +- targets/minecraft/world/level/tile/LeafTile.cpp | 2 +- targets/minecraft/world/level/tile/RedStoneDustTile.cpp | 2 +- targets/minecraft/world/level/tile/StemTile.cpp | 2 +- targets/minecraft/world/level/tile/TallGrassPlantTile.cpp | 2 +- targets/minecraft/world/level/tile/WaterLilyTile.cpp | 2 +- 43 files changed, 41 insertions(+), 41 deletions(-) rename targets/{app/common => minecraft/client/resources}/Colours/ColourTable.cpp (99%) rename targets/{app/common => minecraft/client/resources}/Colours/ColourTable.h (100%) diff --git a/targets/app/common/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp index af08ce99d..479ec07d8 100644 --- a/targets/app/common/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -1,7 +1,7 @@ #include "DLCColourTableFile.h" #include "DLCManager.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 8d7a67455..8357f07a9 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -74,7 +74,7 @@ #include "platform/input/input.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCPack.h" #include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 85bb26c4f..c4b975d5e 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -9,7 +9,7 @@ #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "minecraft/locale/StringTable.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index b34508a53..8f1b38284 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -4,7 +4,6 @@ common/Audio/Consoles_SoundEngine.cpp common/Audio/SoundEngine.cpp common/Audio/SoundNames.cpp common/BannedListManager.cpp -common/Colours/ColourTable.cpp common/ConsoleGameMode.cpp common/DLC/DLCAudioFile.cpp common/DLC/DLCCapeFile.cpp diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 91fbb8db1..519234943 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -103,7 +103,7 @@ #if defined(ENABLE_JAVA_GUIS) #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Minecraft_Macros.h" diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index cae204f9c..b245410e7 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -10,7 +10,7 @@ #include "platform/renderer/renderer.h" #include "Font.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index 95fb45e85..9c8b011cd 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,7 +1,7 @@ #include "DragonBreathParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index a91826588..c95ff1979 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index 5f1fc3a4c..6b3de3eeb 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,7 +1,7 @@ #include "EnchantmentTableParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index 09b440886..b9fa842e6 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,7 +1,7 @@ #include "EnderParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index 497e50880..cb2858ea5 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,7 +1,7 @@ #include "ExplodeParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index b29c58a9b..81eab7ac6 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -4,7 +4,7 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index 2f74cf654..d01344b51 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,7 +1,7 @@ #include "NetherPortalParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index e9544152e..6e8b26354 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/SmokeParticle.cpp b/targets/minecraft/client/particle/SmokeParticle.cpp index a4cd52689..b91241b83 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,7 +1,7 @@ #include "SmokeParticle.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 2251c52ab..7b86453be 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 0df0927e9..d96ca4295 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -17,7 +17,7 @@ #include "LevelRenderer.h" #include "minecraft/GameEnums.h" #include "platform/ShutdownManager.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "util/FrameProfiler.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index fd4afe9d5..fe85738aa 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -10,7 +10,7 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "Tesselator.h" #include "Textures.h" #include "TileRenderer.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index c785d827c..c855edc15 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -22,7 +22,7 @@ #include "GameRenderer.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "util/FrameProfiler.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index aea9f3f63..273e79d90 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -13,7 +13,7 @@ #include "EntityTileRenderer.h" #include "GameRenderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "util/FrameProfiler.h" #include "Tesselator.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index 48fc3df65..b74d3236e 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -8,7 +8,7 @@ #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index ee9b663f0..16b433fa3 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -7,7 +7,7 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/Colours/ColourTable.cpp b/targets/minecraft/client/resources/Colours/ColourTable.cpp similarity index 99% rename from targets/app/common/Colours/ColourTable.cpp rename to targets/minecraft/client/resources/Colours/ColourTable.cpp index 044e31b87..0db6b345f 100644 --- a/targets/app/common/Colours/ColourTable.cpp +++ b/targets/minecraft/client/resources/Colours/ColourTable.cpp @@ -1,4 +1,4 @@ -#include "ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include #include diff --git a/targets/app/common/Colours/ColourTable.h b/targets/minecraft/client/resources/Colours/ColourTable.h similarity index 100% rename from targets/app/common/Colours/ColourTable.h rename to targets/minecraft/client/resources/Colours/ColourTable.h diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index 92463a4ef..13b02e3ad 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -6,7 +6,7 @@ #include -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/BufferedImage.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index aca47c4dd..bc2447de8 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -11,7 +11,7 @@ #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" #include "app/common/DLC/DLCFile.h" diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index 514d291a5..cb6d0b47a 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -255,6 +255,7 @@ client/renderer/tileentity/SkullTileRenderer.cpp client/renderer/tileentity/TheEndPortalRenderer.cpp client/renderer/tileentity/TileEntityRenderDispatcher.cpp client/renderer/tileentity/TileEntityRenderer.cpp +client/resources/Colours/ColourTable.cpp client/skins/AbstractTexturePack.cpp client/skins/DLCTexturePack.cpp client/skins/DefaultTexturePack.cpp diff --git a/targets/minecraft/world/entity/EntityIO.h b/targets/minecraft/world/entity/EntityIO.h index 8693f099a..e309b6876 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -6,7 +6,7 @@ #include "Entity.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/JavaIntHash.h" diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 5559d51ad..9600b2a98 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" #include "minecraft/core/BehaviorRegistry.h" diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index acaaf79b0..2acc074fe 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -5,7 +5,7 @@ #include #include "Facing.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp index c98b2924d..acb0c336b 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index c406d365e..32b64bc16 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,7 +1,7 @@ #include "FoliageColor.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" // 4J Stu - Don't use this any more diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index dbf3d0c22..42512fc21 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -18,7 +18,7 @@ #include "platform/input/input.h" #include "LevelListener.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "util/FrameProfiler.h" diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index f617b1f30..6dc0e967c 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -7,7 +7,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 0700a9fee..12ac98d46 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -8,7 +8,7 @@ #include "HellDimension.h" #include "platform/input/input.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "NormalDimension.h" #include "TheEndDimension.h" diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index 6b7694c4d..abc2a17e8 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -5,7 +5,7 @@ #include "platform/input/input.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/dimension/TheEndDimension.cpp b/targets/minecraft/world/level/dimension/TheEndDimension.cpp index 10b1ee6ad..5558b808d 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -5,7 +5,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/GrassTile.cpp b/targets/minecraft/world/level/tile/GrassTile.cpp index 52c629a32..ffba0293c 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index 3883be2e6..e37d26e44 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/core/particles/ParticleTypes.h" diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index f2cfe9409..49a593141 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -7,7 +7,7 @@ #include "DiodeTile.h" #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index e6bda67c5..e46db21c9 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp index a66f5a3e5..5925a7066 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index ec4dda5da..0b5093458 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -4,7 +4,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Colours/ColourTable.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/Entity.h" From 9834a95f0e98efa02da019df902291a6cdd8ffbf Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:09:03 +1000 Subject: [PATCH 012/104] build: break platform_sdl2 up into per-subsystem libraries --- targets/app/meson.build | 1 + targets/minecraft/meson.build | 1 + targets/platform/fs/meson.build | 12 ++++++ targets/platform/input/meson.build | 13 +++++++ targets/platform/meson.build | 55 +++++++++------------------ targets/platform/profile/meson.build | 12 ++++++ targets/platform/renderer/meson.build | 13 +++++++ targets/platform/storage/meson.build | 12 ++++++ 8 files changed, 82 insertions(+), 37 deletions(-) create mode 100644 targets/platform/fs/meson.build create mode 100644 targets/platform/input/meson.build create mode 100644 targets/platform/profile/meson.build create mode 100644 targets/platform/renderer/meson.build create mode 100644 targets/platform/storage/meson.build diff --git a/targets/app/meson.build b/targets/app/meson.build index 7fd687740..6641edc3f 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -15,6 +15,7 @@ client_dependencies = [ input_dep, profile_dep, storage_dep, + fs_dep, assets_localisation_dep, platform_dep, minecraft_dep, diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index 76e7f3fc6..2de8cc71a 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -28,6 +28,7 @@ lib_minecraft = static_library('minecraft', input_dep, profile_dep, storage_dep, + fs_dep, glm_dep, nbt_dep, java_dep, diff --git a/targets/platform/fs/meson.build b/targets/platform/fs/meson.build new file mode 100644 index 000000000..bb91f51fb --- /dev/null +++ b/targets/platform/fs/meson.build @@ -0,0 +1,12 @@ +lib_platform_fs_std = static_library( + 'platform_fs_std', + files('std/StdFilesystem.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_threads], + cpp_args: global_cpp_args + global_cpp_defs, +) + +fs_dep = declare_dependency( + link_with: lib_platform_fs_std, + include_directories: [platform_inc], +) diff --git a/targets/platform/input/meson.build b/targets/platform/input/meson.build new file mode 100644 index 000000000..3ae17a68e --- /dev/null +++ b/targets/platform/input/meson.build @@ -0,0 +1,13 @@ +lib_platform_input_sdl2 = static_library( + 'platform_input_sdl2', + files('sdl2/SDL2Input.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_sdl2, _threads], + cpp_args: global_cpp_args + global_cpp_defs, +) + +input_dep = declare_dependency( + link_with: lib_platform_input_sdl2, + include_directories: [platform_inc], + dependencies: [_sdl2], +) diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 7aed1816f..a52dc8255 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -1,6 +1,16 @@ platform_inc = include_directories('.') _threads = dependency('threads') +_sdl2 = dependency('sdl2') +if get_option('renderer') == 'gles' + _gl = dependency('glesv2', required: true) + _defs = ['-DGLES'] +else + _gl = dependency('gl', required: true) + _defs = [] +endif + +# Core: thread + shutdown plumbing, no backend. lib_platform_core = static_library('platform_core', files('C4JThread.cpp', 'ShutdownManager.cpp'), include_directories: [platform_inc, include_directories('..')], @@ -13,40 +23,11 @@ platform_dep = declare_dependency( include_directories: platform_inc, ) -# SDL2-based platform implementations (formerly 4J.* modules) -_sdl2 = dependency('sdl2') -_defs = [] - -if get_option('renderer') == 'gles' - _gl = dependency('glesv2', required: true) - _defs += ['-DGLES'] -else - _gl = dependency('gl', required: true) -endif - -sdl2_sources = files( - 'input/sdl2/SDL2Input.cpp', - 'profile/stub/StubProfile.cpp', - 'storage/stub/StubStorage.cpp', - 'renderer/gl/GLRenderer.cpp', - 'renderer/gl/render_stubs.cpp', - 'fs/std/StdFilesystem.cpp', -) - -lib_platform_sdl2 = static_library('platform_sdl2', - sdl2_sources, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep], - cpp_args: _defs + global_cpp_args + global_cpp_defs, -) - -# Combined dependency: interfaces + SDL2 implementations -# Replaces the old render_dep, input_dep, profile_dep, storage_dep -render_dep = declare_dependency( - link_with: lib_platform_sdl2, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep], -) -input_dep = render_dep -profile_dep = render_dep -storage_dep = render_dep +# Per-subsystem backends. Each lives in its own subdir and produces its +# own library + dep so consumers can ask for the subsystem they need +# without dragging the others in. +subdir('input') +subdir('profile') +subdir('storage') +subdir('fs') +subdir('renderer') diff --git a/targets/platform/profile/meson.build b/targets/platform/profile/meson.build new file mode 100644 index 000000000..8990e76d4 --- /dev/null +++ b/targets/platform/profile/meson.build @@ -0,0 +1,12 @@ +lib_platform_profile_stub = static_library( + 'platform_profile_stub', + files('stub/StubProfile.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_threads], + cpp_args: global_cpp_args + global_cpp_defs, +) + +profile_dep = declare_dependency( + link_with: lib_platform_profile_stub, + include_directories: [platform_inc], +) diff --git a/targets/platform/renderer/meson.build b/targets/platform/renderer/meson.build new file mode 100644 index 000000000..ee1bfa419 --- /dev/null +++ b/targets/platform/renderer/meson.build @@ -0,0 +1,13 @@ +lib_platform_renderer_gl = static_library( + 'platform_renderer_gl', + files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep], + cpp_args: _defs + global_cpp_args + global_cpp_defs, +) + +render_dep = declare_dependency( + link_with: lib_platform_renderer_gl, + include_directories: [platform_inc], + dependencies: [_sdl2, _gl, _threads, glm_dep], +) diff --git a/targets/platform/storage/meson.build b/targets/platform/storage/meson.build new file mode 100644 index 000000000..a4b5d57ec --- /dev/null +++ b/targets/platform/storage/meson.build @@ -0,0 +1,12 @@ +lib_platform_storage_stub = static_library( + 'platform_storage_stub', + files('stub/StubStorage.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_threads], + cpp_args: global_cpp_args + global_cpp_defs, +) + +storage_dep = declare_dependency( + link_with: lib_platform_storage_stub, + include_directories: [platform_inc], +) From 60410f59bf45a30f3822a45ca05a8b3c45c56483 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:16:28 +1000 Subject: [PATCH 013/104] refactor: split GLRenderer so the class is not tangled with GL macros --- targets/minecraft/client/Lighting.cpp | 1 + targets/minecraft/client/MemoryTracker.cpp | 1 + targets/minecraft/client/Minecraft.cpp | 1 + targets/minecraft/client/gui/Button.cpp | 1 + targets/minecraft/client/gui/DeathScreen.cpp | 1 + targets/minecraft/client/gui/Font.cpp | 1 + targets/minecraft/client/gui/Gui.cpp | 1 + targets/minecraft/client/gui/GuiComponent.cpp | 1 + targets/minecraft/client/gui/Minimap.cpp | 1 + targets/minecraft/client/gui/SlideButton.cpp | 1 + .../client/gui/TradeSwitchButton.cpp | 1 + .../gui/achievement/AchievementPopup.cpp | 1 + .../gui/inventory/AbstractBeaconButton.cpp | 1 + .../client/gui/inventory/BeaconScreen.cpp | 1 + .../gui/inventory/BrewingStandScreen.cpp | 1 + .../client/gui/inventory/ContainerScreen.cpp | 1 + .../client/gui/inventory/CraftingScreen.cpp | 1 + .../gui/inventory/EnchantmentScreen.cpp | 1 + .../client/gui/inventory/FurnaceScreen.cpp | 1 + .../client/gui/inventory/HopperScreen.cpp | 1 + .../gui/inventory/HorseInventoryScreen.cpp | 1 + .../client/gui/inventory/InventoryScreen.cpp | 1 + .../client/gui/inventory/MerchantScreen.cpp | 1 + .../client/gui/inventory/RepairScreen.cpp | 1 + targets/minecraft/client/model/ChestModel.cpp | 1 + .../minecraft/client/model/ChickenModel.cpp | 1 + targets/minecraft/client/model/GhastModel.cpp | 1 + .../minecraft/client/model/HumanoidModel.cpp | 1 + targets/minecraft/client/model/ModelHorse.cpp | 1 + .../minecraft/client/model/OcelotModel.cpp | 1 + .../minecraft/client/model/QuadrupedModel.cpp | 1 + targets/minecraft/client/model/WolfModel.cpp | 1 + .../client/model/dragon/DragonModel.cpp | 1 + .../client/model/dragon/EnderCrystalModel.cpp | 1 + .../minecraft/client/model/geom/ModelPart.cpp | 1 + .../client/particle/FootstepParticle.cpp | 1 + .../client/particle/HugeExplosionParticle.cpp | 1 + .../client/particle/ParticleEngine.cpp | 1 + .../client/particle/TakeAnimationParticle.cpp | 1 + targets/minecraft/client/renderer/Chunk.cpp | 1 + .../client/renderer/ItemInHandRenderer.cpp | 1 + .../client/renderer/LevelRenderer.cpp | 1 + .../client/renderer/OffsettedRenderList.cpp | 1 + .../minecraft/client/renderer/Textures.cpp | 1 + .../client/renderer/TileRenderer.cpp | 1 + .../client/renderer/culling/Frustum.cpp | 1 + .../client/renderer/entity/ArrowRenderer.cpp | 1 + .../client/renderer/entity/BatRenderer.cpp | 1 + .../client/renderer/entity/BoatRenderer.cpp | 1 + .../renderer/entity/CaveSpiderRenderer.cpp | 1 + .../renderer/entity/CreeperRenderer.cpp | 1 + .../renderer/entity/DefaultRenderer.cpp | 1 + .../renderer/entity/EnderCrystalRenderer.cpp | 1 + .../renderer/entity/EnderDragonRenderer.cpp | 1 + .../renderer/entity/EndermanRenderer.cpp | 1 + .../entity/EntityRenderDispatcher.cpp | 1 + .../client/renderer/entity/EntityRenderer.cpp | 1 + .../renderer/entity/ExperienceOrbRenderer.cpp | 1 + .../renderer/entity/FallingTileRenderer.cpp | 1 + .../renderer/entity/FireballRenderer.cpp | 1 + .../renderer/entity/FishingHookRenderer.cpp | 1 + .../client/renderer/entity/GhastRenderer.cpp | 1 + .../renderer/entity/GiantMobRenderer.cpp | 1 + .../client/renderer/entity/HorseRenderer.cpp | 1 + .../renderer/entity/HumanoidMobRenderer.cpp | 1 + .../renderer/entity/ItemFrameRenderer.cpp | 1 + .../client/renderer/entity/ItemRenderer.cpp | 1 + .../renderer/entity/ItemSpriteRenderer.cpp | 1 + .../renderer/entity/LavaSlimeRenderer.cpp | 1 + .../renderer/entity/LeashKnotRenderer.cpp | 1 + .../renderer/entity/LightningBoltRenderer.cpp | 1 + .../renderer/entity/LivingEntityRenderer.cpp | 1 + .../renderer/entity/MinecartRenderer.cpp | 1 + .../client/renderer/entity/MobRenderer.cpp | 1 + .../renderer/entity/MushroomCowRenderer.cpp | 1 + .../client/renderer/entity/OcelotRenderer.cpp | 1 + .../renderer/entity/PaintingRenderer.cpp | 1 + .../client/renderer/entity/PlayerRenderer.cpp | 1 + .../client/renderer/entity/SheepRenderer.cpp | 1 + .../renderer/entity/SkeletonRenderer.cpp | 1 + .../client/renderer/entity/SlimeRenderer.cpp | 1 + .../renderer/entity/SnowManRenderer.cpp | 1 + .../client/renderer/entity/SpiderRenderer.cpp | 1 + .../client/renderer/entity/SquidRenderer.cpp | 1 + .../renderer/entity/TntMinecartRenderer.cpp | 1 + .../client/renderer/entity/TntRenderer.cpp | 1 + .../renderer/entity/VillagerGolemRenderer.cpp | 1 + .../renderer/entity/VillagerRenderer.cpp | 1 + .../client/renderer/entity/WitchRenderer.cpp | 1 + .../renderer/entity/WitherBossRenderer.cpp | 1 + .../renderer/entity/WitherSkullRenderer.cpp | 1 + .../client/renderer/entity/WolfRenderer.cpp | 1 + .../client/renderer/texture/Texture.cpp | 1 + .../client/renderer/texture/Texture.h | 1 + .../renderer/tileentity/BeaconRenderer.cpp | 1 + .../renderer/tileentity/ChestRenderer.cpp | 1 + .../tileentity/EnchantTableRenderer.cpp | 1 + .../tileentity/EnderChestRenderer.cpp | 1 + .../tileentity/MobSpawnerRenderer.cpp | 1 + .../tileentity/PistonPieceRenderer.cpp | 1 + .../renderer/tileentity/SignRenderer.cpp | 1 + .../renderer/tileentity/SkullTileRenderer.cpp | 1 + .../tileentity/TheEndPortalRenderer.cpp | 1 + .../tileentity/TileEntityRenderDispatcher.cpp | 1 + .../client/skins/AbstractTexturePack.cpp | 1 + .../minecraft/client/title/TitleScreen.cpp | 1 + targets/platform/renderer/gl/GLRenderer.h | 568 ----------------- targets/platform/renderer/gl/gl_compat.h | 595 ++++++++++++++++++ targets/platform/renderer/renderer.h | 10 +- targets/platform/stubs.h | 1 + 110 files changed, 710 insertions(+), 570 deletions(-) create mode 100644 targets/platform/renderer/gl/gl_compat.h diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index e2a03d56f..ef9e1087a 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -1,4 +1,5 @@ #include "Lighting.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index f8830d3c3..7e60bbbe9 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -1,4 +1,5 @@ #include "MemoryTracker.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 519234943..309bcf5f3 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1,4 +1,5 @@ #include "Minecraft.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/Button.cpp b/targets/minecraft/client/gui/Button.cpp index f2ea78386..1d0cc9458 100644 --- a/targets/minecraft/client/gui/Button.cpp +++ b/targets/minecraft/client/gui/Button.cpp @@ -1,4 +1,5 @@ #include "Button.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 723d88fd9..04df42ce8 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -1,4 +1,5 @@ #include "DeathScreen.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index bc2b164ba..c8fef7dc9 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -1,4 +1,5 @@ #include "Font.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index b650252ba..2ae6d830e 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "Gui.h" #include diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index 11b209f2c..839fbb660 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -1,4 +1,5 @@ #include "GuiComponent.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index b245410e7..d649343f8 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -1,4 +1,5 @@ #include "Minimap.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/SlideButton.cpp b/targets/minecraft/client/gui/SlideButton.cpp index d617e1bef..4b908415c 100644 --- a/targets/minecraft/client/gui/SlideButton.cpp +++ b/targets/minecraft/client/gui/SlideButton.cpp @@ -1,4 +1,5 @@ #include "SlideButton.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index ee0063317..dc0ecd691 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -1,4 +1,5 @@ #include "TradeSwitchButton.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index 1830e3a22..cb77e9436 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -1,4 +1,5 @@ #include "AchievementPopup.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp index b862f511c..74e622032 100644 --- a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp @@ -1,4 +1,5 @@ #include "AbstractBeaconButton.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 07bfa39aa..1b487a04b 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -1,4 +1,5 @@ #include "BeaconScreen.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index 49f4b940b..0c7cf7a0a 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -1,4 +1,5 @@ #include "BrewingStandScreen.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp index 87d7d5cbf..ae91c2dcd 100644 --- a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp @@ -1,4 +1,5 @@ #include "ContainerScreen.h" +#include "platform/stubs.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp index 49e40f26e..a6bcbf21e 100644 --- a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp @@ -1,4 +1,5 @@ #include "CraftingScreen.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index 13b01596e..24b817438 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -1,4 +1,5 @@ #include "EnchantmentScreen.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp index a1823b4c5..06cbfe66f 100644 --- a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp +++ b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp @@ -1,4 +1,5 @@ #include "FurnaceScreen.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/gui/inventory/HopperScreen.cpp b/targets/minecraft/client/gui/inventory/HopperScreen.cpp index fb3f5611e..cb5708a3a 100644 --- a/targets/minecraft/client/gui/inventory/HopperScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HopperScreen.cpp @@ -1,4 +1,5 @@ #include "HopperScreen.h" +#include "platform/stubs.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 0ff98dac2..7ebd3f8d9 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -1,4 +1,5 @@ #include "HorseInventoryScreen.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp index f31715916..db178dc35 100644 --- a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp @@ -1,4 +1,5 @@ #include "InventoryScreen.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index d7e7a540d..7a832e609 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -1,4 +1,5 @@ #include "MerchantScreen.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index 67e1cb606..ae6122887 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -1,4 +1,5 @@ #include "RepairScreen.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index 80f849e8e..baf79cd93 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,4 +1,5 @@ #include "ChestModel.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" diff --git a/targets/minecraft/client/model/ChickenModel.cpp b/targets/minecraft/client/model/ChickenModel.cpp index 6604567ef..9f55a298c 100644 --- a/targets/minecraft/client/model/ChickenModel.cpp +++ b/targets/minecraft/client/model/ChickenModel.cpp @@ -1,4 +1,5 @@ #include "ChickenModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/GhastModel.cpp b/targets/minecraft/client/model/GhastModel.cpp index 676797e77..49c79f342 100644 --- a/targets/minecraft/client/model/GhastModel.cpp +++ b/targets/minecraft/client/model/GhastModel.cpp @@ -1,4 +1,5 @@ #include "GhastModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index cf451287d..aa232c760 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -1,4 +1,5 @@ #include "minecraft/util/Log.h" +#include "platform/stubs.h" #include "HumanoidModel.h" #include diff --git a/targets/minecraft/client/model/ModelHorse.cpp b/targets/minecraft/client/model/ModelHorse.cpp index 43c598547..0f1ade837 100644 --- a/targets/minecraft/client/model/ModelHorse.cpp +++ b/targets/minecraft/client/model/ModelHorse.cpp @@ -1,4 +1,5 @@ #include "ModelHorse.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/model/OcelotModel.cpp b/targets/minecraft/client/model/OcelotModel.cpp index 088d8d1a1..1b0d29a06 100644 --- a/targets/minecraft/client/model/OcelotModel.cpp +++ b/targets/minecraft/client/model/OcelotModel.cpp @@ -1,4 +1,5 @@ #include "OcelotModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 5fc29c030..1c98b7f2e 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -1,4 +1,5 @@ #include "QuadrupedModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/WolfModel.cpp b/targets/minecraft/client/model/WolfModel.cpp index f9b86fee1..b1f345c0b 100644 --- a/targets/minecraft/client/model/WolfModel.cpp +++ b/targets/minecraft/client/model/WolfModel.cpp @@ -1,4 +1,5 @@ #include "WolfModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 69aeb7c5c..9f64413fd 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -1,4 +1,5 @@ #include "DragonModel.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index f84bac143..590cd0f8a 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -1,4 +1,5 @@ #include "EnderCrystalModel.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index 2f003f8f0..f49fa93cc 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -1,4 +1,5 @@ #include "ModelPart.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index fb35d73a9..96dbee555 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -1,4 +1,5 @@ #include "FootstepParticle.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 81eab7ac6..6cf2e188f 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -1,4 +1,5 @@ #include "HugeExplosionParticle.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 7267e750f..9e38bdf6c 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -1,4 +1,5 @@ #include "ParticleEngine.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index c71e150e4..5994d3da7 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -1,4 +1,5 @@ #include "TakeAnimationParticle.h" +#include "platform/stubs.h" diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index b3c305f62..0c42015ce 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -1,4 +1,5 @@ #include "Chunk.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index fe85738aa..6ed11dc66 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index c855edc15..018a07052 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "minecraft/util/Log.h" #include "LevelRenderer.h" diff --git a/targets/minecraft/client/renderer/OffsettedRenderList.cpp b/targets/minecraft/client/renderer/OffsettedRenderList.cpp index 58e57e81f..34d1d1123 100644 --- a/targets/minecraft/client/renderer/OffsettedRenderList.cpp +++ b/targets/minecraft/client/renderer/OffsettedRenderList.cpp @@ -1,4 +1,5 @@ #include "OffsettedRenderList.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" #include "java/IntBuffer.h" diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index 6ae27ca29..eae1272b5 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "Textures.h" #include diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index 273e79d90..79beb927d 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -1,4 +1,5 @@ #include "TileRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index 203d20404..a11bee30e 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -7,6 +7,7 @@ #include #include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/client/MemoryTracker.h" diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index 123b26bc5..077a08160 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -1,4 +1,5 @@ #include "ArrowRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/BatRenderer.cpp b/targets/minecraft/client/renderer/entity/BatRenderer.cpp index 9e24748ae..dc8239f17 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -1,4 +1,5 @@ #include "BatRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp index a49cfdc8f..9b349bbbc 100644 --- a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp @@ -1,4 +1,5 @@ #include "BoatRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp index 7f1849475..ed36551be 100644 --- a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp @@ -1,4 +1,5 @@ #include "CaveSpiderRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp index bc98542cc..e400f5ed5 100644 --- a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp @@ -1,4 +1,5 @@ #include "CreeperRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp index 2c7555fa1..b3288523e 100644 --- a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp @@ -1,4 +1,5 @@ #include "DefaultRenderer.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp index 9cf89cbdc..505f567fe 100644 --- a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp @@ -1,4 +1,5 @@ #include "EnderCrystalRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp index 24a68f593..f6e9fac21 100644 --- a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp @@ -1,4 +1,5 @@ #include "EnderDragonRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index d62cc154a..2edc80ee5 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -1,4 +1,5 @@ #include "EndermanRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 762582729..bcd40fb6c 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -1,4 +1,5 @@ #include "minecraft/util/Log.h" +#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index 02b24d18f..33ea6f2e3 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -1,4 +1,5 @@ #include "EntityRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp index b08b3cdeb..541c10325 100644 --- a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp @@ -1,4 +1,5 @@ #include "ExperienceOrbRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp index 8648cf187..e80338b5a 100644 --- a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -1,4 +1,5 @@ #include "FallingTileRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp index dba049c9d..93276d3aa 100644 --- a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp @@ -1,4 +1,5 @@ #include "FireballRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp index a9e292a14..0ca326512 100644 --- a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp @@ -1,4 +1,5 @@ #include "FishingHookRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp index 019d904b3..862f3e409 100644 --- a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp @@ -1,4 +1,5 @@ #include "GhastRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp index b92d2079d..e03bd8256 100644 --- a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp @@ -1,4 +1,5 @@ #include "GiantMobRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index fb692c550..bc7f42901 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -1,4 +1,5 @@ #include "HorseRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index 8e3e496d4..abfebd434 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -1,4 +1,5 @@ #include "HumanoidMobRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index aed9f0e74..314b90bff 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -1,6 +1,7 @@ #include +#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/TileRenderer.h" diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index d93de63ea..d8023e62f 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -1,4 +1,5 @@ #include "ItemRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp index aac8da2b3..6266e3d42 100644 --- a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp @@ -1,4 +1,5 @@ #include "ItemSpriteRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp index 5ddfd6a5e..2aeee8c4c 100644 --- a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp @@ -1,4 +1,5 @@ #include "LavaSlimeRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp index 9f0c38482..553b365b7 100644 --- a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp @@ -1,4 +1,5 @@ #include "LeashKnotRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp index 24c801a08..25ceecfab 100644 --- a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp @@ -1,4 +1,5 @@ #include "LightningBoltRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index 736fb0e45..e1eb72b02 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "LivingEntityRenderer.h" #include diff --git a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp index b91901b44..9951566b7 100644 --- a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp @@ -1,4 +1,5 @@ #include "MinecartRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index b74d3236e..55fddd7c9 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -1,4 +1,5 @@ #include "MobRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index cfcf9f9ff..ea6674b29 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -1,4 +1,5 @@ #include "MushroomCowRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp index 28787c7a1..01f52f756 100644 --- a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp @@ -1,4 +1,5 @@ #include "OcelotRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index 31b9aef47..97f3da859 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -1,4 +1,5 @@ #include "PaintingRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index e2042ba0d..c2511c1f6 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "PlayerRenderer.h" #include diff --git a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp index 38907890b..e9fdfff43 100644 --- a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp @@ -1,4 +1,5 @@ #include "SheepRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp index 1553b9ea1..baf896c8a 100644 --- a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp @@ -1,4 +1,5 @@ #include "SkeletonRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp index 84a0a7fda..c4200ee7c 100644 --- a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp @@ -1,4 +1,5 @@ #include "SlimeRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp index b5b1dbbc3..c0b6f7b8b 100644 --- a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp @@ -1,4 +1,5 @@ #include "SnowManRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp index 9e4c57b12..711eb9541 100644 --- a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp @@ -1,4 +1,5 @@ #include "SpiderRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp index 6a53e1937..538b29fd7 100644 --- a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp @@ -1,4 +1,5 @@ #include "SquidRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp index 50d4613e0..9f8a00b10 100644 --- a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp @@ -1,4 +1,5 @@ #include "TntMinecartRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/TntRenderer.cpp b/targets/minecraft/client/renderer/entity/TntRenderer.cpp index 472c079ed..eb2670b64 100644 --- a/targets/minecraft/client/renderer/entity/TntRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntRenderer.cpp @@ -1,4 +1,5 @@ #include "TntRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 0accf95db..586edb485 100644 --- a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -1,4 +1,5 @@ #include "VillagerGolemRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp index 816846356..ac3d61965 100644 --- a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp @@ -1,4 +1,5 @@ #include "VillagerRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp index 207d129e2..7ad9705b7 100644 --- a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp @@ -1,4 +1,5 @@ #include "WitchRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp index 847441fe8..eb5e3f172 100644 --- a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp @@ -1,4 +1,5 @@ #include "WitherBossRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp index 14fcce976..ba4c19fd0 100644 --- a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp @@ -1,4 +1,5 @@ #include "WitherSkullRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp index 5150f3449..7674d8a77 100644 --- a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp @@ -1,4 +1,5 @@ #include "WolfRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index d4b2694df..a737fc71d 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -1,4 +1,5 @@ #include "minecraft/util/Log.h" +#include "platform/stubs.h" #include "Texture.h" #include diff --git a/targets/minecraft/client/renderer/texture/Texture.h b/targets/minecraft/client/renderer/texture/Texture.h index 718e0ade1..805b8213e 100644 --- a/targets/minecraft/client/renderer/texture/Texture.h +++ b/targets/minecraft/client/renderer/texture/Texture.h @@ -1,6 +1,7 @@ #pragma once #include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp index 2ac5a27ba..ea4768447 100644 --- a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp @@ -1,4 +1,5 @@ #include "BeaconRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp index 7f4e18013..6c41fdb7f 100644 --- a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp @@ -1,4 +1,5 @@ #include "ChestRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index 80777935b..a71f327f2 100644 --- a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -1,4 +1,5 @@ #include "EnchantTableRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp index 6ecc05db4..50d181e73 100644 --- a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp @@ -1,4 +1,5 @@ #include "EnderChestRenderer.h" +#include "platform/stubs.h" #include #include diff --git a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp index 1c68944ea..012395f3c 100644 --- a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp @@ -1,4 +1,5 @@ #include "MobSpawnerRenderer.h" +#include "platform/stubs.h" #include "platform/renderer/renderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" diff --git a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp index 59bb167bb..e71ba0cc5 100644 --- a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp @@ -1,4 +1,5 @@ #include "PistonPieceRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 16b433fa3..8ca473de2 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "SignRenderer.h" #include diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index 3c21309ee..a392ce06b 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -1,4 +1,5 @@ #include "SkullTileRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp index 3fc26a24d..d921be722 100644 --- a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp @@ -1,4 +1,5 @@ #include "TheEndPortalRenderer.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp index bf8eda75b..76d00ae63 100644 --- a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp @@ -1,4 +1,5 @@ #include "TileEntityRenderDispatcher.h" +#include "platform/stubs.h" #include diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index 13b02e3ad..ce0799dc0 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,4 +1,5 @@ #include "minecraft/util/Log.h" +#include "platform/stubs.h" #include "AbstractTexturePack.h" diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 1cfb80097..f8b659b4c 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,4 +1,5 @@ #include "minecraft/IGameServices.h" +#include "platform/stubs.h" #include "minecraft/util/Log.h" #include "TitleScreen.h" diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index 7ca98ad15..e4d3f7b86 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -153,571 +153,3 @@ public: void Shutdown(); }; -// OpenGL Interception Macros -#ifndef GL_MODELVIEW_MATRIX -#define GL_MODELVIEW_MATRIX 0x0BA6 -#endif -#ifndef GL_PROJECTION_MATRIX -#define GL_PROJECTION_MATRIX 0x0BA7 -#endif -#ifndef GL_MODELVIEW -#define GL_MODELVIEW 0x1700 -#endif -#ifndef GL_PROJECTION -#define GL_PROJECTION 0x1701 -#endif -#ifndef GL_TEXTURE -#define GL_TEXTURE 0x1702 -#endif - -#ifndef GL_S -#define GL_S 0x2000 -#endif -#ifndef GL_T -#define GL_T 0x2001 -#endif -#ifndef GL_R -#define GL_R 0x2002 -#endif -#ifndef GL_Q -#define GL_Q 0x2003 -#endif - -#ifndef GL_TEXTURE_GEN_S -#define GL_TEXTURE_GEN_S 0x0C60 -#endif -#ifndef GL_TEXTURE_GEN_T -#define GL_TEXTURE_GEN_T 0x0C61 -#endif -#ifndef GL_TEXTURE_GEN_Q -#define GL_TEXTURE_GEN_Q 0x0C63 -#endif -#ifndef GL_TEXTURE_GEN_R -#define GL_TEXTURE_GEN_R 0x0C62 -#endif - -#ifndef GL_TEXTURE_GEN_MODE -#define GL_TEXTURE_GEN_MODE 0x2500 -#endif -#ifndef GL_OBJECT_LINEAR -#define GL_OBJECT_LINEAR 0x2401 -#endif -#ifndef GL_EYE_LINEAR -#define GL_EYE_LINEAR 0x2400 -#endif -#ifndef GL_OBJECT_PLANE -#define GL_OBJECT_PLANE 0x2501 -#endif -#ifndef GL_EYE_PLANE -#define GL_EYE_PLANE 0x2502 -#endif - -#ifndef GL_TEXTURE_2D -#define GL_TEXTURE_2D 0x0DE1 -#endif -#ifndef GL_BLEND -#define GL_BLEND 0x0BE2 -#endif -#ifndef GL_CULL_FACE -#define GL_CULL_FACE 0x0B44 -#endif -#ifndef GL_ALPHA_TEST -#define GL_ALPHA_TEST 0x0BC0 -#endif -#ifndef GL_DEPTH_TEST -#define GL_DEPTH_TEST 0x0B71 -#endif -#ifndef GL_FOG -#define GL_FOG 0x0B60 -#endif -#ifndef GL_LIGHTING -#define GL_LIGHTING 0x0B50 -#endif -#ifndef GL_LIGHT0 -#define GL_LIGHT0 0x4000 -#endif -#ifndef GL_LIGHT1 -#define GL_LIGHT1 0x4001 -#endif - -#ifndef CLEAR_DEPTH_FLAG -#define CLEAR_DEPTH_FLAG 0x00000100 -#endif -#ifndef CLEAR_COLOUR_FLAG -#define CLEAR_COLOUR_FLAG 0x00004000 -#endif - -#ifndef GL_DEPTH_BUFFER_BIT -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#endif -#ifndef GL_COLOR_BUFFER_BIT -#define GL_COLOR_BUFFER_BIT 0x00004000 -#endif - -#ifndef GL_SRC_ALPHA -#define GL_SRC_ALPHA 0x0302 -#endif -#ifndef GL_ONE_MINUS_SRC_ALPHA -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#endif -#ifndef GL_ONE -#define GL_ONE 1 -#endif -#ifndef GL_ZERO -#define GL_ZERO 0 -#endif -#ifndef GL_DST_ALPHA -#define GL_DST_ALPHA 0x0304 -#endif -#ifndef GL_SRC_COLOR -#define GL_SRC_COLOR 0x0300 -#endif -#ifndef GL_DST_COLOR -#define GL_DST_COLOR 0x0306 -#endif -#ifndef GL_ONE_MINUS_DST_COLOR -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#endif -#ifndef GL_ONE_MINUS_SRC_COLOR -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#endif -#ifndef GL_CONSTANT_ALPHA -#define GL_CONSTANT_ALPHA 0x8003 -#endif -#ifndef GL_ONE_MINUS_CONSTANT_ALPHA -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#endif - -#ifndef GL_GREATER -#define GL_GREATER 0x0204 -#endif -#ifndef GL_EQUAL -#define GL_EQUAL 0x0202 -#endif -#ifndef GL_LEQUAL -#define GL_LEQUAL 0x0203 -#endif -#ifndef GL_GEQUAL -#define GL_GEQUAL 0x0206 -#endif -#ifndef GL_ALWAYS -#define GL_ALWAYS 0x0207 -#endif - -#ifndef GL_TEXTURE_MIN_FILTER -#define GL_TEXTURE_MIN_FILTER 0x2801 -#endif -#ifndef GL_TEXTURE_MAG_FILTER -#define GL_TEXTURE_MAG_FILTER 0x2800 -#endif -#ifndef GL_TEXTURE_WRAP_S -#define GL_TEXTURE_WRAP_S 0x2802 -#endif -#ifndef GL_TEXTURE_WRAP_T -#define GL_TEXTURE_WRAP_T 0x2803 -#endif - -#ifndef GL_NEAREST -#define GL_NEAREST 0x2600 -#endif -#ifndef GL_LINEAR -#define GL_LINEAR 0x2601 -#endif -#ifndef GL_EXP -#define GL_EXP 0x0800 -#endif -#ifndef GL_NEAREST_MIPMAP_LINEAR -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#endif - -#ifndef GL_CLAMP -#define GL_CLAMP 0x2900 -#endif -#ifndef GL_REPEAT -#define GL_REPEAT 0x2901 -#endif - -#ifndef GL_FOG_START -#define GL_FOG_START 0x0B63 -#endif -#ifndef GL_FOG_END -#define GL_FOG_END 0x0B64 -#endif -#ifndef GL_FOG_MODE -#define GL_FOG_MODE 0x0B65 -#endif -#ifndef GL_FOG_DENSITY -#define GL_FOG_DENSITY 0x0B62 -#endif -#ifndef GL_FOG_COLOR -#define GL_FOG_COLOR 0x0B66 -#endif - -#ifndef GL_POSITION -#define GL_POSITION 0x1203 -#endif -#ifndef GL_AMBIENT -#define GL_AMBIENT 0x1200 -#endif -#ifndef GL_DIFFUSE -#define GL_DIFFUSE 0x1201 -#endif -#ifndef GL_SPECULAR -#define GL_SPECULAR 0x1202 -#endif - -#ifndef GL_LIGHT_MODEL_AMBIENT -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#endif - -#ifndef GL_LINES -#define GL_LINES 0x0001 -#endif -#ifndef GL_LINE_STRIP -#define GL_LINE_STRIP 0x0003 -#endif -#ifndef GL_QUADS -#define GL_QUADS 0x0007 -#endif -#ifndef GL_TRIANGLE_FAN -#define GL_TRIANGLE_FAN 0x0006 -#endif -#ifndef GL_TRIANGLE_STRIP -#define GL_TRIANGLE_STRIP 0x0005 -#endif - -// glCallList / display list macros -#undef glNewList -#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) -#undef glEndList -#define glEndList() PlatformRenderer.CBuffEnd() -#undef glCallList -#define glCallList(_list) PlatformRenderer.CBuffCall(_list) - -// glGenLists / glDeleteLists, lists are not supported in core!!!!! -#undef glGenLists -#define glGenLists(range) PlatformRenderer.CBuffCreate(range) -#undef glDeleteLists -#define glDeleteLists(list, range) PlatformRenderer.CBuffDelete(list, range) - -#ifndef GL_SHADEMODEL_IS_FUNCTION -#undef glShadeModel -#define glShadeModel(mode) \ - do { \ - } while (0) -#endif - -#undef glTranslatef -#define glTranslatef(x, y, z) \ - do { \ - PlatformRenderer.MatrixTranslate(x, y, z); \ - } while (0) - -#undef glRotatef -#define glRotatef(a, x, y, z) \ - do { \ - PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ - z); \ - } while (0) - -#undef glScalef -#define glScalef(x, y, z) \ - do { \ - PlatformRenderer.MatrixScale(x, y, z); \ - } while (0) - -#undef glScaled -#define glScaled(x, y, z) \ - do { \ - PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ - } while (0) - -#undef glPushMatrix -#define glPushMatrix() \ - do { \ - PlatformRenderer.MatrixPush(); \ - } while (0) - -#undef glPopMatrix -#define glPopMatrix() \ - do { \ - PlatformRenderer.MatrixPop(); \ - } while (0) - -#undef glLoadIdentity -#define glLoadIdentity() \ - do { \ - PlatformRenderer.MatrixSetIdentity(); \ - } while (0) - -#undef glMatrixMode -#define glMatrixMode(mode) \ - do { \ - PlatformRenderer.MatrixMode(mode); \ - } while (0) - -#undef glMultMatrixf -#define glMultMatrixf(m) \ - do { \ - PlatformRenderer.MatrixMult(m); \ - } while (0) - -#undef glColor4f -#define glColor4f(r, g, b, a) \ - do { \ - PlatformRenderer.StateSetColour(r, g, b, a); \ - } while (0) - -#undef glColor3f -#define glColor3f(r, g, b) \ - do { \ - PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ - } while (0) - -#undef glAlphaFunc -#define glAlphaFunc(func, ref) \ - do { \ - PlatformRenderer.StateSetAlphaFunc(func, ref); \ - } while (0) - -#undef glEnable -#define glEnable(cap) \ - do { \ - if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(true); \ - else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(true); \ - else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(true); \ - else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(true); \ - else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(true); \ - else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(true); \ - else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(true); \ - else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, true); \ - else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, true); \ - else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ - || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ - || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ - || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ - || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ - || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ - || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ - } else \ - ::glEnable(cap); \ - } while (0) - -#undef glDisable -#define glDisable(cap) \ - do { \ - if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(false); \ - else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(false); \ - else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(false); \ - else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(false); \ - else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(false); \ - else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(false); \ - else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(false); \ - else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, false); \ - else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, false); \ - else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ - || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ - || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ - || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ - || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ - || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ - || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ - } else \ - ::glDisable(cap); \ - } while (0) - -#undef glFogi -#define glFogi(pname, param) \ - do { \ - if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ - PlatformRenderer.StateSetFogMode(param); \ - } while (0) - -#undef glFogf -#define glFogf(pname, param) \ - do { \ - if ((pname) == 0x0B63 /*GL_FOG_START*/) \ - PlatformRenderer.StateSetFogNearDistance(param); \ - else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ - PlatformRenderer.StateSetFogFarDistance(param); \ - else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ - PlatformRenderer.StateSetFogDensity(param); \ - } while (0) - -#undef glOrtho -#define glOrtho(left, right, bottom, top, zNear, zFar) \ - do { \ - PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ - } while (0) - -#undef glMultiTexCoord2f -#define glMultiTexCoord2f(tex, u, v) \ - do { \ - if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ - PlatformRenderer.StateSetVertexTextureUV(u, v); \ - } while (0) - -#undef glActiveTexture -#define glActiveTexture(tex) \ - do { \ - PlatformRenderer.StateSetActiveTexture(tex); \ - ::glActiveTexture(tex); \ - } while (0) - -#undef glClientActiveTexture -#define glClientActiveTexture(tex) \ - do { \ - PlatformRenderer.StateSetActiveTexture(tex); \ - } while (0) - -// declarations -int glGenTextures_4J(); -void glGenTextures_4J(int n, unsigned int* textures); -void glDeleteTextures_4J(int id); -void glDeleteTextures_4J(int n, const unsigned int* textures); -void glTexImage2D_4J(int target, int level, int internalformat, int width, - int height, int border, int format, int type, - void* pixels); - -// helprs -void glGenQueries_4J_Helper(unsigned int* id); -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val); - -template -inline void glGenTextures_4J(T* buf) { - unsigned int id = 0; - ::glGenTextures(1, &id); - buf->put((int)id); - buf->flip(); -} -template -inline void glDeleteTextures_4J(T* buf) { - if (buf->limit() > 0) { - unsigned int id = (unsigned int)buf->get(0); - ::glDeleteTextures(1, &id); - } -} -template -inline void glTexCoordPointer_4J(int size, int type, T* pointer) {} -template -inline void glNormalPointer_4J(int type, T* pointer) {} -template -inline void glColorPointer_4J(int size, bool normalized, int stride, - T* pointer) {} -template -inline void glVertexPointer_4J(int size, int type, T* pointer) {} -template -inline void glTexImage2D_4J(int target, int level, int internalformat, - int width, int height, int border, int format, - int type, T* pixels) { - void* data = pixels ? pixels->getBuffer() : nullptr; - ::glTexImage2D((unsigned int)target, level, internalformat, width, height, - border, (unsigned int)format, (unsigned int)type, data); -} -template -inline void glCallLists_4J(T* lists) { - int base = lists->position(); - int count = lists->limit() - base; - for (int i = 0; i < count; i++) { - PlatformRenderer.CBuffCall(lists->get(base + i)); - } -} -template -inline void glGenQueries_4J(T* buf) { - unsigned int id = 0; - glGenQueries_4J_Helper(&id); - buf->put((int)id); - buf->flip(); -} -template -inline void glGetQueryObjectu_4J(int id, int pname, T* params) { - unsigned int val = 0; - glGetQueryObjectu_4J_Helper((unsigned int)id, (unsigned int)pname, &val); - params->put((int)val); - params->flip(); -} -template -inline void glFog_4J(int pname, T* params) { - float* p = params->_getDataPointer(); - if (pname == 0x0B66 /* GL_FOG_COLOR */) - 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 */) - PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], - p[1], p[2]); - else if (pname == 0x1200 /* GL_AMBIENT */) - PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); - else if (pname == 0x1201 /* GL_DIFFUSE */) - 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 */) - PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); -} -template -inline void glTexGen_4J(int coord, int pname, T* params) {} -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, void* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, pixels); -} -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, unsigned char* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, (void*)pixels); -} -// T -> .getBuffer() -template -inline void glReadPixels_4J(int x, int y, int width, int height, int format, - int type, T* pixels) { - ::glReadPixels(x, y, width, height, (unsigned int)format, - (unsigned int)type, pixels->getBuffer()); -} -void glBeginQuery_4J_Helper(unsigned int target, unsigned int id); -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__) -#define glTexCoordPointer(a, b, c) glTexCoordPointer_4J(a, b, c) -#define glNormalPointer(a, b) glNormalPointer_4J(a, b) -#define glColorPointer(a, b, c, d) glColorPointer_4J(a, b, c, d) -#define glVertexPointer(a, b, c) glVertexPointer_4J(a, b, c) -#define glTexImage2D(a, b, c, d, e, f, g, h, i) \ - glTexImage2D_4J(a, b, c, d, e, f, g, h, i) -#define glCallLists(x) glCallLists_4J(x) -#define glGenQueriesARB(x) glGenQueries_4J(x) -#define glGetQueryObjectuARB(a, b, c) glGetQueryObjectu_4J(a, b, c) -#define glReadPixels(a, b, c, d, e, f, g) glReadPixels_4J(a, b, c, d, e, f, g) -#define glFog(a, b) glFog_4J(a, b) -#define glLight(a, b, c) glLight_4J(a, b, c) -#define glLightModel(a, b) glLightModel_4J(a, b) -#define glTexGen(a, b, c) glTexGen_4J(a, b, c) diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h new file mode 100644 index 000000000..0e00d55a1 --- /dev/null +++ b/targets/platform/renderer/gl/gl_compat.h @@ -0,0 +1,595 @@ +#pragma once + +// Legacy gl* compatibility shim for code that still issues fixed-function +// OpenGL calls. Provides: +// - GL_* constant defines for use with legacy gl* call sites +// - Macros that route legacy glPushMatrix / glColor4f / etc. through +// PlatformRenderer +// - Template implementations of glLight_4J / glFog_4J / glTexGen_4J +// etc., used by the legacy producers +// - #define glLight glLight_4J style consumer-facing macros +// +// New rendering code should call IPlatformRenderer methods directly via +// the PlatformRenderer extern. This shim exists to keep the legacy +// rendering files compiling without dragging the concrete GLRenderer +// class into every minecraft TU. + +#include "gl3_loader.h" +// NOTE: gl3_loader.h must be included before these two +#include +#include + +#include +#include + +#include "renderer/IPlatformRenderer.h" +#include "renderer/renderer.h" + +// OpenGL Interception Macros +#ifndef GL_MODELVIEW_MATRIX +#define GL_MODELVIEW_MATRIX 0x0BA6 +#endif +#ifndef GL_PROJECTION_MATRIX +#define GL_PROJECTION_MATRIX 0x0BA7 +#endif +#ifndef GL_MODELVIEW +#define GL_MODELVIEW 0x1700 +#endif +#ifndef GL_PROJECTION +#define GL_PROJECTION 0x1701 +#endif +#ifndef GL_TEXTURE +#define GL_TEXTURE 0x1702 +#endif + +#ifndef GL_S +#define GL_S 0x2000 +#endif +#ifndef GL_T +#define GL_T 0x2001 +#endif +#ifndef GL_R +#define GL_R 0x2002 +#endif +#ifndef GL_Q +#define GL_Q 0x2003 +#endif + +#ifndef GL_TEXTURE_GEN_S +#define GL_TEXTURE_GEN_S 0x0C60 +#endif +#ifndef GL_TEXTURE_GEN_T +#define GL_TEXTURE_GEN_T 0x0C61 +#endif +#ifndef GL_TEXTURE_GEN_Q +#define GL_TEXTURE_GEN_Q 0x0C63 +#endif +#ifndef GL_TEXTURE_GEN_R +#define GL_TEXTURE_GEN_R 0x0C62 +#endif + +#ifndef GL_TEXTURE_GEN_MODE +#define GL_TEXTURE_GEN_MODE 0x2500 +#endif +#ifndef GL_OBJECT_LINEAR +#define GL_OBJECT_LINEAR 0x2401 +#endif +#ifndef GL_EYE_LINEAR +#define GL_EYE_LINEAR 0x2400 +#endif +#ifndef GL_OBJECT_PLANE +#define GL_OBJECT_PLANE 0x2501 +#endif +#ifndef GL_EYE_PLANE +#define GL_EYE_PLANE 0x2502 +#endif + +#ifndef GL_TEXTURE_2D +#define GL_TEXTURE_2D 0x0DE1 +#endif +#ifndef GL_BLEND +#define GL_BLEND 0x0BE2 +#endif +#ifndef GL_CULL_FACE +#define GL_CULL_FACE 0x0B44 +#endif +#ifndef GL_ALPHA_TEST +#define GL_ALPHA_TEST 0x0BC0 +#endif +#ifndef GL_DEPTH_TEST +#define GL_DEPTH_TEST 0x0B71 +#endif +#ifndef GL_FOG +#define GL_FOG 0x0B60 +#endif +#ifndef GL_LIGHTING +#define GL_LIGHTING 0x0B50 +#endif +#ifndef GL_LIGHT0 +#define GL_LIGHT0 0x4000 +#endif +#ifndef GL_LIGHT1 +#define GL_LIGHT1 0x4001 +#endif + +#ifndef CLEAR_DEPTH_FLAG +#define CLEAR_DEPTH_FLAG 0x00000100 +#endif +#ifndef CLEAR_COLOUR_FLAG +#define CLEAR_COLOUR_FLAG 0x00004000 +#endif + +#ifndef GL_DEPTH_BUFFER_BIT +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#endif +#ifndef GL_COLOR_BUFFER_BIT +#define GL_COLOR_BUFFER_BIT 0x00004000 +#endif + +#ifndef GL_SRC_ALPHA +#define GL_SRC_ALPHA 0x0302 +#endif +#ifndef GL_ONE_MINUS_SRC_ALPHA +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#endif +#ifndef GL_ONE +#define GL_ONE 1 +#endif +#ifndef GL_ZERO +#define GL_ZERO 0 +#endif +#ifndef GL_DST_ALPHA +#define GL_DST_ALPHA 0x0304 +#endif +#ifndef GL_SRC_COLOR +#define GL_SRC_COLOR 0x0300 +#endif +#ifndef GL_DST_COLOR +#define GL_DST_COLOR 0x0306 +#endif +#ifndef GL_ONE_MINUS_DST_COLOR +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#endif +#ifndef GL_ONE_MINUS_SRC_COLOR +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif + +#ifndef GL_GREATER +#define GL_GREATER 0x0204 +#endif +#ifndef GL_EQUAL +#define GL_EQUAL 0x0202 +#endif +#ifndef GL_LEQUAL +#define GL_LEQUAL 0x0203 +#endif +#ifndef GL_GEQUAL +#define GL_GEQUAL 0x0206 +#endif +#ifndef GL_ALWAYS +#define GL_ALWAYS 0x0207 +#endif + +#ifndef GL_TEXTURE_MIN_FILTER +#define GL_TEXTURE_MIN_FILTER 0x2801 +#endif +#ifndef GL_TEXTURE_MAG_FILTER +#define GL_TEXTURE_MAG_FILTER 0x2800 +#endif +#ifndef GL_TEXTURE_WRAP_S +#define GL_TEXTURE_WRAP_S 0x2802 +#endif +#ifndef GL_TEXTURE_WRAP_T +#define GL_TEXTURE_WRAP_T 0x2803 +#endif + +#ifndef GL_NEAREST +#define GL_NEAREST 0x2600 +#endif +#ifndef GL_LINEAR +#define GL_LINEAR 0x2601 +#endif +#ifndef GL_EXP +#define GL_EXP 0x0800 +#endif +#ifndef GL_NEAREST_MIPMAP_LINEAR +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#endif + +#ifndef GL_CLAMP +#define GL_CLAMP 0x2900 +#endif +#ifndef GL_REPEAT +#define GL_REPEAT 0x2901 +#endif + +#ifndef GL_FOG_START +#define GL_FOG_START 0x0B63 +#endif +#ifndef GL_FOG_END +#define GL_FOG_END 0x0B64 +#endif +#ifndef GL_FOG_MODE +#define GL_FOG_MODE 0x0B65 +#endif +#ifndef GL_FOG_DENSITY +#define GL_FOG_DENSITY 0x0B62 +#endif +#ifndef GL_FOG_COLOR +#define GL_FOG_COLOR 0x0B66 +#endif + +#ifndef GL_POSITION +#define GL_POSITION 0x1203 +#endif +#ifndef GL_AMBIENT +#define GL_AMBIENT 0x1200 +#endif +#ifndef GL_DIFFUSE +#define GL_DIFFUSE 0x1201 +#endif +#ifndef GL_SPECULAR +#define GL_SPECULAR 0x1202 +#endif + +#ifndef GL_LIGHT_MODEL_AMBIENT +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#endif + +#ifndef GL_LINES +#define GL_LINES 0x0001 +#endif +#ifndef GL_LINE_STRIP +#define GL_LINE_STRIP 0x0003 +#endif +#ifndef GL_QUADS +#define GL_QUADS 0x0007 +#endif +#ifndef GL_TRIANGLE_FAN +#define GL_TRIANGLE_FAN 0x0006 +#endif +#ifndef GL_TRIANGLE_STRIP +#define GL_TRIANGLE_STRIP 0x0005 +#endif + +// glCallList / display list macros +#undef glNewList +#define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) +#undef glEndList +#define glEndList() PlatformRenderer.CBuffEnd() +#undef glCallList +#define glCallList(_list) PlatformRenderer.CBuffCall(_list) + +// glGenLists / glDeleteLists, lists are not supported in core!!!!! +#undef glGenLists +#define glGenLists(range) PlatformRenderer.CBuffCreate(range) +#undef glDeleteLists +#define glDeleteLists(list, range) PlatformRenderer.CBuffDelete(list, range) + +#ifndef GL_SHADEMODEL_IS_FUNCTION +#undef glShadeModel +#define glShadeModel(mode) \ + do { \ + } while (0) +#endif + +#undef glTranslatef +#define glTranslatef(x, y, z) \ + do { \ + PlatformRenderer.MatrixTranslate(x, y, z); \ + } while (0) + +#undef glRotatef +#define glRotatef(a, x, y, z) \ + do { \ + PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ + z); \ + } while (0) + +#undef glScalef +#define glScalef(x, y, z) \ + do { \ + PlatformRenderer.MatrixScale(x, y, z); \ + } while (0) + +#undef glScaled +#define glScaled(x, y, z) \ + do { \ + PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ + } while (0) + +#undef glPushMatrix +#define glPushMatrix() \ + do { \ + PlatformRenderer.MatrixPush(); \ + } while (0) + +#undef glPopMatrix +#define glPopMatrix() \ + do { \ + PlatformRenderer.MatrixPop(); \ + } while (0) + +#undef glLoadIdentity +#define glLoadIdentity() \ + do { \ + PlatformRenderer.MatrixSetIdentity(); \ + } while (0) + +#undef glMatrixMode +#define glMatrixMode(mode) \ + do { \ + PlatformRenderer.MatrixMode(mode); \ + } while (0) + +#undef glMultMatrixf +#define glMultMatrixf(m) \ + do { \ + PlatformRenderer.MatrixMult(m); \ + } while (0) + +#undef glColor4f +#define glColor4f(r, g, b, a) \ + do { \ + PlatformRenderer.StateSetColour(r, g, b, a); \ + } while (0) + +#undef glColor3f +#define glColor3f(r, g, b) \ + do { \ + PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ + } while (0) + +#undef glAlphaFunc +#define glAlphaFunc(func, ref) \ + do { \ + PlatformRenderer.StateSetAlphaFunc(func, ref); \ + } while (0) + +#undef glEnable +#define glEnable(cap) \ + do { \ + if ((cap) == 0x0B60 /*GL_FOG*/) \ + PlatformRenderer.StateSetFogEnable(true); \ + else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ + PlatformRenderer.StateSetLightingEnable(true); \ + else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ + PlatformRenderer.StateSetAlphaTestEnable(true); \ + else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ + PlatformRenderer.StateSetTextureEnable(true); \ + else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ + PlatformRenderer.StateSetBlendEnable(true); \ + else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ + PlatformRenderer.StateSetFaceCull(true); \ + else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ + PlatformRenderer.StateSetDepthTestEnable(true); \ + else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ + PlatformRenderer.StateSetLightEnable(0, true); \ + else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ + PlatformRenderer.StateSetLightEnable(1, true); \ + else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ + || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ + || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ + || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ + || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ + || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ + || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ + } else \ + ::glEnable(cap); \ + } while (0) + +#undef glDisable +#define glDisable(cap) \ + do { \ + if ((cap) == 0x0B60 /*GL_FOG*/) \ + PlatformRenderer.StateSetFogEnable(false); \ + else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ + PlatformRenderer.StateSetLightingEnable(false); \ + else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ + PlatformRenderer.StateSetAlphaTestEnable(false); \ + else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ + PlatformRenderer.StateSetTextureEnable(false); \ + else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ + PlatformRenderer.StateSetBlendEnable(false); \ + else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ + PlatformRenderer.StateSetFaceCull(false); \ + else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ + PlatformRenderer.StateSetDepthTestEnable(false); \ + else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ + PlatformRenderer.StateSetLightEnable(0, false); \ + else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ + PlatformRenderer.StateSetLightEnable(1, false); \ + else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ + || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ + || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ + || (cap) == 0x0C60 /*GL_TEXTURE_GEN_S*/ \ + || (cap) == 0x0C61 /*GL_TEXTURE_GEN_T*/ \ + || (cap) == 0x0C62 /*GL_TEXTURE_GEN_R*/ \ + || (cap) == 0x0C63 /*GL_TEXTURE_GEN_Q*/) { /* empty */ \ + } else \ + ::glDisable(cap); \ + } while (0) + +#undef glFogi +#define glFogi(pname, param) \ + do { \ + if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ + PlatformRenderer.StateSetFogMode(param); \ + } while (0) + +#undef glFogf +#define glFogf(pname, param) \ + do { \ + if ((pname) == 0x0B63 /*GL_FOG_START*/) \ + PlatformRenderer.StateSetFogNearDistance(param); \ + else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ + PlatformRenderer.StateSetFogFarDistance(param); \ + else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ + PlatformRenderer.StateSetFogDensity(param); \ + } while (0) + +#undef glOrtho +#define glOrtho(left, right, bottom, top, zNear, zFar) \ + do { \ + PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ + } while (0) + +#undef glMultiTexCoord2f +#define glMultiTexCoord2f(tex, u, v) \ + do { \ + if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ + PlatformRenderer.StateSetVertexTextureUV(u, v); \ + } while (0) + +#undef glActiveTexture +#define glActiveTexture(tex) \ + do { \ + PlatformRenderer.StateSetActiveTexture(tex); \ + ::glActiveTexture(tex); \ + } while (0) + +#undef glClientActiveTexture +#define glClientActiveTexture(tex) \ + do { \ + PlatformRenderer.StateSetActiveTexture(tex); \ + } while (0) + +// declarations +int glGenTextures_4J(); +void glGenTextures_4J(int n, unsigned int* textures); +void glDeleteTextures_4J(int id); +void glDeleteTextures_4J(int n, const unsigned int* textures); +void glTexImage2D_4J(int target, int level, int internalformat, int width, + int height, int border, int format, int type, + void* pixels); + +// helprs +void glGenQueries_4J_Helper(unsigned int* id); +void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, + unsigned int* val); + +template +inline void glGenTextures_4J(T* buf) { + unsigned int id = 0; + ::glGenTextures(1, &id); + buf->put((int)id); + buf->flip(); +} +template +inline void glDeleteTextures_4J(T* buf) { + if (buf->limit() > 0) { + unsigned int id = (unsigned int)buf->get(0); + ::glDeleteTextures(1, &id); + } +} +template +inline void glTexCoordPointer_4J(int size, int type, T* pointer) {} +template +inline void glNormalPointer_4J(int type, T* pointer) {} +template +inline void glColorPointer_4J(int size, bool normalized, int stride, + T* pointer) {} +template +inline void glVertexPointer_4J(int size, int type, T* pointer) {} +template +inline void glTexImage2D_4J(int target, int level, int internalformat, + int width, int height, int border, int format, + int type, T* pixels) { + void* data = pixels ? pixels->getBuffer() : nullptr; + ::glTexImage2D((unsigned int)target, level, internalformat, width, height, + border, (unsigned int)format, (unsigned int)type, data); +} +template +inline void glCallLists_4J(T* lists) { + int base = lists->position(); + int count = lists->limit() - base; + for (int i = 0; i < count; i++) { + PlatformRenderer.CBuffCall(lists->get(base + i)); + } +} +template +inline void glGenQueries_4J(T* buf) { + unsigned int id = 0; + glGenQueries_4J_Helper(&id); + buf->put((int)id); + buf->flip(); +} +template +inline void glGetQueryObjectu_4J(int id, int pname, T* params) { + unsigned int val = 0; + glGetQueryObjectu_4J_Helper((unsigned int)id, (unsigned int)pname, &val); + params->put((int)val); + params->flip(); +} +template +inline void glFog_4J(int pname, T* params) { + float* p = params->_getDataPointer(); + if (pname == 0x0B66 /* GL_FOG_COLOR */) + 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 */) + PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], + p[1], p[2]); + else if (pname == 0x1200 /* GL_AMBIENT */) + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); + else if (pname == 0x1201 /* GL_DIFFUSE */) + 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 */) + PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); +} +template +inline void glTexGen_4J(int coord, int pname, T* params) {} +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, void* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, pixels); +} +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, unsigned char* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, (void*)pixels); +} +// T -> .getBuffer() +template +inline void glReadPixels_4J(int x, int y, int width, int height, int format, + int type, T* pixels) { + ::glReadPixels(x, y, width, height, (unsigned int)format, + (unsigned int)type, pixels->getBuffer()); +} +void glBeginQuery_4J_Helper(unsigned int target, unsigned int id); +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__) +#define glTexCoordPointer(a, b, c) glTexCoordPointer_4J(a, b, c) +#define glNormalPointer(a, b) glNormalPointer_4J(a, b) +#define glColorPointer(a, b, c, d) glColorPointer_4J(a, b, c, d) +#define glVertexPointer(a, b, c) glVertexPointer_4J(a, b, c) +#define glTexImage2D(a, b, c, d, e, f, g, h, i) \ + glTexImage2D_4J(a, b, c, d, e, f, g, h, i) +#define glCallLists(x) glCallLists_4J(x) +#define glGenQueriesARB(x) glGenQueries_4J(x) +#define glGetQueryObjectuARB(a, b, c) glGetQueryObjectu_4J(a, b, c) +#define glReadPixels(a, b, c, d, e, f, g) glReadPixels_4J(a, b, c, d, e, f, g) +#define glFog(a, b) glFog_4J(a, b) +#define glLight(a, b, c) glLight_4J(a, b, c) +#define glLightModel(a, b) glLightModel_4J(a, b) +#define glTexGen(a, b, c) glTexGen_4J(a, b, c) diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index 873b2a352..70f70b6a2 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -1,4 +1,10 @@ -#include "IPlatformRenderer.h" -#include "./gl/GLRenderer.h" // 4jcraft TODO: find a way to handle OpenGL stubs through a facade +#pragma once +#include "IPlatformRenderer.h" + +// Defined in the linked renderer backend (currently +// platform/renderer/gl/GLRenderer.cpp). The legacy gl* macro shim used +// by older rendering call sites lives in +// platform/renderer/gl/gl_compat.h, which is brought in via +// platform/stubs.h on linux. extern IPlatformRenderer& PlatformRenderer; diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 5c2f47b4a..bcd243d02 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -3,6 +3,7 @@ #include #ifdef __linux__ +#include "renderer/gl/gl_compat.h" #include #include From b032e2a3a0e7b2c380b3561b99d014c532376aee Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:22:40 +1000 Subject: [PATCH 014/104] refactor: use function-local statics for platform accessors to dodge SIOF --- targets/platform/fs/fs.h | 17 +++++++++++++++- targets/platform/fs/std/StdFilesystem.cpp | 8 ++++++-- targets/platform/input/input.h | 17 +++++++++++++++- targets/platform/input/sdl2/SDL2Input.cpp | 8 ++++++-- targets/platform/profile/profile.h | 20 ++++++++++++++++--- targets/platform/profile/stub/StubProfile.cpp | 8 ++++++-- targets/platform/renderer/gl/GLRenderer.cpp | 9 +++++++-- targets/platform/renderer/renderer.h | 20 +++++++++++++------ targets/platform/storage/storage.h | 17 +++++++++++++++- targets/platform/storage/stub/StubStorage.cpp | 8 ++++++-- 10 files changed, 110 insertions(+), 22 deletions(-) diff --git a/targets/platform/fs/fs.h b/targets/platform/fs/fs.h index 4b17768b9..cd2640925 100644 --- a/targets/platform/fs/fs.h +++ b/targets/platform/fs/fs.h @@ -1,3 +1,18 @@ +#pragma once + #include "IPlatformFilesystem.h" -extern IPlatformFilesystem& PlatformFilesystem; \ No newline at end of file +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading PlatformFilesystem +// during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformFilesystem.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformFilesystem& PlatformFilesystem_get(); +} + +#define PlatformFilesystem (::platform_internal::PlatformFilesystem_get()) diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp index 3f605392c..e813b28d3 100644 --- a/targets/platform/fs/std/StdFilesystem.cpp +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -6,8 +6,12 @@ #include #endif -StdFilesystem std_filesystem_instance; -IPlatformFilesystem& PlatformFilesystem = std_filesystem_instance; +namespace platform_internal { +IPlatformFilesystem& PlatformFilesystem_get() { + static StdFilesystem instance; + return instance; +} +} IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path, void* buffer, std::size_t capacity) { diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h index 436916435..d3f5ec9c8 100644 --- a/targets/platform/input/input.h +++ b/targets/platform/input/input.h @@ -1,3 +1,18 @@ +#pragma once + #include "IPlatformInput.h" -extern IPlatformInput& PlatformInput; +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformInput& PlatformInput;` form had: anything reading PlatformInput +// during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformInput.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformInput& PlatformInput_get(); +} + +#define PlatformInput (::platform_internal::PlatformInput_get()) diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 29348e951..1f56f76bf 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -20,8 +20,12 @@ #include "../InputConstants.h" #include "../../PlatformTypes.h" -SDL2Input sdl2_input_instance; -IPlatformInput& PlatformInput = sdl2_input_instance; +namespace platform_internal { +IPlatformInput& PlatformInput_get() { + static SDL2Input instance; + return instance; +} +} static const int KEY_COUNT = SDL_NUM_SCANCODES; static const int BTN_COUNT = SDL_CONTROLLER_BUTTON_MAX; diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h index 7b23288c8..d98421bfc 100644 --- a/targets/platform/profile/profile.h +++ b/targets/platform/profile/profile.h @@ -1,4 +1,18 @@ -#include "IPlatformProfile.h" -#include "ProfileConstants.h" +#pragma once -extern IPlatformProfile& PlatformProfile; +#include "IPlatformProfile.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformProfile& PlatformProfile;` form had: anything reading PlatformProfile +// during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformProfile.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformProfile& PlatformProfile_get(); +} + +#define PlatformProfile (::platform_internal::PlatformProfile_get()) diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index 0cff91666..c30617f3b 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -7,8 +7,12 @@ #include "../ProfileConstants.h" #include "input/input.h" -StubProfile stub_profile_instance; -IPlatformProfile& PlatformProfile = stub_profile_instance; +namespace platform_internal { +IPlatformProfile& PlatformProfile_get() { + static StubProfile instance; + return instance; +} +} namespace { constexpr PlayerUID kFakeXuidBase = 0xe000d45248242f2eULL; diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index a8e87049d..46066d25c 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,5 +1,6 @@ #include "GLRenderer.h" +#include "renderer/renderer.h" #include "PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" @@ -54,8 +55,12 @@ #include #include -GLRenderer gl_renderer_instance; -IPlatformRenderer& PlatformRenderer = gl_renderer_instance; +namespace platform_internal { +IPlatformRenderer& PlatformRenderer_get() { + static GLRenderer instance; + return instance; +} +} // MARK: Shaders diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index 70f70b6a2..aaf9dd4fc 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -2,9 +2,17 @@ #include "IPlatformRenderer.h" -// Defined in the linked renderer backend (currently -// platform/renderer/gl/GLRenderer.cpp). The legacy gl* macro shim used -// by older rendering call sites lives in -// platform/renderer/gl/gl_compat.h, which is brought in via -// platform/stubs.h on linux. -extern IPlatformRenderer& PlatformRenderer; +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading PlatformRenderer +// during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformRenderer.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformRenderer& PlatformRenderer_get(); +} + +#define PlatformRenderer (::platform_internal::PlatformRenderer_get()) diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h index 0a6d962e7..177050af8 100644 --- a/targets/platform/storage/storage.h +++ b/targets/platform/storage/storage.h @@ -1,3 +1,18 @@ +#pragma once + #include "IPlatformStorage.h" -extern IPlatformStorage& PlatformStorage; +// Function accessor backed by a function-local static (Meyers singleton). +// Avoids the static-initialization-order fiasco that the previous +// `extern IPlatformStorage& PlatformStorage;` form had: anything reading PlatformStorage +// during another translation unit's static init was UB. +// +// The macro lets the existing call sites keep writing `PlatformStorage.foo()` +// without each call site having to add the `()`. The expansion is just +// a call to a function returning a reference, so codegen is unchanged +// once inlined. +namespace platform_internal { +IPlatformStorage& PlatformStorage_get(); +} + +#define PlatformStorage (::platform_internal::PlatformStorage_get()) diff --git a/targets/platform/storage/stub/StubStorage.cpp b/targets/platform/storage/stub/StubStorage.cpp index cd4ff1300..748b2e2b4 100644 --- a/targets/platform/storage/stub/StubStorage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -6,8 +6,12 @@ #include #include -StubStorage stub_storage_instance; -IPlatformStorage& PlatformStorage = stub_storage_instance; +namespace platform_internal { +IPlatformStorage& PlatformStorage_get() { + static StubStorage instance; + return instance; +} +} static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; From 9b830f1bfca3eb44a13d755bec7af687de37f721 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:10:18 +1000 Subject: [PATCH 015/104] refactor: carve out a proper sound interface with miniaudio behind it --- targets/app/meson.build | 1 + targets/minecraft/meson.build | 2 +- targets/platform/meson.build | 1 + targets/platform/sound/IPlatformSound.h | 101 +++++++ targets/platform/sound/SoundHandles.h | 30 ++ targets/platform/sound/meson.build | 15 + .../sound/miniaudio/MiniaudioSound.cpp | 261 ++++++++++++++++++ .../platform/sound/miniaudio/MiniaudioSound.h | 61 ++++ targets/platform/sound/sound.h | 16 ++ 9 files changed, 487 insertions(+), 1 deletion(-) create mode 100644 targets/platform/sound/IPlatformSound.h create mode 100644 targets/platform/sound/SoundHandles.h create mode 100644 targets/platform/sound/meson.build create mode 100644 targets/platform/sound/miniaudio/MiniaudioSound.cpp create mode 100644 targets/platform/sound/miniaudio/MiniaudioSound.h create mode 100644 targets/platform/sound/sound.h diff --git a/targets/app/meson.build b/targets/app/meson.build index 6641edc3f..6f90b86e7 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -16,6 +16,7 @@ client_dependencies = [ profile_dep, storage_dep, fs_dep, + sound_dep, assets_localisation_dep, platform_dep, minecraft_dep, diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index 2de8cc71a..dfa8b95b6 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -23,7 +23,7 @@ endif lib_minecraft = static_library('minecraft', minecraft_sources, dependencies : [ - miniaudio_dep, # TODO: remove once a SoundEngine facade is present + sound_dep, render_dep, input_dep, profile_dep, diff --git a/targets/platform/meson.build b/targets/platform/meson.build index a52dc8255..f8ab4cd4c 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -31,3 +31,4 @@ subdir('profile') subdir('storage') subdir('fs') subdir('renderer') +subdir('sound') diff --git a/targets/platform/sound/IPlatformSound.h b/targets/platform/sound/IPlatformSound.h new file mode 100644 index 000000000..7541dc967 --- /dev/null +++ b/targets/platform/sound/IPlatformSound.h @@ -0,0 +1,101 @@ +#pragma once + +#include +#include + +#include "platform/sound/SoundHandles.h" + +// Platform sound interface. The backend (currently miniaudio) implements +// this; consumers in app/common/Audio/SoundEngine talk to the interface +// rather than to miniaudio directly. +// +// The interface is intent-level: load a sample from disk, play it, +// stop it, set listener position. State (volume, pitch, looping) is +// passed at play time as a struct rather than via global setters. +// +// Concrete handles (SoundHandle, MusicHandle) are tagged structs so the +// type system catches sample-vs-music confusion at compile time. + +namespace platform::sound { + +struct PlaySoundParams { + float x = 0.0f; + float y = 0.0f; + float z = 0.0f; + float volume = 1.0f; + float pitch = 1.0f; + bool spatial = true; // 3D sound positioned in the world + bool looping = false; + float minDistance = 1.0f; // distance below which the sound is full-volume + float maxDistance = 16.0f; // distance above which the sound is silent +}; + +struct PlayMusicParams { + float volume = 1.0f; + float pitch = 1.0f; + bool looping = false; +}; + +class IPlatformSound { +public: + virtual ~IPlatformSound() = default; + + // Lifecycle. init() takes the maximum number of simultaneous local + // listeners (splitscreen player count). Idempotent: a second init() + // call with the same parameters is a no-op. + virtual void init(int listenerCount) = 0; + virtual void shutdown() = 0; + + // Per-frame tick. Drives streaming reads, voice cleanup, etc. + virtual void tick() = 0; + + // Master volume scaling. 0.0 to 1.0. Applies to all subsequent + // sound and music playback. + virtual void setMasterVolume(float volume) = 0; + + // -- Spatial / one-shot sound effects -- + + // Load and start playing a sound. The backend allocates a voice and + // returns a handle that can be used to query / stop the sound. If + // the load fails or the mixer is at capacity, returns an invalid + // handle (the caller should treat that as "sound was dropped" - not + // an error). + [[nodiscard]] virtual SoundHandle playSoundFromFile( + const std::string& path, const PlaySoundParams& params) = 0; + + virtual void stopSound(SoundHandle handle) = 0; + [[nodiscard]] virtual bool isSoundPlaying(SoundHandle handle) const = 0; + + virtual void setSoundVolume(SoundHandle handle, float volume) = 0; + virtual void setSoundPosition(SoundHandle handle, float x, float y, + float z) = 0; + virtual void setSoundPitch(SoundHandle handle, float pitch) = 0; + + // Release the voice. Idempotent on invalid handles. + virtual void releaseSound(SoundHandle handle) = 0; + + // -- Streaming music -- + + // Load and start a streaming music track. Streaming means the + // backend reads the file incrementally rather than decoding it all + // upfront. Use for music tracks; sound effects should use the + // playSound* methods above. + [[nodiscard]] virtual MusicHandle playMusicFromFile( + const std::string& path, const PlayMusicParams& params) = 0; + + virtual void stopMusic(MusicHandle handle) = 0; + [[nodiscard]] virtual bool isMusicPlaying(MusicHandle handle) const = 0; + virtual void setMusicVolume(MusicHandle handle, float volume) = 0; + virtual void setMusicPitch(MusicHandle handle, float pitch) = 0; + virtual void releaseMusic(MusicHandle handle) = 0; + + // -- Listener (one per local splitscreen player) -- + + virtual void setListenerPosition(int listenerIndex, float x, float y, + float z) = 0; + virtual void setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, + float upX, float upY, float upZ) = 0; +}; + +} // namespace platform::sound diff --git a/targets/platform/sound/SoundHandles.h b/targets/platform/sound/SoundHandles.h new file mode 100644 index 000000000..16a856df1 --- /dev/null +++ b/targets/platform/sound/SoundHandles.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +// Type-safe handles for the platform sound subsystem. Each handle is a +// tagged 32-bit integer; the tag struct prevents accidental conversion +// between handle types at compile time. +// +// Handle 0 is reserved for "invalid". Backends should never return 0 +// from a successful create call. + +namespace platform::sound { + +template +struct Handle { + std::uint32_t id = 0; + + [[nodiscard]] constexpr bool valid() const noexcept { return id != 0; } + constexpr explicit operator bool() const noexcept { return valid(); } + + friend constexpr bool operator==(Handle, Handle) = default; +}; + +struct SoundTag {}; +struct MusicTag {}; + +using SoundHandle = Handle; +using MusicHandle = Handle; + +} // namespace platform::sound diff --git a/targets/platform/sound/meson.build b/targets/platform/sound/meson.build new file mode 100644 index 000000000..79f6f4519 --- /dev/null +++ b/targets/platform/sound/meson.build @@ -0,0 +1,15 @@ +_miniaudio_dep = dependency('miniaudio') + +lib_platform_sound_miniaudio = static_library( + 'platform_sound_miniaudio', + files('miniaudio/MiniaudioSound.cpp'), + include_directories: [platform_inc, include_directories('../..')], + dependencies: [_threads, _miniaudio_dep], + cpp_args: global_cpp_args + global_cpp_defs, +) + +sound_dep = declare_dependency( + link_with: lib_platform_sound_miniaudio, + include_directories: [platform_inc], + dependencies: [_miniaudio_dep], +) diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.cpp b/targets/platform/sound/miniaudio/MiniaudioSound.cpp new file mode 100644 index 000000000..5aa8c3424 --- /dev/null +++ b/targets/platform/sound/miniaudio/MiniaudioSound.cpp @@ -0,0 +1,261 @@ +#include "MiniaudioSound.h" + +#include +#include + +#include "miniaudio.h" + +#include "platform/sound/sound.h" + +namespace platform::sound::miniaudio { + +namespace { + +// Each loaded sound voice. Owned by the State's map; the SoundHandle +// the caller holds is the integer key. +struct Voice { + ma_sound sound{}; + bool inUse = false; +}; + +} // namespace + +struct State { + ma_engine engine{}; + ma_engine_config engineConfig{}; + bool engineReady = false; + + // Voice pool. Sound handles are keys; the backend allocates a fresh + // id for every play call. Caller releases via releaseSound() (or + // we'll auto-release when the sound finishes - tick() handles that). + std::unordered_map> sounds; + std::unordered_map> music; + std::atomic nextHandleId{1}; +}; + +MiniaudioSound::MiniaudioSound() : m_state(std::make_unique()) {} +MiniaudioSound::~MiniaudioSound() { + if (m_state && m_state->engineReady) { + shutdown(); + } +} +MiniaudioSound::MiniaudioSound(MiniaudioSound&&) noexcept = default; +MiniaudioSound& MiniaudioSound::operator=(MiniaudioSound&&) noexcept = default; + +void MiniaudioSound::init(int listenerCount) { + if (m_state->engineReady) return; + m_state->engineConfig = ma_engine_config_init(); + m_state->engineConfig.listenerCount = + listenerCount > 0 ? static_cast(listenerCount) : 1; + if (ma_engine_init(&m_state->engineConfig, &m_state->engine) != + MA_SUCCESS) { + return; + } + ma_engine_set_volume(&m_state->engine, 1.0f); + m_state->engineReady = true; +} + +void MiniaudioSound::shutdown() { + if (!m_state->engineReady) return; + // Tear down all live voices first. + for (auto& [id, voice] : m_state->sounds) { + if (voice && voice->inUse) { + ma_sound_uninit(&voice->sound); + } + } + m_state->sounds.clear(); + for (auto& [id, voice] : m_state->music) { + if (voice && voice->inUse) { + ma_sound_uninit(&voice->sound); + } + } + m_state->music.clear(); + ma_engine_uninit(&m_state->engine); + m_state->engineReady = false; +} + +void MiniaudioSound::tick() { + if (!m_state->engineReady) return; + // Reap finished one-shot sounds (non-looping, not currently playing). + // We don't auto-reap music here; music is explicitly stopped by the + // game's music system. + for (auto it = m_state->sounds.begin(); it != m_state->sounds.end();) { + auto& voice = it->second; + if (voice && voice->inUse && + !ma_sound_is_playing(&voice->sound) && + !ma_sound_is_looping(&voice->sound)) { + ma_sound_uninit(&voice->sound); + voice->inUse = false; + it = m_state->sounds.erase(it); + } else { + ++it; + } + } +} + +void MiniaudioSound::setMasterVolume(float volume) { + if (!m_state->engineReady) return; + ma_engine_set_volume(&m_state->engine, volume); +} + +SoundHandle MiniaudioSound::playSoundFromFile(const std::string& path, + const PlaySoundParams& params) { + if (!m_state->engineReady) return {}; + auto voice = std::make_unique(); + if (ma_sound_init_from_file(&m_state->engine, path.c_str(), + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &voice->sound) != MA_SUCCESS) { + return {}; + } + ma_sound_set_spatialization_enabled(&voice->sound, + params.spatial ? MA_TRUE : MA_FALSE); + ma_sound_set_min_distance(&voice->sound, params.minDistance); + ma_sound_set_max_distance(&voice->sound, params.maxDistance); + ma_sound_set_volume(&voice->sound, params.volume); + ma_sound_set_pitch(&voice->sound, params.pitch); + ma_sound_set_position(&voice->sound, params.x, params.y, params.z); + ma_sound_set_looping(&voice->sound, params.looping ? MA_TRUE : MA_FALSE); + ma_sound_start(&voice->sound); + voice->inUse = true; + + SoundHandle handle{m_state->nextHandleId.fetch_add(1)}; + m_state->sounds.emplace(handle.id, std::move(voice)); + return handle; +} + +void MiniaudioSound::stopSound(SoundHandle handle) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second) return; + if (it->second->inUse) { + ma_sound_stop(&it->second->sound); + } +} + +bool MiniaudioSound::isSoundPlaying(SoundHandle handle) const { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) { + return false; + } + return ma_sound_is_playing(&it->second->sound) != MA_FALSE; +} + +void MiniaudioSound::setSoundVolume(SoundHandle handle, float volume) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_volume(&it->second->sound, volume); +} + +void MiniaudioSound::setSoundPosition(SoundHandle handle, float x, float y, + float z) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_position(&it->second->sound, x, y, z); +} + +void MiniaudioSound::setSoundPitch(SoundHandle handle, float pitch) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_pitch(&it->second->sound, pitch); +} + +void MiniaudioSound::releaseSound(SoundHandle handle) { + auto it = m_state->sounds.find(handle.id); + if (it == m_state->sounds.end()) return; + if (it->second && it->second->inUse) { + ma_sound_uninit(&it->second->sound); + it->second->inUse = false; + } + m_state->sounds.erase(it); +} + +MusicHandle MiniaudioSound::playMusicFromFile(const std::string& path, + const PlayMusicParams& params) { + if (!m_state->engineReady) return {}; + auto voice = std::make_unique(); + if (ma_sound_init_from_file(&m_state->engine, path.c_str(), + MA_SOUND_FLAG_STREAM, nullptr, nullptr, + &voice->sound) != MA_SUCCESS) { + return {}; + } + ma_sound_set_spatialization_enabled(&voice->sound, MA_FALSE); + ma_sound_set_volume(&voice->sound, params.volume); + ma_sound_set_pitch(&voice->sound, params.pitch); + ma_sound_set_looping(&voice->sound, params.looping ? MA_TRUE : MA_FALSE); + ma_sound_start(&voice->sound); + voice->inUse = true; + + MusicHandle handle{m_state->nextHandleId.fetch_add(1)}; + m_state->music.emplace(handle.id, std::move(voice)); + return handle; +} + +void MiniaudioSound::stopMusic(MusicHandle handle) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second) return; + if (it->second->inUse) { + ma_sound_stop(&it->second->sound); + } +} + +bool MiniaudioSound::isMusicPlaying(MusicHandle handle) const { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) + return false; + return ma_sound_is_playing(&it->second->sound) != MA_FALSE; +} + +void MiniaudioSound::setMusicVolume(MusicHandle handle, float volume) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_volume(&it->second->sound, volume); +} + +void MiniaudioSound::setMusicPitch(MusicHandle handle, float pitch) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end() || !it->second || !it->second->inUse) + return; + ma_sound_set_pitch(&it->second->sound, pitch); +} + +void MiniaudioSound::releaseMusic(MusicHandle handle) { + auto it = m_state->music.find(handle.id); + if (it == m_state->music.end()) return; + if (it->second && it->second->inUse) { + ma_sound_uninit(&it->second->sound); + it->second->inUse = false; + } + m_state->music.erase(it); +} + +void MiniaudioSound::setListenerPosition(int listenerIndex, float x, float y, + float z) { + if (!m_state->engineReady) return; + ma_engine_listener_set_position(&m_state->engine, + static_cast(listenerIndex), x, + y, z); +} + +void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, + float upX, float upY, float upZ) { + if (!m_state->engineReady) return; + ma_engine_listener_set_direction(&m_state->engine, + static_cast(listenerIndex), + forwardX, forwardY, forwardZ); + ma_engine_listener_set_world_up(&m_state->engine, + static_cast(listenerIndex), + upX, upY, upZ); +} + +} // namespace platform::sound::miniaudio + +namespace platform_internal { +::platform::sound::IPlatformSound& PlatformSound_get() { + static ::platform::sound::miniaudio::MiniaudioSound instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.h b/targets/platform/sound/miniaudio/MiniaudioSound.h new file mode 100644 index 000000000..44a7845e5 --- /dev/null +++ b/targets/platform/sound/miniaudio/MiniaudioSound.h @@ -0,0 +1,61 @@ +#pragma once + +#include + +#include "platform/sound/IPlatformSound.h" + +// Forward-declare the miniaudio state struct so this header doesn't +// need to include miniaudio.h - keeps the include footprint small for +// any consumer of the backend header. +namespace platform::sound::miniaudio { + +struct State; + +class MiniaudioSound : public IPlatformSound { +public: + MiniaudioSound(); + ~MiniaudioSound() override; + + // Move-only - the engine owns hardware state. + MiniaudioSound(MiniaudioSound&&) noexcept; + MiniaudioSound& operator=(MiniaudioSound&&) noexcept; + MiniaudioSound(const MiniaudioSound&) = delete; + MiniaudioSound& operator=(const MiniaudioSound&) = delete; + + // -- IPlatformSound -- + + void init(int listenerCount) override; + void shutdown() override; + void tick() override; + + void setMasterVolume(float volume) override; + + [[nodiscard]] SoundHandle playSoundFromFile( + const std::string& path, const PlaySoundParams& params) override; + void stopSound(SoundHandle handle) override; + [[nodiscard]] bool isSoundPlaying(SoundHandle handle) const override; + void setSoundVolume(SoundHandle handle, float volume) override; + void setSoundPosition(SoundHandle handle, float x, float y, + float z) override; + void setSoundPitch(SoundHandle handle, float pitch) override; + void releaseSound(SoundHandle handle) override; + + [[nodiscard]] MusicHandle playMusicFromFile( + const std::string& path, const PlayMusicParams& params) override; + void stopMusic(MusicHandle handle) override; + [[nodiscard]] bool isMusicPlaying(MusicHandle handle) const override; + void setMusicVolume(MusicHandle handle, float volume) override; + void setMusicPitch(MusicHandle handle, float pitch) override; + void releaseMusic(MusicHandle handle) override; + + void setListenerPosition(int listenerIndex, float x, float y, + float z) override; + void setListenerOrientation(int listenerIndex, float forwardX, + float forwardY, float forwardZ, float upX, + float upY, float upZ) override; + +private: + std::unique_ptr m_state; +}; + +} // namespace platform::sound::miniaudio diff --git a/targets/platform/sound/sound.h b/targets/platform/sound/sound.h new file mode 100644 index 000000000..41dba077f --- /dev/null +++ b/targets/platform/sound/sound.h @@ -0,0 +1,16 @@ +#pragma once + +#include "platform/sound/IPlatformSound.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same pattern as input/renderer/profile/storage/fs - SIOF-safe. +// +// The macro lets call sites keep using `PlatformSound.foo()` syntax; +// the expansion is just a function call returning a reference, which +// LTO inlines. + +namespace platform_internal { +::platform::sound::IPlatformSound& PlatformSound_get(); +} + +#define PlatformSound (::platform_internal::PlatformSound_get()) From e5cdd2c370c43bec55698e0bdca538a43a820471 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:15:09 +1000 Subject: [PATCH 016/104] refactor: move NetworkPlayerInterface and SessionInfo into minecraft --- targets/app/common/Game.cpp | 2 +- targets/app/common/Game_XuiActions.cpp | 2 +- targets/app/common/Network/GameNetworkManager.cpp | 2 +- targets/app/common/Network/GameNetworkManager.h | 4 ++-- targets/app/common/Network/NetworkPlayerQNet.h | 2 +- targets/app/common/Network/PlatformNetworkManagerInterface.h | 4 ++-- targets/app/common/Network/PlatformNetworkManagerStub.cpp | 2 +- targets/app/common/Network/PlatformNetworkManagerStub.h | 4 ++-- targets/app/common/Network/Socket.cpp | 2 +- targets/app/common/Network/Socket.h | 2 +- .../app/common/Tutorial/Constraints/ChangeStateConstraint.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_InGameHostOptionsMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp | 2 +- targets/minecraft/client/Minecraft.cpp | 2 +- targets/minecraft/client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/network/Connection.cpp | 2 +- targets/minecraft/network/packet/PlayerInfoPacket.cpp | 2 +- .../network/platform}/NetworkPlayerInterface.h | 0 .../Network => minecraft/network/platform}/SessionInfo.h | 0 targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/server/PlayerList.cpp | 2 +- targets/minecraft/server/level/EntityTracker.cpp | 2 +- targets/minecraft/server/level/PlayerChunkMap.cpp | 2 +- targets/minecraft/server/level/ServerLevel.cpp | 2 +- targets/minecraft/server/level/ServerPlayer.cpp | 2 +- targets/minecraft/server/level/TrackedEntity.cpp | 2 +- targets/minecraft/server/network/PendingConnection.cpp | 2 +- targets/minecraft/server/network/PlayerConnection.cpp | 2 +- 32 files changed, 33 insertions(+), 33 deletions(-) rename targets/{app/common/Network => minecraft/network/platform}/NetworkPlayerInterface.h (100%) rename targets/{app/common/Network => minecraft/network/platform}/SessionInfo.h (100%) diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 8357f07a9..9125722d3 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -13,7 +13,7 @@ #include "app/common/DLC/DLCSkinFile.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index e6e9bd8e0..9dba39495 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -3,7 +3,7 @@ #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index e844beae6..b28291984 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -17,7 +17,7 @@ #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/PlatformNetworkManagerStub.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 9389b3f98..93ceff24c 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -10,9 +10,9 @@ #include "platform/PlatformTypes.h" #include "platform/IPlatformNetwork.h" #include "platform/NetTypes.h" -#include "NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlatformNetworkManagerStub.h" -#include "SessionInfo.h" +#include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" class ClientConnection; diff --git a/targets/app/common/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h index 65d961848..3de173cf1 100644 --- a/targets/app/common/Network/NetworkPlayerQNet.h +++ b/targets/app/common/Network/NetworkPlayerQNet.h @@ -5,7 +5,7 @@ #include #include "platform/PlatformTypes.h" -#include "NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" class IQNetPlayer; class Socket; diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h index 069747bd1..297641349 100644 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ b/targets/app/common/Network/PlatformNetworkManagerInterface.h @@ -7,8 +7,8 @@ #endif #include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" -#include "NetworkPlayerInterface.h" -#include "SessionInfo.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" class ClientConnection; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp index 62bd9c69e..3ae7bb298 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -6,7 +6,7 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index 9f1f15ca5..2d7d80f0a 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -8,9 +8,9 @@ #include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" -#include "NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" -#include "SessionInfo.h" +#include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" class C4JThread; diff --git a/targets/app/common/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp index 691e29d2e..6ae610c25 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -9,7 +9,7 @@ // 4jcraft TODO #include "platform/ShutdownManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/NetTypes.h" #include "minecraft/server/network/ServerConnection.h" diff --git a/targets/app/common/Network/Socket.h b/targets/app/common/Network/Socket.h index e8d69ff85..ca45f8f34 100644 --- a/targets/app/common/Network/Socket.h +++ b/targets/app/common/Network/Socket.h @@ -11,7 +11,7 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/C4JThread.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 5135f2c8e..6859cfa6f 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.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 791c2c9dc..aa6abf132 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 "minecraft/GameTypes.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/SessionInfo.h" +#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.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 42627d430..3ec6865a4 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 @@ -13,7 +13,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/SessionInfo.h" +#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.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 37a433684..a207a9a2f 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 @@ -5,7 +5,7 @@ #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.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 766c715f3..23af36775 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 @@ -7,7 +7,7 @@ #include "minecraft/GameEnums.h" #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.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" 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 1a0cf76fd..d5106a9f0 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 @@ -5,7 +5,7 @@ #include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.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 d5c4379a1..e19845312 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 @@ -5,7 +5,7 @@ #include "app/common/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 309bcf5f3..04621cdfe 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -20,7 +20,7 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 6cd6c0603..e7a12ad97 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -23,7 +23,7 @@ #include "app/common/DLC/DLCSkinFile.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index e29dc6e21..6e40ba86b 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -8,7 +8,7 @@ #include "platform/ShutdownManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "util/StringHelpers.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index 7ea79b2a3..95e226d30 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,4 +1,4 @@ -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" diff --git a/targets/app/common/Network/NetworkPlayerInterface.h b/targets/minecraft/network/platform/NetworkPlayerInterface.h similarity index 100% rename from targets/app/common/Network/NetworkPlayerInterface.h rename to targets/minecraft/network/platform/NetworkPlayerInterface.h diff --git a/targets/app/common/Network/SessionInfo.h b/targets/minecraft/network/platform/SessionInfo.h similarity index 100% rename from targets/app/common/Network/SessionInfo.h rename to targets/minecraft/network/platform/SessionInfo.h diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index ec321d02e..a23f12d2e 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -21,7 +21,7 @@ #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerList.h" #include "Settings.h" #include "util/Timer.h" diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 20efba2eb..daea1f0a5 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -16,7 +16,7 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index cfe112c3a..2a47cf946 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -7,7 +7,7 @@ #include #include -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "TrackedEntity.h" diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index 746292478..971574bd8 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -11,7 +11,7 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerChunkCache.h" #include "ServerLevel.h" #include "ServerPlayer.h" diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 77a16c7f5..6b52b602e 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -14,7 +14,7 @@ #include "app/common/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerChunkMap.h" #include "Pos.h" #include "ServerChunkCache.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index d6778ea81..97af1a433 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -15,7 +15,7 @@ #include "app/common/Console_Debug_enum.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" #include "java/InputOutputStream/ByteArrayInputStream.h" diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index aa4e8518c..2f8162e82 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -11,7 +11,7 @@ #include "platform/PlatformTypes.h" #include "EntityTracker.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerPlayer.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 0784be2d0..fc098b461 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -11,7 +11,7 @@ #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" #include "app/common/BuildVer/BuildVer.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" #include "platform/NetTypes.h" #include "PlayerConnection.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 79644d33f..af89390d2 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -16,7 +16,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Network/NetworkPlayerInterface.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" From 1ddf12beb9340cd8dbe7e22fe35cf407a5ea9c7d Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:17:49 +1000 Subject: [PATCH 017/104] refactor: move WstringLookup into minecraft --- targets/app/common_sources.txt | 1 - targets/minecraft/sources.txt | 1 + .../GameRules => minecraft/world/level}/WstringLookup.cpp | 2 +- .../common/GameRules => minecraft/world/level}/WstringLookup.h | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename targets/{app/common/GameRules => minecraft/world/level}/WstringLookup.cpp (95%) rename targets/{app/common/GameRules => minecraft/world/level}/WstringLookup.h (100%) diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 8f1b38284..c16c39958 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -45,7 +45,6 @@ common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp common/GameRules/LevelRules/Rules/GameRule.cpp -common/GameRules/WstringLookup.cpp common/GameSettingsManager.cpp common/Game_XuiActions.cpp common/Leaderboards/LeaderboardInterface.cpp diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index cb6d0b47a..aefd496ad 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -731,6 +731,7 @@ world/level/TickNextTickData.cpp world/level/TileEventData.cpp world/level/TilePos.cpp world/level/WaterColor.cpp +world/level/WstringLookup.cpp world/level/biome/BeachBiome.cpp world/level/biome/Biome.cpp world/level/biome/BiomeCache.cpp diff --git a/targets/app/common/GameRules/WstringLookup.cpp b/targets/minecraft/world/level/WstringLookup.cpp similarity index 95% rename from targets/app/common/GameRules/WstringLookup.cpp rename to targets/minecraft/world/level/WstringLookup.cpp index 41e82b0c1..7df353651 100644 --- a/targets/app/common/GameRules/WstringLookup.cpp +++ b/targets/minecraft/world/level/WstringLookup.cpp @@ -1,5 +1,5 @@ -#include "WstringLookup.h" +#include "minecraft/world/level/WstringLookup.h" #include diff --git a/targets/app/common/GameRules/WstringLookup.h b/targets/minecraft/world/level/WstringLookup.h similarity index 100% rename from targets/app/common/GameRules/WstringLookup.h rename to targets/minecraft/world/level/WstringLookup.h From 58de5bb40beac5b2e197b5bc61735be992885ce6 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:19:54 +1000 Subject: [PATCH 018/104] refactor: move ConsoleGameRulesConstants.h into minecraft --- targets/app/common/Game.h | 2 +- targets/app/common/GameRules/GameRuleManager.h | 2 +- .../GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp | 2 +- .../GameRules/LevelGeneration/ApplySchematicRuleDefinition.h | 2 +- targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp | 2 +- targets/app/common/GameRules/LevelGeneration/BiomeOverride.h | 2 +- .../GameRules/LevelGeneration/ConsoleGenerateStructure.cpp | 2 +- .../common/GameRules/LevelGeneration/ConsoleGenerateStructure.h | 2 +- .../common/GameRules/LevelGeneration/LevelGenerationOptions.h | 2 +- targets/app/common/GameRules/LevelGeneration/StartFeature.cpp | 2 +- targets/app/common/GameRules/LevelGeneration/StartFeature.h | 2 +- .../StructureActions/XboxStructureActionGenerateBox.cpp | 2 +- .../StructureActions/XboxStructureActionGenerateBox.h | 2 +- .../StructureActions/XboxStructureActionPlaceBlock.cpp | 2 +- .../StructureActions/XboxStructureActionPlaceBlock.h | 2 +- .../StructureActions/XboxStructureActionPlaceContainer.cpp | 2 +- .../StructureActions/XboxStructureActionPlaceContainer.h | 2 +- .../StructureActions/XboxStructureActionPlaceSpawner.cpp | 2 +- .../StructureActions/XboxStructureActionPlaceSpawner.h | 2 +- .../LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/AddItemRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/CollectItemRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h | 2 +- .../GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp | 2 +- .../GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h | 2 +- .../GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp | 2 +- .../common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h | 2 +- .../LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/UseTileRuleDefinition.h | 2 +- targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h | 2 +- .../world/level}/ConsoleGameRulesConstants.h | 0 40 files changed, 39 insertions(+), 39 deletions(-) rename targets/{app/common/GameRules => minecraft/world/level}/ConsoleGameRulesConstants.h (100%) diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 9e7be771b..0a68d6ae0 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -24,7 +24,7 @@ #include "app/common/TerrainFeatureManager.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/common/DLC/DLCManager.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/GameRuleManager.h" #include "minecraft/locale/StringTable.h" #include "app/common/Tutorial/TutorialEnum.h" diff --git a/targets/app/common/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h index 140ca4b52..dc660f6a7 100644 --- a/targets/app/common/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -8,7 +8,7 @@ #include #include "app/common/DLC/DLCGameRulesHeader.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index e4f6d4c04..65ee363ff 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -5,7 +5,7 @@ #include "ConsoleSchematicFile.h" #include "LevelGenerationOptions.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index 1faad1f73..af8cda3eb 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -5,7 +5,7 @@ #include #include "ConsoleSchematicFile.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index 5e45f544b..67e046563 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,6 +1,6 @@ #include "BiomeOverride.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h index fc3918291..f91c49ad9 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h @@ -4,7 +4,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" class BiomeOverride : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index ceffe7f90..970df3176 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h index 9cb2008ab..7b92ad912 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h @@ -2,7 +2,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h index d197644a3..10d3d501d 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h @@ -9,7 +9,7 @@ #include #include "app/common/DLC/DLCPack.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/locale/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index fae469360..313c04fda 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,6 +1,6 @@ #include "StartFeature.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.h b/targets/app/common/GameRules/LevelGeneration/StartFeature.h index de40a5ac2..2adff6afa 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.h +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.h @@ -3,7 +3,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index e956b4bcb..38e5e04ed 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,6 +1,6 @@ #include "XboxStructureActionGenerateBox.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h index 7eee4ccf0..751d87c21 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h @@ -1,7 +1,7 @@ #pragma once #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" class StructurePiece; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index d1c19298f..2b4353df5 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,6 +1,6 @@ #include "XboxStructureActionPlaceBlock.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h index e217a9fa2..8ae640e6d 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h @@ -1,7 +1,7 @@ #pragma once #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" class StructurePiece; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 1c94d8997..04e5676bc 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h index e5735d057..5f002ed9a 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h @@ -3,7 +3,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" class AddItemRuleDefinition; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp index 2934b68b7..c950aad2f 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/Level.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h index 7c0b7abeb..be54cdec1 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h @@ -2,7 +2,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" class StructurePiece; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 61a1336f2..39e1261bf 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index cc69dd8de..a98787675 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -4,7 +4,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class ItemInstance; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 2503523bd..72985794e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -3,7 +3,7 @@ #include #include "AddEnchantmentRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index b2391c6f5..aa3bae12c 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -5,7 +5,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class Container; class AddEnchantmentRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 93bf813c6..c7addda64 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,6 +1,6 @@ #include "CollectItemRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/Rules/GameRule.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 4f956078c..5cc4f16aa 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -4,7 +4,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h index ef10f3721..9905aa7d7 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h @@ -3,7 +3,7 @@ #include #include "CompoundGameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class GameRule; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index b3cde7a2e..d372101cf 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -7,7 +7,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index 26b89124e..675c85efc 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -3,7 +3,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" class CompoundGameRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index 51c083dca..911e8e61c 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -8,7 +8,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/GameRules/LevelRules/Rules/GameRule.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h index 71a43fa2e..19bb1271e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index c103bbaa4..9f9a2a2ec 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -1,6 +1,6 @@ #include "LevelRuleset.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "minecraft/locale/StringTable.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h index 4eaedd7b8..87ce549a5 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h @@ -4,7 +4,7 @@ #include #include "CompoundGameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class NamedAreaRuleDefinition; class AABB; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 170c2c6f3..d5aa85f23 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index b20e209c9..cad2bb6ed 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -3,7 +3,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/phys/AABB.h" class NamedAreaRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index f4b38a3f7..9d383bf54 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index bb6943a31..af7dd2d33 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -5,7 +5,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index 8f18a0e56..738f14b43 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,6 +1,6 @@ #include "UseTileRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index 273398dd8..6abeb1081 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -4,7 +4,7 @@ #include #include "GameRuleDefinition.h" -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/Pos.h" class UseTileRuleDefinition : public GameRuleDefinition { diff --git a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h index ce015a45e..754aa4877 100644 --- a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h +++ b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h @@ -6,7 +6,7 @@ #include #include -#include "app/common/GameRules/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/app/common/GameRules/ConsoleGameRulesConstants.h b/targets/minecraft/world/level/ConsoleGameRulesConstants.h similarity index 100% rename from targets/app/common/GameRules/ConsoleGameRulesConstants.h rename to targets/minecraft/world/level/ConsoleGameRulesConstants.h From a3b8adeb5a156a3378db5f0a1a1bbe5cd300dc76 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:22:09 +1000 Subject: [PATCH 019/104] refactor: move Console_Debug_enum.h into minecraft --- targets/app/common/DLC/DLCPack.cpp | 2 +- targets/app/common/DebugOptions.h | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 2 +- targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp | 2 +- targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h | 2 +- .../Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp | 2 +- targets/{app/common => minecraft}/Console_Debug_enum.h | 0 targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp | 2 +- targets/minecraft/client/renderer/LevelRenderer.cpp | 2 +- targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/server/level/ServerLevel.cpp | 2 +- targets/minecraft/server/level/ServerPlayer.cpp | 2 +- targets/minecraft/server/network/PlayerConnection.cpp | 2 +- targets/minecraft/world/item/PlanterTileItem.cpp | 2 +- targets/minecraft/world/item/TileItem.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 2 +- targets/minecraft/world/level/biome/BiomeSource.cpp | 2 +- .../world/level/chunk/storage/McRegionChunkStorage.cpp | 2 +- targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp | 2 +- targets/minecraft/world/level/dimension/Dimension.cpp | 2 +- targets/minecraft/world/level/dimension/HellDimension.cpp | 2 +- targets/minecraft/world/level/newbiome/layer/Layer.cpp | 2 +- targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename targets/{app/common => minecraft}/Console_Debug_enum.h (100%) diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 4660e6b0a..15b1a6c81 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -15,7 +15,7 @@ #include "DLCLocalisationFile.h" #include "DLCTextureFile.h" #include "DLCUIDataFile.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" diff --git a/targets/app/common/DebugOptions.h b/targets/app/common/DebugOptions.h index de437d650..b8a922145 100644 --- a/targets/app/common/DebugOptions.h +++ b/targets/app/common/DebugOptions.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" class DebugOptions { public: diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 9125722d3..69dfb69b2 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -8,7 +8,7 @@ #include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/GameRules/GameRuleManager.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 1e09c6770..4b7cd0db1 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -5,7 +5,7 @@ #include "minecraft/GameTypes.h" #include "platform/profile/ProfileConstants.h" #include "minecraft/GameEnums.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 7cafffa2b..1b8bc6270 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 "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.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/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 673ff8e1a..47b5fc4cb 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 "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" #ifndef _ENABLEIGGY diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h index 6aedef022..f29aa978a 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h @@ -2,7 +2,7 @@ #include -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.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 ed50aee4d..16f22f310 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/profile/profile.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/Controls/UIControl_Label.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 23af36775..482caabdf 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 @@ -5,7 +5,7 @@ #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.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 e19845312..3ebc242d5 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 "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/app/common/Console_Debug_enum.h b/targets/minecraft/Console_Debug_enum.h similarity index 100% rename from targets/app/common/Console_Debug_enum.h rename to targets/minecraft/Console_Debug_enum.h diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index fa7482299..771015f2f 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -14,7 +14,7 @@ #include "platform/input/input.h" #include "ClientConnection.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 018a07052..1ae7c5c87 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -24,7 +24,7 @@ #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "minecraft/client/resources/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "util/FrameProfiler.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "Tesselator.h" diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index a23f12d2e..1d0509dfd 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -67,7 +67,7 @@ #endif #include "platform/input/input.h" #include "platform/ShutdownManager.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/Network/Socket.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 6b52b602e..f0a1cc5a0 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -11,7 +11,7 @@ #include "platform/storage/storage.h" #include "EntityTracker.h" #include "platform/ShutdownManager.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 97af1a433..c9fe80436 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -12,7 +12,7 @@ #include "platform/input/input.h" #include "EntityTracker.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index af89390d2..185ad999b 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -12,7 +12,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/Network/GameNetworkManager.h" diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 3008d77c5..82eed36fb 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -3,7 +3,7 @@ #include -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index c5421886a..735064e40 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -6,7 +6,7 @@ #include -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "java/Class.h" #include "minecraft/Facing.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 42512fc21..88f11375b 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -19,7 +19,7 @@ #include "LevelListener.h" #include "minecraft/GameEnums.h" #include "minecraft/client/resources/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "util/FrameProfiler.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index e43e9d730..3d5ac8dc3 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -7,7 +7,7 @@ #include #include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 1df454504..6ec930a2e 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -11,7 +11,7 @@ #include #include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "platform/C4JThread.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 0f31e795e..edab83d55 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -13,7 +13,7 @@ #include #include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "util/Definitions.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 12ac98d46..7fba66a4f 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -9,7 +9,7 @@ #include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "minecraft/client/resources/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "NormalDimension.h" #include "TheEndDimension.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index abc2a17e8..aeb72fc0d 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -6,7 +6,7 @@ #include "platform/input/input.h" #include "minecraft/GameEnums.h" #include "minecraft/client/resources/Colours/ColourTable.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index b7cb4c1c0..2260891db 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -8,7 +8,7 @@ #include "BiomeOverrideLayer.h" #include "platform/input/input.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" #include "minecraft/world/level/newbiome/layer/AddMushroomIslandLayer.h" diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index f4910edbd..050851a20 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -14,7 +14,7 @@ #include "platform/input/input.h" #include "LevelData.h" -#include "app/common/Console_Debug_enum.h" +#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" #include "util/StringHelpers.h" #include "java/File.h" From efe4c915380e8a2f08c8256fd35b9b7c47d62f92 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:24:07 +1000 Subject: [PATCH 020/104] refactor: move BuildVer.h into minecraft --- .../common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp | 2 +- targets/{app/common/BuildVer => minecraft}/BuildVer.h | 0 targets/minecraft/client/ClientConstants.cpp | 2 +- targets/minecraft/network/packet/PreLoginPacket.cpp | 2 +- targets/minecraft/server/network/PendingConnection.cpp | 2 +- .../level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp | 2 +- .../level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename targets/{app/common/BuildVer => minecraft}/BuildVer.h (100%) 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 9797f1aa3..4e2a7385e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -6,7 +6,7 @@ #include "platform/input/input.h" #include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/BuildVer/BuildVer.h b/targets/minecraft/BuildVer.h similarity index 100% rename from targets/app/common/BuildVer/BuildVer.h rename to targets/minecraft/BuildVer.h diff --git a/targets/minecraft/client/ClientConstants.cpp b/targets/minecraft/client/ClientConstants.cpp index ed9df059c..89fc249d8 100644 --- a/targets/minecraft/client/ClientConstants.cpp +++ b/targets/minecraft/client/ClientConstants.cpp @@ -1,6 +1,6 @@ #include "ClientConstants.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" const std::string ClientConstants::VERSION_STRING = std::string("Minecraft Xbox ") + VER_FILEVERSION_STR_W + diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 7b8513093..660490752 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" #include "platform/IPlatformNetwork.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index fc098b461..732b591e5 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -10,7 +10,7 @@ #include "platform/PlatformTypes.h" #include "platform/storage/storage.h" #include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/IPlatformNetwork.h" #include "platform/NetTypes.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index c9f431205..c48d6c65a 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -16,7 +16,7 @@ #include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 2445e6b8f..1048025a2 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -18,7 +18,7 @@ #include "platform/fs/fs.h" #include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" -#include "app/common/BuildVer/BuildVer.h" +#include "minecraft/BuildVer.h" #include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/Timer.h" From e14825c302d3853adc51a4ebeac3532b0f3f1699 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:31:07 +1000 Subject: [PATCH 021/104] refactor: move GameRule chain headers into minecraft --- targets/app/common/DLC/DLCGameRules.h | 2 +- targets/app/common/DLC/DLCGameRulesHeader.h | 2 +- targets/app/common/GameRules/ConsoleGameRules.h | 8 ++++---- targets/app/common/GameRules/GameRuleManager.cpp | 4 ++-- .../LevelGeneration/ApplySchematicRuleDefinition.cpp | 4 ++-- .../LevelGeneration/ApplySchematicRuleDefinition.h | 2 +- .../common/GameRules/LevelGeneration/BiomeOverride.cpp | 2 +- .../app/common/GameRules/LevelGeneration/BiomeOverride.h | 2 +- .../LevelGeneration/ConsoleGenerateStructure.cpp | 2 +- .../GameRules/LevelGeneration/ConsoleGenerateStructure.h | 2 +- .../LevelGeneration/ConsoleGenerateStructureAction.h | 2 +- .../GameRules/LevelGeneration/LevelGenerationOptions.cpp | 4 ++-- .../common/GameRules/LevelGeneration/LevelGenerators.cpp | 2 +- .../app/common/GameRules/LevelGeneration/StartFeature.cpp | 2 +- .../app/common/GameRules/LevelGeneration/StartFeature.h | 2 +- .../StructureActions/XboxStructureActionGenerateBox.cpp | 2 +- .../StructureActions/XboxStructureActionPlaceBlock.cpp | 2 +- .../RuleDefinitions/AddEnchantmentRuleDefinition.cpp | 2 +- .../RuleDefinitions/AddEnchantmentRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/AddItemRuleDefinition.h | 2 +- .../RuleDefinitions/CollectItemRuleDefinition.cpp | 6 +++--- .../RuleDefinitions/CollectItemRuleDefinition.h | 4 ++-- .../RuleDefinitions/CompleteAllRuleDefinition.cpp | 4 ++-- .../RuleDefinitions/CompoundGameRuleDefinition.cpp | 6 +++--- .../RuleDefinitions/CompoundGameRuleDefinition.h | 4 ++-- .../LevelRules/RuleDefinitions/GameRuleDefinition.cpp | 6 +++--- .../RuleDefinitions/NamedAreaRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h | 2 +- .../RuleDefinitions/UpdatePlayerRuleDefinition.cpp | 2 +- .../RuleDefinitions/UpdatePlayerRuleDefinition.h | 2 +- .../LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp | 2 +- .../LevelRules/RuleDefinitions/UseTileRuleDefinition.h | 2 +- .../app/common/GameRules/LevelRules/Rules/GameRule.cpp | 4 ++-- targets/app/common/Network/GameNetworkManager.cpp | 2 +- targets/app/common/NetworkController.cpp | 1 + .../UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp | 2 +- targets/minecraft/client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/client/skins/DLCTexturePack.cpp | 2 +- targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/server/PlayerList.cpp | 4 ++-- targets/minecraft/server/level/ServerPlayer.cpp | 2 +- targets/minecraft/server/level/ServerPlayerGameMode.cpp | 2 +- .../Rules => minecraft/world/level/GameRules}/GameRule.h | 0 .../world/level/GameRules}/GameRuleDefinition.h | 2 +- .../world/level/GameRules}/GameRulesInstance.h | 2 +- .../world/level/GameRules}/LevelGenerationOptions.h | 3 +-- .../minecraft/world/level/levelgen/CustomLevelSource.cpp | 2 +- .../minecraft/world/level/levelgen/RandomLevelSource.cpp | 2 +- .../world/level/levelgen/feature/BasicTreeFeature.cpp | 2 +- .../world/level/levelgen/feature/BirchFeature.cpp | 2 +- .../world/level/levelgen/feature/CaveFeature.cpp | 2 +- .../world/level/levelgen/feature/FlowerFeature.cpp | 2 +- .../world/level/levelgen/feature/LakeFeature.cpp | 2 +- .../world/level/levelgen/feature/MegaTreeFeature.cpp | 2 +- .../minecraft/world/level/levelgen/feature/OreFeature.cpp | 2 +- .../world/level/levelgen/feature/PineFeature.cpp | 2 +- .../world/level/levelgen/feature/ReedsFeature.cpp | 2 +- .../world/level/levelgen/feature/SandFeature.cpp | 2 +- .../world/level/levelgen/feature/SpringFeature.cpp | 2 +- .../world/level/levelgen/feature/SpruceFeature.cpp | 2 +- .../world/level/levelgen/feature/SwampTreeFeature.cpp | 2 +- .../world/level/levelgen/feature/TreeFeature.cpp | 2 +- .../world/level/levelgen/structure/MineShaftFeature.cpp | 2 +- .../level/levelgen/structure/NetherBridgeFeature.cpp | 2 +- .../levelgen/structure/RandomScatteredLargeFeature.cpp | 2 +- .../level/levelgen/structure/ScatteredFeaturePieces.cpp | 2 +- .../world/level/levelgen/structure/StrongholdFeature.cpp | 2 +- .../world/level/levelgen/structure/VillageFeature.cpp | 2 +- .../storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp | 2 +- .../storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp | 2 +- 72 files changed, 88 insertions(+), 88 deletions(-) rename targets/{app/common/GameRules/LevelRules/Rules => minecraft/world/level/GameRules}/GameRule.h (100%) rename targets/{app/common/GameRules/LevelRules/RuleDefinitions => minecraft/world/level/GameRules}/GameRuleDefinition.h (97%) rename targets/{app/common/GameRules/LevelRules/Rules => minecraft/world/level/GameRules}/GameRulesInstance.h (93%) rename targets/{app/common/GameRules/LevelGeneration => minecraft/world/level/GameRules}/LevelGenerationOptions.h (98%) diff --git a/targets/app/common/DLC/DLCGameRules.h b/targets/app/common/DLC/DLCGameRules.h index 3be9a70ea..fa31ee680 100644 --- a/targets/app/common/DLC/DLCGameRules.h +++ b/targets/app/common/DLC/DLCGameRules.h @@ -1,7 +1,7 @@ #pragma once #include "DLCFile.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" class DLCGameRules : public DLCFile { public: diff --git a/targets/app/common/DLC/DLCGameRulesHeader.h b/targets/app/common/DLC/DLCGameRulesHeader.h index fa82416c7..cc1dc6468 100644 --- a/targets/app/common/DLC/DLCGameRulesHeader.h +++ b/targets/app/common/DLC/DLCGameRulesHeader.h @@ -4,7 +4,7 @@ #include #include "DLCGameRules.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" class StringTable; diff --git a/targets/app/common/GameRules/ConsoleGameRules.h b/targets/app/common/GameRules/ConsoleGameRules.h index 765acff99..a4c57d938 100644 --- a/targets/app/common/GameRules/ConsoleGameRules.h +++ b/targets/app/common/GameRules/ConsoleGameRules.h @@ -5,7 +5,7 @@ #include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" @@ -16,10 +16,10 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 29c31bf94..a090c4dcb 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -13,10 +13,10 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 65ee363ff..2de23bbf0 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -4,9 +4,9 @@ #include #include "ConsoleSchematicFile.h" -#include "LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index af8cda3eb..b65aa9012 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -6,7 +6,7 @@ #include "ConsoleSchematicFile.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index 67e046563..f6984daf0 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,7 +1,7 @@ #include "BiomeOverride.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h index f91c49ad9..5dac30ab8 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.h @@ -5,7 +5,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class BiomeOverride : public GameRuleDefinition { private: diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 970df3176..15bd9823a 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -10,7 +10,7 @@ #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h index 7b92ad912..12d82816f 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h @@ -3,7 +3,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeatureIO.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h index f8f1014a2..6634535dd 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class ConsoleGenerateStructureAction : public GameRuleDefinition { public: diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 76fc4aa4f..a7ff792f0 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -1,4 +1,4 @@ -#include "LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include #include @@ -16,7 +16,7 @@ #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "app/linux/Stubs/winapi_stubs.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp index 2fad35ae8..8d9576209 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerators.cpp @@ -2,7 +2,7 @@ #include -#include "LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" LevelGenerators::LevelGenerators() {} diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index 313c04fda..d18b6a1d0 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,7 +1,7 @@ #include "StartFeature.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.h b/targets/app/common/GameRules/LevelGeneration/StartFeature.h index 2adff6afa..cd0446609 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.h +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.h @@ -4,7 +4,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class StartFeature : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index 38e5e04ed..f778e2098 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -2,7 +2,7 @@ #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index 2b4353df5..e564b421b 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -2,7 +2,7 @@ #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 39e1261bf..47f31dba2 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -4,7 +4,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index a98787675..ff4e002b5 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -3,7 +3,7 @@ #include #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" class ItemInstance; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 72985794e..999de21a9 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -4,7 +4,7 @@ #include "AddEnchantmentRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index aa3bae12c..5c412ffed 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -4,7 +4,7 @@ #include #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" class Container; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index c7addda64..51df8ccc2 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,9 +1,9 @@ #include "CollectItemRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 5cc4f16aa..2e35806d6 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -3,9 +3,9 @@ #include #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" class Pos; class UseTileRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index 70b001ab2..eab1737a4 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -5,8 +5,8 @@ #include #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRule.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "minecraft/network/Connection.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index d372101cf..a65ca3217 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -10,11 +10,11 @@ #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "util/StringHelpers.h" CompoundGameRuleDefinition::CompoundGameRuleDefinition() { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index 675c85efc..9227ba184 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -2,9 +2,9 @@ #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" class CompoundGameRuleDefinition : public GameRuleDefinition { protected: diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index 911e8e61c..b5e3b8489 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -1,4 +1,4 @@ -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include #include @@ -11,8 +11,8 @@ #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index d5aa85f23..80038ff79 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index cad2bb6ed..2c90d7479 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -2,7 +2,7 @@ #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index 9d383bf54..f4a128cd0 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -6,7 +6,7 @@ #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index af7dd2d33..eb25a6256 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -4,7 +4,7 @@ #include #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index 738f14b43..3cfd9e224 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,7 +1,7 @@ #include "UseTileRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index 6abeb1081..998786837 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -3,7 +3,7 @@ #include -#include "GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/Pos.h" diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index 4c933a1e3..8e4a5f28b 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -1,5 +1,5 @@ -#include "app/common/GameRules/LevelRules/Rules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRule.h" #include @@ -8,7 +8,7 @@ #include #include -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index b28291984..c40a706c6 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -16,7 +16,7 @@ #include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/PlatformNetworkManagerStub.h" #include "app/common/UI/All Platforms/UIEnums.h" diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index e7ed1acbf..3d37c560a 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -4,6 +4,7 @@ #include #include +#include "app/common/DLC/DLCPack.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.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 5688fb328..b5fccce01 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 @@ -12,7 +12,7 @@ #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.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 3ec6865a4..98ff63caa 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 @@ -11,7 +11,7 @@ #include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index e7a12ad97..0a3e79421 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -21,7 +21,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index bc2447de8..369eb9668 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -22,7 +22,7 @@ #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 1d0509dfd..873bb2477 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -19,7 +19,7 @@ #include "DispenserBootstrap.h" #include "minecraft/GameEnums.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerList.h" diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index daea1f0a5..cc4868261 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -12,9 +12,9 @@ #include "platform/profile/profile.h" #include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index c9fe80436..1281b502c 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -13,7 +13,7 @@ #include "platform/input/input.h" #include "EntityTracker.h" #include "minecraft/Console_Debug_enum.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" diff --git a/targets/minecraft/server/level/ServerPlayerGameMode.cpp b/targets/minecraft/server/level/ServerPlayerGameMode.cpp index 300e3fca4..c1dcad91c 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -3,7 +3,7 @@ #include -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.h b/targets/minecraft/world/level/GameRules/GameRule.h similarity index 100% rename from targets/app/common/GameRules/LevelRules/Rules/GameRule.h rename to targets/minecraft/world/level/GameRules/GameRule.h diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h similarity index 97% rename from targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h rename to targets/minecraft/world/level/GameRules/GameRuleDefinition.h index 19bb1271e..3f87bb51b 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h +++ b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h @@ -7,7 +7,7 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/Rules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/item/ItemInstance.h" class GameRule; diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h b/targets/minecraft/world/level/GameRules/GameRulesInstance.h similarity index 93% rename from targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h rename to targets/minecraft/world/level/GameRules/GameRulesInstance.h index b3390636c..f278e3225 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRulesInstance.h +++ b/targets/minecraft/world/level/GameRules/GameRulesInstance.h @@ -2,7 +2,7 @@ // using namespace std; #include -#include "GameRule.h" +#include "minecraft/world/level/GameRules/GameRule.h" class GameRuleDefinition; diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h similarity index 98% rename from targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h rename to targets/minecraft/world/level/GameRules/LevelGenerationOptions.h index 10d3d501d..f39dc5794 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h @@ -8,9 +8,8 @@ #include #include -#include "app/common/DLC/DLCPack.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/locale/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index cc9d7aeb0..45e17ba87 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -6,7 +6,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "platform/fs/fs.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index d671e1aa0..f56d9c44f 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -6,7 +6,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "util/Timer.h" #include "java/Random.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index d0c906150..1abccac72 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -7,7 +7,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index 4b532dffd..d228f701c 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index 4c81dcc9c..ddaef9032 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -7,7 +7,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index 56f96c109..d89fe6b1c 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "FlowerFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index 4a83a4fd5..c67658f41 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "LakeFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LightLayer.h" diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index 439692288..214bde128 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index b1e5a75d3..37349752a 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index 68f36eda9..eb9d1fe87 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index bbe7132ad..490da93af 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "ReedsFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index eaa4d1178..cb9d74b75 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "SandFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index d72bf90b9..9ddb6aa2b 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -2,7 +2,7 @@ #include "minecraft/util/Log.h" #include "SpringFeature.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index aa18a51c9..2bb1579fe 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 5cb5b2359..72664fbc3 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 2d40cc922..50bd605dd 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -4,7 +4,7 @@ #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index c0e2b7a13..ce2517043 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -10,7 +10,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index 8e56d4c20..039adbf3a 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -4,7 +4,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "NetherBridgePieces.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp index 43ce8248e..078f0eb2a 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -4,7 +4,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp index 57a74a67b..1716d3a3b 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -6,7 +6,7 @@ #include #include -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 5bbeedf0d..7eccbe1ce 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -11,7 +11,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index aa6d0e78e..7809d2e75 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -7,7 +7,7 @@ #include #include "minecraft/GameEnums.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "VillagePieces.h" #include "java/Random.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index c48d6c65a..693a08cde 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -17,7 +17,7 @@ #include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" #include "minecraft/BuildVer.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 1048025a2..40c920a0d 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -19,7 +19,7 @@ #include "platform/PlatformTypes.h" #include "minecraft/GameEnums.h" #include "minecraft/BuildVer.h" -#include "app/common/GameRules/LevelGeneration/LevelGenerationOptions.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/Timer.h" #include "util/StringHelpers.h" From 09a6ba4a12cc4a45467fe370c9ecff1e9b3b43a0 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:36:23 +1000 Subject: [PATCH 022/104] refactor: move Minecraft_Macros.h into minecraft --- targets/app/common/DLC/DLCFile.cpp | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/SkinManager.cpp | 2 +- .../common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- targets/{app/common => minecraft}/Minecraft_Macros.h | 0 targets/minecraft/client/Minecraft.cpp | 2 +- .../minecraft/network/packet/TextureAndGeometryChangePacket.cpp | 2 +- targets/minecraft/network/packet/TextureAndGeometryPacket.cpp | 2 +- targets/minecraft/world/entity/player/Player.cpp | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename targets/{app/common => minecraft}/Minecraft_Macros.h (100%) diff --git a/targets/app/common/DLC/DLCFile.cpp b/targets/app/common/DLC/DLCFile.cpp index 378bb6403..ecb33974a 100644 --- a/targets/app/common/DLC/DLCFile.cpp +++ b/targets/app/common/DLC/DLCFile.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) { diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 69dfb69b2..28eaa47bb 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -79,7 +79,7 @@ #include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "util/Timer.h" #include "util/StringHelpers.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index c5c2e0282..851f2f70b 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -9,7 +9,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/geom/Model.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 2312fda10..2d8b03101 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -8,7 +8,7 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/profile/ProfileConstants.h" -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" diff --git a/targets/app/common/Minecraft_Macros.h b/targets/minecraft/Minecraft_Macros.h similarity index 100% rename from targets/app/common/Minecraft_Macros.h rename to targets/minecraft/Minecraft_Macros.h diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 04621cdfe..fb6bac1d1 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -107,7 +107,7 @@ #include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp index 65066922f..8b0834ed3 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp @@ -2,7 +2,7 @@ #include -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 40cb83761..3fe50e8b3 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCSkinFile.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index e6477a1c3..319462fb7 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -24,7 +24,7 @@ #include "Inventory.h" #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "app/common/Minecraft_Macros.h" +#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/linux/LinuxGame.h" From 61a0d9690bc2d20309f9b4ad1e7c9cf2fc96cda0 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:39:05 +1000 Subject: [PATCH 023/104] chore: drop a few more dead winapi_stubs.h includes --- scripts/sweep_winapi_stubs_includes.py | 12 ++++++++++++ targets/minecraft/client/Minecraft.cpp | 1 - .../client/multiplayer/ClientConnection.cpp | 1 - targets/minecraft/network/packet/Packet.cpp | 1 - .../world/level/chunk/CompressedTileStorage.cpp | 1 - .../world/level/chunk/storage/RegionFile.cpp | 1 - 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/sweep_winapi_stubs_includes.py b/scripts/sweep_winapi_stubs_includes.py index e1151e232..5b966c4c1 100644 --- a/scripts/sweep_winapi_stubs_includes.py +++ b/scripts/sweep_winapi_stubs_includes.py @@ -67,8 +67,20 @@ USAGE_PATTERNS = [ ] +def strip_comments(text: str) -> str: + """Strip C++ // and /* */ comments. Approximate but good enough for + detecting whether a symbol appears in real code vs commented-out + code.""" + # Strip /* ... */ comments (multiline) + text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL) + # Strip // ... comments (single line) + text = re.sub(r'//[^\n]*', '', text) + return text + + def needs_winapi(text: str) -> bool: scan = INCLUDE_RE.sub("", text) + scan = strip_comments(scan) return any(p.search(scan) for p in USAGE_PATTERNS) diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index fb6bac1d1..f132c489f 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -25,7 +25,6 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 0a3e79421..73786ded9 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -33,7 +33,6 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "MultiPlayerLevel.h" #include "ReceivingLevelScreen.h" #include "util/Timer.h" diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 56b75aebe..5c9acb854 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -13,7 +13,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "java/Exceptions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 7c4e3eef8..a6aae31d4 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -8,7 +8,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "util/Definitions.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index 882981e02..31f1d0b49 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -7,7 +7,6 @@ #include #include -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" From 33fe5fec3a6bee19fbf7fbc27d14715504eb991d Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:41:09 +1000 Subject: [PATCH 024/104] chore: drop a few more dead LinuxGame.h includes --- scripts/sweep_linuxgame_includes.py | 10 +++++++++- .../client/multiplayer/MultiPlayerLocalPlayer.cpp | 1 - targets/minecraft/world/entity/player/Player.cpp | 1 - targets/minecraft/world/item/EnderEyeItem.cpp | 1 - 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/sweep_linuxgame_includes.py b/scripts/sweep_linuxgame_includes.py index 9a13424f1..dcd693d67 100644 --- a/scripts/sweep_linuxgame_includes.py +++ b/scripts/sweep_linuxgame_includes.py @@ -48,10 +48,18 @@ USAGE_PATTERNS = [ ] +def strip_comments(text: str) -> str: + text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL) + text = re.sub(r'//[^\n]*', '', text) + return text + + def file_needs_linuxgame(text: str) -> bool: # Strip the LinuxGame.h include line itself before checking, to avoid - # the include path matching `LinuxGame`. + # the include path matching `LinuxGame`. Also strip comments so + # references in commented-out code don't keep the include alive. scan = INCLUDE_RE.sub("", text) + scan = strip_comments(scan) for pat in USAGE_PATTERNS: if pat.search(scan): return True diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 3fb436eec..7af1bd050 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -10,7 +10,6 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" -#include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 319462fb7..464a2cab6 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -27,7 +27,6 @@ #include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/linux/LinuxGame.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index 66098b4f7..a90cecd5f 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -3,7 +3,6 @@ #include -#include "app/linux/LinuxGame.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" From 03618ed156d0d591296e7e024302ed9ae05f1a8a Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 22:49:50 +1000 Subject: [PATCH 025/104] refactor: move leaderboard/network interfaces back into app --- .../Leaderboards}/IPlatformLeaderboard.h | 0 .../common/Leaderboards/LeaderboardManager.h | 2 +- .../app/common/Network/GameNetworkManager.h | 2 +- .../common/Network}/IPlatformNetwork.h | 0 .../Network/PlatformNetworkManagerStub.h | 2 +- targets/minecraft/BuildVer.h | 5 +++ .../network/packet/PreLoginPacket.cpp | 1 - .../server/network/PendingConnection.cpp | 1 - targets/platform/IPlatformSound.h | 38 ------------------- 9 files changed, 8 insertions(+), 43 deletions(-) rename targets/{platform => app/common/Leaderboards}/IPlatformLeaderboard.h (100%) rename targets/{platform => app/common/Network}/IPlatformNetwork.h (100%) delete mode 100644 targets/platform/IPlatformSound.h diff --git a/targets/platform/IPlatformLeaderboard.h b/targets/app/common/Leaderboards/IPlatformLeaderboard.h similarity index 100% rename from targets/platform/IPlatformLeaderboard.h rename to targets/app/common/Leaderboards/IPlatformLeaderboard.h diff --git a/targets/app/common/Leaderboards/LeaderboardManager.h b/targets/app/common/Leaderboards/LeaderboardManager.h index 6c65ec98b..183b7234d 100644 --- a/targets/app/common/Leaderboards/LeaderboardManager.h +++ b/targets/app/common/Leaderboards/LeaderboardManager.h @@ -2,7 +2,7 @@ #include -#include "platform/IPlatformLeaderboard.h" +#include "app/common/Leaderboards/IPlatformLeaderboard.h" class LeaderboardManager : public IPlatformLeaderboard { public: diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 93ceff24c..ed9635052 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -8,7 +8,7 @@ #include #endif #include "platform/PlatformTypes.h" -#include "platform/IPlatformNetwork.h" +#include "app/common/Network/IPlatformNetwork.h" #include "platform/NetTypes.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlatformNetworkManagerStub.h" diff --git a/targets/platform/IPlatformNetwork.h b/targets/app/common/Network/IPlatformNetwork.h similarity index 100% rename from targets/platform/IPlatformNetwork.h rename to targets/app/common/Network/IPlatformNetwork.h diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index 2d7d80f0a..aa50268cb 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -9,7 +9,7 @@ #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/IPlatformNetwork.h" +#include "app/common/Network/IPlatformNetwork.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" diff --git a/targets/minecraft/BuildVer.h b/targets/minecraft/BuildVer.h index 9215df6c7..130825af8 100644 --- a/targets/minecraft/BuildVer.h +++ b/targets/minecraft/BuildVer.h @@ -10,6 +10,11 @@ #define VER_PRODUCTBUILD 560 // This goes up if there is any change to network traffic or code in a build #define VER_NETWORK 560 + +// Network protocol version. Sent in the pre-login packet so client and +// server can detect mismatched builds. +#define MINECRAFT_NET_VERSION VER_NETWORK + #define VER_PRODUCTBUILD_QFE 0 #define VER_FILEVERSION_STRING "1.6" diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 660490752..7b6334e5b 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -6,7 +6,6 @@ #include #include "minecraft/BuildVer.h" -#include "platform/IPlatformNetwork.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 732b591e5..0a27fa3a1 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -12,7 +12,6 @@ #include "minecraft/GameEnums.h" #include "minecraft/BuildVer.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/IPlatformNetwork.h" #include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" diff --git a/targets/platform/IPlatformSound.h b/targets/platform/IPlatformSound.h deleted file mode 100644 index cb22aff11..000000000 --- a/targets/platform/IPlatformSound.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include - -class File; -class Mob; -class Options; - -class IPlatformSound { -public: - virtual ~IPlatformSound() = default; - - virtual void init(Options*) = 0; - virtual void destroy() = 0; - virtual void tick(std::shared_ptr* players, float a) = 0; - - // SFX - virtual void play(int iSound, float x, float y, float z, float volume, - float pitch) = 0; - virtual void playUI(int iSound, float volume, float pitch) = 0; - - // Streaming / music - virtual void playStreaming(const std::string& name, float x, float y, - float z, float volume, float pitch, - bool bMusicDelay = true) = 0; - virtual void playMusicTick() = 0; - virtual void updateMusicVolume(float fVal) = 0; - virtual void updateSystemMusicPlaying(bool isPlaying) = 0; - virtual void updateSoundEffectVolume(float fVal) = 0; - - // Asset registration - virtual void add(const std::string& name, File* file) = 0; - virtual void addMusic(const std::string& name, File* file) = 0; - virtual void addStreaming(const std::string& name, File* file) = 0; - virtual char* ConvertSoundPathToName(const std::string& name, - bool bConvertSpaces = false) = 0; -}; From b3d6e7151b6cacbfce348133056913eafc1dde67 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 23:03:54 +1000 Subject: [PATCH 026/104] refactor: extract a network service interface for minecraft to depend on --- .../app/common/Network/GameNetworkManager.cpp | 7 ++ .../app/common/Network/GameNetworkManager.h | 3 +- targets/minecraft/client/Minecraft.cpp | 44 +++++------ .../client/gui/CreateWorldScreen.cpp | 8 +- targets/minecraft/client/gui/PauseScreen.cpp | 10 +-- targets/minecraft/client/gui/Screen.cpp | 6 +- .../client/multiplayer/ClientConnection.cpp | 34 ++++----- .../multiplayer/MultiPlayerChunkCache.cpp | 6 +- .../client/multiplayer/MultiPlayerLevel.cpp | 14 ++-- .../multiplayer/MultiPlayerLocalPlayer.cpp | 2 +- .../minecraft/client/player/LocalPlayer.cpp | 12 +-- targets/minecraft/network/Connection.cpp | 6 +- targets/minecraft/network/INetworkService.h | 73 +++++++++++++++++++ targets/minecraft/server/MinecraftServer.cpp | 30 ++++---- targets/minecraft/server/PlayerList.cpp | 6 +- .../minecraft/server/level/PlayerChunkMap.cpp | 6 +- .../minecraft/server/level/ServerPlayer.cpp | 10 +-- .../server/network/PlayerConnection.cpp | 4 +- targets/minecraft/world/level/Level.cpp | 6 +- .../world/level/chunk/LevelChunk.cpp | 8 +- .../level/tile/entity/SignTileEntity.cpp | 2 +- 21 files changed, 191 insertions(+), 106 deletions(-) create mode 100644 targets/minecraft/network/INetworkService.h diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index c40a706c6..ed88a05c7 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -61,6 +61,13 @@ class INVITE_INFO; CGameNetworkManager g_NetworkManager; IPlatformNetwork* CGameNetworkManager::s_pPlatformNetworkManager; +// minecraft/-side function accessor for INetworkService. +namespace minecraft::network::platform_internal { +::minecraft::network::INetworkService& NetworkService_get() { + return g_NetworkManager; +} +} // namespace minecraft::network::platform_internal + int64_t CGameNetworkManager::messageQueue[512]; int64_t CGameNetworkManager::byteQueue[512]; int CGameNetworkManager::messageQueuePos = 0; diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index ed9635052..980867186 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -10,6 +10,7 @@ #include "platform/PlatformTypes.h" #include "app/common/Network/IPlatformNetwork.h" #include "platform/NetTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlatformNetworkManagerStub.h" #include "minecraft/network/platform/SessionInfo.h" @@ -29,7 +30,7 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; // network implementation (eg QNET), rather it should interface with an // implementation of PlatformNetworkManager to provide this functionality. -class CGameNetworkManager { +class CGameNetworkManager : public ::minecraft::network::INetworkService { friend class IPlatformNetworkStub; public: diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index f132c489f..035b855e3 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -19,7 +19,7 @@ #include "User.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -806,7 +806,7 @@ bool Minecraft::addLocalPlayer(int idx) { m_connectionFailed[idx] = false; m_pendingLocalConnections[idx] = nullptr; - bool success = g_NetworkManager.AddLocalPlayerByUserIndex(idx); + bool success = NetworkService.AddLocalPlayerByUserIndex(idx); if (success) { Log::info("Adding temp local player on pad %d\n", idx); @@ -827,7 +827,7 @@ bool Minecraft::addLocalPlayer(int idx) { ui.NavigateToScene(idx, eUIScene_ConnectingProgress, param); } else { - Log::info("g_NetworkManager.AddLocalPlayerByUserIndex failed\n"); + Log::info("NetworkService.AddLocalPlayerByUserIndex failed\n"); } return success; @@ -957,7 +957,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { ->removeClientConnection(mplp->connection, true); delete mplp->connection; mplp->connection = nullptr; - g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); + NetworkService.RemoveLocalPlayerByUserIndex(idx); } getLevel(localplayers[idx]->dimension)->removeEntity(localplayers[idx]); @@ -975,7 +975,7 @@ void Minecraft::removeLocalPlayerIdx(int idx) { ; delete m_pendingLocalConnections[idx]; m_pendingLocalConnections[idx] = nullptr; - g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); + NetworkService.RemoveLocalPlayerByUserIndex(idx); } else { // Not sure how this works on qnet, but for other platforms, calling // RemoveLocalPlayerByUserIndex won't do anything if there isn't a local @@ -1062,7 +1062,7 @@ void Minecraft::run_middle() { // } // 4J-PB - AUTOSAVE TIMER - if the player is the host - if (level != nullptr && g_NetworkManager.IsHost()) { + if (level != nullptr && NetworkService.IsHost()) { /*if(!bAutosaveTimerSet) { // set the timer @@ -1184,7 +1184,7 @@ void Minecraft::run_middle() { // list get the unique save name and xuid from // whoever is the host INetworkPlayer* pHostPlayer = - g_NetworkManager.GetHostPlayer(); + NetworkService.GetHostPlayer(); PlayerUID xuid = pHostPlayer->GetUID(); if (gameServices().isInBannedLevelList( @@ -1216,7 +1216,7 @@ void Minecraft::run_middle() { // quadrant display to remind them to press start (if the // session has space) if (level != nullptr && bFirstTimeIntoGame && - g_NetworkManager.SessionHasSpace()) { + NetworkService.SessionHasSpace()) { // have a short delay before the display if (iFirstTimeCountdown == 0) { bFirstTimeIntoGame = false; @@ -1390,7 +1390,7 @@ void Minecraft::run_middle() { bool tryJoin = !pause && !ui.IsIgnorePlayerJoinMenuDisplayed( PlatformInput.GetPrimaryPad()) && - g_NetworkManager.SessionHasSpace() && + NetworkService.SessionHasSpace() && PlatformRenderer.IsHiDef() && PlatformInput.ButtonPressed(i); if (tryJoin) { @@ -1408,7 +1408,7 @@ void Minecraft::run_middle() { if (PlatformProfile.IsSignedIn(i)) { // if this is a local game, then the // player just needs to be signed in - if (g_NetworkManager.IsLocalGame() || + if (NetworkService.IsLocalGame() || (PlatformProfile.IsSignedInLive( i) && PlatformProfile @@ -1425,7 +1425,7 @@ void Minecraft::run_middle() { "ui\n"); PlatformProfile.RequestSignInUI( false, - g_NetworkManager + NetworkService .IsLocalGame(), true, false, true, [this](bool b, int p) { @@ -1497,7 +1497,7 @@ void Minecraft::run_middle() { "ui\n"); PlatformProfile.RequestSignInUI( false, - g_NetworkManager + NetworkService .IsLocalGame(), true, false, true, [this](bool b, int p) { @@ -1513,7 +1513,7 @@ void Minecraft::run_middle() { "Bringing up the sign in ui\n"); PlatformProfile.RequestSignInUI( false, - g_NetworkManager.IsLocalGame(), + NetworkService.IsLocalGame(), true, false, true, [this](bool b, int p) { return InGame_SignInReturned( @@ -1739,7 +1739,7 @@ void Minecraft::run_middle() { Packet::renderAllPacketStats(); #else // To show the size of the QNet queue in bytes and messages - g_NetworkManager.renderQueueMeter(); + NetworkService.renderQueueMeter(); #endif } else { lastTimer = System::nanoTime(); @@ -1778,8 +1778,8 @@ void Minecraft::run_middle() { // pause = !isClientSide() && screen != nullptr && // screen->isPauseScreen(); #if defined(ENABLE_JAVA_GUIS) - pause = g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1 && + pause = NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1 && screen != nullptr && screen->isPauseScreen(); #else pause = gameServices().isAppPaused(); @@ -3980,12 +3980,12 @@ std::string Minecraft::gatherStats1() { } std::string Minecraft::gatherStats2() { - return g_NetworkManager.GatherStats(); + return NetworkService.GatherStats(); // return levelRenderer->gatherStats2(); } std::string Minecraft::gatherStats3() { - return g_NetworkManager.GatherRTTStats(); + return NetworkService.GatherRTTStats(); // return "P: " + particleEngine->countParticles() + ". T: " + // level->gatherStats(); } @@ -4465,7 +4465,7 @@ void Minecraft::playerLeftTutorial(int iPad) { int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { Minecraft* pMinecraftClass = (Minecraft*)pParam; - if (g_NetworkManager.IsInSession()) { + if (NetworkService.IsInSession()) { // 4J Stu - There seems to be a bug in the signin ui call that enables // guest sign in. We never allow this within game, so make sure that // it's disabled Fix for #66516 - TCR #124: MPS Guest Support ; #001: @@ -4477,19 +4477,19 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { // If sign in succeded, we're in game and this player isn't already playing, // continue - if (bContinue == true && g_NetworkManager.IsInSession() && + if (bContinue == true && NetworkService.IsInSession() && 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 (PlatformProfile.IsSignedIn(iPad)) { - if (!g_NetworkManager.SessionHasSpace()) { + if (!NetworkService.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE, IDS_MULTIPLAYER_FULL_TEXT, uiIDA, 1); } // if this is a local game then profiles just need to be signed in - else if (g_NetworkManager.IsLocalGame() || + else if (NetworkService.IsLocalGame() || (PlatformProfile.IsSignedInLive(iPad) && PlatformProfile.AllowedToPlayMultiplayer(iPad))) { if (pMinecraftClass->level->isClientSide) { diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index fc2299b3e..ca6167c84 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -13,6 +13,10 @@ #include "EditBox.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" +#include "minecraft/network/INetworkService.h" +// Needed for the &CGameNetworkManager::RunNetworkGameThreadProc address-of +// below. Static thread procs can't be virtual; this one consumer keeps the +// concrete type include. #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -286,10 +290,10 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; - g_NetworkManager.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, + NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, 0); - g_NetworkManager.FakeLocalPlayerJoined(); + NetworkService.FakeLocalPlayerJoined(); LoadingInputParams* loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 03abe500a..4966f2877 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -12,7 +12,7 @@ #include "Button.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "OptionsScreen.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" @@ -30,13 +30,13 @@ void PauseScreen::init() { buttons.clear(); int yo = -16; // 4jcraft: solves the issue of client-side only pausing in the java gui - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) + if (NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), eXuiServerAction_PauseServer, true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { buttons[0]->msg = I18n::get("menu.disconnect"); } @@ -67,7 +67,7 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { MinecraftServer* server = MinecraftServer::getInstance(); minecraft->setScreen(new MessageScreen("Leaving world")); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { server->setSaveOnExit(save); } gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 78cb896c0..42194c7fb 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -6,7 +6,7 @@ #include "Button.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "platform/stubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" @@ -40,8 +40,8 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { // minecraft->grabMouse(); // 4J - removed // 4jcraft: moved here from PauseScreen to ensure that serverside // unpausing is done in all scenarios - if (g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1) + if (NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), eXuiServerAction_PauseServer, false); } diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 73786ded9..c52899d53 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -22,7 +22,7 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" @@ -273,11 +273,11 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { PlatformProfile.GetXUID(m_userIndex, &OnlineXuid, true); // online xuid MOJANG_DATA* pMojangData = nullptr; - if (!g_NetworkManager.IsLocalGame()) { + if (!NetworkService.IsLocalGame()) { pMojangData = gameServices().getMojangDataForXuid(OnlineXuid); } - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCLoginReceived * 100) / (eCCConnected)); } @@ -295,7 +295,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { // find the pad number of this local player for (int i = 0; i < XUSER_MAX_COUNT; i++) { INetworkPlayer* networkLocalPlayer = - g_NetworkManager.GetLocalPlayerByUserIndex(i); + NetworkService.GetLocalPlayerByUserIndex(i); if (networkLocalPlayer == networkPlayer) { iUserID = i; } @@ -1091,7 +1091,7 @@ void ClientConnection::handleMovePlayer( packet->yView = player->y; connection->send(packet); if (!started) { - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCConnected * 100) / (eCCConnected)); } @@ -1274,7 +1274,7 @@ void ClientConnection::handleTileUpdate( MultiPlayerLevel* dimensionLevel = (MultiPlayerLevel*)minecraft->levels[packet->levelIdx]; if (dimensionLevel) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { // 4J Stu - Unshare before we make any changes incase the server is // already another step ahead of us Fix for #7904 - Gameplay: // Players can dupe torches by throwing them repeatedly into water. @@ -1357,7 +1357,7 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, // Fix for #13191 - The host of a game can get a message informing them that // the connection to the server has been lost In the (now unlikely) event // that the host connections times out, allow the player to save their game - if (g_NetworkManager.IsHost() && + if (NetworkService.IsHost() && (reason == DisconnectPacket::eDisconnect_TimeOut || reason == DisconnectPacket::eDisconnect_Overflow) && m_userIndex == PlatformInput.GetPrimaryPad() && @@ -1918,16 +1918,16 @@ void ClientConnection::handleEntityActionAtPosition( void ClientConnection::handlePreLogin(std::shared_ptr packet) { fprintf(stderr, "[LOGIN-CLI] handlePreLogin entered, isHost=%d, userIdx=%d\n", - (int)g_NetworkManager.IsHost(), m_userIndex); + (int)NetworkService.IsHost(), m_userIndex); // 4J - Check that we can play with all the players already in the game who // have Friends-Only UGC set bool canPlay = true; bool canPlayLocal = true; - bool isAtLeastOneFriend = g_NetworkManager.IsHost(); + bool isAtLeastOneFriend = NetworkService.IsHost(); bool isFriendsWithHost = true; bool cantPlayContentRestricted = false; - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { // set the game host settings gameServices().setGameHostOption(eGameHostOption_All, packet->m_serverSettings); @@ -2031,7 +2031,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { } } - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCPreLoginReceived * 100) / (eCCConnected)); } @@ -2060,7 +2060,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "isHost=%d\n", minecraft->user->name.c_str(), SharedConstants::NETWORK_PROTOCOL_VERSION, m_userIndex, - (int)g_NetworkManager.IsHost()); + (int)NetworkService.IsHost()); send(std::make_shared( minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), @@ -2069,7 +2069,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { PlatformProfile.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { Minecraft::GetInstance()->progressRenderer->progressStagePercentage( (eCCLoginSent * 100) / (eCCConnected)); } @@ -3014,7 +3014,7 @@ void ClientConnection::handleGameEvent( ui.NavigateToScene(PlatformInput.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen); } else if (event == GameEventPacket::START_SAVING) { - if (!g_NetworkManager.IsHost()) { + if (!NetworkService.IsHost()) { // Move app started to here so that it happens immediately otherwise // back-to-back START/STOP packets leave the client stuck in the // loading screen @@ -3023,7 +3023,7 @@ void ClientConnection::handleGameEvent( eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { - if (!g_NetworkManager.IsHost()) gameServices().setGameStarted(true); + if (!NetworkService.IsHost()) gameServices().setGameStarted(true); } else if (event == GameEventPacket::SUCCESSFUL_BOW_HIT) { std::shared_ptr player = minecraft->localplayers[m_userIndex]; @@ -3109,7 +3109,7 @@ void ClientConnection::handlePlayerInfo( gameServices().getPlayerPrivileges(packet->m_networkSmallId); INetworkPlayer* networkPlayer = - g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); + NetworkService.GetPlayerBySmallId(packet->m_networkSmallId); if (networkPlayer != nullptr && networkPlayer->IsHost()) { // Some settings should always be considered on for the host player @@ -3393,7 +3393,7 @@ void ClientConnection::handleXZ(std::shared_ptr packet) { void ClientConnection::handleUpdateProgress( std::shared_ptr packet) { - if (!g_NetworkManager.IsHost()) + if (!NetworkService.IsHost()) Minecraft::GetInstance()->progressRenderer->progressStagePercentage( packet->m_percentage); } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 980cb0192..438d2e932 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" #include "minecraft/server/MinecraftServer.h" @@ -167,7 +167,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { std::unique_lock lock(m_csLoadCreate); // LevelChunk *chunk; - if (g_NetworkManager + if (NetworkService .IsHost()) // force here to disable sharing of data { // 4J-JEV: We are about to use shared data, abort if the server @@ -223,7 +223,7 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { // If we're sharing with the server, we'll need to calculate our // heightmap now, which isn't shared. If we aren't sharing with the // server, then this will be calculated when the chunk data arrives. - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { chunk->recalcHeightmapOnly(); } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 771015f2f..09b208298 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -15,7 +15,7 @@ #include "ClientConnection.h" #include "app/common/Audio/SoundEngine.h" #include "minecraft/Console_Debug_enum.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" #include "java/JavaMath.h" @@ -104,13 +104,13 @@ MultiPlayerLevel::~MultiPlayerLevel() { } void MultiPlayerLevel::unshareChunkAt(int x, int z) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { Level::getChunkAt(x, z)->stopSharingTilesAndData(); } } void MultiPlayerLevel::shareChunkAt(int x, int z) { - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { Level::getChunkAt(x, z)->startSharingTilesAndData(); } } @@ -193,12 +193,12 @@ void MultiPlayerLevel::tick() { // chunks become unshared over time. int ls = dimension->getXZSize(); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { if (Level::reallyHasChunk(unshareCheckX - (ls / 2), unshareCheckZ - (ls / 2))) { LevelChunk* lc = Level::getChunk(unshareCheckX - (ls / 2), unshareCheckZ - (ls / 2)); - if (g_NetworkManager.IsHost()) { + if (NetworkService.IsHost()) { lc->startSharingTilesAndData(1000 * 60 * 2); } } @@ -611,8 +611,8 @@ bool MultiPlayerLevel::doSetTileAndData(int x, int y, int z, int tile, // don't change things as the host might have been sharing data and so set // it already, but the renderer won't know to update if ((Level::setTileAndData(x, y, z, tile, data, Tile::UPDATE_ALL) || - g_NetworkManager.IsHost())) { - if (g_NetworkManager.IsHost() && visuallyImportant) { + NetworkService.IsHost())) { + if (NetworkService.IsHost() && visuallyImportant) { // 4J Stu - This got removed from the tileUpdated function in TU14. // Adding it back here as we need it to handle the cases where the // chunk data is shared so the normal paths never call this diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 7af1bd050..0647aaf4f 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -70,7 +70,7 @@ void MultiplayerLocalPlayer::heal(float heal) {} void MultiplayerLocalPlayer::tick() { // 4J Added // 4J-PB - changing this to a game host option ot hide gamertags - // bool bIsisPrimaryHost=g_NetworkManager.IsHost() && + // bool bIsisPrimaryHost=NetworkService.IsHost() && // (PlatformInput.GetPrimaryPad()==m_iPad); /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index a25fed902..bbb55f5ee 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -33,7 +33,7 @@ #include "platform/renderer/renderer.h" #include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -490,9 +490,9 @@ void LocalPlayer::aiStep() { } else if (m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { // Are we offline or online, and how many players are there - if (g_NetworkManager.GetPlayerCount() > 1) { + if (NetworkService.GetPlayerCount() > 1) { // only do it for this player here - each player will run this code - if (g_NetworkManager.IsLocalGame()) { + if (NetworkService.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { @@ -500,7 +500,7 @@ void LocalPlayer::aiStep() { m_iPad, CONTEXT_PRESENCE_MULTIPLAYER, false); } } else { - if (g_NetworkManager.IsLocalGame()) { + if (NetworkService.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( m_iPad, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, false); } else { @@ -848,8 +848,8 @@ void LocalPlayer::awardStat(Stat* stat, const std::vector& param) { // 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 && + if (NetworkService.IsLocalGame() && + NetworkService.GetPlayerCount() == 1 && PlatformProfile.GetAwardType(ach->getAchievementID()) != EAwardType::Achievement) { ui.CloseUIScenes(m_iPad); diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 6e40ba86b..beffdcb91 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -7,7 +7,7 @@ #include #include "platform/ShutdownManager.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "util/StringHelpers.h" @@ -471,8 +471,8 @@ void Connection::tick() { std::vector > packetsToHandle; { std::lock_guard lock(incoming_cs); - while (!disconnected && !g_NetworkManager.IsLeavingGame() && - g_NetworkManager.IsInSession() && !incoming.empty() && + while (!disconnected && !NetworkService.IsLeavingGame() && + NetworkService.IsInSession() && !incoming.empty() && max-- >= 0) { std::shared_ptr packet = incoming.front(); packetsToHandle.push_back(packet); diff --git a/targets/minecraft/network/INetworkService.h b/targets/minecraft/network/INetworkService.h new file mode 100644 index 000000000..916f31172 --- /dev/null +++ b/targets/minecraft/network/INetworkService.h @@ -0,0 +1,73 @@ +#pragma once + +#include +#include + +#include "platform/PlatformTypes.h" + +// Minimal interface that minecraft/ code uses to talk to the network +// subsystem. The concrete implementation lives in app/common/Network/ +// (CGameNetworkManager). Same shape as IGameServices: minecraft/ code +// calls the interface; the implementation can sit in a higher layer +// without minecraft/ needing to include its header. +// +// Method names match the existing CGameNetworkManager surface so the +// concrete class can implement the interface without rename churn. + +class INetworkPlayer; + +namespace minecraft::network { + +class INetworkService { +public: + virtual ~INetworkService() = default; + + // Player management + [[nodiscard]] virtual int GetPlayerCount() = 0; + virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0; + virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex( + int userIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId( + unsigned char smallId) = 0; + [[nodiscard]] virtual INetworkPlayer* GetHostPlayer() = 0; + + // Hosting / state + [[nodiscard]] virtual bool IsHost() = 0; + [[nodiscard]] virtual bool IsInSession() = 0; + [[nodiscard]] virtual bool IsLeavingGame() = 0; + [[nodiscard]] virtual bool IsLocalGame() = 0; + [[nodiscard]] virtual bool SessionHasSpace( + unsigned int spaceRequired = 1) = 0; + virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots, + unsigned char privateSlots) = 0; + virtual void FakeLocalPlayerJoined() = 0; + virtual void UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0; + + // System flags + virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; + [[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) = 0; + + // Server lifecycle events + virtual void ServerReady() = 0; + virtual void ServerStopped() = 0; + + // Stats / debug + [[nodiscard]] virtual std::string GatherStats() = 0; + [[nodiscard]] virtual std::string GatherRTTStats() = 0; + virtual void renderQueueMeter() = 0; +}; + +namespace platform_internal { +INetworkService& NetworkService_get(); +} + +} // namespace minecraft::network + +#define NetworkService \ + (::minecraft::network::platform_internal:: \ + NetworkService_get()) diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 873bb2477..68cb66bf9 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -20,7 +20,7 @@ #include "minecraft/GameEnums.h" #include "app/common/GameRules/GameRuleManager.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerList.h" #include "Settings.h" @@ -261,7 +261,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, initData->saveData->fileSize = 0; } - g_NetworkManager.ServerReady(); // 4J added + NetworkService.ServerReady(); // 4J added return m_bLoaded; } @@ -446,7 +446,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // McRegionLevelStorage *storage = new McRegionLevelStorage(File("."), // name, true); // TODO for (unsigned int i = 0; i < levels.size(); i++) { - if (s_bServerHalted || !g_NetworkManager.IsInSession()) { + if (s_bServerHalted || !NetworkService.IsInSession()) { return false; } @@ -516,7 +516,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, gameServices().setGameHostOption(eGameHostOption_Structures, levels[0]->isGenerateMapFeatures()); - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; // 4J - Make a new thread to do post processing @@ -590,7 +590,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int total = twoRPlusOne * twoRPlusOne; for (int x = -r; x <= r && running; x += 16) { for (int z = -r; z <= r && running; z += 16) { - if (s_bServerHalted || !g_NetworkManager.IsInSession()) { + if (s_bServerHalted || !NetworkService.IsInSession()) { delete spawnPos; m_postUpdateTerminate = true; postProcessTerminate(mcprogress); @@ -678,19 +678,19 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // printf("Lighting complete at %dms\n",System::currentTimeMillis() - // startTime); - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[1]->isNew) { levels[1]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[2]->isNew) { levels[2]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; // 4J - added - immediately save newly created level, like single player // game 4J Stu - We also want to immediately save the tutorial @@ -700,13 +700,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, levels[0]->save(true, mcprogress); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; if (levels[0]->isNew || levels[1]->isNew || levels[2]->isNew) { levels[0]->saveToDisc(mcprogress, false); } - if (s_bServerHalted || !g_NetworkManager.IsInSession()) return false; + if (s_bServerHalted || !NetworkService.IsInSession()) return false; /* * int r = 24; for (int x = -r; x <= r; x++) { @@ -960,7 +960,7 @@ void MinecraftServer::stopServer(bool didInit) { delete settings; settings = nullptr; - g_NetworkManager.ServerStopped(); + NetworkService.ServerStopped(); } void MinecraftServer::halt() { running = false; } @@ -1692,13 +1692,13 @@ void MinecraftServer::chunkPacketManagement_PostTick() { } void MinecraftServer::cycleSlowQueueIndex() { - if (!g_NetworkManager.IsInSession()) return; + if (!NetworkService.IsInSession()) return; int startingIndex = s_slowQueuePlayerIndex; INetworkPlayer* currentPlayer = nullptr; int currentPlayerCount = 0; do { - currentPlayerCount = g_NetworkManager.GetPlayerCount(); + currentPlayerCount = NetworkService.GetPlayerCount(); if (startingIndex >= currentPlayerCount) startingIndex = 0; ++s_slowQueuePlayerIndex; @@ -1709,11 +1709,11 @@ void MinecraftServer::cycleSlowQueueIndex() { // join. The QNet session might be ending while we do this, so do a // few more checks that the player is real currentPlayer = - g_NetworkManager.GetPlayerByIndex(s_slowQueuePlayerIndex); + NetworkService.GetPlayerByIndex(s_slowQueuePlayerIndex); } else { s_slowQueuePlayerIndex = 0; } - } while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 && + } while (NetworkService.IsInSession() && currentPlayerCount > 0 && s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr && currentPlayer->IsLocal()); // Log::info("Cycled slow queue index to %d\n", diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index cc4868261..3e0718f14 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -15,7 +15,7 @@ #include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" @@ -915,7 +915,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, player->gameMode->setLevel(newLevel); // Resend the teleport if we haven't yet sent the chunk they will land on - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), ServerPlayer::getFlagIndexForChunk( ChunkPos(player->xChunk, player->zChunk), @@ -1069,7 +1069,7 @@ void PlayerList::tick() { std::uint8_t smallId = m_smallIdsToKick.front(); m_smallIdsToKick.pop_front(); INetworkPlayer* selectedPlayer = - g_NetworkManager.GetPlayerBySmallId(smallId); + NetworkService.GetPlayerBySmallId(smallId); if (selectedPlayer != nullptr) { if (selectedPlayer->IsLocal() != true) { // #if 0 diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index 971574bd8..2505f2251 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -10,7 +10,7 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerChunkCache.h" #include "ServerLevel.h" @@ -264,7 +264,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); if (player->seenChunks.find(pos) != player->seenChunks.end() && (player->connection->isLocal() || - g_NetworkManager.SystemFlagGet( + NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), flagIndex))) { player->connection->send(packet); sentTo.push_back(player); @@ -298,7 +298,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(std::shared_ptr packet) { // (this flag will be the same for all players on the same system) int flagIndex = ServerPlayer::getFlagIndexForChunk(pos, parent->dimension); - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( player->connection->getNetworkPlayer(), flagIndex)) continue; diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 1281b502c..8bd0d39e5 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -14,7 +14,7 @@ #include "EntityTracker.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" @@ -442,7 +442,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // connection->getNetworkPlayer()->GetSmallId(), // canSendToPlayer, // connection->countDelayedPackets(), - // g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( + // NetworkService.GetHostPlayer()->GetSendQueueSizeMessages( // nullptr, true ), // connection->done); // } @@ -450,7 +450,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { if (dontDelayChunks || (canSendToPlayer && (connection->countDelayedPackets() < 4) && - (g_NetworkManager.GetHostPlayer() + (NetworkService.GetHostPlayer() ->GetSendQueueSizeMessages(nullptr, true) < 4) && //(tickCount - lastBrupSendTickCount) > //(connection->getNetworkPlayer()->GetCurrentRtt()>>4) && @@ -504,7 +504,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // ever request that chunks be unloaded on the client // and so just gradually build up more and more of the // finite set of chunks as the player moves - if (!g_NetworkManager.SystemFlagGet( + if (!NetworkService.SystemFlagGet( connection->getNetworkPlayer(), flagIndex)) { // Log::info("Creating // BRUP for %d %d\n",nearest.x, nearest.z); @@ -530,7 +530,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { } // Set flag to say we have send this block already to // this system - g_NetworkManager.SystemFlagSet( + NetworkService.SystemFlagSet( connection->getNetworkPlayer(), flagIndex); chunkDataSent = true; diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 185ad999b..b016c42fd 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -15,7 +15,7 @@ #include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "minecraft/client/model/SkinBox.h" @@ -1098,7 +1098,7 @@ void PlayerConnection::handleServerSettingsChanged( gameServices().getGameHostOption(eGameHostOption_All)))); // Update the QoS data - g_NetworkManager.UpdateAndSetGameSessionData(); + NetworkService.UpdateAndSetGameSessionData(); } } } diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 88f11375b..17b0a37f4 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -20,7 +20,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Console_Debug_enum.h" -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "util/FrameProfiler.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -3830,7 +3830,7 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, // This is quite expensive so only actually do it if we are hosting, // online, and the update will actually change something bool forceUnshare = false; - if (g_NetworkManager.IsHost() && isClientSide) { + if (NetworkService.IsHost() && isClientSide) { forceUnshare = lc->testSetBlocksAndData(data, x0, y0, z0, x1, y1, z1, p); } @@ -3844,7 +3844,7 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, setTilesDirty(xc * 16 + x0, y0, zc * 16 + z0, xc * 16 + x1, y1, zc * 16 + z1); - if (g_NetworkManager.IsHost() && isClientSide) { + if (NetworkService.IsHost() && isClientSide) { lc->startSharingTilesAndData(); } } diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index e7de983fa..14556ef88 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -9,7 +9,7 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/INetworkService.h" #include "SparseLightStorage.h" #include "java/Class.h" #include "java/Random.h" @@ -1832,7 +1832,7 @@ int LevelChunk::setBlocksAndData(std::vector& data, int x0, int y0, // server updated them. This will leave the lighting information out of // sync on the client, so resync for this & surrounding chunks that // might have been affected - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { reSyncLighting(); level->getChunk(x - 1, z - 1)->reSyncLighting(); level->getChunk(x - 0, z - 1)->reSyncLighting(); @@ -2154,7 +2154,7 @@ void LevelChunk::compressBlocks() { // compress the local client copy of the data if the data is unshared, since // we'll be throwing this data away again anyway once we share with the // server again. - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { // Note - only the extraction of the pointers needs to be done in the // lock, since even if the data is unshared whilst we are // processing this data is still valid (for the server) @@ -2254,7 +2254,7 @@ void LevelChunk::compressData() { // compress the local client copy of the data if the data is unshared, since // we'll be throwing this data away again anyway once we share with the // server again. - if (level->isClientSide && g_NetworkManager.IsHost()) { + if (level->isClientSide && NetworkService.IsHost()) { // Note - only the extraction of the pointers needs to be done in the // lock, since even if the data is unshared whilst we are // processing this data is still valid (for the server) diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index e25505c30..d02363f13 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -108,7 +108,7 @@ void SignTileEntity::setChanged() { // 4J-PB - For TU14 we are allowed to not verify strings anymore ! m_bVerified = true; /* - if(!g_NetworkManager.IsLocalGame() && !m_bVerified) + if(!NetworkService.IsLocalGame() && !m_bVerified) //if (pMinecraft->level->isClientSide) { char *wcMessages[MAX_SIGN_LINES]; From 0ef3b2de31d22e3d837105bf1adc1ee23603cb8b Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 23:11:39 +1000 Subject: [PATCH 027/104] refactor: pull DLC enums out into their own header --- targets/app/common/DLC/DLCManager.h | 74 ++++++++++--------- targets/minecraft/client/Minecraft.cpp | 2 +- .../server/network/PlayerConnection.cpp | 2 +- .../minecraft/world/entity/player/Player.cpp | 2 +- .../minecraft/world/level/dlc/DLCConstants.h | 47 ++++++++++++ 5 files changed, 88 insertions(+), 39 deletions(-) create mode 100644 targets/minecraft/world/level/dlc/DLCConstants.h diff --git a/targets/app/common/DLC/DLCManager.h b/targets/app/common/DLC/DLCManager.h index 41c534a5e..0adc2a57d 100644 --- a/targets/app/common/DLC/DLCManager.h +++ b/targets/app/common/DLC/DLCManager.h @@ -3,50 +3,52 @@ #include #include #include + +#include "minecraft/world/level/dlc/DLCConstants.h" + class DLCPack; class DLCSkinFile; class DLCManager { public: - enum EDLCType { - e_DLCType_Skin = 0, - e_DLCType_Cape, - e_DLCType_Texture, - e_DLCType_UIData, - e_DLCType_PackConfig, - e_DLCType_TexturePack, - e_DLCType_LocalisationData, - e_DLCType_GameRules, - e_DLCType_Audio, - e_DLCType_ColourTable, - e_DLCType_GameRulesHeader, + // Re-export the file-scope enums as nested type aliases so existing + // app-side call sites that use DLCManager::EDLCType / + // DLCManager::e_DLCType_Texture continue to compile. minecraft/-side + // call sites should use the namespaced names from DLCConstants.h + // directly. + using EDLCType = ::minecraft::dlc::EDLCType; + using EDLCParameterType = ::minecraft::dlc::EDLCParameterType; - e_DLCType_Max, - e_DLCType_All, - }; + static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin; + static constexpr EDLCType e_DLCType_Cape = ::minecraft::dlc::e_DLCType_Cape; + static constexpr EDLCType e_DLCType_Texture = ::minecraft::dlc::e_DLCType_Texture; + static constexpr EDLCType e_DLCType_UIData = ::minecraft::dlc::e_DLCType_UIData; + static constexpr EDLCType e_DLCType_PackConfig = ::minecraft::dlc::e_DLCType_PackConfig; + static constexpr EDLCType e_DLCType_TexturePack = ::minecraft::dlc::e_DLCType_TexturePack; + static constexpr EDLCType e_DLCType_LocalisationData = ::minecraft::dlc::e_DLCType_LocalisationData; + static constexpr EDLCType e_DLCType_GameRules = ::minecraft::dlc::e_DLCType_GameRules; + static constexpr EDLCType e_DLCType_Audio = ::minecraft::dlc::e_DLCType_Audio; + static constexpr EDLCType e_DLCType_ColourTable = ::minecraft::dlc::e_DLCType_ColourTable; + static constexpr EDLCType e_DLCType_GameRulesHeader = ::minecraft::dlc::e_DLCType_GameRulesHeader; + static constexpr EDLCType e_DLCType_Max = ::minecraft::dlc::e_DLCType_Max; + static constexpr EDLCType e_DLCType_All = ::minecraft::dlc::e_DLCType_All; - // If you add to the Enum,then you need to add the array of type names - // These are the names used in the XML for the parameters - enum EDLCParameterType { - e_DLCParamType_Invalid = -1, + static constexpr EDLCParameterType e_DLCParamType_Invalid = ::minecraft::dlc::e_DLCParamType_Invalid; + static constexpr EDLCParameterType e_DLCParamType_DisplayName = ::minecraft::dlc::e_DLCParamType_DisplayName; + static constexpr EDLCParameterType e_DLCParamType_ThemeName = ::minecraft::dlc::e_DLCParamType_ThemeName; + static constexpr EDLCParameterType e_DLCParamType_Free = ::minecraft::dlc::e_DLCParamType_Free; + static constexpr EDLCParameterType e_DLCParamType_Credit = ::minecraft::dlc::e_DLCParamType_Credit; + static constexpr EDLCParameterType e_DLCParamType_Cape = ::minecraft::dlc::e_DLCParamType_Cape; + static constexpr EDLCParameterType e_DLCParamType_Box = ::minecraft::dlc::e_DLCParamType_Box; + static constexpr EDLCParameterType e_DLCParamType_Anim = ::minecraft::dlc::e_DLCParamType_Anim; + static constexpr EDLCParameterType e_DLCParamType_PackId = ::minecraft::dlc::e_DLCParamType_PackId; + static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour = ::minecraft::dlc::e_DLCParamType_NetherParticleColour; + static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextColour; + static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextFocusColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour; + static constexpr EDLCParameterType e_DLCParamType_DataPath = ::minecraft::dlc::e_DLCParamType_DataPath; + static constexpr EDLCParameterType e_DLCParamType_PackVersion = ::minecraft::dlc::e_DLCParamType_PackVersion; + static constexpr EDLCParameterType e_DLCParamType_Max = ::minecraft::dlc::e_DLCParamType_Max; - e_DLCParamType_DisplayName = 0, - e_DLCParamType_ThemeName, - e_DLCParamType_Free, // identify free skins - e_DLCParamType_Credit, // legal credits for DLC - e_DLCParamType_Cape, - e_DLCParamType_Box, - e_DLCParamType_Anim, - e_DLCParamType_PackId, - e_DLCParamType_NetherParticleColour, - e_DLCParamType_EnchantmentTextColour, - e_DLCParamType_EnchantmentTextFocusColour, - e_DLCParamType_DataPath, - e_DLCParamType_PackVersion, - - e_DLCParamType_Max, - - }; const static char* wchTypeNamesA[e_DLCParamType_Max]; private: diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 035b855e3..e16d15b87 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -18,7 +18,7 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/DLC/DLCManager.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index b016c42fd..3b2ca8a31 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -13,7 +13,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/Console_Debug_enum.h" -#include "app/common/DLC/DLCManager.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "app/common/DLC/DLCSkinFile.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 464a2cab6..1baeb7927 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -25,7 +25,7 @@ #include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "minecraft/Minecraft_Macros.h" -#include "app/common/DLC/DLCManager.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "app/common/DLC/DLCSkinFile.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/world/level/dlc/DLCConstants.h b/targets/minecraft/world/level/dlc/DLCConstants.h new file mode 100644 index 000000000..fdf8a5f56 --- /dev/null +++ b/targets/minecraft/world/level/dlc/DLCConstants.h @@ -0,0 +1,47 @@ +#pragma once + +// DLC type and parameter enums extracted from app/common/DLC/DLCManager +// so minecraft/ consumers can reference them without including the app +// header. DLCManager re-exports these as nested aliases for backward +// compatibility with app-side call sites. + +namespace minecraft::dlc { + +enum EDLCType { + e_DLCType_Skin = 0, + e_DLCType_Cape, + e_DLCType_Texture, + e_DLCType_UIData, + e_DLCType_PackConfig, + e_DLCType_TexturePack, + e_DLCType_LocalisationData, + e_DLCType_GameRules, + e_DLCType_Audio, + e_DLCType_ColourTable, + e_DLCType_GameRulesHeader, + + e_DLCType_Max, + e_DLCType_All, +}; + +enum EDLCParameterType { + e_DLCParamType_Invalid = -1, + + e_DLCParamType_DisplayName = 0, + e_DLCParamType_ThemeName, + e_DLCParamType_Free, // identify free skins + e_DLCParamType_Credit, // legal credits for DLC + e_DLCParamType_Cape, + e_DLCParamType_Box, + e_DLCParamType_Anim, + e_DLCParamType_PackId, + e_DLCParamType_NetherParticleColour, + e_DLCParamType_EnchantmentTextColour, + e_DLCParamType_EnchantmentTextFocusColour, + e_DLCParamType_DataPath, + e_DLCParamType_PackVersion, + + e_DLCParamType_Max, +}; + +} // namespace minecraft::dlc From 1b9d27f4a0d7f17bb8a3b9b0b9c92fecc2699ca8 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Wed, 8 Apr 2026 23:17:21 +1000 Subject: [PATCH 028/104] refactor: hide miniaudio behind PIMPL in SoundEngine --- targets/app/common/Audio/SoundEngine.cpp | 83 ++++++++++++++---------- targets/app/common/Audio/SoundEngine.h | 26 +++++--- 2 files changed, 66 insertions(+), 43 deletions(-) diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index ea647e328..543d15ee6 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -117,13 +117,28 @@ char SoundEngine::m_szRedistName[] = {"redist64"}; // Linux specific functions #if defined(__linux__) -SoundEngine::SoundEngine() {} + +// PIMPL'd state for the miniaudio backend. Defined here so SoundEngine.h +// stays free of miniaudio.h. +struct SoundEngineMiniAudio { + ma_engine engine{}; + ma_engine_config engineConfig{}; + ma_sound musicStream{}; +}; + +struct MiniAudioSound { + ma_sound sound; + AUDIO_INFO info; + bool active; +}; + +SoundEngine::SoundEngine() : m_audio(std::make_unique()) {} +SoundEngine::~SoundEngine() = default; std::vector m_activeSounds; void SoundEngine::init(Options* pOptions) { app.DebugPrintf("---SoundEngine::init\n"); random = new Random(); - memset(&m_engine, 0, sizeof(ma_engine)); - memset(&m_engineConfig, 0, sizeof(ma_engine_config)); + *m_audio = SoundEngineMiniAudio{}; m_musicStreamActive = false; m_StreamState = eMusicStreamState_Idle; m_iMusicDelay = 0; @@ -149,15 +164,15 @@ void SoundEngine::init(Options* pOptions) { sizeof(int) * (static_cast(eSoundType_MAX) + static_cast(eSFX_MAX))); memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT); - m_engineConfig = ma_engine_config_init(); - m_engineConfig.listenerCount = MAX_LOCAL_PLAYERS; + m_audio->engineConfig = ma_engine_config_init(); + m_audio->engineConfig.listenerCount = MAX_LOCAL_PLAYERS; - if (ma_engine_init(&m_engineConfig, &m_engine) != MA_SUCCESS) { + if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != MA_SUCCESS) { app.DebugPrintf("Failed to initialize miniaudio engine\n"); return; } - ma_engine_set_volume(&m_engine, 1.0f); + ma_engine_set_volume(&m_audio->engine, 1.0f); m_MasterMusicVolume = 1.0f; m_MasterEffectsVolume = 1.0f; @@ -166,7 +181,7 @@ void SoundEngine::init(Options* pOptions) { m_bSystemMusicPlaying = false; } -void SoundEngine::destroy() { ma_engine_uninit(&m_engine); } +void SoundEngine::destroy() { ma_engine_uninit(&m_audio->engine); } void SoundEngine::play(int iSound, float x, float y, float z, float volume, float pitch) { @@ -222,7 +237,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, s->info.pitch = pitch; s->info.bIs3D = true; - if (ma_sound_init_from_file(&m_engine, finalPath, MA_SOUND_FLAG_ASYNC, + if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, nullptr, nullptr, &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_TRUE); ma_sound_set_min_distance(&s->sound, 2.0f); @@ -274,7 +289,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { s->info.pitch = pitch; s->info.bIs3D = false; - if (ma_sound_init_from_file(&m_engine, finalPath, MA_SOUND_FLAG_ASYNC, + if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, nullptr, nullptr, &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_FALSE); ma_sound_set_volume(&s->sound, volume * m_MasterEffectsVolume); @@ -410,14 +425,14 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { const char* ext = strrchr(soundEngine->m_szStreamName, '.'); if (soundEngine->m_musicStreamActive) { - ma_sound_stop(&soundEngine->m_musicStream); - ma_sound_uninit(&soundEngine->m_musicStream); + ma_sound_stop(&soundEngine->m_audio->musicStream); + ma_sound_uninit(&soundEngine->m_audio->musicStream); soundEngine->m_musicStreamActive = false; } ma_result result = ma_sound_init_from_file( - &soundEngine->m_engine, soundEngine->m_szStreamName, - MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEngine->m_musicStream); + &soundEngine->m_audio->engine, soundEngine->m_szStreamName, + MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEngine->m_audio->musicStream); if (result != MA_SUCCESS) { app.DebugPrintf( @@ -427,8 +442,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { return 0; } - ma_sound_set_spatialization_enabled(&soundEngine->m_musicStream, MA_FALSE); - ma_sound_set_looping(&soundEngine->m_musicStream, MA_FALSE); + ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, MA_FALSE); + ma_sound_set_looping(&soundEngine->m_audio->musicStream, MA_FALSE); soundEngine->m_musicStreamActive = true; @@ -503,19 +518,19 @@ void SoundEngine::playMusicTick() { } ma_sound_set_spatialization_enabled( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.bIs3D ? MA_TRUE : MA_FALSE); if (m_StreamingAudioInfo.bIs3D) { ma_sound_set_position( - &m_musicStream, m_StreamingAudioInfo.x, + &m_audio->musicStream, m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, m_StreamingAudioInfo.z); } - ma_sound_set_pitch(&m_musicStream, m_StreamingAudioInfo.pitch); + ma_sound_set_pitch(&m_audio->musicStream, m_StreamingAudioInfo.pitch); ma_sound_set_volume( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.volume * getMasterMusicVolume()); - ma_sound_start(&m_musicStream); + ma_sound_start(&m_audio->musicStream); m_StreamState = eMusicStreamState_Playing; } @@ -531,8 +546,8 @@ void SoundEngine::playMusicTick() { case eMusicStreamState_Stop: if (m_musicStreamActive) { - ma_sound_stop(&m_musicStream); - ma_sound_uninit(&m_musicStream); + ma_sound_stop(&m_audio->musicStream); + ma_sound_uninit(&m_audio->musicStream); m_musicStreamActive = false; } SetIsPlayingStreamingCDMusic(false); @@ -591,7 +606,7 @@ void SoundEngine::playMusicTick() { // volume change required? if (m_musicStreamActive) ma_sound_set_volume( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.volume * fMusicVol); } else if (m_StreamingAudioInfo.bIs3D && m_validListenerCount > 1 && @@ -616,7 +631,7 @@ void SoundEngine::playMusicTick() { } } ma_sound_set_position( - &m_musicStream, + &m_audio->musicStream, m_StreamingAudioInfo.x - m_ListenerA[iClosest].vPosition.x, m_StreamingAudioInfo.y - m_ListenerA[iClosest].vPosition.y, m_StreamingAudioInfo.z - m_ListenerA[iClosest].vPosition.z); @@ -645,9 +660,9 @@ void SoundEngine::playMusicTick() { // check the status of the stream - this is for when a track completes // rather than is stopped by the user action - if (m_musicStreamActive && !ma_sound_is_playing(&m_musicStream) && - ma_sound_at_end(&m_musicStream)) { - ma_sound_uninit(&m_musicStream); + if (m_musicStreamActive && !ma_sound_is_playing(&m_audio->musicStream) && + ma_sound_at_end(&m_audio->musicStream)) { + ma_sound_uninit(&m_audio->musicStream); m_musicStreamActive = false; SetIsPlayingStreamingCDMusic(false); SetIsPlayingStreamingGameMusic(false); @@ -660,23 +675,23 @@ void SoundEngine::updateMiniAudio() { for (size_t i = 0; i < MAX_LOCAL_PLAYERS; i++) { if (m_ListenerA[i].bValid) { ma_engine_listener_set_position( - &m_engine, 0, m_ListenerA[i].vPosition.x, + &m_audio->engine, 0, m_ListenerA[i].vPosition.x, m_ListenerA[i].vPosition.y, m_ListenerA[i].vPosition.z); - ma_engine_listener_set_direction(&m_engine, 0, + ma_engine_listener_set_direction(&m_audio->engine, 0, m_ListenerA[i].vOrientFront.x, m_ListenerA[i].vOrientFront.y, m_ListenerA[i].vOrientFront.z); - ma_engine_listener_set_world_up(&m_engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, 0.0f); break; } } } else { - ma_engine_listener_set_position(&m_engine, 0, 0.0f, 0.0f, 0.0f); - ma_engine_listener_set_direction(&m_engine, 0, 0.0f, 0.0f, 1.0f); - ma_engine_listener_set_world_up(&m_engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_position(&m_audio->engine, 0, 0.0f, 0.0f, 0.0f); + ma_engine_listener_set_direction(&m_audio->engine, 0, 0.0f, 0.0f, 1.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, 0.0f); } for (auto it = m_activeSounds.begin(); it != m_activeSounds.end();) { diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index d6b49b4af..d769d859e 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -4,13 +4,19 @@ class Options; class C4JThread; class Random; +#include #include #include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" -#include "miniaudio.h" + +// Forward-declare the miniaudio backing state. The full struct lives in +// SoundEngine.cpp where miniaudio.h is actually included. This keeps +// miniaudio.h out of the 9 minecraft files that include SoundEngine.h +// via the 4j include chain. +struct SoundEngineMiniAudio; constexpr float SFX_3D_MIN_DISTANCE = 1.0f; constexpr float SFX_3D_MAX_DISTANCE = 16.0f; @@ -90,15 +96,15 @@ typedef struct { char chName[64]; #endif } AUDIO_INFO; -struct MiniAudioSound { - ma_sound sound; - AUDIO_INFO info; - bool active; -}; + +// MiniAudioSound's definition lives in SoundEngine.cpp alongside the +// miniaudio backend; consumers of this header don't need to see it. + class SoundEngine : public ConsoleSoundEngine { static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added public: SoundEngine(); + ~SoundEngine(); virtual void destroy(); #if defined(_DEBUG) void GetSoundName(char* szSoundName, int iSound); @@ -142,9 +148,11 @@ private: int GetRandomishTrack(int iStart, int iEnd); - ma_engine m_engine; - ma_engine_config m_engineConfig; - ma_sound m_musicStream; + // Miniaudio engine + music stream PIMPL'd into SoundEngineMiniAudio, + // defined in SoundEngine.cpp. Owned via unique_ptr; the destructor + // is out-of-line so the unique_ptr instantiation can see the full + // type. + std::unique_ptr m_audio; bool m_musicStreamActive; static char m_szSoundPath[]; From aa515c5f3dee56c16037b639e73b18fd9dd4b72c Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 00:29:33 +1000 Subject: [PATCH 029/104] refactor: replace winapi_stubs with std::vector, std::atomic_ref and std::chrono --- targets/app/common/DLC/DLCPack.cpp | 1 - targets/app/common/DLCController.cpp | 5 +- targets/app/common/Game.cpp | 1 - .../LevelGeneration/ConsoleSchematicFile.cpp | 1 - .../LevelGeneration/ConsoleSchematicFile.h | 1 - .../LevelGenerationOptions.cpp | 5 +- .../GameRules/LevelRules/Rules/GameRule.cpp | 1 - .../app/common/Localisation/StringTable.cpp | 1 - targets/app/common/MenuController.cpp | 3 +- .../app/common/Network/GameNetworkManager.cpp | 1 - .../Network/PlatformNetworkManagerStub.cpp | 1 - .../common/UI/All Platforms/ArchiveFile.cpp | 1 - .../All Platforms/IUIScene_CraftingMenu.cpp | 1 - .../UI/All Platforms/IUIScene_PauseMenu.cpp | 3 +- .../UIScene_LeaderboardsMenu.cpp | 1 - .../UIScene_MainMenu.cpp | 22 ++- .../UIScene_InGameInfoMenu.cpp | 1 - .../UI/Scenes/UIScene_FullscreenProgress.cpp | 3 +- targets/app/common/UI/UIScene.cpp | 1 - targets/app/linux/Stubs/winapi_stubs.h | 179 ------------------ targets/minecraft/client/BufferedImage.cpp | 7 +- .../client/gui/SelectWorldScreen.cpp | 31 +-- .../multiplayer/MultiPlayerChunkCache.cpp | 16 +- .../minecraft/client/skins/DLCTexturePack.cpp | 5 +- .../minecraft/client/title/TitleScreen.cpp | 24 ++- .../server/level/ServerChunkCache.cpp | 16 +- .../world/level/chunk/SparseDataStorage.cpp | 17 +- .../world/level/chunk/SparseLightStorage.cpp | 17 +- .../ConsoleSaveFileOriginal.cpp | 96 +--------- .../ConsoleSaveFileOriginal.h | 21 +- .../ConsoleSaveFileSplit.cpp | 92 +-------- .../ConsoleSaveFileIO/ConsoleSaveFileSplit.h | 19 +- .../storage/ConsoleSaveFileIO/FileHeader.cpp | 1 - .../level/tile/entity/SignTileEntity.cpp | 3 +- 34 files changed, 121 insertions(+), 477 deletions(-) delete mode 100644 targets/app/linux/Stubs/winapi_stubs.h diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 15b1a6c81..97c6ac41c 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -21,7 +21,6 @@ #include "app/common/DLC/DLCSkinFile.h" #include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) { diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 13bfa6cf7..69aea9f52 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -6,7 +6,6 @@ #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" @@ -105,7 +104,7 @@ void DLCController::mountNextDLC(int iPad) { [this](int pad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { return dlcMountedCallback(pad, dwErr, dwLicenceMask); - }) != ERROR_IO_PENDING) { + }) != 997 /* ERROR_IO_PENDING */) { app.DebugPrintf("Failed to mount DLC %d for pad %d\n", m_iTotalDLCInstalled, iPad); ++m_iTotalDLCInstalled; @@ -131,7 +130,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, #if defined(_WINDOWS64) app.DebugPrintf("--- DLCController::dlcMountedCallback\n"); - if (dwErr != ERROR_SUCCESS) { + if (dwErr != 0 /* ERROR_SUCCESS */) { app.DebugPrintf("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); app.m_dlcManager.incrementUnnamedCorruptCount(); } else { diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 28eaa47bb..9dbb035e5 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -20,7 +20,6 @@ #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 "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp index aee9d428c..df109f509 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp @@ -9,7 +9,6 @@ #include #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/Class.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h index 6c788f700..bfc5c0cae 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -15,7 +15,6 @@ #include "minecraft/XuiActionPayload.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index a7ff792f0..a68e1de49 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -19,7 +19,6 @@ #include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -556,7 +555,7 @@ void LevelGenerationOptions::loadBaseSaveData() { [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); }, - "WPACK") != ERROR_IO_PENDING) { + "WPACK") != 997 /* ERROR_IO_PENDING */) { // corrupt DLC setLoadedData(); app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n", @@ -577,7 +576,7 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, uint32_t dwLicenceMask) { LevelGenerationOptions* lgo = this; lgo->m_bLoadingData = false; - if (dwErr != ERROR_SUCCESS) { + if (dwErr != 0 /* ERROR_SUCCESS */) { // corrupt DLC app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n", iPad, dwErr); diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index 8e4a5f28b..fa035db9e 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -9,7 +9,6 @@ #include #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp index beb418cbc..e0e1bcae7 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/app/common/Localisation/StringTable.cpp @@ -4,7 +4,6 @@ #include #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index f4cfed459..0aafa2219 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -6,7 +6,6 @@ #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" @@ -498,7 +497,7 @@ int MenuController::remoteSaveThreadProc(void* lpParameter) { if (app.GetXuiAction(PlatformProfile.GetPrimaryPad()) != eAppAction_WaitRemoteServerSaveComplete) { - return ERROR_CANCELLED; + return 1223; // ERROR_CANCELLED } app.SetAction(PlatformProfile.GetPrimaryPad(), eAppAction_Idle); diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index ed88a05c7..a26907f0c 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -24,7 +24,6 @@ #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "Socket.h" #include "platform/XboxStubs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp index 3ae7bb298..15108e8b9 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -8,7 +8,6 @@ #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "NetworkPlayerQNet.h" #include "Socket.h" diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index 445dcd085..af1034a2c 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -6,7 +6,6 @@ #include #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/fs/fs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayInputStream.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 1b8bc6270..1affdedf7 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -12,7 +12,6 @@ #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" diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index b6dd3b624..ad1c9c2f6 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -18,7 +18,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" @@ -243,7 +242,7 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { if (app.GetChangingSessionType()) { // 4J Stu - This causes the fullscreenprogress scene to ignore the // action it was given - hr = ERROR_CANCELLED; + hr = 1223; // ERROR_CANCELLED } return hr; } 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 16f22f310..7fa6ef461 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 @@ -18,7 +18,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.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 4beac9a53..d7300605e 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 @@ -1,7 +1,9 @@ #include "UIScene_MainMenu.h" +#include #include +#include #include #include #include @@ -20,7 +22,6 @@ #include "app/common/UI/UIString.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "util/StringHelpers.h" @@ -176,18 +177,21 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { random->nextInt((int)m_splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - SYSTEMTIME LocalSysTime; - GetLocalTime(&LocalSysTime); - if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) { + const std::time_t now = std::chrono::system_clock::to_time_t( + std::chrono::system_clock::now()); + std::tm localTime; + localtime_r(&now, &localTime); + const int month = localTime.tm_mon + 1; // tm_mon is 0-based + const int day = localTime.tm_mday; + if (month == 11 && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) { + } else if (month == 6 && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (LocalSysTime.wMonth == 12 && - LocalSysTime.wDay == 24) // the Java game shows this on - // Christmas Eve, so we will too + } else if (month == 12 && day == 24) // the Java game shows this on + // Christmas Eve, so we will too { splashIndex = eSplashMerryXmas; - } else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) { + } else if (month == 1 && day == 1) { splashIndex = eSplashHappyNewYear; } // splashIndex = 47; // Very short string 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 482caabdf..05bbaa567 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 @@ -16,7 +16,6 @@ #include "app/common/UI/UIScene.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/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 9c64047a4..803a001eb 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -16,7 +16,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/C4JThread.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" @@ -166,7 +165,7 @@ void UIScene_FullscreenProgress::tick() { // If we failed (currently used by network connection thread), navigate // back if (exitcode != 0) { - if (exitcode == ERROR_CANCELLED) { + if (exitcode == 1223 /* ERROR_CANCELLED */) { // Current thread cancelled for whatever reason // Currently used only for the // Game::RemoteSaveThreadProc thread Assume to diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 148d8f930..00677e4b8 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -20,7 +20,6 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "java/System.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/linux/Stubs/winapi_stubs.h b/targets/app/linux/Stubs/winapi_stubs.h deleted file mode 100644 index 52ef81a12..000000000 --- a/targets/app/linux/Stubs/winapi_stubs.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef WINAPISTUBS_H -#define WINAPISTUBS_H - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -typedef struct { - int32_t LowPart; - int32_t HighPart; - int64_t QuadPart; -} LARGE_INTEGER; - -typedef struct { - uint32_t LowPart; - uint32_t HighPart; - uint64_t QuadPart; -} ULARGE_INTEGER; - -#define ERROR_SUCCESS 0L -#define ERROR_IO_PENDING 997L // dderror -#define ERROR_CANCELLED 1223L - -#define MEM_COMMIT 0x1000 -#define MEM_RESERVE 0x2000 -#define MEM_DECOMMIT 0x4000 -#define PAGE_READWRITE 0x04 - -// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime -typedef struct _FILETIME { - int32_t dwLowDateTime; - int32_t dwHighDateTime; -} FILETIME, *PFILETIME, *LPFILETIME; - -// https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime -typedef struct _SYSTEMTIME { - 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; - -#ifdef __LP64__ -static inline int64_t InterlockedCompareExchangeRelease64( - int64_t volatile* Destination, int64_t Exchange, int64_t Comperand) { - int64_t expected = Comperand; - __atomic_compare_exchange_n(Destination, &expected, Exchange, false, - __ATOMIC_RELEASE, __ATOMIC_RELAXED); - return expected; -} -#else -static inline int64_t InterlockedCompareExchangeRelease( - LONG volatile* Destination, LONG Exchange, LONG Comperand) { - LONG expected = Comperand; - __atomic_compare_exchange_n(Destination, &expected, Exchange, false, - __ATOMIC_RELEASE, __ATOMIC_RELAXED); - return expected; -} -#endif - -// internal helper: convert time_t to FILETIME (100ns intervals since -// 1601-01-01) -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 = (int32_t)(val & 0xFFFFFFFF); - ft.dwHighDateTime = (int32_t)(val >> 32); - return ft; -} - -// internal helper: convert FILETIME (100ns since 1601) to time_t (seconds since -// 1970) -static inline time_t _FileTimeToTimeT(const FILETIME& ft) { - uint64_t val = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime; - const uint64_t EPOCH_DIFF = - 116444736000000000ULL; // 100ns intervals between 1601-01-01 and - // 1970-01-01 - return (time_t)((val - EPOCH_DIFF) / 10000000ULL); -} - -// internal helper: read the current wall clock into a timespec -static inline void _CurrentTimeSpec(struct timespec* ts) { -#ifdef CLOCK_REALTIME - clock_gettime(CLOCK_REALTIME, ts); -#else - struct timeval tv; - gettimeofday(&tv, nullptr); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * 1000; -#endif -} - -// internal helper: fill SYSTEMTIME from a broken-down tm + nanosecond remainder -static inline void _FillSystemTime(const struct tm* tm, long tv_nsec, - LPSYSTEMTIME lpSystemTime) { - lpSystemTime->wYear = tm->tm_year + 1900; - lpSystemTime->wMonth = tm->tm_mon + 1; - lpSystemTime->wDayOfWeek = tm->tm_wday; // 0 = Sunday - lpSystemTime->wDay = tm->tm_mday; - lpSystemTime->wHour = tm->tm_hour; - lpSystemTime->wMinute = tm->tm_min; - lpSystemTime->wSecond = tm->tm_sec; - lpSystemTime->wMilliseconds = (int16_t)(tv_nsec / 1000000); // ns to ms -} - -// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlocaltime -static inline void GetLocalTime(LPSYSTEMTIME lpSystemTime) { - struct timespec ts; - _CurrentTimeSpec(&ts); - struct tm tm; - localtime_r(&ts.tv_sec, &tm); // local time - _FillSystemTime(&tm, ts.tv_nsec, lpSystemTime); -} - -// https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-filetimetosystemtime -static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, - LPSYSTEMTIME lpSystemTime) { - uint64_t ft = ((uint64_t)lpFileTime->dwHighDateTime << 32) | - lpFileTime->dwLowDateTime; - time_t t = _FileTimeToTimeT(*lpFileTime); - long remainder_ns = (long)((ft % 10000000ULL) * 100); - - struct tm tm; - gmtime_r(&t, &tm); // UTC - _FillSystemTime(&tm, remainder_ns, lpSystemTime); - return true; -} - -static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, - int32_t flAllocationType, int32_t flProtect) { - // MEM_COMMIT | MEM_RESERVE → mmap anonymous - int prot = 0; - if (flProtect == 0x04 /*PAGE_READWRITE*/) - prot = PROT_READ | PROT_WRITE; - else if (flProtect == 0x40 /*PAGE_EXECUTE_READWRITE*/) - prot = PROT_READ | PROT_WRITE | PROT_EXEC; - else if (flProtect == 0x02 /*PAGE_READONLY*/) - prot = PROT_READ; - else - prot = PROT_READ | PROT_WRITE; // default - - int flags = MAP_PRIVATE | MAP_ANONYMOUS; - if (lpAddress != nullptr) flags |= MAP_FIXED; - - void* p = mmap(lpAddress, dwSize, prot, flags, -1, 0); - if (p == MAP_FAILED) return nullptr; - return p; -} - -static inline bool VirtualFree(void* lpAddress, size_t dwSize, - int32_t dwFreeType) { - if (lpAddress == nullptr) return false; - // MEM_RELEASE (0x8000) frees the whole region - if (dwFreeType == 0x8000 /*MEM_RELEASE*/) { - // dwSize should be 0 for MEM_RELEASE per Win32 API, but we don't track - // allocation sizes Use dwSize if provided, otherwise this is a - // best-effort - if (dwSize == 0) dwSize = 4096; // minimum page - munmap(lpAddress, dwSize); - } else { - // MEM_DECOMMIT (0x4000) - just decommit (make inaccessible) - madvise(lpAddress, dwSize, MADV_DONTNEED); - } - return true; -} - -#endif // WINAPISTUBS_H diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 3e2ab00c9..07a8d5b7b 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -11,7 +11,6 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "minecraft/IGameServices.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" #include "util/StringHelpers.h" #include "platform/fs/fs.h" @@ -105,7 +104,7 @@ BufferedImage::BufferedImage(const std::string& File, } } - if (hr == ERROR_SUCCESS) { + if (hr == 0) { if (l == 0) { width = ImageInfo.Width; height = ImageInfo.Height; @@ -154,7 +153,7 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, D3DXIMAGE_INFO ImageInfo; hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[l]); - if (hr == ERROR_SUCCESS && l == 0) { + if (hr == 0 && l == 0) { width = ImageInfo.Width; height = ImageInfo.Height; } @@ -171,7 +170,7 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { int32_t hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); - if (hr == ERROR_SUCCESS) { + if (hr == 0) { width = ImageInfo.Width; height = ImageInfo.Height; } else { diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index 8f927fe86..813247347 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -2,14 +2,16 @@ #include "SelectWorldScreen.h" #include +#include #include +#include +#include #include #include "Button.h" #include "ConfirmScreen.h" #include "CreateWorldScreen.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "RenameWorldScreen.h" #include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" @@ -258,21 +260,24 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, std::string id = levelSummary->getLevelId(); - ULARGE_INTEGER rawtime; - rawtime.QuadPart = levelSummary->getLastPlayed() * - 10000; // Convert it from milliseconds back to FileTime - - FILETIME timeasfiletime; - timeasfiletime.dwHighDateTime = rawtime.HighPart; - timeasfiletime.dwLowDateTime = rawtime.LowPart; - - SYSTEMTIME time; - FileTimeToSystemTime(&timeasfiletime, &time); + // levelSummary->getLastPlayed() is milliseconds since the FILETIME + // epoch (1601-01-01 UTC). Convert to chrono::system_clock (1970 + // epoch) by subtracting the constant offset, then break down with + // gmtime_r for display. + constexpr int64_t kFileTimeEpochToUnixEpochMs = 11644473600000LL; + const int64_t lastPlayedUnixMs = + levelSummary->getLastPlayed() - kFileTimeEpochToUnixEpochMs; + const auto tp = std::chrono::system_clock::time_point{ + std::chrono::milliseconds{lastPlayedUnixMs}}; + time_t lastPlayedTime = std::chrono::system_clock::to_time_t(tp); + std::tm utc; + gmtime_r(&lastPlayedTime, &utc); char buffer[20]; // 4J Stu - Currently shows years as 4 digits, where java only showed 2 - snprintf(buffer, 20, "%d/%d/%d %d:%02d", time.wDay, time.wMonth, - time.wYear, time.wHour, time.wMinute); // 4J - TODO Localise this + snprintf(buffer, 20, "%d/%d/%d %d:%02d", utc.tm_mday, utc.tm_mon + 1, + utc.tm_year + 1900, utc.tm_hour, + utc.tm_min); // 4J - TODO Localise this id = id + " (" + buffer; int64_t size = levelSummary->getSizeOnDisk(); diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 438d2e932..1d6baff82 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -1,10 +1,10 @@ #include "MultiPlayerChunkCache.h" +#include #include #include #include "minecraft/network/INetworkService.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/StringHelpers.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" @@ -210,16 +210,10 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { chunk->loaded = true; } -#if (defined _WIN64 || defined __LP64__) - if (InterlockedCompareExchangeRelease64( - (int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) == - (int64_t)lastChunk) -#else - if (InterlockedCompareExchangeRelease( - (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == - (int32_t)lastChunk) -#endif // 0 - { + LevelChunk* expected = lastChunk; + if (std::atomic_ref(cache[idx]) + .compare_exchange_strong(expected, chunk, + std::memory_order_release)) { // If we're sharing with the server, we'll need to calculate our // heightmap now, which isn't shared. If we aren't sharing with the // server, then this will be calculated when the chunk data arrives. diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 369eb9668..594d0aa69 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -26,7 +26,6 @@ #include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "platform/fs/fs.h" #include "java/File.h" @@ -242,7 +241,7 @@ void DLCTexturePack::loadData() { [this](int pad, std::uint32_t err, std::uint32_t lic) { return onPackMounted(pad, err, lic); }, - "TPACK") != ERROR_IO_PENDING) { + "TPACK") != 997) { // corrupt DLC m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) @@ -273,7 +272,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { DLCTexturePack* texturePack = this; texturePack->m_bLoadingData = false; - if (dwErr != ERROR_SUCCESS) { + if (dwErr != 0) { // corrupt DLC Log::info("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); } else { diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index f8b659b4c..a7d547b22 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -4,12 +4,14 @@ #include "TitleScreen.h" #include +#include +#include #include +#include #include #include "platform/renderer/renderer.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/client/BufferedImage.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" @@ -65,18 +67,20 @@ TitleScreen::TitleScreen() { random->nextInt((int)splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - SYSTEMTIME LocalSysTime; - GetLocalTime(&LocalSysTime); - if (LocalSysTime.wMonth == 11 && LocalSysTime.wDay == 9) { + const auto now = std::chrono::system_clock::now(); + const auto t = std::chrono::system_clock::to_time_t(now); + std::tm localTime; + localtime_r(&t, &localTime); + const int month = localTime.tm_mon + 1; // tm_mon is 0-based + const int day = localTime.tm_mday; + if (month == 11 && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (LocalSysTime.wMonth == 6 && LocalSysTime.wDay == 1) { + } else if (month == 6 && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (LocalSysTime.wMonth == 12 && - LocalSysTime.wDay == 24) // the Java game shows this on - // Christmas Eve, so we will too - { + } else if (month == 12 && day == 24) { + // the Java game shows this on Christmas Eve, so we will too splashIndex = eSplashMerryXmas; - } else if (LocalSysTime.wMonth == 1 && LocalSysTime.wDay == 1) { + } else if (month == 1 && day == 1) { splashIndex = eSplashHappyNewYear; } diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 203c58d9b..6ba4cefbe 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -1,4 +1,5 @@ #include "minecraft/util/Log.h" +#include #include "ServerChunkCache.h" #include @@ -8,7 +9,6 @@ #include #include "minecraft/IGameServices.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "ServerLevel.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/server/MinecraftServer.h" @@ -165,16 +165,10 @@ LevelChunk* ServerChunkCache::create( } } -#if defined(_WIN64) || defined(__LP64__) - if (InterlockedCompareExchangeRelease64( - (int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) == - (int64_t)lastChunk) -#else - if (InterlockedCompareExchangeRelease( - (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == - (int32_t)lastChunk) -#endif - { + LevelChunk* expected = lastChunk; + if (std::atomic_ref(cache[idx]) + .compare_exchange_strong(expected, chunk, + std::memory_order_release)) { // Successfully updated the cache std::lock_guard lock(m_csLoadCreate); // 4J - added - this will run a recalcHeightmap if source is a diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index 5c7bf9c6c..e6dc4fd9a 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -1,4 +1,5 @@ #include "SparseDataStorage.h" +#include #include #include @@ -6,7 +7,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -426,8 +426,9 @@ void SparseDataStorage::addNewPlane(int y) { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 == lastDataAndCount) { success = true; @@ -500,8 +501,9 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 == lastDataAndCount) { success = true; @@ -575,8 +577,9 @@ int SparseDataStorage::compress() { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 != lastDataAndCount) { // Failed to write. Don't bother trying again... being very diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 8d507bc7b..4e4929a6c 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -1,4 +1,5 @@ #include "SparseLightStorage.h" +#include #include #include @@ -6,7 +7,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -430,8 +430,9 @@ void SparseLightStorage::addNewPlane(int y) { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 == lastDataAndCount) { success = true; @@ -504,8 +505,9 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 == lastDataAndCount) { success = true; @@ -586,8 +588,9 @@ int SparseLightStorage::compress() { // succeed if the data stored at dataAndCount is equal to // lastDataAndCount, and will return the value present just before the // write took place - int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( - (int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount); + int64_t lastDataAndCount2 = lastDataAndCount; + std::atomic_ref(dataAndCount).compare_exchange_strong( + lastDataAndCount2, newDataAndCount, std::memory_order_release); if (lastDataAndCount2 != lastDataAndCount) { // Failed to write. Don't bother trying again... being very diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 693a08cde..b1e4f1370 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -18,7 +18,6 @@ #include "minecraft/GameEnums.h" #include "minecraft/BuildVer.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" @@ -35,32 +34,12 @@ #include "platform/storage/storage.h" #include "platform/fs/fs.h" -#define RESERVE_ALLOCATION MEM_RESERVE -#define COMMIT_ALLOCATION MEM_COMMIT - -unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; -void* ConsoleSaveFileOriginal::pvHeap = nullptr; ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( const std::string& fileName, void* pvSaveData /*= nullptr*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, - ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { - // One time initialise of static stuff required for our storage - if (pvHeap == nullptr) { - // Reserve a chunk of 64MB of virtual address space for our saves, using - // 64KB pages. We'll only be committing these as required to grow the - // storage we need, which will the storage to grow without having to use - // realloc. - - // AP - The Vita doesn't have virtual memory so a pretend system has - // been implemented in PSVitaStubs.cpp. All access to the memory must be - // done via the access function as the pointer returned from - // VirtualAlloc can't be used directly. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, - RESERVE_ALLOCATION, PAGE_READWRITE); - } - - pvSaveMem = pvHeap; + ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) + : saveBuffer(MAX_SAVE_SIZE) { m_fileName = fileName; unsigned int fileSize = initialFileSize; @@ -79,34 +58,6 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( if (forceCleanSave) fileSize = 0; - unsigned int heapSize = std::max( - fileSize, - 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than - // 2MB so allocate high to start with - - // Initially committ enough room to store headSize bytes (using - // CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one - // save file at a time, and the pages should be decommitted in the dtor, so - // pages committed should always be zero at this point. - if (pagesCommitted != 0) { -#ifndef _CONTENT_PACKAGE - assert(0); -#endif - } - - unsigned int pagesRequired = - (heapSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { -#ifndef _CONTENT_PACKAGE - // Out of physical memory - assert(0); -#endif - } - pagesCommitted = pagesRequired; - if (fileSize > 0) { if (pvSaveData != nullptr) { memcpy(pvSaveMem, pvSaveData, fileSize); @@ -135,6 +86,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // Clear the first 8 bytes that reference the header header.WriteHeader(pvSourceData); } else { + assert(decompSize <= MAX_SAVE_SIZE); unsigned char* buf = new unsigned char[decompSize]; Compression::getCompression()->SetDecompressionType( plat); // if this save is from another platform, set the @@ -146,25 +98,6 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( SAVE_FILE_PLATFORM_LOCAL); // and then set the // decompression back to the // local machine's standard type - - // Only ReAlloc if we need to (we might already have enough) - // and align to 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = decompSize; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = - VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } memcpy(pvSaveMem, buf, decompSize); delete[] buf; } @@ -178,10 +111,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( } } -ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() { - VirtualFree(pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT); - pagesCommitted = 0; -} +ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() = default; // Add the file to our table of internal files if not already there // Open our actual save file ready for reading/writing, and the set the file @@ -424,23 +354,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond( unsigned int buffer1Size = 0; unsigned int buffer2Size = 0; - // Only ReAlloc if we need to (we might already have enough) and align to - // 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } + assert(header.GetFileSize() + nNumberOfBytesToWrite <= MAX_SAVE_SIZE); // This is the start of where we want the space to be, and the start of the // data that we need to move diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index 2d8fcbd27..6e5be08ff 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -1,6 +1,8 @@ #pragma once +#include #include #include +#include #include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" @@ -13,18 +15,19 @@ private: std::string m_fileName; - // void* hHeap; - static void* pvHeap; - static unsigned int pagesCommitted; + // Backing store for the in-memory save image. The buffer is sized to + // MAX_SAVE_SIZE up front; on Linux/macOS the kernel only physically backs + // pages that are actually touched, so this gives the same demand-paging + // behaviour the legacy VirtualAlloc reserve/commit pattern relied on, + // without any OS-specific calls. #if defined(_LARGE_WORLDS) - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = - 32 * 1024; // 2GB virtual allocation + static constexpr std::size_t MAX_SAVE_SIZE = + 2u * 1024u * 1024u * 1024u; // 2GB #else - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 1024; + static constexpr std::size_t MAX_SAVE_SIZE = 64u * 1024u * 1024u; // 64MB #endif - void* pvSaveMem; + std::vector saveBuffer; + void* pvSaveMem = saveBuffer.data(); std::recursive_mutex m_lock; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 40c920a0d..b1bb7a155 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -20,7 +20,6 @@ #include "minecraft/GameEnums.h" #include "minecraft/BuildVer.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/Timer.h" #include "util/StringHelpers.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -41,11 +40,6 @@ class ProgressListener; -#define RESERVE_ALLOCATION MEM_RESERVE -#define COMMIT_ALLOCATION MEM_COMMIT - -unsigned int ConsoleSaveFileSplit::pagesCommitted = 0; -void* ConsoleSaveFileSplit::pvHeap = nullptr; ConsoleSaveFileSplit::RegionFileReference::RegionFileReference( int index, unsigned int regionIndex, unsigned int length /*=0*/, @@ -363,7 +357,8 @@ FileEntry* ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) { ConsoleSaveFileSplit::ConsoleSaveFileSplit( const std::string& fileName, void* pvSaveData /*= nullptr*/, unsigned int initialFileSize /*= 0*/, bool forceCleanSave /*= false*/, - ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { + ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) + : saveBuffer(MAX_SAVE_SIZE) { unsigned int fileSize = initialFileSize; // Load a save from the game rules @@ -389,7 +384,8 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit( ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile* sourceSave, bool alreadySmallRegions, - ProgressListener* progress) { + ProgressListener* progress) + : saveBuffer(MAX_SAVE_SIZE) { _init(sourceSave->getFilename(), nullptr, 0, sourceSave->getSavePlatform()); header.setOriginalSaveVersion(sourceSave->getOriginalSaveVersion()); @@ -422,17 +418,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, unsigned int fileSize, ESavePlatform plat) { m_lastTickTime = 0; - // One time initialise of static stuff required for our storage - if (pvHeap == nullptr) { - // Reserve a chunk of 64MB of virtual address space for our saves, using - // 64KB pages. We'll only be committing these as required to grow the - // storage we need, which will the storage to grow without having to use - // realloc. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, - RESERVE_ALLOCATION, PAGE_READWRITE); - } - - pvSaveMem = pvHeap; m_fileName = fileName; // Get details of region files. From this point on we are responsible for @@ -458,34 +443,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, regionFiles[regionIndex] = regionFileRef; } - unsigned int heapSize = std::max( - fileSize, - 1024u * 1024u * 2u); // 4J Stu - Our files are going to be bigger than - // 2MB so allocate high to start with - - // Initially committ enough room to store headSize bytes (using - // CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one - // save file at a time, and the pages should be decommitted in the dtor, so - // pages committed should always be zero at this point. - if (pagesCommitted != 0) { -#if !defined(_CONTENT_PACKAGE) - assert(0); -#endif - } - - unsigned int pagesRequired = - (heapSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { -#if !defined(_CONTENT_PACKAGE) - // Out of physical memory - assert(0); -#endif - } - pagesCommitted = pagesRequired; - if (fileSize > 0) { if (pvSaveData != nullptr) { memcpy(pvSaveMem, pvSaveData, fileSize); @@ -515,26 +472,7 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, if (Compression::getCompression()->Decompress( buf, &decompSize, (unsigned char*)pvSaveMem + 8, fileSize - 8) == 0) { - // Only ReAlloc if we need to (we might already have enough) - // and align to 512 byte boundaries - unsigned int currentHeapSize = - pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = decompSize; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = - VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } - + assert(decompSize <= MAX_SAVE_SIZE); memcpy(pvSaveMem, buf, decompSize); } else { // Corrupt save, although most of the terrain should @@ -561,8 +499,6 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, } ConsoleSaveFileSplit::~ConsoleSaveFileSplit() { - VirtualFree(pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT); - pagesCommitted = 0; // Make sure we don't have any thumbnail data still waiting round - we can't // need it now we've destroyed the save file anyway @@ -1023,23 +959,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry* file, unsigned int buffer1Size = 0; unsigned int buffer2Size = 0; - // Only ReAlloc if we need to (we might already have enough) and align to - // 512 byte boundaries - unsigned int currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - unsigned int desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; - - if (desiredSize > currentHeapSize) { - unsigned int pagesRequired = - (desiredSize + (CSF_PAGE_SIZE - 1)) / CSF_PAGE_SIZE; - void* pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, - COMMIT_ALLOCATION, PAGE_READWRITE); - if (pvRet == nullptr) { - // Out of physical memory - assert(0); - } - pagesCommitted = pagesRequired; - } + assert(header.GetFileSize() + nNumberOfBytesToWrite <= MAX_SAVE_SIZE); // This is the start of where we want the space to be, and the start of the // data that we need to move diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index a1e93f573..bfc05165f 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -73,18 +73,19 @@ private: std::string m_fileName; bool m_autosave; - // void* hHeap; - static void* pvHeap; - static unsigned int pagesCommitted; + // Backing store for the in-memory save image. The buffer is sized to + // MAX_SAVE_SIZE up front; on Linux/macOS the kernel only physically backs + // pages that are actually touched, so this gives the same demand-paging + // behaviour the legacy VirtualAlloc reserve/commit pattern relied on, + // without any OS-specific calls. #if defined(_LARGE_WORLDS) - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = - 32 * 1024; // 2GB virtual allocation + static constexpr std::size_t MAX_SAVE_SIZE = + 2u * 1024u * 1024u * 1024u; // 2GB #else - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 1024; + static constexpr std::size_t MAX_SAVE_SIZE = 64u * 1024u * 1024u; // 64MB #endif - void* pvSaveMem; + std::vector saveBuffer; + void* pvSaveMem = saveBuffer.data(); std::recursive_mutex m_lock; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index a3ff514d5..991a8af5b 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -13,7 +13,6 @@ #include #include "app/linux/LinuxGame.h" -#include "app/linux/Stubs/winapi_stubs.h" #include "util/Definitions.h" #include "java/System.h" diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index d02363f13..2677f592a 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -2,7 +2,6 @@ #include -#include "app/linux/Stubs/winapi_stubs.h" #include "PlatformTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/SignUpdatePacket.h" @@ -153,7 +152,7 @@ int SignTileEntity::handleStringVerify(STRING_VERIFY_RESPONSE* pResults) { m_bVerified = true; m_bCensored = false; for (int i = 0; i < pResults->wNumStrings; i++) { - if (pResults->pStringResult[i] != ERROR_SUCCESS) { + if (pResults->pStringResult[i] != 0) { m_bCensored = true; } } From 81c2eb82f0f91d682e6181762bdb80699304469f Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:55:13 +1000 Subject: [PATCH 030/104] fix: clear all build warnings and clean up review nits --- targets/app/common/DLC/DLCSkinFile.cpp | 5 +-- .../Leaderboards/LeaderboardInterface.cpp | 2 +- .../app/common/Network/GameNetworkManager.cpp | 4 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../UIScene_LoadMenu.cpp | 2 +- .../UIScene_MainMenu.cpp | 8 ++-- .../Help & Options/UIScene_SkinSelectMenu.cpp | 2 + targets/app/common/UI/UIScene.cpp | 2 +- targets/minecraft/client/gui/DeathScreen.h | 2 +- targets/minecraft/client/gui/Font.cpp | 4 +- targets/minecraft/client/gui/MessageScreen.h | 2 +- .../gui/achievement/AchievementScreen.h | 2 +- .../client/multiplayer/ClientConnection.cpp | 4 +- .../client/multiplayer/ConnectScreen.h | 2 +- .../client/multiplayer/DisconnectedScreen.h | 2 +- .../multiplayer/MultiPlayerLocalPlayer.cpp | 3 +- .../client/multiplayer/ReceivingLevelScreen.h | 2 +- .../client/skins/AbstractTexturePack.cpp | 3 +- .../minecraft/client/skins/DLCTexturePack.cpp | 6 ++- .../server/network/PlayerConnection.cpp | 8 ++-- targets/minecraft/world/level/Level.cpp | 2 +- .../world/level/chunk/SparseDataStorage.cpp | 45 ++++++++----------- .../world/level/chunk/SparseLightStorage.cpp | 45 ++++++++----------- .../level/tile/entity/SignTileEntity.cpp | 6 +-- targets/nbt/include/nbt/ByteArrayTag.h | 2 +- targets/nbt/include/nbt/IntArrayTag.h | 2 +- targets/nbt/include/nbt/LongTag.h | 2 +- targets/platform/PlatformTypes.h | 6 +-- targets/platform/renderer/gl/GLRenderer.cpp | 3 +- targets/platform/renderer/gl/gl_compat.h | 6 ++- 30 files changed, 88 insertions(+), 98 deletions(-) diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index be8c44cac..e120d94a8 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -110,7 +110,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, SKIN_BOX* pSkinBox = new SKIN_BOX; memset(pSkinBox, 0, sizeof(SKIN_BOX)); - sscanf(value.c_str(), "%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, + sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart, &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); @@ -132,8 +132,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, m_AdditionalBoxes.push_back(pSkinBox); } break; case DLCManager::e_DLCParamType_Anim: { - sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask, - sizeof(unsigned int)); + sscanf(value.c_str(), "%X", &m_uiAnimOverrideBitmask); uint32_t skinId = app.getSkinIdFromPath(m_path); app.SetAnimOverrideBitmask(skinId, m_uiAnimOverrideBitmask); break; diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.cpp b/targets/app/common/Leaderboards/LeaderboardInterface.cpp index 979d7937b..41cef18ae 100644 --- a/targets/app/common/Leaderboards/LeaderboardInterface.cpp +++ b/targets/app/common/Leaderboards/LeaderboardInterface.cpp @@ -15,7 +15,7 @@ LeaderboardInterface::LeaderboardInterface(IPlatformLeaderboard* man) { m_startIndex = 0; m_readCount = 0; - m_manager->OpenSession(); + (void)m_manager->OpenSession(); } LeaderboardInterface::~LeaderboardInterface() { diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index a26907f0c..9fe851b20 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -717,7 +717,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, // 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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -1377,7 +1377,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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 1affdedf7..334afbb18 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -875,7 +875,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { app.DebugPrintf("Need more H slots - "); #if !defined(_CONTENT_PACKAGE) fprintf( - stderr, + stderr, "%s", app.GetString(pTempItemInst->getDescriptionId())); #endif app.DebugPrintf("\n"); 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 b5fccce01..f42d33b5d 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 @@ -302,7 +302,7 @@ void UIScene_LoadMenu::tick() { if (szSeed[0] != 0) { char TempString[256]; - snprintf(TempString, 256, "%s: %hs", app.GetString(IDS_SEED), + snprintf(TempString, 256, "%s: %s", app.GetString(IDS_SEED), szSeed); m_labelSeed.setLabel(TempString); } else { 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 d7300605e..861dabcbf 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 @@ -787,7 +787,7 @@ void UIScene_MainMenu::RunPlayGame(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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); // 4J-PB - Need to check for installed DLC if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(iPad); @@ -896,7 +896,7 @@ void UIScene_MainMenu::RunLeaderboards(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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); proceedToScene(iPad, eUIScene_LeaderboardsMenu); } @@ -916,7 +916,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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); { bool bContentRestricted = false; @@ -1015,7 +1015,7 @@ 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 - PlatformProfile.QuerySigninStatus(); + (void)PlatformProfile.QuerySigninStatus(); #if TO_BE_IMPLEMENTED // 4J-PB - You can be offline and still can go into help and options 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 2d8b03101..ffebcc195 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -885,6 +885,8 @@ TEXTURE_NAME UIScene_SkinSelectMenu::getTextureId(int skinIndex) { case EDefaultSkins::Skin7: texture = TN_MOB_CHAR7; break; + case EDefaultSkins::Count: + break; }; return texture; diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 00677e4b8..11d23735d 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -586,7 +586,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, } m_cachedSlotDraw.clear(); - if (useCommandBuffers) PlatformRenderer.CBuffCall(list); + if (useCommandBuffers) (void)PlatformRenderer.CBuffCall(list); // Finish GDraw and anything else that needs to be finalised ui.endCustomDraw(region); diff --git a/targets/minecraft/client/gui/DeathScreen.h b/targets/minecraft/client/gui/DeathScreen.h index 96e0d6260..a20c9ea55 100644 --- a/targets/minecraft/client/gui/DeathScreen.h +++ b/targets/minecraft/client/gui/DeathScreen.h @@ -6,7 +6,7 @@ public: virtual void init() override; protected: - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; virtual void buttonClicked(Button* button) override; public: diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index c8fef7dc9..904afa844 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -188,8 +188,8 @@ void Font::draw(const std::string& str, bool dropShadow) { // 4jcraft: this is a check for §. This was easy in UTF-16, since a // single widechar can fit §, but it's encoded as 0xA7 0xC2 in UTF-8, so // we need to check both characters. - if (i + 2 < cleanStr.length() && c == '\xC2' && - (unsigned char)cleanStr[i + 1] == '\xA7') { + if (i + 2 < cleanStr.length() && c == 0xC2u && + (unsigned char)cleanStr[i + 1] == 0xA7u) { // 4J - following block was: // int colorN = // "0123456789abcdefk".indexOf(str.toLowerCase().charAt(i + 1)); diff --git a/targets/minecraft/client/gui/MessageScreen.h b/targets/minecraft/client/gui/MessageScreen.h index 83b3d3383..d04100717 100644 --- a/targets/minecraft/client/gui/MessageScreen.h +++ b/targets/minecraft/client/gui/MessageScreen.h @@ -13,7 +13,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.h b/targets/minecraft/client/gui/achievement/AchievementScreen.h index 1b4d35934..d2ba38f56 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.h +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.h @@ -49,7 +49,7 @@ public: protected: virtual void buttonClicked(Button* button) override; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void render(int mouseX, int mouseY, float a) override; diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index c52899d53..b98a62d4a 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -2375,7 +2375,7 @@ void ClientConnection::handleTextureChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -2431,7 +2431,7 @@ void ClientConnection::handleTextureAndGeometryChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && diff --git a/targets/minecraft/client/multiplayer/ConnectScreen.h b/targets/minecraft/client/multiplayer/ConnectScreen.h index 9544d9895..90a4874f2 100644 --- a/targets/minecraft/client/multiplayer/ConnectScreen.h +++ b/targets/minecraft/client/multiplayer/ConnectScreen.h @@ -16,7 +16,7 @@ public: virtual void tick() override; protected: - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/multiplayer/DisconnectedScreen.h b/targets/minecraft/client/multiplayer/DisconnectedScreen.h index 7b0b91ee2..32115e525 100644 --- a/targets/minecraft/client/multiplayer/DisconnectedScreen.h +++ b/targets/minecraft/client/multiplayer/DisconnectedScreen.h @@ -15,7 +15,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 0647aaf4f..d1efdaf5b 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -373,7 +373,8 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { LocalPlayer::setCustomSkin(skinId); #if !defined(_CONTENT_PACKAGE) printf("Skin for local player %s has changed to %s (%d)\n", - name.c_str(), customTextureUrl.c_str(), getPlayerDefaultSkin()); + name.c_str(), customTextureUrl.c_str(), + static_cast(getPlayerDefaultSkin())); #endif if (getCustomSkin() != oldSkinIndex) connection->send(std::shared_ptr( diff --git a/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h b/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h index 91d0f13d6..a5eca2bf7 100644 --- a/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h +++ b/targets/minecraft/client/multiplayer/ReceivingLevelScreen.h @@ -13,7 +13,7 @@ public: protected: using Screen::keyPressed; - virtual void keyPressed(char eventCharacter, int eventKey); + virtual void keyPressed(char eventCharacter, int eventKey) override; public: virtual void init() override; diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index ce0799dc0..b95dee1f0 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -3,6 +3,7 @@ #include "AbstractTexturePack.h" +#include #include #include @@ -222,7 +223,7 @@ std::string AbstractTexturePack::getXuiRootPath() { 256; // Use this to allocate space to hold a ResourceLocator string char szResourceLocator[LOCATOR_SIZE]; - snprintf(szResourceLocator, LOCATOR_SIZE, "section://%X,%s#%s", + snprintf(szResourceLocator, LOCATOR_SIZE, "section://%" PRIxPTR ",%s#%s", c_ModuleHandle, "media", "media/"); return szResourceLocator; } diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 594d0aa69..cee737ec6 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -2,6 +2,7 @@ #include "minecraft/util/Log.h" #include "DLCTexturePack.h" +#include #include #include #include @@ -451,8 +452,9 @@ std::string DLCTexturePack::getXuiRootPath() { constexpr int LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string char szResourceLocator[LOCATOR_SIZE]; - snprintf(szResourceLocator, LOCATOR_SIZE, "memory://%08X,%04X#", - pbData, dwSize); + snprintf(szResourceLocator, LOCATOR_SIZE, + "memory://%08" PRIxPTR ",%04X#", + reinterpret_cast(pbData), dwSize); path = szResourceLocator; } return path; diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 3b2ca8a31..e149367cf 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -969,7 +969,7 @@ void PlayerConnection::handleTextureChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for server player %s has changed to %s (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -1013,7 +1013,7 @@ void PlayerConnection::handleTextureAndGeometryChange( "PlayerConnection::handleTextureAndGeometryChange - Skin for server " "player %s has changed to %s (%d)\n", player->name.c_str(), player->customTextureUrl.c_str(), - player->getPlayerDefaultSkin()); + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && @@ -1423,7 +1423,7 @@ void PlayerConnection::handlePlayerInfo( gameType) { #if !defined(_CONTENT_PACKAGE) printf("Setting %s to game mode %d\n", - serverPlayer->name.c_str(), gameType); + serverPlayer->name.c_str(), gameType->getId()); #endif serverPlayer->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_CreativeMode, @@ -1438,7 +1438,7 @@ void PlayerConnection::handlePlayerInfo( } else { #if !defined(_CONTENT_PACKAGE) printf("%s already has game mode %d\n", - serverPlayer->name.c_str(), gameType); + serverPlayer->name.c_str(), gameType->getId()); #endif } if (cheats) { diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 17b0a37f4..ea7f6961d 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -2570,7 +2570,7 @@ std::string Level::gatherStats() { char buf[64]; { std::lock_guard lock(m_entitiesCS); - snprintf(buf, 64, "All:%d", entities.size()); + snprintf(buf, 64, "All:%zu", entities.size()); } return std::string(buf); } diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index e6dc4fd9a..b3b56e24c 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -422,15 +422,12 @@ void SparseDataStorage::addNewPlane(int y) { newDataAndCount |= ((int64_t)linesUsed) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted queueForDelete(lastDataPointer); @@ -497,15 +494,12 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) { unsigned char* lastDataPointer = (unsigned char*)(lastDataAndCount & 0x0000ffffffffffff); - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full @@ -573,15 +567,12 @@ int SparseDataStorage::compress() { newDataAndCount |= ((int64_t)planesToAlloc) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 != lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (!std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 4e4929a6c..5a29b0d52 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -426,15 +426,12 @@ void SparseLightStorage::addNewPlane(int y) { newDataAndCount |= ((int64_t)linesUsed) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted queueForDelete(lastDataPointer); @@ -501,15 +498,12 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) { unsigned char* lastDataPointer = (unsigned char*)(lastDataAndCount & 0x0000ffffffffffff); - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 == lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full @@ -584,15 +578,12 @@ int SparseLightStorage::compress() { newDataAndCount |= ((int64_t)planesToAlloc) << 48; - // Attempt to update the data & count atomically. This command will Only - // succeed if the data stored at dataAndCount is equal to - // lastDataAndCount, and will return the value present just before the - // write took place - int64_t lastDataAndCount2 = lastDataAndCount; - std::atomic_ref(dataAndCount).compare_exchange_strong( - lastDataAndCount2, newDataAndCount, std::memory_order_release); - - if (lastDataAndCount2 != lastDataAndCount) { + // Attempt to update the data & count atomically. CAS only + // succeeds if dataAndCount currently equals lastDataAndCount. + int64_t expected = lastDataAndCount; + if (!std::atomic_ref(dataAndCount) + .compare_exchange_strong(expected, newDataAndCount, + std::memory_order_release)) { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index 2677f592a..e117afd61 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -44,8 +44,7 @@ void SignTileEntity::save(CompoundTag* tag) { #if !defined(_CONTENT_PACKAGE) fprintf(stderr, "### - Saving a sign with text - \n"); for (int i = 0; i < 4; i++) { - fprintf(stderr, m_wsmessages[i].c_str()); - fprintf(stderr, "\n"); + fprintf(stderr, "%s\n", m_wsmessages[i].c_str()); } #endif } @@ -63,8 +62,7 @@ void SignTileEntity::load(CompoundTag* tag) { #if !defined(_CONTENT_PACKAGE) fprintf(stderr, "### - Loaded a sign with text - \n"); for (int i = 0; i < 4; i++) { - fprintf(stderr, m_wsmessages[i].c_str()); - fprintf(stderr, "\n"); + fprintf(stderr, "%s\n", m_wsmessages[i].c_str()); } #endif diff --git a/targets/nbt/include/nbt/ByteArrayTag.h b/targets/nbt/include/nbt/ByteArrayTag.h index d5409c018..58adda56f 100644 --- a/targets/nbt/include/nbt/ByteArrayTag.h +++ b/targets/nbt/include/nbt/ByteArrayTag.h @@ -32,7 +32,7 @@ public: std::string toString() { static char buf[32]; - snprintf(buf, 32, "[%d bytes]", data.size()); + snprintf(buf, 32, "[%zu bytes]", data.size()); return std::string(buf); } diff --git a/targets/nbt/include/nbt/IntArrayTag.h b/targets/nbt/include/nbt/IntArrayTag.h index 7c2525b7e..fd9f940f9 100644 --- a/targets/nbt/include/nbt/IntArrayTag.h +++ b/targets/nbt/include/nbt/IntArrayTag.h @@ -36,7 +36,7 @@ public: std::string toString() { static char buf[32]; - snprintf(buf, 32, "[%d bytes]", data.size()); + snprintf(buf, 32, "[%zu bytes]", data.size()); return std::string(buf); } diff --git a/targets/nbt/include/nbt/LongTag.h b/targets/nbt/include/nbt/LongTag.h index 9af3b75d0..755e845e8 100644 --- a/targets/nbt/include/nbt/LongTag.h +++ b/targets/nbt/include/nbt/LongTag.h @@ -15,7 +15,7 @@ public: uint8_t getId() { return TAG_Long; } std::string toString() { static char buf[32]; - snprintf(buf, 32, "%I64d", data); + snprintf(buf, 32, "%lld", static_cast(data)); return std::string(buf); } diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index 33b74fdbd..4e78dfc2a 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -14,7 +14,7 @@ struct ImageFileBuffer { ImageFileBuffer(EImageType type, std::size_t size) : m_type(type), m_pBuffer(size > 0 ? std::make_unique(size) : nullptr), - m_bufferSize(static_cast(size)) {} + m_bufferSize(size) {} // move-only ImageFileBuffer(ImageFileBuffer&&) noexcept = default; @@ -24,7 +24,7 @@ struct ImageFileBuffer { [[nodiscard]] EImageType GetType() const { return m_type; } [[nodiscard]] std::byte* GetBufferPointer() const { return m_pBuffer.get(); } - [[nodiscard]] int GetBufferSize() const { return m_bufferSize; } + [[nodiscard]] std::size_t GetBufferSize() const { return m_bufferSize; } [[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; } void Release() { m_pBuffer.reset(); @@ -33,7 +33,7 @@ struct ImageFileBuffer { EImageType m_type{e_typePNG}; std::unique_ptr m_pBuffer; - int m_bufferSize = 0; + std::size_t m_bufferSize = 0; }; struct D3DXIMAGE_INFO { diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 46066d25c..96b5474da 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1563,7 +1563,8 @@ 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); + for (int i = 0; i < count; i++) + (void)PlatformRenderer.CBuffCall(ids[i], false); } void glReadPixels_4J(int x, int y, int w, int h, int f, int t, ByteBuffer* p) { diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index 0e00d55a1..f7c84e535 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -264,7 +264,11 @@ #undef glEndList #define glEndList() PlatformRenderer.CBuffEnd() #undef glCallList -#define glCallList(_list) PlatformRenderer.CBuffCall(_list) +// CBuffCall is [[nodiscard]] because it can fail (chunk not ready), but +// legacy display list call sites treat it as fire-and-forget rendering - +// a missed call just means nothing draws this frame, which is what the +// old GL display list semantics already gave them. +#define glCallList(_list) ((void)PlatformRenderer.CBuffCall(_list)) // glGenLists / glDeleteLists, lists are not supported in core!!!!! #undef glGenLists From cd4b39cf88ebbd1f04521421cb5d212cec6df1c4 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 10:17:55 +1000 Subject: [PATCH 031/104] style: clang-format the entire project --- targets/app/common/AppGameServices.cpp | 92 +- targets/app/common/AppGameServices.h | 22 +- targets/app/common/App_structs.h | 11 +- targets/app/common/ArchiveManager.cpp | 2 +- targets/app/common/Audio/SoundEngine.cpp | 54 +- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/Audio/SoundNames.cpp | 8 +- targets/app/common/BannedListManager.cpp | 11 +- targets/app/common/DLC/DLCColourTableFile.cpp | 2 +- targets/app/common/DLC/DLCFile.cpp | 2 +- targets/app/common/DLC/DLCManager.cpp | 29 +- targets/app/common/DLC/DLCManager.h | 75 +- targets/app/common/DLC/DLCPack.cpp | 6 +- targets/app/common/DLC/DLCPack.h | 2 +- targets/app/common/DLC/DLCSkinFile.cpp | 10 +- targets/app/common/DLC/DLCSkinFile.h | 2 +- targets/app/common/DLCController.cpp | 45 +- targets/app/common/DLCController.h | 7 +- targets/app/common/DebugOptions.cpp | 3 +- targets/app/common/Game.cpp | 152 +- targets/app/common/Game.h | 299 +- targets/app/common/GameMenuService.cpp | 65 +- targets/app/common/GameMenuService.h | 5 +- .../app/common/GameRules/ConsoleGameRules.h | 4 +- .../app/common/GameRules/GameRuleManager.cpp | 8 +- .../app/common/GameRules/GameRuleManager.h | 2 +- .../ApplySchematicRuleDefinition.cpp | 8 +- .../LevelGeneration/BiomeOverride.cpp | 4 +- .../ConsoleGenerateStructure.cpp | 10 +- .../LevelGeneration/ConsoleSchematicFile.cpp | 15 +- .../LevelGeneration/ConsoleSchematicFile.h | 1 - .../LevelGenerationOptions.cpp | 15 +- .../LevelGeneration/StartFeature.cpp | 4 +- .../XboxStructureActionGenerateBox.cpp | 6 +- .../XboxStructureActionGenerateBox.h | 2 +- .../XboxStructureActionPlaceBlock.cpp | 6 +- .../XboxStructureActionPlaceBlock.h | 2 +- .../XboxStructureActionPlaceContainer.cpp | 4 +- .../XboxStructureActionPlaceContainer.h | 2 +- .../XboxStructureActionPlaceSpawner.cpp | 7 +- .../XboxStructureActionPlaceSpawner.h | 2 +- .../AddEnchantmentRuleDefinition.cpp | 6 +- .../AddEnchantmentRuleDefinition.h | 2 +- .../RuleDefinitions/AddItemRuleDefinition.cpp | 6 +- .../RuleDefinitions/AddItemRuleDefinition.h | 2 +- .../CollectItemRuleDefinition.cpp | 13 +- .../CollectItemRuleDefinition.h | 2 +- .../CompleteAllRuleDefinition.cpp | 6 +- .../CompleteAllRuleDefinition.h | 4 +- .../CompoundGameRuleDefinition.cpp | 4 +- .../CompoundGameRuleDefinition.h | 2 +- .../RuleDefinitions/GameRuleDefinition.cpp | 17 +- .../RuleDefinitions/LevelRuleset.cpp | 2 +- .../NamedAreaRuleDefinition.cpp | 6 +- .../RuleDefinitions/NamedAreaRuleDefinition.h | 2 +- .../UpdatePlayerRuleDefinition.cpp | 6 +- .../UpdatePlayerRuleDefinition.h | 2 +- .../RuleDefinitions/UseTileRuleDefinition.cpp | 4 +- .../RuleDefinitions/UseTileRuleDefinition.h | 4 +- .../GameRules/LevelRules/Rules/GameRule.cpp | 7 +- targets/app/common/GameSettingsManager.h | 11 +- targets/app/common/Game_XuiActions.cpp | 26 +- targets/app/common/IPlatformGame.h | 3 +- .../Leaderboards/IPlatformLeaderboard.h | 3 +- .../Leaderboards/LeaderboardInterface.h | 11 +- .../Leaderboards/LeaderboardManager.cpp | 3 +- .../app/common/Localisation/StringTable.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 21 +- targets/app/common/LocalizationManager.h | 4 +- targets/app/common/MenuController.cpp | 49 +- targets/app/common/MenuController.h | 18 +- .../app/common/Network/GameNetworkManager.cpp | 59 +- .../app/common/Network/GameNetworkManager.h | 14 +- targets/app/common/Network/IPlatformNetwork.h | 13 +- .../app/common/Network/NetworkPlayerQNet.cpp | 2 +- .../app/common/Network/NetworkPlayerQNet.h | 2 +- .../Network/PlatformNetworkManagerInterface.h | 10 +- .../Network/PlatformNetworkManagerStub.cpp | 51 +- .../Network/PlatformNetworkManagerStub.h | 16 +- targets/app/common/Network/Socket.cpp | 4 +- targets/app/common/Network/Socket.h | 4 +- targets/app/common/NetworkController.h | 14 +- targets/app/common/SaveManager.cpp | 5 +- targets/app/common/SkinManager.cpp | 24 +- targets/app/common/SkinManager.h | 6 +- targets/app/common/TerrainFeatureManager.h | 2 +- .../Constraints/ChangeStateConstraint.cpp | 2 +- .../Constraints/ChangeStateConstraint.h | 2 +- targets/app/common/Tutorial/FullTutorial.cpp | 12 +- targets/app/common/Tutorial/FullTutorial.h | 2 +- targets/app/common/Tutorial/Hints/AreaHint.h | 2 +- .../common/Tutorial/Hints/DiggerItemHint.cpp | 2 +- .../common/Tutorial/Hints/DiggerItemHint.h | 2 +- .../common/Tutorial/Hints/LookAtEntityHint.h | 4 +- .../common/Tutorial/Hints/LookAtTileHint.h | 4 +- .../app/common/Tutorial/Hints/TakeItemHint.h | 4 +- targets/app/common/Tutorial/Tasks/AreaTask.h | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.cpp | 6 +- .../app/common/Tutorial/Tasks/ChoiceTask.h | 2 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 8 +- .../Tutorial/Tasks/FullTutorialActiveTask.h | 2 +- .../common/Tutorial/Tasks/HorseChoiceTask.cpp | 2 +- .../app/common/Tutorial/Tasks/InfoTask.cpp | 4 +- .../Tutorial/Tasks/ProcedureCompoundTask.h | 2 +- .../common/Tutorial/Tasks/ProgressFlagTask.h | 2 +- .../common/Tutorial/Tasks/RideEntityTask.cpp | 2 +- .../app/common/Tutorial/Tasks/StatTask.cpp | 6 +- .../common/Tutorial/Tasks/StateChangeTask.h | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 50 +- targets/app/common/Tutorial/Tutorial.h | 7 +- .../common/UI/All Platforms/ArchiveFile.cpp | 14 +- .../common/UI/All Platforms/IUIController.h | 2 +- .../IUIScene_AbstractContainerMenu.cpp | 10 +- .../IUIScene_AbstractContainerMenu.h | 2 +- .../All Platforms/IUIScene_CommandBlockMenu.h | 2 - .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_CraftingMenu.h | 3 +- .../UI/All Platforms/IUIScene_PauseMenu.h | 18 +- .../app/common/UI/All Platforms/UIStructs.h | 4 +- .../common/UI/Components/UIComponent_Chat.cpp | 2 +- .../common/UI/Components/UIComponent_Chat.h | 2 +- .../common/UI/Components/UIComponent_Logo.cpp | 2 +- .../Components/UIComponent_MenuBackground.cpp | 6 +- .../Components/UIComponent_MenuBackground.h | 2 +- .../UI/Components/UIComponent_Panorama.cpp | 2 +- .../UI/Components/UIComponent_Panorama.h | 2 +- .../Components/UIComponent_PressStartToPlay.h | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 6 +- .../UI/Components/UIComponent_Tooltips.h | 6 +- .../Components/UIComponent_TutorialPopup.cpp | 15 +- .../UI/Components/UIComponent_TutorialPopup.h | 5 +- .../app/common/UI/Components/UIScene_HUD.cpp | 13 +- .../app/common/UI/Components/UIScene_HUD.h | 2 +- .../app/common/UI/Controls/UIControl_Base.cpp | 3 +- .../UI/Controls/UIControl_DynamicLabel.cpp | 3 +- .../UI/Controls/UIControl_DynamicLabel.h | 2 +- .../UI/Controls/UIControl_EnchantmentBook.cpp | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 16 +- .../common/UI/Controls/UIControl_HTMLLabel.h | 2 +- .../UI/Controls/UIControl_LeaderboardList.cpp | 5 +- .../UI/Controls/UIControl_LeaderboardList.h | 11 +- .../UI/Controls/UIControl_MinecraftHorse.cpp | 4 +- .../UI/Controls/UIControl_MinecraftPlayer.cpp | 4 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 5 +- .../common/UI/Controls/UIControl_Slider.cpp | 2 +- .../app/common/UI/Controls/UIControl_Slider.h | 2 +- .../UI/Controls/UIControl_TexturePackList.h | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 8 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOptions.h | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 6 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 12 +- .../IUIScene_StartGame.cpp | 2 +- .../IUIScene_StartGame.h | 10 +- .../UIScene_CreateWorldMenu.cpp | 41 +- .../UIScene_CreateWorldMenu.h | 2 +- .../UIScene_DLCMainMenu.cpp | 6 +- .../UIScene_DLCMainMenu.h | 2 +- .../UIScene_DLCOffersMenu.cpp | 4 +- .../UIScene_DLCOffersMenu.h | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 16 +- .../UIScene_JoinMenu.cpp | 4 +- .../Frontend Menu screens/UIScene_JoinMenu.h | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 14 +- .../UIScene_LeaderboardsMenu.cpp | 17 +- .../UIScene_LeaderboardsMenu.h | 4 +- .../UIScene_LoadMenu.cpp | 30 +- .../Frontend Menu screens/UIScene_LoadMenu.h | 12 +- .../UIScene_LoadOrJoinMenu.cpp | 76 +- .../UIScene_LoadOrJoinMenu.h | 28 +- .../UIScene_MainMenu.cpp | 88 +- .../Frontend Menu screens/UIScene_MainMenu.h | 2 +- .../UIScene_NewUpdateMessage.cpp | 4 +- .../UIScene_SaveMessage.cpp | 13 +- .../UIScene_TrialExitUpsell.cpp | 4 +- .../Help & Options/UIScene_ControlsMenu.cpp | 14 +- .../Scenes/Help & Options/UIScene_Credits.cpp | 22 +- .../UIScene_HelpAndOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_HowToPlay.cpp | 4 +- .../Help & Options/UIScene_HowToPlayMenu.cpp | 4 +- .../Help & Options/UIScene_LanguageSelector.h | 4 +- .../UIScene_SettingsAudioMenu.cpp | 2 +- .../UIScene_SettingsControlMenu.cpp | 2 +- .../UIScene_SettingsGraphicsMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsMenu.h | 6 +- .../UIScene_SettingsOptionsMenu.cpp | 9 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 4 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 20 +- .../Help & Options/UIScene_SkinSelectMenu.h | 7 +- .../UIScene_AbstractContainerMenu.cpp | 4 +- .../UIScene_AbstractContainerMenu.h | 2 +- .../Containers/UIScene_AnvilMenu.cpp | 12 +- .../Containers/UIScene_AnvilMenu.h | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 2 +- .../Containers/UIScene_BrewingStandMenu.h | 2 +- .../Containers/UIScene_ContainerMenu.h | 2 +- .../Containers/UIScene_CreativeMenu.cpp | 2 +- .../Containers/UIScene_DispenserMenu.h | 2 +- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.h | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 2 +- .../Containers/UIScene_FurnaceMenu.h | 2 +- .../Containers/UIScene_HopperMenu.h | 2 +- .../Containers/UIScene_InventoryMenu.cpp | 2 +- .../Containers/UIScene_TradingMenu.cpp | 4 +- .../UIScene_CraftingMenu.cpp | 2 +- .../UIScene_DeathMenu.cpp | 6 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 8 +- .../UIScene_InGameHostOptionsMenu.cpp | 4 +- .../UIScene_InGameInfoMenu.cpp | 10 +- .../UIScene_InGameInfoMenu.h | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 4 +- .../UIScene_InGamePlayerOptionsMenu.h | 2 +- .../UIScene_InGameSaveManagementMenu.cpp | 8 +- .../UIScene_InGameSaveManagementMenu.h | 6 +- .../UIScene_PauseMenu.cpp | 4 +- .../In-Game Menu Screens/UIScene_PauseMenu.h | 2 +- .../UIScene_SignEntryMenu.cpp | 10 +- .../UIScene_TeleportMenu.cpp | 4 +- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 4 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 11 +- .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 6 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 10 +- .../app/common/UI/Scenes/UIScene_MessageBox.h | 2 +- .../UI/Scenes/UIScene_QuadrantSignin.cpp | 21 +- targets/app/common/UI/UIBitmapFont.cpp | 4 +- targets/app/common/UI/UIController.cpp | 85 +- targets/app/common/UI/UIController.h | 31 +- targets/app/common/UI/UIGroup.cpp | 8 +- targets/app/common/UI/UIGroup.h | 4 +- targets/app/common/UI/UILayer.cpp | 5 +- targets/app/common/UI/UILayer.h | 5 +- targets/app/common/UI/UIScene.h | 8 +- targets/app/common/UI/UITTFFont.cpp | 2 +- targets/app/common/XboxStubs.cpp | 3 +- targets/app/linux/Iggy/include/iggy.h | 13 +- .../Leaderboards/LinuxLeaderboardManager.h | 2 +- targets/app/linux/LinuxGame.cpp | 27 +- targets/app/linux/Stubs/iggy_stubs.h | 9 +- .../app/windows/Iggy/gdraw/gdraw_d3d11.cpp | 4 +- targets/app/windows/Iggy/include/gdraw.h | 4 +- targets/app/windows/Iggy/include/iggy.h | 13 +- targets/app/windows/Iggy/include/rrCore.h | 3613 +++++++++-------- targets/app/windows/Windows64_App.cpp | 17 +- .../app/windows/Windows64_UIController.cpp | 3 +- targets/app/windows/WindowsGame.h | 1 - targets/app/windows/XML/ATGXmlParser.h | 4 +- targets/app/windows/XML/xmlFilesCallback.h | 13 +- .../app/windows/src/Windows64_Minecraft.cpp | 258 +- targets/java/include/java/ByteBuffer.h | 2 +- .../java/InputOutputStream/GZIPInputStream.h | 2 +- .../java/InputOutputStream/GZIPOutputStream.h | 2 +- targets/java/src/File.cpp | 8 +- .../ByteArrayInputStream.cpp | 6 +- .../src/InputOutputStream/FileInputStream.cpp | 6 +- .../InputOutputStream/FileOutputStream.cpp | 6 +- targets/minecraft/BuildVer.h | 6 +- targets/minecraft/Facing.cpp | 2 +- targets/minecraft/GameHostOptions.cpp | 86 +- targets/minecraft/IGameServices.cpp | 4 +- targets/minecraft/IGameServices.h | 72 +- targets/minecraft/SharedConstants.h | 3 +- targets/minecraft/XuiActionPayload.h | 8 +- targets/minecraft/client/BufferedImage.cpp | 28 +- targets/minecraft/client/Camera.cpp | 5 +- targets/minecraft/client/IMenuService.h | 9 +- targets/minecraft/client/Lighting.cpp | 6 +- targets/minecraft/client/MemoryTracker.cpp | 5 +- targets/minecraft/client/Minecraft.cpp | 35 +- targets/minecraft/client/Minecraft.h | 4 +- targets/minecraft/client/Options.cpp | 23 +- targets/minecraft/client/gui/Button.cpp | 4 +- targets/minecraft/client/gui/ChatScreen.cpp | 7 +- .../client/gui/CreateWorldScreen.cpp | 55 +- .../minecraft/client/gui/CreateWorldScreen.h | 2 +- targets/minecraft/client/gui/DeathScreen.cpp | 6 +- targets/minecraft/client/gui/EditBox.cpp | 2 +- targets/minecraft/client/gui/ErrorScreen.cpp | 3 +- targets/minecraft/client/gui/Font.cpp | 2 +- targets/minecraft/client/gui/Font.h | 3 +- targets/minecraft/client/gui/Gui.cpp | 86 +- targets/minecraft/client/gui/Gui.h | 2 +- targets/minecraft/client/gui/GuiComponent.cpp | 9 +- .../minecraft/client/gui/InBedChatScreen.cpp | 4 +- .../client/gui/JoinMultiplayerScreen.cpp | 12 +- targets/minecraft/client/gui/Minimap.cpp | 7 +- .../minecraft/client/gui/NameEntryScreen.cpp | 8 +- targets/minecraft/client/gui/PauseScreen.cpp | 18 +- .../client/gui/RenameWorldScreen.cpp | 4 +- targets/minecraft/client/gui/Screen.cpp | 19 +- .../client/gui/SelectWorldScreen.cpp | 7 +- targets/minecraft/client/gui/SlideButton.cpp | 4 +- .../client/gui/TradeSwitchButton.cpp | 3 +- .../gui/achievement/AchievementPopup.cpp | 10 +- .../gui/achievement/AchievementScreen.cpp | 6 +- .../gui/achievement/AchievementScreen.h | 1 - .../client/gui/achievement/StatsScreen.cpp | 4 +- .../gui/inventory/AbstractBeaconButton.cpp | 6 +- .../gui/inventory/AbstractContainerScreen.cpp | 9 +- .../gui/inventory/BeaconCancelButton.cpp | 4 +- .../gui/inventory/BeaconPowerButton.cpp | 4 +- .../client/gui/inventory/BeaconPowerButton.h | 1 - .../client/gui/inventory/BeaconScreen.cpp | 6 +- .../client/gui/inventory/BeaconScreen.h | 1 - .../gui/inventory/BrewingStandScreen.cpp | 9 +- .../client/gui/inventory/BrewingStandScreen.h | 1 - .../client/gui/inventory/ContainerScreen.cpp | 6 +- .../client/gui/inventory/CraftingScreen.cpp | 2 +- .../gui/inventory/CreativeInventoryScreen.cpp | 27 +- .../gui/inventory/EnchantmentScreen.cpp | 12 +- .../client/gui/inventory/FurnaceScreen.cpp | 8 +- .../client/gui/inventory/HopperScreen.cpp | 6 +- .../gui/inventory/HorseInventoryScreen.cpp | 3 +- .../gui/inventory/HorseInventoryScreen.h | 1 - .../client/gui/inventory/InventoryScreen.cpp | 4 +- .../client/gui/inventory/MerchantScreen.cpp | 5 +- .../client/gui/inventory/MerchantScreen.h | 1 - .../client/gui/inventory/RepairScreen.cpp | 9 +- .../client/gui/inventory/TextEditScreen.cpp | 4 +- .../client/gui/inventory/TrapScreen.cpp | 4 +- .../client/gui/particle/GuiParticle.cpp | 4 +- targets/minecraft/client/level/DemoLevel.h | 1 - targets/minecraft/client/model/BookModel.h | 2 +- targets/minecraft/client/model/ChestModel.cpp | 4 +- .../minecraft/client/model/ChickenModel.cpp | 4 +- targets/minecraft/client/model/GhastModel.cpp | 4 +- .../minecraft/client/model/HumanoidModel.cpp | 6 +- targets/minecraft/client/model/ModelHorse.cpp | 4 +- .../minecraft/client/model/OcelotModel.cpp | 4 +- targets/minecraft/client/model/OcelotModel.h | 2 +- .../minecraft/client/model/QuadrupedModel.cpp | 5 +- targets/minecraft/client/model/WolfModel.cpp | 4 +- .../client/model/dragon/DragonModel.cpp | 5 +- .../client/model/dragon/EnderCrystalModel.cpp | 5 +- targets/minecraft/client/model/geom/Model.h | 2 +- .../minecraft/client/model/geom/ModelPart.cpp | 6 +- .../minecraft/client/model/geom/ModelPart.h | 2 +- .../client/multiplayer/ClientConnection.cpp | 313 +- .../client/multiplayer/ClientConnection.h | 5 +- .../multiplayer/MultiPlayerChunkCache.cpp | 9 +- .../multiplayer/MultiPlayerChunkCache.h | 2 - .../multiplayer/MultiPlayerGameMode.cpp | 7 +- .../client/multiplayer/MultiPlayerLevel.cpp | 12 +- .../client/multiplayer/MultiPlayerLevel.h | 2 - .../multiplayer/MultiPlayerLocalPlayer.cpp | 25 +- .../client/particle/DragonBreathParticle.cpp | 4 +- .../client/particle/DripParticle.cpp | 4 +- .../particle/EnchantmentTableParticle.cpp | 4 +- .../client/particle/EnderParticle.cpp | 4 +- .../client/particle/ExplodeParticle.cpp | 4 +- .../client/particle/FootstepParticle.cpp | 6 +- .../client/particle/HugeExplosionParticle.cpp | 10 +- .../client/particle/NetherPortalParticle.cpp | 4 +- .../client/particle/NoteParticle.cpp | 2 +- .../minecraft/client/particle/Particle.cpp | 4 +- .../client/particle/ParticleEngine.cpp | 11 +- .../client/particle/SmokeParticle.cpp | 4 +- .../client/particle/SuspendedParticle.cpp | 4 +- .../client/particle/TakeAnimationParticle.cpp | 6 +- targets/minecraft/client/player/Input.cpp | 14 +- .../minecraft/client/player/LocalPlayer.cpp | 94 +- targets/minecraft/client/player/LocalPlayer.h | 1 - .../minecraft/client/player/RemotePlayer.cpp | 2 +- .../minecraft/client/player/RemotePlayer.h | 1 - targets/minecraft/client/renderer/Chunk.cpp | 7 +- .../client/renderer/GameRenderer.cpp | 76 +- .../minecraft/client/renderer/GameRenderer.h | 2 +- .../client/renderer/ItemInHandRenderer.cpp | 24 +- .../client/renderer/LevelRenderer.cpp | 64 +- .../minecraft/client/renderer/LevelRenderer.h | 8 +- .../client/renderer/OffsettedRenderList.cpp | 4 +- .../minecraft/client/renderer/Tesselator.cpp | 13 +- .../minecraft/client/renderer/Textures.cpp | 73 +- targets/minecraft/client/renderer/Textures.h | 1 - .../client/renderer/TileRenderer.cpp | 11 +- .../client/renderer/culling/Frustum.cpp | 5 +- .../client/renderer/entity/ArrowRenderer.cpp | 6 +- .../client/renderer/entity/BatRenderer.cpp | 5 +- .../client/renderer/entity/BoatRenderer.cpp | 4 +- .../renderer/entity/CaveSpiderRenderer.cpp | 4 +- .../renderer/entity/CreeperRenderer.cpp | 5 +- .../renderer/entity/DefaultRenderer.cpp | 2 +- .../renderer/entity/EnderCrystalRenderer.cpp | 4 +- .../renderer/entity/EnderDragonRenderer.cpp | 5 +- .../renderer/entity/EndermanRenderer.cpp | 6 +- .../entity/EntityRenderDispatcher.cpp | 7 +- .../client/renderer/entity/EntityRenderer.cpp | 11 +- .../renderer/entity/ExperienceOrbRenderer.cpp | 5 +- .../renderer/entity/FallingTileRenderer.cpp | 5 +- .../renderer/entity/FireballRenderer.cpp | 5 +- .../renderer/entity/FishingHookRenderer.cpp | 5 +- .../client/renderer/entity/GhastRenderer.cpp | 4 +- .../renderer/entity/GiantMobRenderer.cpp | 4 +- .../client/renderer/entity/HorseRenderer.cpp | 5 +- .../renderer/entity/HumanoidMobRenderer.cpp | 7 +- .../renderer/entity/ItemFrameRenderer.cpp | 4 +- .../client/renderer/entity/ItemRenderer.cpp | 7 +- .../renderer/entity/ItemSpriteRenderer.cpp | 5 +- .../renderer/entity/LavaSlimeRenderer.cpp | 4 +- .../renderer/entity/LeashKnotRenderer.cpp | 5 +- .../renderer/entity/LightningBoltRenderer.cpp | 5 +- .../renderer/entity/LivingEntityRenderer.cpp | 24 +- .../renderer/entity/MinecartRenderer.cpp | 4 +- .../client/renderer/entity/MobRenderer.cpp | 11 +- .../renderer/entity/MushroomCowRenderer.cpp | 6 +- .../client/renderer/entity/OcelotRenderer.cpp | 4 +- .../renderer/entity/PaintingRenderer.cpp | 6 +- .../client/renderer/entity/PlayerRenderer.cpp | 17 +- .../client/renderer/entity/PlayerRenderer.h | 4 +- .../client/renderer/entity/SheepRenderer.cpp | 4 +- .../renderer/entity/SkeletonRenderer.cpp | 4 +- .../client/renderer/entity/SlimeRenderer.cpp | 5 +- .../renderer/entity/SnowManRenderer.cpp | 4 +- .../client/renderer/entity/SpiderRenderer.cpp | 5 +- .../client/renderer/entity/SquidRenderer.cpp | 4 +- .../renderer/entity/TntMinecartRenderer.cpp | 5 +- .../client/renderer/entity/TntRenderer.cpp | 5 +- .../renderer/entity/VillagerGolemRenderer.cpp | 5 +- .../renderer/entity/VillagerRenderer.cpp | 4 +- .../client/renderer/entity/WitchRenderer.cpp | 4 +- .../renderer/entity/WitherBossRenderer.cpp | 5 +- .../renderer/entity/WitherSkullRenderer.cpp | 5 +- .../client/renderer/entity/WolfRenderer.cpp | 4 +- .../client/renderer/entity/ZombieRenderer.cpp | 2 +- .../texture/PreStitchedTextureMap.cpp | 9 +- .../client/renderer/texture/StitchSlot.cpp | 7 +- .../renderer/texture/StitchedTexture.cpp | 2 +- .../client/renderer/texture/Stitcher.cpp | 2 +- .../client/renderer/texture/Texture.cpp | 21 +- .../client/renderer/texture/Texture.h | 14 +- .../client/renderer/texture/TextureHolder.cpp | 4 +- .../renderer/texture/TextureManager.cpp | 4 +- .../client/renderer/texture/TextureMap.cpp | 8 +- .../renderer/texture/custom/ClockTexture.cpp | 2 +- .../texture/custom/CompassTexture.cpp | 2 +- .../renderer/tileentity/BeaconRenderer.cpp | 5 +- .../renderer/tileentity/ChestRenderer.cpp | 5 +- .../tileentity/EnchantTableRenderer.cpp | 5 +- .../tileentity/EnderChestRenderer.cpp | 5 +- .../tileentity/MobSpawnerRenderer.cpp | 4 +- .../tileentity/PistonPieceRenderer.cpp | 5 +- .../renderer/tileentity/SignRenderer.cpp | 20 +- .../renderer/tileentity/SkullTileRenderer.cpp | 9 +- .../tileentity/TheEndPortalRenderer.cpp | 5 +- .../tileentity/TileEntityRenderDispatcher.cpp | 5 +- .../client/resources/Colours/ColourTable.cpp | 7 +- .../client/skins/AbstractTexturePack.cpp | 24 +- .../client/skins/AbstractTexturePack.h | 6 +- .../minecraft/client/skins/DLCTexturePack.cpp | 40 +- .../minecraft/client/skins/DLCTexturePack.h | 12 +- .../client/skins/DefaultTexturePack.cpp | 3 +- .../client/skins/DefaultTexturePack.h | 4 +- .../client/skins/FolderTexturePack.cpp | 2 +- .../client/skins/FolderTexturePack.h | 2 +- .../minecraft/client/skins/TexturePack.cpp | 5 +- targets/minecraft/client/skins/TexturePack.h | 15 +- .../client/skins/TexturePackRepository.cpp | 35 +- .../minecraft/client/title/TitleScreen.cpp | 21 +- targets/minecraft/commands/AdminLogCommand.h | 11 +- targets/minecraft/commands/Command.h | 2 +- .../minecraft/commands/CommandDispatcher.cpp | 2 +- .../commands/common/EnchantItemCommand.cpp | 2 +- .../commands/common/GiveItemCommand.cpp | 2 +- .../core/DefaultDispenseItemBehavior.h | 4 +- .../minecraft/core/ItemDispenseBehaviors.cpp | 6 +- targets/minecraft/network/Connection.cpp | 10 +- targets/minecraft/network/Connection.h | 3 +- targets/minecraft/network/INetworkService.h | 5 +- .../network/packet/AddGlobalEntityPacket.cpp | 2 +- .../network/packet/AddPlayerPacket.h | 2 +- .../packet/BlockRegionUpdatePacket.cpp | 7 +- .../network/packet/CustomPayloadPacket.cpp | 2 +- .../network/packet/GameCommandPacket.cpp | 2 +- .../minecraft/network/packet/LoginPacket.cpp | 2 +- .../minecraft/network/packet/LoginPacket.h | 2 +- targets/minecraft/network/packet/Packet.cpp | 14 +- .../network/packet/PlayerInfoPacket.cpp | 2 +- .../network/packet/PreLoginPacket.cpp | 6 +- .../minecraft/network/packet/PreLoginPacket.h | 2 +- .../network/packet/RespawnPacket.cpp | 2 +- .../packet/ServerSettingsChangedPacket.cpp | 2 +- .../network/packet/SetPlayerTeamPacket.cpp | 2 +- .../packet/TextureAndGeometryChangePacket.cpp | 2 +- .../packet/TextureAndGeometryPacket.cpp | 4 +- .../network/packet/TextureAndGeometryPacket.h | 2 +- .../packet/UpdateGameRuleProgressPacket.h | 2 +- targets/minecraft/server/ConsoleInput.cpp | 3 +- targets/minecraft/server/MinecraftServer.cpp | 136 +- targets/minecraft/server/MinecraftServer.h | 7 +- targets/minecraft/server/PlayerList.cpp | 67 +- targets/minecraft/server/PlayerList.h | 2 +- targets/minecraft/server/ServerInterface.h | 2 +- targets/minecraft/server/Settings.cpp | 2 +- targets/minecraft/server/Settings.h | 2 +- .../server/commands/TeleportCommand.h | 2 +- .../minecraft/server/level/CreativeMode.cpp | 5 - targets/minecraft/server/level/DemoMode.cpp | 2 - .../minecraft/server/level/EntityTracker.cpp | 54 +- targets/minecraft/server/level/GameMode.cpp | 7 - .../minecraft/server/level/PlayerChunkMap.cpp | 6 +- .../server/level/ServerChunkCache.cpp | 19 +- .../minecraft/server/level/ServerChunkCache.h | 4 +- .../minecraft/server/level/ServerLevel.cpp | 75 +- targets/minecraft/server/level/ServerLevel.h | 3 +- .../server/level/ServerLevelListener.cpp | 2 +- .../minecraft/server/level/ServerPlayer.cpp | 43 +- targets/minecraft/server/level/ServerPlayer.h | 8 +- .../server/level/ServerPlayerGameMode.cpp | 4 +- .../minecraft/server/level/SurvivalMode.cpp | 4 - .../minecraft/server/level/TrackedEntity.cpp | 81 +- .../server/network/PendingConnection.cpp | 32 +- .../server/network/PlayerConnection.cpp | 104 +- .../server/network/PlayerConnection.h | 2 +- .../server/network/ServerConnection.cpp | 6 +- targets/minecraft/stats/Achievement.cpp | 9 +- targets/minecraft/stats/Achievements.cpp | 16 +- targets/minecraft/stats/CommonStats.h | 2 +- targets/minecraft/stats/GenericStats.h | 2 +- targets/minecraft/stats/NumberFormatters.h | 2 +- targets/minecraft/stats/Stat.h | 2 +- targets/minecraft/stats/Stats.cpp | 36 +- targets/minecraft/stats/StatsCounter.cpp | 16 +- targets/minecraft/util/HtmlString.h | 2 +- targets/minecraft/util/WeighedRandom.cpp | 2 +- targets/minecraft/world/CompoundContainer.cpp | 2 +- targets/minecraft/world/SimpleContainer.cpp | 2 +- .../world/damageSource/CombatEntry.cpp | 4 +- .../world/damageSource/CombatTracker.cpp | 21 +- .../world/damageSource/EntityDamageSource.cpp | 11 +- .../IndirectEntityDamageSource.cpp | 4 +- .../world/effect/AbsoptionMobEffect.h | 2 +- .../world/effect/AttackDamageMobEffect.h | 2 +- .../world/effect/HealthBoostMobEffect.h | 2 +- .../world/effect/InstantaneousMobEffect.h | 2 +- targets/minecraft/world/effect/MobEffect.cpp | 6 +- .../world/effect/MobEffectInstance.cpp | 6 +- targets/minecraft/world/entity/Entity.cpp | 17 +- targets/minecraft/world/entity/Entity.h | 4 +- targets/minecraft/world/entity/EntityIO.cpp | 11 +- targets/minecraft/world/entity/EntityIO.h | 9 +- .../minecraft/world/entity/EntitySelector.cpp | 6 +- .../minecraft/world/entity/HangingEntity.cpp | 15 +- targets/minecraft/world/entity/ItemFrame.cpp | 2 +- .../minecraft/world/entity/LivingEntity.cpp | 45 +- targets/minecraft/world/entity/Mob.cpp | 27 +- targets/minecraft/world/entity/Painting.cpp | 4 +- targets/minecraft/world/entity/Painting.h | 2 +- .../minecraft/world/entity/PathfinderMob.cpp | 3 +- .../world/entity/SyncedEntityData.cpp | 2 +- .../ai/attributes/AttributeModifier.cpp | 2 +- .../world/entity/ai/control/LookControl.cpp | 2 +- .../entity/ai/goal/ControlledByPlayerGoal.cpp | 4 +- .../world/entity/ai/goal/MeleeAttackGoal.cpp | 2 +- .../entity/ai/goal/RunAroundLikeCrazyGoal.cpp | 2 +- .../target/NearestAttackableTargetGoal.cpp | 2 +- .../entity/ai/goal/target/TargetGoal.cpp | 2 +- .../minecraft/world/entity/animal/Animal.cpp | 22 +- .../world/entity/animal/EntityHorse.cpp | 28 +- .../minecraft/world/entity/animal/Ocelot.cpp | 6 +- targets/minecraft/world/entity/animal/Pig.cpp | 4 +- .../world/entity/animal/VillagerGolem.cpp | 4 +- .../minecraft/world/entity/animal/Wolf.cpp | 18 +- .../entity/boss/enderdragon/EnderCrystal.cpp | 4 +- .../entity/boss/enderdragon/EnderDragon.cpp | 34 +- .../entity/boss/enderdragon/EnderDragon.h | 6 +- .../world/entity/boss/wither/WitherBoss.cpp | 28 +- .../world/entity/boss/wither/WitherBoss.h | 6 +- .../world/entity/global/GlobalEntity.h | 2 +- .../world/entity/global/LightningBolt.h | 1 - targets/minecraft/world/entity/item/Boat.cpp | 21 +- .../world/entity/item/ItemEntity.cpp | 2 +- .../minecraft/world/entity/item/Minecart.cpp | 30 +- .../world/entity/item/MinecartContainer.cpp | 2 +- .../world/entity/item/MinecartRideable.cpp | 4 +- .../world/entity/monster/CaveSpider.cpp | 2 +- .../world/entity/monster/Creeper.cpp | 11 +- .../world/entity/monster/EnderMan.cpp | 12 +- .../minecraft/world/entity/monster/Enemy.cpp | 2 +- .../minecraft/world/entity/monster/Ghast.cpp | 4 +- .../world/entity/monster/Monster.cpp | 6 +- .../world/entity/monster/PigZombie.cpp | 6 +- .../monster/SharedMonsterAttributes.cpp | 5 +- .../world/entity/monster/Silverfish.cpp | 2 +- .../world/entity/monster/Skeleton.cpp | 13 +- .../minecraft/world/entity/monster/Spider.cpp | 2 +- .../minecraft/world/entity/monster/Zombie.cpp | 9 +- .../world/entity/npc/ClientSideMerchant.h | 3 +- .../minecraft/world/entity/npc/Villager.cpp | 8 +- .../world/entity/player/Inventory.cpp | 15 +- .../minecraft/world/entity/player/Player.cpp | 92 +- .../minecraft/world/entity/player/Player.h | 8 +- .../world/entity/projectile/Arrow.cpp | 32 +- .../world/entity/projectile/Fireball.cpp | 4 +- .../world/entity/projectile/Snowball.cpp | 2 +- .../world/entity/projectile/Throwable.cpp | 4 +- .../entity/projectile/ThrownEnderpearl.cpp | 4 +- .../world/entity/projectile/WitherSkull.cpp | 2 +- .../minecraft/world/inventory/AnvilMenu.cpp | 26 +- targets/minecraft/world/item/ArmorItem.cpp | 10 +- targets/minecraft/world/item/BowItem.cpp | 2 +- targets/minecraft/world/item/BucketItem.cpp | 2 +- targets/minecraft/world/item/ClockItem.h | 2 +- targets/minecraft/world/item/CompassItem.h | 2 +- .../minecraft/world/item/DyePowderItem.cpp | 4 +- .../world/item/EnchantedBookItem.cpp | 6 +- targets/minecraft/world/item/EnderEyeItem.cpp | 2 +- .../world/item/FireworksChargeItem.cpp | 27 +- .../minecraft/world/item/FireworksItem.cpp | 8 +- .../world/item/HangingEntityItem.cpp | 2 +- targets/minecraft/world/item/Item.cpp | 5 +- targets/minecraft/world/item/ItemInstance.cpp | 6 +- targets/minecraft/world/item/MapItem.cpp | 8 +- targets/minecraft/world/item/NameTagItem.cpp | 2 +- .../minecraft/world/item/PlanterTileItem.cpp | 2 +- targets/minecraft/world/item/PotionItem.cpp | 45 +- targets/minecraft/world/item/SaddleItem.cpp | 2 +- targets/minecraft/world/item/SkullItem.cpp | 8 +- targets/minecraft/world/item/SpawnEggItem.cpp | 22 +- targets/minecraft/world/item/TileItem.cpp | 12 +- .../world/item/alchemy/PotionBrewing.cpp | 8 +- .../world/item/alchemy/PotionBrewing.h | 4 +- .../world/item/crafting/ArmorDyeRecipe.cpp | 2 +- .../world/item/crafting/ArmorRecipes.cpp | 12 +- .../world/item/crafting/ClothDyeRecipes.cpp | 3 +- .../minecraft/world/item/crafting/Recipes.cpp | 38 +- .../minecraft/world/item/crafting/Recipes.h | 2 +- .../minecraft/world/item/crafting/Recipy.h | 2 +- .../world/item/crafting/ShapedRecipy.cpp | 5 +- .../world/item/crafting/ShapelessRecipy.cpp | 2 +- .../world/item/crafting/StructureRecipes.cpp | 3 +- .../world/item/crafting/WeaponRecipes.cpp | 4 +- .../world/item/enchantment/Enchantment.cpp | 11 +- .../item/enchantment/EnchantmentHelper.cpp | 11 +- .../world/item/trading/MerchantRecipeList.cpp | 3 +- .../minecraft/world/level/BaseMobSpawner.cpp | 10 +- targets/minecraft/world/level/ChunkPos.cpp | 2 +- targets/minecraft/world/level/Coord.h | 2 +- targets/minecraft/world/level/Explosion.cpp | 8 +- .../minecraft/world/level/FoliageColor.cpp | 2 +- targets/minecraft/world/level/GameRules.cpp | 23 +- .../level/GameRules/GameRuleDefinition.h | 7 +- .../level/GameRules/LevelGenerationOptions.h | 5 +- targets/minecraft/world/level/Level.cpp | 39 +- targets/minecraft/world/level/Level.h | 8 +- .../minecraft/world/level/PortalForcer.cpp | 2 +- targets/minecraft/world/level/biome/Biome.cpp | 4 +- targets/minecraft/world/level/biome/Biome.h | 2 +- .../world/level/biome/BiomeCache.cpp | 2 +- .../world/level/biome/BiomeDecorator.cpp | 3 +- .../world/level/biome/BiomeSource.cpp | 12 +- .../minecraft/world/level/biome/BiomeSource.h | 1 - .../minecraft/world/level/biome/IceBiome.cpp | 2 +- .../level/chunk/CompressedTileStorage.cpp | 6 +- .../world/level/chunk/LevelChunk.cpp | 22 +- .../world/level/chunk/SparseDataStorage.cpp | 12 +- .../world/level/chunk/SparseLightStorage.cpp | 12 +- .../storage/ChunkStorageProfileDecorator.cpp | 2 +- .../chunk/storage/McRegionChunkStorage.cpp | 40 +- .../chunk/storage/McRegionChunkStorage.h | 2 +- .../chunk/storage/MemoryChunkStorage.cpp | 3 - .../world/level/chunk/storage/NbtSlotFile.cpp | 3 +- .../level/chunk/storage/OldChunkStorage.cpp | 24 +- .../world/level/chunk/storage/RegionFile.cpp | 4 +- .../world/level/chunk/storage/RegionFile.h | 2 +- .../level/chunk/storage/RegionFileCache.cpp | 10 +- .../level/chunk/storage/RegionFileCache.h | 9 +- .../world/level/chunk/storage/ZoneFile.cpp | 3 +- .../level/chunk/storage/ZonedChunkStorage.cpp | 17 +- .../world/level/dimension/Dimension.cpp | 10 +- .../world/level/dimension/HellDimension.cpp | 8 +- .../world/level/dimension/TheEndDimension.cpp | 2 +- .../world/level/levelgen/CanyonFeature.cpp | 8 +- .../level/levelgen/CustomLevelSource.cpp | 15 +- .../world/level/levelgen/FlatLevelSource.cpp | 2 +- .../level/levelgen/HellFlatLevelSource.cpp | 6 +- .../level/levelgen/HellRandomLevelSource.cpp | 2 +- .../level/levelgen/RandomLevelSource.cpp | 9 +- .../levelgen/TheEndLevelRandomLevelSource.cpp | 2 +- .../levelgen/feature/BasicTreeFeature.cpp | 6 +- .../level/levelgen/feature/BirchFeature.cpp | 6 +- .../level/levelgen/feature/CaveFeature.cpp | 6 +- .../world/level/levelgen/feature/Feature.h | 2 +- .../level/levelgen/feature/FlowerFeature.cpp | 6 +- .../level/levelgen/feature/LakeFeature.cpp | 6 +- .../levelgen/feature/MegaTreeFeature.cpp | 6 +- .../level/levelgen/feature/OreFeature.cpp | 6 +- .../level/levelgen/feature/PineFeature.cpp | 6 +- .../level/levelgen/feature/ReedsFeature.cpp | 6 +- .../level/levelgen/feature/SandFeature.cpp | 6 +- .../level/levelgen/feature/SpikeFeature.cpp | 2 +- .../level/levelgen/feature/SpringFeature.cpp | 4 +- .../level/levelgen/feature/SpruceFeature.cpp | 6 +- .../levelgen/feature/SwampTreeFeature.cpp | 6 +- .../level/levelgen/feature/TreeFeature.cpp | 6 +- .../level/levelgen/flat/FlatGeneratorInfo.cpp | 8 +- .../level/levelgen/structure/BoundingBox.cpp | 2 +- .../levelgen/structure/MineShaftFeature.cpp | 10 +- .../structure/NetherBridgeFeature.cpp | 7 +- .../structure/RandomScatteredLargeFeature.cpp | 7 +- .../structure/ScatteredFeaturePieces.cpp | 7 +- .../levelgen/structure/SkyIslandDimension.cpp | 5 - .../levelgen/structure/StrongholdFeature.cpp | 16 +- .../levelgen/structure/StrongholdPieces.cpp | 10 +- .../levelgen/structure/StructureFeatureIO.cpp | 7 +- .../structure/StructureFeatureSavedData.cpp | 4 +- .../levelgen/structure/VillageFeature.cpp | 11 +- .../newbiome/layer/BiomeOverrideLayer.cpp | 8 +- .../world/level/newbiome/layer/Layer.cpp | 4 +- .../minecraft/world/level/pathfinder/Node.cpp | 2 +- .../ConsoleSaveFileIO/ConsoleSaveFile.h | 2 +- .../ConsoleSaveFileConverter.cpp | 8 +- .../ConsoleSaveFileOriginal.cpp | 30 +- .../ConsoleSaveFileOriginal.h | 2 +- .../ConsoleSaveFileSplit.cpp | 48 +- .../ConsoleSaveFileIO/ConsoleSaveFileSplit.h | 2 +- .../storage/ConsoleSaveFileIO/FileHeader.cpp | 25 +- .../storage/ConsoleSaveFileIO/FileHeader.h | 11 +- .../storage/ConsoleSaveFileIO/compression.cpp | 24 +- .../world/level/storage/DerivedLevelData.cpp | 4 +- .../level/storage/DirectoryLevelStorage.cpp | 22 +- .../level/storage/DirectoryLevelStorage.h | 2 +- .../storage/DirectoryLevelStorageSource.cpp | 4 +- .../world/level/storage/LevelData.cpp | 13 +- .../world/level/storage/LevelStorage.h | 2 +- .../level/storage/McRegionLevelStorage.cpp | 4 +- .../level/storage/MemoryLevelStorage.cpp | 4 - .../world/level/storage/MemoryLevelStorage.h | 4 - .../storage/MemoryLevelStorageSource.cpp | 4 +- .../world/level/storage/SavedDataStorage.h | 2 +- .../minecraft/world/level/tile/CarrotTile.cpp | 2 +- .../world/level/tile/CauldronTile.cpp | 2 +- .../minecraft/world/level/tile/CocoaTile.cpp | 3 +- .../minecraft/world/level/tile/CropTile.cpp | 2 +- .../world/level/tile/DispenserTile.h | 1 - .../minecraft/world/level/tile/DoorTile.cpp | 4 +- .../world/level/tile/DropperTile.cpp | 3 +- .../minecraft/world/level/tile/FarmTile.cpp | 2 +- .../minecraft/world/level/tile/FireTile.cpp | 4 +- .../world/level/tile/FurnaceTile.cpp | 4 +- .../minecraft/world/level/tile/GrassTile.cpp | 4 +- .../world/level/tile/HugeMushroomTile.cpp | 3 +- .../minecraft/world/level/tile/LeafTile.cpp | 4 +- .../world/level/tile/NetherWartTile.cpp | 2 +- .../world/level/tile/NotGateTile.cpp | 12 +- .../world/level/tile/NoteBlockTile.cpp | 7 +- .../minecraft/world/level/tile/PotatoTile.cpp | 2 +- .../world/level/tile/PressurePlateTile.cpp | 2 +- .../world/level/tile/RedStoneDustTile.cpp | 4 +- .../world/level/tile/SmoothStoneBrickTile.cpp | 4 +- .../minecraft/world/level/tile/StemTile.cpp | 4 +- .../world/level/tile/StoneMonsterTile.cpp | 2 +- .../world/level/tile/TallGrassPlantTile.cpp | 6 +- targets/minecraft/world/level/tile/Tile.cpp | 8 +- .../minecraft/world/level/tile/TntTile.cpp | 8 +- .../minecraft/world/level/tile/TreeTile.cpp | 2 +- .../world/level/tile/WaterLilyTile.cpp | 6 +- .../minecraft/world/level/tile/WoodTile.cpp | 2 +- .../level/tile/entity/BeaconTileEntity.cpp | 5 +- .../tile/entity/BrewingStandTileEntity.cpp | 5 +- .../level/tile/entity/ChestTileEntity.cpp | 2 +- .../level/tile/entity/CommandBlockEntity.cpp | 4 +- .../level/tile/entity/DispenserTileEntity.cpp | 5 +- .../level/tile/entity/DropperTileEntity.cpp | 5 +- .../entity/EnchantmentTableTileEntity.cpp | 2 +- .../level/tile/entity/FurnaceTileEntity.cpp | 2 +- .../level/tile/entity/HopperTileEntity.cpp | 5 +- .../level/tile/entity/SignTileEntity.cpp | 6 +- .../level/tile/entity/TheEndPortalTile.cpp | 4 +- .../world/level/tile/entity/TileEntity.cpp | 4 +- targets/minecraft/world/scores/PlayerTeam.cpp | 3 +- targets/minecraft/world/scores/Team.h | 3 +- .../world/scores/criteria/ObjectiveCriteria.h | 3 +- targets/nbt/include/nbt/IntTag.h | 4 +- targets/platform/C4JThread.cpp | 3 +- targets/platform/PlatformTypes.h | 16 +- targets/platform/ShutdownManager.cpp | 1 + targets/platform/fs/IPlatformFilesystem.h | 6 +- targets/platform/fs/fs.h | 12 +- targets/platform/fs/std/StdFilesystem.cpp | 12 +- targets/platform/fs/std/StdFilesystem.h | 6 +- targets/platform/input/IPlatformInput.h | 7 +- targets/platform/input/input.h | 4 +- targets/platform/input/sdl2/SDL2Input.cpp | 4 +- targets/platform/profile/IPlatformProfile.h | 13 +- targets/platform/profile/ProfileConstants.h | 1 - targets/platform/profile/profile.h | 4 +- targets/platform/profile/stub/StubProfile.cpp | 10 +- targets/platform/profile/stub/StubProfile.h | 6 +- targets/platform/renderer/gl/GLRenderer.cpp | 60 +- targets/platform/renderer/gl/GLRenderer.h | 1 - targets/platform/renderer/gl/gl_compat.h | 131 +- targets/platform/renderer/gl/render_stubs.cpp | 4 +- targets/platform/renderer/renderer.h | 4 +- targets/platform/sound/IPlatformSound.h | 6 +- .../sound/miniaudio/MiniaudioSound.cpp | 20 +- targets/platform/storage/IPlatformStorage.h | 25 +- targets/platform/storage/storage.h | 4 +- targets/platform/storage/stub/StubStorage.cpp | 64 +- targets/platform/storage/stub/StubStorage.h | 13 +- targets/platform/stubs.h | 3 +- targets/util/StringHelpers.h | 4 +- targets/util/Timer.h | 24 +- 803 files changed, 6092 insertions(+), 6095 deletions(-) diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index b18b8e986..323996113 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -8,19 +8,13 @@ AppGameServices::AppGameServices(Game& game, IMenuService& menus) // -- Strings -- -const char* AppGameServices::getString(int id) { - return Game::GetString(id); -} +const char* AppGameServices::getString(int id) { return Game::GetString(id); } // -- Debug settings -- -bool AppGameServices::debugSettingsOn() { - return game_.DebugSettingsOn(); -} +bool AppGameServices::debugSettingsOn() { return game_.DebugSettingsOn(); } -bool AppGameServices::debugArtToolsOn() { - return game_.DebugArtToolsOn(); -} +bool AppGameServices::debugArtToolsOn() { return game_.DebugArtToolsOn(); } unsigned int AppGameServices::debugGetMask(int iPad, bool overridePlayer) { return game_.GetGameSettingsDebugMask(iPad, overridePlayer); @@ -34,9 +28,7 @@ bool AppGameServices::debugMobsDontTick() { return game_.GetMobsDontTickEnabled(); } -bool AppGameServices::debugFreezePlayers() { - return game_.GetFreezePlayers(); -} +bool AppGameServices::debugFreezePlayers() { return game_.GetFreezePlayers(); } // -- Game host options -- @@ -93,9 +85,7 @@ unsigned char AppGameServices::getGameSettings(int setting) { // -- App time -- -float AppGameServices::getAppTime() { - return game_.getAppTime(); -} +float AppGameServices::getAppTime() { return game_.getAppTime(); } // -- Game state -- @@ -104,10 +94,14 @@ void AppGameServices::setGameStarted(bool val) { game_.SetGameStarted(val); } bool AppGameServices::getTutorialMode() { return game_.GetTutorialMode(); } void AppGameServices::setTutorialMode(bool val) { game_.SetTutorialMode(val); } bool AppGameServices::isAppPaused() { return game_.IsAppPaused(); } -int AppGameServices::getLocalPlayerCount() { return game_.GetLocalPlayerCount(); } +int AppGameServices::getLocalPlayerCount() { + return game_.GetLocalPlayerCount(); +} bool AppGameServices::autosaveDue() { return game_.AutosaveDue(); } void AppGameServices::setAutosaveTimerTime() { game_.SetAutosaveTimerTime(); } -int64_t AppGameServices::secondsToAutosave() { return game_.SecondsToAutosave(); } +int64_t AppGameServices::secondsToAutosave() { + return game_.SecondsToAutosave(); +} void AppGameServices::setDisconnectReason( DisconnectPacket::eDisconnectReason reason) { @@ -115,9 +109,13 @@ void AppGameServices::setDisconnectReason( } void AppGameServices::lockSaveNotification() { game_.lockSaveNotification(); } -void AppGameServices::unlockSaveNotification() { game_.unlockSaveNotification(); } +void AppGameServices::unlockSaveNotification() { + game_.unlockSaveNotification(); +} bool AppGameServices::getResetNether() { return game_.GetResetNether(); } -bool AppGameServices::getUseDPadForDebug() { return game_.GetUseDPadForDebug(); } +bool AppGameServices::getUseDPadForDebug() { + return game_.GetUseDPadForDebug(); +} bool AppGameServices::getWriteSavesToFolderEnabled() { return game_.GetWriteSavesToFolderEnabled(); @@ -127,9 +125,7 @@ bool AppGameServices::isLocalMultiplayerAvailable() { return game_.IsLocalMultiplayerAvailable(); } -bool AppGameServices::dlcInstallPending() { - return game_.DLCInstallPending(); -} +bool AppGameServices::dlcInstallPending() { return game_.DLCInstallPending(); } bool AppGameServices::dlcInstallProcessCompleted() { return game_.DLCInstallProcessCompleted(); @@ -198,9 +194,7 @@ void AppGameServices::setGlobalXuiAction(eXuiAction action) { game_.SetGlobalXuiAction(action); } -void AppGameServices::handleButtonPresses() { - game_.HandleButtonPresses(); -} +void AppGameServices::handleButtonPresses() { game_.HandleButtonPresses(); } void AppGameServices::setTMSAction(int iPad, eTMSAction action) { game_.SetTMSAction(iPad, action); @@ -254,8 +248,7 @@ void AppGameServices::setAnimOverrideBitmask(std::uint32_t dwSkinID, game_.SetAnimOverrideBitmask(dwSkinID, bitmask); } -unsigned int AppGameServices::getAnimOverrideBitmask( - std::uint32_t dwSkinID) { +unsigned int AppGameServices::getAnimOverrideBitmask(std::uint32_t dwSkinID) { return game_.GetAnimOverrideBitmask(dwSkinID); } @@ -267,9 +260,7 @@ std::string AppGameServices::getSkinPathFromId(std::uint32_t skinId) { return Game::getSkinPathFromId(skinId); } -bool AppGameServices::defaultCapeExists() { - return game_.DefaultCapeExists(); -} +bool AppGameServices::defaultCapeExists() { return game_.DefaultCapeExists(); } bool AppGameServices::isXuidNotch(PlayerUID xuid) { return game_.isXuidNotch(xuid); @@ -305,8 +296,7 @@ void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId, game_.UpdatePlayerInfo(networkSmallId, playerColourIndex, playerPrivileges); } -unsigned int AppGameServices::getPlayerPrivileges( - std::uint8_t networkSmallId) { +unsigned int AppGameServices::getPlayerPrivileges(std::uint8_t networkSmallId) { return game_.GetPlayerPrivileges(networkSmallId); } @@ -334,9 +324,7 @@ bool AppGameServices::getTerrainFeaturePosition(_eTerrainFeatureType type, return game_.GetTerrainFeaturePosition(type, pX, pZ); } -void AppGameServices::loadDefaultGameRules() { - game_.loadDefaultGameRules(); -} +void AppGameServices::loadDefaultGameRules() { game_.loadDefaultGameRules(); } // -- Archive / resources -- @@ -363,24 +351,21 @@ const char* AppGameServices::getGameRulesString(const std::string& key) { return game_.GetGameRulesString(key); } -unsigned int AppGameServices::createImageTextData(std::uint8_t* textMetadata, - int64_t seed, bool hasSeed, - unsigned int uiHostOptions, - unsigned int uiTexturePackId) { - return game_.CreateImageTextData(textMetadata, seed, hasSeed, - uiHostOptions, uiTexturePackId); +unsigned int AppGameServices::createImageTextData( + std::uint8_t* textMetadata, int64_t seed, bool hasSeed, + unsigned int uiHostOptions, unsigned int uiTexturePackId) { + return game_.CreateImageTextData(textMetadata, seed, hasSeed, uiHostOptions, + uiTexturePackId); } std::string AppGameServices::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint) { + std::string filename, + bool bAddDataFolder, + std::string mountPoint) { return game_.getFilePath(packId, filename, bAddDataFolder, mountPoint); } -char* AppGameServices::getUniqueMapName() { - return game_.GetUniqueMapName(); -} +char* AppGameServices::getUniqueMapName() { return game_.GetUniqueMapName(); } void AppGameServices::setUniqueMapName(char* name) { game_.SetUniqueMapName(name); @@ -390,9 +375,7 @@ unsigned int AppGameServices::getOpacityTimer(int iPad) { return game_.GetOpacityTimer(iPad); } -void AppGameServices::setOpacityTimer(int iPad) { - game_.SetOpacityTimer(iPad); -} +void AppGameServices::setOpacityTimer(int iPad) { game_.SetOpacityTimer(iPad); } void AppGameServices::tickOpacityTimer(int iPad) { game_.TickOpacityTimer(iPad); @@ -423,8 +406,8 @@ unsigned int AppGameServices::dlcCheckForCorrupt(bool showMessage) { return game_.m_dlcManager.checkForCorruptDLCAndAlert(showMessage); } bool AppGameServices::dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, - DLCPack* pack, bool fromArchive) { + const std::string& path, DLCPack* pack, + bool fromArchive) { return game_.m_dlcManager.readDLCDataFile(filesProcessed, path, pack, fromArchive); } @@ -435,7 +418,7 @@ void AppGameServices::dlcRemovePack(DLCPack* pack) { // -- Game rules -- LevelGenerationOptions* AppGameServices::loadGameRules(std::uint8_t* data, - unsigned int size) { + unsigned int size) { return game_.m_gameRules.loadGameRules(data, size); } void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) { @@ -444,7 +427,8 @@ void AppGameServices::saveGameRules(std::uint8_t** data, unsigned int* size) { void AppGameServices::unloadCurrentGameRules() { game_.m_gameRules.unloadCurrentGameRules(); } -void AppGameServices::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { +void AppGameServices::setLevelGenerationOptions( + LevelGenerationOptions* levelGen) { game_.m_gameRules.setLevelGenerationOptions(levelGen); } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index dfa10d396..4cc9b43a1 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -22,8 +22,7 @@ public: // -- Game host options -- unsigned int getGameHostOption(eGameHostOption option) override; - void setGameHostOption(eGameHostOption option, - unsigned int value) override; + void setGameHostOption(eGameHostOption option, unsigned int value) override; // -- Level generation -- LevelGenerationOptions* getLevelGenerationOptions() override; @@ -113,8 +112,7 @@ public: void setRichPresenceContext(int iPad, int contextId) override; void captureSaveThumbnail() override; void getSaveThumbnail(std::uint8_t** data, unsigned int* size) override; - void readBannedList(int iPad, eTMSAction action, - bool bCallback) override; + void readBannedList(int iPad, eTMSAction action, bool bCallback) override; void updatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, unsigned int playerPrivileges) override; @@ -139,13 +137,12 @@ public: int getHTMLColour(eMinecraftColour colour) override; std::string getEntityName(EntityTypeId type) override; const char* getGameRulesString(const std::string& key) override; - unsigned int createImageTextData(std::uint8_t* textMetadata, - int64_t seed, bool hasSeed, - unsigned int uiHostOptions, + unsigned int createImageTextData(std::uint8_t* textMetadata, int64_t seed, + bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) override; std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder, - std::string mountPoint) override; + bool bAddDataFolder, + std::string mountPoint) override; char* getUniqueMapName() override; void setUniqueMapName(char* name) override; unsigned int getOpacityTimer(int iPad) override; @@ -160,14 +157,13 @@ public: DLCSkinFile* getDLCSkinFile(const std::string& name) override; bool dlcNeedsCorruptCheck() override; unsigned int dlcCheckForCorrupt(bool showMessage) override; - bool dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, DLCPack* pack, - bool fromArchive) override; + bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path, + DLCPack* pack, bool fromArchive) override; void dlcRemovePack(DLCPack* pack) override; // -- Game rules -- LevelGenerationOptions* loadGameRules(std::uint8_t* data, - unsigned int size) override; + unsigned int size) override; void saveGameRules(std::uint8_t** data, unsigned int* size) override; void unloadCurrentGameRules() override; void setLevelGenerationOptions(LevelGenerationOptions* levelGen) override; diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 537048244..92eebb5f2 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,16 +2,15 @@ #include -#include "platform/storage/storage.h" -#include "minecraft/GameTypes.h" -#include "platform/profile/ProfileConstants.h" -#include "minecraft/GameEnums.h" -#include "minecraft/GameTypes.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "platform/NetTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/model/SkinBox.h" +#include "platform/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/storage/storage.h" typedef struct { char* wchFilename; diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 6ad335052..51dd2b9d3 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -9,8 +9,8 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/fs/fs.h" #include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" ArchiveManager::ArchiveManager() : m_mediaArchive(nullptr), m_dwRequiredTexturePackID(0) {} diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 543d15ee6..76abaccbe 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -10,13 +10,9 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" -#include "platform/C4JThread.h" -#include "platform/fs/fs.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -24,6 +20,9 @@ #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" #if defined(__linux__) #define STB_VORBIS_HEADER_ONLY @@ -132,7 +131,8 @@ struct MiniAudioSound { bool active; }; -SoundEngine::SoundEngine() : m_audio(std::make_unique()) {} +SoundEngine::SoundEngine() + : m_audio(std::make_unique()) {} SoundEngine::~SoundEngine() = default; std::vector m_activeSounds; void SoundEngine::init(Options* pOptions) { @@ -167,7 +167,8 @@ void SoundEngine::init(Options* pOptions) { m_audio->engineConfig = ma_engine_config_init(); m_audio->engineConfig.listenerCount = MAX_LOCAL_PLAYERS; - if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != MA_SUCCESS) { + if (ma_engine_init(&m_audio->engineConfig, &m_audio->engine) != + MA_SUCCESS) { app.DebugPrintf("Failed to initialize miniaudio engine\n"); return; } @@ -192,9 +193,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, if (szId[i] == '.') szId[i] = '/'; std::string base = PlatformFilesystem.getBasePath().string() + "/"; - const char* roots[] = { - "Sound/Minecraft/", "app/common/Sound/Minecraft/", - "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; + const char* roots[] = {"Sound/Minecraft/", "app/common/Sound/Minecraft/", + "app/common/res/TitleUpdate/res/Sound/Minecraft/"}; char finalPath[512] = {0}; bool found = false; @@ -237,8 +237,9 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, s->info.pitch = pitch; s->info.bIs3D = true; - if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_TRUE); ma_sound_set_min_distance(&s->sound, 2.0f); ma_sound_set_max_distance(&s->sound, 48.0f); @@ -289,8 +290,9 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) { s->info.pitch = pitch; s->info.bIs3D = false; - if (ma_sound_init_from_file(&m_audio->engine, finalPath, MA_SOUND_FLAG_ASYNC, - nullptr, nullptr, &s->sound) == MA_SUCCESS) { + if (ma_sound_init_from_file(&m_audio->engine, finalPath, + MA_SOUND_FLAG_ASYNC, nullptr, nullptr, + &s->sound) == MA_SUCCESS) { ma_sound_set_spatialization_enabled(&s->sound, MA_FALSE); ma_sound_set_volume(&s->sound, volume * m_MasterEffectsVolume); ma_sound_set_pitch(&s->sound, pitch); @@ -432,7 +434,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { ma_result result = ma_sound_init_from_file( &soundEngine->m_audio->engine, soundEngine->m_szStreamName, - MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEngine->m_audio->musicStream); + MA_SOUND_FLAG_STREAM, nullptr, nullptr, + &soundEngine->m_audio->musicStream); if (result != MA_SUCCESS) { app.DebugPrintf( @@ -442,7 +445,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { return 0; } - ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, MA_FALSE); + ma_sound_set_spatialization_enabled(&soundEngine->m_audio->musicStream, + MA_FALSE); ma_sound_set_looping(&soundEngine->m_audio->musicStream, MA_FALSE); soundEngine->m_musicStreamActive = true; @@ -460,27 +464,29 @@ void SoundEngine::playMusicTick() { return; } if (m_musicID != -1) { - std::string base = PlatformFilesystem.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]; bool found = false; m_szStreamName[0] = '\0'; - const char* roots[] = {"app/common/music/", - "music/", "./"}; + const char* roots[] = {"app/common/music/", "music/", "./"}; for (const char* r : roots) { for (const char* e : {".ogg", ".mp3", ".wav"}) { // 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); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s%s", base.c_str(), r, folder, track, + e); 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); + snprintf(m_szStreamName, sizeof(m_szStreamName), + "%s%s%s%s", base.c_str(), r, track, e); if (PlatformFilesystem.exists(m_szStreamName)) { found = true; break; @@ -526,7 +532,8 @@ void SoundEngine::playMusicTick() { m_StreamingAudioInfo.y, m_StreamingAudioInfo.z); } - ma_sound_set_pitch(&m_audio->musicStream, m_StreamingAudioInfo.pitch); + ma_sound_set_pitch(&m_audio->musicStream, + m_StreamingAudioInfo.pitch); ma_sound_set_volume( &m_audio->musicStream, m_StreamingAudioInfo.volume * getMasterMusicVolume()); @@ -683,7 +690,8 @@ void SoundEngine::updateMiniAudio() { m_ListenerA[i].vOrientFront.y, m_ListenerA[i].vOrientFront.z); - ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, 0.0f); + ma_engine_listener_set_world_up(&m_audio->engine, 0, 0.0f, 1.0f, + 0.0f); break; } diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index d769d859e..f4e604b39 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -7,10 +7,10 @@ class Random; #include #include -#include "platform/PlatformTypes.h" #include "app/common/Audio/Consoles_SoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" // Forward-declare the miniaudio backing state. The full struct lives in // SoundEngine.cpp where miniaudio.h is actually included. This keeps diff --git a/targets/app/common/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp index 5b4bbe127..dd44c7f52 100644 --- a/targets/app/common/Audio/SoundNames.cpp +++ b/targets/app/common/Audio/SoundNames.cpp @@ -58,7 +58,7 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { "mob/cat/meow", // eSoundType_MOB_CAT_MEOW // 4J-PB - correct the name of the event for hitting ocelots "mob/cat/hitt", // eSoundType_MOB_CAT_HITT - // "mob.irongolem.throw", // + // "mob.irongolem.throw", // // eSoundType_MOB_IRONGOLEM_THROW "mob.irongolem.hit", //// eSoundType_MOB_IRONGOLEM_HIT "mob.irongolem.death", //// eSoundType_MOB_IRONGOLEM_DEATH "mob.irongolem.walk", @@ -205,11 +205,11 @@ const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { "mob/horse/jump", // eSoundType_MOB_HORSE_JUMP, "mob/witch/idle", // eSoundType_MOB_WITCH_IDLE, <--- - // missing + // missing "mob/witch/hurt", // eSoundType_MOB_WITCH_HURT, <--- - // missing + // missing "mob/witch/death", // eSoundType_MOB_WITCH_DEATH, <--- - // missing + // missing "mob/slime/big", // eSoundType_MOB_SLIME_BIG, "mob/slime/small", // eSoundType_MOB_SLIME_SMALL, diff --git a/targets/app/common/BannedListManager.cpp b/targets/app/common/BannedListManager.cpp index fecd02beb..838530ad6 100644 --- a/targets/app/common/BannedListManager.cpp +++ b/targets/app/common/BannedListManager.cpp @@ -29,8 +29,8 @@ void BannedListManager::invalidate(int iPad) { } } -void BannedListManager::addLevel(int iPad, PlayerUID xuid, - char* pszLevelName, bool bWriteToTMS) { +void BannedListManager::addLevel(int iPad, PlayerUID xuid, char* pszLevelName, + bool bWriteToTMS) { // we will have retrieved the banned level list from TMS, so add this one to // it and write it back to TMS @@ -64,8 +64,7 @@ void BannedListManager::addLevel(int iPad, PlayerUID xuid, // update telemetry too } -bool BannedListManager::isInList(int iPad, PlayerUID xuid, - char* pszLevelName) { +bool BannedListManager::isInList(int iPad, PlayerUID xuid, char* pszLevelName) { for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); ++it) { PBANNEDLISTDATA pData = *it; @@ -126,6 +125,4 @@ void BannedListManager::setUniqueMapName(char* pszUniqueMapName) { memcpy(m_pszUniqueMapName, pszUniqueMapName, 14); } -char* BannedListManager::getUniqueMapName() { - return m_pszUniqueMapName; -} +char* BannedListManager::getUniqueMapName() { return m_pszUniqueMapName; } diff --git a/targets/app/common/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp index 479ec07d8..8cf7ed6b3 100644 --- a/targets/app/common/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -1,10 +1,10 @@ #include "DLCColourTableFile.h" #include "DLCManager.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" diff --git a/targets/app/common/DLC/DLCFile.cpp b/targets/app/common/DLC/DLCFile.cpp index ecb33974a..33e712c9c 100644 --- a/targets/app/common/DLC/DLCFile.cpp +++ b/targets/app/common/DLC/DLCFile.cpp @@ -2,8 +2,8 @@ #include -#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" +#include "minecraft/Minecraft_Macros.h" DLCFile::DLCFile(DLCManager::EDLCType type, const std::string& path) { m_type = type; diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index bbf34088e..f729b54e6 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -13,20 +13,19 @@ #include #include -#include "simdutf.h" - -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "DLCFile.h" #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/fs/fs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/fs/fs.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" +#include "simdutf.h" #include "strings.h" +#include "util/StringHelpers.h" // 4jcraft, this is the size of wchar_t on disk // the DLC was created on windows, with wchar_t beeing 2 bytes and UTF-16 @@ -71,7 +70,8 @@ std::string getMountedDlcReadPath(const std::string& path) { std::string readPath = path; #if defined(_WINDOWS64) - const std::string mountedPath = PlatformStorage.GetMountedPath(path.c_str()); + const std::string mountedPath = + PlatformStorage.GetMountedPath(path.c_str()); if (!mountedPath.empty()) { readPath = mountedPath; } @@ -240,7 +240,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"); - //assert(0); + // assert(0); return foundIndex; } if (type != e_DLCType_All) { @@ -401,10 +401,12 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, // for details, read in the function below #define DLC_PARAM_WSTR(buf, off) \ - DLC_WSTRING((buf) + (off) + offsetof(IPlatformStorage::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(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) + DLC_WSTRING((buf) + (off) + \ + offsetof(IPlatformStorage::DLC_FILE_DETAILS, wchFile)) { std::unordered_map parameterMapping; unsigned int uiCurrentByte = 0; @@ -462,7 +464,8 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, uiCurrentByte += DLC_PARAM_ADV(parBuf.dwWchCount); DLC_READ_PARAM(&parBuf, pbData, uiCurrentByte); } - // ulCurrentByte+=ulParameterCount * sizeof(IPlatformStorage::DLC_FILE_PARAM); + // ulCurrentByte+=ulParameterCount * + // sizeof(IPlatformStorage::DLC_FILE_PARAM); unsigned int uiFileCount; DLC_READ_UINT(&uiFileCount, pbData, uiCurrentByte); @@ -477,7 +480,9 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, DLC_READ_DETAIL(&fileBuf, pbData, dwTemp); } std::uint8_t* pbTemp = - &pbData[dwTemp]; //+ sizeof(IPlatformStorage::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++) { diff --git a/targets/app/common/DLC/DLCManager.h b/targets/app/common/DLC/DLCManager.h index 0adc2a57d..9f3ef0662 100644 --- a/targets/app/common/DLC/DLCManager.h +++ b/targets/app/common/DLC/DLCManager.h @@ -21,33 +21,58 @@ public: static constexpr EDLCType e_DLCType_Skin = ::minecraft::dlc::e_DLCType_Skin; static constexpr EDLCType e_DLCType_Cape = ::minecraft::dlc::e_DLCType_Cape; - static constexpr EDLCType e_DLCType_Texture = ::minecraft::dlc::e_DLCType_Texture; - static constexpr EDLCType e_DLCType_UIData = ::minecraft::dlc::e_DLCType_UIData; - static constexpr EDLCType e_DLCType_PackConfig = ::minecraft::dlc::e_DLCType_PackConfig; - static constexpr EDLCType e_DLCType_TexturePack = ::minecraft::dlc::e_DLCType_TexturePack; - static constexpr EDLCType e_DLCType_LocalisationData = ::minecraft::dlc::e_DLCType_LocalisationData; - static constexpr EDLCType e_DLCType_GameRules = ::minecraft::dlc::e_DLCType_GameRules; - static constexpr EDLCType e_DLCType_Audio = ::minecraft::dlc::e_DLCType_Audio; - static constexpr EDLCType e_DLCType_ColourTable = ::minecraft::dlc::e_DLCType_ColourTable; - static constexpr EDLCType e_DLCType_GameRulesHeader = ::minecraft::dlc::e_DLCType_GameRulesHeader; + static constexpr EDLCType e_DLCType_Texture = + ::minecraft::dlc::e_DLCType_Texture; + static constexpr EDLCType e_DLCType_UIData = + ::minecraft::dlc::e_DLCType_UIData; + static constexpr EDLCType e_DLCType_PackConfig = + ::minecraft::dlc::e_DLCType_PackConfig; + static constexpr EDLCType e_DLCType_TexturePack = + ::minecraft::dlc::e_DLCType_TexturePack; + static constexpr EDLCType e_DLCType_LocalisationData = + ::minecraft::dlc::e_DLCType_LocalisationData; + static constexpr EDLCType e_DLCType_GameRules = + ::minecraft::dlc::e_DLCType_GameRules; + static constexpr EDLCType e_DLCType_Audio = + ::minecraft::dlc::e_DLCType_Audio; + static constexpr EDLCType e_DLCType_ColourTable = + ::minecraft::dlc::e_DLCType_ColourTable; + static constexpr EDLCType e_DLCType_GameRulesHeader = + ::minecraft::dlc::e_DLCType_GameRulesHeader; static constexpr EDLCType e_DLCType_Max = ::minecraft::dlc::e_DLCType_Max; static constexpr EDLCType e_DLCType_All = ::minecraft::dlc::e_DLCType_All; - static constexpr EDLCParameterType e_DLCParamType_Invalid = ::minecraft::dlc::e_DLCParamType_Invalid; - static constexpr EDLCParameterType e_DLCParamType_DisplayName = ::minecraft::dlc::e_DLCParamType_DisplayName; - static constexpr EDLCParameterType e_DLCParamType_ThemeName = ::minecraft::dlc::e_DLCParamType_ThemeName; - static constexpr EDLCParameterType e_DLCParamType_Free = ::minecraft::dlc::e_DLCParamType_Free; - static constexpr EDLCParameterType e_DLCParamType_Credit = ::minecraft::dlc::e_DLCParamType_Credit; - static constexpr EDLCParameterType e_DLCParamType_Cape = ::minecraft::dlc::e_DLCParamType_Cape; - static constexpr EDLCParameterType e_DLCParamType_Box = ::minecraft::dlc::e_DLCParamType_Box; - static constexpr EDLCParameterType e_DLCParamType_Anim = ::minecraft::dlc::e_DLCParamType_Anim; - static constexpr EDLCParameterType e_DLCParamType_PackId = ::minecraft::dlc::e_DLCParamType_PackId; - static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour = ::minecraft::dlc::e_DLCParamType_NetherParticleColour; - static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextColour; - static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextFocusColour = ::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour; - static constexpr EDLCParameterType e_DLCParamType_DataPath = ::minecraft::dlc::e_DLCParamType_DataPath; - static constexpr EDLCParameterType e_DLCParamType_PackVersion = ::minecraft::dlc::e_DLCParamType_PackVersion; - static constexpr EDLCParameterType e_DLCParamType_Max = ::minecraft::dlc::e_DLCParamType_Max; + static constexpr EDLCParameterType e_DLCParamType_Invalid = + ::minecraft::dlc::e_DLCParamType_Invalid; + static constexpr EDLCParameterType e_DLCParamType_DisplayName = + ::minecraft::dlc::e_DLCParamType_DisplayName; + static constexpr EDLCParameterType e_DLCParamType_ThemeName = + ::minecraft::dlc::e_DLCParamType_ThemeName; + static constexpr EDLCParameterType e_DLCParamType_Free = + ::minecraft::dlc::e_DLCParamType_Free; + static constexpr EDLCParameterType e_DLCParamType_Credit = + ::minecraft::dlc::e_DLCParamType_Credit; + static constexpr EDLCParameterType e_DLCParamType_Cape = + ::minecraft::dlc::e_DLCParamType_Cape; + static constexpr EDLCParameterType e_DLCParamType_Box = + ::minecraft::dlc::e_DLCParamType_Box; + static constexpr EDLCParameterType e_DLCParamType_Anim = + ::minecraft::dlc::e_DLCParamType_Anim; + static constexpr EDLCParameterType e_DLCParamType_PackId = + ::minecraft::dlc::e_DLCParamType_PackId; + static constexpr EDLCParameterType e_DLCParamType_NetherParticleColour = + ::minecraft::dlc::e_DLCParamType_NetherParticleColour; + static constexpr EDLCParameterType e_DLCParamType_EnchantmentTextColour = + ::minecraft::dlc::e_DLCParamType_EnchantmentTextColour; + static constexpr EDLCParameterType + e_DLCParamType_EnchantmentTextFocusColour = + ::minecraft::dlc::e_DLCParamType_EnchantmentTextFocusColour; + static constexpr EDLCParameterType e_DLCParamType_DataPath = + ::minecraft::dlc::e_DLCParamType_DataPath; + static constexpr EDLCParameterType e_DLCParamType_PackVersion = + ::minecraft::dlc::e_DLCParamType_PackVersion; + static constexpr EDLCParameterType e_DLCParamType_Max = + ::minecraft::dlc::e_DLCParamType_Max; const static char* wchTypeNamesA[e_DLCParamType_Max]; @@ -85,7 +110,7 @@ public: EDLCType type = e_DLCType_All); DLCSkinFile* getSkinFile( const std::string& path); // Will hunt all packs of type skin to find - // the right skinfile + // the right skinfile DLCPack* getPackContainingSkin(const std::string& path); unsigned int getPackIndexContainingSkin(const std::string& path, diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 97c6ac41c..d0f78b64d 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -6,7 +6,6 @@ #include #include -#include "platform/profile/profile.h" #include "DLCAudioFile.h" #include "DLCCapeFile.h" #include "DLCColourTableFile.h" @@ -15,12 +14,13 @@ #include "DLCLocalisationFile.h" #include "DLCTextureFile.h" #include "DLCUIDataFile.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/locale/StringTable.h" +#include "platform/profile/profile.h" #include "util/StringHelpers.h" DLCPack::DLCPack(const std::string& name, std::uint32_t dwLicenseMask) { diff --git a/targets/app/common/DLC/DLCPack.h b/targets/app/common/DLC/DLCPack.h index 60c19d5bc..f225bdcd5 100644 --- a/targets/app/common/DLC/DLCPack.h +++ b/targets/app/common/DLC/DLCPack.h @@ -5,9 +5,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" +#include "platform/PlatformTypes.h" class DLCFile; class DLCSkinFile; diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index e120d94a8..2f13329c6 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -3,12 +3,12 @@ #include #include -#include "platform/renderer/renderer.h" #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" #include "app/linux/LinuxGame.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" +#include "platform/renderer/renderer.h" DLCSkinFile::DLCSkinFile(const std::string& path) : DLCFile(DLCManager::e_DLCType_Skin, path) { @@ -56,8 +56,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, int maximumChars = 55; - bool bIsSDMode = - !PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen(); + bool bIsSDMode = !PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen(); if (bIsSDMode) { maximumChars = 45; @@ -111,8 +111,8 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, memset(pSkinBox, 0, sizeof(SKIN_BOX)); sscanf(value.c_str(), "%9s%f%f%f%f%f%f%f%f", wchBodyPart, - &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, - &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); + &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, + &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); if (strcmp(wchBodyPart, "HEAD") == 0) { pSkinBox->ePart = eBodyPart_Head; diff --git a/targets/app/common/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h index 4e4d12389..fbcc7c2ef 100644 --- a/targets/app/common/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -6,8 +6,8 @@ #include "DLCFile.h" #include "app/common/DLC/DLCManager.h" -#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/HumanoidModel.h" +#include "minecraft/client/model/SkinBox.h" class DLCSkinFile : public DLCFile { private: diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 69aea9f52..bdbb1a044 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -1,20 +1,20 @@ #include "app/common/DLCController.h" -#include "app/common/Game.h" -#include "app/common/DLC/DLCPack.h" +#include +#include + #include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Game.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/storage/storage.h" -#include "platform/profile/profile.h" #include "platform/XboxStubs.h" - -#include -#include +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" DLCController::DLCController() { m_pDLCFileBuffer = nullptr; @@ -75,10 +75,9 @@ bool DLCController::startInstallDLCProcess(int iPad) { "--- DLCController::startInstallDLCProcess - " "PlatformStorage.GetInstalledDLC\n"); - PlatformStorage.GetInstalledDLC( - iPad, [this](int iInstalledC, int pad) { - return dlcInstalledCallback(iInstalledC, pad); - }); + PlatformStorage.GetInstalledDLC(iPad, [this](int iInstalledC, int pad) { + return dlcInstalledCallback(iInstalledC, pad); + }); return true; } else { app.DebugPrintf( @@ -193,7 +192,7 @@ void DLCController::handleDLC(DLCPack* pack) { PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); for (int i = 0; i < dlcFilenames.size(); i++) { app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], - pack); + pack); } if (dwFilesProcessed == 0) app.m_dlcManager.removePack(pack); } @@ -313,8 +312,7 @@ bool DLCController::getDLCFullOfferIDForPackID(const int iPackID, } } -DLC_INFO* DLCController::getDLCInfoForTrialOfferID( - uint64_t ullOfferID_Trial) { +DLC_INFO* DLCController::getDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial) { if (DLCInfo_Trial.size() > 0) { auto it = DLCInfo_Trial.find(ullOfferID_Trial); if (it == DLCInfo_Trial.end()) { @@ -436,12 +434,13 @@ bool DLCController::retrieveNextDLCContent() { app.DebugPrintf("RetrieveNextDLCContent - type = %d\n", pCurrent->dwType); #endif - IPlatformStorage::EDLCStatus status = PlatformStorage.GetDLCOffers( - PlatformProfile.GetPrimaryPad(), - [this](int iOfferC, std::uint32_t dwType, int pad) { - return dlcOffersReturned(iOfferC, dwType, pad); - }, - pCurrent->dwType); + 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 == IPlatformStorage::EDLC_Pending) { pCurrent->eState = e_DLC_ContentState_Retrieving; } else { @@ -669,9 +668,9 @@ unsigned int DLCController::addTMSPPFileTypeRequest(eDLCContentType eType, return 1; } -int DLCController::tmsPPFileReturned(void* pParam, int iPad, int iUserData, - IPlatformStorage::PTMSPP_FILEDATA pFileData, - const char* szFilename) { +int DLCController::tmsPPFileReturned( + void* pParam, int iPad, int iUserData, + 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 fbec77634..2ef3a520b 100644 --- a/targets/app/common/DLCController.h +++ b/targets/app/common/DLCController.h @@ -8,8 +8,8 @@ #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" -#include "platform/storage/storage.h" #include "platform/XboxStubs.h" +#include "platform/storage/storage.h" struct SCreditTextItemDef; @@ -36,9 +36,8 @@ public: int iPad); // DLC info registration - static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, - char*, unsigned int, int, - char* pDataFile); + static int32_t registerDLCData(char*, char*, int, uint64_t, uint64_t, char*, + unsigned int, int, char* pDataFile); bool getDLCFullOfferIDForSkinID(const std::string& FirstSkin, uint64_t* pullVal); bool getDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal); diff --git a/targets/app/common/DebugOptions.cpp b/targets/app/common/DebugOptions.cpp index b8a7bd099..3f16e4d91 100644 --- a/targets/app/common/DebugOptions.cpp +++ b/targets/app/common/DebugOptions.cpp @@ -27,7 +27,6 @@ DebugOptions::DebugOptions() { #if defined(_DEBUG_MENUS_ENABLED) bool DebugOptions::debugArtToolsOn(unsigned int debugMask) { - return settingsOn() && - (debugMask & (1L << eDebugSetting_ArtTools)) != 0; + return settingsOn() && (debugMask & (1L << eDebugSetting_ArtTools)) != 0; } #endif diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 9dbb035e5..7bd8be6ef 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -1,34 +1,27 @@ -#include "minecraft/GameHostOptions.h" #include "app/common/Game.h" -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" #include "java/Class.h" #include "java/File.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/ProgressRenderer.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -39,6 +32,7 @@ #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/Container.h" @@ -47,6 +41,12 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" #if defined(_WINDOWS64) #include "app/windows/XML/ATGXmlParser.h" @@ -71,24 +71,24 @@ #include #include -#include "platform/input/input.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "minecraft/Minecraft_Macros.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/locale/StringTable.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class BeaconTileEntity; class BrewingStandTileEntity; @@ -189,31 +189,14 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } // Load*Menu methods moved to MenuController - ////////////////////////////////////////////// // GAME SETTINGS ////////////////////////////////////////////// - - - - - // Skin/Cape/FavoriteSkin methods moved to SkinManager // Mash-up pack worlds - - - - - - - - - - - /////////////////////////// // // Remove the debug settings in the content package build @@ -221,16 +204,10 @@ void Game::SetAppPaused(bool val) { m_bIsAppPaused = val; } //////////////////////////// #if !defined(_DEBUG_MENUS_ENABLED) - - #else - - #endif - - int Game::BannedLevelDialogReturned( void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { Game* pApp = (Game*)pParam; @@ -284,11 +261,8 @@ int Game::GetLocalPlayerCount(void) { return iPlayerC; } - - // Installed DLC callback - // 4J-JEV: For the sake of clarity in DLCMountedCallback. #if defined(_WINDOWS64) #define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) @@ -326,7 +300,6 @@ int Game::GetLocalPlayerCount(void) { // } // } - // int Game::DLCReadCallback(void* // pParam,IPlatformStorage::DLC_FILE_DETAILS *pDLCData) // { @@ -365,8 +338,9 @@ void Game::UpdateTime() { } bool Game::isXuidDeadmau5(PlayerUID xuid) { - auto it = DLCController::MojangData.find(xuid); // 4J Stu - The .at and [] accessors - // insert elements if they don't exist + auto it = DLCController::MojangData.find( + xuid); // 4J Stu - The .at and [] accessors + // insert elements if they don't exist if (it != DLCController::MojangData.end()) { MOJANG_DATA* pMojangData = DLCController::MojangData[xuid]; if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { @@ -383,12 +357,6 @@ void Game::ExitGame() {} // Invites - - - - - - ////////////////////////////////////////////////////////////////////////// // // FatalLoadError @@ -400,26 +368,16 @@ void Game::ExitGame() {} ////////////////////////////////////////////////////////////////////////// void Game::FatalLoadError() {} - - - - - // Game Host options -void Game::SetGameHostOption(eGameHostOption eVal, - unsigned int uiVal) { +void Game::SetGameHostOption(eGameHostOption eVal, unsigned int uiVal) { GameHostOptions::set(m_uiGameHostSettings, eVal, uiVal); } - unsigned int Game::GetGameHostOption(eGameHostOption eVal) { return GameHostOptions::get(m_uiGameHostSettings, eVal); } - - - void Game::processSchematics(LevelChunk* levelChunk) { m_gameRules.processSchematics(levelChunk); } @@ -428,12 +386,9 @@ void Game::processSchematicsLighting(LevelChunk* levelChunk) { m_gameRules.processSchematicsLighting(levelChunk); } -void Game::loadDefaultGameRules() { - m_gameRules.loadDefaultGameRules(); -} +void Game::loadDefaultGameRules() { m_gameRules.loadDefaultGameRules(); } -void Game::setLevelGenerationOptions( - LevelGenerationOptions* levelGen) { +void Game::setLevelGenerationOptions(LevelGenerationOptions* levelGen) { m_gameRules.setLevelGenerationOptions(levelGen); } @@ -441,16 +396,8 @@ const char* Game::GetGameRulesString(const std::string& key) { return m_gameRules.GetGameRulesString(key); } - - -// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to MenuController - - - - - - - +// PNG_TAG_tEXt, FromBigEndian, GetImageTextData, CreateImageTextData moved to +// MenuController std::string Game::getEntityName(eINSTANCEOF type) { switch (type) { @@ -506,12 +453,8 @@ std::string Game::getEntityName(eINSTANCEOF type) { // m_dwContentTypeA moved to DLCController - - - - -int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, - char* pSkin, char* pCape) { +int32_t Game::RegisterMojangData(char* pXuidName, PlayerUID xuid, char* pSkin, + char* pCape) { int32_t hr = 0; eXUID eTempXuid = eXUID_Undefined; MOJANG_DATA* pMojangData = nullptr; @@ -579,33 +522,12 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) { #endif - - - - - - - - - - - - - - - - - - - // DLC - - - // AUTOSAVE void Game::SetAutosaveTimerTime(void) { - int settingValue = GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); + int settingValue = + GetGameSettings(PlatformProfile.GetPrimaryPad(), eGameSetting_Autosave); m_saveManager.setAutosaveTimerTime(settingValue); } @@ -641,7 +563,8 @@ bool Game::IsLocalMultiplayerAvailable() { // #else // for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) // { - // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) || + // if( (i!=userIndex) && (PlatformInput.IsPadConnected(i) + //|| // PlatformProfile.IsSignedIn(i)) ) // { // iOtherConnectedControllers++; @@ -654,10 +577,8 @@ bool Game::IsLocalMultiplayerAvailable() { // (moved to manager class) -std::string Game::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint) { +std::string Game::getFilePath(std::uint32_t packId, std::string filename, + bool bAddDataFolder, std::string mountPoint) { std::string path = getRootPath(packId, true, bAddDataFolder, mountPoint) + filename; File f(path); @@ -689,9 +610,8 @@ std::string titleUpdateTexturePackRoot = "Windows64\\DLC\\"; std::string titleUpdateTexturePackRoot = "CU\\DLC\\"; #endif -std::string Game::getRootPath(std::uint32_t packId, - bool allowOverride, bool bAddDataFolder, - std::string mountPoint) { +std::string Game::getRootPath(std::uint32_t packId, bool allowOverride, + bool bAddDataFolder, std::string mountPoint) { std::string path = mountPoint; if (allowOverride) { switch (packId) { diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 0a68d6ae0..a67163e99 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -3,38 +3,38 @@ #include #include -#include "util/Timer.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "util/Timer.h" // using namespace std; +#include "app/common/App_structs.h" #include "app/common/ArchiveManager.h" +#include "app/common/Audio/Consoles_SoundEngine.h" #include "app/common/BannedListManager.h" -#include "app/common/DebugOptions.h" +#include "app/common/DLC/DLCManager.h" #include "app/common/DLCController.h" +#include "app/common/DebugOptions.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameSettingsManager.h" #include "app/common/IPlatformGame.h" -#include "app/common/App_structs.h" #include "app/common/LocalizationManager.h" #include "app/common/MenuController.h" #include "app/common/NetworkController.h" #include "app/common/SaveManager.h" #include "app/common/SkinManager.h" #include "app/common/TerrainFeatureManager.h" -#include "app/common/Audio/Consoles_SoundEngine.h" -#include "app/common/DLC/DLCManager.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/locale/StringTable.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" +#include "minecraft/locale/StringTable.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "platform/NetTypes.h" +#include "platform/XboxStubs.h" // JoinFromInviteData moved to NetworkController.h @@ -145,7 +145,8 @@ public: bool IsAppPaused(); void SetAppPaused(bool val); - int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, int iPad) { + int displaySavingMessage(const IPlatformStorage::ESavingMessage eMsg, + int iPad) { return m_gameSettingsManager.displaySavingMessage(eMsg, iPad); } bool GetGameStarted() { return m_bGameStarted; } @@ -169,7 +170,8 @@ public: bool LoadEnchantingMenu(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::string& name) { - return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, level, name); + return m_menuController.loadEnchantingMenu(iPad, inventory, x, y, z, + level, name); } bool LoadFurnaceMenu(int iPad, std::shared_ptr inventory, std::shared_ptr furnace) { @@ -178,7 +180,8 @@ public: bool LoadBrewingStandMenu( int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { - return m_menuController.loadBrewingStandMenu(iPad, inventory, brewingStand); + return m_menuController.loadBrewingStandMenu(iPad, inventory, + brewingStand); } bool LoadContainerMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container) { @@ -204,12 +207,14 @@ public: } bool LoadRepairingMenu(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { - return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, z); + return m_menuController.loadRepairingMenu(iPad, inventory, level, x, y, + z); } bool LoadTradingMenu(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, const std::string& name) { - return m_menuController.loadTradingMenu(iPad, inventory, trader, level, name); + return m_menuController.loadTradingMenu(iPad, inventory, trader, level, + name); } bool LoadCommandBlockMenu( @@ -227,7 +232,8 @@ public: bool LoadHorseMenu(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { - return m_menuController.loadHorseMenu(iPad, inventory, container, horse); + return m_menuController.loadHorseMenu(iPad, inventory, container, + horse); } bool LoadBeaconMenu(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { @@ -242,21 +248,31 @@ public: } static const char* GetString(int iID); - StringTable* getStringTable() const { return m_localizationManager.getStringTable(); } + StringTable* getStringTable() const { + return m_localizationManager.getStringTable(); + } eGameMode GetGameMode() { return m_eGameMode; } void SetGameMode(eGameMode eMode) { m_eGameMode = eMode; } - eXuiAction GetGlobalXuiAction() { return m_menuController.getGlobalXuiAction(); } - void SetGlobalXuiAction(eXuiAction action) { m_menuController.setGlobalXuiAction(action); } - eXuiAction GetXuiAction(int iPad) { return m_menuController.getXuiAction(iPad); } + eXuiAction GetGlobalXuiAction() { + return m_menuController.getGlobalXuiAction(); + } + void SetGlobalXuiAction(eXuiAction action) { + m_menuController.setGlobalXuiAction(action); + } + eXuiAction GetXuiAction(int iPad) { + return m_menuController.getXuiAction(iPad); + } void SetAction(int iPad, eXuiAction action, void* param = nullptr) { m_menuController.setAction(iPad, action, param); } void SetTMSAction(int iPad, eTMSAction action) { m_menuController.setTMSAction(iPad, action); } - eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); } + eTMSAction GetTMSAction(int iPad) { + return m_menuController.getTMSAction(iPad); + } eXuiServerAction GetXuiServerAction(int iPad) { return m_menuController.getXuiServerAction(iPad); } @@ -281,10 +297,16 @@ public: m_networkController.setDisconnectReason(bVal); } - bool GetChangingSessionType() { return m_networkController.getChangingSessionType(); } - void SetChangingSessionType(bool bVal) { m_networkController.setChangingSessionType(bVal); } + bool GetChangingSessionType() { + return m_networkController.getChangingSessionType(); + } + void SetChangingSessionType(bool bVal) { + m_networkController.setChangingSessionType(bVal); + } - bool GetReallyChangingSessionType() { return m_networkController.getReallyChangingSessionType(); } + bool GetReallyChangingSessionType() { + return m_networkController.getReallyChangingSessionType(); + } void SetReallyChangingSessionType(bool bVal) { m_networkController.setReallyChangingSessionType(bVal); } @@ -340,13 +362,15 @@ public: static int OldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, const int iPad) { - return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, usVersion, iPad); + return GameSettingsManager::oldProfileVersionCallback(pParam, pucData, + usVersion, iPad); } - static int DefaultOptionsCallback(void* pParam, - IPlatformProfile::PROFILESETTINGS* pSettings, - const int iPad) { - return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, iPad); + static int DefaultOptionsCallback( + void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, + const int iPad) { + return GameSettingsManager::defaultOptionsCallback(pParam, pSettings, + iPad); } int SetDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad) { @@ -376,7 +400,8 @@ public: m_skinManager.setPlayerCape(iPad, dwCapeId, GameSettingsA); } void SetPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID) { - m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, GameSettingsA); + m_skinManager.setPlayerFavoriteSkin(iPad, iIndex, uiSkinID, + GameSettingsA); } unsigned int GetPlayerFavoriteSkin(int iPad, int iIndex) { return m_skinManager.getPlayerFavoriteSkin(iPad, iIndex, GameSettingsA); @@ -427,9 +452,7 @@ public: void SetOpacityTimer(int iPad) { m_menuController.setOpacityTimer(iPad); } // 6 seconds - void TickOpacityTimer(int iPad) { - m_menuController.tickOpacityTimer(iPad); - } + void TickOpacityTimer(int iPad) { m_menuController.tickOpacityTimer(iPad); } public: std::string GetPlayerSkinName(int iPad) { @@ -449,7 +472,8 @@ public: } void CheckGameSettingsChanged(bool bOverride5MinuteTimer = false, int iPad = XUSER_INDEX_ANY) { - m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, iPad); + m_gameSettingsManager.checkGameSettingsChanged(bOverride5MinuteTimer, + iPad); } void ApplyGameSettingsChanged(int iPad) { m_gameSettingsManager.applyGameSettingsChanged(iPad); @@ -462,7 +486,8 @@ public: } unsigned int GetGameSettingsDebugMask(int iPad = -1, bool bOverridePlayer = false) { - return m_gameSettingsManager.getGameSettingsDebugMask(iPad, bOverridePlayer); + return m_gameSettingsManager.getGameSettingsDebugMask(iPad, + bOverridePlayer); } void SetGameSettingsDebugMask(int iPad, unsigned int uiVal) { m_gameSettingsManager.setGameSettingsDebugMask(iPad, uiVal); @@ -485,13 +510,15 @@ public: static int SignoutExitWorldThreadProc(void* lpParameter) { return NetworkController::signoutExitWorldThreadProc(lpParameter); } - static int PrimaryPlayerSignedOutReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult result) { - return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, result); + static int PrimaryPlayerSignedOutReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { + return NetworkController::primaryPlayerSignedOutReturned(pParam, iPad, + result); } - static int EthernetDisconnectReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult result) { - return NetworkController::ethernetDisconnectReturned(pParam, iPad, result); + static int EthernetDisconnectReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult result) { + return NetworkController::ethernetDisconnectReturned(pParam, iPad, + result); } static void ProfileReadErrorCallback(void* pParam) { NetworkController::profileReadErrorCallback(pParam); @@ -504,15 +531,20 @@ public: static void NotificationsCallback(void* pParam, std::uint32_t dwNotification, unsigned int uiParam) { - NetworkController::notificationsCallback(pParam, dwNotification, uiParam); + NetworkController::notificationsCallback(pParam, dwNotification, + uiParam); } // for the ethernet being disconnected static void LiveLinkChangeCallback(void* pParam, bool bConnected) { NetworkController::liveLinkChangeCallback(pParam, bConnected); } - bool GetLiveLinkRequired() { return m_networkController.getLiveLinkRequired(); } - void SetLiveLinkRequired(bool required) { m_networkController.setLiveLinkRequired(required); } + bool GetLiveLinkRequired() { + return m_networkController.getLiveLinkRequired(); + } + void SetLiveLinkRequired(bool required) { + m_networkController.setLiveLinkRequired(required); + } #if defined(_DEBUG_MENUS_ENABLED) bool DebugSettingsOn() { return m_debugOptions.settingsOn(); } @@ -523,11 +555,15 @@ public: #endif void SetDebugSequence(const char* pchSeq); // bool UploadFileToGlobalStorage(int iQuadrant, - // IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile ); + // IPlatformStorage::eGlobalStorage eStorageFacility, std::string *wsFile ); // Installed DLC - delegated to DLCController - bool StartInstallDLCProcess(int iPad) { return m_dlcController.startInstallDLCProcess(iPad); } - int dlcInstalledCallback(int iOfferC, int iPad) { return m_dlcController.dlcInstalledCallback(iOfferC, iPad); } + bool StartInstallDLCProcess(int iPad) { + return m_dlcController.startInstallDLCProcess(iPad); + } + int dlcInstalledCallback(int iOfferC, int iPad) { + return m_dlcController.dlcInstalledCallback(iOfferC, iPad); + } void HandleDLCLicenseChange(); int dlcMountedCallback(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask) { @@ -536,11 +572,12 @@ public: void MountNextDLC(int iPad) { m_dlcController.mountNextDLC(iPad); } void HandleDLC(DLCPack* pack) { m_dlcController.handleDLC(pack); } bool DLCInstallPending() { return m_dlcController.dlcInstallPending(); } - bool DLCInstallProcessCompleted() { return m_dlcController.dlcInstallProcessCompleted(); } + bool DLCInstallProcessCompleted() { + return m_dlcController.dlcInstallProcessCompleted(); + } void ClearDLCInstalled() { m_dlcController.clearDLCInstalled(); } - static int MarketplaceCountsCallback(void* pParam, - IPlatformStorage::DLC_TMS_DETAILS* details, - int iPad) { + static int MarketplaceCountsCallback( + void* pParam, IPlatformStorage::DLC_TMS_DETAILS* details, int iPad) { return DLCController::marketplaceCountsCallback(pParam, details, iPad); } @@ -558,9 +595,7 @@ public: virtual void StoreLaunchData(); virtual void ExitGame(); - bool isXuidNotch(PlayerUID xuid) { - return m_skinManager.isXuidNotch(xuid); - } + bool isXuidNotch(PlayerUID xuid) { return m_skinManager.isXuidNotch(xuid); } bool isXuidDeadmau5(PlayerUID xuid); void AddMemoryTextureFile(const std::string& wName, std::uint8_t* pbData, @@ -597,9 +632,7 @@ public: return m_archiveManager.getTPConfigVal(pwchDataFile); } - bool DefaultCapeExists() { - return m_skinManager.defaultCapeExists(); - } + bool DefaultCapeExists() { return m_skinManager.defaultCapeExists(); } // void InstallDefaultCape(); // attempt to install the default cape once // per game launch @@ -607,11 +640,14 @@ public: void ProcessInvite(std::uint32_t dwUserIndex, std::uint32_t dwLocalUsersMask, const INVITE_INFO* pInviteInfo) { - m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, pInviteInfo); + m_networkController.processInvite(dwUserIndex, dwLocalUsersMask, + pInviteInfo); } // Add credits for DLC installed - delegated to DLCController - void AddCreditText(const char* lpStr) { m_dlcController.addCreditText(lpStr); } + void AddCreditText(const char* lpStr) { + m_dlcController.addCreditText(lpStr); + } private: std::unordered_map m_GTS_Files; @@ -654,14 +690,16 @@ public: bool m_bTutorialMode; bool m_bIsAppPaused; - // m_bChangingSessionType and m_bReallyChangingSessionType moved to NetworkController + // m_bChangingSessionType and m_bReallyChangingSessionType moved to + // NetworkController // trial, and trying to unlock full // version on an upsell void loadMediaArchive() { m_archiveManager.loadMediaArchive(); } void loadStringTable() { - m_localizationManager.loadStringTable(m_archiveManager.getMediaArchive()); + m_localizationManager.loadStringTable( + m_archiveManager.getMediaArchive()); } public: @@ -676,10 +714,10 @@ public: } private: - static int BannedLevelDialogReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { + static int BannedLevelDialogReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::texturePackDialogReturned(pParam, iPad, result); } @@ -703,7 +741,8 @@ private: eGameMode m_eGameMode; // single or multiplayer // GameSettingsA reference alias into GameSettingsManager - GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = m_gameSettingsManager.GameSettingsA; + GAME_SETTINGS* (&GameSettingsA)[XUSER_MAX_COUNT] = + m_gameSettingsManager.GameSettingsA; // m_uiLastSignInData moved to NetworkController @@ -728,7 +767,6 @@ public: } private: - static int UnlockFullExitReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::unlockFullExitReturned(pParam, iPad, result); @@ -737,8 +775,8 @@ private: IPlatformStorage::EMessageResult result) { return MenuController::unlockFullSaveReturned(pParam, iPad, result); } - static int UnlockFullInviteReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { + static int UnlockFullInviteReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { return MenuController::unlockFullInviteReturned(pParam, iPad, result); } static int TrialOverReturned(void* pParam, int iPad, @@ -751,21 +789,25 @@ private: } static int ExitAndJoinFromInviteSaveDialogReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteSaveDialogReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteSaveDialogReturned( + pParam, iPad, result); } static int ExitAndJoinFromInviteAndSaveReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteAndSaveReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteAndSaveReturned( + pParam, iPad, result); } static int ExitAndJoinFromInviteDeclineSaveReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::exitAndJoinFromInviteDeclineSaveReturned(pParam, iPad, result); + return NetworkController::exitAndJoinFromInviteDeclineSaveReturned( + pParam, iPad, result); } - static int FatalErrorDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int FatalErrorDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return NetworkController::warningTrialTexturePackReturned(pParam, iPad, result); + return NetworkController::warningTrialTexturePackReturned(pParam, iPad, + result); } JoinFromInviteData& m_InviteData = m_networkController.m_InviteData; @@ -794,7 +836,7 @@ public: return m_localizationManager.getHTMLFontSize(size); } std::string FormatHTMLString(int iPad, const std::string& desc, - int shadowColour = 0xFFFFFFFF) { + int shadowColour = 0xFFFFFFFF) { return m_localizationManager.formatHTMLString(iPad, desc, shadowColour); } std::string GetActionReplacement(int iPad, unsigned char ucAction) { @@ -818,7 +860,8 @@ public: } static int ExitGameFromRemoteSaveDialogReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result) { - return MenuController::exitGameFromRemoteSaveDialogReturned(pParam, iPad, result); + return MenuController::exitGameFromRemoteSaveDialogReturned( + pParam, iPad, result); } // XML @@ -840,10 +883,11 @@ public: MOJANG_DATA* GetMojangDataForXuid(PlayerUID xuid); static int32_t RegisterConfigValues(char* pType, int iValue); - static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, uint64_t e, - char* f, unsigned int g, int h, + static int32_t RegisterDLCData(char* a, char* b, int c, uint64_t d, + uint64_t e, char* f, unsigned int g, int h, char* pDataFile) { - return DLCController::registerDLCData(a, b, c, d, e, f, g, h, pDataFile); + return DLCController::registerDLCData(a, b, c, d, e, f, g, h, + pDataFile); } bool GetDLCFullOfferIDForSkinID(const std::string& FirstSkin, uint64_t* pullVal) { @@ -856,8 +900,12 @@ public: return m_dlcController.getDLCInfoForFullOfferID(ullOfferID_Full); } - unsigned int GetDLCCreditsCount() { return m_dlcController.getDLCCreditsCount(); } - SCreditTextItemDef* GetDLCCredits(int iIndex) { return m_dlcController.getDLCCredits(iIndex); } + unsigned int GetDLCCreditsCount() { + return m_dlcController.getDLCCreditsCount(); + } + SCreditTextItemDef* GetDLCCredits(int iIndex) { + return m_dlcController.getDLCCredits(iIndex); + } // TMS void ReadDLCFileFromTMS(int iPad, eTMSAction action, @@ -880,11 +928,11 @@ public: // Sign-in info moved to NetworkController public: - // void OverrideFontRenderer(bool set, bool immediate = true); // void ToggleFontRenderer() { // OverrideFontRenderer(!m_bFontRendererOverridden,false); } - BANNEDLIST (&BannedListA)[XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; + BANNEDLIST (&BannedListA) + [XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; public: void SetBanListCheck(int iPad, bool bVal) { @@ -902,7 +950,8 @@ public: // m_uiOpacityCountDown moved to MenuController // DLC flags moved to DLCController // Host options - m_uiGameHostSettings moved to GameSettingsManager - unsigned int& m_uiGameHostSettings = m_gameSettingsManager.m_uiGameHostSettings; + unsigned int& m_uiGameHostSettings = + m_gameSettingsManager.m_uiGameHostSettings; #if defined(_LARGE_WORLDS) unsigned int m_GameNewWorldSize; @@ -945,13 +994,17 @@ public: // World seed from png image - delegated to MenuController void GetImageTextData(std::uint8_t* imageData, unsigned int imageBytes, unsigned char* seedText, unsigned int& uiHostOptions, - bool& bHostOptionsRead, std::uint32_t& uiTexturePack) { - m_menuController.getImageTextData(imageData, imageBytes, seedText, uiHostOptions, bHostOptionsRead, uiTexturePack); + bool& bHostOptionsRead, + std::uint32_t& uiTexturePack) { + m_menuController.getImageTextData(imageData, imageBytes, seedText, + uiHostOptions, bHostOptionsRead, + uiTexturePack); } unsigned int CreateImageTextData(std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) { - return m_menuController.createImageTextData(textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); + return m_menuController.createImageTextData( + textMetadata, seed, hasSeed, uiHostOptions, uiTexturePackId); } // Game rules @@ -979,7 +1032,8 @@ public: void UpdatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, unsigned int playerGamePrivileges) { - m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, playerGamePrivileges); + m_networkController.updatePlayerInfo(networkSmallId, playerColourIndex, + playerGamePrivileges); } short GetPlayerColour(std::uint8_t networkSmallId) { return m_networkController.getPlayerColour(networkSmallId); @@ -994,7 +1048,9 @@ public: bool bPromote = false) { return m_dlcController.addDLCRequest(eContentType, bPromote); } - bool RetrieveNextDLCContent() { return m_dlcController.retrieveNextDLCContent(); } + bool RetrieveNextDLCContent() { + return m_dlcController.retrieveNextDLCContent(); + } bool CheckTMSDLCCanStop() { return m_dlcController.checkTMSDLCCanStop(); } int dlcOffersReturned(int iOfferC, std::uint32_t dwType, int iPad) { return m_dlcController.dlcOffersReturned(iOfferC, dwType, iPad); @@ -1010,26 +1066,45 @@ public: return m_dlcController.dlcContentRetrieved(eType); } void TickDLCOffersRetrieved() { m_dlcController.tickDLCOffersRetrieved(); } - void ClearAndResetDLCDownloadQueue() { m_dlcController.clearAndResetDLCDownloadQueue(); } - bool RetrieveNextTMSPPContent() { return m_dlcController.retrieveNextTMSPPContent(); } - void TickTMSPPFilesRetrieved() { m_dlcController.tickTMSPPFilesRetrieved(); } - void ClearTMSPPFilesRetrieved() { m_dlcController.clearTMSPPFilesRetrieved(); } + void ClearAndResetDLCDownloadQueue() { + m_dlcController.clearAndResetDLCDownloadQueue(); + } + bool RetrieveNextTMSPPContent() { + return m_dlcController.retrieveNextTMSPPContent(); + } + void TickTMSPPFilesRetrieved() { + m_dlcController.tickTMSPPFilesRetrieved(); + } + void ClearTMSPPFilesRetrieved() { + m_dlcController.clearTMSPPFilesRetrieved(); + } unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote = false) { return m_dlcController.addTMSPPFileTypeRequest(eType, bPromote); } - int GetDLCInfoTexturesOffersCount() { return m_dlcController.getDLCInfoTexturesOffersCount(); } + int GetDLCInfoTexturesOffersCount() { + return m_dlcController.getDLCInfoTexturesOffersCount(); + } static int TMSPPFileReturned(void* pParam, int iPad, int iUserData, IPlatformStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { - return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, pFileData, szFilename); + return DLCController::tmsPPFileReturned(pParam, iPad, iUserData, + pFileData, szFilename); + } + DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { + return m_dlcController.getDLCInfoTrialOffer(iIndex); + } + DLC_INFO* GetDLCInfoFullOffer(int iIndex) { + return m_dlcController.getDLCInfoFullOffer(iIndex); } - DLC_INFO* GetDLCInfoTrialOffer(int iIndex) { return m_dlcController.getDLCInfoTrialOffer(iIndex); } - DLC_INFO* GetDLCInfoFullOffer(int iIndex) { return m_dlcController.getDLCInfoFullOffer(iIndex); } - int GetDLCInfoTrialOffersCount() { return m_dlcController.getDLCInfoTrialOffersCount(); } - int GetDLCInfoFullOffersCount() { return m_dlcController.getDLCInfoFullOffersCount(); } + int GetDLCInfoTrialOffersCount() { + return m_dlcController.getDLCInfoTrialOffersCount(); + } + int GetDLCInfoFullOffersCount() { + return m_dlcController.getDLCInfoFullOffersCount(); + } bool GetDLCFullOfferIDForPackID(const int iPackID, uint64_t* pullVal) { return m_dlcController.getDLCFullOfferIDForPackID(iPackID, pullVal); } @@ -1046,8 +1121,10 @@ public: // Download status members moved to DLCController bool m_bCorruptSaveDeleted; - std::uint8_t*& m_pBannedListFileBuffer = m_bannedListManager.m_pBannedListFileBuffer; - unsigned int& m_dwBannedListFileSize = m_bannedListManager.m_dwBannedListFileSize; + std::uint8_t*& m_pBannedListFileBuffer = + m_bannedListManager.m_pBannedListFileBuffer; + unsigned int& m_dwBannedListFileSize = + m_bannedListManager.m_dwBannedListFileSize; public: unsigned int& m_dwDLCFileSize = m_dlcController.m_dwDLCFileSize; @@ -1094,8 +1171,7 @@ public: int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) override = 0; void FreeLocalTMSFiles(eTMSFileType eType) override = 0; - int GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, + int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, eFileExtensionType eEXT) override = 0; virtual bool GetTMSGlobalFileListRead() { return true; } @@ -1132,7 +1208,9 @@ private: // 4J-PB - language and locale functions public: - void LocaleAndLanguageInit() { m_localizationManager.localeAndLanguageInit(); } + void LocaleAndLanguageInit() { + m_localizationManager.localeAndLanguageInit(); + } void getLocale(std::vector& vecWstrLocales) { m_localizationManager.getLocale(vecWstrLocales); } @@ -1143,15 +1221,17 @@ public: return m_localizationManager.get_xcLang(pwchLocale); } - void SetTickTMSDLCFiles(bool bVal) { m_dlcController.setTickTMSDLCFiles(bVal); } + void SetTickTMSDLCFiles(bool bVal) { + m_dlcController.setTickTMSDLCFiles(bVal); + } std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder, - std::string mountPoint = "TPACK:"); + bool bAddDataFolder, + std::string mountPoint = "TPACK:"); private: std::string getRootPath(std::uint32_t packId, bool allowOverride, - bool bAddDataFolder, std::string mountPoint); + bool bAddDataFolder, std::string mountPoint); public: #if defined(_WINDOWS64) @@ -1161,6 +1241,5 @@ public: #endif }; - // singleton // extern CMinecraftApp app; \ No newline at end of file diff --git a/targets/app/common/GameMenuService.cpp b/targets/app/common/GameMenuService.cpp index a264ed789..7ed1b82c1 100644 --- a/targets/app/common/GameMenuService.cpp +++ b/targets/app/common/GameMenuService.cpp @@ -2,57 +2,88 @@ #include "app/common/Game.h" -bool GameMenuService::openInventory(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openInventory(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadInventoryMenu(iPad, player, navigateBack); } -bool GameMenuService::openCreative(int iPad, std::shared_ptr player, bool navigateBack) { +bool GameMenuService::openCreative(int iPad, + std::shared_ptr player, + bool navigateBack) { return game_.LoadCreativeMenu(iPad, player, navigateBack); } -bool GameMenuService::openCrafting2x2(int iPad, std::shared_ptr player) { +bool GameMenuService::openCrafting2x2(int iPad, + std::shared_ptr player) { return game_.LoadCrafting2x2Menu(iPad, player); } -bool GameMenuService::openCrafting3x3(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openCrafting3x3(int iPad, + std::shared_ptr player, + int x, int y, int z) { return game_.LoadCrafting3x3Menu(iPad, player, x, y, z); } -bool GameMenuService::openEnchanting(int iPad, std::shared_ptr inventory, int x, int y, int z, Level* level, const std::string& name) { +bool GameMenuService::openEnchanting(int iPad, + std::shared_ptr inventory, + int x, int y, int z, Level* level, + const std::string& name) { return game_.LoadEnchantingMenu(iPad, inventory, x, y, z, level, name); } -bool GameMenuService::openFurnace(int iPad, std::shared_ptr inventory, std::shared_ptr furnace) { +bool GameMenuService::openFurnace(int iPad, + std::shared_ptr inventory, + std::shared_ptr furnace) { return game_.LoadFurnaceMenu(iPad, inventory, furnace); } -bool GameMenuService::openBrewingStand(int iPad, std::shared_ptr inventory, std::shared_ptr brewingStand) { +bool GameMenuService::openBrewingStand( + int iPad, std::shared_ptr inventory, + std::shared_ptr brewingStand) { return game_.LoadBrewingStandMenu(iPad, inventory, brewingStand); } -bool GameMenuService::openContainer(int iPad, std::shared_ptr inventory, std::shared_ptr container) { +bool GameMenuService::openContainer(int iPad, + std::shared_ptr inventory, + std::shared_ptr container) { return game_.LoadContainerMenu(iPad, inventory, container); } -bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, std::shared_ptr trap) { +bool GameMenuService::openTrap(int iPad, std::shared_ptr inventory, + std::shared_ptr trap) { return game_.LoadTrapMenu(iPad, inventory, trap); } -bool GameMenuService::openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) { +bool GameMenuService::openFireworks(int iPad, + std::shared_ptr player, int x, + int y, int z) { return game_.LoadFireworksMenu(iPad, player, x, y, z); } bool GameMenuService::openSign(int iPad, std::shared_ptr sign) { return game_.LoadSignEntryMenu(iPad, sign); } -bool GameMenuService::openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) { +bool GameMenuService::openRepairing(int iPad, + std::shared_ptr inventory, + Level* level, int x, int y, int z) { return game_.LoadRepairingMenu(iPad, inventory, level, x, y, z); } -bool GameMenuService::openTrading(int iPad, std::shared_ptr inventory, std::shared_ptr trader, Level* level, const std::string& name) { +bool GameMenuService::openTrading(int iPad, + std::shared_ptr inventory, + std::shared_ptr trader, + Level* level, const std::string& name) { return game_.LoadTradingMenu(iPad, inventory, trader, level, name); } -bool GameMenuService::openCommandBlock(int iPad, std::shared_ptr commandBlock) { +bool GameMenuService::openCommandBlock( + int iPad, std::shared_ptr commandBlock) { return game_.LoadCommandBlockMenu(iPad, commandBlock); } -bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopper(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHopperMinecart(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) { +bool GameMenuService::openHopperMinecart( + int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) { return game_.LoadHopperMenu(iPad, inventory, hopper); } -bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) { +bool GameMenuService::openHorse(int iPad, std::shared_ptr inventory, + std::shared_ptr container, + std::shared_ptr horse) { return game_.LoadHorseMenu(iPad, inventory, container, horse); } -bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, std::shared_ptr beacon) { +bool GameMenuService::openBeacon(int iPad, std::shared_ptr inventory, + std::shared_ptr beacon) { return game_.LoadBeaconMenu(iPad, inventory, beacon); } diff --git a/targets/app/common/GameMenuService.h b/targets/app/common/GameMenuService.h index a864deb6e..744f38544 100644 --- a/targets/app/common/GameMenuService.h +++ b/targets/app/common/GameMenuService.h @@ -40,9 +40,8 @@ public: int iPad, std::shared_ptr commandBlock) override; bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) override; - bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) override; + bool openHopperMinecart(int iPad, std::shared_ptr inventory, + std::shared_ptr hopper) override; bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) override; diff --git a/targets/app/common/GameRules/ConsoleGameRules.h b/targets/app/common/GameRules/ConsoleGameRules.h index a4c57d938..6f27b83d1 100644 --- a/targets/app/common/GameRules/ConsoleGameRules.h +++ b/targets/app/common/GameRules/ConsoleGameRules.h @@ -5,7 +5,6 @@ #include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" @@ -16,10 +15,11 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index a090c4dcb..af49ff1c6 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -13,20 +13,20 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "strings.h" const char* GameRuleManager::wchTagNameA[] = { diff --git a/targets/app/common/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h index dc660f6a7..7f3020851 100644 --- a/targets/app/common/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -8,9 +8,9 @@ #include #include "app/common/DLC/DLCGameRulesHeader.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class LevelGenerationOptions; class RootGameRulesDefinition; diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 2de23bbf0..3ace1743e 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -4,16 +4,16 @@ #include #include "ConsoleSchematicFile.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/phys/AABB.h" +#include "util/StringHelpers.h" ApplySchematicRuleDefinition::ApplySchematicRuleDefinition( LevelGenerationOptions* levelGenOptions) { diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index f6984daf0..5886fb321 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,10 +1,10 @@ #include "BiomeOverride.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" BiomeOverride::BiomeOverride() { m_tile = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 15bd9823a..2ceeb4e76 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,20 +4,20 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Direction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" +#include "util/StringHelpers.h" ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { m_x = m_y = m_z = 0; @@ -77,8 +77,8 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream* dos, dos->writeUTF(toWString(m_dimension)); } -void ConsoleGenerateStructure::addAttribute( - const std::string& attributeName, const std::string& attributeValue) { +void ConsoleGenerateStructure::addAttribute(const std::string& attributeName, + const std::string& attributeValue) { if (attributeName.compare("x") == 0) { int value = fromWString(attributeValue); m_x = value; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp index df109f509..ccac746a8 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp @@ -9,7 +9,6 @@ #include #include "app/linux/LinuxGame.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/Class.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -21,6 +20,7 @@ #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/chunk/LevelChunk.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" @@ -749,9 +749,9 @@ void ConsoleSchematicFile::generateSchematicFile( bool mobCanBeSaved = false; if (bSaveMobs) { - if (e->instanceof(eTYPE_MONSTER) || - e->instanceof(eTYPE_WATERANIMAL) || - e->instanceof(eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) + if (e->instanceof (eTYPE_MONSTER) || e->instanceof + (eTYPE_WATERANIMAL) || e->instanceof + (eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) // 4J-JEV: All these are derived from eTYPE_ANIMAL and true // implicitly. @@ -765,8 +765,9 @@ void ConsoleSchematicFile::generateSchematicFile( // 4J-JEV: Changed to check for instances of minecarts and // hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and // eTYPE_MINECART - if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || - e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY)) { + if (mobCanBeSaved || e->instanceof + (eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof + (eTYPE_HANGING_ENTITY)) { CompoundTag* eTag = new CompoundTag(); if (e->save(eTag)) { ListTag* pos = @@ -776,7 +777,7 @@ void ConsoleSchematicFile::generateSchematicFile( pos->get(1)->data -= yStart; pos->get(2)->data -= zStart; - if (e->instanceof(eTYPE_HANGING_ENTITY)) { + if (e->instanceof (eTYPE_HANGING_ENTITY)) { ((IntTag*)eTag->get("TileX"))->data -= xStart; ((IntTag*)eTag->get("TileY"))->data -= yStart; ((IntTag*)eTag->get("TileZ"))->data -= zStart; diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h index bfc5c0cae..e51e3d46e 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -14,7 +14,6 @@ #include #include "minecraft/XuiActionPayload.h" - #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index a68e1de49..d92c82e0f 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -6,7 +6,6 @@ #include #include -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" @@ -16,14 +15,15 @@ #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/locale/StringTable.h" #include "app/linux/LinuxGame.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/GameEnums.h" #include "minecraft/Pos.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -440,8 +440,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile( auto it = m_schematics.find(filename); if (it != m_schematics.end()) { #if !defined(_CONTENT_PACKAGE) - printf("We have already loaded schematic file %s\n", - filename.c_str()); + printf("We have already loaded schematic file %s\n", filename.c_str()); #endif it->second->incrementRefCount(); return it->second; @@ -470,8 +469,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile( return schematic; } -void LevelGenerationOptions::releaseSchematicFile( - const std::string& filename) { +void LevelGenerationOptions::releaseSchematicFile(const std::string& filename) { // 4J Stu - We don't want to delete them when done, but probably want to // keep a set of active schematics for the current world // auto it = m_schematics.find(filename); @@ -627,7 +625,8 @@ int LevelGenerationOptions::onPackMounted(int iPad, uint32_t dwErr, uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; auto readResult = PlatformFilesystem.readFile( save.getPath(), pbData, dwFileSize); - if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { + if (readResult.status != + IPlatformFilesystem::ReadStatus::Ok) { app.FatalLoadError(); } diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index d18b6a1d0..76299849d 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,10 +1,10 @@ #include "StartFeature.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" StartFeature::StartFeature() { m_chunkX = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index f778e2098..5cf0fdeda 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,12 +1,12 @@ #include "XboxStructureActionGenerateBox.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" +#include "util/StringHelpers.h" XboxStructureActionGenerateBox::XboxStructureActionGenerateBox() { m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h index 751d87c21..e6da1f4f3 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h @@ -1,8 +1,8 @@ #pragma once #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index e564b421b..34299492b 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,12 +1,12 @@ #include "XboxStructureActionPlaceBlock.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" +#include "util/StringHelpers.h" XboxStructureActionPlaceBlock::XboxStructureActionPlaceBlock() { m_x = m_y = m_z = m_tile = m_data = 0; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h index 8ae640e6d..7745a3039 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h @@ -1,8 +1,8 @@ #pragma once #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 04e5676bc..68d512003 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,17 +4,17 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/world/Container.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "util/StringHelpers.h" XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() { m_tile = Tile::chest_Id; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h index 5f002ed9a..790311c51 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AddItemRuleDefinition; class StructurePiece; diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp index c950aad2f..7d6770857 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.cpp @@ -4,9 +4,9 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/level/levelgen/structure/StructurePiece.h" @@ -33,9 +33,8 @@ void XboxStructureActionPlaceSpawner::addAttribute( if (attributeName.compare("entity") == 0) { m_entityId = attributeValue; #ifndef _CONTENT_PACKAGE - printf( - "XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n", - m_entityId.c_str()); + printf("XboxStructureActionPlaceSpawner: Adding parameter entity=%s\n", + m_entityId.c_str()); #endif } else { XboxStructureActionPlaceBlock::addAttribute(attributeName, diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h index be54cdec1..8b5304a57 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "XboxStructureActionPlaceBlock.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class StructurePiece; class Level; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 47f31dba2..4d089fc17 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,10 +3,7 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" @@ -14,6 +11,9 @@ #include "minecraft/world/item/enchantment/Enchantment.h" #include "minecraft/world/item/enchantment/EnchantmentCategory.h" #include "minecraft/world/item/enchantment/EnchantmentInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition() { m_enchantmentId = m_enchantmentLevel = 0; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h index ff4e002b5..5ef3b0e89 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class ItemInstance; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp index 999de21a9..f6b77869f 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.cpp @@ -3,14 +3,14 @@ #include #include "AddEnchantmentRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" AddItemRuleDefinition::AddItemRuleDefinition() { m_itemId = m_quantity = m_auxValue = m_dataTag = 0; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h index 5c412ffed..e3b214884 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class Container; class AddEnchantmentRuleDefinition; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 51df8ccc2..3fe6282c6 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,15 +1,15 @@ #include "CollectItemRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRule.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" +#include "util/StringHelpers.h" CollectItemRuleDefinition::CollectItemRuleDefinition() { m_itemId = 0; @@ -111,8 +111,7 @@ std::string CollectItemRuleDefinition::generateXml( "\" quantity=\"SET\" descriptionName=\"OPTIONAL\" " "promptName=\"OPTIONAL\""; if (item->getAuxValue() != 0) - xml += - " auxValue=\"" + toWString(item->getAuxValue()) + "\""; + xml += " auxValue=\"" + toWString(item->getAuxValue()) + "\""; if (item->get4JData() != 0) xml += " dataTag=\"" + toWString(item->get4JData()) + "\""; xml += "/>\n"; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h index 2e35806d6..ee8251192 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index eab1737a4..c8431003b 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -5,12 +5,12 @@ #include #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRule.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" +#include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" void CompleteAllRuleDefinition::getChildren( std::vector* children) { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h index 9905aa7d7..ee100f28a 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h @@ -25,8 +25,8 @@ public: virtual bool onCollectItem(GameRule* rule, std::shared_ptr item); - static std::string generateDescriptionString( - const std::string& description, void* data, int dataLength); + static std::string generateDescriptionString(const std::string& description, + void* data, int dataLength); private: void updateStatus(GameRule* rule); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp index a65ca3217..9a64816da 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.cpp @@ -7,13 +7,13 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h index 9227ba184..8f73b67dd 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" class CompoundGameRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index b5e3b8489..ea42d5261 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -8,14 +8,14 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" class Connection; @@ -66,7 +66,7 @@ GameRuleDefinition* GameRuleDefinition::addChild( ConsoleGameRules::EGameRuleType ruleType) { #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Attempted to add invalid child rule - %d\n", - ruleType); + ruleType); #endif return nullptr; } @@ -77,13 +77,13 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName, m_descriptionId = attributeValue; #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Adding parameter descriptionId=%s\n", - m_descriptionId.c_str()); + m_descriptionId.c_str()); #endif } else if (attributeName.compare("promptName") == 0) { m_promptId = attributeValue; #ifndef _CONTENT_PACKAGE printf("GameRuleDefinition: Adding parameter m_promptId=%s\n", - m_promptId.c_str()); + m_promptId.c_str()); #endif } else if (attributeName.compare("dataTag") == 0) { m_4JDataValue = fromWString(attributeValue); @@ -92,9 +92,8 @@ void GameRuleDefinition::addAttribute(const std::string& attributeName, m_4JDataValue); } else { #ifndef _CONTENT_PACKAGE - printf( - "GameRuleDefinition: Attempted to add invalid attribute: %s\n", - attributeName.c_str()); + printf("GameRuleDefinition: Attempted to add invalid attribute: %s\n", + attributeName.c_str()); #endif } } diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp index 9f9a2a2ec..67342dfe7 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.cpp @@ -1,9 +1,9 @@ #include "LevelRuleset.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h" #include "minecraft/locale/StringTable.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class AABB; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 80038ff79..456bc4e48 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,11 +2,11 @@ #include +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" NamedAreaRuleDefinition::NamedAreaRuleDefinition() { m_name = ""; @@ -41,7 +41,7 @@ void NamedAreaRuleDefinition::addAttribute(const std::string& attributeName, m_name = attributeValue; #ifndef _CONTENT_PACKAGE printf("NamedAreaRuleDefinition: Adding parameter name=%s\n", - m_name.c_str()); + m_name.c_str()); #endif } else if (attributeName.compare("x0") == 0) { m_area.x0 = fromWString(attributeValue); diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h index 2c90d7479..7bac12e77 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.h @@ -2,8 +2,8 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" class NamedAreaRuleDefinition : public GameRuleDefinition { diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index f4a128cd0..b29b7911d 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,16 +4,16 @@ #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Pos.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodData.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "util/StringHelpers.h" UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() { m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h index eb25a6256..5e4eb68cf 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class AddItemRuleDefinition; class Pos; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index 3cfd9e224..b29ab5797 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,10 +1,10 @@ #include "UseTileRuleDefinition.h" +#include "app/linux/LinuxGame.h" +#include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "app/linux/LinuxGame.h" #include "util/StringHelpers.h" -#include "java/InputOutputStream/DataOutputStream.h" UseTileRuleDefinition::UseTileRuleDefinition() { m_tileId = -1; diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h index 998786837..8e9f6872d 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.h @@ -3,9 +3,9 @@ #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/Pos.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class UseTileRuleDefinition : public GameRuleDefinition { private: diff --git a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp index fa035db9e..77e58f556 100644 --- a/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp +++ b/targets/app/common/GameRules/LevelRules/Rules/GameRule.cpp @@ -8,9 +8,9 @@ #include #include -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" class Connection; class ItemInstance; @@ -32,15 +32,14 @@ GameRule::ValueType GameRule::getParameter(const std::string& parameterName) { if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE printf("WARNING: Parameter %s was not set before being fetched\n", - parameterName.c_str()); + parameterName.c_str()); assert(0); #endif } return m_parameters[parameterName]; } -void GameRule::setParameter(const std::string& parameterName, - ValueType value) { +void GameRule::setParameter(const std::string& parameterName, ValueType value) { if (m_parameters.find(parameterName) == m_parameters.end()) { #ifndef _CONTENT_PACKAGE printf("Adding parameter %s to GameRule\n", parameterName.c_str()); diff --git a/targets/app/common/GameSettingsManager.h b/targets/app/common/GameSettingsManager.h index 293969b20..bad5dfbf9 100644 --- a/targets/app/common/GameSettingsManager.h +++ b/targets/app/common/GameSettingsManager.h @@ -3,8 +3,8 @@ #include #include "app/common/App_structs.h" -#include "platform/profile/profile.h" #include "platform/XboxStubs.h" +#include "platform/profile/profile.h" class GameSettingsManager { public: @@ -14,9 +14,9 @@ public: static int oldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, const int iPad); - static int defaultOptionsCallback(void* pParam, - IPlatformProfile::PROFILESETTINGS* pSettings, - const int iPad); + static int defaultOptionsCallback( + void* pParam, IPlatformProfile::PROFILESETTINGS* pSettings, + const int iPad); int setDefaultOptions(IPlatformProfile::PROFILESETTINGS* pSettings, const int iPad); @@ -64,7 +64,8 @@ public: static void setActionConfirmed(void* param); // Saving message - int displaySavingMessage(const IPlatformStorage::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 9dba39495..673e52980 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -1,9 +1,8 @@ -#include "minecraft/GameTypes.h" +#include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,6 +10,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/ProgressRenderer.h" @@ -25,13 +25,13 @@ #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "util/StringHelpers.h" -#include "app/common/Audio/SoundEngine.h" void Game::HandleXuiActions(void) { eXuiAction eAction; @@ -215,8 +215,8 @@ void Game::HandleXuiActions(void) { // app.CloseAllPlayersXuiScenes(); // Hide the other players scenes - ui.ShowOtherPlayersBaseScene(PlatformProfile.GetPrimaryPad(), - false); + ui.ShowOtherPlayersBaseScene( + PlatformProfile.GetPrimaryPad(), false); // This just allows it to be shown if (pMinecraft @@ -1148,7 +1148,8 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_SetDefaultOptions: SetAction(i, eAppAction_Idle); - SetDefaultOptions((IPlatformProfile::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 @@ -1211,10 +1212,11 @@ void Game::HandleXuiActions(void) { case eAppAction_FailedToJoinNoPrivileges: { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - IPlatformStorage::EMessageResult result = ui.RequestErrorMessage( - IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, - IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, - PlatformProfile.GetPrimaryPad()); + IPlatformStorage::EMessageResult result = + ui.RequestErrorMessage( + IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, + IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA, 1, + PlatformProfile.GetPrimaryPad()); if (result != IPlatformStorage::EMessage_Busy) SetAction(i, eAppAction_Idle); } break; @@ -1282,9 +1284,7 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_DebugText: // launch the xui for text entry - { - SetAction(i, eAppAction_Idle); - } + { SetAction(i, eAppAction_Idle); } break; case eAppAction_ReloadTexturePack: { diff --git a/targets/app/common/IPlatformGame.h b/targets/app/common/IPlatformGame.h index 033c3c26e..5ded22b07 100644 --- a/targets/app/common/IPlatformGame.h +++ b/targets/app/common/IPlatformGame.h @@ -21,8 +21,7 @@ public: bool bCallback = false) = 0; virtual int LoadLocalTMSFile(char* wchTMSFile) = 0; - virtual int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) = 0; + virtual int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) = 0; virtual void FreeLocalTMSFiles(eTMSFileType eType) = 0; virtual int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, diff --git a/targets/app/common/Leaderboards/IPlatformLeaderboard.h b/targets/app/common/Leaderboards/IPlatformLeaderboard.h index f0f164ba9..cc800f317 100644 --- a/targets/app/common/Leaderboards/IPlatformLeaderboard.h +++ b/targets/app/common/Leaderboards/IPlatformLeaderboard.h @@ -166,8 +166,7 @@ public: unsigned int readCount) = 0; virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int readCount) = 0; + PlayerUID myUID, unsigned int readCount) = 0; virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, EStatsType type, unsigned int startIndex, diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.h b/targets/app/common/Leaderboards/LeaderboardInterface.h index 0b689ba0a..4931ed643 100644 --- a/targets/app/common/Leaderboards/LeaderboardInterface.h +++ b/targets/app/common/Leaderboards/LeaderboardInterface.h @@ -1,7 +1,7 @@ #pragma once -#include "platform/PlatformTypes.h" #include "LeaderboardManager.h" +#include "platform/PlatformTypes.h" // 4J-JEV: Simple interface for handling ReadStat failures. class LeaderboardInterface { @@ -23,11 +23,12 @@ public: ~LeaderboardInterface(); void ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int startIndex, unsigned int readCount); - void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, + IPlatformLeaderboard::EStatsType type, + PlayerUID myUID, unsigned int startIndex, unsigned int readCount); + void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, + IPlatformLeaderboard::EStatsType type, + PlayerUID myUID, unsigned int readCount); void ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, IPlatformLeaderboard::EStatsType type, unsigned int startIndex, unsigned int readCount); diff --git a/targets/app/common/Leaderboards/LeaderboardManager.cpp b/targets/app/common/Leaderboards/LeaderboardManager.cpp index 894293a8f..49aa9825c 100644 --- a/targets/app/common/Leaderboards/LeaderboardManager.cpp +++ b/targets/app/common/Leaderboards/LeaderboardManager.cpp @@ -83,8 +83,7 @@ void LeaderboardManager::printStats(ReadView& view) { for (unsigned int i = 0; i < view.m_numQueries; i++) { ReadScore score = view.m_queries[i]; - app.DebugPrintf("\tname='%s'\n", - score.m_name.c_str()); + app.DebugPrintf("\tname='%s'\n", score.m_name.c_str()); app.DebugPrintf("\trank='%i'\n", score.m_rank); app.DebugPrintf("\tstatsData=["); diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/app/common/Localisation/StringTable.cpp index e0e1bcae7..90789035f 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/app/common/Localisation/StringTable.cpp @@ -38,7 +38,7 @@ void StringTable::ProcessStringTableData(void) { langSizeMap.push_back( std::vector >::value_type(langId, - langSize)); + langSize)); } std::vector locales; diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index c4b975d5e..1e78ed248 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -6,24 +6,23 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" -#include "minecraft/locale/StringTable.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/locale/StringTable.h" +#include "platform/XboxStubs.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" -#include "platform/XboxStubs.h" #include "strings.h" #include "util/StringHelpers.h" -int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { - 20, 13, 20, 26}; +int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {20, 13, 20, 26}; TIPSTRUCT LocalizationManager::m_GameTipA[MAX_TIPS_GAMETIP] = { {0, IDS_TIPS_GAMETIP_1}, {0, IDS_TIPS_GAMETIP_2}, @@ -77,8 +76,7 @@ void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { } std::string localisationFile = "languages.loc"; if (mediaArchive->hasFile(localisationFile)) { - std::vector locFile = - mediaArchive->getFile(localisationFile); + std::vector locFile = mediaArchive->getFile(localisationFile); m_stringTable = new StringTable(locFile.data(), locFile.size()); } else { m_stringTable = nullptr; @@ -345,8 +343,8 @@ std::string LocalizationManager::formatHTMLString( return text; } -std::string LocalizationManager::getActionReplacement( - int iPad, unsigned char ucAction) { +std::string LocalizationManager::getActionReplacement(int iPad, + unsigned char ucAction) { unsigned int input = PlatformInput.GetGameJoypadMaps( PlatformInput.GetJoypadMapVal(iPad), ucAction); @@ -505,8 +503,7 @@ std::string LocalizationManager::getIconReplacement(unsigned int uiIcon) { return result; } -void LocalizationManager::getLocale( - std::vector& vecWstrLocales) { +void LocalizationManager::getLocale(std::vector& vecWstrLocales) { std::vector locales; const unsigned int systemLanguage = XGetLanguage(); diff --git a/targets/app/common/LocalizationManager.h b/targets/app/common/LocalizationManager.h index d84689f75..920ba4c11 100644 --- a/targets/app/common/LocalizationManager.h +++ b/targets/app/common/LocalizationManager.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" #include "platform/XboxStubs.h" class ArchiveFile; @@ -22,7 +22,7 @@ public: const char* getString(int iID) const; std::string formatHTMLString(int iPad, const std::string& desc, - int shadowColour = 0xFFFFFFFF); + int shadowColour = 0xFFFFFFFF); std::string getActionReplacement(int iPad, unsigned char ucAction); std::string getVKReplacement(unsigned int uiVKey); std::string getIconReplacement(unsigned int uiIcon); diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 0aafa2219..2c5f6c323 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -1,5 +1,10 @@ #include "app/common/MenuController.h" +#include +#include +#include +#include + #include "app/common/Game.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -8,24 +13,19 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" -#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #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/profile/profile.h" #include "platform/storage/storage.h" -#include -#include -#include -#include - unsigned char MenuController::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; MenuController::MenuController() { @@ -273,9 +273,9 @@ bool MenuController::loadContainerMenu(int iPad, return success; } -bool MenuController::loadTrapMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr trap) { +bool MenuController::loadTrapMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr trap) { bool success = true; TrapScreenInput* initData = new TrapScreenInput(); @@ -294,8 +294,8 @@ bool MenuController::loadTrapMenu( return success; } -bool MenuController::loadSignEntryMenu( - int iPad, std::shared_ptr sign) { +bool MenuController::loadSignEntryMenu(int iPad, + std::shared_ptr sign) { bool success = true; SignEntryScreenInput* initData = new SignEntryScreenInput(); @@ -352,9 +352,9 @@ bool MenuController::loadTradingMenu(int iPad, return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -371,9 +371,9 @@ bool MenuController::loadHopperMenu( return success; } -bool MenuController::loadHopperMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) { +bool MenuController::loadHopperMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) { bool success = true; HopperScreenInput* initData = new HopperScreenInput(); @@ -411,9 +411,9 @@ bool MenuController::loadHorseMenu(int iPad, return success; } -bool MenuController::loadBeaconMenu( - int iPad, std::shared_ptr inventory, - std::shared_ptr beacon) { +bool MenuController::loadBeaconMenu(int iPad, + std::shared_ptr inventory, + std::shared_ptr beacon) { bool success = true; BeaconScreenInput* initData = new BeaconScreenInput(); @@ -633,9 +633,10 @@ void MenuController::getImageTextData(std::uint8_t* imageData, return; } -unsigned int MenuController::createImageTextData( - std::uint8_t* textMetadata, int64_t seed, bool hasSeed, - unsigned int uiHostOptions, unsigned int uiTexturePackId) { +unsigned int MenuController::createImageTextData(std::uint8_t* textMetadata, + int64_t seed, bool hasSeed, + unsigned int uiHostOptions, + unsigned int uiTexturePackId) { int iTextMetadataBytes = 0; if (hasSeed) { strcpy((char*)textMetadata, "4J_SEED"); diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index 626824520..fbaaa0071 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -6,8 +6,8 @@ #include "app/common/App_structs.h" #include "minecraft/XuiActionPayload.h" -#include "platform/storage/storage.h" #include "platform/XboxStubs.h" +#include "platform/storage/storage.h" class Player; class Inventory; @@ -49,8 +49,8 @@ public: bool loadCrafting2x2Menu(int iPad, std::shared_ptr player); bool loadCrafting3x3Menu(int iPad, std::shared_ptr player, int x, int y, int z); - bool loadFireworksMenu(int iPad, std::shared_ptr player, - int x, int y, int z); + bool loadFireworksMenu(int iPad, std::shared_ptr player, int x, + int y, int z); bool loadSignEntryMenu(int iPad, std::shared_ptr sign); bool loadRepairingMenu(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z); @@ -97,18 +97,18 @@ public: eTMSAction getTMSAction(int iPad) { return m_eTMSAction[iPad]; } // Dialog callbacks - static int texturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int fatalErrorDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int texturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int fatalErrorDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int trialOverReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullExitReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int unlockFullSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int unlockFullInviteReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int unlockFullInviteReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); // Remote save static int remoteSaveThreadProc(void* lpParameter); diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 9fe851b20..d1f308480 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -9,27 +9,17 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" +#include "Socket.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/PlatformNetworkManagerStub.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "Socket.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" @@ -42,16 +32,26 @@ #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/crafting/FireworksRecipe.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/XboxStubs.h" +#include "platform/fs/fs.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" +#include "util/StringHelpers.h" class FriendSessionInfo; class INVITE_INFO; @@ -407,8 +407,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, // Open the socket on the server end to accept incoming data Socket::addIncomingSocket(socket); - connection->send(std::shared_ptr(new PreLoginPacket( - PlatformProfile.GetGamertag(idx)))); + connection->send(std::shared_ptr( + new PreLoginPacket(PlatformProfile.GetGamertag(idx)))); createdConnections.push_back(connection); @@ -626,8 +626,8 @@ void CGameNetworkManager::SetSessionsUpdatedCallback( void CGameNetworkManager::GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) { - s_pPlatformNetworkManager->GetFullFriendSessionInfo( - foundSession, std::move(callback)); + s_pPlatformNetworkManager->GetFullFriendSessionInfo(foundSession, + std::move(callback)); } void CGameNetworkManager::ForceFriendsSessionRefresh() { @@ -723,8 +723,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, Minecraft::GetInstance()->clearConnectionFailed(); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( iPad, // dwUserIndex @@ -824,7 +825,8 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) { } } - C4JThread::setThreadName(static_cast(-1), "Minecraft Server thread"); + C4JThread::setThreadName(static_cast(-1), + "Minecraft Server thread"); Compression::UseDefaultThreadStorage(); OldChunkStorage::UseDefaultThreadStorage(); Entity::useSmallIds(); @@ -1247,7 +1249,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { void CGameNetworkManager::PlayerLeaving(INetworkPlayer* pNetworkPlayer) { if (pNetworkPlayer->IsLocal()) { PlatformProfile.SetCurrentGameActivity(pNetworkPlayer->GetUserIndex(), - CONTEXT_PRESENCE_IDLE, false); + CONTEXT_PRESENCE_IDLE, false); } } @@ -1290,8 +1292,9 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, bool bContentRestricted = false; bool pccAllowed = true; bool pccFriendsAllowed = true; - PlatformProfile.AllowedPlayerCreatedContent( - PlatformProfile.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); + PlatformProfile.AllowedPlayerCreatedContent(PlatformProfile.GetPrimaryPad(), + false, &pccAllowed, + &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (noUGC) { @@ -1307,7 +1310,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // 4J-PB - it's possible there is no primary pad here, when accepting an // invite from the dashboard - // PlatformStorage.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()); @@ -1328,9 +1332,7 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // pInviteInfo; // tell the app to process this - { - app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); - } + { app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); } } } } @@ -1385,8 +1387,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( g_NetworkManager.SetLocalGame(false); // change the minecraft player name - Minecraft::GetInstance()->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + Minecraft::GetInstance()->user->name = + PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); bool success = g_NetworkManager.JoinGameFromInviteInfo( userIndex, localUsersMask, pInviteInfo); diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 980867186..2af904c4b 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -7,14 +7,14 @@ #if !defined(__linux__) #include #endif -#include "platform/PlatformTypes.h" +#include "PlatformNetworkManagerStub.h" #include "app/common/Network/IPlatformNetwork.h" -#include "platform/NetTypes.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "PlatformNetworkManagerStub.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" class ClientConnection; class Minecraft; @@ -97,9 +97,8 @@ public: bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession); void SetSessionsUpdatedCallback(std::function callback); - void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + std::function callback); void ForceFriendsSessionRefresh(); // Session joining and leaving @@ -167,8 +166,7 @@ public: private: void StateChange_AnyToHosting(); void StateChange_AnyToJoining(); - void StateChange_JoiningToIdle( - IPlatformNetwork::eJoinFailedReason reason); + void StateChange_JoiningToIdle(IPlatformNetwork::eJoinFailedReason reason); void StateChange_AnyToStarting(); void StateChange_AnyToEnding(bool bStateWasPlaying); void StateChange_AnyToIdle(); diff --git a/targets/app/common/Network/IPlatformNetwork.h b/targets/app/common/Network/IPlatformNetwork.h index 742a8d383..b479863a6 100644 --- a/targets/app/common/Network/IPlatformNetwork.h +++ b/targets/app/common/Network/IPlatformNetwork.h @@ -51,8 +51,7 @@ public: virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetLocalPlayerByUserIndex( int userIndex) = 0; - [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex( - int playerIndex) = 0; + [[nodiscard]] virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; [[nodiscard]] virtual INetworkPlayer* GetPlayerBySmallId( unsigned char smallId) = 0; @@ -89,9 +88,8 @@ public: // Callbacks virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; + int iPad, std::function + callback) = 0; virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; virtual void HandleSignInChange() = 0; @@ -112,7 +110,7 @@ public: // System flags virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; [[nodiscard]] virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) = 0; + int index) = 0; // Stats [[nodiscard]] virtual std::string GatherStats() = 0; @@ -128,8 +126,7 @@ public: int iPad, int localPlayers, bool partyOnly) = 0; [[nodiscard]] virtual bool GetGameSessionInfo( int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; + virtual void SetSessionsUpdatedCallback(std::function callback) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) = 0; diff --git a/targets/app/common/Network/NetworkPlayerQNet.cpp b/targets/app/common/Network/NetworkPlayerQNet.cpp index be89cbda0..4c77c4a57 100644 --- a/targets/app/common/Network/NetworkPlayerQNet.cpp +++ b/targets/app/common/Network/NetworkPlayerQNet.cpp @@ -2,8 +2,8 @@ #include -#include "platform/NetTypes.h" #include "java/System.h" +#include "platform/NetTypes.h" NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) { m_qnetPlayer = qnetPlayer; diff --git a/targets/app/common/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h index 3de173cf1..9df94b161 100644 --- a/targets/app/common/Network/NetworkPlayerQNet.h +++ b/targets/app/common/Network/NetworkPlayerQNet.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/PlatformTypes.h" class IQNetPlayer; class Socket; diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h index 297641349..bde23aac2 100644 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ b/targets/app/common/Network/PlatformNetworkManagerInterface.h @@ -5,11 +5,11 @@ #if !defined(__linux__) #include #endif -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" class ClientConnection; class Minecraft; @@ -87,9 +87,8 @@ public: virtual void ResetLeavingGame() = 0; virtual void RegisterPlayerChangedCallback( - int iPad, - std::function - callback) = 0; + int iPad, std::function + callback) = 0; virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; virtual void HandleSignInChange() = 0; @@ -128,8 +127,7 @@ public: bool partyOnly) = 0; virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback( - std::function callback) = 0; + virtual void SetSessionsUpdatedCallback(std::function callback) = 0; virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback) = 0; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp index 15108e8b9..f46e0853f 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -5,13 +5,13 @@ #include -#include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "app/linux/LinuxGame.h" -#include "platform/NetTypes.h" #include "NetworkPlayerQNet.h" #include "Socket.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" IPlatformNetworkStub* g_pPlatformNetworkManager; @@ -107,8 +107,8 @@ void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { } } -bool IPlatformNetworkStub::Initialise( - CGameNetworkManager* pGameNetworkManager, int flagIndexSize) { +bool IPlatformNetworkStub::Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize) { m_pGameNetworkManager = pGameNetworkManager; m_flagIndexSize = flagIndexSize; g_pPlatformNetworkManager = this; @@ -152,8 +152,7 @@ int IPlatformNetworkStub::GetJoiningReadyPercentage() { return 100; } int IPlatformNetworkStub::CorrectErrorIDS(int IDS) { return IDS; } -bool IPlatformNetworkStub::isSystemPrimaryPlayer( - IQNetPlayer* pQNetPlayer) { +bool IPlatformNetworkStub::isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer) { return true; } @@ -165,9 +164,7 @@ int IPlatformNetworkStub::GetPlayerCount() { return m_pIQNet->GetPlayerCount(); } -bool IPlatformNetworkStub::ShouldMessageForFullSession() { - return false; -} +bool IPlatformNetworkStub::ShouldMessageForFullSession() { return false; } int IPlatformNetworkStub::GetOnlinePlayerCount() { return 1; } @@ -186,8 +183,7 @@ bool IPlatformNetworkStub::RemoveLocalPlayerByUserIndex(int userIndex) { bool IPlatformNetworkStub::IsInStatsEnabledSession() { return true; } -bool IPlatformNetworkStub::SessionHasSpace( - unsigned int spaceRequired /*= 1*/) { +bool IPlatformNetworkStub::SessionHasSpace(unsigned int spaceRequired /*= 1*/) { return true; } @@ -209,8 +205,7 @@ bool IPlatformNetworkStub::LeaveGame(bool bMigrateHost) { return true; } -bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, - bool bLeaveRoom) { +bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) { return true; } @@ -242,8 +237,7 @@ void IPlatformNetworkStub::_HostGame( bool IPlatformNetworkStub::_StartGame() { return true; } int IPlatformNetworkStub::JoinGame(FriendSessionInfo* searchResult, - int localUsersMask, - int primaryUserIndex) { + int localUsersMask, int primaryUserIndex) { return CGameNetworkManager::JOINGAME_SUCCESS; } @@ -319,8 +313,7 @@ void IPlatformNetworkStub::UpdateAndSetGameSessionData( // app.GetGameHostOption(eGameHostOption_All); } -int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc( - void* lpParam) { +int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc(void* lpParam) { INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; Socket* socket = pNetworkPlayer->GetSocket(); @@ -338,13 +331,12 @@ int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc( return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); } -bool IPlatformNetworkStub::RemoveLocalPlayer( - INetworkPlayer* pNetworkPlayer) { +bool IPlatformNetworkStub::RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) { return true; } -IPlatformNetworkStub::PlayerFlags::PlayerFlags( - INetworkPlayer* pNetworkPlayer, unsigned int count) { +IPlatformNetworkStub::PlayerFlags::PlayerFlags(INetworkPlayer* pNetworkPlayer, + unsigned int count) { // 4J Stu - Don't assert, just make it a multiple of 8! This count is // calculated from a load of separate values, and makes tweaking // world/render sizes a pain if we hit an assert here @@ -359,8 +351,7 @@ IPlatformNetworkStub::PlayerFlags::~PlayerFlags() { delete[] flags; } // Add a player to the per system flag storage - if we've already got a player // from that system, copy its flags over -void IPlatformNetworkStub::SystemFlagAddPlayer( - INetworkPlayer* pNetworkPlayer) { +void IPlatformNetworkStub::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { PlayerFlags* newPlayerFlags = new PlayerFlags(pNetworkPlayer, m_flagIndexSize); // If any of our existing players are on the same system, then copy over @@ -399,7 +390,7 @@ void IPlatformNetworkStub::SystemFlagReset() { // Set a per system flag - this is done by setting the flag on every player that // shares that system void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, - int index) { + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return; if (pNetworkPlayer == nullptr) return; @@ -414,7 +405,7 @@ void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, // player as anything else sent to that system should also have been duplicated // here bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) { + int index) { if ((index < 0) || (index >= m_flagIndexSize)) return false; if (pNetworkPlayer == nullptr) { return false; @@ -505,8 +496,7 @@ INetworkPlayer* IPlatformNetworkStub::addNetworkPlayer( return pNetworkPlayer; } -void IPlatformNetworkStub::removeNetworkPlayer( - IQNetPlayer* pQNetPlayer) { +void IPlatformNetworkStub::removeNetworkPlayer(IQNetPlayer* pQNetPlayer) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++) { @@ -523,8 +513,7 @@ INetworkPlayer* IPlatformNetworkStub::getNetworkPlayer( : nullptr; } -INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex( - int userIndex) { +INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex(int userIndex) { return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); } diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index aa50268cb..af9c3827b 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -4,14 +4,14 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" -#include "platform/XboxStubs.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/IPlatformNetwork.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" class C4JThread; class CGameNetworkManager; @@ -67,8 +67,7 @@ public: virtual void RegisterPlayerChangedCallback( int iPad, - std::function - callback); + std::function callback); virtual void UnRegisterPlayerChangedCallback(int iPad); virtual void HandleSignInChange(); @@ -184,8 +183,7 @@ public: bool partyOnly); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, FriendSessionInfo* foundSession); - virtual void SetSessionsUpdatedCallback( - std::function callback); + virtual void SetSessionsUpdatedCallback(std::function callback); virtual void GetFullFriendSessionInfo( FriendSessionInfo* foundSession, std::function callback); diff --git a/targets/app/common/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp index 6ae610c25..68c3e3c7a 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -7,11 +7,11 @@ #include // 4jcraft TODO -#include "platform/ShutdownManager.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/NetTypes.h" #include "minecraft/server/network/ServerConnection.h" +#include "platform/NetTypes.h" +#include "platform/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/app/common/Network/Socket.h b/targets/app/common/Network/Socket.h index ca45f8f34..25037db28 100644 --- a/targets/app/common/Network/Socket.h +++ b/targets/app/common/Network/Socket.h @@ -11,10 +11,10 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/C4JThread.h" class INetworkPlayer; diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 4d226d8dd..6557f4b0b 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -3,10 +3,10 @@ #include #include "app/common/App_structs.h" -#include "platform/NetTypes.h" -#include "platform/storage/storage.h" -#include "platform/XboxStubs.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/NetTypes.h" +#include "platform/XboxStubs.h" +#include "platform/storage/storage.h" struct INVITE_INFO; @@ -32,10 +32,10 @@ public: unsigned int uiSignInData); static void clearSignInChangeUsersMask(); static int signoutExitWorldThreadProc(void* lpParameter); - static int primaryPlayerSignedOutReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); - static int ethernetDisconnectReturned(void* pParam, int iPad, - const IPlatformStorage::EMessageResult); + static int primaryPlayerSignedOutReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); + static int ethernetDisconnectReturned( + void* pParam, int iPad, const IPlatformStorage::EMessageResult); static void profileReadErrorCallback(void* pParam); // Notifications diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index fa846850b..d3db14610 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -1,17 +1,16 @@ -#include "app/linux/LinuxGame.h" #include "app/common/SaveManager.h" #include #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/linux/LinuxGame.h" #include "minecraft/server/MinecraftServer.h" #include "platform/profile/profile.h" void SaveManager::setAutosaveTimerTime(int settingValue) { m_uiAutosaveTimer = - time_util::clock::now() + - std::chrono::minutes(settingValue * 15); + time_util::clock::now() + std::chrono::minutes(settingValue * 15); } bool SaveManager::autosaveDue() const { diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index 851f2f70b..4cc7a743c 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -1,21 +1,22 @@ #include "app/common/SkinManager.h" +#include + #include #include #include -#include #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/Minecraft_Macros.h" #include "app/linux/LinuxGame.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/world/entity/player/Player.h" #include "platform/profile/profile.h" @@ -44,7 +45,7 @@ void SkinManager::setPlayerSkin(int iPad, std::uint32_t dwSkinId, } std::string SkinManager::getPlayerSkinName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return getSkinPathFromId(gameSettingsA[iPad]->dwSelectedSkin); } @@ -104,7 +105,7 @@ void SkinManager::setPlayerCape(int iPad, std::uint32_t dwCapeId, } std::string SkinManager::getPlayerCapeName(int iPad, - GAME_SETTINGS** gameSettingsA) { + GAME_SETTINGS** gameSettingsA) { return Player::getCapePathFromId(gameSettingsA[iPad]->dwSelectedCape); } @@ -122,8 +123,8 @@ void SkinManager::setPlayerFavoriteSkin(int iPad, int iIndex, gameSettingsA[iPad]->bSettingsChanged = true; } -unsigned int SkinManager::getPlayerFavoriteSkin( - int iPad, int iIndex, GAME_SETTINGS** gameSettingsA) { +unsigned int SkinManager::getPlayerFavoriteSkin(int iPad, int iIndex, + GAME_SETTINGS** gameSettingsA) { return gameSettingsA[iPad]->uiFavoriteSkinA[iIndex]; } @@ -151,8 +152,7 @@ unsigned int SkinManager::getPlayerFavoriteSkinsCount( return uiCount; } -void SkinManager::validateFavoriteSkins(int iPad, - GAME_SETTINGS** gameSettingsA, +void SkinManager::validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager) { unsigned int uiCount = getPlayerFavoriteSkinsCount(iPad, gameSettingsA); @@ -203,7 +203,7 @@ void SkinManager::addMemoryTextureFile(const std::string& wName, if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Incrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif pData = (*it).second; @@ -233,14 +233,14 @@ void SkinManager::removeMemoryTextureFile(const std::string& wName) { if (it != m_MEM_Files.end()) { #if !defined(_CONTENT_PACKAGE) printf("Decrementing the memory texture file count for %s\n", - wName.c_str()); + wName.c_str()); #endif PMEMDATA pData = (*it).second; --pData->ucRefCount; if (pData->ucRefCount <= 0) { #if !defined(_CONTENT_PACKAGE) printf("Erasing the memory texture file data for %s\n", - wName.c_str()); + wName.c_str()); #endif delete pData; m_MEM_Files.erase(wName); diff --git a/targets/app/common/SkinManager.h b/targets/app/common/SkinManager.h index 6336f0d87..a20a52e58 100644 --- a/targets/app/common/SkinManager.h +++ b/targets/app/common/SkinManager.h @@ -38,13 +38,13 @@ public: void setPlayerFavoriteSkin(int iPad, int iIndex, unsigned int uiSkinID, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkin(int iPad, int iIndex, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); unsigned char getPlayerFavoriteSkinsPos(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void setPlayerFavoriteSkinsPos(int iPad, int iPos, GAME_SETTINGS** gameSettingsA); unsigned int getPlayerFavoriteSkinsCount(int iPad, - GAME_SETTINGS** gameSettingsA); + GAME_SETTINGS** gameSettingsA); void validateFavoriteSkins(int iPad, GAME_SETTINGS** gameSettingsA, DLCManager& dlcManager); diff --git a/targets/app/common/TerrainFeatureManager.h b/targets/app/common/TerrainFeatureManager.h index 16cb46a1a..015bca8f7 100644 --- a/targets/app/common/TerrainFeatureManager.h +++ b/targets/app/common/TerrainFeatureManager.h @@ -2,8 +2,8 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" +#include "minecraft/GameEnums.h" class TerrainFeatureManager { public: diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 6859cfa6f..3ed3abaf9 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -2,7 +2,6 @@ #include -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" @@ -10,6 +9,7 @@ #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/PlayerInfoPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelSettings.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index b87601123..1bcfdcf55 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -2,8 +2,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialConstraint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index b7ef2a036..ca1f78ba3 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -290,8 +290,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) IDS_TUTORIAL_TASK_CREATE_TORCH)); if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("tutorialArea"); if (area != nullptr) { std::vector* areaConstraints = new std::vector(); @@ -506,8 +505,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("minecartArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("minecartArea"); if (area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, @@ -680,8 +678,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("creativeArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("creativeArea"); if (area != nullptr) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( @@ -1195,8 +1192,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * */ if (app.getGameRuleDefinitions() != nullptr) { - AABB* area = - app.getGameRuleDefinitions()->getNamedArea("breedingArea"); + AABB* area = app.getGameRuleDefinitions()->getNamedArea("breedingArea"); if (area != nullptr) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint(new ChangeStateConstraint( diff --git a/targets/app/common/Tutorial/FullTutorial.h b/targets/app/common/Tutorial/FullTutorial.h index ddf86922d..b8cad4486 100644 --- a/targets/app/common/Tutorial/FullTutorial.h +++ b/targets/app/common/Tutorial/FullTutorial.h @@ -1,6 +1,6 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "Tutorial.h" +#include "app/common/Tutorial/TutorialEnum.h" #define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1 #define FULL_TUTORIAL_PROGRESS_3_X_3_Crafting 2 diff --git a/targets/app/common/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h index 375abfc99..919bc3fb8 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp index dfea1d621..573f8bedb 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp @@ -57,7 +57,7 @@ int DiggerItemHint::attack(std::shared_ptr item, if (itemFound) { // It's also possible that we could hit TileEntities (eg falling // sand) so don't want to give this hint then - if (entity->instanceof(eTYPE_MOB)) { + if (entity->instanceof (eTYPE_MOB)) { return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; } else { return -1; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.h b/targets/app/common/Tutorial/Hints/DiggerItemHint.h index 95ba875e2..8f86cd6f9 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.h +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class DiggerItem; class Level; diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h index d74b98767..a0d2936a2 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" class ItemInstance; @@ -17,7 +17,7 @@ public: LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, eINSTANCEOF type); // TODO: 4jcraft added, this was not implemented - ~LookAtEntityHint() {}; + ~LookAtEntityHint(){}; virtual bool onLookAtEntity(eINSTANCEOF type); }; diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h index 514c4fc43..cb9e826be 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; @@ -20,7 +20,7 @@ public: unsigned int tilesLength, int iconOverride = -1, int iData = -1, int iDataOverride = -1); // TODO: 4jcraft, added, destructor was never implemented - ~LookAtTileHint() {}; + ~LookAtTileHint(){}; virtual bool onLookAt(int id, int iData = 0); }; diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h index 0cb9c6928..81225bac8 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialHint.h" +#include "app/common/Tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; @@ -16,7 +16,7 @@ public: TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], unsigned int itemsLength); // TODO: 4jcraft, added, it was never implemented - virtual ~TakeItemHint() {}; + virtual ~TakeItemHint(){}; virtual bool onTake(std::shared_ptr item); }; diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.h b/targets/app/common/Tutorial/Tasks/AreaTask.h index fbbd20bcc..6d69b0cc6 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.h +++ b/targets/app/common/Tutorial/Tasks/AreaTask.h @@ -4,8 +4,8 @@ #include #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; class TutorialConstraint; diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index fbc14d81e..6d0ceba55 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -3,7 +3,6 @@ #include #include -#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" @@ -12,6 +11,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "platform/input/input.h" ChoiceTask::ChoiceTask( Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, @@ -55,12 +55,12 @@ bool ChoiceTask::isCompleted() { if (!m_bConfirmMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iConfirmMapping) > 0) { + m_iConfirmMapping) > 0) { m_bConfirmMappingComplete = true; } if (!m_bCancelMappingComplete && PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - m_iCancelMapping) > 0) { + m_iCancelMapping) > 0) { m_bCancelMappingComplete = true; } } diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.h b/targets/app/common/Tutorial/Tasks/ChoiceTask.h index 7faf10682..8a9fa5dbe 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index 62b91e381..d58244009 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -6,13 +6,13 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/linux/LinuxGame.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/input/input.h" class Tutorial; @@ -82,7 +82,7 @@ bool ControllerTask::isCompleted() { it != southpawCompletedMappings.end(); ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { @@ -96,7 +96,7 @@ bool ControllerTask::isCompleted() { ++it) { if (!it->second) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - it->first) > 0) { + it->first) > 0) { it->second = true; m_uiCompletionMask |= 1 << iCurrent; } else { diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h index bcee51649..b5b631caa 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index bbb131b5a..a2c7738ff 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -39,7 +39,7 @@ int HorseChoiceTask::getDescriptionId() { } void HorseChoiceTask::onLookAtEntity(std::shared_ptr entity) { - if ((m_eHorseType < 0) && entity->instanceof(eTYPE_HORSE)) { + if ((m_eHorseType < 0) && entity->instanceof (eTYPE_HORSE)) { std::shared_ptr horse = std::dynamic_pointer_cast(entity); if (horse->isAdult()) m_eHorseType = horse->getType(); diff --git a/targets/app/common/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp index 65a41a07e..588ac0686 100644 --- a/targets/app/common/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -5,7 +5,6 @@ #include #include -#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" @@ -13,6 +12,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "platform/input/input.h" InfoTask::InfoTask(Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/) @@ -64,7 +64,7 @@ bool InfoTask::isCompleted() { bool current = (*it).second; if (!current) { if (PlatformInput.GetValue(pMinecraft->player->GetXboxPad(), - (*it).first) > 0) { + (*it).first) > 0) { (*it).second = true; bAllComplete = true; } else { diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h index c78318b0d..c48dc7e3e 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h @@ -2,8 +2,8 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" #include "TutorialTask.h" +#include "app/common/Tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h index 03f0abb42..5d81d540b 100644 --- a/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h +++ b/targets/app/common/Tutorial/Tasks/ProgressFlagTask.h @@ -1,8 +1,8 @@ #pragma once // using namespace std; +#include "TutorialTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "TutorialTask.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp index af7a61733..b36f9de03 100644 --- a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp +++ b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp @@ -21,7 +21,7 @@ RideEntityTask::RideEntityTask(const int eType, Tutorial* tutorial, bool RideEntityTask::isCompleted() { return bIsCompleted; } void RideEntityTask::onRideEntity(std::shared_ptr entity) { - if (entity->instanceof((eINSTANCEOF)m_eType)) { + if (entity->instanceof ((eINSTANCEOF)m_eType)) { bIsCompleted = true; } } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tasks/StatTask.cpp b/targets/app/common/Tutorial/Tasks/StatTask.cpp index 1cba2d63a..bfaac9e16 100644 --- a/targets/app/common/Tutorial/Tasks/StatTask.cpp +++ b/targets/app/common/Tutorial/Tasks/StatTask.cpp @@ -1,9 +1,9 @@ #include "StatTask.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "minecraft/client/Minecraft.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/profile/profile.h" class Tutorial; @@ -23,7 +23,7 @@ bool StatTask::isCompleted() { Minecraft* minecraft = Minecraft::GetInstance(); bIsCompleted = - minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue(stat) >= - (unsigned int)targetValue; + minecraft->stats[PlatformProfile.GetPrimaryPad()]->getTotalValue( + stat) >= (unsigned int)targetValue; return bIsCompleted; } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tasks/StateChangeTask.h b/targets/app/common/Tutorial/Tasks/StateChangeTask.h index af6e7cf20..e1235e388 100644 --- a/targets/app/common/Tutorial/Tasks/StateChangeTask.h +++ b/targets/app/common/Tutorial/Tasks/StateChangeTask.h @@ -1,7 +1,7 @@ #pragma once // using namespace std; -#include "app/common/Tutorial/Tutorial.h" #include "TutorialTask.h" +#include "app/common/Tutorial/Tutorial.h" class StateChangeTask : public TutorialTask { private: diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 549bd5f6f..844085386 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -6,8 +6,7 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "TutorialMessage.h" #include "app/common/App_structs.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h" @@ -23,10 +22,8 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "TutorialMessage.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -45,7 +42,10 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" #include "minecraft/world/level/tile/WallTile.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class MobEffect; @@ -2131,7 +2131,8 @@ void Tutorial::tick() { if (!m_allowShow) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2152,7 +2153,8 @@ void Tutorial::tick() { if (ui.IsPauseMenuDisplayed(m_iPad)) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2232,7 +2234,9 @@ void Tutorial::tick() { isCurrentTask = false; if ((!task->ShowMinimumTime() || (task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now())) && task->isCompleted()) { eTutorial_CompletionAction compAction = @@ -2323,7 +2327,9 @@ void Tutorial::tick() { } if (task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && - (lastMessageTime + std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime)) < + (lastMessageTime + + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime)) < time_util::clock::now()) { task->setShownForMinimumTime(); @@ -2392,14 +2398,17 @@ void Tutorial::tick() { } } - if (m_hintDisplayed && (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < - time_util::clock::now()) { + if (m_hintDisplayed && + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) < + time_util::clock::now()) { m_hintDisplayed = false; } if (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders != 0) && - (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * m_iTutorialReminderTime)) < + (lastMessageTime + std::chrono::milliseconds(m_iTaskReminders * + m_iTutorialReminderTime)) < time_util::clock::now()) { // Reminder PopupMessageDetails* message = new PopupMessageDetails(); @@ -2428,7 +2437,8 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && (!message->m_isReminder || - ((lastMessageTime + std::chrono::milliseconds(m_iTutorialReminderTime)) > + ((lastMessageTime + + std::chrono::milliseconds(m_iTutorialReminderTime)) > time_util::clock::now() && message->m_isReminder))) { delete message; @@ -2527,9 +2537,12 @@ bool Tutorial::setMessage(TutorialHint* hint, PopupMessageDetails* message) { if (message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ((m_hintDisplayed && - (now - m_lastHintDisplayedTime) > std::chrono::milliseconds(m_iTutorialHintDelayTime)) || + (now - m_lastHintDisplayedTime) > + std::chrono::milliseconds(m_iTutorialHintDelayTime)) || (!m_hintDisplayed && - (now - lastMessageTime) > std::chrono::milliseconds(m_iTutorialMinimumDisplayMessageTime))))) { + (now - lastMessageTime) > + std::chrono::milliseconds( + m_iTutorialMinimumDisplayMessageTime))))) { messageShown = setMessage(message); if (messageShown) { @@ -2558,7 +2571,8 @@ void Tutorial::showTutorialPopup(bool show) { if (!show) { if (currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || - (lastMessageTime + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > + (lastMessageTime + + std::chrono::milliseconds(m_iTutorialDisplayMessageTime)) > time_util::clock::now())) { uiTempDisabled = true; } @@ -2786,8 +2800,8 @@ void Tutorial::onLookAtEntity(std::shared_ptr entity) { } } - if ((m_CurrentState == e_Tutorial_State_Gameplay) && - entity->instanceof(eTYPE_HORSE)) { + if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof + (eTYPE_HORSE)) { changeTutorialState(e_Tutorial_State_Horse); } diff --git a/targets/app/common/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h index 5de42d941..c272aa5aa 100644 --- a/targets/app/common/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -9,14 +9,13 @@ #include #include -#include "util/Timer.h" - +#include "TutorialEnum.h" +#include "TutorialMessage.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "TutorialEnum.h" -#include "TutorialMessage.h" +#include "util/Timer.h" class Entity; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index af1034a2c..e5a07e58a 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -6,11 +6,11 @@ #include #include "app/linux/LinuxGame.h" -#include "platform/fs/fs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/fs/fs.h" void ArchiveFile::_readHeader(DataInputStream* dis) { int numberOfFiles = dis->readInt(); @@ -28,8 +28,7 @@ void ArchiveFile::_readHeader(DataInputStream* dis) { } else meta->isCompressed = false; - m_index.insert( - std::pair(meta->filename, meta)); + m_index.insert(std::pair(meta->filename, meta)); } } @@ -113,10 +112,9 @@ std::vector ArchiveFile::getFile(const std::string& filename) { const unsigned int fileSize = static_cast(data->filesize); std::uint8_t* pbData = new std::uint8_t[fileSize == 0 ? 1 : fileSize]; out = std::vector(pbData, pbData + fileSize); - auto readResult = - PlatformFilesystem.readFileSegment( - m_sourcefile.getPath(), static_cast(data->ptr), - out.data(), static_cast(data->filesize)); + auto readResult = PlatformFilesystem.readFileSegment( + m_sourcefile.getPath(), static_cast(data->ptr), + out.data(), static_cast(data->filesize)); if (readResult.status != IPlatformFilesystem::ReadStatus::Ok) { app.DebugPrintf("Failed to read archive file segment\n"); diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index 9bbd292b8..20a7c9fc6 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -1,9 +1,9 @@ #pragma once -#include "platform/storage/storage.h" #include "UIEnums.h" #include "UIStructs.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/storage/storage.h" // 4J Stu - An interface class that defines all the public functions that we use // within the game code. This allows us to build the Xbox 360 version without diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index a1b1c7c71..fc5da509f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,14 +7,12 @@ #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -32,6 +30,8 @@ #include "minecraft/world/item/crafting/FurnaceRecipes.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" #include "strings.h" IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { @@ -782,9 +782,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { buttonX = eToolTipPickUpHalf; } - { - buttonRT = eToolTipWhatIsThis; - } + { buttonRT = eToolTipWhatIsThis; } } else { // Nothing in slot and nothing in hand. } diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index dcf87e8ee..d558bf5e5 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -3,9 +3,9 @@ #include #include +#include "UIStructs.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "UIStructs.h" class HtmlString; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h index 2c106f76b..a7d052a0b 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CommandBlockMenu.h @@ -1,8 +1,6 @@ #pragma once #include - - class CommandBlockEntity; class IUIScene_CommandBlockMenu { diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 334afbb18..0539b5fb7 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,11 +7,11 @@ #include #include -#include "minecraft/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 "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index f0d893e94..570249054 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -110,8 +110,7 @@ protected: virtual void setIngredientDescriptionItem( int iPad, int index, std::shared_ptr item) = 0; virtual void setIngredientDescriptionRedBox(int index, bool show) = 0; - virtual void setIngredientDescriptionText(int index, - const char* text) = 0; + virtual void setIngredientDescriptionText(int index, const char* text) = 0; virtual void setShowCraftHSlot(int iIndex, bool show) = 0; virtual void showTabHighlight(int iIndex, bool show) = 0; virtual void setGroupText(const char* text) = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h index 46522bac3..f3d86ae57 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.h @@ -1,8 +1,8 @@ #pragma once +#include "app/common/DLC/DLCPack.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" -#include "app/common/DLC/DLCPack.h" class DLCPack; @@ -13,20 +13,20 @@ protected: public: static int ExitGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int ExitGameAndSaveReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int ExitGameDeclineSaveReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ExitGameDeclineSaveReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int WarningTrialTexturePackReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int SaveGameDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int EnableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DisableAutosaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int EnableAutosaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DisableAutosaveDialogReturned( + void* pParam, int iPad, 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 d8d695266..6ca6d7545 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -6,11 +6,11 @@ #include #include +#include "UIEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/XuiActionPayload.h" #include "platform/C4JThread.h" #include "platform/storage/storage.h" -#include "UIEnums.h" class Container; class Inventory; @@ -385,7 +385,7 @@ typedef struct _SignInInfo { // Credits struct SCreditTextItemDef { const char* m_Text; // Should contain string, optionally with %s to add - // in translated string ... e.g. "Andy West - %s" + // in translated string ... e.g. "Andy West - %s" int m_iStringID[2]; // May be NO_TRANSLATED_STRING if we do not require to // add any translated string. ECreditTextTypes m_eType; diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index b72ea71e7..daed9d34d 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -2,12 +2,12 @@ #include -#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" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index 9e72a38b0..e99098640 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -2,12 +2,12 @@ #include -#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" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Logo.cpp b/targets/app/common/UI/Components/UIComponent_Logo.cpp index 57d5165e4..05517c41b 100644 --- a/targets/app/common/UI/Components/UIComponent_Logo.cpp +++ b/targets/app/common/UI/Components/UIComponent_Logo.cpp @@ -1,8 +1,8 @@ #include "UIComponent_Logo.h" -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" +#include "platform/renderer/renderer.h" UIComponent_Logo::UIComponent_Logo(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index 7ad96e0f3..badb6e95b 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,9 +1,9 @@ #include "UIComponent_MenuBackground.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" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -41,8 +41,8 @@ std::string UIComponent_MenuBackground::getMoviePath() { return "MenuBackground"; } -void UIComponent_MenuBackground::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_MenuBackground::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (m_bSplitscreen) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index 5daaff3a6..1a9f8a985 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -2,10 +2,10 @@ #include -#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" +#include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index 154e5c15f..06c93c0d5 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -4,10 +4,10 @@ #include -#include "platform/renderer/renderer.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index fafc1c914..976f6c462 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -2,10 +2,10 @@ #include -#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" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index d59340d6c..364cc3845 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -2,12 +2,12 @@ #include -#include "platform/PlatformTypes.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 44c7c6f51..1e9eb4716 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,13 +1,13 @@ #include "UIComponent_Tooltips.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index b0bc2ea15..1c0b0dd8b 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -2,13 +2,13 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index a20cc72a3..ea72371d1 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -4,8 +4,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -13,13 +11,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData, UILayer* parentLayer) @@ -248,8 +248,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene* interactScene, } std::string UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, - bool isFoil, - const char* desc) { + bool isFoil, const char* desc) { std::string temp(desc); bool isFixedIcon = false; @@ -362,7 +361,7 @@ std::string UIComponent_TutorialPopup::_SetImage(std::string& desc) { } std::string UIComponent_TutorialPopup::ParseDescription(int iPad, - std::string& text) { + std::string& text) { text = replaceAll(text, "{*CraftingTableIcon*}", ""); text = replaceAll(text, "{*SticksIcon*}", ""); text = replaceAll(text, "{*PlanksIcon*}", ""); @@ -442,8 +441,8 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) { } } -void UIComponent_TutorialPopup::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewport) { +void UIComponent_TutorialPopup::render( + S32 width, S32 height, IPlatformRenderer::eViewportType viewport) { if (viewport != IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { S32 xPos = 0; S32 yPos = 0; diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index eecb81729..36d2d2aca 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -3,13 +3,13 @@ #include #include -#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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -115,8 +115,7 @@ private: void _SetDescription(UIScene* interactScene, const std::string& desc, const std::string& title, bool allowFade, bool isReminder); - std::string _SetIcon(int icon, int iAuxVal, bool isFoil, - const char* desc); + std::string _SetIcon(int icon, int iAuxVal, bool isFoil, const char* desc); std::string _SetImage(std::string& desc); std::string ParseDescription(int iPad, std::string& text); void UpdateInteractScenePosition(bool visible); diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 9a3bd4044..4d6fb58c7 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -4,15 +4,13 @@ #include #include -#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" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -22,7 +20,9 @@ #include "minecraft/world/inventory/InventoryMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_HUD::UIScene_HUD(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) { @@ -261,9 +261,10 @@ void UIScene_HUD::handleReload() { repositionHud(); - SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || - (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), - eGameSetting_Tooltips) != 0))); + SetTooltipsEnabled( + ((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), + eGameSetting_Tooltips) != 0))); } int UIScene_HUD::getPad() { return m_iPad; } diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index 33e30f98a..adca8d77a 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -2,13 +2,13 @@ #include -#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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp index 0476a6ea5..2bea9da0b 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -91,8 +91,7 @@ const char* UIControl_Base::getLabel() { return m_label.c_str(); } -void UIControl_Base::setAllPossibleLabels(int labelCount, - char labels[][256]) { +void UIControl_Base::setAllPossibleLabels(int labelCount, char labels[][256]) { IggyDataValue result; IggyDataValue* value = new IggyDataValue[labelCount]; IggyStringUTF8* stringVal = new IggyStringUTF8[labelCount]; diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index 9e78ba8a1..27eee671d 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -26,8 +26,7 @@ bool UIControl_DynamicLabel::setupControl(UIScene* scene, IggyValuePath* parent, return success; } -void UIControl_DynamicLabel::addText(const std::string& text, - bool bLastEntry) { +void UIControl_DynamicLabel::addText(const std::string& text, bool bLastEntry) { IggyDataValue result; IggyDataValue value[2]; diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h index eaa15c650..ab45fb6b3 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -9,8 +9,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_DynamicLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index 072919ad4..d4a30af59 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -2,10 +2,10 @@ #include -#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" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index ccd57d319..473029c07 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -5,24 +5,23 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" - #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "util/StringHelpers.h" UIControl_EnchantmentButton::UIControl_EnchantmentButton() { m_index = 0; @@ -210,11 +209,10 @@ UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string UIControl_EnchantmentButton::EnchantmentNames::getRandomName() { diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 7a988f703..0fad90b1c 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -10,8 +10,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_HTMLLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index 745d6eeb3..fbd71e762 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -108,9 +108,8 @@ void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) { void UIControl_LeaderboardList::addDataSet( bool bLast, int iId, int iRank, const std::string& gamertag, bool bDisplayMessage, const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6) { + const std::string& col2, const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6) { IggyDataValue result; IggyDataValue value[12]; diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h index dd6acf80f..9129443f7 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -47,10 +47,9 @@ public: void setupTitles(const std::string& rank, const std::string& gamertag); void initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns); void setColumnIcon(int iColumn, int iType); - void addDataSet(bool bLast, int iId, int iRank, - const std::string& gamertag, bool bDisplayMessage, - const std::string& col0, const std::string& col1, - const std::string& col2, const std::string& col3, - const std::string& col4, const std::string& col5, - const std::string& col6); + void addDataSet(bool bLast, int iId, int iRank, const std::string& gamertag, + bool bDisplayMessage, const std::string& col0, + const std::string& col1, const std::string& col2, + const std::string& col3, const std::string& col4, + const std::string& col5, const std::string& col6); }; \ No newline at end of file diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 252e1e9f3..ac1faa19f 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -1,14 +1,12 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" - - #include #include -#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" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index ed5fee485..29d4bee4a 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -1,14 +1,12 @@ #include "UIControl_MinecraftPlayer.h" - - #include #include -#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" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 7c0714642..54b27ca61 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -6,15 +6,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/LinuxGame.h" - #include "java/Class.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index 1c54934c8..863dbc049 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -10,8 +10,8 @@ #endif #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/sounds/SoundTypes.h" +#include "util/StringHelpers.h" UIControl_Slider::UIControl_Slider() { m_id = 0; diff --git a/targets/app/common/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h index 9481fa15c..823e55290 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -11,8 +11,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_Slider : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h index de7dab64a..8972fd657 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -9,8 +9,8 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" #include "UIControl_Base.h" +#include "app/linux/Iggy/include/rrCore.h" class UIControl_TexturePackList : public UIControl_Base { private: diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 7a3575fa9..b44a29812 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,9 +3,6 @@ #include -#include "platform/input/input.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" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -15,9 +12,12 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 47b5fc4cb..34485f76d 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,8 +1,8 @@ #include "UIScene_DebugOptions.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/Console_Debug_enum.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h index f29aa978a..1f4a1f192 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.h @@ -2,10 +2,10 @@ #include -#include "minecraft/Console_Debug_enum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" +#include "minecraft/Console_Debug_enum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 805a4c2c2..d07d22aac 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,8 +5,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -14,6 +12,8 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -33,13 +33,13 @@ class Player; class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" +#include "util/StringHelpers.h" UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 435bd2cd3..5037a116d 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,9 +5,6 @@ #include -#include "platform/input/input.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" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -17,13 +14,16 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" class UILayer; #ifdef _DEBUG_MENUS_ENABLED -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "util/StringHelpers.h" UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, UILayer* parentLayer) @@ -78,9 +78,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, m_labelYRotElev.init("Y-Rot & Elevation (Degs)"); } -std::string UIScene_DebugSetCamera::getMoviePath() { - return "DebugSetCamera"; -} +std::string UIScene_DebugSetCamera::getMoviePath() { return "DebugSetCamera"; } void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, 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 9fc4d9e3e..b1d4ad79d 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,6 @@ #include -#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" @@ -16,6 +15,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "platform/profile/profile.h" class UILayer; 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 b38d136ee..8fbf9ff13 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,6 @@ #include -#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" @@ -10,6 +9,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -54,8 +54,8 @@ protected: static int TrialTexturePackWarningReturned( void* pParam, int iPad, IPlatformStorage::EMessageResult result); - static int UnlockTexturePackReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int UnlockTexturePackReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, 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 f5fd6afc8..0dfc0d3a1 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 @@ -6,12 +6,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" @@ -25,8 +19,9 @@ #include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/skins/DLCTexturePack.h" @@ -36,7 +31,12 @@ #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" #if defined(_WINDOWS64) @@ -198,8 +198,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData, snprintf(imageName, 64, "tpack%08x", tp->getId()); registerSubstitutionTexture(imageName, imageData, imageBytes); m_texturePackList.addPack(i, imageName); - app.DebugPrintf("Adding texture pack %s at %d\n", imageName, - i); + app.DebugPrintf("Adding texture pack %s at %d\n", imageName, i); } } @@ -571,7 +570,6 @@ void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) { } } - void UIScene_CreateWorldMenu::checkStateAndStartGame() { int primaryPad = PlatformProfile.GetPrimaryPad(); bool isSignedInLive = true; @@ -587,7 +585,8 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { iPadNotSignedInLive = i; } - isSignedInLive = isSignedInLive && PlatformProfile.IsSignedInLive(i); + isSignedInLive = + isSignedInLive && PlatformProfile.IsSignedInLive(i); } } @@ -622,7 +621,8 @@ 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) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -894,9 +894,9 @@ 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 (PlatformProfile.IsSignedIn(pClass->m_iPad)) { - bool isOnlineGame = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isOnlineGame = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; // bool isOnlineGame = pClass->m_MoreOptionsParams.bOnlineGame; int primaryPad = PlatformProfile.GetPrimaryPad(); bool noPrivileges = false; @@ -989,7 +989,8 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( // the sign-in UI again int connectedControllers = 0; for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if (PlatformInput.IsPadConnected(i) || PlatformProfile.IsSignedIn(i)) + if (PlatformInput.IsPadConnected(i) || + PlatformProfile.IsSignedIn(i)) ++connectedControllers; } @@ -1007,9 +1008,9 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( } else { // Check if user-created content is allowed, as we cannot play // multiplayer if it's not - bool isClientSide = - PlatformProfile.IsSignedInLive(PlatformProfile.GetPrimaryPad()) && - pClass->m_MoreOptionsParams.bOnlineGame; + bool isClientSide = PlatformProfile.IsSignedInLive( + PlatformProfile.GetPrimaryPad()) && + pClass->m_MoreOptionsParams.bOnlineGame; bool noUGC = false; bool pccAllowed = true; bool pccFriendsAllowed = true; 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 ee1237adb..efd4827b6 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,6 @@ #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -18,6 +17,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class UILayer; 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 f028964d1..4cf330511 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,13 +1,13 @@ #include "UIScene_DLCMainMenu.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "strings.h" class UILayer; @@ -93,8 +93,8 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { void UIScene_DLCMainMenu::handleTimerComplete(int id) {} -int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_DLCMainMenu::ExitDLCMainMenu( + void* pParam, int iPad, 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 c216c32ff..ee8f07798 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,13 +2,13 @@ #include -#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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; 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 c02b8a636..e09f759df 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 @@ -3,8 +3,6 @@ #include -#include "platform/PlatformTypes.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" @@ -12,6 +10,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/renderer/renderer.h" #include "strings.h" class UILayer; 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 584bb262f..cd8e03fc6 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,6 @@ #include -#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" @@ -11,6 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; 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 3737ca710..a2580ec13 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 @@ -3,18 +3,18 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) @@ -32,8 +32,7 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) std::vector paragraphs; int lastIndex = 0; for (int index = EULA.find("\r\n", lastIndex, 2); - index != std::string::npos; - index = EULA.find("\r\n", lastIndex, 2)) { + index != std::string::npos; index = EULA.find("\r\n", lastIndex, 2)) { paragraphs.push_back(EULA.substr(lastIndex, index - lastIndex) + " "); lastIndex = index + 2; } @@ -45,7 +44,8 @@ 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) || PlatformProfile.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 aa6abf132..929f44e16 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 @@ -4,9 +4,7 @@ #include #include -#include "minecraft/GameTypes.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" @@ -16,6 +14,8 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" +#include "minecraft/network/platform/SessionInfo.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.h" 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 67f2121ed..9f65aceba 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,13 +2,13 @@ #include -#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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class FriendSessionInfo; class UILayer; 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 076b50bb8..bdc50c4da 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,12 +4,6 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -19,9 +13,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 #define GAME_CREATE_ONLINE_TIMER_TIME 100 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 7fa6ef461..6708700e1 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,8 +8,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/Leaderboards/LeaderboardInterface.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -18,10 +16,12 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" #include "strings.h" #define PLAYER_ONLINE_TIMER_ID 0 @@ -126,8 +126,8 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, m_labelFilter.init(filterBuffer); char entriesBuffer[40]; - snprintf(entriesBuffer, 40, "%s%i", - app.GetString(IDS_LEADERBOARD_ENTRIES), 0); + snprintf(entriesBuffer, 40, "%s%i", app.GetString(IDS_LEADERBOARD_ENTRIES), + 0); m_labelEntries.init(entriesBuffer); ReadStats(-1); @@ -373,7 +373,8 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_MyScore: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); m_interface.ReadStats_MyScore( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, @@ -381,7 +382,8 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { } break; case IPlatformLeaderboard::eFM_Friends: { PlayerUID uid; - PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); + PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, + true); m_interface.ReadStats_Friends( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, @@ -733,8 +735,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard( true, // 4J-JEV: Has error message to display. - app.GetString(idsErrorMessage), "", "", "", "", "", - ""); + app.GetString(idsErrorMessage), "", "", "", "", "", ""); } else { m_listEntries.addDataSet( isLast, m_leaderboard.m_entries[i].m_row, 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 396304e39..597c3efa4 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 @@ -3,8 +3,6 @@ #include #include -#include "platform/PlatformTypes.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" @@ -12,6 +10,8 @@ #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/PlatformTypes.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 f42d33b5d..bd6c17f84 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 @@ -4,15 +4,8 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -24,7 +17,9 @@ #include "app/common/UI/UILayer.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/skins/DLCTexturePack.h" @@ -32,7 +27,12 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" #define GAME_CREATE_ONLINE_TIMER_ID 0 @@ -777,7 +777,8 @@ void UIScene_LoadMenu::LaunchGame(void) { &pSaveDetails ->SaveInfoA[(int)m_iSaveGameInfoIndex], [this](bool bCorrupt, bool bOwner) { - return loadSaveDataReturned(bCorrupt, bOwner); + return loadSaveDataReturned(bCorrupt, + bOwner); }); #if TO_BE_IMPLEMENTED @@ -785,7 +786,8 @@ void UIScene_LoadMenu::LaunchGame(void) { IPlatformStorage::ELoadGame_DeviceRemoved) { // disable saving PlatformStorage.SetSaveDisabled(true); - PlatformStorage.SetSaveDeviceSelected(m_iPad, false); + PlatformStorage.SetSaveDeviceSelected(m_iPad, + false); unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage( @@ -868,8 +870,8 @@ int UIScene_LoadMenu::CheckResetNetherReturned( return 0; } -int UIScene_LoadMenu::ConfirmLoadReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::ConfirmLoadReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -1026,8 +1028,8 @@ int UIScene_LoadMenu::loadSaveDataReturned(bool bIsCorrupt, bool bIsOwner) { return 0; } -int UIScene_LoadMenu::TrophyDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_LoadMenu::TrophyDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; return LoadDataComplete(pClass); } 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 96a3ebff3..cb50cb64b 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,6 @@ #include #include -#include "platform/storage/storage.h" #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -16,6 +15,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class DLCPack; class LevelGenerationOptions; @@ -126,16 +126,16 @@ private: static int TrophyDialogReturned(void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int LoadDataComplete(void* pParam); - static int CheckResetNetherReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CheckResetNetherReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bSuccess); static int MustSignInReturnedPSN(void* pParam, int iPad, IPlatformStorage::EMessageResult result); public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int StartGame_SignInReturned(void* pParam, bool, int); }; \ No newline at end of file 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 98ff63caa..9edcad607 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,29 +6,29 @@ #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/SessionInfo.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/network/platform/SessionInfo.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/NetTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) @@ -295,8 +295,9 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { if (navBack) { app.SetLiveLinkRequired(true); - m_bMultiplayerAllowed = PlatformProfile.IsSignedInLive(m_iPad) && - PlatformProfile.AllowedToPlayMultiplayer(m_iPad); + m_bMultiplayerAllowed = + PlatformProfile.IsSignedInLive(m_iPad) && + PlatformProfile.AllowedToPlayMultiplayer(m_iPad); // re-enable button presses m_bIgnoreInput = false; @@ -350,9 +351,7 @@ void UIScene_LoadOrJoinMenu::handleLoseFocus() { killTimer(JOIN_LOAD_ONLINE_TIMER_ID); } -std::string UIScene_LoadOrJoinMenu::getMoviePath() { - return "LoadOrJoinMenu"; -} +std::string UIScene_LoadOrJoinMenu::getMoviePath() { return "LoadOrJoinMenu"; } void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); @@ -427,7 +426,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -449,7 +449,7 @@ void UIScene_LoadOrJoinMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -494,7 +494,8 @@ void UIScene_LoadOrJoinMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -599,8 +600,8 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_pSaveDetails = PlatformStorage.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - IPlatformStorage::ESaveGameState eSGIStatus = PlatformStorage.GetSavesInfo( - m_iPad, nullptr, (char*)"save"); + IPlatformStorage::ESaveGameState eSGIStatus = + PlatformStorage.GetSavesInfo(m_iPad, nullptr, (char*)"save"); } #if TO_BE_IMPLEMENTED @@ -1207,8 +1208,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { std::uint8_t* imageData = tp->getPackIcon(imageBytes); if (imageBytes > 0 && imageData) { - snprintf(textureName, 64, "%s", - sessionInfo->displayLabel); + snprintf(textureName, 64, "%s", sessionInfo->displayLabel); registerSubstitutionTexture(textureName, imageData, imageBytes); } @@ -1429,8 +1429,9 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( pClass->m_iDefaultButtonsC], [cbId](const bool bRes) { ui.lockCallbackScenes(); - auto* p = (UIScene_LoadOrJoinMenu*) - ui.GetSceneFromCallbackId(cbId); + auto* p = + (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId( + cbId); if (p) { p->deleteSaveDataReturned(bRes); } @@ -1703,7 +1704,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); strncpy(wSaveName, pNameUTF8, - strlen(pNameUTF8) + 1); // plus null + strlen(pNameUTF8) + 1); // plus null PlatformStorage.SetSaveTitle(wSaveName); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -1737,10 +1738,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage()->waitForPlatformStorageIdle(); IPlatformStorage::ESaveGameState saveState = - PlatformStorage.SaveSaveData( - [pClass](const bool bRes) { - return pClass->createDummySaveDataCallback(bRes); - }); + PlatformStorage.SaveSaveData([pClass](const bool bRes) { + return pClass->createDummySaveDataCallback(bRes); + }); if (saveState == IPlatformStorage::ESaveGame_Save) { pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; @@ -1955,9 +1955,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // we need to wait for the - // save system to be idle - // here, as Flush doesn't - // check for it. + // save system to be idle + // here, as Flush doesn't + // check for it. pSave->Flush(false, false); } break; case eSaveTransfer_Saving: { @@ -1982,12 +1982,13 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { uiIDA[0] = IDS_CONFIRM_OK; app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, - uiIDA, 1, PlatformProfile.GetPrimaryPad(), + uiIDA, 1, + PlatformProfile.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2041,7 +2042,8 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { return pClass ->crossSaveDeleteOnErrorReturned(bRes); }); - if (eDeleteStatus == IPlatformStorage::ESaveGame_Delete) { + if (eDeleteStatus == + IPlatformStorage::ESaveGame_Delete) { pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; } else { @@ -2061,9 +2063,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) { case eSaveTransfer_ErrorMesssage: { app.getRemoteStorage() ->waitForPlatformStorageIdle(); // wait for everything to - // complete before we hand - // control back to the - // player + // complete before we hand + // control back to the + // player if (pClass->m_saveTransferDownloadCancelled) { pClass->m_eSaveTransferState = eSaveTransfer_Idle; } else { 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 d03c6b834..41618e4aa 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,6 @@ #include #include -#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" @@ -16,6 +15,7 @@ #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/storage/storage.h" class LevelGenerationOptions; class File; @@ -137,14 +137,14 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); + unsigned int thumbnailBytes); static int LoadSaveCallback(void* lpParam, bool bRes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int SaveOptionsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); - static int TexturePackDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int SaveOptionsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); + static int TexturePackDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int deleteSaveDataReturned(bool bRes); int renameSaveDataReturned(bool bRes); int handleKeyboardCompleteWorldName(bool bRes); @@ -201,11 +201,11 @@ private: int createDummySaveDataCallback(bool bRes); int crossSaveGetSavesInfoCallback(SAVE_DETAILS* pSaveDetails, bool bRes); int loadCrossSaveDataCallback(bool bIsCorrupt, bool bIsOwner); - static int CrossSaveFinishedCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int CrossSaveFinishedCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); int crossSaveDeleteOnErrorReturned(bool bRes); - static int RemoteSaveNotFoundCallback(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int RemoteSaveNotFoundCallback( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int DownloadSonyCrossSaveThreadProc(void* lpParameter); static void SaveTransferReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); @@ -237,8 +237,8 @@ private: static void SaveUploadReturned(void* lpParam, SonyRemoteStorage::Status s, int error_code); static void CancelSaveUploadCallback(void* lpParam); - static int SaveTransferDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int SaveTransferDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); static int CrossSaveUploadFinishedCallback( void* pParam, int iPad, IPlatformStorage::EMessageResult result); #endif 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 861dabcbf..984bb95f3 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,12 +8,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameTypes.h" -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -22,21 +16,25 @@ #include "app/common/UI/UIString.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "util/StringHelpers.h" - #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class LevelGenerationOptions; @@ -177,8 +175,8 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { random->nextInt((int)m_splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - const std::time_t now = std::chrono::system_clock::to_time_t( - std::chrono::system_clock::now()); + const std::time_t now = + std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm localTime; localtime_r(&now, &localTime); const int month = localTime.tm_mon + 1; // tm_mon is 0-based @@ -301,8 +299,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { if (PlatformProfile.IsSignedIn(primaryPad)) { if (confirmUser) { PlatformProfile.RequestSignInUI(false, false, true, false, true, - signInReturnedFunc, - primaryPad); + signInReturnedFunc, primaryPad); } else { RunAction(primaryPad); } @@ -398,8 +395,8 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { ui.endCustomDraw(region); } -int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::MustSignInReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (result == IPlatformStorage::EMessage_ResultAccept) { @@ -456,8 +453,8 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -473,7 +470,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, // 4J-JEV: Don't we only need to update rich-presence if the sign-in // status changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); #if TO_BE_IMPLEMENTED if (app.GetTMSDLCInfoRead()) @@ -508,8 +505,8 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -525,7 +522,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -537,7 +534,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); // change the minecraft player name - Minecraft::GetInstance()->user->name = + Minecraft::GetInstance()->user->name = PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); { @@ -598,9 +595,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, } #else Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); @@ -614,8 +610,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // offline PlatformProfile.DisplayOfflineProfile( [pClass](bool b, int p) { - return CScene_Main::CreateLoad_OfflineProfileReturned( - pClass, b, p); + return CScene_Main:: + CreateLoad_OfflineProfileReturned(pClass, b, p); }, PlatformProfile.GetPrimaryPad()); #else @@ -635,8 +631,8 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -651,7 +647,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); unsigned int uiIDA[1] = {IDS_OK}; @@ -679,7 +675,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, PlatformProfile.GetPrimaryPad()); #endif } else { - PlatformProfile.SetLockedProfile(PlatformProfile.GetPrimaryPad()); + PlatformProfile.SetLockedProfile( + PlatformProfile.GetPrimaryPad()); proceedToScene(PlatformProfile.GetPrimaryPad(), eUIScene_LeaderboardsMenu); } @@ -691,8 +688,8 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -708,7 +705,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); // XShowAchievementsUI(PlatformProfile.GetPrimaryPad()); } else { @@ -718,8 +715,8 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -734,7 +731,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, // 4J-JEV: We only need to update rich-presence if the sign-in status // changes. PlatformProfile.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, - false); + false); pClass->RunUnlockOrDLC(iPad); } else { @@ -744,8 +741,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, for (int i = 0; i < XUSER_MAX_COUNT; i++) { // if the user is valid, we should set the presence if (PlatformProfile.IsSignedIn(i)) { - PlatformProfile.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, - false); + PlatformProfile.SetCurrentGameActivity( + i, CONTEXT_PRESENCE_MENUS, false); } } } @@ -753,8 +750,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, return 0; } -int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result) { +int UIScene_MainMenu::ExitGameReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this @@ -812,9 +809,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { if (PlatformStorage.SetSaveDevice( &CScene_Main::DeviceSelectReturned, this) == true) { // change the minecraft player name - pMinecraft->user->name = - PlatformProfile.GetGamertag( - PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // save device already selected // ensure we've applied this player's settings @@ -844,8 +840,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { m_Timer.SetShow(true); } #else - pMinecraft->user->name = - PlatformProfile.GetGamertag(PlatformProfile.GetPrimaryPad()); + pMinecraft->user->name = PlatformProfile.GetGamertag( + PlatformProfile.GetPrimaryPad()); // ensure we've applied this player's settings app.ApplyGameSettingsChanged(iPad); 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 da092417b..990f35ae8 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,12 +5,12 @@ #include #include -#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" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 8c28db506..7c24a8329 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,14 +3,14 @@ #include -#include "minecraft/GameTypes.h" -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.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 e078d407f..89efb30e6 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 @@ -1,18 +1,18 @@ #include "UIScene_SaveMessage.h" -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" -#include "platform/profile/ProfileConstants.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" #include "strings.h" #define PROFILE_LOADED_TIMER_ID 0 @@ -39,7 +39,8 @@ 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) || PlatformProfile.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 959d93e4a..df684fab8 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,12 +1,12 @@ #include "UIScene_TrialExitUpsell.h" -#include "platform/profile/profile.h" -#include "minecraft/GameTypes.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; 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 4e2a7385e..4101422c5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,19 +4,19 @@ #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" #include "strings.h" class UILayer; @@ -75,9 +75,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData, char* layoutString = new char[128]; snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[iSelected])); - { - m_labelCurrentLayout.init(layoutString); - } + { m_labelCurrentLayout.init(layoutString); } m_iCurrentNavigatedControlsLayout = iSelected; @@ -174,9 +172,7 @@ void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) { snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[control])); - { - m_labelCurrentLayout.setLabel(layoutString); - } + { m_labelCurrentLayout.setLabel(layoutString); } break; }; 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 a8cc86b8b..d889687f3 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -8,8 +8,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "strings.h" +#include "util/StringHelpers.h" #define CREDIT_ICON -2 @@ -27,8 +27,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line {"%s", IDS_CREDITS_RESTOFMOJANG, NO_TRANSLATED_STRING, eMediumText}, {"%s", IDS_CREDITS_LEADPC, NO_TRANSLATED_STRING, eLargeText}, - {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_JON_KAGSTROM, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_CEO, NO_TRANSLATED_STRING, eLargeText}, {"Carl Manneh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -73,8 +72,8 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { eSmallText}, // extra blank line // Added credit for horses - {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, - NO_TRANSLATED_STRING, eExtraLargeText}, + {"Developers of Mo' Creatures:", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, + eExtraLargeText}, {"John Olarte (DrZhark)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kent Christian Jensen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, @@ -83,8 +82,7 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line - {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eExtraLargeText}, + {"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eExtraLargeText}, {"%s", IDS_CREDITS_PROGRAMMING, NO_TRANSLATED_STRING, eLargeText}, {"Paddy Burns", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Richard Reavy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -92,12 +90,10 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {"James Vaughan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Mark Hughes", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Harry Gordon", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"%s", IDS_CREDITS_ART, NO_TRANSLATED_STRING, eLargeText}, - {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, + {"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Alan Redmond", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Chris Reeves", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, {"Kate Wright", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -125,14 +121,14 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { // Miles & Iggy credits {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Iggy, eSmallText}, // extra blank line {"Uses Iggy.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"Copyright (C) 2009-2014 by RAD Game Tools, Inc.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line {"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, - eSmallText}, // extra blank line + eSmallText}, // extra blank line {"", CREDIT_ICON, eCreditIcon_Miles, eSmallText}, // extra blank line {"Uses Miles Sound System.", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, // extra blank line 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 38f341d24..6d6db0610 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/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -9,6 +8,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, 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 6846170a4..d5f59efc8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,14 +6,14 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameEnums.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; 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 c84ab18d5..2d4552d2f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -110,9 +110,7 @@ void UIScene_HowToPlayMenu::updateComponents() { void UIScene_HowToPlayMenu::handleReload() { for (unsigned int i = 0; i < eHTPButton_Max; ++i) { // 4J Stu - Re-add for future platforms - { - m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); - } + { m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); } } doHorizontalResizeCheck(); diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index 0101fe73c..1dae880f3 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -2,15 +2,15 @@ #include -#include "platform/profile/ProfileConstants.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "platform/NetTypes.h" #include "minecraft/client/model/SkinBox.h" +#include "platform/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/profile/ProfileConstants.h" class UILayer; 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 aeef22f6f..39804afc9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,12 +3,12 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.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 a3e65f9e0..33bc48fa2 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.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 23ac8299b..ede1945ad 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,8 +2,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" @@ -11,7 +9,9 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, 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 e5719b4c2..370ac6e81 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/profile/profile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" @@ -9,6 +8,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void* initData, 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 b8e886f58..bd5e1eae5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,11 +2,11 @@ #include -#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" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; @@ -51,6 +51,6 @@ public: protected: void handlePress(F64 controlId, F64 childId); - static int ResetDefaultsDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + static int ResetDefaultsDialogReturned( + void* pParam, int iPad, IPlatformStorage::EMessageResult result); }; \ No newline at end of file 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 2c7f0a946..d310b4356 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,9 +3,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -15,8 +12,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4] = { @@ -380,7 +380,8 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, std::string wsText = app.GetString(m_iDifficultySettingA[value]); EHTMLFontSize size = eHTMLSize_Normal; - if (!PlatformRenderer.IsHiDef() && !PlatformRenderer.IsWidescreen()) { + if (!PlatformRenderer.IsHiDef() && + !PlatformRenderer.IsWidescreen()) { size = eHTMLSize_Splitscreen; } char startTags[64]; 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 125bf5abc..8e5bb788a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,15 +3,15 @@ #include -#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" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void* initData, 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 ffebcc195..c95234fd8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,10 +5,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/profile/ProfileConstants.h" -#include "minecraft/Minecraft_Macros.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" @@ -19,12 +15,15 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/model/SkinBox.h" -#include "util/StringHelpers.h" - +#include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" #include "strings.h" +#include "util/StringHelpers.h" class ModelPart; @@ -528,8 +527,8 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion* region) { // region->stencil_func_ref, region->stencil_write_mask); if (region->stencil_func_ref != 0) PlatformRenderer.StateSetStencil(GL_EQUAL, region->stencil_func_ref, - region->stencil_func_mask, - region->stencil_write_mask); + region->stencil_func_mask, + region->stencil_write_mask); m_characters[characterId].render(region); // Finish GDraw and anything else that needs to be finalised @@ -589,7 +588,8 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { case SKIN_SELECT_PACK_DEFAULT: backupTexture = getTextureId(m_skinIndex); - if (m_skinIndex == std::to_underlying(EDefaultSkins::ServerSelected)) { + if (m_skinIndex == + std::to_underlying(EDefaultSkins::ServerSelected)) { skinName = app.GetString(IDS_DEFAULT_SKINS); } else { skinName = wchDefaultNamesA[m_skinIndex]; 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 be4090428..6da39709a 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,6 @@ #include #include -#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" @@ -11,20 +10,22 @@ #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/entity/player/SkinTypes.h" class DLCPack; class UILayer; class UIScene_SkinSelectMenu : public UIScene { private: - static const char* wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; + static const char* + wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; 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 6147b1661..53bc88642 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 @@ -193,8 +193,8 @@ void UIScene_AbstractContainerMenu::tick() { IggyPlayerDispatchEventRS(getMovie(), &mouseEvent, &result); } -void UIScene_AbstractContainerMenu::render(S32 width, S32 height, - IPlatformRenderer::eViewportType viewpBort) { +void UIScene_AbstractContainerMenu::render( + S32 width, S32 height, 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 84b037e5d..5e5187797 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,6 @@ #include -#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" @@ -10,6 +9,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 6bf9d5a95..5bcbfa26d 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,8 +7,6 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -17,7 +15,6 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" @@ -25,7 +22,10 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; @@ -317,7 +317,8 @@ UIControl* UIScene_AnvilMenu::getSection(ESceneSection eSection) { void UIScene_AnvilMenu::handleEditNamePressed() { setIgnoreInput(true); PlatformInput.RequestKeyboard( - app.GetString(IDS_TITLE_RENAME), m_textInputAnvil.getLabel(), m_iPad, 30, + 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); @@ -338,8 +339,7 @@ void UIScene_AnvilMenu::setEditNameValue(const std::string& name) { void UIScene_AnvilMenu::setEditNameEditable(bool enabled) {} -void UIScene_AnvilMenu::setCostLabel(const std::string& label, - bool canAfford) { +void UIScene_AnvilMenu::setCostLabel(const std::string& label, bool canAfford) { IggyDataValue result; IggyDataValue value[2]; 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 6a4262c7c..48f0425e6 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,6 @@ #include -#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" @@ -13,6 +12,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/input/input.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 fb29b70e0..e210f2abc 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,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -17,6 +16,7 @@ #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" +#include "platform/profile/profile.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h index ffa31b5c2..83cc46c8f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BrewingStandMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_BrewingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class BrewingStandTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h index becd3b9a4..54081c8f4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_ContainerMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index cf611ba13..ca6a4f48c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -19,11 +19,11 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" +#include "platform/XboxStubs.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h index 47402ff55..e22da5241 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_DispenserMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; 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 9be761c88..1643bd549 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,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -18,6 +17,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index 4cce00e0b..34c28fe3b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_EnchantingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -12,7 +13,6 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; 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 bf465d457..205049a6a 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,6 @@ #include -#include "platform/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,6 +14,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h index 4f43bc00b..df8f0fcf9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FurnaceMenu.h @@ -3,6 +3,7 @@ #include #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_FurnaceMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class FurnaceTileEntity; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h index 63b54e8df..7d2a7bdac 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.h @@ -2,6 +2,7 @@ #include +#include "UIScene_AbstractContainerMenu.h" #include "app/common/UI/All Platforms/IUIScene_HopperMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "UIScene_AbstractContainerMenu.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index f0aafc9f5..58f9f6465 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -15,7 +15,6 @@ #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -24,6 +23,7 @@ #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/inventory/InventoryMenu.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; 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 3829bf771..d596257ea 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/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,7 +14,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" @@ -23,7 +21,9 @@ #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; 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 dbb9361dc..00cc12cb6 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/profile/profile.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" @@ -22,6 +21,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "platform/profile/profile.h" #include "strings.h" class UILayer; 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 04ef15858..4efb6e88b 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,9 +3,6 @@ #include -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" @@ -15,8 +12,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" class UILayer; 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 9185eb526..448650f9c 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 @@ -6,21 +6,21 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" class UILayer; 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 a207a9a2f..e1f56c6e6 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,19 +3,19 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Player.h" #include "strings.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 05bbaa567..0da94aab4 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 @@ -2,12 +2,7 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.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" @@ -16,11 +11,16 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void* initData, 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 995c07e3f..aa3dce319 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,6 @@ #include #include -#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" @@ -12,6 +11,7 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class INetworkPlayer; class UILayer; 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 d5106a9f0..5e6dac856 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,9 +3,7 @@ #include -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -14,11 +12,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/packet/PlayerInfoPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/world/entity/player/Player.h" #include "strings.h" 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 0b7f4a3a3..1ce577898 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,6 @@ #include #include -#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" @@ -11,6 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif 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 469b58061..8c40bd7e5 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 @@ -202,7 +202,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; @@ -224,7 +225,7 @@ void UIScene_InGameSaveManagementMenu::tick() { MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 // string, // in char's (= bytes), including end-of-string \0 - (char*)u16Message, // destination buffer + (char*)u16Message, // destination buffer MAX_SAVEFILENAME_LENGTH // size of destination buffer, in // char's ); @@ -268,7 +269,8 @@ void UIScene_InGameSaveManagementMenu::tick() { return loadSaveDataThumbnailReturned(data, bytes); }); - if (eLoadStatus != IPlatformStorage::ESaveGame_GetSaveThumbnail) { + if (eLoadStatus != + IPlatformStorage::ESaveGame_GetSaveThumbnail) { // something went wrong m_bRetrievingSaveThumbnails = false; m_bAllLoaded = true; 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 737d8d5ef..639fe48d8 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 @@ -91,9 +91,9 @@ protected: public: int loadSaveDataThumbnailReturned(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes); - static int DeleteSaveDialogReturned(void* pParam, int iPad, - IPlatformStorage::EMessageResult result); + unsigned int thumbnailBytes); + static int DeleteSaveDialogReturned( + void* pParam, int iPad, 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 dbac8c9f1..fdf4dba56 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,8 +5,6 @@ #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/Network/GameNetworkManager.h" @@ -18,11 +16,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class TexturePack; 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 23c305cf8..7ec51ef6c 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,12 +2,12 @@ #include -#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" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/storage/storage.h" class UILayer; 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 7a637adfb..1da16ab73 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/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" @@ -10,7 +9,6 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" @@ -18,7 +16,9 @@ #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/input/input.h" #include "strings.h" +#include "util/StringHelpers.h" UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, UILayer* parentLayer) @@ -52,7 +52,8 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData, IPlatformInput::EKeyboardMode_Alphabet); break; default: - m_signRows[i].SetKeyboardType(IPlatformInput::EKeyboardMode_Full); + m_signRows[i].SetKeyboardType( + IPlatformInput::EKeyboardMode_Full); break; } @@ -164,8 +165,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { // 4J HEG - No reason to set value if keyboard was cancelled m_bIgnoreInput = false; if (bRes && m_iEditingLine >= 0 && m_iEditingLine < 4) { - std::string str = - PlatformInput.GetText(); + std::string str = PlatformInput.GetText(); if (str.size() > 15) str.resize(15); m_textInputLines[m_iEditingLine].setLabel(str); } 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 3ebc242d5..cd03823cd 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,9 +3,7 @@ #include -#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" @@ -13,9 +11,11 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/network/packet/GameCommandPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/commands/TeleportCommand.h" #include "minecraft/sounds/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index fcc99ac9e..76e61d5bf 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,8 +1,6 @@ #include "UIScene_ConnectingProgress.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -13,8 +11,10 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_ConnectingProgress::UIScene_ConnectingProgress(int iPad, diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 803a001eb..1183838ac 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -4,9 +4,6 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/Controls/UIControl_Button.h" @@ -16,10 +13,13 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "platform/C4JThread.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void* initData, @@ -231,7 +231,8 @@ void UIScene_FullscreenProgress::tick() { // This just allows it to be shown Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes - [PlatformProfile.GetPrimaryPad()] != nullptr) + [PlatformProfile.GetPrimaryPad()] != + nullptr) pMinecraft ->localgameModes[PlatformProfile .GetPrimaryPad()] diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 23bdd0aec..5959ed9e2 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 "minecraft/GameTypes.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" @@ -8,8 +7,9 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "util/StringHelpers.h" +#include "minecraft/GameTypes.h" #include "strings.h" +#include "util/StringHelpers.h" #define KEYBOARD_DONE_TIMER_ID 0 #define KEYBOARD_DONE_TIMER_TIME 100 @@ -30,7 +30,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void* initData, m_ButtonCursorRight.init("Cursor Right", -1); m_ButtonCaps.init("Caps", -1); m_ButtonDone.init("Done", 0); // only the done button needs an id, the - // others will never call back! + // others will never call back! m_ButtonSymbols.init("Symbols", -1); m_ButtonBackspace.init("Backspace", -1); diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 1c5e369aa..855e05dd3 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -1,8 +1,6 @@ #include "UIScene_MessageBox.h" -#include "platform/PlatformTypes.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" @@ -10,6 +8,8 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_MessageBox::UIScene_MessageBox(int iPad, void* initData, @@ -114,7 +114,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, if (pressed) { navigateBack(); if (m_Func) - m_Func(m_lpParam, iPad, IPlatformStorage::EMessage_Cancelled); + m_Func(m_lpParam, iPad, + IPlatformStorage::EMessage_Cancelled); } break; case ACTION_MENU_OK: @@ -129,7 +130,8 @@ void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, } void UIScene_MessageBox::handlePress(F64 controlId, F64 childId) { - IPlatformStorage::EMessageResult result = IPlatformStorage::EMessage_Cancelled; + IPlatformStorage::EMessageResult result = + IPlatformStorage::EMessage_Cancelled; switch ((int)controlId) { case 0: result = IPlatformStorage::EMessage_ResultAccept; diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index d417692e5..aaf07e0bd 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,12 +2,12 @@ #include -#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" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/iggy.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 3dea50cd3..d7d002d32 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -3,15 +3,15 @@ #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.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" #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void* _initData, @@ -35,9 +35,7 @@ UIScene_QuadrantSignin::~UIScene_QuadrantSignin() { m_parentLayer->removeComponent(eUIComponent_MenuBackground); } -std::string UIScene_QuadrantSignin::getMoviePath() { - return "QuadrantSignin"; -} +std::string UIScene_QuadrantSignin::getMoviePath() { return "QuadrantSignin"; } void UIScene_QuadrantSignin::updateTooltips() { ui.SetTooltips(m_iPad, IDS_TOOLTIPS_CONTINUE, IDS_TOOLTIPS_CANCEL); @@ -140,9 +138,7 @@ void UIScene_QuadrantSignin::updateState() { // app.DebugPrintf("Index %d is signed in, display name - '%s'\n", // i, PlatformProfile.GetDisplayName(i).data()); - { - setControllerState(i, eControllerStatus_PlayerDetails); - } + { setControllerState(i, eControllerStatus_PlayerDetails); } m_labelDisplayName[i].setLabel(PlatformProfile.GetDisplayName(i)); // m_buttonControllers[i].setLabel(app.GetString(IDS_TOOLTIPS_CONTINUE),i); @@ -150,8 +146,7 @@ void UIScene_QuadrantSignin::updateState() { if (!m_iconRequested[i]) { app.DebugPrintf(app.USER_SR, "Requesting avatar for %d\n", i); if (PlatformProfile.GetProfileAvatar( - i, - [this](std::uint8_t* data, unsigned int bytes) { + i, [this](std::uint8_t* data, unsigned int bytes) { return AvatarReturned(this, data, bytes); })) { m_iconRequested[i] = true; @@ -228,9 +223,7 @@ void UIScene_QuadrantSignin::_initQuadrants() { if (PlatformProfile.IsSignedIn(i)) { app.DebugPrintf("Index %d is signed in\n", i); - { - setControllerState(i, eControllerStatus_PlayerDetails); - } + { setControllerState(i, eControllerStatus_PlayerDetails); } m_labelDisplayName[i].init(PlatformProfile.GetDisplayName(i)); } else if (PlatformInput.IsPadConnected(i)) { diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index 1ed7820e5..c6fe24590 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -4,9 +4,9 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif +#include "UIFontData.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/client/BufferedImage.h" -#include "UIFontData.h" ///////////////////////////// // UI Abstract Bitmap Font // @@ -282,7 +282,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, while ((0.5f + glyphScale) * truePixelScale < targetPixelScale) glyphScale++; - // 4J-JEV: Debug code to check which font sizes are being used. + // 4J-JEV: Debug code to check which font sizes are being used. #if (!defined _CONTENT_PACKAGE) && (VERBOSE_FONT_OUTPUT > 0) struct DebugData { diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 12c385a29..8655de601 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -10,9 +10,6 @@ #include #include -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Network/GameNetworkManager.h" @@ -30,20 +27,17 @@ #include "app/common/UI/UIString.h" #include "app/common/UI/UITTFFont.h" #include "app/linux/Iggy/include/iggy.h" +#include "minecraft/GameEnums.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif +#include "UIFontData.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "UIFontData.h" -#include "platform/XboxStubs.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" - -#include "util/StringHelpers.h" - #include "java/System.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Textures.h" @@ -51,7 +45,11 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "platform/C4JThread.h" +#include "platform/XboxStubs.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Tutorial; @@ -355,15 +353,13 @@ UITTFFont* UIController::createFont(EFont fontLanguage) { "app/common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN case eFont_TradChinese: - return new UITTFFont( - "Mojangles_TTF_cnTD", - "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", - 0x2022); // CHT + return new UITTFFont("Mojangles_TTF_cnTD", + "app/common/Media/font/CHT/DFHeiMedium-B5.ttf", + 0x2022); // CHT case eFont_Korean: - return new UITTFFont( - "Mojangles_TTF_koKR", - "app/common/Media/font/KOR/BOKMSD.ttf", - 0x2022); // KOR + return new UITTFFont("Mojangles_TTF_koKR", + "app/common/Media/font/KOR/BOKMSD.ttf", + 0x2022); // KOR // 4J-JEV, Cyrillic characters have been added to this font now, // (4/July/14) XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK: default: @@ -561,8 +557,7 @@ void UIController::loadSkins() { loadSkin("skinHDLabels.swf", "skinHDLabels.swf"); m_iggyLibraries[eLibrary_InGame] = loadSkin("skinHDInGame.swf", "skinHDInGame.swf"); - m_iggyLibraries[eLibrary_HUD] = - loadSkin("skinHDHud.swf", "skinHDHud.swf"); + m_iggyLibraries[eLibrary_HUD] = loadSkin("skinHDHud.swf", "skinHDHud.swf"); m_iggyLibraries[eLibrary_Tooltips] = loadSkin("skinHDTooltips.swf", "skinHDTooltips.swf"); m_iggyLibraries[eLibrary_Default] = loadSkin("skinHD.swf", "skinHD.swf"); @@ -740,7 +735,7 @@ void UIController::tickInput() { #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { if (PlatformInput.ButtonPressed(PlatformProfile.GetPrimaryPad(), - ACTION_MENU_STICK_PRESS)) + ACTION_MENU_STICK_PRESS)) m_iggyPerfmonEnabled = !m_iggyPerfmonEnabled; } else #endif @@ -777,7 +772,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { if (pressed) { // Start repeat timer m_actionRepeatTimer[iPad][key] = - time_util::clock::now() + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); + time_util::clock::now() + + std::chrono::milliseconds(UI_REPEAT_KEY_DELAY_MS); } else if (released) { // Stop repeat timer m_actionRepeatTimer[iPad][key] = {}; @@ -887,8 +883,8 @@ void UIController::renderScenes() { #endif } -void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport, - S32& width, S32& height) { +void UIController::getRenderDimensions( + IPlatformRenderer::eViewportType viewport, S32& width, S32& height) { switch (viewport) { case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: width = (S32)(getScreenWidth()); @@ -916,7 +912,8 @@ void UIController::getRenderDimensions(IPlatformRenderer::eViewportType viewport } } -void UIController::setupRenderPosition(IPlatformRenderer::eViewportType viewport) { +void UIController::setupRenderPosition( + IPlatformRenderer::eViewportType viewport) { if (m_bCustomRenderPosition || m_currentRenderViewport != viewport) { m_currentRenderViewport = viewport; m_bCustomRenderPosition = false; @@ -1128,8 +1125,8 @@ GDrawTexture* RADLINK UIController::TextureSubstitutionCreateCallback( if (image.getData() != nullptr) { image.preMultiplyAlpha(); Textures* t = Minecraft::GetInstance()->textures; - int id = t->getTexture(&image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + int id = t->getTexture( + &image, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); // 4J Stu - All our flash controls that allow replacing textures use // a special 64x64 symbol Force this size here so that our images @@ -1179,8 +1176,8 @@ void UIController::registerSubstitutionTexture(const std::string& textureName, std::vector(pbData, pbData + dwLength); } -void UIController::unregisterSubstitutionTexture( - const std::string& textureName, bool deleteData) { +void UIController::unregisterSubstitutionTexture(const std::string& textureName, + bool deleteData) { auto it = m_substitutionTextures.find(textureName); if (it != m_substitutionTextures.end()) { @@ -1370,7 +1367,8 @@ void UIController::NavigateToHomeMenu() { // { // pDLCTexPack->m_pSoundBank->Destroy(); // } - const unsigned int result = PlatformStorage.UnmountInstalledDLC("TPACK"); + const unsigned int result = + PlatformStorage.UnmountInstalledDLC("TPACK"); app.DebugPrintf("Unmount result is %d\n", result); } @@ -1796,8 +1794,7 @@ void UIController::DisplayGamertag(unsigned int iPad, bool show) { } } -void UIController::SetSelectedItem(unsigned int iPad, - const std::string& name) { +void UIController::SetSelectedItem(unsigned int iPad, const std::string& name) { EUIGroup group; if (app.GetGameStarted()) { @@ -2159,8 +2156,8 @@ void UIController::ClearPressStart() { m_iPressStartQuadrantsMask = 0; } IPlatformStorage::EMessageResult UIController::RequestAlertMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false); } @@ -2168,8 +2165,8 @@ IPlatformStorage::EMessageResult UIController::RequestAlertMessage( IPlatformStorage::EMessageResult UIController::RequestErrorMessage( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString) { + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString) { return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true); } @@ -2177,8 +2174,9 @@ IPlatformStorage::EMessageResult UIController::RequestErrorMessage( IPlatformStorage::EMessageResult UIController::RequestMessageBox( unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, unsigned int uiOptionC, unsigned int dwPad, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult), void* lpParam, - char* pwchFormatString, unsigned int dwFocusButton, bool bIsError) + int (*Func)(void*, int, const IPlatformStorage::EMessageResult), + void* lpParam, char* pwchFormatString, unsigned int dwFocusButton, + bool bIsError) { MessageBoxInfo param; @@ -2224,7 +2222,8 @@ IPlatformStorage::EMessageResult UIController::RequestMessageBox( IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) /* = nullptr*/, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) /* = nullptr*/, void* lpParam /* = nullptr*/) { // Default title / messages if (title == -1) { @@ -2244,9 +2243,11 @@ IPlatformStorage::EMessageResult UIController::RequestUGCMessageBox( lpParam); } -IPlatformStorage::EMessageResult UIController::RequestContentRestrictedMessageBox( +IPlatformStorage::EMessageResult +UIController::RequestContentRestrictedMessageBox( int title /* = -1 */, int message /* = -1 */, int iPad /* = -1*/, - int (*Func)(void*, int, const IPlatformStorage::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 561513dbe..d8906c7da 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -21,17 +21,17 @@ #include "app/windows/Iggy/include/iggy.h" #endif -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" +#include "UIGroup.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" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/rrCore.h" -#include "UIGroup.h" #include "minecraft/sounds/SoundTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" class UIAbstractBitmapFont; class UIBitmapFont; @@ -43,7 +43,7 @@ class Tutorial; class UIScene; // 4jcraft, used to be D3D11_RECT. -// This was the only class that used it, so it's here now. +// This was the only class that used it, so it's here now. struct RECT { long left; long top; @@ -72,7 +72,8 @@ private: 300; // How long from press until the first repeat static constexpr int UI_REPEAT_KEY_REPEAT_RATE_MS = 100; // How long in between repeats - time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT][ACTION_MAX_MENU + 1]; + time_util::time_point m_actionRepeatTimer[XUSER_MAX_COUNT] + [ACTION_MAX_MENU + 1]; float m_fScreenWidth; float m_fScreenHeight; @@ -277,8 +278,8 @@ public: } virtual void render() = 0; - void getRenderDimensions(IPlatformRenderer::eViewportType viewport, S32& width, - S32& height); + void getRenderDimensions(IPlatformRenderer::eViewportType viewport, + S32& width, S32& height); void setupRenderPosition(IPlatformRenderer::eViewportType viewport); void setupRenderPosition(S32 xOrigin, S32 yOrigin); @@ -431,12 +432,14 @@ public: 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 IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); 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 IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr, char* pwchFormatString = nullptr); private: @@ -450,11 +453,13 @@ private: public: IPlatformStorage::EMessageResult RequestUGCMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); IPlatformStorage::EMessageResult RequestContentRestrictedMessageBox( int title = -1, int message = -1, int iPad = -1, - int (*Func)(void*, int, const IPlatformStorage::EMessageResult) = nullptr, + int (*Func)(void*, int, + const IPlatformStorage::EMessageResult) = nullptr, void* lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index b949956d4..58ad0bc69 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,7 +1,5 @@ #include "UIGroup.h" -#include "platform/profile/profile.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" @@ -11,6 +9,8 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" class UIScene; @@ -251,7 +251,9 @@ void UIGroup::SetViewportType(IPlatformRenderer::eViewportType type) { } } -IPlatformRenderer::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 806c269c4..162369f53 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -1,10 +1,10 @@ #pragma once #include -#include "platform/renderer/renderer.h" +#include "UILayer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" -#include "UILayer.h" +#include "platform/renderer/renderer.h" class UIComponent_Tooltips; class UIComponent_TutorialPopup; diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index ba67117b4..a348916ba 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -2,7 +2,6 @@ #include -#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" @@ -79,6 +78,7 @@ #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "platform/renderer/renderer.h" UILayer::UILayer(UIGroup* parent) { m_parentGroup = parent; @@ -138,7 +138,8 @@ void UILayer::tick() { } } -void UILayer::render(S32 width, S32 height, IPlatformRenderer::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()); diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index 540c3bd24..8e6d7fe5b 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -6,9 +6,9 @@ #include #include -#include "platform/renderer/renderer.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Iggy/include/rrCore.h" +#include "platform/renderer/renderer.h" // using namespace std; class UIScene; @@ -44,7 +44,8 @@ public: UILayer(UIGroup* parent); void tick(); - void render(S32 width, S32 height, IPlatformRenderer::eViewportType viewport); + void render(S32 width, S32 height, + IPlatformRenderer::eViewportType viewport); void getRenderDimensions(S32& width, S32& height); void DestroyAll(); diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index ebb660d42..a597b5735 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -13,11 +13,11 @@ #include #include -#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" #include "app/linux/Iggy/include/iggy.h" +#include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -55,10 +55,8 @@ class UIControl; currentRoot = lastRoot; \ } -#define UI_MAP_NAME(var, name) \ - { \ - var = registerFastName(name); \ - } +#define UI_MAP_NAME(var, name) \ + { var = registerFastName(name); } class UIScene { friend class UILayer; diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index fe5065a90..2d09b2ad3 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -8,8 +8,8 @@ #endif #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" #include "platform/fs/fs.h" +#include "util/StringHelpers.h" UITTFFont::UITTFFont(const std::string& name, const std::string& path, S32 fallbackCharacter) diff --git a/targets/app/common/XboxStubs.cpp b/targets/app/common/XboxStubs.cpp index d0b57de3d..913f61e07 100644 --- a/targets/app/common/XboxStubs.cpp +++ b/targets/app/common/XboxStubs.cpp @@ -1,6 +1,7 @@ -#include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" +#include "platform/PlatformTypes.h" + bool IsEqualXUID(PlayerUID a, PlayerUID b) { return a == b; } uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, diff --git a/targets/app/linux/Iggy/include/iggy.h b/targets/app/linux/Iggy/include/iggy.h index 23c441c61..188064dac 100644 --- a/targets/app/linux/Iggy/include/iggy.h +++ b/targets/app/linux/Iggy/include/iggy.h @@ -488,15 +488,16 @@ IDOCN typedef struct { rrbool(RADLINK* connection_valid)( Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy // Explorer is still connected - S32(RADLINK* poll_command)( - Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes + S32(RADLINK* poll_command) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // stores command in *buffer, returns number of bytes void(RADLINK* send_command)( Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands + S32(RADLINK* get_storage) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // returns temporary storage Iggy + // can use for assembling commands rrbool(RADLINK* attach)( Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, IggyForPerfmonFunctions* diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h index 72fe03e0e..cdca7a091 100644 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h +++ b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h @@ -1,7 +1,7 @@ #pragma once -#include "platform/PlatformTypes.h" #include "app/common/Leaderboards/LeaderboardManager.h" +#include "platform/PlatformTypes.h" class LinuxLeaderboardManager : public LeaderboardManager { public: diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 0e6d59c73..54fc0830b 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -4,18 +4,18 @@ #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "platform/C4JThread.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" +#include "platform/C4JThread.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" LinuxGame app; @@ -31,19 +31,17 @@ void LinuxGame::ExitGame() { PlatformRenderer.Close(); } void LinuxGame::FatalLoadError() { - app.DebugPrintf( - "LinuxGame::FatalLoadError - asserting 0 and dying...\n"); + app.DebugPrintf("LinuxGame::FatalLoadError - asserting 0 and dying...\n"); assert(0); } void LinuxGame::CaptureSaveThumbnail() {} void LinuxGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} + unsigned int* thumbnailSize) {} void LinuxGame::ReleaseSaveThumbnail() {} -void LinuxGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} +void LinuxGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, + unsigned int* screenshotSize) {} void LinuxGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// @@ -122,15 +120,14 @@ void LinuxGame::TemporaryCreateGameStart() { } int LinuxGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) { return -1; } int LinuxGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { +int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { return -1; } diff --git a/targets/app/linux/Stubs/iggy_stubs.h b/targets/app/linux/Stubs/iggy_stubs.h index dc9d7a0d8..16ac44909 100644 --- a/targets/app/linux/Stubs/iggy_stubs.h +++ b/targets/app/linux/Stubs/iggy_stubs.h @@ -3,14 +3,13 @@ #pragma once +#include +#include + #include "app/linux/Iggy/include/iggy.h" -#include -#include - #define STUBBED \ - { \ - } + {} RADEXPFUNC inline IggyValuePath* RADEXPLINK IggyPlayerRootPath(Iggy* f) { STUBBED; diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp index eae540d50..d70bb5d3d 100644 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp +++ b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp @@ -38,8 +38,8 @@ // We temporarily disable this warning for the shared interface portions #pragma warning(push) -#pragma warning(disable \ - : 4201) // nonstandard extension used : nameless struct/union +#pragma warning( \ + disable : 4201) // nonstandard extension used : nameless struct/union #include #include diff --git a/targets/app/windows/Iggy/include/gdraw.h b/targets/app/windows/Iggy/include/gdraw.h index d1c58dfe8..c6a171970 100644 --- a/targets/app/windows/Iggy/include/gdraw.h +++ b/targets/app/windows/Iggy/include/gdraw.h @@ -243,8 +243,8 @@ typedef struct GDrawRenderState { S32 id; // Object "identifier" used for high-quality AA mode U32 test_id : 1; // Whether to test zbuffer == id U32 set_id : 1; // Whether to set zbuffer == id - U32 use_world_space - : 1; // Whether primitive is defined in object space or world space + U32 use_world_space : 1; // Whether primitive is defined in object space or + // world space U32 scissor : 1; // Whether rendering will be clipped to // $(GDrawRenderState::scissor_rect) U32 identical_state : 1; // Whether state is identical to the one used for diff --git a/targets/app/windows/Iggy/include/iggy.h b/targets/app/windows/Iggy/include/iggy.h index c1d89e639..bb84c5014 100644 --- a/targets/app/windows/Iggy/include/iggy.h +++ b/targets/app/windows/Iggy/include/iggy.h @@ -488,15 +488,16 @@ IDOCN typedef struct { rrbool(RADLINK* connection_valid)( Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy // Explorer is still connected - S32(RADLINK* poll_command)( - Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes + S32(RADLINK* poll_command) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // stores command in *buffer, returns number of bytes void(RADLINK* send_command)( Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands + S32(RADLINK* get_storage) + (Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // returns temporary storage Iggy + // can use for assembling commands rrbool(RADLINK* attach)( Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, IggyForPerfmonFunctions* diff --git a/targets/app/windows/Iggy/include/rrCore.h b/targets/app/windows/Iggy/include/rrCore.h index 83110cabc..54cc183f0 100644 --- a/targets/app/windows/Iggy/include/rrCore.h +++ b/targets/app/windows/Iggy/include/rrCore.h @@ -58,1315 +58,1340 @@ // __RADNOVARARGMACROS__ means #defines can't use ... - #ifdef WINAPI_FAMILY - // If this is #defined, we might be in a Windows Store App. But - // VC++ by default #defines this to a symbolic name, not an integer - // value, and those names are defined in "winapifamily.h". So if - // WINAPI_FAMILY is #defined, #include the header so we can parse it. - #include - #define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) - #else - #define RAD_WINAPI_IS_APP 0 - #endif +#ifdef WINAPI_FAMILY +// If this is #defined, we might be in a Windows Store App. But +// VC++ by default #defines this to a symbolic name, not an integer +// value, and those names are defined in "winapifamily.h". So if +// WINAPI_FAMILY is #defined, #include the header so we can parse it. +#include +#define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) +#else +#define RAD_WINAPI_IS_APP 0 +#endif - #ifndef __RADRES__ - // Theoretically, this is to pad structs on platforms that don't support pragma pack or do it poorly. (PS3, PS2) - // In general it is assumed that your padding is set via pragma, so this is just a struct. - #define RADSTRUCT struct +#ifndef __RADRES__ +// Theoretically, this is to pad structs on platforms that don't support pragma +// pack or do it poorly. (PS3, PS2) In general it is assumed that your padding +// is set via pragma, so this is just a struct. +#define RADSTRUCT struct - #ifdef __GNUC_MINOR__ - // make a combined GCC version for testing : +#ifdef __GNUC_MINOR__ +// make a combined GCC version for testing : - #define __RAD_GCC_VERSION__ (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) +#define __RAD_GCC_VERSION__ \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - /* Test for GCC > 3.2.0 */ - // #if GCC_VERSION > 30200 - #endif +/* Test for GCC > 3.2.0 */ +// #if GCC_VERSION > 30200 +#endif - #if defined(__RADX32__) +#if defined(__RADX32__) - #define __RADX86__ - #define __RADMMX__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#define __RADX86__ +#define __RADMMX__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - // known platforms under the RAD generic build type - #if defined(_WIN32) || defined(_Windows) || defined(WIN32) || defined(__WINDOWS__) || defined(_WINDOWS) - #define __RADNT__ - #define __RADWIN__ - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #define __RADMAC__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #elif defined(__linux__) - #define __RADLINUX__ - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif +// known platforms under the RAD generic build type +#if defined(_WIN32) || defined(_Windows) || defined(WIN32) || \ + defined(__WINDOWS__) || defined(_WINDOWS) +#define __RADNT__ +#define __RADWIN__ +#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ + defined(THINK_C) || defined(powerc) || defined(macintosh) || \ + defined(__powerc) || defined(__APPLE__) || defined(__MACH__) +#define __RADMAC__ +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#elif defined(__linux__) +#define __RADLINUX__ +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif #elif defined(ANDROID) - #define __RADANDROID__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #ifdef __i386__ - #define __RADX86__ - #else - #define __RADARM__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) +#define __RADANDROID__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#ifdef __i386__ +#define __RADX86__ +#else +#define __RADARM__ +#endif +#define RADINLINE inline +#define RADRESTRICT __restrict +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) #elif defined(__QNX__) - #define __RAD32__ - #define __RADQNX__ +#define __RAD32__ +#define __RADQNX__ #ifdef __arm__ - #define __RADARM__ +#define __RADARM__ #elif defined __i386__ - #define __RADX86__ +#define __RADX86__ #else - #error Unknown processor -#endif - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#error Unknown processor +#endif +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) -#elif defined(__linux__) && defined(__arm__) //This should pull in Raspberry Pi as well +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#elif defined(__linux__) && \ + defined(__arm__) // This should pull in Raspberry Pi as well - #define __RAD32__ - #define __RADLINUX__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict +#define __RAD32__ +#define __RADLINUX__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) #elif defined(__native_client__) - #define __RADNACL__ - #define __RAD32__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || defined(_XBOX_ONE) - - #define __RADDURANGO__ 1 - #define __RADXBOXONE__ 1 - #if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat - #define __RADSEKRIT__ 1 - #endif - - #define __RADWIN__ - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - #define __RADWINRTAPI__ - - #elif defined(__ORBIS__) - - #define __RADPS4__ - #if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat - #define __RADSEKRIT2__ 1 - #endif - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP - - #define __RADWINRTAPI__ - #define __RADWIN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #if defined(_M_IX86) // WinRT on x86 - - #define __RAD32__ - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_X64) // WinRT on x64 - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RADMMX__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - - #elif defined(_M_ARM) // WinRT on ARM - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - - #else - - #error Unrecognized WinRT platform! - - #endif - - #elif defined(_WIN64) - - #define __RADWIN__ - #define __RADNT__ - // See note at top for why both __RAD32__ and __RAD64__ are defined. - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RADMMX__ - #define __RADX86__ - #define __RAD64REGS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE __inline - #define RADRESTRICT __restrict - - #elif defined(GENERIC_ARM) - - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it - - #define __RADWIIU__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - - #elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) - - #define __RADWII__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #elif defined(NN_PLATFORM_CTR) - - #define __RAD3DS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(GEKKO) - - #define __RADNGC__ - #define __RAD32__ - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT // __restrict not supported on cw - - #elif defined(SDK_ARM9) || defined(SDK_TWL) || (defined(__arm) && defined(__MWERKS__)) - - #define __RADNDS__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define __RADFIXEDPOINT__ - #define RADINLINE inline - #if (defined(__GCC__) || defined(__GNUC__)) - #define RADRESTRICT __restrict - #else - #define RADRESTRICT // __restrict not supported on cw - #endif - - #if defined(SDK_TWL) - #define __RADTWL__ - #endif - - #elif defined(R5900) - - #define __RADPS2__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RAD64REGS__ - #define U128 u_long128 - - #if !defined(__MWERKS__) - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #elif defined(__psp__) - - #define __RADPSP__ - #define __RAD32__ - #define __RADMIPS__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #elif defined(__psp2__) - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #define __RADPSP2__ - #define __RAD32__ - #define __RADARM__ - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - - // need packed attribute for struct with snc? - #elif defined(__CELLOS_LV2__) - - // CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU - - #ifdef __SPU__ - #define __RADSPU__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #else - #define __RAD64REGS__ - #define __RADPS3__ - #define __RADPPC__ - #define __RAD32__ - #define __RADCELL__ - #define __RADBIGENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADALTIVEC__ - #endif - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #ifndef __LP32__ - #error "PS3 32bit ABI support only" - #endif - #elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc) || defined(__APPLE__) || defined(__MACH__) - #ifdef __APPLE__ - #include "TargetConditionals.h" - #endif - - #if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) - - // iPhone/iPad/iOS - #define __RADIPHONE__ - #define __RADMACAPI__ - - #define __RAD32__ - #if defined(__x86_64__) - #define __RAD64__ - #endif - - #define __RADLITTLEENDIAN__ - #define RADINLINE inline - #define RADRESTRICT __restrict - #define __RADMACH__ - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR - #if defined( __x86_64__) - #define __RADX64__ - #else - #define __RADX86__ - #endif - #define __RADIPHONESIM__ - #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE - #define __RADARM__ - #endif - #else - - // An actual MacOSX machine - #define __RADMAC__ - #define __RADMACAPI__ - - #if defined(powerc) || defined(__powerc) || defined(__ppc__) - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #elif defined(__i386__) - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #elif defined(__x86_64__) - #define __RAD32__ - #define __RAD64__ - #define __RADX86__ - #define __RADX64__ - #define __RAD64REGS__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define RADRESTRICT __restrict - #else - #define __RAD68K__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #define RADRESTRICT - #endif - - #define __RAD32__ - - #if defined(__MWERKS__) - #if (defined(__cplusplus) || ! __option(only_std_keywords)) - #define RADINLINE inline - #endif - #ifdef __MACH__ - #define __RADMACH__ - #endif - #elif defined(__MRC__) - #if defined(__cplusplus) - #define RADINLINE inline - #endif - #elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) - #define RADINLINE inline - #define __RADMACH__ - - #undef RADRESTRICT /* could have been defined above... */ - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - #endif - - #ifdef __RADX86__ - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - - #ifdef TARGET_API_MAC_CARBON - #if TARGET_API_MAC_CARBON - #ifndef __RADCARBON__ - #define __RADCARBON__ - #endif - #endif - #endif - #endif - #elif defined(__linux__) - - #define __RADLINUX__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #define __RADX86__ - #ifdef __x86_64 - #define __RAD32__ - #define __RAD64__ - #define __RADX64__ - #define __RAD64REGS__ - #else - #define __RAD32__ - #endif - #define RADINLINE inline - #define RADRESTRICT __restrict - - #undef RADSTRUCT - #define RADSTRUCT struct __attribute__((__packed__)) - - #else - - #if _MSC_VER >= 1400 - #undef RADRESTRICT - #define RADRESTRICT __restrict - #else - #define RADRESTRICT - #define __RADNOVARARGMACROS__ - #endif - - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADPPC__ - #define __RADBIGENDIAN__ - #define __RADALTIVEC__ - #else - #define __RADX86__ - #define __RADMMX__ - #define __RADLITTLEENDIAN__ - #endif - - #ifdef __MWERKS__ - #define _WIN32 - #endif - - #ifdef __DOS__ - #define __RADDOS__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #define __RADNOVARARGMACROS__ - #endif - - #ifdef __386__ - #define __RAD32__ - #endif - - #ifdef _Windows //For Borland - #ifdef __WIN32__ - #define WIN32 - #else - #define __WINDOWS__ - #endif - #endif - - #ifdef _WINDOWS //For MS - #ifndef _WIN32 - #define __WINDOWS__ - #endif - #endif - - #ifdef _WIN32 - #if defined(_XENON) || ( defined(_XBOX_VER) && (_XBOX_VER == 200) ) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #elif !defined(__RADWINRTAPI__) - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __NT__ - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #define __RAD64REGS__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #else - #ifdef __WINDOWS_386__ - #define __RADWIN__ - #define __RADWINEXT__ - #define __RAD32__ - #define S64_DEFINED // turn off these types - #define U64_DEFINED - #define S64 double //should error - #define U64 double //should error - #else - #ifdef __WINDOWS__ - #define __RADWIN__ - #define __RAD16__ - #else - #ifdef WIN32 - #if defined(_XENON) || (_XBOX_VER == 200) - // Remember that Xenon also defines _XBOX - #define __RADXENON__ - #elif defined(_XBOX) - #define __RADXBOX__ - #else - #define __RADNT__ - #endif - #define __RADWIN__ - #define __RAD32__ - #endif - #endif - #endif - #endif - #endif - - #ifdef __WATCOMC__ - #define RADINLINE - #else - #define RADINLINE __inline - #endif - #endif - - #if defined __RADMAC__ || defined __RADIPHONE__ - #define __RADBSD__ - #endif - - #if defined __RADBSD__ || defined __RADLINUX__ - #define __RADPOSIX__ - #endif - - #if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ - !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ - !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ - !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && !defined(__RADSPU__) && \ - !defined(__RADWII__) && !defined(__RADIPHONE__) && !defined(__RADX32__) && !defined(__RADARM__) && \ - !defined(__RADWIIU__) && !defined(__RADANDROID__) && !defined(__RADNACL__) && !defined (__RADQNX__) ) - #error "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." - #endif - - - #ifdef __RADFINAL__ - #define RADTODO(str) { char __str[0]=str; } - #else - #define RADTODO(str) - #endif - - #ifdef __RADX32__ - #if defined(_MSC_VER) - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #else - #define RADLINK __attribute__((stdcall)) - #define RADEXPLINK __attribute__((stdcall)) - #endif - #define RADEXPFUNC RADDEFFUNC - - #elif (defined(__RADNGC__) || defined(__RADWII__) || defined( __RADPS2__) || \ - defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ - defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ - (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || defined(__RADWIIU__) || defined(__RADPS4__) ) - - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADANDROID__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADNACL__) - #define RADLINK - #define RADEXPLINK - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - #elif defined(__RADLINUX__) || defined (__RADQNX__) - - #ifdef __RAD64__ - #define RADLINK - #define RADEXPLINK - #else - #define RADLINK __attribute__((cdecl)) - #define RADEXPLINK __attribute__((cdecl)) - #endif - - #define RADEXPFUNC RADDEFFUNC - #define RADASMLINK - - #elif defined(__RADMAC__) - - // this define is for CodeWarrior 11's stupid new libs (even though - // we don't use longlong's). - - #define __MSL_LONGLONG_SUPPORT__ - - #define RADLINK - #define RADEXPLINK - - #if defined(__CFM68K__) || defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(export) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(import) - #endif - #else - #if defined(__RADMACH__) && !defined(__MWERKS__) - #ifdef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #define RADASMLINK - - #else - - #ifdef __RADNT__ - #ifndef _WIN32 - #define _WIN32 - #endif - #ifndef WIN32 - #define WIN32 - #endif - #endif - - #ifdef __RADWIN__ - #ifdef __RAD32__ - - #ifdef __RADXBOX__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADXENON__) || defined(__RADDURANGO__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #define RADEXPFUNC RADDEFFUNC - - #elif defined(__RADWINRTAPI__) - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - - #elif defined(__RADNTBUILDLINUX__) - - #define RADLINK __cdecl - #define RADEXPLINK __cdecl - #define RADEXPFUNC RADDEFFUNC - - #else - #ifdef __RADNT__ - - #define RADLINK __stdcall - #define RADEXPLINK __stdcall - - #if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) ) - #define RADEXPFUNC RADDEFFUNC - #else - #ifndef __RADINDLL__ - #define RADEXPFUNC RADDEFFUNC __declspec(dllimport) - #ifdef __BORLANDC__ - #if __BORLANDC__<=0x460 - #undef RADEXPFUNC - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADEXPFUNC RADDEFFUNC __declspec(dllexport) - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __far __pascal __export - #define RADEXPFUNC RADDEFFUNC - #endif - #else - #define RADLINK __pascal - #define RADEXPLINK __pascal - #define RADEXPFUNC RADDEFFUNC - #endif - - #define RADASMLINK __cdecl - - #endif - - #if !defined(__RADXBOX__) && !defined(__RADXENON__) && !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) - #ifdef __RADWIN__ - #ifndef _WINDOWS - #define _WINDOWS - #endif - #endif - #endif - - #ifdef __RADLITTLEENDIAN__ - #ifdef __RADBIGENDIAN__ - #error both endians !? - #endif - #endif - - #if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) - #error neither endian! - #endif - - - //----------------------------------------------------------------- - - #ifndef RADDEFFUNC - - #ifdef __cplusplus - #define RADDEFFUNC extern "C" - #define RADDEFSTART extern "C" { - #define RADDEFEND } - #define RADDEFINEDATA extern "C" - #define RADDECLAREDATA extern "C" - #define RADDEFAULT( val ) =val - - #define RR_NAMESPACE rr - #define RR_NAMESPACE_START namespace RR_NAMESPACE { - #define RR_NAMESPACE_END }; - #define RR_NAMESPACE_USE using namespace RR_NAMESPACE; - - #else - #define RADDEFFUNC - #define RADDEFSTART - #define RADDEFEND - #define RADDEFINEDATA - #define RADDECLAREDATA extern - #define RADDEFAULT( val ) - - #define RR_NAMESPACE - #define RR_NAMESPACE_START - #define RR_NAMESPACE_END - #define RR_NAMESPACE_USE - - #endif - - #endif - - // probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) - #if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || defined(__RADPSP2__) || \ - defined(__RADPS3__) || defined(__RADSPU__) || defined(__RADPS4__) || \ - defined(__RADLINUX__) || defined(__RADMAC__)) || defined(__RADNDS__) || defined(__RAD3DS__) || \ - defined(__RADIPHONE__) || defined(__RADANDROID__) || defined (__RADQNX__) - #define RAD_ALIGN(type,var,num) type __attribute__ ((aligned (num))) var - #elif (defined(__RADNGC__) || defined(__RADPS2__)) - #define RAD_ALIGN(type,var,num) __attribute__ ((aligned (num))) type var - #elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) - #define RAD_ALIGN(type,var,num) type __declspec(align(num)) var - #else - // NOTE: / / is a guaranteed parse error in C/C++. - #define RAD_ALIGN(type,var,num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / - #endif - - // WARNING : RAD_TLS should really only be used for debug/tools stuff - // it's not reliable because even if we are built as a lib, our lib can - // be put into a DLL and then it doesn't work - #if defined(__RADNT__) || defined(__RADXENON__) - #ifndef __RADINDLL__ - // note that you can't use this in windows DLLs - #define RAD_TLS(type,var) __declspec(thread) type var - #endif - #elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) - // works on PS3/gcc I believe : - #define RAD_TLS(type,var) __thread type var - #else - // RAD_TLS not defined - #endif - - // Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. - // The size of integers is specified explicitly in the code, i.e. u32 or whatever. - - #define RAD_S8 signed char - #define RAD_U8 unsigned char - - #if defined(__RAD64__) - // Remember that __RAD32__ will also be defined! - #if defined(__RADX64__) - // x64 still has 32-bit ints! - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // But pointers are 64 bits. - #if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64 ) - #define RAD_SINTa __w64 signed int64_t - #define RAD_UINTa __w64 unsigned int64_t - #else // non-vc.net compiler or /Wp64 turned off - #define RAD_UINTa unsigned long long - #define RAD_SINTa signed long long - #endif - #else - #error Unknown 64-bit processor (see radbase.h) - #endif - #elif defined(__RAD32__) - #define RAD_U32 unsigned int - #define RAD_S32 signed int - // Pointers are 32 bits. - - #if ( ( defined(_MSC_VER) && (_MSC_VER >= 1300 ) ) && ( defined(_Wp64) && ( _Wp64 ) ) ) - #define RAD_SINTa __w64 signed long - #define RAD_UINTa __w64 unsigned long - #else // non-vc.net compiler or /Wp64 turned off - #ifdef _Wp64 - #define RAD_SINTa signed long - #define RAD_UINTa unsigned long - #else - #define RAD_SINTa signed int - #define RAD_UINTa unsigned int - #endif - #endif - #else - #define RAD_U32 unsigned long - #define RAD_S32 signed long - // Pointers in 16-bit land are still 32 bits. - #define RAD_UINTa unsigned long - #define RAD_SINTa signed long - #endif - - #define RAD_F32 float - #if defined(__RADPS2__) || defined(__RADPSP__) - typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_F64; - #define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 - #else - #define RAD_F64 double - #define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 - #endif - - #if (defined(__RADMAC__) || defined(__MRC__) || defined( __RADNGC__ ) || \ - defined(__RADLINUX__) || defined( __RADWII__ ) || defined(__RADWIIU__) || \ - defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADPS4__) || \ - defined(__RADSPU__) || defined(__RADIPHONE__) || defined(__RADNACL__) || defined( __RADANDROID__) || defined( __RADQNX__ ) ) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADPS2__) - #define RAD_U64 unsigned long - #define RAD_S64 signed long - #elif defined(__RADARM__) - #define RAD_U64 unsigned long long - #define RAD_S64 signed long long - #elif defined(__RADX64__) || defined(__RAD32__) - #define RAD_U64 unsigned int64_t - #define RAD_S64 signed int64_t - #else - // 16-bit - typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s - { // while using the same space - RAD_U32 vals[ 2 ]; - } RAD_U64; - typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s - { // while using the same space - RAD_S32 vals[ 2 ]; - } RAD_S64; - #endif - - #if defined(__RAD32__) - #define PTR4 - #define RAD_U16 unsigned short - #define RAD_S16 signed short - #else - #define PTR4 __far - #define RAD_U16 unsigned int - #define RAD_S16 signed int - #endif - - //------------------------------------------------- - // RAD_PTRBITS and such defined here without using sizeof() - // so that they can be used in align() and other macros - - #ifdef __RAD64__ - - #define RAD_PTRBITS 64 - #define RAD_PTRBYTES 8 - #define RAD_TWOPTRBYTES 16 - - #else - - #define RAD_PTRBITS 32 - #define RAD_PTRBYTES 4 - #define RAD_TWOPTRBYTES 8 - - #endif - - - //------------------------------------------------- - // UINTr = int the size of a register - - #ifdef __RAD64REGS__ - - #define RAD_UINTr RAD_U64 - #define RAD_SINTr RAD_S64 - - #else - - #define RAD_UINTr RAD_U32 - #define RAD_SINTr RAD_S32 - - #endif - - //=========================================================================== - - /* - // CB : meh this is enough of a mess that it's probably best to just let each - #if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define __RADX86INTRIN2003__ - #endif - */ - - // RADASSUME(expr) tells the compiler that expr is always true - // RADUNREACHABLE must never be reachable - even in event of error - // eg. it's okay for compiler to generate completely invalid code after RADUNREACHABLE - - #ifdef _MSC_VER - #define RADFORCEINLINE __forceinline - #if _MSC_VER >= 1300 - #define RADNOINLINE __declspec(noinline) - #else - #define RADNOINLINE - #endif - #define RADUNREACHABLE __assume(0) - #define RADASSUME(exp) __assume(exp) - #elif defined(__clang__) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #define RADUNREACHABLE __builtin_unreachable() - - #if __has_builtin(__builtin_assume) - #define RADASSUME(exp) __builtin_assume(exp) - #else - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #endif - #elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) - #ifdef _DEBUG - #define RADFORCEINLINE inline - #else - #define RADFORCEINLINE inline __attribute((always_inline)) - #endif - #define RADNOINLINE __attribute__((noinline)) - - #if __RAD_GCC_VERSION__ >= 40500 - #define RADUNREACHABLE __builtin_unreachable() - #define RADASSUME(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) __builtin_unreachable(); ) - #else - #define RADUNREACHABLE RAD_INFINITE_LOOP( RR_BREAK(); ) - #define RADASSUME(exp) - #endif - #elif defined(__CWCC__) - #define RADFORCEINLINE inline - #define RADNOINLINE __attribute__((never_inline)) - #define RADUNREACHABLE - #define RADASSUME(x) (void)0 - #else - // ? #define RADFORCEINLINE ? - #define RADFORCEINLINE inline - #define RADNOINLINE - #define RADASSUME(x) (void)0 - #endif - - //=========================================================================== - - // RAD_ALIGN_HINT tells the compiler how a given pointer is aligned - // it *must* be true, but the compiler may or may not use that information - // it is not for cases where the pointer is to an inherently aligned data type, - // it's when the compiler cannot tell the alignment but you have extra information. - // eg : - // U8 * ptr = rrMallocAligned(256,16); - // RAD_ALIGN_HINT(ptr,16,0); - - #ifdef __RADSPU__ - #define RAD_ALIGN_HINT(ptr,alignment,offset) __align_hint(ptr,alignment,offset); RR_ASSERT( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #else - #define RAD_ALIGN_HINT(ptr,alignment,offset) RADASSUME( ((UINTa)(ptr) & ((alignment)-1)) == (UINTa)(offset) ) - #endif - - //=========================================================================== - - // RAD_EXPECT is to tell the compiler the *likely* value of an expression - // different than RADASSUME in that expr might not have that value - // it's use for branch code layout and static branch prediction - // condition can technically be a variable but should usually be 0 or 1 - - #if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) - - // __builtin_expect returns value of expr - #define RAD_EXPECT(expr,cond) __builtin_expect(expr,cond) - - #else - - #define RAD_EXPECT(expr,cond) (expr) - - #endif - - // helpers for doing an if ( ) with expect : - // if ( RAD_LIKELY(expr) ) { ... } - - #define RAD_LIKELY(expr) RAD_EXPECT(expr,1) - #define RAD_UNLIKELY(expr) RAD_EXPECT(expr,0) - - //=========================================================================== - - // __RADX86ASM__ means you can use __asm {} style inline assembly - #if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) - #define __RADX86ASM__ - #endif - - //------------------------------------------------- - // typedefs : - - #ifndef RADNOTYPEDEFS - - #ifndef S8_DEFINED - #define S8_DEFINED - typedef RAD_S8 S8; - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - typedef RAD_U8 U8; - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - typedef RAD_S16 S16; - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - typedef RAD_U16 U16; - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - typedef RAD_S32 S32; - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - typedef RAD_U32 U32; - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - typedef RAD_S64 S64; - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - typedef RAD_U64 U64; - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - typedef RAD_F32 F32; - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - typedef RAD_F64 F64; - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - typedef RAD_F64_OR_32 F64_OR_32; - #endif - - // UINTa and SINTa are the ints big enough for an address - - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - typedef RAD_SINTa SINTa; - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - typedef RAD_UINTa UINTa; - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - typedef RAD_UINTr UINTr; - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - typedef RAD_SINTr SINTr; - #endif - - #elif !defined(RADNOTYPEDEFINES) - - #ifndef S8_DEFINED - #define S8_DEFINED - #define S8 RAD_S8 - #endif - - #ifndef U8_DEFINED - #define U8_DEFINED - #define U8 RAD_U8 - #endif - - #ifndef S16_DEFINED - #define S16_DEFINED - #define S16 RAD_S16 - #endif - - #ifndef U16_DEFINED - #define U16_DEFINED - #define U16 RAD_U16 - #endif - - #ifndef S32_DEFINED - #define S32_DEFINED - #define S32 RAD_S32 - #endif - - #ifndef U32_DEFINED - #define U32_DEFINED - #define U32 RAD_U32 - #endif - - #ifndef S64_DEFINED - #define S64_DEFINED - #define S64 RAD_S64 - #endif - - #ifndef U64_DEFINED - #define U64_DEFINED - #define U64 RAD_U64 - #endif - - #ifndef F32_DEFINED - #define F32_DEFINED - #define F32 RAD_F32 - #endif - - #ifndef F64_DEFINED - #define F64_DEFINED - #define F64 RAD_F64 - #endif - - #ifndef F64_OR_32_DEFINED - #define F64_OR_32_DEFINED - #define F64_OR_32 RAD_F64_OR_32 - #endif - - // UINTa and SINTa are the ints big enough for an address (pointer) - #ifndef SINTa_DEFINED - #define SINTa_DEFINED - #define SINTa RAD_SINTa - #endif - - #ifndef UINTa_DEFINED - #define UINTa_DEFINED - #define UINTa RAD_UINTa - #endif - - #ifndef UINTr_DEFINED - #define UINTr_DEFINED - #define UINTr RAD_UINTr - #endif - - #ifndef SINTr_DEFINED - #define SINTr_DEFINED - #define SINTr RAD_SINTr - #endif - - #endif - - /// Some error-checking. - #if defined(__RAD64__) && !defined(__RAD32__) - // See top of file for why this is. - #error __RAD64__ must not be defined without __RAD32__ (see radbase.h) - #endif +#define __RADNACL__ +#define __RAD32__ +#define __RADLITTLEENDIAN__ +#define __RADX86__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || \ + defined(_XBOX_ONE) + +#define __RADDURANGO__ 1 +#define __RADXBOXONE__ 1 +#if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat +#define __RADSEKRIT__ 1 +#endif + +#define __RADWIN__ +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict +#define __RADWINRTAPI__ + +#elif defined(__ORBIS__) + +#define __RADPS4__ +#if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat +#define __RADSEKRIT2__ 1 +#endif +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP + +#define __RADWINRTAPI__ +#define __RADWIN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict + +#if defined(_M_IX86) // WinRT on x86 + +#define __RAD32__ +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ + +#elif defined(_M_X64) // WinRT on x64 +#define __RAD32__ +#define __RAD64__ +#define __RADX86__ +#define __RADX64__ +#define __RADMMX__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ + +#elif defined(_M_ARM) // WinRT on ARM + +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ + +#else + +#error Unrecognized WinRT platform! + +#endif + +#elif defined(_WIN64) + +#define __RADWIN__ +#define __RADNT__ +// See note at top for why both __RAD32__ and __RAD64__ are defined. +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RADMMX__ +#define __RADX86__ +#define __RAD64REGS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE __inline +#define RADRESTRICT __restrict + +#elif defined(GENERIC_ARM) + +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define __RADFIXEDPOINT__ +#define RADINLINE inline +#if (defined(__GCC__) || defined(__GNUC__)) +#define RADRESTRICT __restrict +#else +#define RADRESTRICT // __restrict not supported on cw +#endif +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it + +#define __RADWIIU__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) + +#define __RADWII__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#elif defined(NN_PLATFORM_CTR) + +#define __RAD3DS__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(GEKKO) + +#define __RADNGC__ +#define __RAD32__ +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT // __restrict not supported on cw + +#elif defined(SDK_ARM9) || defined(SDK_TWL) || \ + (defined(__arm) && defined(__MWERKS__)) + +#define __RADNDS__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define __RADFIXEDPOINT__ +#define RADINLINE inline +#if (defined(__GCC__) || defined(__GNUC__)) +#define RADRESTRICT __restrict +#else +#define RADRESTRICT // __restrict not supported on cw +#endif + +#if defined(SDK_TWL) +#define __RADTWL__ +#endif + +#elif defined(R5900) + +#define __RADPS2__ +#define __RAD32__ +#define __RADMIPS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RAD64REGS__ +#define U128 u_long128 + +#if !defined(__MWERKS__) +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif + +#elif defined(__psp__) + +#define __RADPSP__ +#define __RAD32__ +#define __RADMIPS__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#elif defined(__psp2__) + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#define __RADPSP2__ +#define __RAD32__ +#define __RADARM__ +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict + +// need packed attribute for struct with snc? +#elif defined(__CELLOS_LV2__) + +// CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU + +#ifdef __SPU__ +#define __RADSPU__ +#define __RAD32__ +#define __RADCELL__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#else +#define __RAD64REGS__ +#define __RADPS3__ +#define __RADPPC__ +#define __RAD32__ +#define __RADCELL__ +#define __RADBIGENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RADALTIVEC__ +#endif + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#ifndef __LP32__ +#error "PS3 32bit ABI support only" +#endif +#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ + defined(THINK_C) || defined(powerc) || defined(macintosh) || \ + defined(__powerc) || defined(__APPLE__) || defined(__MACH__) +#ifdef __APPLE__ +#include "TargetConditionals.h" +#endif + +#if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ + (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) + +// iPhone/iPad/iOS +#define __RADIPHONE__ +#define __RADMACAPI__ + +#define __RAD32__ +#if defined(__x86_64__) +#define __RAD64__ +#endif + +#define __RADLITTLEENDIAN__ +#define RADINLINE inline +#define RADRESTRICT __restrict +#define __RADMACH__ + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR +#if defined(__x86_64__) +#define __RADX64__ +#else +#define __RADX86__ +#endif +#define __RADIPHONESIM__ +#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +#define __RADARM__ +#endif +#else + +// An actual MacOSX machine +#define __RADMAC__ +#define __RADMACAPI__ + +#if defined(powerc) || defined(__powerc) || defined(__ppc__) +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#define RADRESTRICT +#elif defined(__i386__) +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define RADRESTRICT __restrict +#elif defined(__x86_64__) +#define __RAD32__ +#define __RAD64__ +#define __RADX86__ +#define __RADX64__ +#define __RAD64REGS__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define RADRESTRICT __restrict +#else +#define __RAD68K__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#define RADRESTRICT +#endif + +#define __RAD32__ + +#if defined(__MWERKS__) +#if (defined(__cplusplus) || !__option(only_std_keywords)) +#define RADINLINE inline +#endif +#ifdef __MACH__ +#define __RADMACH__ +#endif +#elif defined(__MRC__) +#if defined(__cplusplus) +#define RADINLINE inline +#endif +#elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) +#define RADINLINE inline +#define __RADMACH__ + +#undef RADRESTRICT /* could have been defined above... */ +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) +#endif + +#ifdef __RADX86__ +#ifndef __RADCARBON__ +#define __RADCARBON__ +#endif +#endif + +#ifdef TARGET_API_MAC_CARBON +#if TARGET_API_MAC_CARBON +#ifndef __RADCARBON__ +#define __RADCARBON__ +#endif +#endif +#endif +#endif +#elif defined(__linux__) + +#define __RADLINUX__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#define __RADX86__ +#ifdef __x86_64 +#define __RAD32__ +#define __RAD64__ +#define __RADX64__ +#define __RAD64REGS__ +#else +#define __RAD32__ +#endif +#define RADINLINE inline +#define RADRESTRICT __restrict + +#undef RADSTRUCT +#define RADSTRUCT struct __attribute__((__packed__)) + +#else + +#if _MSC_VER >= 1400 +#undef RADRESTRICT +#define RADRESTRICT __restrict +#else +#define RADRESTRICT +#define __RADNOVARARGMACROS__ +#endif + +#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) +// Remember that Xenon also defines _XBOX +#define __RADPPC__ +#define __RADBIGENDIAN__ +#define __RADALTIVEC__ +#else +#define __RADX86__ +#define __RADMMX__ +#define __RADLITTLEENDIAN__ +#endif + +#ifdef __MWERKS__ +#define _WIN32 +#endif + +#ifdef __DOS__ +#define __RADDOS__ +#define S64_DEFINED // turn off these types +#define U64_DEFINED +#define S64 double // should error +#define U64 double // should error +#define __RADNOVARARGMACROS__ +#endif + +#ifdef __386__ +#define __RAD32__ +#endif + +#ifdef _Windows // For Borland +#ifdef __WIN32__ +#define WIN32 +#else +#define __WINDOWS__ +#endif +#endif + +#ifdef _WINDOWS // For MS +#ifndef _WIN32 +#define __WINDOWS__ +#endif +#endif + +#ifdef _WIN32 +#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#define __RAD64REGS__ +#elif defined(_XBOX) +#define __RADXBOX__ +#elif !defined(__RADWINRTAPI__) +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#else +#ifdef __NT__ +#if defined(_XENON) || (_XBOX_VER == 200) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#define __RAD64REGS__ +#elif defined(_XBOX) +#define __RADXBOX__ +#else +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#else +#ifdef __WINDOWS_386__ +#define __RADWIN__ +#define __RADWINEXT__ +#define __RAD32__ +#define S64_DEFINED // turn off these types +#define U64_DEFINED +#define S64 double // should error +#define U64 double // should error +#else +#ifdef __WINDOWS__ +#define __RADWIN__ +#define __RAD16__ +#else +#ifdef WIN32 +#if defined(_XENON) || (_XBOX_VER == 200) +// Remember that Xenon also defines _XBOX +#define __RADXENON__ +#elif defined(_XBOX) +#define __RADXBOX__ +#else +#define __RADNT__ +#endif +#define __RADWIN__ +#define __RAD32__ +#endif +#endif +#endif +#endif +#endif + +#ifdef __WATCOMC__ +#define RADINLINE +#else +#define RADINLINE __inline +#endif +#endif + +#if defined __RADMAC__ || defined __RADIPHONE__ +#define __RADBSD__ +#endif + +#if defined __RADBSD__ || defined __RADLINUX__ +#define __RADPOSIX__ +#endif + +#if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ + !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ + !defined(__RADXENON__) && !defined(__RADDURANGO__) && \ + !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ + !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && \ + !defined(__RADSPU__) && !defined(__RADWII__) && \ + !defined(__RADIPHONE__) && !defined(__RADX32__) && \ + !defined(__RADARM__) && !defined(__RADWIIU__) && \ + !defined(__RADANDROID__) && !defined(__RADNACL__) && \ + !defined(__RADQNX__)) +#error \ + "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." +#endif + +#ifdef __RADFINAL__ +#define RADTODO(str) \ + { char __str[0] = str; } +#else +#define RADTODO(str) +#endif + +#ifdef __RADX32__ +#if defined(_MSC_VER) +#define RADLINK __stdcall +#define RADEXPLINK __stdcall +#else +#define RADLINK __attribute__((stdcall)) +#define RADEXPLINK __attribute__((stdcall)) +#endif +#define RADEXPFUNC RADDEFFUNC + +#elif (defined(__RADNGC__) || defined(__RADWII__) || defined(__RADPS2__) || \ + defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ + defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ + (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || \ + defined(__RADWIIU__) || defined(__RADPS4__)) + +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK + +#elif defined(__RADANDROID__) +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK +#elif defined(__RADNACL__) +#define RADLINK +#define RADEXPLINK +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK +#elif defined(__RADLINUX__) || defined(__RADQNX__) + +#ifdef __RAD64__ +#define RADLINK +#define RADEXPLINK +#else +#define RADLINK __attribute__((cdecl)) +#define RADEXPLINK __attribute__((cdecl)) +#endif + +#define RADEXPFUNC RADDEFFUNC +#define RADASMLINK + +#elif defined(__RADMAC__) + +// this define is for CodeWarrior 11's stupid new libs (even though +// we don't use longlong's). + +#define __MSL_LONGLONG_SUPPORT__ + +#define RADLINK +#define RADEXPLINK + +#if defined(__CFM68K__) || defined(__MWERKS__) +#ifdef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(export) +#else +#define RADEXPFUNC RADDEFFUNC __declspec(import) +#endif +#else +#if defined(__RADMACH__) && !defined(__MWERKS__) +#ifdef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) +#else +#define RADEXPFUNC RADDEFFUNC +#endif +#else +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#define RADASMLINK + +#else + +#ifdef __RADNT__ +#ifndef _WIN32 +#define _WIN32 +#endif +#ifndef WIN32 +#define WIN32 +#endif +#endif + +#ifdef __RADWIN__ +#ifdef __RAD32__ + +#ifdef __RADXBOX__ + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall +#define RADEXPFUNC RADDEFFUNC + +#elif defined(__RADXENON__) || defined(__RADDURANGO__) + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#define RADEXPFUNC RADDEFFUNC + +#elif defined(__RADWINRTAPI__) + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ + (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ + (!defined(__RADINSTATICLIB__)))) +#define RADEXPFUNC RADDEFFUNC +#else +#ifndef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) +#else +#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) +#endif +#endif + +#elif defined(__RADNTBUILDLINUX__) + +#define RADLINK __cdecl +#define RADEXPLINK __cdecl +#define RADEXPFUNC RADDEFFUNC + +#else +#ifdef __RADNT__ + +#define RADLINK __stdcall +#define RADEXPLINK __stdcall + +#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ + (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ + (!defined(__RADINSTATICLIB__)))) +#define RADEXPFUNC RADDEFFUNC +#else +#ifndef __RADINDLL__ +#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) +#ifdef __BORLANDC__ +#if __BORLANDC__ <= 0x460 +#undef RADEXPFUNC +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#else +#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) +#endif +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __far __pascal +#define RADEXPFUNC RADDEFFUNC +#endif +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __far __pascal __export +#define RADEXPFUNC RADDEFFUNC +#endif +#else +#define RADLINK __pascal +#define RADEXPLINK __pascal +#define RADEXPFUNC RADDEFFUNC +#endif + +#define RADASMLINK __cdecl + +#endif + +#if !defined(__RADXBOX__) && !defined(__RADXENON__) && \ + !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) +#ifdef __RADWIN__ +#ifndef _WINDOWS +#define _WINDOWS +#endif +#endif +#endif + +#ifdef __RADLITTLEENDIAN__ +#ifdef __RADBIGENDIAN__ +#error both endians !? +#endif +#endif + +#if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) +#error neither endian! +#endif + +//----------------------------------------------------------------- + +#ifndef RADDEFFUNC + +#ifdef __cplusplus +#define RADDEFFUNC extern "C" +#define RADDEFSTART extern "C" { +#define RADDEFEND } +#define RADDEFINEDATA extern "C" +#define RADDECLAREDATA extern "C" +#define RADDEFAULT(val) = val + +#define RR_NAMESPACE rr +#define RR_NAMESPACE_START namespace RR_NAMESPACE { +#define RR_NAMESPACE_END \ + } \ + ; +#define RR_NAMESPACE_USE using namespace RR_NAMESPACE; + +#else +#define RADDEFFUNC +#define RADDEFSTART +#define RADDEFEND +#define RADDEFINEDATA +#define RADDECLAREDATA extern +#define RADDEFAULT(val) + +#define RR_NAMESPACE +#define RR_NAMESPACE_START +#define RR_NAMESPACE_END +#define RR_NAMESPACE_USE + +#endif + +#endif + +// probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) +#if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || \ + defined(__RADPSP2__) || defined(__RADPS3__) || defined(__RADSPU__) || \ + defined(__RADPS4__) || defined(__RADLINUX__) || defined(__RADMAC__)) || \ + defined(__RADNDS__) || defined(__RAD3DS__) || defined(__RADIPHONE__) || \ + defined(__RADANDROID__) || defined(__RADQNX__) +#define RAD_ALIGN(type, var, num) type __attribute__((aligned(num))) var +#elif (defined(__RADNGC__) || defined(__RADPS2__)) +#define RAD_ALIGN(type, var, num) __attribute__((aligned(num))) type var +#elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) +#define RAD_ALIGN(type, var, num) type __declspec(align(num)) var +#else +// NOTE: / / is a guaranteed parse error in C/C++. +#define RAD_ALIGN(type, var, num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / +#endif + +// WARNING : RAD_TLS should really only be used for debug/tools stuff +// it's not reliable because even if we are built as a lib, our lib can +// be put into a DLL and then it doesn't work +#if defined(__RADNT__) || defined(__RADXENON__) +#ifndef __RADINDLL__ +// note that you can't use this in windows DLLs +#define RAD_TLS(type, var) __declspec(thread) type var +#endif +#elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) +// works on PS3/gcc I believe : +#define RAD_TLS(type, var) __thread type var +#else +// RAD_TLS not defined +#endif + +// Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. +// The size of integers is specified explicitly in the code, i.e. u32 or +// whatever. + +#define RAD_S8 signed char +#define RAD_U8 unsigned char + +#if defined(__RAD64__) +// Remember that __RAD32__ will also be defined! +#if defined(__RADX64__) +// x64 still has 32-bit ints! +#define RAD_U32 unsigned int +#define RAD_S32 signed int +// But pointers are 64 bits. +#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64) +#define RAD_SINTa __w64 signed int64_t +#define RAD_UINTa __w64 unsigned int64_t +#else // non-vc.net compiler or /Wp64 turned off +#define RAD_UINTa unsigned long long +#define RAD_SINTa signed long long +#endif +#else +#error Unknown 64-bit processor (see radbase.h) +#endif +#elif defined(__RAD32__) +#define RAD_U32 unsigned int +#define RAD_S32 signed int +// Pointers are 32 bits. + +#if ((defined(_MSC_VER) && (_MSC_VER >= 1300)) && (defined(_Wp64) && (_Wp64))) +#define RAD_SINTa __w64 signed long +#define RAD_UINTa __w64 unsigned long +#else // non-vc.net compiler or /Wp64 turned off +#ifdef _Wp64 +#define RAD_SINTa signed long +#define RAD_UINTa unsigned long +#else +#define RAD_SINTa signed int +#define RAD_UINTa unsigned int +#endif +#endif +#else +#define RAD_U32 unsigned long +#define RAD_S32 signed long +// Pointers in 16-bit land are still 32 bits. +#define RAD_UINTa unsigned long +#define RAD_SINTa signed long +#endif + +#define RAD_F32 float +#if defined(__RADPS2__) || defined(__RADPSP__) +typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles +{ // while using the same space + RAD_U32 vals[2]; +} +RAD_F64; +#define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 +#else +#define RAD_F64 double +#define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 +#endif + +#if (defined(__RADMAC__) || defined(__MRC__) || defined(__RADNGC__) || \ + defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADWIIU__) || \ + defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || \ + defined(__RADPS4__) || defined(__RADSPU__) || defined(__RADIPHONE__) || \ + defined(__RADNACL__) || defined(__RADANDROID__) || defined(__RADQNX__)) +#define RAD_U64 unsigned long long +#define RAD_S64 signed long long +#elif defined(__RADPS2__) +#define RAD_U64 unsigned long +#define RAD_S64 signed long +#elif defined(__RADARM__) +#define RAD_U64 unsigned long long +#define RAD_S64 signed long long +#elif defined(__RADX64__) || defined(__RAD32__) +#define RAD_U64 unsigned int64_t +#define RAD_S64 signed int64_t +#else +// 16-bit +typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s +{ // while using the same space + RAD_U32 vals[2]; +} +RAD_U64; +typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s +{ // while using the same space + RAD_S32 vals[2]; +} +RAD_S64; +#endif + +#if defined(__RAD32__) +#define PTR4 +#define RAD_U16 unsigned short +#define RAD_S16 signed short +#else +#define PTR4 __far +#define RAD_U16 unsigned int +#define RAD_S16 signed int +#endif + +//------------------------------------------------- +// RAD_PTRBITS and such defined here without using sizeof() +// so that they can be used in align() and other macros + +#ifdef __RAD64__ + +#define RAD_PTRBITS 64 +#define RAD_PTRBYTES 8 +#define RAD_TWOPTRBYTES 16 + +#else + +#define RAD_PTRBITS 32 +#define RAD_PTRBYTES 4 +#define RAD_TWOPTRBYTES 8 + +#endif + +//------------------------------------------------- +// UINTr = int the size of a register + +#ifdef __RAD64REGS__ + +#define RAD_UINTr RAD_U64 +#define RAD_SINTr RAD_S64 + +#else + +#define RAD_UINTr RAD_U32 +#define RAD_SINTr RAD_S32 + +#endif + +//=========================================================================== + +/* +// CB : meh this is enough of a mess that it's probably best to just let each +#if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 + #define __RADX86INTRIN2003__ +#endif +*/ + +// RADASSUME(expr) tells the compiler that expr is always true +// RADUNREACHABLE must never be reachable - even in event of error +// eg. it's okay for compiler to generate completely invalid code after +// RADUNREACHABLE #ifdef _MSC_VER - // microsoft compilers - - #if _MSC_VER >= 1400 - #define RAD_STATEMENT_START \ - do { - - #define RAD_STATEMENT_END_FALSE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(0) \ - __pragma(warning(pop)) - - #define RAD_STATEMENT_END_TRUE \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - } while(1) \ - __pragma(warning(pop)) - - #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT - #endif +#define RADFORCEINLINE __forceinline +#if _MSC_VER >= 1300 +#define RADNOINLINE __declspec(noinline) #else - #define RAD_USE_STANDARD_LOOP_CONSTRUCT +#define RADNOINLINE +#endif +#define RADUNREACHABLE __assume(0) +#define RADASSUME(exp) __assume(exp) +#elif defined(__clang__) +#ifdef _DEBUG +#define RADFORCEINLINE inline +#else +#define RADFORCEINLINE inline __attribute((always_inline)) +#endif +#define RADNOINLINE __attribute__((noinline)) + +#define RADUNREACHABLE __builtin_unreachable() + +#if __has_builtin(__builtin_assume) +#define RADASSUME(exp) __builtin_assume(exp) +#else +#define RADASSUME(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) +#endif +#elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) +#ifdef _DEBUG +#define RADFORCEINLINE inline +#else +#define RADFORCEINLINE inline __attribute((always_inline)) +#endif +#define RADNOINLINE __attribute__((noinline)) + +#if __RAD_GCC_VERSION__ >= 40500 +#define RADUNREACHABLE __builtin_unreachable() +#define RADASSUME(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) +#else +#define RADUNREACHABLE RAD_INFINITE_LOOP(RR_BREAK();) +#define RADASSUME(exp) +#endif +#elif defined(__CWCC__) +#define RADFORCEINLINE inline +#define RADNOINLINE __attribute__((never_inline)) +#define RADUNREACHABLE +#define RADASSUME(x) (void)0 +#else +// ? #define RADFORCEINLINE ? +#define RADFORCEINLINE inline +#define RADNOINLINE +#define RADASSUME(x) (void)0 +#endif + +//=========================================================================== + +// RAD_ALIGN_HINT tells the compiler how a given pointer is aligned +// it *must* be true, but the compiler may or may not use that information +// it is not for cases where the pointer is to an inherently aligned data type, +// it's when the compiler cannot tell the alignment but you have extra +// information. +// eg : +// U8 * ptr = rrMallocAligned(256,16); +// RAD_ALIGN_HINT(ptr,16,0); + +#ifdef __RADSPU__ +#define RAD_ALIGN_HINT(ptr, alignment, offset) \ + __align_hint(ptr, alignment, offset); \ + RR_ASSERT(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) +#else +#define RAD_ALIGN_HINT(ptr, alignment, offset) \ + RADASSUME(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) +#endif + +//=========================================================================== + +// RAD_EXPECT is to tell the compiler the *likely* value of an expression +// different than RADASSUME in that expr might not have that value +// it's use for branch code layout and static branch prediction +// condition can technically be a variable but should usually be 0 or 1 + +#if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) + +// __builtin_expect returns value of expr +#define RAD_EXPECT(expr, cond) __builtin_expect(expr, cond) + +#else + +#define RAD_EXPECT(expr, cond) (expr) + +#endif + +// helpers for doing an if ( ) with expect : +// if ( RAD_LIKELY(expr) ) { ... } + +#define RAD_LIKELY(expr) RAD_EXPECT(expr, 1) +#define RAD_UNLIKELY(expr) RAD_EXPECT(expr, 0) + +//=========================================================================== + +// __RADX86ASM__ means you can use __asm {} style inline assembly +#if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) +#define __RADX86ASM__ +#endif + +//------------------------------------------------- +// typedefs : + +#ifndef RADNOTYPEDEFS + +#ifndef S8_DEFINED +#define S8_DEFINED +typedef RAD_S8 S8; +#endif + +#ifndef U8_DEFINED +#define U8_DEFINED +typedef RAD_U8 U8; +#endif + +#ifndef S16_DEFINED +#define S16_DEFINED +typedef RAD_S16 S16; +#endif + +#ifndef U16_DEFINED +#define U16_DEFINED +typedef RAD_U16 U16; +#endif + +#ifndef S32_DEFINED +#define S32_DEFINED +typedef RAD_S32 S32; +#endif + +#ifndef U32_DEFINED +#define U32_DEFINED +typedef RAD_U32 U32; +#endif + +#ifndef S64_DEFINED +#define S64_DEFINED +typedef RAD_S64 S64; +#endif + +#ifndef U64_DEFINED +#define U64_DEFINED +typedef RAD_U64 U64; +#endif + +#ifndef F32_DEFINED +#define F32_DEFINED +typedef RAD_F32 F32; +#endif + +#ifndef F64_DEFINED +#define F64_DEFINED +typedef RAD_F64 F64; +#endif + +#ifndef F64_OR_32_DEFINED +#define F64_OR_32_DEFINED +typedef RAD_F64_OR_32 F64_OR_32; +#endif + +// UINTa and SINTa are the ints big enough for an address + +#ifndef SINTa_DEFINED +#define SINTa_DEFINED +typedef RAD_SINTa SINTa; +#endif + +#ifndef UINTa_DEFINED +#define UINTa_DEFINED +typedef RAD_UINTa UINTa; +#endif + +#ifndef UINTr_DEFINED +#define UINTr_DEFINED +typedef RAD_UINTr UINTr; +#endif + +#ifndef SINTr_DEFINED +#define SINTr_DEFINED +typedef RAD_SINTr SINTr; +#endif + +#elif !defined(RADNOTYPEDEFINES) + +#ifndef S8_DEFINED +#define S8_DEFINED +#define S8 RAD_S8 +#endif + +#ifndef U8_DEFINED +#define U8_DEFINED +#define U8 RAD_U8 +#endif + +#ifndef S16_DEFINED +#define S16_DEFINED +#define S16 RAD_S16 +#endif + +#ifndef U16_DEFINED +#define U16_DEFINED +#define U16 RAD_U16 +#endif + +#ifndef S32_DEFINED +#define S32_DEFINED +#define S32 RAD_S32 +#endif + +#ifndef U32_DEFINED +#define U32_DEFINED +#define U32 RAD_U32 +#endif + +#ifndef S64_DEFINED +#define S64_DEFINED +#define S64 RAD_S64 +#endif + +#ifndef U64_DEFINED +#define U64_DEFINED +#define U64 RAD_U64 +#endif + +#ifndef F32_DEFINED +#define F32_DEFINED +#define F32 RAD_F32 +#endif + +#ifndef F64_DEFINED +#define F64_DEFINED +#define F64 RAD_F64 +#endif + +#ifndef F64_OR_32_DEFINED +#define F64_OR_32_DEFINED +#define F64_OR_32 RAD_F64_OR_32 +#endif + +// UINTa and SINTa are the ints big enough for an address (pointer) +#ifndef SINTa_DEFINED +#define SINTa_DEFINED +#define SINTa RAD_SINTa +#endif + +#ifndef UINTa_DEFINED +#define UINTa_DEFINED +#define UINTa RAD_UINTa +#endif + +#ifndef UINTr_DEFINED +#define UINTr_DEFINED +#define UINTr RAD_UINTr +#endif + +#ifndef SINTr_DEFINED +#define SINTr_DEFINED +#define SINTr RAD_SINTr +#endif + +#endif + +/// Some error-checking. +#if defined(__RAD64__) && !defined(__RAD32__) +// See top of file for why this is. +#error __RAD64__ must not be defined without __RAD32__ (see radbase.h) +#endif + +#ifdef _MSC_VER +// microsoft compilers + +#if _MSC_VER >= 1400 +#define RAD_STATEMENT_START do { +#define RAD_STATEMENT_END_FALSE \ + __pragma(warning(push)) __pragma(warning(disable : 4127)) \ + } \ + while (0) __pragma(warning(pop)) + +#define RAD_STATEMENT_END_TRUE \ + __pragma(warning(push)) __pragma(warning(disable : 4127)) \ + } \ + while (1) __pragma(warning(pop)) + +#else +#define RAD_USE_STANDARD_LOOP_CONSTRUCT +#endif +#else +#define RAD_USE_STANDARD_LOOP_CONSTRUCT #endif #ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT - #define RAD_STATEMENT_START \ - do { +#define RAD_STATEMENT_START do { +#define RAD_STATEMENT_END_FALSE \ + } \ + while ((void)0, 0) - #define RAD_STATEMENT_END_FALSE \ - } while ( (void)0,0 ) - - #define RAD_STATEMENT_END_TRUE \ - } while ( (void)1,1 ) +#define RAD_STATEMENT_END_TRUE \ + } \ + while ((void)1, 1) #endif -#define RAD_STATEMENT_WRAPPER( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_FALSE - -#define RAD_INFINITE_LOOP( code ) \ - RAD_STATEMENT_START \ - code \ - RAD_STATEMENT_END_TRUE +#define RAD_STATEMENT_WRAPPER(code) \ + RAD_STATEMENT_START \ + code RAD_STATEMENT_END_FALSE +#define RAD_INFINITE_LOOP(code) \ + RAD_STATEMENT_START \ + code RAD_STATEMENT_END_TRUE // Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later -# define RR_UNUSED_VARIABLE(x) (void) x +#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later +#define RR_UNUSED_VARIABLE(x) (void)x #else -# define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) +#define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) #endif //----------------------------------------------- @@ -1384,31 +1409,33 @@ #define RR_UINT3264 U32 #endif -//RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); +// RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); //-------------------------------------------------- // RR_LINESTRING is the current line number as a string -#define RR_STRINGIZE( L ) #L -#define RR_DO_MACRO( M, X ) M(X) -#define RR_STRINGIZE_DELAY( X ) RR_DO_MACRO( RR_STRINGIZE, X ) -#define RR_LINESTRING RR_STRINGIZE_DELAY( __LINE__ ) +#define RR_STRINGIZE(L) #L +#define RR_DO_MACRO(M, X) M(X) +#define RR_STRINGIZE_DELAY(X) RR_DO_MACRO(RR_STRINGIZE, X) +#define RR_LINESTRING RR_STRINGIZE_DELAY(__LINE__) -#define RR_CAT(X,Y) X ## Y +#define RR_CAT(X, Y) X##Y // RR_STRING_JOIN joins strings in the preprocessor and works with LINESTRING -#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) -#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) -#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2 +#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) +#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) +#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1##arg2 -// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to declare +// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to +// declare // variable names and they won't conflict with each other -// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works +// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC +// extension that works #ifdef _MSC_VER - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__COUNTER__) +#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __COUNTER__) #else - #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__LINE__) +#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __LINE__) #endif //-------------------------------------------------- @@ -1418,112 +1445,125 @@ // then the rrbool must be set to exactly "1" not just "not zero" !! #ifndef RADNOTYPEDEFS - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - typedef S32 rrbool; - typedef S32 RRBOOL; - #endif +#ifndef RRBOOL_DEFINED +#define RRBOOL_DEFINED +typedef S32 rrbool; +typedef S32 RRBOOL; +#endif #elif !defined(RADNOTYPEDEFINES) - #ifndef RRBOOL_DEFINED - #define RRBOOL_DEFINED - #define rrbool S32 - #define RRBOOL S32 - #endif +#ifndef RRBOOL_DEFINED +#define RRBOOL_DEFINED +#define rrbool S32 +#define RRBOOL S32 +#endif #endif //-------------------------------------------------- // Range macros - #ifndef RR_MIN - #define RR_MIN(a,b) ( (a) < (b) ? (a) : (b) ) - #endif +#ifndef RR_MIN +#define RR_MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif - #ifndef RR_MAX - #define RR_MAX(a,b) ( (a) > (b) ? (a) : (b) ) - #endif +#ifndef RR_MAX +#define RR_MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif - #ifndef RR_ABS - #define RR_ABS(a) ( ((a) < 0) ? -(a) : (a) ) - #endif +#ifndef RR_ABS +#define RR_ABS(a) (((a) < 0) ? -(a) : (a)) +#endif - #ifndef RR_CLAMP - #define RR_CLAMP(val,lo,hi) RR_MAX( RR_MIN(val,hi), lo ) - #endif +#ifndef RR_CLAMP +#define RR_CLAMP(val, lo, hi) RR_MAX(RR_MIN(val, hi), lo) +#endif //-------------------------------------------------- // Data layout macros - #define RR_ARRAY_SIZE(array) ( sizeof(array)/sizeof(array[0]) ) +#define RR_ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) - // MEMBER_OFFSET tells you the offset of a member in a type - #ifdef __RAD3DS__ - #define RR_MEMBER_OFFSET(type,member) (unsigned int)(( (char *) &(((type *)0)->member) - (char *) 0 )) - #elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || defined(__RADSPU__) - // offsetof() gets mucked with by system headers on android, making things dependent on #include order. - #define RR_MEMBER_OFFSET(type,member) __builtin_offsetof(type, member) - #elif defined(__RADLINUX__) - #define RR_MEMBER_OFFSET(type,member) (offsetof(type, member)) - #else - #define RR_MEMBER_OFFSET(type,member) ( (size_t) (UINTa) &(((type *)0)->member) ) - #endif +// MEMBER_OFFSET tells you the offset of a member in a type +#ifdef __RAD3DS__ +#define RR_MEMBER_OFFSET(type, member) \ + (unsigned int)(((char *)&(((type *)0)->member) - (char *)0)) +#elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || \ + defined(__RADSPU__) +// offsetof() gets mucked with by system headers on android, making things +// dependent on #include order. +#define RR_MEMBER_OFFSET(type, member) __builtin_offsetof(type, member) +#elif defined(__RADLINUX__) +#define RR_MEMBER_OFFSET(type, member) (offsetof(type, member)) +#else +#define RR_MEMBER_OFFSET(type, member) ((size_t)(UINTa) & (((type *)0)->member)) +#endif - // MEMBER_SIZE tells you the size of a member in a type - #define RR_MEMBER_SIZE(type,member) ( sizeof( ((type *) 0)->member) ) +// MEMBER_SIZE tells you the size of a member in a type +#define RR_MEMBER_SIZE(type, member) (sizeof(((type *)0)->member)) - // just to make gcc shut up about derefing null : - #define RR_MEMBER_OFFSET_PTR(type,member,ptr) ( (SINTa) &(((type *)(ptr))->member) - (SINTa)(ptr) ) - #define RR_MEMBER_SIZE_PTR(type,member,ptr) ( sizeof( ((type *) (ptr))->member) ) - - // MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of the object - // you should then RR_ASSERT( &(ret->member) == ptr ); - #define RR_MEMBER_TO_OWNER(type,member,ptr) (type *)( ((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type,member,ptr) ) +// just to make gcc shut up about derefing null : +#define RR_MEMBER_OFFSET_PTR(type, member, ptr) \ + ((SINTa) & (((type *)(ptr))->member) - (SINTa)(ptr)) +#define RR_MEMBER_SIZE_PTR(type, member, ptr) (sizeof(((type *)(ptr))->member)) + +// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of +// the object +// you should then RR_ASSERT( &(ret->member) == ptr ); +#define RR_MEMBER_TO_OWNER(type, member, ptr) \ + (type *)(((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type, member, ptr)) //-------------------------------------------------- // Cache / prefetch macros : // RR_PREFETCH for various platforms : -// +// // RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan -// platforms that automatically prefetch sequential (eg. PC) should be a no-op here -// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of memory are undefined +// platforms that automatically prefetch sequential (eg. PC) should +//be a no-op here +// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of +// memory are undefined // (may be a no-op, may be a normal prefetch, may zero memory) -// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't do it past the end of buffers +// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't +//do it past the end of buffers #ifdef __RADX86__ -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // nop -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // nop +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RADXENON__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((int)(offset),(void *)(ptr)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz128((int)(offset),(void *)(ptr)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __dcbt((int)(offset), (void *)(ptr)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __dcbz128((int)(offset), (void *)(ptr)) #elif defined(__RADPS3__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __dcbt((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __dcbz((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) \ + __dcbt((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __dcbz((char *)(ptr) + (int)(offset)) #elif defined(__RADSPU__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RADWII__) || defined(__RADWIIU__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // intentional NOP for now -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // nop +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP for now +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop #elif defined(__RAD3DS__) -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) __pld((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) __pldw((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __pld((char *)(ptr) + (int)(offset)) +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ + __pldw((char *)(ptr) + (int)(offset)) #else // other platform -#define RR_PREFETCH_SEQUENTIAL(ptr,offset) // need_prefetch // compile error -#define RR_PREFETCH_WRITE_INVALIDATE(ptr,offset) // need_writezero // error +#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // need_prefetch // compile error +#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // need_writezero // error #endif @@ -1534,130 +1574,131 @@ RADDEFSTART // set up RR_BREAK : - #ifdef __RADNGC__ +#ifdef __RADNGC__ - #define RR_BREAK() asm(" .long 0x00000001") - #define RR_CACHE_LINE_SIZE xxx +#define RR_BREAK() asm(" .long 0x00000001") +#define RR_CACHE_LINE_SIZE xxx - #elif defined(__RADWII__) +#elif defined(__RADWII__) - #define RR_BREAK() __asm__ volatile("trap") - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() __asm__ volatile("trap") +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADWIIU__) +#elif defined(__RADWIIU__) - #define RR_BREAK() asm("trap") - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() asm("trap") +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RAD3DS__) +#elif defined(__RAD3DS__) - #define RR_BREAK() *((int volatile*)0)=0 - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() *((int volatile *)0) = 0 +#define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADNDS__) +#elif defined(__RADNDS__) - #define RR_BREAK() asm("BKPT 0") - #define RR_CACHE_LINE_SIZE xxx +#define RR_BREAK() asm("BKPT 0") +#define RR_CACHE_LINE_SIZE xxx - #elif defined(__RADPS2__) +#elif defined(__RADPS2__) - #define RR_BREAK() __asm__ volatile("break") - #define RR_CACHE_LINE_SIZE 64 +#define RR_BREAK() __asm__ volatile("break") +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADPSP__) +#elif defined(__RADPSP__) - #define RR_BREAK() __asm__("break 0") - #define RR_CACHE_LINE_SIZE 64 +#define RR_BREAK() __asm__("break 0") +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADPSP2__) +#elif defined(__RADPSP2__) - #define RR_BREAK() { __asm__ volatile("bkpt 0x0000"); } - #define RR_CACHE_LINE_SIZE 32 +#define RR_BREAK() \ + { __asm__ volatile("bkpt 0x0000"); } +#define RR_CACHE_LINE_SIZE 32 - #elif defined (__RADQNX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined (__RADARM__) && defined (__RADLINUX__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADSPU__) +#elif defined(__RADQNX__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADARM__) && defined(__RADLINUX__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADSPU__) - #define RR_BREAK() __asm volatile ("stopd 0,1,1") - #define RR_CACHE_LINE_SIZE 128 +#define RR_BREAK() __asm volatile("stopd 0,1,1") +#define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADPS3__) +#elif defined(__RADPS3__) - // #ifdef snPause // in LibSN.h - // snPause - // __asm__ volatile ( "tw 31,1,1" ) +// #ifdef snPause // in LibSN.h +// snPause +// __asm__ volatile ( "tw 31,1,1" ) - #define RR_BREAK() __asm__ volatile ( "tw 31,1,1" ) - //#define RR_BREAK() __asm__ volatile("trap"); +#define RR_BREAK() __asm__ volatile("tw 31,1,1") +// #define RR_BREAK() __asm__ volatile("trap"); - #define RR_CACHE_LINE_SIZE 128 +#define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADMAC__) +#elif defined(__RADMAC__) - #if defined(__GNUG__) || defined(__GNUC__) - #ifdef __RADX86__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #else - #define RR_BREAK() __builtin_trap() - #endif - #else - #ifdef __RADMACH__ - void DebugStr(unsigned char const *); - #else - void pascal DebugStr(unsigned char const *); - #endif - #define RR_BREAK() DebugStr("\pRR_BREAK() was called") - #endif +#if defined(__GNUG__) || defined(__GNUC__) +#ifdef __RADX86__ +#define RR_BREAK() __asm__ volatile("int $3") +#else +#define RR_BREAK() __builtin_trap() +#endif +#else +#ifdef __RADMACH__ +void DebugStr(unsigned char const *); +#else +void pascal DebugStr(unsigned char const *); +#endif +#define RR_BREAK() DebugStr("\pRR_BREAK() was called") +#endif - #define RR_CACHE_LINE_SIZE 64 +#define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADIPHONE__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADXENON__) - #define RR_BREAK() assert(0) - #define RR_CACHE_LINE_SIZE 128 - #elif defined(__RADANDROID__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 32 - #elif defined(__RADPS4__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #elif defined(__RADNACL__) - #define RR_BREAK() __builtin_trap() - #define RR_CACHE_LINE_SIZE 64 - #else - // x86 : - #define RR_CACHE_LINE_SIZE 64 +#elif defined(__RADIPHONE__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADXENON__) +#define RR_BREAK() assert(0) +#define RR_CACHE_LINE_SIZE 128 +#elif defined(__RADANDROID__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 32 +#elif defined(__RADPS4__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 64 +#elif defined(__RADNACL__) +#define RR_BREAK() __builtin_trap() +#define RR_CACHE_LINE_SIZE 64 +#else +// x86 : +#define RR_CACHE_LINE_SIZE 64 - #ifdef __RADLINUX__ - #define RR_BREAK() __asm__ volatile ( "int $3" ) - #elif defined(__WATCOMC__) +#ifdef __RADLINUX__ +#define RR_BREAK() __asm__ volatile("int $3") +#elif defined(__WATCOMC__) - void RR_BREAK( void ); - #pragma aux RR_BREAK = "int 0x3"; +void RR_BREAK(void); +#pragma aux RR_BREAK = "int 0x3"; - #elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 +#elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define RR_BREAK __debugbreak +#define RR_BREAK __debugbreak - #else +#else - #define RR_BREAK() RAD_STATEMENT_WRAPPER( __asm {int 3} ) +#define RR_BREAK() RAD_STATEMENT_WRAPPER(__asm {int 3}) - #endif +#endif - #endif +#endif // simple RR_ASSERT : // CB 5-27-10 : use RR_DO_ASSERTS to toggle asserts on and off : #if (defined(_DEBUG) && !defined(NDEBUG)) || defined(ASSERT_IN_RELEASE) - #define RR_DO_ASSERTS +#define RR_DO_ASSERTS #endif /********* @@ -1665,18 +1706,19 @@ RADDEFSTART rrAsserts : RR_ASSERT(exp) - the normal assert thing, toggled with RR_DO_ASSERTS -RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds (including final!) -RR_ASSERT_RELEASE(exp) - assert that you want to test even in release builds (not for final!) -RR_ASSERT_LITE(exp) - normal assert is not safe from threads or inside malloc; use this instead -RR_DURING_ASSERT(exp) - wrap operations that compute stuff for assert in here -RR_DO_ASSERTS - toggle tells you if asserts are enabled or not +RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds +(including final!) RR_ASSERT_RELEASE(exp) - assert that you want to test even in +release builds (not for final!) RR_ASSERT_LITE(exp) - normal assert is not safe +from threads or inside malloc; use this instead RR_DURING_ASSERT(exp) - wrap +operations that compute stuff for assert in here RR_DO_ASSERTS - toggle tells +you if asserts are enabled or not RR_BREAK() - generate a debug break - always ! RR_ASSERT_BREAK() - RR_BREAK for asserts ; disable with RAD_NO_BREAK -RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no condition -RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds too -RR_CANT_GET_HERE() - put in spots execution should never go +RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no +condition RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds +too RR_CANT_GET_HERE() - put in spots execution should never go RR_COMPILER_ASSERT(exp) - checks constant conditions at compile time RADTODO - note to search for nonfinal stuff @@ -1686,72 +1728,90 @@ RR_PRAGMA_MESSAGE - message dealy, use with #pragma in MSVC //----------------------------------------------------------- - -#if defined(__GNUG__) || defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER > 1200) - #define RR_FUNCTION_NAME __FUNCTION__ +#if defined(__GNUG__) || defined(__GNUC__) || \ + (defined(_MSC_VER) && _MSC_VER > 1200) +#define RR_FUNCTION_NAME __FUNCTION__ #else - #define RR_FUNCTION_NAME 0 +#define RR_FUNCTION_NAME 0 - // __func__ is in the C99 standard +// __func__ is in the C99 standard #endif //----------------------------------------------------------- -// rrDisplayAssertion might just log, or it might pop a message box, depending on settings +// rrDisplayAssertion might just log, or it might pop a message box, depending +// on settings // rrDisplayAssertion returns whether you should break or not -typedef rrbool (RADLINK fp_rrDisplayAssertion)(int * Ignored, const char * fileName,const int line,const char * function,const char * message); +typedef rrbool(RADLINK fp_rrDisplayAssertion)(int *Ignored, + const char *fileName, + const int line, + const char *function, + const char *message); -extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; +extern fp_rrDisplayAssertion *g_fp_rrDisplayAssertion; // if I have func pointer, call it, else true ; true = do int 3 -#define rrDisplayAssertion(i,n,l,f,m) ( ( g_fp_rrDisplayAssertion ) ? (*g_fp_rrDisplayAssertion)(i,n,l,f,m) : 1 ) +#define rrDisplayAssertion(i, n, l, f, m) \ + ((g_fp_rrDisplayAssertion) ? (*g_fp_rrDisplayAssertion)(i, n, l, f, m) : 1) //----------------------------------------------------------- - + // RAD_NO_BREAK : option if you don't like your assert to break // CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional #ifdef RAD_NO_BREAK #define RR_ASSERT_BREAK() 0 #else -#define RR_ASSERT_BREAK() RR_BREAK() +#define RR_ASSERT_BREAK() RR_BREAK() #endif // assert_always is on FINAL ! -#define RR_ASSERT_ALWAYS(exp) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( ! (exp) ) { if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,#exp) ) RR_ASSERT_BREAK(); } ) +#define RR_ASSERT_ALWAYS(exp) \ + RAD_STATEMENT_WRAPPER(static int Ignored = 0; if (!(exp)) { \ + if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, RR_FUNCTION_NAME, \ + #exp)) \ + RR_ASSERT_BREAK(); \ + }) -// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, you're bad -#define RR_ASSERT_FAILURE_ALWAYS(str) RAD_STATEMENT_WRAPPER( static int Ignored=0; if ( rrDisplayAssertion(&Ignored,__FILE__,__LINE__,RR_FUNCTION_NAME,str) ) RR_ASSERT_BREAK(); ) +// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, +// you're bad +#define RR_ASSERT_FAILURE_ALWAYS(str) \ + RAD_STATEMENT_WRAPPER(static int Ignored = 0; \ + if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, \ + RR_FUNCTION_NAME, str)) \ + RR_ASSERT_BREAK();) -#define RR_ASSERT_LITE_ALWAYS(exp) RAD_STATEMENT_WRAPPER( if ( ! (exp) ) { RR_ASSERT_BREAK(); } ) +#define RR_ASSERT_LITE_ALWAYS(exp) \ + RAD_STATEMENT_WRAPPER(if (!(exp)) { RR_ASSERT_BREAK(); }) //----------------------------------- -#ifdef RR_DO_ASSERTS +#ifdef RR_DO_ASSERTS -#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) +#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) +#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) #define RR_ASSERT_NO_ASSUME(exp) RR_ASSERT_ALWAYS(exp) -// RR_DURING_ASSERT is to set up expressions or declare variables that are only used in asserts -#define RR_DURING_ASSERT(exp) exp +// RR_DURING_ASSERT is to set up expressions or declare variables that are only +// used in asserts +#define RR_DURING_ASSERT(exp) exp -#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) +#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) // RR_CANT_GET_HERE is for like defaults in switches that should never be hit -#define RR_CANT_GET_HERE() RAD_STATEMENT_WRAPPER( RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE; ) +#define RR_CANT_GET_HERE() \ + RAD_STATEMENT_WRAPPER(RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE;) +#else // RR_DO_ASSERTS //----------------------------------- -#else // RR_DO_ASSERTS //----------------------------------- - -#define RR_ASSERT(exp) (void)0 -#define RR_ASSERT_LITE(exp) (void)0 +#define RR_ASSERT(exp) (void)0 +#define RR_ASSERT_LITE(exp) (void)0 #define RR_ASSERT_NO_ASSUME(exp) (void)0 -#define RR_DURING_ASSERT(exp) (void)0 +#define RR_DURING_ASSERT(exp) (void)0 -#define RR_ASSERT_FAILURE(str) (void)0 +#define RR_ASSERT_FAILURE(str) (void)0 #define RR_CANT_GET_HERE() RADUNREACHABLE -#endif // RR_DO_ASSERTS //----------------------------------- +#endif // RR_DO_ASSERTS //----------------------------------- //================================================================= @@ -1759,27 +1819,27 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #ifndef __RADFINAL__ -#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) +#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) +#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) #else -#define RR_ASSERT_RELEASE(exp) (void)0 -#define RR_ASSERT_LITE_RELEASE(exp) (void)0 +#define RR_ASSERT_RELEASE(exp) (void)0 +#define RR_ASSERT_LITE_RELEASE(exp) (void)0 #endif // BH: This never gets compiled away except for __RADFINAL__ -#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE +#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE -#define rrAssert RR_ASSERT -#define rrassert RR_ASSERT +#define rrAssert RR_ASSERT +#define rrassert RR_ASSERT #ifdef _MSC_VER - // without this, our assert errors... - #if _MSC_VER >= 1300 - #pragma warning( disable : 4127) // conditional expression is constant - #endif +// without this, our assert errors... +#if _MSC_VER >= 1300 +#pragma warning(disable : 4127) // conditional expression is constant +#endif #endif //--------------------------------------- @@ -1791,8 +1851,8 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; // available here : // RR_[GET/PUT][16/32]_[BE/LE][_UNALIGNED][_OFFSET] // -// if you don't specify _UNALIGNED , then ptr & offset shoud both be aligned to type size -// _OFFSET is in *bytes* ! +// if you don't specify _UNALIGNED , then ptr & offset shoud both be +//aligned to type size _OFFSET is in *bytes* ! // you can #define RR_GET_RESTRICT to make all RR_GETs be RESTRICT // if you set nothing they are not @@ -1806,65 +1866,71 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; // native version of get/put is always trivial : -#define RR_GET16_NATIVE(ptr) *((const U16 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT16_NATIVE(ptr,val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET16_NATIVE(ptr) *((const U16 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT16_NATIVE(ptr, val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U16_PTR_OFFSET(ptr,offset) ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET16_NATIVE_OFFSET(ptr,offset) *( RR_U16_PTR_OFFSET((ptr),offset) ) -#define RR_PUT16_NATIVE_OFFSET(ptr,val,offset) *( RR_U16_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U16_PTR_OFFSET(ptr, offset) \ + ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET16_NATIVE_OFFSET(ptr, offset) *(RR_U16_PTR_OFFSET((ptr), offset)) +#define RR_PUT16_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U16_PTR_OFFSET((ptr), offset)) = (val) -#define RR_GET32_NATIVE(ptr) *((const U32 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT32_NATIVE(ptr,val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET32_NATIVE(ptr) *((const U32 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT32_NATIVE(ptr, val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U32_PTR_OFFSET(ptr,offset) ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_NATIVE_OFFSET(ptr,offset) *( RR_U32_PTR_OFFSET((ptr),offset) ) -#define RR_PUT32_NATIVE_OFFSET(ptr,val,offset) *( RR_U32_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U32_PTR_OFFSET(ptr, offset) \ + ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET32_NATIVE_OFFSET(ptr, offset) *(RR_U32_PTR_OFFSET((ptr), offset)) +#define RR_PUT32_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U32_PTR_OFFSET((ptr), offset)) = (val) -#define RR_GET64_NATIVE(ptr) *((const U64 * RR_GET_PTR_POST)(ptr)) -#define RR_PUT64_NATIVE(ptr,val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) +#define RR_GET64_NATIVE(ptr) *((const U64 *RR_GET_PTR_POST)(ptr)) +#define RR_PUT64_NATIVE(ptr, val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) // offset is in bytes -#define RR_U64_PTR_OFFSET(ptr,offset) ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET64_NATIVE_OFFSET(ptr,offset) *( RR_U64_PTR_OFFSET((ptr),offset) ) -#define RR_PUT64_NATIVE_OFFSET(ptr,val,offset) *( RR_U64_PTR_OFFSET((ptr),offset)) = (val) +#define RR_U64_PTR_OFFSET(ptr, offset) \ + ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_GET64_NATIVE_OFFSET(ptr, offset) *(RR_U64_PTR_OFFSET((ptr), offset)) +#define RR_PUT64_NATIVE_OFFSET(ptr, val, offset) \ + *(RR_U64_PTR_OFFSET((ptr), offset)) = (val) //--------------------------------------------------- #ifdef __RADLITTLEENDIAN__ -#define RR_GET16_LE RR_GET16_NATIVE -#define RR_PUT16_LE RR_PUT16_NATIVE -#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET +#define RR_GET16_LE RR_GET16_NATIVE +#define RR_PUT16_LE RR_PUT16_NATIVE +#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET +#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET -#define RR_GET32_LE RR_GET32_NATIVE -#define RR_PUT32_LE RR_PUT32_NATIVE -#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET +#define RR_GET32_LE RR_GET32_NATIVE +#define RR_PUT32_LE RR_PUT32_NATIVE +#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET +#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET -#define RR_GET64_LE RR_GET64_NATIVE -#define RR_PUT64_LE RR_PUT64_NATIVE -#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET +#define RR_GET64_LE RR_GET64_NATIVE +#define RR_PUT64_LE RR_PUT64_NATIVE +#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET +#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET #else -#define RR_GET16_BE RR_GET16_NATIVE -#define RR_PUT16_BE RR_PUT16_NATIVE -#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET +#define RR_GET16_BE RR_GET16_NATIVE +#define RR_PUT16_BE RR_PUT16_NATIVE +#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET +#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET -#define RR_GET32_BE RR_GET32_NATIVE -#define RR_PUT32_BE RR_PUT32_NATIVE -#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET +#define RR_GET32_BE RR_GET32_NATIVE +#define RR_PUT32_BE RR_PUT32_NATIVE +#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET +#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET -#define RR_GET64_BE RR_GET64_NATIVE -#define RR_PUT64_BE RR_PUT64_NATIVE -#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET +#define RR_GET64_BE RR_GET64_NATIVE +#define RR_PUT64_BE RR_PUT64_NATIVE +#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET +#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET #endif @@ -1876,50 +1942,47 @@ extern fp_rrDisplayAssertion * g_fp_rrDisplayAssertion; #if (_MSC_VER >= 1300) -unsigned short __cdecl _byteswap_ushort (unsigned short _Short); -unsigned long __cdecl _byteswap_ulong (unsigned long _Long); +unsigned short __cdecl _byteswap_ushort(unsigned short _Short); +unsigned long __cdecl _byteswap_ulong(unsigned long _Long); #pragma intrinsic(_byteswap_ushort, _byteswap_ulong) -#define RR_BSWAP16 _byteswap_ushort -#define RR_BSWAP32 _byteswap_ulong +#define RR_BSWAP16 _byteswap_ushort +#define RR_BSWAP32 _byteswap_ulong -unsigned int64_t __cdecl _byteswap_uint64 (unsigned int64_t val); +unsigned int64_t __cdecl _byteswap_uint64(unsigned int64_t val); #pragma intrinsic(_byteswap_uint64) -#define RR_BSWAP64 _byteswap_uint64 +#define RR_BSWAP64 _byteswap_uint64 -#elif defined(_MSC_VER) // VC6 +#elif defined(_MSC_VER) // VC6 -RADFORCEINLINE unsigned long RR_BSWAP16 (unsigned long _Long) -{ - __asm { +RADFORCEINLINE unsigned long RR_BSWAP16(unsigned long _Long) { + __asm { mov eax, [_Long] rol ax, 8 mov [_Long], eax; - } - return _Long; + } + return _Long; } -RADFORCEINLINE unsigned long RR_BSWAP32 (unsigned long _Long) -{ - __asm { +RADFORCEINLINE unsigned long RR_BSWAP32(unsigned long _Long) { + __asm { mov eax, [_Long] bswap eax mov [_Long], eax - } - return _Long; + } + return _Long; } -RADFORCEINLINE unsigned int64_t RR_BSWAP64 (unsigned int64_t _Long) -{ - __asm { +RADFORCEINLINE unsigned int64_t RR_BSWAP64(unsigned int64_t _Long) { + __asm { mov eax, DWORD PTR _Long mov edx, DWORD PTR _Long+4 bswap eax bswap edx mov DWORD PTR _Long, edx mov DWORD PTR _Long+4, eax - } - return _Long; + } + return _Long; } #elif defined(__GNUC__) || defined(__clang__) @@ -1927,98 +1990,112 @@ RADFORCEINLINE unsigned int64_t RR_BSWAP64 (unsigned int64_t _Long) // GCC has __builtin_bswap16, but Clang only seems to have added it recently. // We use __builtin_bswap32/64 but 16 just uses the macro version. (No big // deal if that turns into shifts anyway) -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32 __builtin_bswap32 -#define RR_BSWAP64 __builtin_bswap64 +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32 __builtin_bswap32 +#define RR_BSWAP64 __builtin_bswap64 #endif -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = (U16) RR_BSWAP16(val) -#define RR_GET16_BE_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,val,offset) *RR_U16_PTR_OFFSET(ptr,offset) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = (U16)RR_BSWAP16(val) +#define RR_GET16_BE_OFFSET(ptr, offset) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_BE_OFFSET(ptr, val, offset) \ + *RR_U16_PTR_OFFSET(ptr, offset) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#define RR_GET32_BE_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,val,offset) *RR_U32_PTR_OFFSET(ptr,offset) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE_OFFSET(ptr, offset) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_BE_OFFSET(ptr, val, offset) \ + *RR_U32_PTR_OFFSET(ptr, offset) = RR_BSWAP32(val) -#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) -#define RR_PUT64_BE(ptr,val) *((U64 *)(ptr)) = RR_BSWAP64(val) -#define RR_GET64_BE_OFFSET(ptr,offset) RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_BE_OFFSET(ptr,val,offset) *RR_U64_PTR_OFFSET(ptr,offset) = RR_BSWAP64(val) +#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) +#define RR_PUT64_BE(ptr, val) *((U64 *)(ptr)) = RR_BSWAP64(val) +#define RR_GET64_BE_OFFSET(ptr, offset) \ + RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr, offset)) +#define RR_PUT64_BE_OFFSET(ptr, val, offset) \ + *RR_U64_PTR_OFFSET(ptr, offset) = RR_BSWAP64(val) // end _MSC_VER -#elif defined(__RADXENON__) // Xenon has built-in funcs for this +#elif defined(__RADXENON__) // Xenon has built-in funcs for this unsigned short __loadshortbytereverse(int offset, const void *base); -unsigned long __loadwordbytereverse (int offset, const void *base); +unsigned long __loadwordbytereverse(int offset, const void *base); -void __storeshortbytereverse(unsigned short val, int offset, void *base); -void __storewordbytereverse (unsigned int val, int offset, void *base); +void __storeshortbytereverse(unsigned short val, int offset, void *base); +void __storewordbytereverse(unsigned int val, int offset, void *base); -#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) -#define RR_PUT16_LE(ptr,val) __storeshortbytereverse((U16) (val), 0, ptr) +#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) +#define RR_PUT16_LE(ptr, val) __storeshortbytereverse((U16)(val), 0, ptr) -#define RR_GET16_LE_OFFSET(ptr,offset) __loadshortbytereverse(offset, ptr) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __storeshortbytereverse((U16) (val), offset, ptr) +#define RR_GET16_LE_OFFSET(ptr, offset) __loadshortbytereverse(offset, ptr) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + __storeshortbytereverse((U16)(val), offset, ptr) -#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) -#define RR_PUT32_LE(ptr,val) __storewordbytereverse((U32) (val), 0, ptr) +#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) +#define RR_PUT32_LE(ptr, val) __storewordbytereverse((U32)(val), 0, ptr) -#define RR_GET32_LE_OFFSET(ptr,offset) __loadwordbytereverse(offset, ptr) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __storewordbytereverse((U32) (val), offset, ptr) +#define RR_GET32_LE_OFFSET(ptr, offset) __loadwordbytereverse(offset, ptr) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + __storewordbytereverse((U32)(val), offset, ptr) -#define RR_GET64_LE(ptr) ( ((U64)RR_GET32_OFFSET_LE(ptr,4)<<32) | RR_GET32_LE(ptr) ) -#define RR_PUT64_LE(ptr,val) RR_PUT32_LE(ptr, (U32) (val)), RR_PUT32_OFFSET_LE(ptr, (U32) ((val)>>32),4) +#define RR_GET64_LE(ptr) \ + (((U64)RR_GET32_OFFSET_LE(ptr, 4) << 32) | RR_GET32_LE(ptr)) +#define RR_PUT64_LE(ptr, val) \ + RR_PUT32_LE(ptr, (U32)(val)), RR_PUT32_OFFSET_LE(ptr, (U32)((val) >> 32), 4) #elif defined(__RADPS3__) #include -#define RR_GET16_LE(ptr) __lhbrx(ptr) -#define RR_PUT16_LE(ptr,val) __sthbrx(ptr, (U16) (val)) +#define RR_GET16_LE(ptr) __lhbrx(ptr) +#define RR_PUT16_LE(ptr, val) __sthbrx(ptr, (U16)(val)) -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16) (val)) +#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16)(val)) -#define RR_GET32_LE(ptr) __lwbrx(ptr) -#define RR_PUT32_LE(ptr,val) __stwbrx(ptr, (U32) (val)) +#define RR_GET32_LE(ptr) __lwbrx(ptr) +#define RR_PUT32_LE(ptr, val) __stwbrx(ptr, (U32)(val)) -#define RR_GET64_LE(ptr) __ldbrx(ptr) -#define RR_PUT64_LE(ptr,val) __stdbrx(ptr, (U32) (val)) +#define RR_GET64_LE(ptr) __ldbrx(ptr) +#define RR_PUT64_LE(ptr, val) __stdbrx(ptr, (U32)(val)) -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32) (val)) +#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32)(val)) #elif defined(__RADWII__) -#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) -#define RR_PUT16_LE(ptr,val) __sthbrx((U16) (val), ptr, 0) +#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) +#define RR_PUT16_LE(ptr, val) __sthbrx((U16)(val), ptr, 0) -#define RR_GET16_LE_OFFSET(ptr,offset) __lhbrx(ptr, offset) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) __sthbrx((U16) (val), ptr, offset) +#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(ptr, offset) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) __sthbrx((U16)(val), ptr, offset) -#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) -#define RR_PUT32_LE(ptr,val) __stwbrx((U32) (val), ptr, 0) +#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) +#define RR_PUT32_LE(ptr, val) __stwbrx((U32)(val), ptr, 0) -#define RR_GET32_LE_OFFSET(ptr,offset) __lwbrx(ptr, offset) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) __stwbrx((U32) (val), ptr, offset) +#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(ptr, offset) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) __stwbrx((U32)(val), ptr, offset) #elif defined(__RAD3DS__) -#define RR_GET16_BE(ptr) __rev16(*(U16 *) (ptr)) -#define RR_PUT16_BE(ptr,val) *(U16 *) (ptr) = __rev16(val) +#define RR_GET16_BE(ptr) __rev16(*(U16 *)(ptr)) +#define RR_PUT16_BE(ptr, val) *(U16 *)(ptr) = __rev16(val) -#define RR_GET16_BE_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_BE_OFFSET(ptr,offset,val) *RR_U16_PTR_OFFSET(ptr,offset) = __rev16(val) +#define RR_GET16_BE_OFFSET(ptr, offset) __rev16(*RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_BE_OFFSET(ptr, offset, val) \ + *RR_U16_PTR_OFFSET(ptr, offset) = __rev16(val) -#define RR_GET32_BE(ptr) __rev(*(U32 *) (ptr)) -#define RR_PUT32_BE(ptr,val) *(U32 *) (ptr) = __rev(val) +#define RR_GET32_BE(ptr) __rev(*(U32 *)(ptr)) +#define RR_PUT32_BE(ptr, val) *(U32 *)(ptr) = __rev(val) -#define RR_GET32_BE_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_BE_OFFSET(ptr,offset,val) *RR_U32_PTR_OFFSET(ptr,offset) = __rev(val) +#define RR_GET32_BE_OFFSET(ptr, offset) __rev(*RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_BE_OFFSET(ptr, offset, val) \ + *RR_U32_PTR_OFFSET(ptr, offset) = __rev(val) #elif defined(__RADIPHONE__) @@ -2026,87 +2103,98 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas // Bswap is just here for use of implementing get/put // caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) \ + ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ + (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) #elif defined(__RADWIIU__) #include -#define RR_GET16_LE(ptr) (*(__bytereversed U16 *) (ptr)) -#define RR_PUT16_LE(ptr,val) *(__bytereversed U16 *) (ptr) = val +#define RR_GET16_LE(ptr) (*(__bytereversed U16 *)(ptr)) +#define RR_PUT16_LE(ptr, val) *(__bytereversed U16 *)(ptr) = val -#define RR_GET16_LE_OFFSET(ptr,offset) (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset)) -#define RR_PUT16_LE_OFFSET(ptr,val,offset) *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr,offset) = val +#define RR_GET16_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset)) +#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset) = val -#define RR_GET32_LE(ptr) (*(__bytereversed U32 *) (ptr)) -#define RR_PUT32_LE(ptr,val) *(__bytereversed U32 *) (ptr) = val +#define RR_GET32_LE(ptr) (*(__bytereversed U32 *)(ptr)) +#define RR_PUT32_LE(ptr, val) *(__bytereversed U32 *)(ptr) = val -#define RR_GET32_LE_OFFSET(ptr,offset) (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT32_LE_OFFSET(ptr,val,offset) *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr,offset) = val +#define RR_GET32_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset) = val -#define RR_GET64_LE(ptr) (*(__bytereversed U64 *) (ptr)) -#define RR_PUT64_LE(ptr,val) *(__bytereversed U64 *) (ptr) = val +#define RR_GET64_LE(ptr) (*(__bytereversed U64 *)(ptr)) +#define RR_PUT64_LE(ptr, val) *(__bytereversed U64 *)(ptr) = val -#define RR_GET64_LE_OFFSET(ptr,offset) (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset)) -#define RR_PUT64_LE_OFFSET(ptr,val,offset) *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr,offset) = val +#define RR_GET64_LE_OFFSET(ptr, offset) \ + (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset)) +#define RR_PUT64_LE_OFFSET(ptr, val, offset) \ + *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset) = val #elif defined(__RADWINRTAPI__) && defined(__RADARM__) #include -#define RR_BSWAP16(u16) _arm_rev16(u16) -#define RR_BSWAP32(u32) _arm_rev(u32) +#define RR_BSWAP16(u16) _arm_rev16(u16) +#define RR_BSWAP32(u32) _arm_rev(u32) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) #elif defined(__RADPSP2__) // no rev16 exposed -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) __builtin_rev(u32) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) __builtin_rev(u32) -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#else // other platforms ? +#else // other platforms ? // fall back : // Bswap is just here for use of implementing get/put // caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ( (U16) ( ((u16) >> 8) | ((u16) << 8) ) ) -#define RR_BSWAP32(u32) ( (U32) ( ((u32) >> 24) | (((u32)<<8) & 0x00FF0000) | (((u32)>>8) & 0x0000FF00) | ((u32) << 24) ) ) -#define RR_BSWAP64(u64) ( ((U64) RR_BSWAP32((U32) (u64)) << 32) | (U64) RR_BSWAP32((U32) ((u64) >> 32)) ) +#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) +#define RR_BSWAP32(u32) \ + ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ + (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) +#define RR_BSWAP64(u64) \ + (((U64)RR_BSWAP32((U32)(u64)) << 32) | (U64)RR_BSWAP32((U32)((u64) >> 32))) #ifdef __RADLITTLEENDIAN__ // comment out fallbacks so users will get errors -//#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +// #define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +// #define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +// #define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +// #define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) #else // comment out fallbacks so users will get errors -//#define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -//#define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -//#define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -//#define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) +// #define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) +// #define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) +// #define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) +// #define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) #endif @@ -2115,104 +2203,122 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas //=================================================================== // @@ TEMP : Aliases for old names : remove me when possible : -#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET -#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET -#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET -#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET -#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET -#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET -#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET -#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET - +#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET +#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET +#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET +#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET +#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET +#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET +#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET +#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET //=================================================================== // UNALIGNED VERSIONS : -#if defined(__RADX86__) || defined(__RADPPC__) // platforms where unaligned is fast : +#if defined(__RADX86__) || \ + defined(__RADPPC__) // platforms where unaligned is fast : -#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_BE_OFFSET(ptr,offset) -#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_BE_OFFSET(ptr,offset) +#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET32_BE_OFFSET(ptr, offset) +#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET16_BE_OFFSET(ptr, offset) -#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET32_LE_OFFSET(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) RR_GET16_LE_OFFSET(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET32_LE_OFFSET(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + RR_GET16_LE_OFFSET(ptr, offset) #elif defined(__RAD3DS__) // arm has a "__packed" qualifier to tell the compiler to do unaligned accesses -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) +#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) +#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) #elif defined(__RADPSP2__) -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) +#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ + ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_BE_UNALIGNED(ptr) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset)) -#define RR_GET16_BE_UNALIGNED(ptr) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset)) +#define RR_GET32_BE_UNALIGNED(ptr) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) +#define RR_GET16_BE_UNALIGNED(ptr) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U32_PTR_OFFSET_UNALIGNED(ptr,offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) *RR_U16_PTR_OFFSET_UNALIGNED(ptr,offset) +#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) +#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) #else // Unaligned via bytes : -#define RR_GET32_BE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 0 ) ) +#define RR_GET32_BE_UNALIGNED(ptr) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 0 ) ) +#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 0)) -#define RR_GET16_BE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 0 ) ) +#define RR_GET16_BE_UNALIGNED(ptr) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 0 ) ) +#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 0)) -#define RR_GET32_LE_UNALIGNED(ptr) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) +#define RR_GET32_LE_UNALIGNED(ptr) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[3] << 24 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[2] << 16 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U32)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) +#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ + (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 24) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 16) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ + ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) -#define RR_GET16_LE_UNALIGNED(ptr) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr)))[0] << 0 ) ) +#define RR_GET16_LE_UNALIGNED(ptr) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr,offset) ( \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[1] << 8 ) | \ - ( (U16)(((const U8 * RR_GET_PTR_POST)(ptr))+(offset))[0] << 0 ) ) +#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ + (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ + ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) #endif @@ -2222,54 +2328,56 @@ void __storewordbytereverse (unsigned int val, int offset, void *bas #ifdef _MSC_VER - unsigned long __cdecl _lrotl(unsigned long, int); - #pragma intrinsic(_lrotl) +unsigned long __cdecl _lrotl(unsigned long, int); +#pragma intrinsic(_lrotl) - #define RR_ROTL32(x,k) _lrotl((unsigned long)(x),(int)(k)) +#define RR_ROTL32(x, k) _lrotl((unsigned long)(x), (int)(k)) -#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || defined(__RADPSP2__) +#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || \ + defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || \ + defined(__RADPSP2__) - // Compiler turns this into rotate correctly : - #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) +// Compiler turns this into rotate correctly : +#define RR_ROTL32(u32, num) (((u32) << (num)) | ((u32) >> (32 - (num)))) #elif defined(__RAD3DS__) - #define RR_ROTL32(u32,num) __ror(u32, (-(num))&31) +#define RR_ROTL32(u32, num) __ror(u32, (-(num)) & 31) #else // comment out fallbacks so users will get errors // fallback implementation using shift and or : -//#define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) +// #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) #endif - //=================================================================== // RR_ROTL64 : 64-bit rotate -#if ( defined(_MSC_VER) && _MSC_VER >= 1300) +#if (defined(_MSC_VER) && _MSC_VER >= 1300) unsigned int64_t __cdecl _rotl64(unsigned int64_t _Val, int _Shift); #pragma intrinsic(_rotl64) -#define RR_ROTL64(x,k) _rotl64((unsigned int64_t)(x),(int)(k)) +#define RR_ROTL64(x, k) _rotl64((unsigned int64_t)(x), (int)(k)) #elif defined(__RADCELL__) // PS3 GCC turns this into rotate correctly : -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) #elif defined(__RADLINUX__) || defined(__RADMACAPI__) -//APTODO: Just to compile linux. Should we be doing better than this? If not, combine with above. -#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +// APTODO: Just to compile linux. Should we be doing better than this? If not, +// combine with above. +#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) #else // comment out fallbacks so users will get errors // fallback implementation using shift and or : -//#define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) +// #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) #endif @@ -2281,42 +2389,49 @@ RADDEFEND // RR_COMPILER_ASSERT #if defined(__cplusplus) && !defined(RR_COMPILER_ASSERT) - #if defined(_MSC_VER) && (_MSC_VER >=1400) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) - // better version of COMPILER_ASSERT using boost technique - template struct RR_COMPILER_ASSERT_FAILURE; +// better version of COMPILER_ASSERT using boost technique +template +struct RR_COMPILER_ASSERT_FAILURE; - template <> struct RR_COMPILER_ASSERT_FAILURE<1> { enum { value = 1 }; }; +template <> +struct RR_COMPILER_ASSERT_FAILURE<1> { + enum { value = 1 }; +}; - template struct rr_compiler_assert_test{}; +template +struct rr_compiler_assert_test {}; - // __LINE__ macro broken when -ZI is used see Q199057 - #define RR_COMPILER_ASSERT( B ) \ - typedef rr_compiler_assert_test<\ - sizeof(RR_COMPILER_ASSERT_FAILURE< (B) ? 1 : 0 >)\ - > rr_compiler_assert_typedef_ +// __LINE__ macro broken when -ZI is used see Q199057 +#define RR_COMPILER_ASSERT(B) \ + typedef rr_compiler_assert_test)> \ + rr_compiler_assert_typedef_ - #endif +#endif #endif #ifndef RR_COMPILER_ASSERT - // this happens at declaration time, so if it's inside a function in a C file, drop {} around it - #define RR_COMPILER_ASSERT(exp) typedef char RR_STRING_JOIN(_dummy_array, __LINE__) [ (exp) ? 1 : -1 ] +// this happens at declaration time, so if it's inside a function in a C file, +// drop {} around it +#define RR_COMPILER_ASSERT(exp) \ + typedef char RR_STRING_JOIN(_dummy_array, __LINE__)[(exp) ? 1 : -1] #endif //=================================================================== // some error checks : - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == sizeof( RR_STRING_JOIN(RAD_U,RAD_PTRBITS) ) ); - RR_COMPILER_ASSERT( sizeof(RAD_UINTa) == RAD_PTRBYTES ); - RR_COMPILER_ASSERT( RAD_TWOPTRBYTES == 2* RAD_PTRBYTES ); +RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == + sizeof(RR_STRING_JOIN(RAD_U, RAD_PTRBITS))); +RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == RAD_PTRBYTES); +RR_COMPILER_ASSERT(RAD_TWOPTRBYTES == 2 * RAD_PTRBYTES); //=================================================================== - #endif // __RADRES__ - -//include "testconstant.inl" // uncomment and include to test statement constants - -#endif // __RADRR_COREH__ +#endif // __RADRES__ +// include "testconstant.inl" // uncomment and include to test statement +// constants +#endif // __RADRR_COREH__ diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 8a1ef2297..bf7a50f45 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -1,6 +1,5 @@  #include "WindowsGame.h" - #include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" @@ -20,7 +19,7 @@ WindowsGame::WindowsGame() : Game() {} void WindowsGame::SetRichPresenceContext(int iPad, int contextId) { PlatformProfile.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, - contextId); + contextId); } void WindowsGame::StoreLaunchData() {} @@ -29,12 +28,11 @@ void WindowsGame::FatalLoadError() {} void WindowsGame::CaptureSaveThumbnail() {} void WindowsGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} + unsigned int* thumbnailSize) {} void WindowsGame::ReleaseSaveThumbnail() {} -void WindowsGame::GetScreenshot(int iPad, - std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} +void WindowsGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, + unsigned int* screenshotSize) {} void WindowsGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,15 +111,14 @@ void WindowsGame::TemporaryCreateGameStart() { } int WindowsGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) { return -1; } int WindowsGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) { +int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { return -1; } diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp index 5b1a825ad..a1056d9e8 100644 --- a/targets/app/windows/Windows64_UIController.cpp +++ b/targets/app/windows/Windows64_UIController.cpp @@ -150,7 +150,8 @@ 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 = PlatformRenderer.TextureGetTexture(textureId); + ID3D11ShaderResourceView* tex = + PlatformRenderer.TextureGetTexture(textureId); ID3D11Resource* resource; tex->GetResource(&resource); ID3D11Texture2D* tex2d = (ID3D11Texture2D*)resource; diff --git a/targets/app/windows/WindowsGame.h b/targets/app/windows/WindowsGame.h index f04abc674..d7a31afc6 100644 --- a/targets/app/windows/WindowsGame.h +++ b/targets/app/windows/WindowsGame.h @@ -36,4 +36,3 @@ public: }; extern WindowsGame app; - diff --git a/targets/app/windows/XML/ATGXmlParser.h b/targets/app/windows/XML/ATGXmlParser.h index 2b8dabbe0..45ebfaee1 100644 --- a/targets/app/windows/XML/ATGXmlParser.h +++ b/targets/app/windows/XML/ATGXmlParser.h @@ -50,8 +50,8 @@ class ISAXCallback { friend class XMLParser; public: - ISAXCallback() {}; - virtual ~ISAXCallback() {}; + ISAXCallback(){}; + virtual ~ISAXCallback(){}; virtual int32_t StartDocument() = 0; virtual int32_t EndDocument() = 0; diff --git a/targets/app/windows/XML/xmlFilesCallback.h b/targets/app/windows/XML/xmlFilesCallback.h index f3d940f73..06d5fd3bc 100644 --- a/targets/app/windows/XML/xmlFilesCallback.h +++ b/targets/app/windows/XML/xmlFilesCallback.h @@ -58,8 +58,8 @@ public: // if the xuid hasn't been defined, then we can't use the data if (xuid != 0LL) { - return Game::RegisterMojangData( - wNameXUID, xuid, wNameSkin, wNameCloak); + return Game::RegisterMojangData(wNameXUID, xuid, wNameSkin, + wNameCloak); } else return 1; } else { @@ -136,8 +136,7 @@ public: printf("Type - %s, Value - %d, ", wType, iValue); #endif - return Game::RegisterConfigValues(wType, - iValue); + return Game::RegisterConfigValues(wType, iValue); } else { return 1; } @@ -267,9 +266,9 @@ public: #endif app.DebugPrintf("Full = %lld, Trial %lld\n", ullFull, ullTrial); - return Game::RegisterDLCData( - wType, wNameBanner, iGender, ullFull, ullTrial, wFirstSkin, - uiSortIndex, iConfig, wDataFile); + return Game::RegisterDLCData(wType, wNameBanner, iGender, + ullFull, ullTrial, wFirstSkin, + uiSortIndex, iConfig, wDataFile); } else { return 1; } diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index c71f2e217..7563ecbfc 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -6,7 +6,6 @@ #include #include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/ConnectScreen.h" @@ -19,20 +18,20 @@ #include "minecraft/world/item/crafting/Recipes.h" #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/Level.h" - #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "util/StringHelpers.h" // #include "Social/SocialManager.h" // #include "app/common/Leaderboards/LeaderboardManager.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "../Resource.h" #include "Sentient/SentientManager.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Options.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" HINSTANCE hMyInst; LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, @@ -75,17 +74,17 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -99,92 +98,92 @@ void DefineActions(void) { MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -198,92 +197,92 @@ void DefineActions(void) { MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -300,77 +299,77 @@ void DefineActions(void) { MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); } HINSTANCE g_hInst = nullptr; @@ -736,8 +735,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // no profile data for the player PlatformProfile.SetDefaultOptionsCallback( [](IPlatformProfile::PROFILESETTINGS* pSettings, int iPad) { - return Game::DefaultOptionsCallback(&app, pSettings, - 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 diff --git a/targets/java/include/java/ByteBuffer.h b/targets/java/include/java/ByteBuffer.h index 4213b3de1..f088ac0ef 100644 --- a/targets/java/include/java/ByteBuffer.h +++ b/targets/java/include/java/ByteBuffer.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include #include "Buffer.h" -#include class IntBuffer; class FloatBuffer; diff --git a/targets/java/include/java/InputOutputStream/GZIPInputStream.h b/targets/java/include/java/InputOutputStream/GZIPInputStream.h index 6fa590f70..3aa36bcb7 100644 --- a/targets/java/include/java/InputOutputStream/GZIPInputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPInputStream.h @@ -11,7 +11,7 @@ private: InputStream* stream; public: - GZIPInputStream(InputStream* out) : stream(out) {}; + GZIPInputStream(InputStream* out) : stream(out){}; virtual int read() { return stream->read(); }; virtual int read(std::vector& b) { return stream->read(b); }; virtual int read(std::vector& b, unsigned int offset, diff --git a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h index b7015ee4f..d14e47821 100644 --- a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h @@ -9,7 +9,7 @@ private: OutputStream* stream; public: - GZIPOutputStream(OutputStream* out) : stream(out) {}; + GZIPOutputStream(OutputStream* out) : stream(out){}; virtual void write(unsigned int b) { stream->write(b); }; virtual void write(const std::vector& b) { stream->write(b); }; virtual void write(const std::vector& b, unsigned int offset, diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index ccc96a374..6a05e3caf 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -8,9 +8,9 @@ #include #include -#include "util/StringHelpers.h" // 4jcraft TODO -#include "platform/fs/fs.h" #include "java/FileFilter.h" +#include "platform/fs/fs.h" +#include "util/StringHelpers.h" // 4jcraft TODO const char File::pathSeparator = '/'; @@ -20,9 +20,7 @@ const std::string File::pathRoot = namespace { namespace fs = std::filesystem; -fs::path ToFilesystemPath(const std::string& path) { - return fs::path(path); -} +fs::path ToFilesystemPath(const std::string& path) { return fs::path(path); } std::string ToFilename(const fs::path& path) { const std::string filename = path.filename().string(); diff --git a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp index c2bf9123f..39f8b1e0d 100644 --- a/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp +++ b/targets/java/src/InputOutputStream/ByteArrayInputStream.cpp @@ -28,10 +28,10 @@ ByteArrayInputStream::ByteArrayInputStream(std::vector& buf) this->buf = buf; } -// 4jcraft: helper function to create a ByteArrayInputStream from a vector of bytes to avoid one copy +// 4jcraft: helper function to create a ByteArrayInputStream from a vector of +// bytes to avoid one copy ByteArrayInputStream::ByteArrayInputStream(std::vector&& buf) - : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) { -} + : buf(std::move(buf)), pos(0), count(this->buf.size()), mark(0) {} // Reads the next byte of data from this input stream. The value byte is // returned as an int in the range 0 to 255. If no byte is available because the diff --git a/targets/java/src/InputOutputStream/FileInputStream.cpp b/targets/java/src/InputOutputStream/FileInputStream.cpp index c59f25e81..1522fdb58 100644 --- a/targets/java/src/InputOutputStream/FileInputStream.cpp +++ b/targets/java/src/InputOutputStream/FileInputStream.cpp @@ -7,11 +7,10 @@ #include #include #include +#include #include #include -#include - #include "java/File.h" namespace { @@ -53,7 +52,8 @@ FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) { #if defined(_WIN32) m_fileHandle = _wfopen(file.getPath().c_str(), "rb"); #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "rb"); #endif diff --git a/targets/java/src/InputOutputStream/FileOutputStream.cpp b/targets/java/src/InputOutputStream/FileOutputStream.cpp index 59f64750f..82db3bbac 100644 --- a/targets/java/src/InputOutputStream/FileOutputStream.cpp +++ b/targets/java/src/InputOutputStream/FileOutputStream.cpp @@ -2,11 +2,10 @@ #include #include +#include #include #include -#include - #include "java/File.h" // Creates a file output stream to write to the file represented by the @@ -30,7 +29,8 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) { #if defined(_WIN32) m_fileHandle = _wfopen(file.getPath().c_str(), "wb"); #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "wb"); #endif diff --git a/targets/minecraft/BuildVer.h b/targets/minecraft/BuildVer.h index 130825af8..fcf6eb240 100644 --- a/targets/minecraft/BuildVer.h +++ b/targets/minecraft/BuildVer.h @@ -48,9 +48,9 @@ #define VER_FILEVERSION_STR2(x, y) \ VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y -#define VER_FILEVERSION_STR2_W(x, y) \ - VER_FILEVERSION_STRING_W "." VER_FILEBPAD_W VER_WIDE_PREFIX( \ - #x) "." VER_WIDE_PREFIX(#y) +#define VER_FILEVERSION_STR2_W(x, y) \ + VER_FILEVERSION_STRING_W \ + "." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y) #define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y) #define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y) diff --git a/targets/minecraft/Facing.cpp b/targets/minecraft/Facing.cpp index 49e1ccb14..11a5592b0 100644 --- a/targets/minecraft/Facing.cpp +++ b/targets/minecraft/Facing.cpp @@ -9,4 +9,4 @@ const int Facing::STEP_Y[6] = {-1, 1, 0, 0, 0, 0}; const int Facing::STEP_Z[6] = {0, 0, -1, 1, 0, 0}; const std::string Facing::NAMES[] = {"DOWN", "UP", "NORTH", - "SOUTH", "WEST", "EAST"}; \ No newline at end of file + "SOUTH", "WEST", "EAST"}; \ No newline at end of file diff --git a/targets/minecraft/GameHostOptions.cpp b/targets/minecraft/GameHostOptions.cpp index 33bd30311..69569a5bd 100644 --- a/targets/minecraft/GameHostOptions.cpp +++ b/targets/minecraft/GameHostOptions.cpp @@ -91,31 +91,43 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { switch (option) { case eGameHostOption_FriendsOfFriends: - setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); break; + setBit(GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); + break; case eGameHostOption_Difficulty: settings &= ~GAME_HOST_OPTION_BITMASK_DIFFICULTY; - settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); break; + settings |= (GAME_HOST_OPTION_BITMASK_DIFFICULTY & value); + break; case eGameHostOption_Gamertags: - setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); break; + setBit(GAME_HOST_OPTION_BITMASK_GAMERTAGS); + break; case eGameHostOption_GameType: settings &= ~GAME_HOST_OPTION_BITMASK_GAMETYPE; - settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); break; + settings |= (GAME_HOST_OPTION_BITMASK_GAMETYPE & (value << 4)); + break; case eGameHostOption_LevelType: - setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); break; + setBit(GAME_HOST_OPTION_BITMASK_LEVELTYPE); + break; case eGameHostOption_Structures: - setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); break; + setBit(GAME_HOST_OPTION_BITMASK_STRUCTURES); + break; case eGameHostOption_BonusChest: - setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); break; + setBit(GAME_HOST_OPTION_BITMASK_BONUSCHEST); + break; case eGameHostOption_HasBeenInCreative: - setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); break; + setBit(GAME_HOST_OPTION_BITMASK_BEENINCREATIVE); + break; case eGameHostOption_PvP: - setBit(GAME_HOST_OPTION_BITMASK_PVP); break; + setBit(GAME_HOST_OPTION_BITMASK_PVP); + break; case eGameHostOption_TrustPlayers: - setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); break; + setBit(GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS); + break; case eGameHostOption_TNT: - setBit(GAME_HOST_OPTION_BITMASK_TNT); break; + setBit(GAME_HOST_OPTION_BITMASK_TNT); + break; case eGameHostOption_FireSpreads: - setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); break; + setBit(GAME_HOST_OPTION_BITMASK_FIRESPREADS); + break; case eGameHostOption_CheatsEnabled: if (value != 0) { settings |= GAME_HOST_OPTION_BITMASK_HOSTFLY; @@ -125,40 +137,56 @@ void set(unsigned int& settings, eGameHostOption option, unsigned int value) { settings &= ~GAME_HOST_OPTION_BITMASK_HOSTFLY; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTHUNGER; settings &= ~GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE; - } break; + } + break; case eGameHostOption_HostCanFly: - setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTFLY); + break; case eGameHostOption_HostCanChangeHunger: - setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTHUNGER); + break; case eGameHostOption_HostCanBeInvisible: - setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); break; + setBit(GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE); + break; case eGameHostOption_BedrockFog: - setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); break; + setBit(GAME_HOST_OPTION_BITMASK_BEDROCKFOG); + break; case eGameHostOption_DisableSaving: - setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); break; + setBit(GAME_HOST_OPTION_BITMASK_DISABLESAVE); + break; case eGameHostOption_WasntSaveOwner: - setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); break; + setBit(GAME_HOST_OPTION_BITMASK_NOTOWNER); + break; case eGameHostOption_MobGriefing: - setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_MOBGRIEFING); + break; case eGameHostOption_KeepInventory: - setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); break; + setBit(GAME_HOST_OPTION_BITMASK_KEEPINVENTORY); + break; case eGameHostOption_DoMobSpawning: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING); + break; case eGameHostOption_DoMobLoot: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOMOBLOOT); + break; case eGameHostOption_DoTileDrops: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DOTILEDROPS); + break; case eGameHostOption_NaturalRegeneration: - setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_NATURALREGEN); + break; case eGameHostOption_DoDaylightCycle: - setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); break; + setInvertedBit(GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE); + break; case eGameHostOption_WorldSize: settings &= ~GAME_HOST_OPTION_BITMASK_WORLDSIZE; - settings |= (GAME_HOST_OPTION_BITMASK_WORLDSIZE & - (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); + settings |= + (GAME_HOST_OPTION_BITMASK_WORLDSIZE & + (value << GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT)); break; case eGameHostOption_All: - settings = value; break; + settings = value; + break; default: break; } diff --git a/targets/minecraft/IGameServices.cpp b/targets/minecraft/IGameServices.cpp index a854ef3ef..3d801d9b6 100644 --- a/targets/minecraft/IGameServices.cpp +++ b/targets/minecraft/IGameServices.cpp @@ -4,9 +4,7 @@ static IGameServices* s_services = nullptr; -void initGameServices(IGameServices* services) { - s_services = services; -} +void initGameServices(IGameServices* services) { s_services = services; } IGameServices& gameServices() { assert(s_services && diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index da3193b8e..47a23f155 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -14,13 +14,13 @@ class ModelPart; class DLCSkinFile; class DLCPack; -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/GameTypes.h" #include "minecraft/GameEnums.h" +#include "minecraft/GameTypes.h" #include "minecraft/XuiActionPayload.h" -#include "platform/PlatformTypes.h" -#include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/client/IMenuService.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/PlatformTypes.h" // eINSTANCEOF lives in java/Class.h which is heavyweight. using EntityTypeId = int; @@ -37,21 +37,23 @@ public: [[nodiscard]] virtual bool debugSettingsOn() = 0; [[nodiscard]] virtual bool debugArtToolsOn() = 0; - [[nodiscard]] virtual unsigned int debugGetMask(int iPad = -1, - bool overridePlayer = false) = 0; + [[nodiscard]] virtual unsigned int debugGetMask( + int iPad = -1, bool overridePlayer = false) = 0; [[nodiscard]] virtual bool debugMobsDontAttack() = 0; [[nodiscard]] virtual bool debugMobsDontTick() = 0; [[nodiscard]] virtual bool debugFreezePlayers() = 0; // -- Game host options (global settings via stored pointer) -- - [[nodiscard]] virtual unsigned int getGameHostOption(eGameHostOption option) = 0; + [[nodiscard]] virtual unsigned int getGameHostOption( + eGameHostOption option) = 0; virtual void setGameHostOption(eGameHostOption option, unsigned int value) = 0; // -- Level generation -- - [[nodiscard]] virtual LevelGenerationOptions* getLevelGenerationOptions() = 0; + [[nodiscard]] virtual LevelGenerationOptions* + getLevelGenerationOptions() = 0; [[nodiscard]] virtual LevelRuleset* getGameRuleDefinitions() = 0; // -- Texture cache -- @@ -60,14 +62,15 @@ public: std::uint8_t* data, unsigned int size) = 0; virtual void removeMemoryTextureFile(const std::string& name) = 0; - virtual void getMemFileDetails(const std::string& name, - std::uint8_t** data, + virtual void getMemFileDetails(const std::string& name, std::uint8_t** data, unsigned int* size) = 0; - [[nodiscard]] virtual bool isFileInMemoryTextures(const std::string& name) = 0; + [[nodiscard]] virtual bool isFileInMemoryTextures( + const std::string& name) = 0; // -- Player settings -- - [[nodiscard]] virtual unsigned char getGameSettings(int iPad, int setting) = 0; + [[nodiscard]] virtual unsigned char getGameSettings(int iPad, + int setting) = 0; [[nodiscard]] virtual unsigned char getGameSettings(int setting) = 0; // -- App time -- @@ -125,9 +128,9 @@ public: [[nodiscard]] virtual std::uint32_t getPlayerSkinId(int iPad) = 0; [[nodiscard]] virtual std::string getPlayerCapeName(int iPad) = 0; [[nodiscard]] virtual std::uint32_t getPlayerCapeId(int iPad) = 0; - [[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad(int iPad) = 0; - virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID, - SKIN_BOX* boxA, + [[nodiscard]] virtual std::uint32_t getAdditionalModelPartsForPad( + int iPad) = 0; + virtual void setAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* boxA, unsigned int boxC) = 0; [[nodiscard]] virtual std::vector* getAdditionalSkinBoxes( std::uint32_t dwSkinID) = 0; @@ -139,8 +142,10 @@ public: unsigned int bitmask) = 0; [[nodiscard]] virtual unsigned int getAnimOverrideBitmask( std::uint32_t dwSkinID) = 0; - [[nodiscard]] virtual std::uint32_t getSkinIdFromPath(const std::string& skin) = 0; - [[nodiscard]] virtual std::string getSkinPathFromId(std::uint32_t skinId) = 0; + [[nodiscard]] virtual std::uint32_t getSkinIdFromPath( + const std::string& skin) = 0; + [[nodiscard]] virtual std::string getSkinPathFromId( + std::uint32_t skinId) = 0; [[nodiscard]] virtual bool defaultCapeExists() = 0; [[nodiscard]] virtual bool isXuidNotch(PlayerUID xuid) = 0; [[nodiscard]] virtual bool isXuidDeadmau5(PlayerUID xuid) = 0; @@ -150,8 +155,7 @@ public: virtual void fatalLoadError() = 0; virtual void setRichPresenceContext(int iPad, int contextId) = 0; virtual void captureSaveThumbnail() = 0; - virtual void getSaveThumbnail(std::uint8_t** data, - unsigned int* size) = 0; + virtual void getSaveThumbnail(std::uint8_t** data, unsigned int* size) = 0; virtual void readBannedList(int iPad, eTMSAction action = (eTMSAction)0, bool bCallback = false) = 0; virtual void updatePlayerInfo(std::uint8_t networkSmallId, @@ -159,17 +163,16 @@ public: unsigned int playerPrivileges) = 0; [[nodiscard]] virtual unsigned int getPlayerPrivileges( std::uint8_t networkSmallId) = 0; - virtual void setGameSettingsDebugMask(int iPad, - unsigned int uiVal) = 0; + virtual void setGameSettingsDebugMask(int iPad, unsigned int uiVal) = 0; // -- Schematics / terrain -- virtual void processSchematics(LevelChunk* chunk) = 0; virtual void processSchematicsLighting(LevelChunk* chunk) = 0; - virtual void addTerrainFeaturePosition(_eTerrainFeatureType type, - int x, int z) = 0; - [[nodiscard]] virtual bool getTerrainFeaturePosition(_eTerrainFeatureType type, - int* pX, int* pZ) = 0; + virtual void addTerrainFeaturePosition(_eTerrainFeatureType type, int x, + int z) = 0; + [[nodiscard]] virtual bool getTerrainFeaturePosition( + _eTerrainFeatureType type, int* pX, int* pZ) = 0; virtual void loadDefaultGameRules() = 0; // -- Archive / resources -- @@ -187,17 +190,16 @@ public: [[nodiscard]] virtual unsigned int createImageTextData( std::uint8_t* textMetadata, int64_t seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId) = 0; - [[nodiscard]] virtual std::string getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder, - std::string mountPoint = "TPACK:") = 0; + [[nodiscard]] virtual std::string getFilePath( + std::uint32_t packId, std::string filename, bool bAddDataFolder, + std::string mountPoint = "TPACK:") = 0; [[nodiscard]] virtual char* getUniqueMapName() = 0; virtual void setUniqueMapName(char* name) = 0; [[nodiscard]] virtual unsigned int getOpacityTimer(int iPad) = 0; virtual void setOpacityTimer(int iPad) = 0; virtual void tickOpacityTimer(int iPad) = 0; [[nodiscard]] virtual bool isInBannedLevelList(int iPad, PlayerUID xuid, - char* levelName) = 0; + char* levelName) = 0; [[nodiscard]] virtual MOJANG_DATA* getMojangDataForXuid(PlayerUID xuid) = 0; virtual void debugPrintf(const char* msg) = 0; @@ -208,16 +210,16 @@ public: [[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0; virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0; [[nodiscard]] virtual bool dlcReadDataFile(unsigned int& filesProcessed, - const std::string& path, DLCPack* pack, - bool fromArchive = false) = 0; + const std::string& path, + DLCPack* pack, + bool fromArchive = false) = 0; virtual void dlcRemovePack(DLCPack* pack) = 0; // -- Game rules -- virtual LevelGenerationOptions* loadGameRules(std::uint8_t* data, - unsigned int size) = 0; - virtual void saveGameRules(std::uint8_t** data, - unsigned int* size) = 0; + unsigned int size) = 0; + virtual void saveGameRules(std::uint8_t** data, unsigned int* size) = 0; virtual void unloadCurrentGameRules() = 0; virtual void setLevelGenerationOptions( LevelGenerationOptions* levelGen) = 0; diff --git a/targets/minecraft/SharedConstants.h b/targets/minecraft/SharedConstants.h index 6699867d6..dc4cc1726 100644 --- a/targets/minecraft/SharedConstants.h +++ b/targets/minecraft/SharedConstants.h @@ -25,8 +25,7 @@ public: static std::string acceptableLetters; static inline constexpr int ILLEGAL_FILE_CHARACTERS_LENGTH = 15; - static const char - ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; + static const char ILLEGAL_FILE_CHARACTERS[ILLEGAL_FILE_CHARACTERS_LENGTH]; static const bool TEXTURE_LIGHTING; // 4J - change brought forward from 1.8.2 diff --git a/targets/minecraft/XuiActionPayload.h b/targets/minecraft/XuiActionPayload.h index 34e6989e4..aeb49dadc 100644 --- a/targets/minecraft/XuiActionPayload.h +++ b/targets/minecraft/XuiActionPayload.h @@ -20,8 +20,6 @@ struct XuiActionOwnedPayload { } // namespace minecraft -using XuiActionPayload = std::variant< - std::monostate, - bool, - std::int64_t, - std::unique_ptr>; +using XuiActionPayload = + std::variant>; diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 07a8d5b7b..dff8e52f9 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,14 +6,14 @@ #include #include -#include "platform/renderer/renderer.h" +#include "PlatformTypes.h" #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "minecraft/IGameServices.h" -#include "PlatformTypes.h" -#include "util/StringHelpers.h" #include "platform/fs/fs.h" +#include "platform/renderer/renderer.h" +#include "util/StringHelpers.h" BufferedImage::BufferedImage(int width, int height, int type) { data[0] = new int[width * height]; @@ -36,8 +36,7 @@ void BufferedImage::ByteFlip4(unsigned int& data) { // with a valid alpha channel. // 4jcraft: mostly rewrote this function -BufferedImage::BufferedImage(const std::string& File, - bool filenameHasExtension, +BufferedImage::BufferedImage(const std::string& File, bool filenameHasExtension, bool bTitleUpdateTexture, const std::string& drive) { int32_t hr = -1; @@ -94,13 +93,14 @@ BufferedImage::BufferedImage(const std::string& File, if (foundOnDisk) { std::string nativePath = std::filesystem::path(finalPath).string(); hr = PlatformRenderer.LoadTextureData(nativePath.c_str(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } else { std::string archiveKey = "res/" + fileName; if (gameServices().hasArchiveFile(archiveKey)) { - std::vector ba = gameServices().getArchiveFile(archiveKey); + std::vector ba = + gameServices().getArchiveFile(archiveKey); hr = PlatformRenderer.LoadTextureData(ba.data(), ba.size(), - &ImageInfo, &data[l]); + &ImageInfo, &data[l]); } } @@ -134,9 +134,9 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, std::string mipMapPath = (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; name = "res" + (filenameHasExtension - ? filePath - : filePath.substr(0, filePath.length() - 4) + - mipMapPath + ".png"); + ? filePath + : filePath.substr(0, filePath.length() - 4) + + mipMapPath + ".png"); if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { if (l == 0) gameServices().fatalLoadError(); @@ -152,7 +152,7 @@ BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, D3DXIMAGE_INFO ImageInfo; hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, - &data[l]); + &data[l]); if (hr == 0 && l == 0) { width = ImageInfo.Width; height = ImageInfo.Height; @@ -167,8 +167,8 @@ BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { D3DXIMAGE_INFO ImageInfo; memset(&ImageInfo, 0, sizeof(D3DXIMAGE_INFO)); - int32_t hr = - PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, &data[0]); + int32_t hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, + &data[0]); if (hr == 0) { width = ImageInfo.Width; diff --git a/targets/minecraft/client/Camera.cpp b/targets/minecraft/client/Camera.cpp index b5b31e63f..1e8f2d924 100644 --- a/targets/minecraft/client/Camera.cpp +++ b/targets/minecraft/client/Camera.cpp @@ -1,14 +1,12 @@ #include "Camera.h" - -#include #include #include +#include #include #include "MemoryTracker.h" -#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -18,6 +16,7 @@ #include "minecraft/world/level/tile/LiquidTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/stubs.h" float Camera::xPlayerOffs = 0.0f; float Camera::yPlayerOffs = 0.0f; diff --git a/targets/minecraft/client/IMenuService.h b/targets/minecraft/client/IMenuService.h index deac5a411..2a782bccc 100644 --- a/targets/minecraft/client/IMenuService.h +++ b/targets/minecraft/client/IMenuService.h @@ -44,8 +44,7 @@ public: std::shared_ptr trap) = 0; virtual bool openFireworks(int iPad, std::shared_ptr player, int x, int y, int z) = 0; - virtual bool openSign(int iPad, - std::shared_ptr sign) = 0; + virtual bool openSign(int iPad, std::shared_ptr sign) = 0; virtual bool openRepairing(int iPad, std::shared_ptr inventory, Level* level, int x, int y, int z) = 0; virtual bool openTrading(int iPad, std::shared_ptr inventory, @@ -55,9 +54,9 @@ public: int iPad, std::shared_ptr commandBlock) = 0; virtual bool openHopper(int iPad, std::shared_ptr inventory, std::shared_ptr hopper) = 0; - virtual bool openHopperMinecart( - int iPad, std::shared_ptr inventory, - std::shared_ptr hopper) = 0; + virtual bool openHopperMinecart(int iPad, + std::shared_ptr inventory, + std::shared_ptr hopper) = 0; virtual bool openHorse(int iPad, std::shared_ptr inventory, std::shared_ptr container, std::shared_ptr horse) = 0; diff --git a/targets/minecraft/client/Lighting.cpp b/targets/minecraft/client/Lighting.cpp index ef9e1087a..4811b786e 100644 --- a/targets/minecraft/client/Lighting.cpp +++ b/targets/minecraft/client/Lighting.cpp @@ -1,11 +1,9 @@ #include "Lighting.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" #include "java/FloatBuffer.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FloatBuffer* Lighting::lb = new FloatBuffer(16); diff --git a/targets/minecraft/client/MemoryTracker.cpp b/targets/minecraft/client/MemoryTracker.cpp index 7e60bbbe9..41a7a60a2 100644 --- a/targets/minecraft/client/MemoryTracker.cpp +++ b/targets/minecraft/client/MemoryTracker.cpp @@ -1,12 +1,11 @@ #include "MemoryTracker.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "java/ByteBuffer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" std::unordered_map MemoryTracker::GL_LIST_IDS; std::vector MemoryTracker::TEXTURE_IDS; diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index e16d15b87..93ea4d4fc 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1,5 +1,4 @@ #include "Minecraft.h" -#include "platform/stubs.h" #include #include @@ -18,9 +17,6 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/world/level/dlc/DLCConstants.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -54,8 +50,10 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" @@ -85,6 +83,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/CompressedTileStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" @@ -99,19 +98,19 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" +#include "platform/stubs.h" #include "strings.h" #if defined(ENABLE_JAVA_GUIS) #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/Minecraft_Macros.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" #include "java/File.h" #include "java/System.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/StaticConstructors.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/gui/Font.h" @@ -123,6 +122,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" #include "minecraft/client/renderer/texture/TextureManager.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/world/entity/npc/Villager.h" #include "minecraft/world/item/alchemy/PotionMacros.h" @@ -1443,7 +1443,8 @@ void Minecraft::run_middle() { player = createExtraLocalPlayer( i, - PlatformProfile.GetGamertag(i), + PlatformProfile + .GetGamertag(i), i, level->dimension ->id); @@ -1512,8 +1513,7 @@ void Minecraft::run_middle() { Log::info( "Bringing up the sign in ui\n"); PlatformProfile.RequestSignInUI( - false, - NetworkService.IsLocalGame(), + false, NetworkService.IsLocalGame(), true, false, true, [this](bool b, int p) { return InGame_SignInReturned( @@ -1695,10 +1695,9 @@ void Minecraft::run_middle() { if (unoccupiedQuadrant > -1) { // render a logo PlatformRenderer.StateSetViewport(( - IPlatformRenderer:: - eViewportType)(IPlatformRenderer:: - VIEWPORT_TYPE_QUADRANT_TOP_LEFT + - unoccupiedQuadrant)); + IPlatformRenderer::eViewportType)( + IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2176,8 +2175,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->isRiding()) { std::shared_ptr mount = player->riding; - if (mount->instanceof(eTYPE_MINECART) || - mount->instanceof(eTYPE_BOAT)) { + if (mount->instanceof (eTYPE_MINECART) || mount->instanceof + (eTYPE_BOAT)) { *piAlt = IDS_TOOLTIPS_EXIT; } else { *piAlt = IDS_TOOLTIPS_DISMOUNT; @@ -3203,7 +3202,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; default: - if (hitResult->entity->instanceof(eTYPE_MOB)) { + if (hitResult->entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast( hitResult->entity); @@ -4500,8 +4499,8 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { pMinecraftClass->localplayers[iPad]; if (player == nullptr) { player = pMinecraftClass->createExtraLocalPlayer( - iPad, PlatformProfile.GetGamertag(iPad), - iPad, pMinecraftClass->level->dimension->id); + iPad, PlatformProfile.GetGamertag(iPad), iPad, + pMinecraftClass->level->dimension->id); } } } else if (PlatformProfile.IsSignedInLive( diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 44ca6988a..192239382 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -6,11 +6,11 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/C4JThread.h" #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" #include "platform/stubs.h" class Timer; diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index 8b4a83a75..c0fd1f95a 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,9 +1,7 @@ -#include "minecraft/util/Log.h" #include "Options.h" #include "KeyMapping.h" #include "app/common/Audio/SoundEngine.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -15,7 +13,9 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "platform/stubs.h" +#include "util/StringHelpers.h" // 4J - the Option sub-class used to be an java enumerated type, trying to // emulate that functionality here @@ -103,8 +103,8 @@ const std::string Options::FRAMERATE_LIMITS[] = { #endif const std::string Options::PARTICLES[] = {"options.particles.all", - "options.particles.decreased", - "options.particles.minimal"}; + "options.particles.decreased", + "options.particles.minimal"}; // 4J added void Options::init() { @@ -374,7 +374,7 @@ void Options::load() { std::string line = ""; while ((line = br->readLine()) != "") // 4J - was check against nullptr - do we need to distinguish - // between empty lines and a fail here? + // between empty lines and a fail here? { // 4J - removed try/catch // try { @@ -394,8 +394,7 @@ void Options::load() { if (cmds[0] == "fov") fov = readFloat(cmds[1]); if (cmds[0] == "gamma") gamma = readFloat(cmds[1]); if (cmds[0] == "invertYMouse") invertYMouse = cmds[1] == "true"; - if (cmds[0] == "viewDistance") - viewDistance = fromWString(cmds[1]); + if (cmds[0] == "viewDistance") viewDistance = fromWString(cmds[1]); if (cmds[0] == "guiScale") guiScale = fromWString(cmds[1]); if (cmds[0] == "particles") particles = fromWString(cmds[1]); if (cmds[0] == "bobView") bobView = cmds[1] == "true"; @@ -444,8 +443,8 @@ void Options::save() { dos.writeChars("music:" + toWString(music) + "\n"); dos.writeChars("sound:" + toWString(sound) + "\n"); - dos.writeChars("invertYMouse:" + - std::string(invertYMouse ? "true" : "false") + "\n"); + dos.writeChars( + "invertYMouse:" + std::string(invertYMouse ? "true" : "false") + "\n"); dos.writeChars("mouseSensitivity:" + toWString(sensitivity)); dos.writeChars("fov:" + toWString(fov)); dos.writeChars("gamma:" + toWString(gamma)); @@ -453,16 +452,14 @@ void Options::save() { dos.writeChars("guiScale:" + toWString(guiScale)); dos.writeChars("particles:" + toWString(particles)); dos.writeChars("bobView:" + std::string(bobView ? "true" : "false")); - dos.writeChars("anaglyph3d:" + - std::string(anaglyph3d ? "true" : "false")); + dos.writeChars("anaglyph3d:" + std::string(anaglyph3d ? "true" : "false")); dos.writeChars("advancedOpengl:" + std::string(advancedOpengl ? "true" : "false")); dos.writeChars("fpsLimit:" + toWString(framerateLimit)); dos.writeChars("difficulty:" + toWString(difficulty)); dos.writeChars("fancyGraphics:" + std::string(fancyGraphics ? "true" : "false")); - dos.writeChars("ao:" + - std::string(ambientOcclusion ? "true" : "false")); + dos.writeChars("ao:" + std::string(ambientOcclusion ? "true" : "false")); dos.writeChars("clouds:" + toWString(renderClouds)); dos.writeChars("skin:" + skin); dos.writeChars("lastServer:" + lastMpIp); diff --git a/targets/minecraft/client/gui/Button.cpp b/targets/minecraft/client/gui/Button.cpp index 1d0cc9458..d4b48ad3c 100644 --- a/targets/minecraft/client/gui/Button.cpp +++ b/targets/minecraft/client/gui/Button.cpp @@ -1,10 +1,10 @@ #include "Button.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Minecraft; #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/ChatScreen.cpp b/targets/minecraft/client/gui/ChatScreen.cpp index 69eb819e7..224962a8d 100644 --- a/targets/minecraft/client/gui/ChatScreen.cpp +++ b/targets/minecraft/client/gui/ChatScreen.cpp @@ -2,16 +2,15 @@ #include -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" -const std::string ChatScreen::allowedChars = - SharedConstants::acceptableLetters; +const std::string ChatScreen::allowedChars = SharedConstants::acceptableLetters; ChatScreen::ChatScreen() { frame = 0; } diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index ca6167c84..0b66a378e 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CreateWorldScreen.h" #include @@ -8,12 +6,14 @@ #include #include -#include "platform/storage/storage.h" #include "Button.h" #include "EditBox.h" #include "MessageScreen.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/INetworkService.h" +#include "minecraft/util/Log.h" +#include "platform/storage/storage.h" // Needed for the &CGameNetworkManager::RunNetworkGameThreadProc address-of // below. Static thread procs can't be virtual; this one consumer keeps the // concrete type include. @@ -21,9 +21,6 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" -#include "platform/NetTypes.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -32,6 +29,9 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/NetTypes.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" CreateWorldScreen::CreateWorldScreen(Screen* lastScreen) { done = false; // 4J added @@ -256,42 +256,44 @@ void CreateWorldScreen::buttonClicked(Button* button) { param->settings = 0; gameServices().setGameHostOption(eGameHostOption_Difficulty, - minecraft->options->difficulty); - gameServices().setGameHostOption(eGameHostOption_FriendsOfFriends, - moreOptionsParams->bAllowFriendsOfFriends); + minecraft->options->difficulty); + gameServices().setGameHostOption( + eGameHostOption_FriendsOfFriends, + moreOptionsParams->bAllowFriendsOfFriends); gameServices().setGameHostOption(eGameHostOption_Gamertags, 1); gameServices().setGameHostOption(eGameHostOption_BedrockFog, 0); gameServices().setGameHostOption(eGameHostOption_GameType, - (gameMode == "survival") - ? GameType::SURVIVAL->getId() - : GameType::CREATIVE->getId()); + (gameMode == "survival") + ? GameType::SURVIVAL->getId() + : GameType::CREATIVE->getId()); gameServices().setGameHostOption(eGameHostOption_LevelType, - moreOptionsParams->bFlatWorld); + moreOptionsParams->bFlatWorld); gameServices().setGameHostOption(eGameHostOption_Structures, - moreOptionsParams->bStructures); + moreOptionsParams->bStructures); gameServices().setGameHostOption(eGameHostOption_BonusChest, - moreOptionsParams->bBonusChest); - gameServices().setGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP); + moreOptionsParams->bBonusChest); + gameServices().setGameHostOption(eGameHostOption_PvP, + moreOptionsParams->bPVP); gameServices().setGameHostOption(eGameHostOption_TrustPlayers, - moreOptionsParams->bTrust); + moreOptionsParams->bTrust); gameServices().setGameHostOption(eGameHostOption_FireSpreads, - moreOptionsParams->bFireSpreads); - gameServices().setGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT); + moreOptionsParams->bFireSpreads); + gameServices().setGameHostOption(eGameHostOption_TNT, + moreOptionsParams->bTNT); gameServices().setGameHostOption(eGameHostOption_HostCanFly, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanChangeHunger, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_HostCanBeInvisible, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); gameServices().setGameHostOption(eGameHostOption_CheatsEnabled, - moreOptionsParams->bHostPrivileges); + moreOptionsParams->bHostPrivileges); param->settings = gameServices().getGameHostOption(eGameHostOption_All); param->xzSize = LEVEL_MAX_WIDTH; param->hellScale = HELL_LEVEL_MAX_SCALE; - NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, - 0); + NetworkService.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS, 0); NetworkService.FakeLocalPlayerJoined(); @@ -408,8 +410,7 @@ void CreateWorldScreen::render(int xm, int ym, float a) { width / 2 - 100, 85, 0xa0a0a0); drawString(font, language->getElement("selectWorld.mapFeatures.info"), width / 2 - 150, 122, 0xa0a0a0); - drawString(font, - language->getElement("selectWorld.allowCommands.info"), + drawString(font, language->getElement("selectWorld.allowCommands.info"), width / 2 - 150, 157, 0xa0a0a0); seedEdit->render(); diff --git a/targets/minecraft/client/gui/CreateWorldScreen.h b/targets/minecraft/client/gui/CreateWorldScreen.h index 550a650d5..4aee42a54 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.h +++ b/targets/minecraft/client/gui/CreateWorldScreen.h @@ -44,7 +44,7 @@ private: public: static std::string findAvailableFolderName(LevelStorageSource* levelSource, - const std::string& folder); + const std::string& folder); virtual void removed() override; protected: diff --git a/targets/minecraft/client/gui/DeathScreen.cpp b/targets/minecraft/client/gui/DeathScreen.cpp index 04df42ce8..a59bfcf92 100644 --- a/targets/minecraft/client/gui/DeathScreen.cpp +++ b/targets/minecraft/client/gui/DeathScreen.cpp @@ -1,17 +1,17 @@ #include "DeathScreen.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "Button.h" #include "PauseScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void DeathScreen::init() { buttons.clear(); diff --git a/targets/minecraft/client/gui/EditBox.cpp b/targets/minecraft/client/gui/EditBox.cpp index 9af8859d3..af4085859 100644 --- a/targets/minecraft/client/gui/EditBox.cpp +++ b/targets/minecraft/client/gui/EditBox.cpp @@ -1,8 +1,8 @@ #include "EditBox.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" EditBox::EditBox(Screen* screen, Font* font, int x, int y, int width, int height, const std::string& value) { diff --git a/targets/minecraft/client/gui/ErrorScreen.cpp b/targets/minecraft/client/gui/ErrorScreen.cpp index 73cbb843d..05c60e996 100644 --- a/targets/minecraft/client/gui/ErrorScreen.cpp +++ b/targets/minecraft/client/gui/ErrorScreen.cpp @@ -2,8 +2,7 @@ #include "minecraft/client/gui/Screen.h" -ErrorScreen::ErrorScreen(const std::string& title, - const std::string& message) { +ErrorScreen::ErrorScreen(const std::string& title, const std::string& message) { this->title = title; this->message = message; } diff --git a/targets/minecraft/client/gui/Font.cpp b/targets/minecraft/client/gui/Font.cpp index 904afa844..2120533d0 100644 --- a/targets/minecraft/client/gui/Font.cpp +++ b/targets/minecraft/client/gui/Font.cpp @@ -1,5 +1,4 @@ #include "Font.h" -#include "platform/stubs.h" #include @@ -14,6 +13,7 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "util/StringHelpers.h" Font::Font(Options* options, const std::string& name, Textures* textures, diff --git a/targets/minecraft/client/gui/Font.h b/targets/minecraft/client/gui/Font.h index 83b0a4ce1..03a84f04c 100644 --- a/targets/minecraft/client/gui/Font.h +++ b/targets/minecraft/client/gui/Font.h @@ -64,8 +64,7 @@ private: std::string reorderBidi(const std::string& str); void draw(const std::string& str, bool dropShadow); - void draw(const std::string& str, int x, int y, int color, - bool dropShadow); + void draw(const std::string& str, int x, int y, int color, bool dropShadow); int MapCharacter(char c); // 4J added bool CharacterExists(char c); // 4J added diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 2ae6d830e..cf6315f69 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -1,23 +1,17 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "Gui.h" -#include #include +#include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Facing.h" -#include "minecraft/GameEnums.h" #include "app/common/App_structs.h" #include "app/linux/Linux_UIController.h" -#include "platform/XboxStubs.h" -#include "util/StringHelpers.h" +#include "java/Color.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" -#include "java/Color.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/Lighting.h" @@ -37,28 +31,30 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/resources/ResourceLocation.h" - #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/entity/Entity.h" +#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" +#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" -#include "minecraft/world/entity/ai/attributes/AttributeInstance.h" -#include "minecraft/world/entity/monster/SharedMonsterAttributes.h" #include "minecraft/world/food/FoodConstants.h" - #include "minecraft/world/item/ItemInstance.h" - #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/PortalTile.h" #include "minecraft/world/level/tile/Tile.h" - +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" +#include "util/StringHelpers.h" ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR); @@ -113,10 +109,12 @@ 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 == IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN) { - guiScale = gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; - } else { guiScale = - gameServices().getGameSettings(iPad, eGameSetting_UISizeSplitscreen) + 2; + gameServices().getGameSettings(iPad, eGameSetting_UISize) + 2; + } else { + guiScale = gameServices().getGameSettings( + iPad, eGameSetting_UISizeSplitscreen) + + 2; } ScreenSizeCalculator ssc(minecraft->options, minecraft->width, @@ -251,7 +249,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { eAppAction_AutosaveSaveGameCapturedThumbnail); // if tooltips are off, set the y offset to zero - if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && bDisplayGui) { + if (gameServices().getGameSettings(iPad, eGameSetting_Tooltips) == 0 && + bDisplayGui) { switch (minecraft->player->m_iScreenSection) { case IPlatformRenderer::VIEWPORT_TYPE_FULLSCREEN: iTooltipsYOffset = screenHeight / 10; @@ -359,7 +358,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { } PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); currentGuiBlendFactor = fVal / 255.0f; // PlatformRenderer.StateSetBlendFactor(0x40ffffff); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); @@ -411,7 +410,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { &GUI_ICONS_LOCATION); // "/gui/icons.png")); glEnable(GL_BLEND); PlatformRenderer.StateSetBlendFactor(0xffffff | - (((unsigned int)fVal) << 24)); + (((unsigned int)fVal) << 24)); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); // glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); // 4J Stu - We don't want to adjust the cursor by the safezone, we @@ -729,7 +728,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { // positions worked out by hand from the xui implementation of the // crouch icon - if (gameServices().getGameSettings(iPad, eGameSetting_AnimatedCharacter)) { + if (gameServices().getGameSettings(iPad, + eGameSetting_AnimatedCharacter)) { // int playerIdx = minecraft->player->GetXboxPad(); static int characterDisplayTimer[4] = {0}; @@ -951,9 +951,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { if (minecraft->options->renderDebug) { glPushMatrix(); if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0); - font->drawShadow(ClientConstants::VERSION_STRING + " (" + - minecraft->fpsString + ")", - iSafezoneXHalf + 2, 20, 0xffffff); + font->drawShadow( + ClientConstants::VERSION_STRING + " (" + minecraft->fpsString + ")", + iSafezoneXHalf + 2, 20, 0xffffff); font->drawShadow( "Seed: " + toWString(minecraft->level->getLevelData()->getSeed()), @@ -978,8 +978,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { wfeature[eTerrainFeature_Village] = "Village: "; wfeature[eTerrainFeature_Ravine] = "Ravine: "; - for (int i = 0; i < gameServices().getTerrainFeatures().size(); i++) { - FEATURE_DATA* pFeatureData = gameServices().getTerrainFeatures()[i]; + for (int i = 0; i < gameServices().getTerrainFeatures().size(); + i++) { + FEATURE_DATA* pFeatureData = + gameServices().getTerrainFeatures()[i]; std::string itemInfo = "[" + toWString(pFeatureData->x * 16) + ", " + @@ -1016,8 +1018,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth double zBlockPos = floor(minecraft->player->z); drawString(font, "x: " + toWString(minecraft->player->x) + - "/ Head: " + toWString(xBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(xBlockPos) + "/ Chunk: " + toWString(minecraft->player->xChunk), iSafezoneXHalf + 2, iYPos + 8 * 0, 0xe0e0e0); drawString(font, @@ -1026,8 +1027,7 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth iSafezoneXHalf + 2, iYPos + 8 * 1, 0xe0e0e0); drawString(font, "z: " + toWString(minecraft->player->z) + - "/ Head: " + toWString(zBlockPos) + - "/ Chunk: " + + "/ Head: " + toWString(zBlockPos) + "/ Chunk: " + toWString(minecraft->player->zChunk), iSafezoneXHalf + 2, iYPos + 8 * 2, 0xe0e0e0); drawString( @@ -1048,10 +1048,10 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth LevelChunk* chunkAt = minecraft->level->getChunkAt(px, pz); Biome* biome = chunkAt->getBiome( px & 15, pz & 15, minecraft->level->getBiomeSource()); - drawString(font, - "b: " + biome->m_name + " (" + - toWString(biome->id) + ")", - iSafezoneXHalf + 2, iYPos, 0xe0e0e0); + drawString( + font, + "b: " + biome->m_name + " (" + toWString(biome->id) + ")", + iSafezoneXHalf + 2, iYPos, 0xe0e0e0); } glPopMatrix(); @@ -1085,7 +1085,8 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth int col = 0xffffff; if (animateOverlayMessageColor) { - col = Color::getHSBColor(t / 50.0f, 0.7f, 0.6f).getRGB() & 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 @@ -1465,8 +1466,8 @@ void Gui::addMessage(const std::string& _string, int iPad, // add to all for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (minecraft->localplayers[i] && - !(bIsDeathMessage && - gameServices().getGameSettings(i, eGameSetting_DeathMessages) == 0)) { + !(bIsDeathMessage && gameServices().getGameSettings( + i, eGameSetting_DeathMessages) == 0)) { guiMessages[i].insert(guiMessages[i].begin(), GuiMessage(string)); while (guiMessages[i].size() > 50) { @@ -1475,7 +1476,8 @@ void Gui::addMessage(const std::string& _string, int iPad, } } } else if (!(bIsDeathMessage && - gameServices().getGameSettings(iPad, eGameSetting_DeathMessages) == 0)) { + gameServices().getGameSettings( + iPad, eGameSetting_DeathMessages) == 0)) { guiMessages[iPad].insert(guiMessages[iPad].begin(), GuiMessage(string)); while (guiMessages[iPad].size() > 50) { guiMessages[iPad].pop_back(); @@ -1517,8 +1519,8 @@ void Gui::setNowPlaying(const std::string& string) { void Gui::displayClientMessage(int messageId, int iPad) { // Language *language = Language::getInstance(); - std::string languageString = - gameServices().getString(messageId); // language->getElement(messageId); + std::string languageString = gameServices().getString( + messageId); // language->getElement(messageId); addMessage(languageString, iPad); } diff --git a/targets/minecraft/client/gui/Gui.h b/targets/minecraft/client/gui/Gui.h index 7cee85007..b60408898 100644 --- a/targets/minecraft/client/gui/Gui.h +++ b/targets/minecraft/client/gui/Gui.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "GuiComponent.h" #include "minecraft/client/GuiMessage.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "platform/PlatformTypes.h" class Random; class Minecraft; diff --git a/targets/minecraft/client/gui/GuiComponent.cpp b/targets/minecraft/client/gui/GuiComponent.cpp index 839fbb660..c6918b199 100644 --- a/targets/minecraft/client/gui/GuiComponent.cpp +++ b/targets/minecraft/client/gui/GuiComponent.cpp @@ -1,14 +1,13 @@ #include "GuiComponent.h" -#include "platform/stubs.h" - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Gui.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void GuiComponent::hLine(int x0, int x1, int y, int col) { if (x1 < x0) { @@ -93,8 +92,8 @@ void GuiComponent::fillGradient(int x0, int y0, int x1, int y1, int col1, GuiComponent::GuiComponent() { blitOffset = 0; } -void GuiComponent::drawCenteredString(Font* font, const std::string& str, - int x, int y, int color) { +void GuiComponent::drawCenteredString(Font* font, const std::string& str, int x, + int y, int color) { font->drawShadow(str, x - (font->width(str)) / 2, y, color); } diff --git a/targets/minecraft/client/gui/InBedChatScreen.cpp b/targets/minecraft/client/gui/InBedChatScreen.cpp index 65cac4711..ec0ab8e10 100644 --- a/targets/minecraft/client/gui/InBedChatScreen.cpp +++ b/targets/minecraft/client/gui/InBedChatScreen.cpp @@ -5,12 +5,12 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/ChatScreen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" void InBedChatScreen::init() { Keyboard::enableRepeatEvents(true); diff --git a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp index 14555085d..c15972f95 100644 --- a/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp +++ b/targets/minecraft/client/gui/JoinMultiplayerScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" JoinMultiplayerScreen::JoinMultiplayerScreen(Screen* lastScreen) { ipEdit = nullptr; @@ -103,10 +103,10 @@ void JoinMultiplayerScreen::render(int xm, int ym, float a) { drawCenteredString(font, language->getElement("multiplayer.title"), width / 2, height / 4 - 60 + 20, 0xffffff); - drawString(font, language->getElement("multiplayer.info1"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); - drawString(font, language->getElement("multiplayer.info2"), - width / 2 - 140, height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info1"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 0, 0xa0a0a0); + drawString(font, language->getElement("multiplayer.info2"), width / 2 - 140, + height / 4 - 60 + 60 + 9 * 1, 0xa0a0a0); drawString(font, language->getElement("multiplayer.ipinfo"), width / 2 - 140, height / 4 - 60 + 60 + 9 * 4, 0xa0a0a0); diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index d649343f8..ca4374ca5 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -1,6 +1,4 @@ #include "Minimap.h" -#include "platform/stubs.h" - #include #include @@ -8,17 +6,18 @@ #include -#include "platform/renderer/renderer.h" #include "Font.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/material/MaterialColor.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" int Minimap::LUT[256]; // 4J added bool Minimap::genLUT = true; // 4J added diff --git a/targets/minecraft/client/gui/NameEntryScreen.cpp b/targets/minecraft/client/gui/NameEntryScreen.cpp index 3eb92a8ed..f66185978 100644 --- a/targets/minecraft/client/gui/NameEntryScreen.cpp +++ b/targets/minecraft/client/gui/NameEntryScreen.cpp @@ -3,17 +3,17 @@ #include #include "Button.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string NameEntryScreen::allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " ",.:-_'*!\"#%/()=+?[]{}<>"; -NameEntryScreen::NameEntryScreen(Screen* lastScreen, - const std::string& oldName, int slot) { +NameEntryScreen::NameEntryScreen(Screen* lastScreen, const std::string& oldName, + int slot) { frame = 0; // 4J added this->lastScreen = lastScreen; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index 4966f2877..d97aef333 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "PauseScreen.h" #include @@ -8,17 +7,18 @@ #include #include -#include "platform/input/input.h" #include "Button.h" #include "MessageScreen.h" -#include "minecraft/GameEnums.h" -#include "minecraft/network/INetworkService.h" #include "OptionsScreen.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/locale/I18n.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" +#include "platform/input/input.h" PauseScreen::PauseScreen() { saveStep = 0; @@ -30,10 +30,9 @@ void PauseScreen::init() { buttons.clear(); int yo = -16; // 4jcraft: solves the issue of client-side only pausing in the java gui - if (NetworkService.IsLocalGame() && - NetworkService.GetPlayerCount() == 1) + if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + eXuiServerAction_PauseServer, true); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); if (!NetworkService.IsHost()) { @@ -70,7 +69,8 @@ void PauseScreen::exitWorld(Minecraft* minecraft, bool save) { if (NetworkService.IsHost()) { server->setSaveOnExit(save); } - gameServices().setAction(minecraft->player->GetXboxPad(), eAppAction_ExitWorld); + gameServices().setAction(minecraft->player->GetXboxPad(), + eAppAction_ExitWorld); } void PauseScreen::buttonClicked(Button* button) { @@ -91,7 +91,7 @@ void PauseScreen::buttonClicked(Button* button) { } if (button->id == 4) { gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + eXuiServerAction_PauseServer, false); minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } diff --git a/targets/minecraft/client/gui/RenameWorldScreen.cpp b/targets/minecraft/client/gui/RenameWorldScreen.cpp index fb060ff2b..da2decafc 100644 --- a/targets/minecraft/client/gui/RenameWorldScreen.cpp +++ b/targets/minecraft/client/gui/RenameWorldScreen.cpp @@ -4,12 +4,12 @@ #include "Button.h" #include "EditBox.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/locale/Language.h" #include "minecraft/world/level/storage/LevelStorageSource.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" RenameWorldScreen::RenameWorldScreen(Screen* lastScreen, const std::string& levelId) { diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 42194c7fb..adfa8080c 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,19 +1,19 @@ -#include "minecraft/IGameServices.h" #include "Screen.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" #include "Button.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/network/INetworkService.h" -#include "platform/stubs.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" -#include "minecraft/client/gui/particle/GuiParticles.h" -#include "minecraft/sounds/SoundTypes.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" +#include "minecraft/client/gui/particle/GuiParticles.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/network/INetworkService.h" +#include "minecraft/sounds/SoundTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/stubs.h" Screen::Screen() // 4J added { @@ -43,7 +43,8 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + eXuiServerAction_PauseServer, + false); } } diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index 813247347..cc78b1386 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SelectWorldScreen.h" #include @@ -13,13 +12,14 @@ #include "ConfirmScreen.h" #include "CreateWorldScreen.h" #include "RenameWorldScreen.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/ScrolledSelectionList.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/LevelStorageSource.h" #include "minecraft/world/level/storage/LevelSummary.h" +#include "util/StringHelpers.h" SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) { // 4J - added initialisers @@ -110,8 +110,7 @@ void SelectWorldScreen::buttonClicked(Button* button) { std::string warning = "'" + worldName + "' " + language->getElement("selectWorld.deleteWarning"); - std::string yes = - language->getElement("selectWorld.deleteButton"); + std::string yes = language->getElement("selectWorld.deleteButton"); std::string no = language->getElement("gui.cancel"); ConfirmScreen* confirmScreen = diff --git a/targets/minecraft/client/gui/SlideButton.cpp b/targets/minecraft/client/gui/SlideButton.cpp index 4b908415c..95bd9b608 100644 --- a/targets/minecraft/client/gui/SlideButton.cpp +++ b/targets/minecraft/client/gui/SlideButton.cpp @@ -1,10 +1,10 @@ #include "SlideButton.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Button.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SlideButton::SlideButton(int id, int x, int y, const Options::Option* option, const std::string& msg, float value) diff --git a/targets/minecraft/client/gui/TradeSwitchButton.cpp b/targets/minecraft/client/gui/TradeSwitchButton.cpp index dc0ecd691..844be43b1 100644 --- a/targets/minecraft/client/gui/TradeSwitchButton.cpp +++ b/targets/minecraft/client/gui/TradeSwitchButton.cpp @@ -1,13 +1,12 @@ #include "TradeSwitchButton.h" -#include "platform/stubs.h" #include - #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index cb77e9436..789c06100 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -1,17 +1,15 @@ #include "AchievementPopup.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" #include "java/System.h" +#include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" -#include "minecraft/client/Lighting.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementPopup::AchievementPopup(Minecraft* mc) { // 4J - added initialisers @@ -78,7 +76,7 @@ void AchievementPopup::render() { prepareWindow(); std::string title = "Minecraft " + SharedConstants::VERSION_STRING + - " Unlicensed Copy :("; + " Unlicensed Copy :("; std::string msg1 = "(Or logged in from another location)"; std::string msg2 = "Purchase at minecraft.net"; diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp index 1789ce69e..6b34dc186 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.cpp @@ -1,12 +1,8 @@ #include "AchievementScreen.h" - - #include #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" @@ -17,6 +13,8 @@ #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" AchievementScreen::AchievementScreen(StatsCounter* statsCounter) { // 4J - added initialisers diff --git a/targets/minecraft/client/gui/achievement/AchievementScreen.h b/targets/minecraft/client/gui/achievement/AchievementScreen.h index d2ba38f56..5e780812e 100644 --- a/targets/minecraft/client/gui/achievement/AchievementScreen.h +++ b/targets/minecraft/client/gui/achievement/AchievementScreen.h @@ -2,7 +2,6 @@ #include "minecraft/client/gui/Screen.h" #include "minecraft/stats/Achievements.h" - class StatsCounter; class AchievementScreen : public Screen { diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index d9dbee6b6..cca45430e 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,8 +1,6 @@ #include "StatsScreen.h" #include "app/common/Audio/SoundEngine.h" -#include "platform/stubs.h" -#include "util/StringHelpers.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" @@ -16,6 +14,8 @@ #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class Tesselator; diff --git a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp index 74e622032..c64f49710 100644 --- a/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractBeaconButton.cpp @@ -1,13 +1,13 @@ #include "AbstractBeaconButton.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp index 0618c0a9d..5c552d809 100644 --- a/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/AbstractContainerScreen.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "AbstractContainerScreen.h" #include #include -#include "platform/stubs.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/KeyMapping.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -15,11 +14,12 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" +#include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/Rarity.h" -#include "minecraft/world/entity/player/Inventory.h" +#include "platform/stubs.h" ItemRenderer* AbstractContainerScreen::itemRenderer = new ItemRenderer(); @@ -248,7 +248,8 @@ void AbstractContainerScreen::renderTooltip(std::shared_ptr item, } if (!cleanedLines.empty()) { - lineColors[0] = gameServices().getHTMLColour(item->getRarity()->color); + lineColors[0] = + gameServices().getHTMLColour(item->getRarity()->color); } renderTooltipInternal(cleanedLines, lineColors, xm, ym); diff --git a/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp index 4226697e6..34a6b3137 100644 --- a/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconCancelButton.cpp @@ -23,6 +23,6 @@ BeaconCancelButton::BeaconCancelButton(BeaconScreen* screen, int id, int x, } void BeaconCancelButton::renderTooltip(int xm, int ym) { - screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), - xm, ym); + screen->renderTooltip(Language::getInstance()->getElement("gui.cancel"), xm, + ym); } \ No newline at end of file diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp index 597eb7e18..b4a2acdbb 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.cpp @@ -1,13 +1,13 @@ -#include "minecraft/IGameServices.h" #include "BeaconPowerButton.h" #include #include "BeaconScreen.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/gui/inventory/AbstractBeaconButton.h" -#include "minecraft/world/effect/MobEffect.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/world/effect/MobEffect.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) #ifdef ENABLE_JAVA_GUIS diff --git a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h index 9a6750239..f29a10cb7 100644 --- a/targets/minecraft/client/gui/inventory/BeaconPowerButton.h +++ b/targets/minecraft/client/gui/inventory/BeaconPowerButton.h @@ -1,7 +1,6 @@ #pragma once #include "AbstractBeaconButton.h" - class BeaconScreen; class BeaconPowerButton : public AbstractBeaconButton { diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp index 1b487a04b..012514558 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.cpp @@ -1,13 +1,9 @@ #include "BeaconScreen.h" -#include "platform/stubs.h" - - #include #include #include -#include "platform/renderer/renderer.h" #include "BeaconCancelButton.h" #include "BeaconConfirmButton.h" #include "BeaconPowerButton.h" @@ -28,6 +24,8 @@ #include "minecraft/world/inventory/BeaconMenu.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes (and iggy too) diff --git a/targets/minecraft/client/gui/inventory/BeaconScreen.h b/targets/minecraft/client/gui/inventory/BeaconScreen.h index 4a977ac58..531b7c551 100644 --- a/targets/minecraft/client/gui/inventory/BeaconScreen.h +++ b/targets/minecraft/client/gui/inventory/BeaconScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BeaconMenu.h" - class BeaconConfirmButton; class BeaconCancelButton; class BeaconMenu; diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp index 0c7cf7a0a..20533c5b8 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.cpp @@ -1,17 +1,16 @@ #include "BrewingStandScreen.h" -#include "platform/stubs.h" #include - +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h index 45f4a16bc..51d2a1bd3 100644 --- a/targets/minecraft/client/gui/inventory/BrewingStandScreen.h +++ b/targets/minecraft/client/gui/inventory/BrewingStandScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/BrewingStandMenu.h" - class BrewingStandMenu; class BrewingStandTileEntity; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp index ae91c2dcd..5a8dc4c16 100644 --- a/targets/minecraft/client/gui/inventory/ContainerScreen.cpp +++ b/targets/minecraft/client/gui/inventory/ContainerScreen.cpp @@ -1,11 +1,11 @@ #include "ContainerScreen.h" -#include "platform/stubs.h" -#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/world/Container.h" +#include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/world/Container.h" #include "minecraft/world/inventory/ContainerMenu.h" +#include "platform/stubs.h" ContainerScreen::ContainerScreen(std::shared_ptr inventory, std::shared_ptr container) diff --git a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp index a6bcbf21e..f842e5277 100644 --- a/targets/minecraft/client/gui/inventory/CraftingScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CraftingScreen.cpp @@ -1,5 +1,4 @@ #include "CraftingScreen.h" -#include "platform/stubs.h" #include @@ -11,6 +10,7 @@ #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/CraftingMenu.h" +#include "platform/stubs.h" class Player; diff --git a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp index cff4ed82d..435c4333b 100644 --- a/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/CreativeInventoryScreen.cpp @@ -1,24 +1,19 @@ -#include "minecraft/IGameServices.h" #include "CreativeInventoryScreen.h" - - #include #include -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "AbstractContainerScreen.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" -#include "platform/stubs.h" -#include "minecraft/client/Minecraft.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/Screen.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "minecraft/client/gui/Font.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" @@ -28,6 +23,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // Static member initialization int CreativeInventoryScreen::selectedTabIndex = @@ -257,8 +255,8 @@ void CreativeInventoryScreen::updateEvents() { currentScroll -= step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); - } else if (PlatformInput.ButtonDown(0, - MINECRAFT_ACTION_RIGHT_SCROLL)) { + } else if (PlatformInput.ButtonDown( + 0, MINECRAFT_ACTION_RIGHT_SCROLL)) { currentScroll += step; currentScroll = std::max(0.0f, std::min(1.0f, currentScroll)); container->scrollTo(currentScroll); @@ -410,7 +408,8 @@ void CreativeInventoryScreen::renderLabels() { IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex]; if (spec) { - std::string tabName = gameServices().getString(spec->m_descriptionId); + std::string tabName = + gameServices().getString(spec->m_descriptionId); font->draw(tabName, 8, 6, 0x404040); } } @@ -587,9 +586,9 @@ bool CreativeInventoryScreen::renderIconTooltip(int tab, int mouseX, if (isMouseOverIcon(tab, x, y)) { glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - renderTooltip( - gameServices().getString(IUIScene_CreativeMenu::specs[tab]->m_descriptionId), - mouseX, mouseY); + renderTooltip(gameServices().getString( + IUIScene_CreativeMenu::specs[tab]->m_descriptionId), + mouseX, mouseY); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); return true; diff --git a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp index 24b817438..bd1703ed2 100644 --- a/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp +++ b/targets/minecraft/client/gui/inventory/EnchantmentScreen.cpp @@ -1,5 +1,4 @@ #include "EnchantmentScreen.h" -#include "platform/stubs.h" #include #include @@ -8,7 +7,6 @@ #include #include - #include "AbstractContainerScreen.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" @@ -23,6 +21,7 @@ #include "minecraft/world/inventory/EnchantmentMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/stubs.h" class Level; @@ -317,11 +316,10 @@ EnchantmentScreen::EnchantmentNames::EnchantmentNames() { "physical grow shrink demon elemental spirit animal creature beast " "humanoid undead fresh stale "; std::istringstream iss(allWords); - std::copy(std::istream_iterator >(iss), - std::istream_iterator >(), - std::back_inserter(words)); + std::copy( + std::istream_iterator >(iss), + std::istream_iterator >(), + std::back_inserter(words)); } std::string EnchantmentScreen::EnchantmentNames::getRandomName() { diff --git a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp index 06cbfe66f..054d1371e 100644 --- a/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp +++ b/targets/minecraft/client/gui/inventory/FurnaceScreen.cpp @@ -1,16 +1,16 @@ #include "FurnaceScreen.h" -#include "platform/stubs.h" #include +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" -#include "minecraft/client/Minecraft.h" +#include "platform/stubs.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_FURNACE_LOCATION = ResourceLocation(TN_GUI_FURNACE); diff --git a/targets/minecraft/client/gui/inventory/HopperScreen.cpp b/targets/minecraft/client/gui/inventory/HopperScreen.cpp index cb5708a3a..8d88dda59 100644 --- a/targets/minecraft/client/gui/inventory/HopperScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HopperScreen.cpp @@ -1,13 +1,13 @@ #include "HopperScreen.h" -#include "platform/stubs.h" +#include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HopperMenu.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/renderer/Textures.h" +#include "platform/stubs.h" // 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing // container classes diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp index 7ebd3f8d9..1568b13ea 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.cpp @@ -1,10 +1,8 @@ #include "HorseInventoryScreen.h" -#include "platform/stubs.h" #include #include - #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -16,6 +14,7 @@ #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HorseInventoryMenu.h" +#include "platform/stubs.h" class EntityHorse; diff --git a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h index c543c563b..4a08c9be5 100644 --- a/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h +++ b/targets/minecraft/client/gui/inventory/HorseInventoryScreen.h @@ -3,7 +3,6 @@ #include "AbstractContainerScreen.h" - class Container; class EntityHorse; class Inventory; diff --git a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp index db178dc35..8e6f17b80 100644 --- a/targets/minecraft/client/gui/inventory/InventoryScreen.cpp +++ b/targets/minecraft/client/gui/inventory/InventoryScreen.cpp @@ -1,11 +1,9 @@ #include "InventoryScreen.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -19,6 +17,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" InventoryScreen::InventoryScreen(std::shared_ptr player) : AbstractContainerScreen(player->inventoryMenu) { diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp index 7a832e609..9f6a995dc 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.cpp +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.cpp @@ -1,11 +1,9 @@ #include "MerchantScreen.h" -#include "platform/stubs.h" #include #include #include - #include "AbstractContainerScreen.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -23,8 +21,9 @@ #include "minecraft/world/inventory/MerchantContainer.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/trading/Merchant.h" -#include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "minecraft/world/item/trading/MerchantRecipeList.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/gui/inventory/MerchantScreen.h b/targets/minecraft/client/gui/inventory/MerchantScreen.h index 698fc394c..d48ab2028 100644 --- a/targets/minecraft/client/gui/inventory/MerchantScreen.h +++ b/targets/minecraft/client/gui/inventory/MerchantScreen.h @@ -5,7 +5,6 @@ #include "AbstractContainerScreen.h" #include "minecraft/world/inventory/MerchantMenu.h" - class TradeSwitchButton; class Inventory; class Level; diff --git a/targets/minecraft/client/gui/inventory/RepairScreen.cpp b/targets/minecraft/client/gui/inventory/RepairScreen.cpp index ae6122887..4f9cad4a8 100644 --- a/targets/minecraft/client/gui/inventory/RepairScreen.cpp +++ b/targets/minecraft/client/gui/inventory/RepairScreen.cpp @@ -1,12 +1,8 @@ #include "RepairScreen.h" -#include "platform/stubs.h" - - #include #include -#include "platform/renderer/renderer.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" @@ -22,6 +18,8 @@ #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Inventory; class Level; @@ -73,8 +71,7 @@ void RepairScreen::render(int xm, int ym, float a) { } void RepairScreen::renderLabels() { - std::string title = - Language::getInstance()->getElement("container.repair"); + std::string title = Language::getInstance()->getElement("container.repair"); font->draw(title, 60, 6, 0x404040); if (repairMenu->cost > 0) { diff --git a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp index c3ddf2b66..d52f28bc8 100644 --- a/targets/minecraft/client/gui/inventory/TextEditScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TextEditScreen.cpp @@ -2,8 +2,6 @@ #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -14,6 +12,8 @@ #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const std::string TextEditScreen::allowedChars = SharedConstants::acceptableLetters; diff --git a/targets/minecraft/client/gui/inventory/TrapScreen.cpp b/targets/minecraft/client/gui/inventory/TrapScreen.cpp index 98fdcaab4..8b68a5b12 100644 --- a/targets/minecraft/client/gui/inventory/TrapScreen.cpp +++ b/targets/minecraft/client/gui/inventory/TrapScreen.cpp @@ -4,11 +4,11 @@ #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/inventory/AbstractContainerScreen.h" +#include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/resources/ResourceLocation.h" #ifdef ENABLE_JAVA_GUIS ResourceLocation GUI_TRAP_LOCATION = ResourceLocation(TN_GUI_TRAP); diff --git a/targets/minecraft/client/gui/particle/GuiParticle.cpp b/targets/minecraft/client/gui/particle/GuiParticle.cpp index 9d46a83b7..8fed392ce 100644 --- a/targets/minecraft/client/gui/particle/GuiParticle.cpp +++ b/targets/minecraft/client/gui/particle/GuiParticle.cpp @@ -1,8 +1,8 @@ #include "GuiParticle.h" -#include "platform/stubs.h" -#include "java/Random.h" #include "java/Color.h" +#include "java/Random.h" +#include "platform/stubs.h" Random* GuiParticle::random = new Random(); diff --git a/targets/minecraft/client/level/DemoLevel.h b/targets/minecraft/client/level/DemoLevel.h index b9ab5932d..7f161c714 100644 --- a/targets/minecraft/client/level/DemoLevel.h +++ b/targets/minecraft/client/level/DemoLevel.h @@ -6,7 +6,6 @@ #include "minecraft/world/level/Level.h" - class Dimension; class LevelSettings; class LevelStorage; diff --git a/targets/minecraft/client/model/BookModel.h b/targets/minecraft/client/model/BookModel.h index 4efb7d06e..940ba85b1 100644 --- a/targets/minecraft/client/model/BookModel.h +++ b/targets/minecraft/client/model/BookModel.h @@ -9,7 +9,7 @@ public: ModelPart *leftLid, *rightLid; ModelPart *leftPages, *rightPages; ModelPart *flipPage1, *flipPage2; - ModelPart* seam; + ModelPart *seam; BookModel(); virtual void render(std::shared_ptr entity, float time, float r, diff --git a/targets/minecraft/client/model/ChestModel.cpp b/targets/minecraft/client/model/ChestModel.cpp index baf79cd93..830f20cdd 100644 --- a/targets/minecraft/client/model/ChestModel.cpp +++ b/targets/minecraft/client/model/ChestModel.cpp @@ -1,8 +1,8 @@ #include "ChestModel.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChestModel::ChestModel() { lid = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64); diff --git a/targets/minecraft/client/model/ChickenModel.cpp b/targets/minecraft/client/model/ChickenModel.cpp index 9f55a298c..509b05feb 100644 --- a/targets/minecraft/client/model/ChickenModel.cpp +++ b/targets/minecraft/client/model/ChickenModel.cpp @@ -1,14 +1,14 @@ #include "ChickenModel.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ChickenModel::ChickenModel() : Model() { int yo = 16; diff --git a/targets/minecraft/client/model/GhastModel.cpp b/targets/minecraft/client/model/GhastModel.cpp index 49c79f342..269345fdb 100644 --- a/targets/minecraft/client/model/GhastModel.cpp +++ b/targets/minecraft/client/model/GhastModel.cpp @@ -1,14 +1,14 @@ #include "GhastModel.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "java/Random.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" GhastModel::GhastModel() : Model() { int yoffs = -16; diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index aa232c760..355e0a9b0 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -1,15 +1,15 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "HumanoidModel.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added diff --git a/targets/minecraft/client/model/ModelHorse.cpp b/targets/minecraft/client/model/ModelHorse.cpp index 0f1ade837..8404face9 100644 --- a/targets/minecraft/client/model/ModelHorse.cpp +++ b/targets/minecraft/client/model/ModelHorse.cpp @@ -1,18 +1,18 @@ #include "ModelHorse.h" -#include "platform/stubs.h" #include #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ModelHorse::ModelHorse() { texWidth = 128; diff --git a/targets/minecraft/client/model/OcelotModel.cpp b/targets/minecraft/client/model/OcelotModel.cpp index 1b0d29a06..b92b62dc4 100644 --- a/targets/minecraft/client/model/OcelotModel.cpp +++ b/targets/minecraft/client/model/OcelotModel.cpp @@ -1,5 +1,4 @@ #include "OcelotModel.h" -#include "platform/stubs.h" #include @@ -7,10 +6,11 @@ #include #include -#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" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float OcelotModel::xo = 0; const float OcelotModel::yo = 16; diff --git a/targets/minecraft/client/model/OcelotModel.h b/targets/minecraft/client/model/OcelotModel.h index ee5a4d96e..c54154d3e 100644 --- a/targets/minecraft/client/model/OcelotModel.h +++ b/targets/minecraft/client/model/OcelotModel.h @@ -39,7 +39,7 @@ public: void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); - void render(OcelotModel* model, float scale, bool usecompiled); + void render(OcelotModel *model, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, std::shared_ptr entity, unsigned int uiBitmaskOverrideAnim = 0); diff --git a/targets/minecraft/client/model/QuadrupedModel.cpp b/targets/minecraft/client/model/QuadrupedModel.cpp index 1c98b7f2e..e85d7cd47 100644 --- a/targets/minecraft/client/model/QuadrupedModel.cpp +++ b/targets/minecraft/client/model/QuadrupedModel.cpp @@ -1,15 +1,14 @@ #include "QuadrupedModel.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/model/geom/ModelPart.h" - +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" 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 b1f345c0b..4847bc56e 100644 --- a/targets/minecraft/client/model/WolfModel.cpp +++ b/targets/minecraft/client/model/WolfModel.cpp @@ -1,16 +1,16 @@ #include "WolfModel.h" -#include "platform/stubs.h" #include #include #include -#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" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" WolfModel::WolfModel() { float g = 0; diff --git a/targets/minecraft/client/model/dragon/DragonModel.cpp b/targets/minecraft/client/model/dragon/DragonModel.cpp index 9f64413fd..1c2919e77 100644 --- a/targets/minecraft/client/model/dragon/DragonModel.cpp +++ b/targets/minecraft/client/model/dragon/DragonModel.cpp @@ -1,5 +1,4 @@ #include "DragonModel.h" -#include "platform/stubs.h" #include @@ -8,12 +7,12 @@ #include #include - -#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" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" DragonModel::DragonModel(float g) : Model() { // 4J-PB diff --git a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp index 590cd0f8a..c92b278bd 100644 --- a/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp +++ b/targets/minecraft/client/model/dragon/EnderCrystalModel.cpp @@ -1,12 +1,11 @@ #include "EnderCrystalModel.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/geom/ModelPart.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" EnderCrystalModel::EnderCrystalModel(float g) { glass = new ModelPart(this, "glass"); diff --git a/targets/minecraft/client/model/geom/Model.h b/targets/minecraft/client/model/geom/Model.h index 3951fd120..7becdc889 100644 --- a/targets/minecraft/client/model/geom/Model.h +++ b/targets/minecraft/client/model/geom/Model.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "java/Random.h" +#include "minecraft/client/model/SkinBox.h" class Mob; class ModelPart; diff --git a/targets/minecraft/client/model/geom/ModelPart.cpp b/targets/minecraft/client/model/geom/ModelPart.cpp index f49fa93cc..e9766fa44 100644 --- a/targets/minecraft/client/model/geom/ModelPart.cpp +++ b/targets/minecraft/client/model/geom/ModelPart.cpp @@ -1,16 +1,14 @@ #include "ModelPart.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "Cube.h" #include "TexOffs.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Tesselator.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const float ModelPart::RAD = (180.0f / std::numbers::pi); diff --git a/targets/minecraft/client/model/geom/ModelPart.h b/targets/minecraft/client/model/geom/ModelPart.h index fb1eace16..0dbba593a 100644 --- a/targets/minecraft/client/model/geom/ModelPart.h +++ b/targets/minecraft/client/model/geom/ModelPart.h @@ -2,9 +2,9 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Model.h" #include "minecraft/client/model/Polygon.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/Vertex.h" class Cube; diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index b98a62d4a..7b47701f3 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ClientConnection.h" #include @@ -12,18 +10,13 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" +#include "MultiPlayerLevel.h" +#include "ReceivingLevelScreen.h" #include "app/common/App_structs.h" #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/Tutorial/Tutorial.h" @@ -33,20 +26,19 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/Linux_UIController.h" -#include "MultiPlayerLevel.h" -#include "ReceivingLevelScreen.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" +#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/particle/CritParticle.h" @@ -57,8 +49,8 @@ #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/client/gui/inventory/MerchantScreen.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AddEntityPacket.h" #include "minecraft/network/packet/AddExperienceOrbPacket.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" @@ -126,9 +118,11 @@ #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/EntityIO.h" @@ -180,6 +174,7 @@ #include "minecraft/world/item/trading/Merchant.h" #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/Explosion.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" @@ -201,7 +196,12 @@ #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" #include "strings.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class Packet; class TexturePack; @@ -375,15 +375,17 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { } Log::info("ClientConnection - DIFFICULTY --- %d\n", - packet->difficulty); + packet->difficulty); level->difficulty = packet->difficulty; // 4J Added level->isClientSide = true; minecraft->setLevel(level); } minecraft->player->setPlayerIndex(packet->m_playerIndex); - minecraft->player->setCustomSkin(gameServices().getPlayerSkinId(m_userIndex)); - minecraft->player->setCustomCape(gameServices().getPlayerCapeId(m_userIndex)); + minecraft->player->setCustomSkin( + gameServices().getPlayerSkinId(m_userIndex)); + minecraft->player->setCustomCape( + gameServices().getPlayerCapeId(m_userIndex)); minecraft->createPrimaryLocalPlayer(PlatformInput.GetPrimaryPad()); @@ -393,7 +395,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); minecraft->player->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -410,8 +412,9 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { displayPrivilegeChanges(minecraft->player, startingPrivileges); // update the debugoptions - gameServices().setGameSettingsDebugMask(PlatformInput.GetPrimaryPad(), - gameServices().debugGetMask(-1, true)); + gameServices().setGameSettingsDebugMask( + PlatformInput.GetPrimaryPad(), + gameServices().debugGetMask(-1, true)); } else { // 4J-PB - this isn't the level we want // level = (MultiPlayerLevel *)minecraft->level; @@ -443,10 +446,10 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added dimensionLevel->isClientSide = true; level = dimensionLevel; - // 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 + // 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 MultiPlayerLevel* levelpassedin = (MultiPlayerLevel*)level; player = minecraft->createExtraLocalPlayer( m_userIndex, networkPlayer->GetOnlineName(), m_userIndex, @@ -474,7 +477,7 @@ void ClientConnection::handleLogin(std::shared_ptr packet) { std::uint8_t networkSmallId = getSocket()->getSmallId(); gameServices().updatePlayerInfo(networkSmallId, packet->m_playerIndex, - packet->m_uiGamePrivileges); + packet->m_uiGamePrivileges); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_uiGamePrivileges); @@ -533,7 +536,7 @@ void ClientConnection::handleAddEntity( } } - if (owner->instanceof(eTYPE_PLAYER)) { + if (owner->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); std::shared_ptr hook = @@ -556,8 +559,7 @@ void ClientConnection::handleAddEntity( int ix = (int)x; int iy = (int)y; int iz = (int)z; - Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, - iy, iz); + Log::info("ClientConnection ITEM_FRAME xyz %d,%d,%d\n", ix, iy, iz); } e = std::shared_ptr( new ItemFrame(level, (int)x, (int)y, (int)z, packet->data)); @@ -788,7 +790,8 @@ void ClientConnection::handleAddEntity( } } - if (owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY)) { + if (owner != nullptr && owner->instanceof + (eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(e)->owner = std::dynamic_pointer_cast(owner); } @@ -873,8 +876,7 @@ void ClientConnection::handleAddPlayer( PlatformProfile.AreXUIDSEqual(playerXUIDOnline, packet->xuid)) || (playerXUIDOffline != INVALID_XUID && PlatformProfile.AreXUIDSEqual(playerXUIDOffline, packet->xuid))) { - Log::info( - "AddPlayerPacket received with XUID of local player\n"); + Log::info("AddPlayerPacket received with XUID of local player\n"); return; } } @@ -931,13 +933,15 @@ void ClientConnection::handleAddPlayer( 0))); } } else if (!player->customTextureUrl.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, + 0); } Log::info("Custom skin for player %s is %s\n", player->name.c_str(), - player->customTextureUrl.c_str()); + player->customTextureUrl.c_str()); if (!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0, 3).compare("def") != 0 && @@ -952,13 +956,15 @@ void ClientConnection::handleAddPlayer( new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl2)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, + 0); } Log::info("Custom cape for player %s is %s\n", player->name.c_str(), - player->customTextureUrl2.c_str()); + player->customTextureUrl2.c_str()); level->putEntity(packet->id, player); @@ -1369,7 +1375,8 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, &ClientConnection::HostDisconnectReturned, nullptr); } else { - gameServices().setAction(m_userIndex, eAppAction_ExitWorld, (void*)true); + gameServices().setAction(m_userIndex, eAppAction_ExitWorld, + (void*)true); } // minecraft->setLevel(nullptr); @@ -1761,7 +1768,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = gameServices().getString(IDS_MAX_VILLAGERS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED); break; case ChatPacket::e_ChatPlayerMaxChickens: message = gameServices().getString(IDS_MAX_CHICKENS_SPAWNED); @@ -1781,7 +1789,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { // Breeding case ChatPacket::e_ChatPlayerMaxBredPigsSheepCows: - message = gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); + message = + gameServices().getString(IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED); break; case ChatPacket::e_ChatPlayerMaxBredChickens: message = gameServices().getString(IDS_MAX_CHICKENS_BRED); @@ -1820,9 +1829,9 @@ void ClientConnection::handleChat(std::shared_ptr packet) { message = replaceAll(message, "{*DESTINATION*}", sourceDisplayName); } else { - message = replaceAll( - message, "{*DESTINATION*}", - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0])); + message = replaceAll(message, "{*DESTINATION*}", + gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0])); } break; case ChatPacket::e_ChatCommandTeleportMe: @@ -1854,8 +1863,8 @@ void ClientConnection::handleChat(std::shared_ptr packet) { !packet->m_stringArgs[1].empty()) { entityName = packet->m_stringArgs[1]; } else { - entityName = - gameServices().getEntityName((EntityTypeId)packet->m_intArgs[0]); + entityName = gameServices().getEntityName( + (EntityTypeId)packet->m_intArgs[0]); } message = replaceAll(message, "{*SOURCE*}", entityName); @@ -1879,12 +1888,12 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); if (e == nullptr) return; if (packet->action == AnimatePacket::SWING) { - if (e->instanceof(eTYPE_LIVINGENTITY)) + if (e->instanceof (eTYPE_LIVINGENTITY)) std::dynamic_pointer_cast(e)->swing(); } else if (packet->action == AnimatePacket::HURT) { e->animateHurt(); } else if (packet->action == AnimatePacket::WAKE_UP) { - if (e->instanceof(eTYPE_PLAYER)) + if (e->instanceof (eTYPE_PLAYER)) std::dynamic_pointer_cast(e)->stopSleepInBed(false, false, false); } else if (packet->action == AnimatePacket::RESPAWN) { @@ -1900,8 +1909,8 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { new CritParticle(minecraft->level, e, eParticleType_magicCrit)); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); - } else if ((packet->action == AnimatePacket::EAT) && - e->instanceof(eTYPE_REMOTEPLAYER)) { + } else if ((packet->action == AnimatePacket::EAT) && e->instanceof + (eTYPE_REMOTEPLAYER)) { } } @@ -1929,13 +1938,15 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { if (!NetworkService.IsHost()) { // set the game host settings - gameServices().setGameHostOption(eGameHostOption_All, packet->m_serverSettings); + gameServices().setGameHostOption(eGameHostOption_All, + packet->m_serverSettings); // 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(PlatformInput.GetPrimaryPad(), - eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); + gameServices().setTMSAction( + PlatformInput.GetPrimaryPad(), + eTMSAction_TMSPP_RetrieveFiles_RunPlayGame); } } @@ -1965,8 +1976,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { "privileges: %d\n", reason); gameServices().setDisconnectReason(reason); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ExitWorld, - (void*)true); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ExitWorld, (void*)true); } else { if (!isFriendsWithHost) reason = DisconnectPacket::eDisconnect_NotFriendsWithHost; @@ -2003,7 +2014,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // gameServices().setAction(m_userIndex,eAppAction_ExitPlayer); // 4J-PB - doing this instead - gameServices().setAction(m_userIndex, eAppAction_ExitPlayerPreLogin); + gameServices().setAction(m_userIndex, + eAppAction_ExitPlayerPreLogin); } } else { // Texture pack handling @@ -2016,9 +2028,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->skins->selectTexturePackById( packet->m_texturePackId)) { - Log::info( - "Selected texture pack %d from Pre-Login packet\n", - packet->m_texturePackId); + Log::info("Selected texture pack %d from Pre-Login packet\n", + packet->m_texturePackId); } else { Log::info( "Could not select texture pack %d from Pre-Login packet, " @@ -2064,7 +2075,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { send(std::make_shared( minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (!allAllowed && friendsAllowed), - packet->m_ugcPlayersVersion, gameServices().getPlayerSkinId(m_userIndex), + packet->m_ugcPlayersVersion, + gameServices().getPlayerSkinId(m_userIndex), gameServices().getPlayerCapeId(m_userIndex), PlatformProfile.IsGuest(m_userIndex))); fprintf(stderr, "[LOGIN] LoginPacket sent successfully\n"); @@ -2174,13 +2186,13 @@ void ClientConnection::handleEntityLinkPacket( ->entityId) { sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; - if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) + if (destEntity != nullptr && destEntity->instanceof (eTYPE_BOAT)) (std::dynamic_pointer_cast(destEntity))->setDoLerp(false); displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr); - } else if (destEntity != nullptr && - destEntity->instanceof(eTYPE_BOAT)) { + } else if (destEntity != nullptr && destEntity->instanceof + (eTYPE_BOAT)) { (std::dynamic_pointer_cast(destEntity))->setDoLerp(true); } @@ -2197,7 +2209,7 @@ void ClientConnection::handleEntityLinkPacket( } */ } else if (packet->type == SetEntityLinkPacket::LEASH) { - if ((sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB)) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof (eTYPE_MOB)) { if (destEntity != nullptr) { (std::dynamic_pointer_cast(sourceEntity)) ->setLeashedTo(destEntity, false); @@ -2262,11 +2274,12 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Client received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -2276,10 +2289,10 @@ void ClientConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); Minecraft::GetInstance()->handleClientTextureReceived( packet->textureName); } @@ -2295,13 +2308,13 @@ void ClientConnection::handleTextureAndGeometry( if (packet->dwTextureBytes == 0) { // Request for texture #if !defined(_CONTENT_PACKAGE) - printf( - "Client received request for custom texture and geometry %s\n", - packet->textureName.c_str()); + printf("Client received request for custom texture and geometry %s\n", + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(packet->textureName); @@ -2332,19 +2345,19 @@ void ClientConnection::handleTextureAndGeometry( // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Client received custom TextureAndGeometry %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif // Add the texture data gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // Add the geometry data if (packet->dwBoxC != 0) { - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); // clear out the pending texture request Minecraft::GetInstance()->handleClientTextureReceived( @@ -2355,7 +2368,7 @@ void ClientConnection::handleTextureAndGeometry( void ClientConnection::handleTextureChange( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); - if ((e == nullptr) || !e->instanceof(eTYPE_PLAYER)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_PLAYER)) return; std::shared_ptr player = std::dynamic_pointer_cast(e); bool isLocalPlayer = false; @@ -2371,11 +2384,12 @@ void ClientConnection::handleTextureChange( switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); + player->setCustomSkin( + gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -2383,7 +2397,7 @@ void ClientConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for remote player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -2430,8 +2444,8 @@ void ClientConnection::handleTextureAndGeometryChange( #if !defined(_CONTENT_PACKAGE) printf("Skin for remote player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif if (!packet->path.empty() && @@ -2490,7 +2504,7 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { dimensionLevel->difficulty = packet->difficulty; // 4J Added Log::info("dimensionLevel->difficulty - Difficulty = %d\n", - packet->difficulty); + packet->difficulty); dimensionLevel->isClientSide = true; } else { @@ -2549,7 +2563,8 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { ui.NavigateToScene(m_userIndex, eUIScene_ConnectingProgress, param); } - gameServices().setAction(m_userIndex, eAppAction_WaitForDimensionChangeComplete); + gameServices().setAction(m_userIndex, + eAppAction_WaitForDimensionChangeComplete); } // minecraft->respawnPlayer(minecraft->player->GetXboxPad(),true, @@ -2888,8 +2903,8 @@ void ClientConnection::handleSignUpdate( ste->SetMessage(i, packet->lines[i]); } - Log::info("verified = %d\tCensored = %d\n", - packet->m_bVerified, packet->m_bCensored); + Log::info("verified = %d\tCensored = %d\n", packet->m_bVerified, + packet->m_bCensored); ste->SetVerified(packet->m_bVerified); ste->SetCensored(packet->m_bCensored); @@ -3004,8 +3019,7 @@ void ClientConnection::handleGameEvent( } else if (event == GameEventPacket::WIN_GAME) { ui.SetWinUserIndex(static_cast(gameEventPacket->param)); - Log::info("handleGameEvent packet for WIN_GAME - %d\n", - m_userIndex); + Log::info("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown if (minecraft->localgameModes[PlatformInput.GetPrimaryPad()] != nullptr) minecraft->localgameModes[PlatformInput.GetPrimaryPad()] @@ -3020,7 +3034,7 @@ void ClientConnection::handleGameEvent( // loading screen gameServices().setGameStarted(false); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_RemoteServerSave); + eAppAction_RemoteServerSave); } } else if (event == GameEventPacket::STOP_SAVING) { if (!NetworkService.IsHost()) gameServices().setGameStarted(true); @@ -3080,7 +3094,7 @@ void ClientConnection::handleAwardStat( void ClientConnection::handleUpdateMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; //( std::dynamic_pointer_cast(e) )->addEffect(new // MobEffectInstance(packet->effectId, packet->effectDurationTicks, @@ -3095,7 +3109,7 @@ void ClientConnection::handleUpdateMobEffect( void ClientConnection::handleRemoveMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; (std::dynamic_pointer_cast(e)) ->removeEffectNoUpdate(packet->effectId); @@ -3119,11 +3133,12 @@ void ClientConnection::handlePlayerInfo( } // 4J Stu - Repurposed this packet for player info that we want - gameServices().updatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, - packet->m_playerPrivileges); + gameServices().updatePlayerInfo(packet->m_networkSmallId, + packet->m_playerColourIndex, + packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, @@ -3161,27 +3176,32 @@ void ClientConnection::displayPrivilegeChanges( Player::getPlayerGamePrivilege(oldPrivileges, priv)) { privOn = Player::getPlayerGamePrivilege(newPrivileges, priv); std::string message = ""; - if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) == 0) { switch (priv) { case Player::ePlayerGamePrivilege_CannotMine: if (privOn) - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MINE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MINE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotBuild: if (privOn) - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_BUILD_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_BUILD_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches: if (privOn) - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_USE_DOORS_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_USE_DOORS_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanUseContainers: if (privOn) @@ -3193,24 +3213,24 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CannotAttackAnimals: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackMobs: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_ATTACK_MOB_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CannotAttackPlayers: if (privOn) - message = - gameServices().getString(IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF); @@ -3222,59 +3242,65 @@ void ClientConnection::displayPrivilegeChanges( switch (priv) { case Player::ePlayerGamePrivilege_Op: if (privOn) - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_MODERATOR_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_MODERATOR_TOGGLE_OFF); break; default: break; }; - if (gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0) { + if (gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0) { switch (priv) { case Player::ePlayerGamePrivilege_CanFly: if (privOn) - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_ON); else - message = gameServices().getString(IDS_PRIV_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_ClassicHunger: if (privOn) - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_EXHAUSTION_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_EXHAUSTION_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVISIBLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_Invulnerable: if (privOn) - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_INVULNERABLE_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_INVULNERABLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleInvisible: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON); else message = gameServices().getString( IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleFly: if (privOn) - message = gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_FLY_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_FLY_TOGGLE_OFF); break; case Player::ePlayerGamePrivilege_CanToggleClassicHunger: if (privOn) @@ -3286,11 +3312,11 @@ void ClientConnection::displayPrivilegeChanges( break; case Player::ePlayerGamePrivilege_CanTeleport: if (privOn) - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_ON); else - message = - gameServices().getString(IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); + message = gameServices().getString( + IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF); break; default: break; @@ -3379,7 +3405,8 @@ void ClientConnection::handleServerSettingsChanged( } else { // options // minecraft->options->SetGamertagSetting((packet->data==0)?false:true); - gameServices().setGameHostOption(eGameHostOption_Gamertags, packet->data); + gameServices().setGameHostOption(eGameHostOption_Gamertags, + packet->data); } } @@ -3418,7 +3445,7 @@ void ClientConnection::handleUpdateGameRuleProgressPacket( "handleUpdateGameRuleProgressPacket: Data tag is in range, so " "updating profile data\n"); gameServices().setSpecialTutorialCompletionFlag(m_userIndex, - packet->m_dataTag - 1); + packet->m_dataTag - 1); } } @@ -3525,7 +3552,7 @@ void ClientConnection::handleUpdateAttributes( std::shared_ptr entity = getEntity(packet->getEntityId()); if (entity == nullptr) return; - if (!entity->instanceof(eTYPE_LIVINGENTITY)) { + if (!entity->instanceof (eTYPE_LIVINGENTITY)) { // Entity is not a living entity! assert(0); } @@ -3576,7 +3603,9 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) { // Only consider recently deferred packets auto tickInterval = - std::chrono::duration_cast(time_util::clock::now() - deferred->m_recievedTick).count(); + std::chrono::duration_cast( + time_util::clock::now() - deferred->m_recievedTick) + .count(); if (tickInterval < MAX_ENTITY_LINK_DEFERRAL_INTERVAL) { // Note: we assume it's the destination entity if (deferred->m_packet->destId == newEntityId) { diff --git a/targets/minecraft/client/multiplayer/ClientConnection.h b/targets/minecraft/client/multiplayer/ClientConnection.h index 5764e310f..1c08a7d75 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.h +++ b/targets/minecraft/client/multiplayer/ClientConnection.h @@ -5,13 +5,12 @@ #include #include -#include "util/Timer.h" -#include "platform/storage/storage.h" #include "minecraft/network/Connection.h" - #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/world/entity/Entity.h" +#include "platform/storage/storage.h" +#include "util/Timer.h" class Minecraft; class MultiPlayerLevel; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 1d6baff82..7fa6694c6 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -1,11 +1,11 @@ #include "MultiPlayerChunkCache.h" -#include #include #include +#include + #include "minecraft/network/INetworkService.h" -#include "util/StringHelpers.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" @@ -19,6 +19,7 @@ #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" MultiPlayerChunkCache::MultiPlayerChunkCache(Level* level) { XZSIZE = level->dimension->getXZSize(); // 4J Added @@ -175,8 +176,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { if (MinecraftServer::getInstance()->serverHalted()) return nullptr; - // If we're the host, then don't create the chunk, share data - // from the server's copy + // If we're the host, then don't create the chunk, share + // data from the server's copy #ifdef _LARGE_WORLDS LevelChunk* serverChunk = MinecraftServer::getInstance() diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h index 82a068da7..dad40c3b1 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.h @@ -5,10 +5,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" - #include "minecraft/world/level/levelgen/RandomLevelSource.h" - class ServerChunkCache; class Level; class LevelChunk; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 274eed236..054300597 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerGameMode.h" #include #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" #include "MultiPlayerLevel.h" +#include "app/common/Audio/SoundEngine.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ContainerButtonClickPacket.h" @@ -513,7 +513,8 @@ bool MultiPlayerGameMode::hasFarPickRange() { // only happens when the player is riding a horse. bool MultiPlayerGameMode::isServerControlledInventory() { return minecraft->player->isRiding() && - minecraft->player->riding->instanceof(eTYPE_HORSE); + minecraft->player->riding->instanceof + (eTYPE_HORSE); } bool MultiPlayerGameMode::handleCraftItem(int recipe, diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 09b208298..b5c9c5e38 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "MultiPlayerLevel.h" #include @@ -10,21 +9,20 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" #include "ClientConnection.h" -#include "app/common/Audio/SoundEngine.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/network/INetworkService.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" +#include "app/common/Audio/SoundEngine.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/FireworksParticles.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" @@ -38,6 +36,8 @@ #include "minecraft/world/level/storage/SavedDataStorage.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" class LevelSettings; class Scoreboard; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h index c0773c45e..dee97d45d 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.h @@ -9,10 +9,8 @@ #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" - #include "minecraft/world/level/Level.h" - class ClientConnection; class MultiPlayerChunkCache; class LevelSettings; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index d1efdaf5b..81a8256e3 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MultiPlayerLocalPlayer.h" #include @@ -10,6 +8,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" @@ -26,6 +25,7 @@ #include "minecraft/network/packet/TextureAndGeometryChangePacket.h" #include "minecraft/network/packet/TextureChangePacket.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Abilities.h" @@ -73,13 +73,14 @@ void MultiplayerLocalPlayer::tick() { // bool bIsisPrimaryHost=NetworkService.IsHost() && // (PlatformInput.GetPrimaryPad()==m_iPad); - /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) != - m_bShownOnMaps) + /*if((gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0) + != m_bShownOnMaps) { m_bShownOnMaps = - (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); if - (m_bShownOnMaps) connection->send( std::shared_ptr( new - PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::SHOW_ON_MAPS) ) + (gameServices().getGameSettings(m_iPad,eGameSetting_PlayerVisibleInMap)!=0); + if (m_bShownOnMaps) connection->send( std::shared_ptr( + new PlayerCommandPacket(shared_from_this(), + PlayerCommandPacket::SHOW_ON_MAPS) ) ); else connection->send( std::shared_ptr( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::HIDE_ON_MAPS) ) ); @@ -372,14 +373,14 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomSkin(std::uint32_t skinId) { std::uint32_t oldSkinIndex = getCustomSkin(); LocalPlayer::setCustomSkin(skinId); #if !defined(_CONTENT_PACKAGE) - printf("Skin for local player %s has changed to %s (%d)\n", - name.c_str(), customTextureUrl.c_str(), - static_cast(getPlayerDefaultSkin())); + printf("Skin for local player %s has changed to %s (%d)\n", name.c_str(), + customTextureUrl.c_str(), static_cast(getPlayerDefaultSkin())); #endif if (getCustomSkin() != oldSkinIndex) connection->send(std::shared_ptr( new TextureAndGeometryChangePacket( - shared_from_this(), gameServices().getPlayerSkinName(GetXboxPad())))); + shared_from_this(), + gameServices().getPlayerSkinName(GetXboxPad())))); } void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { @@ -387,7 +388,7 @@ void MultiplayerLocalPlayer::setAndBroadcastCustomCape(std::uint32_t capeId) { LocalPlayer::setCustomCape(capeId); #if !defined(_CONTENT_PACKAGE) printf("Cape for local player %s has changed to %s\n", name.c_str(), - customTextureUrl2.c_str()); + customTextureUrl2.c_str()); #endif if (getCustomCape() != oldCapeIndex) connection->send(std::make_shared( diff --git a/targets/minecraft/client/particle/DragonBreathParticle.cpp b/targets/minecraft/client/particle/DragonBreathParticle.cpp index 9c8b011cd..2712591fa 100644 --- a/targets/minecraft/client/particle/DragonBreathParticle.cpp +++ b/targets/minecraft/client/particle/DragonBreathParticle.cpp @@ -1,11 +1,11 @@ #include "DragonBreathParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/DripParticle.cpp b/targets/minecraft/client/particle/DripParticle.cpp index c95ff1979..9cf893b7a 100644 --- a/targets/minecraft/client/particle/DripParticle.cpp +++ b/targets/minecraft/client/particle/DripParticle.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp index 6b3de3eeb..ef5d8ec21 100644 --- a/targets/minecraft/client/particle/EnchantmentTableParticle.cpp +++ b/targets/minecraft/client/particle/EnchantmentTableParticle.cpp @@ -1,11 +1,11 @@ #include "EnchantmentTableParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" EchantmentTableParticle::EchantmentTableParticle(Level* level, double x, double y, double z, double xd, diff --git a/targets/minecraft/client/particle/EnderParticle.cpp b/targets/minecraft/client/particle/EnderParticle.cpp index b9fa842e6..c8eac5285 100644 --- a/targets/minecraft/client/particle/EnderParticle.cpp +++ b/targets/minecraft/client/particle/EnderParticle.cpp @@ -1,11 +1,11 @@ #include "EnderParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/ExplodeParticle.cpp b/targets/minecraft/client/particle/ExplodeParticle.cpp index cb2858ea5..dbfeb9c35 100644 --- a/targets/minecraft/client/particle/ExplodeParticle.cpp +++ b/targets/minecraft/client/particle/ExplodeParticle.cpp @@ -1,11 +1,11 @@ #include "ExplodeParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/FootstepParticle.cpp b/targets/minecraft/client/particle/FootstepParticle.cpp index 96dbee555..8b2070194 100644 --- a/targets/minecraft/client/particle/FootstepParticle.cpp +++ b/targets/minecraft/client/particle/FootstepParticle.cpp @@ -1,17 +1,15 @@ #include "FootstepParticle.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FootstepParticle::FOOTPRINT_LOCATION = ResourceLocation(TN_MISC_FOOTSTEP); diff --git a/targets/minecraft/client/particle/HugeExplosionParticle.cpp b/targets/minecraft/client/particle/HugeExplosionParticle.cpp index 6cf2e188f..d43cc32d6 100644 --- a/targets/minecraft/client/particle/HugeExplosionParticle.cpp +++ b/targets/minecraft/client/particle/HugeExplosionParticle.cpp @@ -1,19 +1,17 @@ #include "HugeExplosionParticle.h" -#include "platform/stubs.h" - - -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Level; diff --git a/targets/minecraft/client/particle/NetherPortalParticle.cpp b/targets/minecraft/client/particle/NetherPortalParticle.cpp index d01344b51..9cce8a408 100644 --- a/targets/minecraft/client/particle/NetherPortalParticle.cpp +++ b/targets/minecraft/client/particle/NetherPortalParticle.cpp @@ -1,11 +1,11 @@ #include "NetherPortalParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/NoteParticle.cpp b/targets/minecraft/client/particle/NoteParticle.cpp index 6e8b26354..781e17c08 100644 --- a/targets/minecraft/client/particle/NoteParticle.cpp +++ b/targets/minecraft/client/particle/NoteParticle.cpp @@ -3,9 +3,9 @@ #include #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/Particle.cpp b/targets/minecraft/client/particle/Particle.cpp index 28a23095c..e44bd6a71 100644 --- a/targets/minecraft/client/particle/Particle.cpp +++ b/targets/minecraft/client/particle/Particle.cpp @@ -211,6 +211,6 @@ bool Particle::isAttackable() { return false; } //@Override std::string Particle::toString() { return "A particle"; // getClass()->getSimpleName() + ", Pos (" + x + "," - // + y + "," + z + "), RGBA (" + rCol + "," + gCol + - // "," + bCol + "," + alpha + "), Age " + age; + // + y + "," + z + "), RGBA (" + rCol + "," + gCol + + // "," + bCol + "," + alpha + "), Age " + age; } \ No newline at end of file diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index 9e38bdf6c..f10fb25c0 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -1,16 +1,12 @@ #include "ParticleEngine.h" -#include "platform/stubs.h" - #include #include #include -#include "platform/renderer/renderer.h" #include "Particle.h" #include "TerrainParticle.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -23,6 +19,9 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTICLES); @@ -30,9 +29,7 @@ ResourceLocation ParticleEngine::PARTICLES_LOCATION = ParticleEngine::ParticleEngine(Level* level, Textures* textures) { // if (level != nullptr) // 4J - removed - we want level to be // initialised to *something* - { - this->level = level; - } + { this->level = level; } this->textures = textures; this->random = new Random(); diff --git a/targets/minecraft/client/particle/SmokeParticle.cpp b/targets/minecraft/client/particle/SmokeParticle.cpp index b91241b83..e80824432 100644 --- a/targets/minecraft/client/particle/SmokeParticle.cpp +++ b/targets/minecraft/client/particle/SmokeParticle.cpp @@ -1,10 +1,10 @@ #include "SmokeParticle.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; diff --git a/targets/minecraft/client/particle/SuspendedParticle.cpp b/targets/minecraft/client/particle/SuspendedParticle.cpp index 7b86453be..a23a9bee8 100644 --- a/targets/minecraft/client/particle/SuspendedParticle.cpp +++ b/targets/minecraft/client/particle/SuspendedParticle.cpp @@ -2,12 +2,12 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/client/particle/TakeAnimationParticle.cpp b/targets/minecraft/client/particle/TakeAnimationParticle.cpp index 5994d3da7..8f9265dd0 100644 --- a/targets/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/targets/minecraft/client/particle/TakeAnimationParticle.cpp @@ -1,17 +1,15 @@ #include "TakeAnimationParticle.h" -#include "platform/stubs.h" - - #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TakeAnimationParticle::TakeAnimationParticle(Level* level, std::shared_ptr item, diff --git a/targets/minecraft/client/player/Input.cpp b/targets/minecraft/client/player/Input.cpp index ef03d38ed..00ad1e807 100644 --- a/targets/minecraft/client/player/Input.cpp +++ b/targets/minecraft/client/player/Input.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "Input.h" #include -#include "platform/input/input.h" #include "LocalPlayer.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/entity/player/Abilities.h" +#include "platform/input/input.h" Input::Input() { xa = 0; @@ -86,16 +86,18 @@ void Input::tick(LocalPlayer* player) { pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_RIGHT)) tx = PlatformInput.GetJoypadStick_RX(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look if (pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_UP) || pMinecraft->localgameModes[iPad]->isInputAllowed( MINECRAFT_ACTION_LOOK_DOWN)) ty = PlatformInput.GetJoypadStick_RY(iPad) * - (((float)gameServices().getGameSettings(iPad, - eGameSetting_Sensitivity_InGame)) / + (((float)gameServices().getGameSettings( + iPad, + eGameSetting_Sensitivity_InGame)) / 100.0f); // apply sensitivity to look #ifndef _CONTENT_PACKAGE diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index bbb55f5ee..cd27e3bf6 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -1,6 +1,3 @@ -#include "minecraft/client/IMenuService.h" -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LocalPlayer.h" #include @@ -12,6 +9,8 @@ #include "Input.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/IMenuService.h" #include "minecraft/client/Options.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -21,6 +20,7 @@ #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/client/renderer/ItemInHandRenderer.h" #include "minecraft/stats/StatsCounter.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/entity/TileEntity.h" @@ -28,18 +28,14 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" +#include "PlatformTypes.h" +#include "Pos.h" #include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/network/INetworkService.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Linux_UIController.h" -#include "PlatformTypes.h" -#include "Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" @@ -59,6 +55,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/CommonStats.h" @@ -80,11 +77,14 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/entity/CommandBlockEntity.h" -#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, int dimension) @@ -115,7 +115,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, this->name = user->name; // printf("Created LocalPlayer with name %s\n", name.c_str() ); // check to see if this player's xuid is in the list of special players - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { customTextureUrl = pMojangData->wchSkin; } @@ -123,7 +124,8 @@ LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, User* user, input = nullptr; m_iPad = -1; m_iScreenSection = - IPlatformRenderer::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; @@ -485,7 +487,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) { PlatformProfile.SetCurrentGameActivity(m_iPad, CONTEXT_PRESENCE_IDLE, - false); + false); m_bIsIdle = true; } else if (m_bIsIdle && PlatformInput.GetIdleSeconds(m_iPad) < PLAYER_IDLE_TIME) { @@ -608,7 +610,8 @@ bool LocalPlayer::openContainer(std::shared_ptr container) { minecraft->setScreen(new ContainerScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openContainer(GetXboxPad(), inventory, + container); if (success) ui.PlayUISFX(eSFX_Press); #endif // minecraft->setScreen(new ContainerScreen(inventory, container)); @@ -620,7 +623,8 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openHopper(GetXboxPad(), inventory, container); + bool success = + gameServices().menus().openHopper(GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -631,7 +635,8 @@ bool LocalPlayer::openHopper(std::shared_ptr container) { minecraft->setScreen(new HopperScreen(inventory, container)); bool success = true; #else - bool success = gameServices().menus().openHopperMinecart(GetXboxPad(), inventory, container); + bool success = gameServices().menus().openHopperMinecart( + GetXboxPad(), inventory, container); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -643,7 +648,8 @@ bool LocalPlayer::openHorseInventory(std::shared_ptr horse, minecraft->setScreen(new HorseInventoryScreen(inventory, container, horse)); bool success = true; #else - bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, container, horse); + bool success = gameServices().menus().openHorse(GetXboxPad(), inventory, + container, horse); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -678,8 +684,8 @@ bool LocalPlayer::startEnchanting(int x, int y, int z, minecraft->setScreen(new EnchantmentScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openEnchanting(GetXboxPad(), inventory, x, y, z, level, name); + bool success = gameServices().menus().openEnchanting( + GetXboxPad(), inventory, x, y, z, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -690,8 +696,8 @@ bool LocalPlayer::startRepairing(int x, int y, int z) { minecraft->setScreen(new RepairScreen(inventory, level, x, y, z)); bool success = true; #else - bool success = - gameServices().menus().openRepairing(GetXboxPad(), inventory, level, x, y, z); + bool success = gameServices().menus().openRepairing(GetXboxPad(), inventory, + level, x, y, z); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -702,7 +708,8 @@ bool LocalPlayer::openFurnace(std::shared_ptr furnace) { minecraft->setScreen(new FurnaceScreen(inventory, furnace)); bool success = true; #else - bool success = gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); + bool success = + gameServices().menus().openFurnace(GetXboxPad(), inventory, furnace); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -714,8 +721,8 @@ bool LocalPlayer::openBrewingStand( minecraft->setScreen(new BrewingStandScreen(inventory, brewingStand)); bool success = true; #else - bool success = - gameServices().menus().openBrewingStand(GetXboxPad(), inventory, brewingStand); + bool success = gameServices().menus().openBrewingStand( + GetXboxPad(), inventory, brewingStand); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -726,7 +733,8 @@ bool LocalPlayer::openBeacon(std::shared_ptr beacon) { minecraft->setScreen(new BeaconScreen(inventory, beacon)); bool success = true; #else - bool success = gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); + bool success = + gameServices().menus().openBeacon(GetXboxPad(), inventory, beacon); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -737,7 +745,8 @@ bool LocalPlayer::openTrap(std::shared_ptr trap) { minecraft->setScreen(new TrapScreen(inventory, trap)); bool success = true; #else - bool success = gameServices().menus().openTrap(GetXboxPad(), inventory, trap); + bool success = + gameServices().menus().openTrap(GetXboxPad(), inventory, trap); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -749,8 +758,8 @@ bool LocalPlayer::openTrading(std::shared_ptr traderTarget, minecraft->setScreen(new MerchantScreen(inventory, traderTarget, level)); bool success = true; #else - bool success = - gameServices().menus().openTrading(GetXboxPad(), inventory, traderTarget, level, name); + bool success = gameServices().menus().openTrading( + GetXboxPad(), inventory, traderTarget, level, name); if (success) ui.PlayUISFX(eSFX_Press); #endif return success; @@ -1574,23 +1583,30 @@ void LocalPlayer::updateRichPresence() { std::shared_ptr selectedItem = inventory->getSelected(); if (selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_FISHING); } else if (selectedItem != nullptr && selectedItem->id == Item::map_Id) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { gameServices().setRichPresenceContext(m_iPad, - CONTEXT_GAME_STATE_RIDING_MINECART); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); - } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); + CONTEXT_GAME_STATE_MAP); + } else if ((riding != nullptr) && riding->instanceof (eTYPE_MINECART)) { + gameServices().setRichPresenceContext( + m_iPad, CONTEXT_GAME_STATE_RIDING_MINECART); + } else if ((riding != nullptr) && riding->instanceof (eTYPE_BOAT)) { + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_BOATING); + } else if ((riding != nullptr) && riding->instanceof (eTYPE_PIG)) { + gameServices().setRichPresenceContext( + m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); } else if (this->dimension == -1) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_NETHER); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_NETHER); } else if (minecraft->soundEngine->GetIsPlayingStreamingCDMusic()) { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CD); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_CD); } else { - gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BLANK); + gameServices().setRichPresenceContext(m_iPad, + CONTEXT_GAME_STATE_BLANK); } } } diff --git a/targets/minecraft/client/player/LocalPlayer.h b/targets/minecraft/client/player/LocalPlayer.h index 5b73c8679..9b3dbf959 100644 --- a/targets/minecraft/client/player/LocalPlayer.h +++ b/targets/minecraft/client/player/LocalPlayer.h @@ -10,7 +10,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Level; class User; class CompoundTag; diff --git a/targets/minecraft/client/player/RemotePlayer.cpp b/targets/minecraft/client/player/RemotePlayer.cpp index 4d5a51c5f..1370532e5 100644 --- a/targets/minecraft/client/player/RemotePlayer.cpp +++ b/targets/minecraft/client/player/RemotePlayer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RemotePlayer.h" #include @@ -6,6 +5,7 @@ #include #include "Pos.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/client/player/RemotePlayer.h b/targets/minecraft/client/player/RemotePlayer.h index 1492e4653..64ad6a08e 100644 --- a/targets/minecraft/client/player/RemotePlayer.h +++ b/targets/minecraft/client/player/RemotePlayer.h @@ -7,7 +7,6 @@ #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/entity/player/Player.h" - class Input; class Level; diff --git a/targets/minecraft/client/renderer/Chunk.cpp b/targets/minecraft/client/renderer/Chunk.cpp index 0c42015ce..ec1716642 100644 --- a/targets/minecraft/client/renderer/Chunk.cpp +++ b/targets/minecraft/client/renderer/Chunk.cpp @@ -1,6 +1,4 @@ #include "Chunk.h" -#include "platform/stubs.h" - #include @@ -10,9 +8,7 @@ #include #include -#include "platform/renderer/renderer.h" #include "LevelRenderer.h" -#include "util/FrameProfiler.h" #include "TileRenderer.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/culling/Culler.h" @@ -25,6 +21,9 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" int Chunk::updates = 0; diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index d96ca4295..a8d97bc13 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "GameRenderer.h" #include @@ -8,29 +6,21 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "BossMobGuiInfo.h" #include "Chunk.h" #include "ItemInHandRenderer.h" #include "LevelRenderer.h" -#include "minecraft/GameEnums.h" -#include "platform/ShutdownManager.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/client/BufferedImage.h" -#include "util/FrameProfiler.h" -#include "platform/stubs.h" #include "Tesselator.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" - #include "java/Class.h" #include "java/FloatBuffer.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Camera.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -53,10 +43,12 @@ #include "minecraft/client/renderer/culling/Frustum.h" #include "minecraft/client/renderer/culling/FrustumCuller.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -78,10 +70,17 @@ #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" bool GameRenderer::anaglyph3d = false; int GameRenderer::anaglyphPass = 0; @@ -376,7 +375,7 @@ void GameRenderer::pick(float a) { if (nearest < dist || (mc->hitResult == nullptr)) { if (mc->hitResult != nullptr) delete mc->hitResult; mc->hitResult = new HitResult(hovered); - if (hovered->instanceof(eTYPE_LIVINGENTITY)) { + if (hovered->instanceof (eTYPE_LIVINGENTITY)) { mc->crosshairPickMob = std::dynamic_pointer_cast(hovered); } @@ -449,7 +448,7 @@ void GameRenderer::bobHurt(float a) { } void GameRenderer::bobView(float a) { - if (!mc->cameraTargetPlayer->instanceof(eTYPE_LIVINGENTITY)) return; + if (!mc->cameraTargetPlayer->instanceof (eTYPE_LIVINGENTITY)) return; std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); @@ -608,7 +607,8 @@ void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, aspect = mc->width / (float)mc->height; fov = getFov(a, applyEffects); - if ((mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || + if ((mc->player->m_iScreenSection == + IPlatformRenderer::VIEWPORT_TYPE_SPLIT_TOP) || (mc->player->m_iScreenSection == IPlatformRenderer::VIEWPORT_TYPE_SPLIT_BOTTOM)) { aspect *= 2.0f; @@ -663,7 +663,8 @@ void GameRenderer::setupCamera(float a, int eye) { bool bNoBobbingAnim = (mc->player->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_NoBobbing)) != 0; - if (gameServices().getGameSettings(mc->player->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(mc->player->GetXboxPad(), + eGameSetting_ViewBob) && !mc->player->abilities.flying && !bNoLegAnim && !bNoBobbingAnim) bobView(a); @@ -705,7 +706,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-JEV: I'm fairly confident this method would crash if the cameratarget // isnt a local player anyway, but oh well. std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) + mc->cameraTargetPlayer->instanceof + (eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast(mc->cameraTargetPlayer) : nullptr; @@ -718,7 +720,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { localplayer->inventory->getSelected(); if (!(item && item->getItem()->id == Item::map_Id) && gameServices().getGameSettings(localplayer->GetXboxPad(), - eGameSetting_DisplayHand) == 0) + eGameSetting_DisplayHand) == 0) renderHand = false; } @@ -758,7 +760,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { bool bNoLegAnim = (localplayer->getAnimOverrideBitmask() & ((1 << HumanoidModel::eAnim_NoLegAnim) | (1 << HumanoidModel::eAnim_NoBobbing))) != 0; - if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), + eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); @@ -790,7 +793,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-PB - changing this to be per player // if (mc->options->bobView) bobView(a); - if (gameServices().getGameSettings(localplayer->GetXboxPad(), eGameSetting_ViewBob) && + if (gameServices().getGameSettings(localplayer->GetXboxPad(), + eGameSetting_ViewBob) && !localplayer->abilities.flying && !bNoLegAnim) bobView(a); } @@ -833,7 +837,7 @@ void GameRenderer::turnOnLightLayer( if (logCount < 16) { ++logCount; Log::info("[linux-lightmap] turnOnLightLayer tex=%d scale=%d\n", - textureId, scaleLight ? 1 : 0); + textureId, scaleLight ? 1 : 0); } PlatformRenderer.TextureBindVertex(textureId, scaleLight); @@ -1197,8 +1201,7 @@ void GameRenderer::EnableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (updateRunning) return; - Log::info( - "------------------EnableUpdateThread--------------------\n"); + Log::info("------------------EnableUpdateThread--------------------\n"); updateRunning = true; m_updateEvents->set(eUpdateCanRun); m_updateEvents->set(eUpdateEventIsFinished); @@ -1211,8 +1214,7 @@ void GameRenderer::DisableUpdateThread() { // #endif #if defined(MULTITHREAD_ENABLE) if (!updateRunning) return; - Log::info( - "------------------DisableUpdateThread--------------------\n"); + Log::info("------------------DisableUpdateThread--------------------\n"); updateRunning = false; m_updateEvents->clear(eUpdateCanRun); m_updateEvents->waitForSingle(eUpdateEventIsFinished, @@ -1240,9 +1242,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we // want to update this is mc->player changes for different local players - { - mc->cameraTargetPlayer = mc->player; - } + { mc->cameraTargetPlayer = mc->player; } pick(a); std::shared_ptr cameraEntity = mc->cameraTargetPlayer; @@ -1380,9 +1380,9 @@ void GameRenderer::renderLevel(float a, int64_t until) { turnOffLightLayer(a); // 4J - brought forward from 1.8.2 if ((mc->hitResult != nullptr) && - cameraEntity->isUnderLiquid(Material::water) && - cameraEntity->instanceof( - eTYPE_PLAYER)) //&& !mc->options.hideGui) + cameraEntity->isUnderLiquid(Material::water) && + cameraEntity->instanceof + (eTYPE_PLAYER)) //&& !mc->options.hideGui) { std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); @@ -1395,7 +1395,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glDisable(GL_BLEND); glEnable(GL_CULL_FACE); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); PlatformRenderer.StateSetDepthMask(true); setupFog(0, a); glEnable(GL_BLEND); @@ -1417,7 +1418,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + PlatformRenderer.StateSetBlendFunc(GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA); if (visibleWaterChunks > 0) { levelRenderer->render( @@ -1456,8 +1458,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glEnable(GL_CULL_FACE); glDisable(GL_BLEND); - if ((zoom == 1) && - cameraEntity->instanceof(eTYPE_PLAYER)) //&& !mc->options.hideGui) + if ((zoom == 1) && cameraEntity->instanceof + (eTYPE_PLAYER)) //&& !mc->options.hideGui) { if (mc->hitResult != nullptr && !cameraEntity->isUnderLiquid(Material::water)) { @@ -2016,7 +2018,7 @@ void GameRenderer::setupFog(int i, float alpha) { // 4J - check for creative mode brought forward from 1.2.3 bool creative = false; - if (player->instanceof(eTYPE_PLAYER)) { + if (player->instanceof (eTYPE_PLAYER)) { creative = (std::dynamic_pointer_cast(player))->abilities.instabuild; } diff --git a/targets/minecraft/client/renderer/GameRenderer.h b/targets/minecraft/client/renderer/GameRenderer.h index cc4302a0c..11a1dfa10 100644 --- a/targets/minecraft/client/renderer/GameRenderer.h +++ b/targets/minecraft/client/renderer/GameRenderer.h @@ -6,10 +6,10 @@ #include #include -#include "platform/C4JThread.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/C4JThread.h" class Minecraft; class Entity; diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 6ed11dc66..3bdeecbc1 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -1,21 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "ItemInHandRenderer.h" - - #include #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "Tesselator.h" #include "Textures.h" #include "TileRenderer.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -27,7 +21,9 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/entity/PlayerRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Inventory.h" @@ -40,6 +36,8 @@ #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class EntityRenderer; class MapItemSavedData; @@ -466,9 +464,8 @@ void ItemInHandRenderer::render(float a) { static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - Log::info( - "[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, u, - v); + Log::info("[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, + u, v); } #endif glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); @@ -550,7 +547,8 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != + 0) { playerRenderer->renderHand(); } glPopMatrix(); @@ -767,7 +765,7 @@ void ItemInHandRenderer::render(float a) { if ((itemInstance && (itemInstance->getItem()->id == Item::map_Id)) || gameServices().getGameSettings(localPlayer->GetXboxPad(), - eGameSetting_DisplayHand) != 0) { + eGameSetting_DisplayHand) != 0) { playerRenderer->renderHand(); } glPopMatrix(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 1ae7c5c87..4d80b0502 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -1,9 +1,5 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "LevelRenderer.h" - #include #include #include @@ -16,23 +12,17 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/renderer/renderer.h" #include "Chunk.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" -#include "util/FrameProfiler.h" -#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "Tesselator.h" -#include "util/StringHelpers.h" +#include "app/common/Audio/SoundEngine.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/MemoryTracker.h" @@ -69,6 +59,7 @@ #include "minecraft/client/particle/SuspendedTownParticle.h" #include "minecraft/client/particle/TerrainParticle.h" #include "minecraft/client/player/LocalPlayer.h" +#include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" #include "minecraft/client/renderer/OffsettedRenderList.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/TileRenderer.h" @@ -79,9 +70,11 @@ #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -108,6 +101,12 @@ #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" +#include "util/StringHelpers.h" class Icon; class ItemInstance; @@ -623,7 +622,7 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { (entity->noCulling || culler->isVisible(&entity->bb))); // Render the mob if the mob's leash holder is within the culler - if (!shouldRender && entity->instanceof(eTYPE_MOB)) { + if (!shouldRender && entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->isLeashed() && (mob->getLeashHolder() != nullptr)) { std::shared_ptr leashHolder = mob->getLeashHolder(); @@ -637,10 +636,10 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { // !mc->options->thirdPersonView && // !mc->cameraTargetPlayer->isSleeping()) continue; std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) - ? std::dynamic_pointer_cast( - mc->cameraTargetPlayer) - : nullptr; + mc->cameraTargetPlayer->instanceof + (eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast( + mc->cameraTargetPlayer) + : nullptr; if (localplayer && entity == mc->cameraTargetPlayer && !localplayer->ThirdPersonView() && @@ -681,16 +680,16 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { std::string LevelRenderer::gatherStats1() { return "C: " + toWString(renderedChunks) + "/" + - toWString(totalChunks) + ". F: " + - toWString(offscreenChunks) + ", O: " + - toWString(occludedChunks) + ", E: " + - toWString(emptyChunks); + toWString(totalChunks) + + ". F: " + toWString(offscreenChunks) + + ", O: " + toWString(occludedChunks) + + ", E: " + toWString(emptyChunks); } std::string LevelRenderer::gatherStats2() { return "E: " + toWString(renderedEntities) + "/" + - toWString(totalEntities) + ". B: " + - toWString(culledEntities) + ", I: " + + toWString(totalEntities) + + ". B: " + toWString(culledEntities) + ", I: " + toWString((totalEntities - culledEntities) - renderedEntities); } @@ -862,8 +861,8 @@ 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 PlatformRenderer.SetChunkOffset((float)chunk->chunk->x, - (float)chunk->chunk->y, - (float)chunk->chunk->z); + (float)chunk->chunk->y, + (float)chunk->chunk->z); if (PlatformRenderer.CBuffCall(list, first)) { first = false; @@ -1168,7 +1167,7 @@ void LevelRenderer::renderClouds(float alpha) { // if the primary player has clouds off, so do all players on this machine if (gameServices().getGameSettings(PlatformInput.GetPrimaryPad(), - eGameSetting_Clouds) == 0) { + eGameSetting_Clouds) == 0) { return; } @@ -2223,7 +2222,8 @@ void LevelRenderer::renderHitOutline(std::shared_ptr player, const float ss = 0.002f; // 4J-PB - If Display HUD is false, don't render the hit outline - if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) return; + if (gameServices().getGameSettings(iPad, eGameSetting_DisplayHUD) == 0) + return; PlatformRenderer.StateSetLightingEnable(false); glDisable(GL_TEXTURE_2D); @@ -3204,7 +3204,7 @@ std::shared_ptr LevelRenderer::addParticleInternal( } void LevelRenderer::entityAdded(std::shared_ptr entity) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->prepareCustomTextures(); @@ -3222,7 +3222,7 @@ void LevelRenderer::entityAdded(std::shared_ptr entity) { } void LevelRenderer::entityRemoved(std::shared_ptr entity) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (player->customTextureUrl != "") { @@ -3518,7 +3518,7 @@ void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, if (!mc->soundEngine->GetIsPlayingStreamingGameMusic()) { level[playerIndex]->playStreamingMusic( "", x, y, z); // 4J - used to pass nullptr, but using - // empty string here now instead + // empty string here now instead } } mc->localplayers[playerIndex]->updateRichPresence(); diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index 9adda8ec3..fa319735a 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -1,14 +1,14 @@ #pragma once -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "OffsettedRenderList.h" -#include "platform/C4JThread.h" -#include "util/Definitions.h" #include "java/JavaIntHash.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" +#include "platform/C4JThread.h" +#include "platform/NetTypes.h" +#include "util/Definitions.h" class ClipChunk; class HitResult; diff --git a/targets/minecraft/client/renderer/OffsettedRenderList.cpp b/targets/minecraft/client/renderer/OffsettedRenderList.cpp index 34d1d1123..9c9c18426 100644 --- a/targets/minecraft/client/renderer/OffsettedRenderList.cpp +++ b/targets/minecraft/client/renderer/OffsettedRenderList.cpp @@ -1,9 +1,9 @@ #include "OffsettedRenderList.h" -#include "platform/stubs.h" -#include "platform/renderer/renderer.h" #include "java/IntBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" // 4J added OffsettedRenderList::OffsettedRenderList() { diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 6abdf4b28..0d1e7bff0 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -1,13 +1,11 @@ -#include "minecraft/util/Log.h" #include "Tesselator.h" - - #include +#include "minecraft/client/MemoryTracker.h" +#include "minecraft/util/Log.h" #include "platform/renderer/renderer.h" #include "platform/stubs.h" -#include "minecraft/client/MemoryTracker.h" bool Tesselator::TRIANGLE_MODE = false; bool Tesselator::USE_VBO = false; @@ -132,7 +130,8 @@ void Tesselator::end() { PlatformRenderer.DrawVertices( (IPlatformRenderer::ePrimitiveType)mode, vertexCount, _array->data(), - IPlatformRenderer::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, + IPlatformRenderer:: + VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_TEXGEN, IPlatformRenderer::PIXEL_SHADER_TYPE_PROJECTION); } else { PlatformRenderer.DrawVertices( @@ -538,8 +537,8 @@ 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 PlatformRenderer.StateSetVertexTextureUV) rather - // than these local ones + // 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 eae1272b5..c4ef4d783 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "Textures.h" #include @@ -9,19 +7,16 @@ #include #include - -#include "platform/renderer/renderer.h" #include "HttpTexture.h" +#include "java/Buffer.h" +#include "java/ByteBuffer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/BufferedImage.h" +#include "minecraft/client/MemoryTracker.h" +#include "minecraft/client/Options.h" #include "minecraft/client/renderer/MemTexture.h" #include "minecraft/client/renderer/MemTextureProcessor.h" #include "minecraft/client/renderer/MobSkinMemTextureProcessor.h" -#include "util/StringHelpers.h" - -#include "java/Buffer.h" -#include "java/ByteBuffer.h" -#include "minecraft/client/MemoryTracker.h" -#include "minecraft/client/Options.h" #include "minecraft/client/renderer/texture/PreStitchedTextureMap.h" #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -32,6 +27,9 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" // Linux/PC port: disable mipmapping globally so textures are always sampled // from the full-resolution level 0 with GL_NEAREST, giving pixel-crisp @@ -416,9 +414,7 @@ int Textures::loadTexture(int idx) { // renderer that map the single 8-bit channel to RGBA differently. void Textures::setTextureFormat(const std::string& resourceName) { // 4J Stu - These texture formats are not currently in the render header - { - TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; - } + { TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; } } void Textures::bindTexture(const std::string& resourceName) { @@ -526,8 +522,8 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { mergedWidth, mergedHeight, BufferedImage::TYPE_INT_ARGB); memcpy(mergedImage->getData(), mergedPixels.data(), mergedWidth * mergedHeight * sizeof(int)); - id = getTexture(mergedImage, IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, - false); + id = getTexture(mergedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, false); } else { id = 0; } @@ -573,8 +569,7 @@ ResourceLocation* Textures::getTextureLocation(int iconType) { void Textures::clearLastBoundId() { lastBoundId = -1; } -int Textures::loadTexture(TEXTURE_NAME texId, - const std::string& resourceName) { +int Textures::loadTexture(TEXTURE_NAME texId, const std::string& resourceName) { // char buf[256]; // strncpy(buf, resourceName.c_str(), 256); // printf("Textures::loadTexture name - %s\n",buf); @@ -606,8 +601,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, (resourceName == "%clamp%misc/shadow.png") || (resourceName == "%blur%misc/pumpkinblur.png") || (resourceName == "%clamp%misc/shadow.png") || - (resourceName == "gui/icons.png") || - (resourceName == "gui/gui.png") || + (resourceName == "gui/icons.png") || (resourceName == "gui/gui.png") || (resourceName == "misc/footprint.png")) { MIPMAP = false; } @@ -654,7 +648,8 @@ return id; */ } -int Textures::getTexture(BufferedImage* img, IPlatformRenderer::eTextureFormat format, +int Textures::getTexture(BufferedImage* img, + IPlatformRenderer::eTextureFormat format, bool mipmap) { int id = MemoryTracker::genTextures(); TEXTURE_FORMAT = format; @@ -805,7 +800,7 @@ void Textures::loadTexture(BufferedImage* img, int id, bool blur, bool clamp) { } delete[] tempData; PlatformRenderer.TextureData(ww, hh, pixels->getBuffer(), level, - TEXTURE_FORMAT); + TEXTURE_FORMAT); } } @@ -905,7 +900,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } // 4J - added. This is a more minimal version of replaceTexture that assumes the @@ -925,7 +920,7 @@ void Textures::replaceTextureDirect(const std::vector& rawPixels, int w, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); PlatformRenderer.TextureDataUpdate(0, 0, w, h, - const_cast(rawPixels.data()), 0); + const_cast(rawPixels.data()), 0); } void Textures::releaseTexture(int id) { @@ -1019,9 +1014,9 @@ int Textures::loadMemTexture(const std::string& url, } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1056,9 +1051,9 @@ int Textures::loadMemTexture(const std::string& url, int backup) { MIPMAP = false; } if (texture->id < 0) { - texture->id = - getTexture(texture->loadedImage, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); + texture->id = getTexture( + texture->loadedImage, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw, MIPMAP); } else { loadTexture(texture->loadedImage, texture->id); } @@ -1230,9 +1225,7 @@ BufferedImage* Textures::readImage( name, false, isTu, drive); // new BufferedImage(name,false,isTu,drive); } else { - { - drive = skins->getDefault()->getPath(isTu); - } + { drive = skins->getDefault()->getPath(isTu); } if (IsOriginalImage(texId, name) || isTu) { img = skins->getDefault()->getImageResource( @@ -1303,16 +1296,16 @@ TEXTURE_NAME TUImages[] = { }; // This is for any TU textures that aren't part of our enum indexed preload set -const char* const TUImagePaths[] = { - "font/Default", "font/Mojangles_7", "font/Mojangles_11", +const char* const TUImagePaths[] = {"font/Default", "font/Mojangles_7", + "font/Mojangles_11", - // TU12 - "armor/cloth_1.png", "armor/cloth_1_b.png", "armor/cloth_2.png", - "armor/cloth_2_b.png", + // TU12 + "armor/cloth_1.png", "armor/cloth_1_b.png", + "armor/cloth_2.png", "armor/cloth_2_b.png", - // + // - nullptr}; + nullptr}; bool Textures::IsTUImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; @@ -1344,7 +1337,7 @@ TEXTURE_NAME OriginalImages[] = {TN_MOB_CHAR, TN_MOB_CHAR1, TN_MOB_CHAR2, const char* const OriginalImagesPaths[] = {"misc/watercolor.png", - nullptr}; + nullptr}; bool Textures::IsOriginalImage(TEXTURE_NAME texId, const std::string& name) { int i = 0; diff --git a/targets/minecraft/client/renderer/Textures.h b/targets/minecraft/client/renderer/Textures.h index 8d067f247..d8855ecbd 100644 --- a/targets/minecraft/client/renderer/Textures.h +++ b/targets/minecraft/client/renderer/Textures.h @@ -5,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "platform/renderer/renderer.h" class Icon; diff --git a/targets/minecraft/client/renderer/TileRenderer.cpp b/targets/minecraft/client/renderer/TileRenderer.cpp index 79beb927d..acf089344 100644 --- a/targets/minecraft/client/renderer/TileRenderer.cpp +++ b/targets/minecraft/client/renderer/TileRenderer.cpp @@ -1,6 +1,4 @@ #include "TileRenderer.h" -#include "platform/stubs.h" - #include #include @@ -10,18 +8,16 @@ #include #include -#include "platform/renderer/renderer.h" #include "EntityTileRenderer.h" #include "GameRenderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "util/FrameProfiler.h" #include "Tesselator.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/Icon.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" @@ -66,6 +62,9 @@ #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/FrameProfiler.h" bool TileRenderer::fancy = true; diff --git a/targets/minecraft/client/renderer/culling/Frustum.cpp b/targets/minecraft/client/renderer/culling/Frustum.cpp index a11bee30e..9d4191092 100644 --- a/targets/minecraft/client/renderer/culling/Frustum.cpp +++ b/targets/minecraft/client/renderer/culling/Frustum.cpp @@ -1,15 +1,14 @@ #include "Frustum.h" - #include #include #include -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" #include "java/FloatBuffer.h" #include "minecraft/client/MemoryTracker.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class FrustumData; diff --git a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp index 077a08160..f9acc2b37 100644 --- a/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ArrowRenderer.cpp @@ -1,18 +1,16 @@ #include "ArrowRenderer.h" -#include "platform/stubs.h" #include #include -#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 "platform/renderer/renderer.h" +#include "platform/stubs.h" 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 dc8239f17..e24504373 100644 --- a/targets/minecraft/client/renderer/entity/BatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BatRenderer.cpp @@ -1,11 +1,8 @@ #include "BatRenderer.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -13,6 +10,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/ambient/Bat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT); diff --git a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp index 9b349bbbc..a0a0fe9b8 100644 --- a/targets/minecraft/client/renderer/entity/BoatRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/BoatRenderer.cpp @@ -1,11 +1,9 @@ #include "BoatRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/BoatModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -13,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Boat.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT); diff --git a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp index ed36551be..f865cccac 100644 --- a/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CaveSpiderRenderer.cpp @@ -1,12 +1,12 @@ #include "CaveSpiderRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/SpiderRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CaveSpiderRenderer::CAVE_SPIDER_LOCATION = ResourceLocation(TN_MOB_CAVE_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp index e400f5ed5..44d1f3838 100644 --- a/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/CreeperRenderer.cpp @@ -1,18 +1,17 @@ #include "CreeperRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/CreeperModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Creeper.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation CreeperRenderer::POWER_LOCATION = ResourceLocation(TN_POWERED_CREEPER); diff --git a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp index b3288523e..d6f4feeed 100644 --- a/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/DefaultRenderer.cpp @@ -1,7 +1,7 @@ #include "DefaultRenderer.h" -#include "platform/stubs.h" #include "platform/renderer/renderer.h" +#include "platform/stubs.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 505f567fe..fc6397d8a 100644 --- a/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderCrystalRenderer.cpp @@ -1,16 +1,16 @@ #include "EnderCrystalRenderer.h" -#include "platform/stubs.h" #include #include -#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" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderCrystalRenderer::ENDER_CRYSTAL_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_ENDERCRYSTAL); diff --git a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp index f6e9fac21..b43e7e58e 100644 --- a/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EnderDragonRenderer.cpp @@ -1,14 +1,11 @@ #include "EnderDragonRenderer.h" -#include "platform/stubs.h" #include #include #include #include -#include "platform/renderer/renderer.h" #include "SharedConstants.h" - #include "java/Random.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/model/dragon/DragonModel.h" @@ -22,6 +19,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/entity/boss/enderdragon/EnderDragon.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderDragonRenderer::DRAGON_EXPLODING_LOCATION = ResourceLocation(TN_MOB_ENDERDRAGON_SHUFFLE); diff --git a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp index 2edc80ee5..082703e7a 100644 --- a/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EndermanRenderer.cpp @@ -1,11 +1,7 @@ #include "EndermanRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/EndermanModel.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +13,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/EnderMan.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EndermanRenderer::ENDERMAN_EYES_LOCATION = ResourceLocation(TN_MOB_ENDERMAN_EYES); diff --git a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index bcd40fb6c..9981db874 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include @@ -7,7 +5,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "ArrowRenderer.h" #include "BatRenderer.h" #include "BlazeRenderer.h" @@ -59,7 +56,6 @@ #include "WitherSkullRenderer.h" #include "WolfRenderer.h" #include "ZombieRenderer.h" - #include "minecraft/client/model/ChickenModel.h" #include "minecraft/client/model/CowModel.h" #include "minecraft/client/model/HumanoidModel.h" @@ -73,6 +69,7 @@ #include "minecraft/client/model/WolfModel.h" #include "minecraft/client/model/ZombieModel.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" @@ -81,6 +78,8 @@ #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class IconRegister; diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index 33ea6f2e3..9dcb82ba5 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -1,11 +1,8 @@ #include "EntityRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/Options.h" #include "minecraft/client/renderer/Tesselator.h" @@ -21,6 +18,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__MISC_SHADOW); @@ -157,11 +156,11 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, float r = shadowRadius; float fYLocalPlayerShadowOffset = 0.0f; - if (e->instanceof(eTYPE_MOB)) { + if (e->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); r *= mob->getSizeScale(); - if (mob->instanceof(eTYPE_ANIMAL)) { + if (mob->instanceof (eTYPE_ANIMAL)) { if (std::dynamic_pointer_cast(mob)->isBaby()) { r *= 0.5f; } @@ -174,7 +173,7 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, // 4J-PB - local players seem to have a position at their head, and remote // players have a foot position. get the shadow to render by changing the // check here depending on the player type - if (e->instanceof(eTYPE_LOCALPLAYER)) { + if (e->instanceof (eTYPE_LOCALPLAYER)) { ey -= 1.62; fYLocalPlayerShadowOffset = -1.62f; } diff --git a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp index 541c10325..0e375fd88 100644 --- a/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ExperienceOrbRenderer.cpp @@ -1,20 +1,19 @@ #include "ExperienceOrbRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/SharedConstants.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/ExperienceOrb.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ExperienceOrbRenderer::XP_ORB_LOCATION = ResourceLocation(TN_ITEM_EXPERIENCE_ORB); diff --git a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp index e80338b5a..6d2551dbe 100644 --- a/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -1,11 +1,8 @@ #include "FallingTileRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" @@ -15,6 +12,8 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/AnvilTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FallingTileRenderer::FallingTileRenderer() : EntityRenderer() { tileRenderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp index 93276d3aa..5634860eb 100644 --- a/targets/minecraft/client/renderer/entity/FireballRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FireballRenderer.cpp @@ -1,11 +1,8 @@ #include "FireballRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Class.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -16,6 +13,8 @@ #include "minecraft/world/level/tile/FireTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" FireballRenderer::FireballRenderer(float scale) { this->scale = scale; } diff --git a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp index 0ca326512..39a1710e9 100644 --- a/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/FishingHookRenderer.cpp @@ -1,13 +1,10 @@ #include "FishingHookRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/Tesselator.h" @@ -17,6 +14,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation FishingHookRenderer::PARTICLE_LOCATION = ResourceLocation(TN_PARTICLES); diff --git a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp index 862f3e409..cdf0f5351 100644 --- a/targets/minecraft/client/renderer/entity/GhastRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GhastRenderer.cpp @@ -1,9 +1,7 @@ #include "GhastRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/GhastModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Ghast.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation GhastRenderer::GHAST_LOCATION = ResourceLocation(TN_MOB_GHAST); ResourceLocation GhastRenderer::GHAST_SHOOTING_LOCATION = diff --git a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp index e03bd8256..55c91e273 100644 --- a/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/GiantMobRenderer.cpp @@ -1,12 +1,12 @@ #include "GiantMobRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp index bc7f42901..82e3ac25f 100644 --- a/targets/minecraft/client/renderer/entity/HorseRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HorseRenderer.cpp @@ -1,10 +1,7 @@ #include "HorseRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "MobRenderer.h" #include "minecraft/client/model/geom/Model.h" @@ -14,6 +11,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation HorseRenderer::HORSE_LOCATION = ResourceLocation(TN_MOB_HORSE_WHITE); diff --git a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp index abfebd434..6e1b6f8be 100644 --- a/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/HumanoidMobRenderer.cpp @@ -1,13 +1,9 @@ #include "HumanoidMobRenderer.h" -#include "platform/stubs.h" #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -25,6 +21,9 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" const std::string HumanoidMobRenderer::MATERIAL_NAMES[5] = { "cloth", "chain", "iron", "diamond", "gold"}; diff --git a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index 314b90bff..9b742a276 100644 --- a/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -1,12 +1,11 @@ #include -#include "platform/stubs.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/renderer/TileRenderer.h" +#include "platform/stubs.h" // #include "ItemFrame" -#include "platform/renderer/renderer.h" #include "ItemFrameRenderer.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" @@ -28,6 +27,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/TreeTile.h" +#include "platform/renderer/renderer.h" class MapItemSavedData; diff --git a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp index d8023e62f..8190e98bb 100644 --- a/targets/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -1,14 +1,10 @@ #include "ItemRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "util/StringHelpers.h" - #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" @@ -29,6 +25,9 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" class ResourceLocation; diff --git a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp index 6266e3d42..71fde94d0 100644 --- a/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ItemSpriteRenderer.cpp @@ -1,11 +1,8 @@ #include "ItemSpriteRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" @@ -15,6 +12,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/PotionItem.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ItemSpriteRenderer::ItemSpriteRenderer(Item* sourceItem, int sourceItemAuxValue /*= 0*/) diff --git a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp index 2aeee8c4c..ab946b958 100644 --- a/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LavaSlimeRenderer.cpp @@ -1,15 +1,15 @@ #include "LavaSlimeRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/LavaSlimeModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/LavaSlime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LavaSlimeRenderer::MAGMACUBE_LOCATION = ResourceLocation(TN_MOB_LAVA); diff --git a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp index 553b365b7..e9b24215e 100644 --- a/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LeashKnotRenderer.cpp @@ -1,14 +1,13 @@ #include "LeashKnotRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/LeashKnotModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LeashKnotRenderer::KNOT_LOCATION = ResourceLocation(TN_ITEM_LEASHKNOT); diff --git a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp index 25ceecfab..752008826 100644 --- a/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LightningBoltRenderer.cpp @@ -1,14 +1,13 @@ #include "LightningBoltRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/LightningBolt.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void LightningBoltRenderer::render(std::shared_ptr _bolt, double x, double y, double z, float rot, float a) { diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index e1eb72b02..e6fd1a2ff 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -1,17 +1,14 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "LivingEntityRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" -#include "minecraft/GameEnums.h" - #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" @@ -27,6 +24,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Arrow.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT); @@ -67,7 +66,7 @@ void LivingEntityRenderer::render(std::shared_ptr _mob, double x, float bodyRot = rotlerp(mob->yBodyRotO, mob->yBodyRot, a); float headRot = rotlerp(mob->yHeadRotO, mob->yHeadRot, a); - if (mob->isRiding() && mob->riding->instanceof(eTYPE_LIVINGENTITY)) { + if (mob->isRiding() && mob->riding->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr riding = std::dynamic_pointer_cast(mob->riding); bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a); @@ -285,8 +284,9 @@ void LivingEntityRenderer::setupRotations(std::shared_ptr mob, } else { std::string name = mob->getAName(); if (name == "Dinnerbone" || name == "Grumm") { - if (!mob->instanceof(eTYPE_PLAYER) || - !std::dynamic_pointer_cast(mob)->isCapeHidden()) { + if (!mob->instanceof + (eTYPE_PLAYER) || + !std::dynamic_pointer_cast(mob)->isCapeHidden()) { glTranslatef(0, mob->bbHeight + 0.1f, 0); glRotatef(180, 0, 0, 1); } @@ -389,12 +389,14 @@ void LivingEntityRenderer::renderName(std::shared_ptr mob, if (!msg.empty()) { if (mob->isSneaking()) { - if (gameServices().getGameSettings(eGameSetting_DisplayHUD) == 0) { + if (gameServices().getGameSettings( + eGameSetting_DisplayHUD) == 0) { // 4J-PB - turn off gamertag render return; } - if (gameServices().getGameHostOption(eGameHostOption_Gamertags) == 0) { + if (gameServices().getGameHostOption( + eGameHostOption_Gamertags) == 0) { // turn off gamertags if the host has set them off return; } @@ -525,7 +527,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, std::string playerName; char wchName[2]; - if (mob->instanceof(eTYPE_PLAYER)) { + if (mob->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(mob); if (gameServices().isXuidDeadmau5(player->getXuid())) offs = -10; diff --git a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp index 9951566b7..68fbb638f 100644 --- a/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MinecartRenderer.cpp @@ -1,5 +1,4 @@ #include "MinecartRenderer.h" -#include "platform/stubs.h" #include #include @@ -7,7 +6,6 @@ #include #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/MinecartModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +15,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Tile; diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index 55fddd7c9..aabf17f07 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -1,23 +1,22 @@ #include "MobRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "LivingEntityRenderer.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" - #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; @@ -55,7 +54,7 @@ void MobRenderer::renderLeash(std::shared_ptr entity, double x, double y, double rotOffCos = cos(roperYRot); double rotOffSin = sin(roperYRot); double yOff = sin(roperXRot); - if (roper->instanceof(eTYPE_HANGING_ENTITY)) { + if (roper->instanceof (eTYPE_HANGING_ENTITY)) { rotOffCos = 0; rotOffSin = 0; yOff = -1; diff --git a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp index ea6674b29..90aed102e 100644 --- a/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MushroomCowRenderer.cpp @@ -1,11 +1,7 @@ #include "MushroomCowRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/QuadrupedModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +13,8 @@ #include "minecraft/world/entity/animal/MushroomCow.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp index 01f52f756..0043aba52 100644 --- a/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/OcelotRenderer.cpp @@ -1,15 +1,15 @@ #include "OcelotRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Ocelot.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp index 97f3da859..22a737c41 100644 --- a/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -1,12 +1,8 @@ #include "PaintingRenderer.h" -#include "platform/stubs.h" #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" - #include "java/Random.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -14,6 +10,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/level/Level.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PaintingRenderer::PAINTING_LOCATION(TN_ART_KZ); diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index c2511c1f6..1d2ab8331 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -1,18 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "PlayerRenderer.h" #include #include #include - -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "HumanoidMobRenderer.h" -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/HumanoidModel.h" @@ -36,6 +33,8 @@ #include "minecraft/world/item/UseAnim.h" #include "minecraft/world/level/tile/Tile.h" #include "nbt/CompoundTag.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" const unsigned int PlayerRenderer::s_nametagColors[MINECRAFT_NET_MAX_PLAYERS] = { @@ -196,7 +195,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, mob->isSneaking(); double yp = y - mob->heightOffset; - if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER)) { + if (mob->isSneaking() && !mob->instanceof (eTYPE_LOCALPLAYER)) { yp -= 2 / 16.0f; } @@ -459,8 +458,7 @@ bool b2 = !mob->isCapeHidden();*/ void PlayerRenderer::renderNameTags(std::shared_ptr player, double x, double y, double z, - std::string msg, float scale, - double dist) { + std::string msg, float scale, double dist) { LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); } @@ -524,7 +522,8 @@ void PlayerRenderer::setupRotations(std::shared_ptr _mob, // 4J Added override to stop rendering shadow if player is invisible void PlayerRenderer::renderShadow(std::shared_ptr e, double x, double y, double z, float pow, float a) { - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) > + 0) { std::shared_ptr player = std::dynamic_pointer_cast(e); if (player != nullptr && player->hasInvisiblePrivilege()) return; } diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.h b/targets/minecraft/client/renderer/entity/PlayerRenderer.h index 5feabe813..e2440f8cf 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -2,11 +2,11 @@ #include #include -#include "platform/NetTypes.h" -#include "minecraft/client/model/SkinBox.h" #include "MobRenderer.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/renderer/entity/LivingEntityRenderer.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/NetTypes.h" class HumanoidModel; class LivingEntity; diff --git a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp index e9fdfff43..cab34494a 100644 --- a/targets/minecraft/client/renderer/entity/SheepRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SheepRenderer.cpp @@ -1,10 +1,8 @@ #include "SheepRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -13,6 +11,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp index baf896c8a..b97c00e5e 100644 --- a/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SkeletonRenderer.cpp @@ -1,9 +1,7 @@ #include "SkeletonRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/SkeletonModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/HumanoidMobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Skeleton.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SkeletonRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON); diff --git a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp index c4200ee7c..fcc79f1a7 100644 --- a/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SlimeRenderer.cpp @@ -1,15 +1,14 @@ #include "SlimeRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Slime.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp index c0b6f7b8b..592633f8b 100644 --- a/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SnowManRenderer.cpp @@ -1,9 +1,7 @@ #include "SnowManRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/client/model/SnowManModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -17,6 +15,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SnowManRenderer::SNOWMAN_LOCATION = ResourceLocation(TN_MOB_SNOWMAN); diff --git a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp index 711eb9541..08b3ad8db 100644 --- a/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SpiderRenderer.cpp @@ -1,10 +1,7 @@ #include "SpiderRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/SpiderModel.h" #include "minecraft/client/renderer/Textures.h" @@ -12,6 +9,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/monster/Spider.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation SpiderRenderer::SPIDER_LOCATION = ResourceLocation(TN_MOB_SPIDER); diff --git a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp index 538b29fd7..a7a671baf 100644 --- a/targets/minecraft/client/renderer/entity/SquidRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/SquidRenderer.cpp @@ -1,14 +1,14 @@ #include "SquidRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Squid.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp index 9f8a00b10..74fd6eecb 100644 --- a/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntMinecartRenderer.cpp @@ -1,15 +1,14 @@ #include "TntMinecartRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/entity/MinecartRenderer.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/entity/item/MinecartTNT.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void TntMinecartRenderer::renderMinecartContents( std::shared_ptr _cart, float a, Tile* tile, int tileData) { diff --git a/targets/minecraft/client/renderer/entity/TntRenderer.cpp b/targets/minecraft/client/renderer/entity/TntRenderer.cpp index eb2670b64..8f031b27a 100644 --- a/targets/minecraft/client/renderer/entity/TntRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/TntRenderer.cpp @@ -1,16 +1,15 @@ #include "TntRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/TileRenderer.h" #include "minecraft/client/renderer/texture/TextureAtlas.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/item/PrimedTnt.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" TntRenderer::TntRenderer() { renderer = new TileRenderer(); diff --git a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp index 586edb485..f5e88b431 100644 --- a/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerGolemRenderer.cpp @@ -1,12 +1,9 @@ #include "VillagerGolemRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/client/model/VillagerGolemModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -19,6 +16,8 @@ #include "minecraft/world/entity/animal/VillagerGolem.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerGolemRenderer::GOLEM_LOCATION = ResourceLocation(TN_MOB_VILLAGER_GOLEM); diff --git a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp index ac3d61965..84a0e4740 100644 --- a/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/VillagerRenderer.cpp @@ -1,9 +1,7 @@ #include "VillagerRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/client/model/VillagerModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/MobRenderer.h" @@ -11,6 +9,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/npc/Villager.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation VillagerRenderer::VILLAGER_LOCATION = ResourceLocation(TN_MOB_VILLAGER_VILLAGER); diff --git a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp index 7ad9705b7..f135b4785 100644 --- a/targets/minecraft/client/renderer/entity/WitchRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitchRenderer.cpp @@ -1,10 +1,8 @@ #include "WitchRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "EntityRenderDispatcher.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/WitchModel.h" @@ -22,6 +20,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitchRenderer::WITCH_LOCATION = ResourceLocation(TN_MOB_WITCH); diff --git a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp index eb5e3f172..89a98df5d 100644 --- a/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherBossRenderer.cpp @@ -1,13 +1,10 @@ #include "WitherBossRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" #include "MobRenderer.h" #include "SharedConstants.h" - #include "minecraft/client/model/WitherBossModel.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/client/renderer/BossMobGuiInfo.h" @@ -16,6 +13,8 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/boss/wither/WitherBoss.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherBossRenderer::WITHER_ARMOR_LOCATION = ResourceLocation(TN_MOB_WITHER_ARMOR); diff --git a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp index ba4c19fd0..f784f9a37 100644 --- a/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WitherSkullRenderer.cpp @@ -1,15 +1,14 @@ #include "WitherSkullRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/projectile/WitherSkull.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation WitherSkullRenderer::WITHER_ARMOR_LOCATION( TN_MOB_WITHER_INVULNERABLE); diff --git a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp index 7674d8a77..526958b3e 100644 --- a/targets/minecraft/client/renderer/entity/WolfRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/WolfRenderer.cpp @@ -1,9 +1,7 @@ #include "WolfRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -14,6 +12,8 @@ #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/entity/animal/Wolf.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Model; diff --git a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp index b1bb89c51..25815c572 100644 --- a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp @@ -68,7 +68,7 @@ ResourceLocation* ZombieRenderer::getTextureLocation( std::shared_ptr mob = std::dynamic_pointer_cast(entity); // TODO Extract this clusterfck into 3 renderers - if (entity->instanceof(eTYPE_PIGZOMBIE)) { + if (entity->instanceof (eTYPE_PIGZOMBIE)) { return &ZOMBIE_PIGMAN_LOCATION; } diff --git a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp index e8706b262..fe8684843 100644 --- a/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/PreStitchedTextureMap.cpp @@ -1,14 +1,13 @@ -#include "minecraft/util/Log.h" #include "PreStitchedTextureMap.h" #include #include -#include "minecraft/client/BufferedImage.h" #include "SimpleIcon.h" #include "StitchedTexture.h" #include "Texture.h" #include "TextureManager.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" @@ -16,6 +15,7 @@ #include "minecraft/client/renderer/texture/custom/CompassTexture.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -173,9 +173,8 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, if (first->getWidth() != tex->getWidth() || first->getHeight() != tex->getHeight()) { Log::info("%s - first w - %d, h - %d, tex w - %d, h - %d\n", - textureFileName.c_str(), first->getWidth(), - tex->getWidth(), first->getHeight(), - tex->getHeight()); + textureFileName.c_str(), first->getWidth(), + tex->getWidth(), first->getHeight(), tex->getHeight()); assert(0); } #endif diff --git a/targets/minecraft/client/renderer/texture/StitchSlot.cpp b/targets/minecraft/client/renderer/texture/StitchSlot.cpp index da44be1fe..385bf4405 100644 --- a/targets/minecraft/client/renderer/texture/StitchSlot.cpp +++ b/targets/minecraft/client/renderer/texture/StitchSlot.cpp @@ -137,8 +137,9 @@ void StitchSlot::collectAssignments(std::vector* result) { //@Override std::string StitchSlot::toString() { - return "Slot{originX=" + toWString(originX) + ", originY=" + - toWString(originY) + ", width=" + toWString(width) + ", height=" + - toWString(height) + ", texture=" + toWString(textureHolder) + + return "Slot{originX=" + toWString(originX) + + ", originY=" + toWString(originY) + ", width=" + toWString(width) + + ", height=" + toWString(height) + + ", texture=" + toWString(textureHolder) + ", subSlots=" + toWString(subSlots) + '}'; } \ No newline at end of file diff --git a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp index 5bd407020..c6858f3ed 100644 --- a/targets/minecraft/client/renderer/texture/StitchedTexture.cpp +++ b/targets/minecraft/client/renderer/texture/StitchedTexture.cpp @@ -4,11 +4,11 @@ #include "Texture.h" #include "TextureManager.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/renderer/texture/custom/ClockTexture.h" #include "minecraft/client/renderer/texture/custom/CompassTexture.h" +#include "util/StringHelpers.h" StitchedTexture* StitchedTexture::create(const std::string& name) { // TODO: Generalize? diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 514c2273b..8a309b338 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Stitcher.h" #include @@ -7,6 +6,7 @@ #include "Texture.h" #include "TextureHolder.h" #include "TextureManager.h" +#include "minecraft/util/Log.h" void Stitcher::_init(const std::string& name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale) { diff --git a/targets/minecraft/client/renderer/texture/Texture.cpp b/targets/minecraft/client/renderer/texture/Texture.cpp index a737fc71d..b1501ee40 100644 --- a/targets/minecraft/client/renderer/texture/Texture.cpp +++ b/targets/minecraft/client/renderer/texture/Texture.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "Texture.h" #include @@ -7,12 +5,14 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/client/BufferedImage.h" #include "TextureManager.h" #include "java/Buffer.h" #include "java/ByteBuffer.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Rect2i.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #define MAX_MIP_LEVELS 5 @@ -575,24 +575,25 @@ void Texture::updateOnGPU() { if (!m_bInitialised) { PlatformRenderer.TextureSetTextureLevels(m_iMipLevels); // 4J added - PlatformRenderer.TextureData(width, height, data[0]->getBuffer(), 0, - IPlatformRenderer::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; - PlatformRenderer.TextureData(levelWidth, levelHeight, - data[level]->getBuffer(), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + PlatformRenderer.TextureData( + levelWidth, levelHeight, data[level]->getBuffer(), level, + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } } m_bInitialised = true; } else { PlatformRenderer.TextureDataUpdate(0, 0, width, height, - data[0]->getBuffer(), 0); + data[0]->getBuffer(), 0); if (mipmapped) { if (PlatformRenderer.TextureGetTextureLevels() > 1) { diff --git a/targets/minecraft/client/renderer/texture/Texture.h b/targets/minecraft/client/renderer/texture/Texture.h index 805b8213e..06bf6ad1c 100644 --- a/targets/minecraft/client/renderer/texture/Texture.h +++ b/targets/minecraft/client/renderer/texture/Texture.h @@ -1,12 +1,12 @@ #pragma once -#include "platform/renderer/renderer.h" -#include "platform/stubs.h" - #include #include #include +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" + class Rect2i; class ByteBuffer; class BufferedImage; @@ -69,8 +69,8 @@ public: ~Texture(); private: - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, bool mipMap = true); void _init(const std::string& name, int mode, int width, int height, @@ -84,8 +84,8 @@ public: Texture(const std::string& name, int mode, int width, int height, int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); - Texture(const std::string& name, int mode, int width, int height, - int depth, int wrapMode, int format, int minFilter, int magFilter, + Texture(const std::string& name, int mode, int width, int height, int depth, + int wrapMode, int format, int minFilter, int magFilter, BufferedImage* image, bool mipMap = true); const Rect2i* getRect(); diff --git a/targets/minecraft/client/renderer/texture/TextureHolder.cpp b/targets/minecraft/client/renderer/texture/TextureHolder.cpp index 413beb484..e90be0e37 100644 --- a/targets/minecraft/client/renderer/texture/TextureHolder.cpp +++ b/targets/minecraft/client/renderer/texture/TextureHolder.cpp @@ -49,8 +49,8 @@ void TextureHolder::setForcedScale(int targetSize) { //@Override std::string TextureHolder::toString() { - return "TextureHolder{width=" + toWString(width) + ", height=" + - toWString(height) + '}'; + return "TextureHolder{width=" + toWString(width) + + ", height=" + toWString(height) + '}'; } int TextureHolder::compareTo(const TextureHolder* other) const { diff --git a/targets/minecraft/client/renderer/texture/TextureManager.cpp b/targets/minecraft/client/renderer/texture/TextureManager.cpp index 8f12f48db..6db5a2c32 100644 --- a/targets/minecraft/client/renderer/texture/TextureManager.cpp +++ b/targets/minecraft/client/renderer/texture/TextureManager.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureManager.h" #include @@ -6,13 +5,14 @@ #include #include -#include "minecraft/client/BufferedImage.h" #include "Stitcher.h" #include "Texture.h" #include "java/File.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" TextureManager* TextureManager::instance = nullptr; diff --git a/targets/minecraft/client/renderer/texture/TextureMap.cpp b/targets/minecraft/client/renderer/texture/TextureMap.cpp index 2856ca086..2aaec1b96 100644 --- a/targets/minecraft/client/renderer/texture/TextureMap.cpp +++ b/targets/minecraft/client/renderer/texture/TextureMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TextureMap.h" #include @@ -6,7 +5,6 @@ #include #include -#include "minecraft/client/BufferedImage.h" #include "StitchSlot.h" #include "StitchedTexture.h" #include "Stitcher.h" @@ -16,11 +14,13 @@ #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" @@ -157,7 +157,7 @@ void TextureMap::stitch() { // premade icon for " + textureName + " doing " + name); #ifndef _CONTENT_PACKAGE printf("Couldn't find premade icon for %s doing %s\n", - textureName.c_str(), name.c_str()); + textureName.c_str(), name.c_str()); #endif } } @@ -188,7 +188,7 @@ void TextureMap::stitch() { // for: " + animationDefinitionFile); #ifndef _CONTENT_PACKAGE printf("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); diff --git a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp index dab61cdc0..6c4b0c872 100644 --- a/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/ClockTexture.cpp @@ -4,7 +4,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -12,6 +11,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" ClockTexture::ClockTexture() : StitchedTexture("clock", "clock") { rot = rota = 0.0; diff --git a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp index 5abc49cab..29b3e1f41 100644 --- a/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp +++ b/targets/minecraft/client/renderer/texture/custom/CompassTexture.cpp @@ -7,7 +7,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaMath.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" @@ -16,6 +15,7 @@ #include "minecraft/client/renderer/texture/Texture.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/PlatformTypes.h" CompassTexture* CompassTexture::instance = nullptr; diff --git a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp index ea4768447..bd8c0c78d 100644 --- a/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/BeaconRenderer.cpp @@ -1,18 +1,17 @@ #include "BeaconRenderer.h" -#include "platform/stubs.h" #include #include #include -#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/level/Level.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM); diff --git a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp index 6c41fdb7f..3d433ecd3 100644 --- a/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/ChestRenderer.cpp @@ -1,11 +1,8 @@ #include "ChestRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/LargeChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" @@ -16,6 +13,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation ChestRenderer::CHEST_LARGE_TRAP_LOCATION = ResourceLocation(TN_TILE_LARGE_TRAP_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index a71f327f2..687bb2d7e 100644 --- a/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -1,18 +1,17 @@ #include "EnchantTableRenderer.h" -#include "platform/stubs.h" #include #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/BookModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/tile/entity/EnchantmentTableTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnchantTableRenderer::BOOK_LOCATION = ResourceLocation(TN_ITEM_BOOK); diff --git a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp index 50d181e73..da1b16561 100644 --- a/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/EnderChestRenderer.cpp @@ -1,17 +1,16 @@ #include "EnderChestRenderer.h" -#include "platform/stubs.h" #include #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/model/ChestModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/EnderChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation EnderChestRenderer::ENDER_CHEST_LOCATION = ResourceLocation(TN_TILE_ENDER_CHEST); diff --git a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp index 012395f3c..bd12348c9 100644 --- a/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/MobSpawnerRenderer.cpp @@ -1,12 +1,12 @@ #include "MobSpawnerRenderer.h" -#include "platform/stubs.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" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" void MobSpawnerRenderer::render(std::shared_ptr _spawner, double x, double y, double z, float a, bool setColor, diff --git a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp index e71ba0cc5..f1f6b2cfb 100644 --- a/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/PistonPieceRenderer.cpp @@ -1,10 +1,7 @@ #include "PistonPieceRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/client/Lighting.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" @@ -17,6 +14,8 @@ #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/level/tile/piston/PistonBaseTile.h" #include "minecraft/world/level/tile/piston/PistonExtensionTile.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); diff --git a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp index 8ca473de2..1748209c4 100644 --- a/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -1,25 +1,24 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" #include "SignRenderer.h" #include #include #include -#include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "platform/XboxStubs.h" - +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/model/SignModel.h" #include "minecraft/client/model/geom/ModelPart.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/XboxStubs.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" #include "strings.h" ResourceLocation SignRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); @@ -90,7 +89,8 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, msg = "Censored"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_CENSORED); + msg = + gameServices().getString(IDS_STRINGVERIFY_CENSORED); break; } } else { @@ -101,11 +101,11 @@ void SignRenderer::render(std::shared_ptr _sign, double x, double y, case XC_LANGUAGE_KOREAN: case XC_LANGUAGE_JAPANESE: case XC_LANGUAGE_TCHINESE: - msg = - "Awaiting Approval"; // In-game font, so English only + msg = "Awaiting Approval"; // In-game font, so English only break; default: - msg = gameServices().getString(IDS_STRINGVERIFY_AWAITING_APPROVAL); + msg = gameServices().getString( + IDS_STRINGVERIFY_AWAITING_APPROVAL); break; } } diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index a392ce06b..f04a12f4c 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -1,10 +1,7 @@ #include "SkullTileRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" - #include "minecraft/Facing.h" #include "minecraft/client/model/SkeletonHeadModel.h" #include "minecraft/client/model/geom/Model.h" @@ -15,6 +12,8 @@ #include "minecraft/world/level/tile/SkullTile.h" #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" SkullTileRenderer* SkullTileRenderer::instance = nullptr; @@ -83,9 +82,7 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, // bindTexture(url, "/mob/char.png"); //} // else - { - bindTexture(&PlayerRenderer::DEFAULT_LOCATION); - } + { bindTexture(&PlayerRenderer::DEFAULT_LOCATION); } break; case SkullTileEntity::TYPE_CREEPER: bindTexture(&CREEPER_LOCATION); diff --git a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp index d921be722..dbbb5dcf8 100644 --- a/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/TheEndPortalRenderer.cpp @@ -1,11 +1,8 @@ #include "TheEndPortalRenderer.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "TileEntityRenderDispatcher.h" - #include "java/FloatBuffer.h" #include "java/Random.h" #include "java/System.h" @@ -16,6 +13,8 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/world/level/tile/entity/TheEndPortalTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" ResourceLocation TheEndPortalRenderer::END_SKY_LOCATION = ResourceLocation(TN_MISC_TUNNEL); diff --git a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp index 76d00ae63..2d91599cc 100644 --- a/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp +++ b/targets/minecraft/client/renderer/tileentity/TileEntityRenderDispatcher.cpp @@ -1,9 +1,7 @@ #include "TileEntityRenderDispatcher.h" -#include "platform/stubs.h" #include -#include "platform/renderer/renderer.h" #include "BeaconRenderer.h" #include "ChestRenderer.h" #include "EnchantTableRenderer.h" @@ -14,11 +12,12 @@ #include "SkullTileRenderer.h" #include "TheEndPortalRenderer.h" #include "TileEntityRenderer.h" - #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" class Font; class Textures; diff --git a/targets/minecraft/client/resources/Colours/ColourTable.cpp b/targets/minecraft/client/resources/Colours/ColourTable.cpp index 0db6b345f..e01b360d9 100644 --- a/targets/minecraft/client/resources/Colours/ColourTable.cpp +++ b/targets/minecraft/client/resources/Colours/ColourTable.cpp @@ -4,13 +4,12 @@ #include #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" +#include "minecraft/GameEnums.h" +#include "util/StringHelpers.h" -std::unordered_map - ColourTable::s_colourNamesMap; +std::unordered_map ColourTable::s_colourNamesMap; const char* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { "NOTSET", diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index b95dee1f0..cf5e77f24 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -1,25 +1,24 @@ -#include "minecraft/util/Log.h" -#include "platform/stubs.h" #include "AbstractTexturePack.h" - -#include #include +#include #include -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/IGameServices.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStreamReader.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" AbstractTexturePack::AbstractTexturePack(std::uint32_t id, File* file, const std::string& name, @@ -98,8 +97,7 @@ void AbstractTexturePack::load(Textures* textures) { } } -bool AbstractTexturePack::hasFile(const std::string& name, - bool allowFallback) { +bool AbstractTexturePack::hasFile(const std::string& name, bool allowFallback) { bool hasFile = this->hasFile(name); return !hasFile && (allowFallback && fallback != nullptr) @@ -139,7 +137,7 @@ std::string AbstractTexturePack::getAnimationString( // " + animationDefinitionFile); #if !defined(_CONTENT_PACKAGE) Log::info("Found animation info for: %s\n", - animationDefinitionFile.c_str()); + animationDefinitionFile.c_str()); #endif InputStreamReader isr(fileStream); BufferedReader br(&isr); @@ -165,7 +163,7 @@ BufferedImage* AbstractTexturePack::getImageResource( std::string pchTexture = File; std::string pchDrive = drive; Log::info("AbstractTexturePack::getImageResource - %s, drive is %s\n", - pchTexture.c_str(), pchDrive.c_str()); + pchTexture.c_str(), pchDrive.c_str()); return new BufferedImage(TexturePack::getResource("/" + File), filenameHasExtension, bTitleUpdateTexture, drive); @@ -216,7 +214,7 @@ void AbstractTexturePack::unloadUI() { std::string AbstractTexturePack::getXuiRootPath() { // const uintptr_t c_ModuleHandle = (uintptr_t)GetModuleHandle(nullptr); - const uintptr_t c_ModuleHandle = 0; // 4jcraft changed + const uintptr_t c_ModuleHandle = 0; // 4jcraft changed // Load new skin constexpr int LOCATOR_SIZE = diff --git a/targets/minecraft/client/skins/AbstractTexturePack.h b/targets/minecraft/client/skins/AbstractTexturePack.h index 33bf00a3f..9982b62e4 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.h +++ b/targets/minecraft/client/skins/AbstractTexturePack.h @@ -75,12 +75,12 @@ public: virtual std::string getWorldName(); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback); + const std::string& path, + bool allowFallback); protected: virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); + const std::string& path); void loadDefaultUI(); void loadDefaultColourTable(); void loadDefaultHTMLColourTable(); diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index cee737ec6..bf187631a 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DLCTexturePack.h" #include @@ -8,11 +6,7 @@ #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" #include "app/common/DLC/DLCFile.h" @@ -23,16 +17,22 @@ #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" #include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/locale/StringTable.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/client/BufferedImage.h" -#include "platform/fs/fs.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/AbstractTexturePack.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/locale/StringTable.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "platform/fs/fs.h" +#include "platform/input/input.h" +#include "platform/storage/storage.h" #if defined(_WINDOWS64) #include "app/windows/XML/ATGXmlParser.h" @@ -176,12 +176,12 @@ bool DLCTexturePack::hasFile(const std::string& name) { bool DLCTexturePack::isTerrainUpdateCompatible() { return true; } std::string DLCTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { return ""; } std::string DLCTexturePack::getAnimationString(const std::string& textureName, - const std::string& path) { + const std::string& path) { std::string result = ""; std::string fullpath = "res/" + path + textureName + ".png"; @@ -248,24 +248,24 @@ void DLCTexturePack::loadData() { if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); Log::info("Failed to mount texture pack DLC %d for pad %d\n", - mountIndex, PlatformInput.GetPrimaryPad()); + mountIndex, PlatformInput.GetPrimaryPad()); } else { m_bLoadingData = true; Log::info("Attempted to mount DLC data for texture pack %d\n", - mountIndex); + mountIndex); } } else { m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } std::string DLCTexturePack::getFilePath(std::uint32_t packId, - std::string filename, - bool bAddDataFolder) { + std::string filename, + bool bAddDataFolder) { return gameServices().getFilePath(packId, filename, bAddDataFolder); } @@ -277,8 +277,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, // corrupt DLC Log::info("Failed to mount DLC for pad %d: %u\n", iPad, dwErr); } else { - Log::info( - "Mounted DLC for texture pack, attempting to load data\n"); + Log::info("Mounted DLC for texture pack, attempting to load data\n"); texturePack->m_dlcDataPack = new DLCPack(texturePack->m_dlcInfoPack->getName(), dwLicenceMask); texturePack->setHasAudio(false); @@ -403,7 +402,8 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, texturePack->m_bHasLoadedData = true; if (gameServices().getLevelGenerationOptions()) gameServices().getLevelGenerationOptions()->setLoadedData(); - gameServices().setAction(PlatformInput.GetPrimaryPad(), eAppAction_ReloadTexturePack); + gameServices().setAction(PlatformInput.GetPrimaryPad(), + eAppAction_ReloadTexturePack); return 0; } diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index a7d8c067b..4c2d860d9 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -3,9 +3,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "AbstractTexturePack.h" #include "minecraft/locale/StringTable.h" +#include "platform/PlatformTypes.h" class DLCPack; class StringTable; @@ -27,7 +27,7 @@ public: using AbstractTexturePack::getResource; DLCTexturePack(std::uint32_t id, DLCPack* pack, TexturePack* fallback); - ~DLCTexturePack() {}; + ~DLCTexturePack(){}; virtual std::string getResource(const std::string& name); virtual DLCPack* getDLCPack(); @@ -58,9 +58,9 @@ public: // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); + const std::string& path); virtual BufferedImage* getImageResource(const std::string& File, bool filenameHasExtension = false, bool bTitleUpdateTexture = false, @@ -71,9 +71,9 @@ public: private: static std::string getRootPath(std::uint32_t packId, bool allowOverride, - bool bAddDataFolder); + bool bAddDataFolder); static std::string getFilePath(std::uint32_t packId, std::string filename, - bool bAddDataFolder = true); + bool bAddDataFolder = true); public: int onPackMounted(int iPad, std::uint32_t dwErr, diff --git a/targets/minecraft/client/skins/DefaultTexturePack.cpp b/targets/minecraft/client/skins/DefaultTexturePack.cpp index 7a344dcae..908018170 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.cpp +++ b/targets/minecraft/client/skins/DefaultTexturePack.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" - #include "DefaultTexturePack.h" #include #include #include "java/InputOutputStream/InputStream.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/skins/AbstractTexturePack.h" DefaultTexturePack::DefaultTexturePack() diff --git a/targets/minecraft/client/skins/DefaultTexturePack.h b/targets/minecraft/client/skins/DefaultTexturePack.h index 085b1d4ed..600b4fd34 100644 --- a/targets/minecraft/client/skins/DefaultTexturePack.h +++ b/targets/minecraft/client/skins/DefaultTexturePack.h @@ -22,7 +22,9 @@ public: bool hasFile(const std::string& name); bool isTerrainUpdateCompatible(); - std::string getDesc1() { return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); } + std::string getDesc1() { + return gameServices().getString(IDS_DEFAULT_TEXTUREPACK); + } protected: //@Override diff --git a/targets/minecraft/client/skins/FolderTexturePack.cpp b/targets/minecraft/client/skins/FolderTexturePack.cpp index aa62fd4bc..06718f5a5 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.cpp +++ b/targets/minecraft/client/skins/FolderTexturePack.cpp @@ -44,7 +44,7 @@ bool FolderTexturePack::hasFile(const std::string& name) { bool FolderTexturePack::isTerrainUpdateCompatible() { return true; } std::string FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFilename) { + const char* pchBDPatchFilename) { std::string wDrive; wDrive = "Common\\" + file->getPath() + "\\"; return wDrive; diff --git a/targets/minecraft/client/skins/FolderTexturePack.h b/targets/minecraft/client/skins/FolderTexturePack.h index 637ef54d8..c6e1715b8 100644 --- a/targets/minecraft/client/skins/FolderTexturePack.h +++ b/targets/minecraft/client/skins/FolderTexturePack.h @@ -28,7 +28,7 @@ public: // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/targets/minecraft/client/skins/TexturePack.cpp b/targets/minecraft/client/skins/TexturePack.cpp index c323e5fb2..2c0f38a2f 100644 --- a/targets/minecraft/client/skins/TexturePack.cpp +++ b/targets/minecraft/client/skins/TexturePack.cpp @@ -1,8 +1,7 @@ #include "TexturePack.h" -std::string TexturePack::getPath( - bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFileName /*= nullptr*/) { +std::string TexturePack::getPath(bool bTitleUpdateTexture /*= false*/, + const char* pchBDPatchFileName /*= nullptr*/) { std::string wDrive; if (bTitleUpdateTexture) { diff --git a/targets/minecraft/client/skins/TexturePack.h b/targets/minecraft/client/skins/TexturePack.h index 53727ff40..a959b0558 100644 --- a/targets/minecraft/client/skins/TexturePack.h +++ b/targets/minecraft/client/skins/TexturePack.h @@ -38,7 +38,7 @@ public: virtual std::string getResource( const std::string& name) // 4J - changed to just return a name rather - // than an input stream + // than an input stream { /* 4J - TODO return TexturePack.class.getResourceAsStream(name); @@ -49,13 +49,14 @@ return TexturePack.class.getResourceAsStream(name); // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); + const char* pchBDPatchFilename = nullptr); virtual std::string getAnimationString(const std::string& textureName, - const std::string& path, - bool allowFallback) = 0; - virtual BufferedImage* getImageResource( - const std::string& File, bool filenameHasExtension = false, - bool bTitleUpdateTexture = false, const std::string& drive = "") = 0; + const std::string& path, + bool allowFallback) = 0; + virtual BufferedImage* getImageResource(const std::string& File, + bool filenameHasExtension = false, + bool bTitleUpdateTexture = false, + const std::string& drive = "") = 0; virtual void loadColourTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index 37ad9b795..bfb56647e 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TexturePackRepository.h" #include @@ -7,17 +5,19 @@ #include #include -#include "platform/input/input.h" #include "DLCTexturePack.h" #include "DefaultTexturePack.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Minimap.h" #include "minecraft/client/skins/TexturePack.h" +#include "minecraft/util/Log.h" +#include "platform/input/input.h" TexturePack* TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr; @@ -63,14 +63,11 @@ bool TexturePackRepository::selectSkin(TexturePack* skin) { } void TexturePackRepository::selectWebSkin(const std::string& url) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } -void TexturePackRepository::downloadWebSkin(const std::string& url, - File file) { - Log::info( - "TexturePackRepository::selectWebSkin is not implemented\n"); +void TexturePackRepository::downloadWebSkin(const std::string& url, File file) { + Log::info("TexturePackRepository::selectWebSkin is not implemented\n"); } bool TexturePackRepository::isUsingWebSkin() { return usingWeb; } @@ -92,8 +89,7 @@ std::string TexturePackRepository::getIdOrNull(File file) { } std::vector TexturePackRepository::getWorkDirContents() { - Log::info( - "TexturePackRepository::getWorkDirContents is not implemented\n"); + Log::info("TexturePackRepository::getWorkDirContents is not implemented\n"); return std::vector(); } @@ -116,8 +112,7 @@ bool TexturePackRepository::shouldPromptForWebSkin() { } bool TexturePackRepository::canUseWebSkin() { - Log::info( - "TexturePackRepository::canUseWebSkin is not implemented\n"); + Log::info("TexturePackRepository::canUseWebSkin is not implemented\n"); return false; } @@ -151,7 +146,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { if (newPack->hasData()) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } else { newPack->loadData(); } @@ -162,12 +157,12 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { } bDidSelect = true; } else { - Log::info( - "Failed to select texture pack %d as it is not in the list\n", id); + Log::info("Failed to select texture pack %d as it is not in the list\n", + id); // Fail safely if (selectSkin(DEFAULT_TEXTURE_PACK)) { gameServices().setAction(PlatformInput.GetPrimaryPad(), - eAppAction_ReloadTexturePack); + eAppAction_ReloadTexturePack); } } return bDidSelect; @@ -199,10 +194,10 @@ TexturePack* TexturePackRepository::addTexturePackFromDLC(DLCPack* dlcPack, #if !defined(_CONTENT_PACKAGE) if (dlcPack->hasPurchasedFile(DLCManager::e_DLCType_TexturePack, "")) { printf("Added new FULL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } else { printf("Added new TRIAL DLCTexturePack: %s - id=%u\n", - dlcPack->getName().c_str(), parentId); + dlcPack->getName().c_str(), parentId); } #endif } diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index a7d547b22..43ca00fb9 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "platform/stubs.h" -#include "minecraft/util/Log.h" #include "TitleScreen.h" #include @@ -11,13 +8,12 @@ #include #include -#include "platform/renderer/renderer.h" -#include "minecraft/client/BufferedImage.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/client/BufferedImage.h" #include "minecraft/client/ClientConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" @@ -29,6 +25,10 @@ #include "minecraft/client/renderer/Textures.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/locale/Language.h" +#include "minecraft/util/Log.h" +#include "platform/renderer/renderer.h" +#include "platform/stubs.h" +#include "util/StringHelpers.h" Random* TitleScreen::random = new Random(); @@ -46,7 +46,8 @@ TitleScreen::TitleScreen() { std::string filename = "splashes.txt"; if (gameServices().hasArchiveFile(filename)) { - std::vector splashesArray = gameServices().getArchiveFile(filename); + std::vector splashesArray = + gameServices().getArchiveFile(filename); ByteArrayInputStream bais(splashesArray); InputStreamReader isr(&bais); BufferedReader br(&isr); @@ -122,9 +123,9 @@ if (c.get(Calendar.MONTH) + 1 == 11 && c.get(Calendar.DAY_OF_MONTH) == 9) { buttons.push_back(new Button(1, width / 2 - 100, topPos, language->getElement("menu.singleplayer"))); - buttons.push_back(multiplayerButton = new Button( - 2, width / 2 - 100, topPos + spacing * 1, - language->getElement("menu.multiplayer"))); + buttons.push_back(multiplayerButton = + new Button(2, width / 2 - 100, topPos + spacing * 1, + language->getElement("menu.multiplayer"))); buttons.push_back(new Button(3, width / 2 - 100, topPos + spacing * 2, language->getElement("menu.mods"))); diff --git a/targets/minecraft/commands/AdminLogCommand.h b/targets/minecraft/commands/AdminLogCommand.h index a20713570..3a36b2e75 100644 --- a/targets/minecraft/commands/AdminLogCommand.h +++ b/targets/minecraft/commands/AdminLogCommand.h @@ -8,9 +8,10 @@ class AdminLogCommand { public: static const int LOGTYPE_DONT_SHOW_TO_SELF = 1; - virtual void logAdminCommand( - std::shared_ptr source, int type, - ChatPacket::EChatPacketMessage messageType, - const std::string& message = "", int customData = -1, - const std::string& additionalMessage = "") = 0; + virtual void logAdminCommand(std::shared_ptr source, + int type, + ChatPacket::EChatPacketMessage messageType, + const std::string& message = "", + int customData = -1, + const std::string& additionalMessage = "") = 0; }; \ No newline at end of file diff --git a/targets/minecraft/commands/Command.h b/targets/minecraft/commands/Command.h index ae308e167..b82fb83f4 100644 --- a/targets/minecraft/commands/Command.h +++ b/targets/minecraft/commands/Command.h @@ -9,9 +9,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "CommandsEnum.h" #include "minecraft/network/packet/ChatPacket.h" +#include "platform/PlatformTypes.h" class AdminLogCommand; class CommandSender; diff --git a/targets/minecraft/commands/CommandDispatcher.cpp b/targets/minecraft/commands/CommandDispatcher.cpp index 3fd03819e..cd6bd826e 100644 --- a/targets/minecraft/commands/CommandDispatcher.cpp +++ b/targets/minecraft/commands/CommandDispatcher.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "CommandDispatcher.h" #include @@ -7,6 +6,7 @@ #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" int CommandDispatcher::performCommand(std::shared_ptr sender, EGameCommand command, diff --git a/targets/minecraft/commands/common/EnchantItemCommand.cpp b/targets/minecraft/commands/common/EnchantItemCommand.cpp index dee0c25d3..09b7f19e3 100644 --- a/targets/minecraft/commands/common/EnchantItemCommand.cpp +++ b/targets/minecraft/commands/common/EnchantItemCommand.cpp @@ -3,7 +3,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -17,6 +16,7 @@ #include "minecraft/world/item/enchantment/Enchantment.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "platform/PlatformTypes.h" EGameCommand EnchantItemCommand::getId() { return eGameCommand_EnchantItem; } diff --git a/targets/minecraft/commands/common/GiveItemCommand.cpp b/targets/minecraft/commands/common/GiveItemCommand.cpp index bf3165ff2..b62f300d4 100644 --- a/targets/minecraft/commands/common/GiveItemCommand.cpp +++ b/targets/minecraft/commands/common/GiveItemCommand.cpp @@ -2,7 +2,6 @@ #include -#include "platform/PlatformTypes.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -15,6 +14,7 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "platform/PlatformTypes.h" EGameCommand GiveItemCommand::getId() { return eGameCommand_Give; } diff --git a/targets/minecraft/core/DefaultDispenseItemBehavior.h b/targets/minecraft/core/DefaultDispenseItemBehavior.h index 65e221dda..76296aba2 100644 --- a/targets/minecraft/core/DefaultDispenseItemBehavior.h +++ b/targets/minecraft/core/DefaultDispenseItemBehavior.h @@ -23,8 +23,8 @@ protected: }; public: - DefaultDispenseItemBehavior() {}; - virtual ~DefaultDispenseItemBehavior() {}; + DefaultDispenseItemBehavior(){}; + virtual ~DefaultDispenseItemBehavior(){}; virtual std::shared_ptr dispense( BlockSource* source, std::shared_ptr dispensed); diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index 8939f5437..ef22049e6 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "ItemDispenseBehaviors.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/AbstractProjectileDispenseBehavior.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" @@ -135,7 +135,7 @@ std::shared_ptr SpawnEggDispenseBehavior::execute( return dispensed; } - if (entity->instanceof(eTYPE_MOB) && dispensed->hasCustomHoverName()) { + if (entity->instanceof (eTYPE_MOB) && dispensed->hasCustomHoverName()) { std::dynamic_pointer_cast(entity)->setCustomName( dispensed->getHoverName()); } diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index beffdcb91..6912b88cc 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -6,21 +6,21 @@ #include #include -#include "platform/ShutdownManager.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/KeepAlivePacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/PacketListener.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/ShutdownManager.h" +#include "util/StringHelpers.h" class SocketAddress; diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index 8fc94a926..918039003 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -8,12 +8,11 @@ #include #include "app/common/Network/Socket.h" -#include "platform/C4JThread.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" #include "minecraft/network/packet/DisconnectPacket.h" - +#include "platform/C4JThread.h" class DataInputStream; class DataOutputStream; diff --git a/targets/minecraft/network/INetworkService.h b/targets/minecraft/network/INetworkService.h index 916f31172..a0fb2b782 100644 --- a/targets/minecraft/network/INetworkService.h +++ b/targets/minecraft/network/INetworkService.h @@ -68,6 +68,5 @@ INetworkService& NetworkService_get(); } // namespace minecraft::network -#define NetworkService \ - (::minecraft::network::platform_internal:: \ - NetworkService_get()) +#define NetworkService \ + (::minecraft::network::platform_internal::NetworkService_get()) diff --git a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp index 7a2258570..bd885912b 100644 --- a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp +++ b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp @@ -24,7 +24,7 @@ AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr e) { x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - if (e->instanceof(eTYPE_LIGHTNINGBOLT)) { + if (e->instanceof (eTYPE_LIGHTNINGBOLT)) { type = LIGHTNING; } else { type = 0; diff --git a/targets/minecraft/network/packet/AddPlayerPacket.h b/targets/minecraft/network/packet/AddPlayerPacket.h index 240ee5737..90cbd7c85 100644 --- a/targets/minecraft/network/packet/AddPlayerPacket.h +++ b/targets/minecraft/network/packet/AddPlayerPacket.h @@ -6,10 +6,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/world/entity/SyncedEntityData.h" +#include "platform/PlatformTypes.h" class Player; diff --git a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp index 77f05c36c..52c625178 100644 --- a/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp +++ b/targets/minecraft/network/packet/BlockRegionUpdatePacket.cpp @@ -1,16 +1,16 @@ -#include "minecraft/util/Log.h" #include "BlockRegionUpdatePacket.h" #include #include #include "PacketListener.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #define BLOCK_REGION_UPDATE_FULLCHUNK 0x01 #define BLOCK_REGION_UPDATE_ZEROHEIGHT \ @@ -118,8 +118,7 @@ void BlockRegionUpdatePacket::read(DataInputStream* dis) // throws IOException Compression::getCompression()->DecompressLZXRLE( buffer.data(), &outputSize, compressedBuffer.data(), size); } else { - Log::info( - "Not decompressing packet that wasn't fully read\n"); + Log::info("Not decompressing packet that wasn't fully read\n"); } // printf("Block (%d %d %d), (%d %d %d) coming in decomp from %d to diff --git a/targets/minecraft/network/packet/CustomPayloadPacket.cpp b/targets/minecraft/network/packet/CustomPayloadPacket.cpp index 78ff7c704..563677e9e 100644 --- a/targets/minecraft/network/packet/CustomPayloadPacket.cpp +++ b/targets/minecraft/network/packet/CustomPayloadPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "CustomPayloadPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" // Mojang-defined custom packets const std::string CustomPayloadPacket::CUSTOM_BOOK_PACKET = "MC|BEdit"; diff --git a/targets/minecraft/network/packet/GameCommandPacket.cpp b/targets/minecraft/network/packet/GameCommandPacket.cpp index 0f05da553..bbb5a52e8 100644 --- a/targets/minecraft/network/packet/GameCommandPacket.cpp +++ b/targets/minecraft/network/packet/GameCommandPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "GameCommandPacket.h" #include @@ -7,6 +6,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/commands/CommandsEnum.h" +#include "minecraft/util/Log.h" GameCommandPacket::GameCommandPacket() { length = 0; } diff --git a/targets/minecraft/network/packet/LoginPacket.cpp b/targets/minecraft/network/packet/LoginPacket.cpp index 957240210..a4063e984 100644 --- a/targets/minecraft/network/packet/LoginPacket.cpp +++ b/targets/minecraft/network/packet/LoginPacket.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "LoginPacket.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/LoginPacket.h b/targets/minecraft/network/packet/LoginPacket.h index facc61ae7..a8938a4b3 100644 --- a/targets/minecraft/network/packet/LoginPacket.h +++ b/targets/minecraft/network/packet/LoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class LevelType; diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 5c9acb854..21256b114 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Packet.h" #include @@ -104,6 +103,7 @@ #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/UseItemPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "nbt/NbtIo.h" @@ -576,8 +576,8 @@ void Packet::writeUtf(const std::string& value, } std::string Packet::readUtf(DataInputStream* dis, - int maxLength) // throws IOException TODO 4J JEV, - // should this declare a throws? + int maxLength) // throws IOException TODO 4J JEV, + // should this declare a throws? { short stringLength = dis->readShort(); if (stringLength > maxLength) { @@ -674,9 +674,7 @@ std::shared_ptr Packet::readItem(DataInputStream* dis) { // 4J Stu - Always read/write the tag // if (Item.items[id].canBeDepleted() || // Item.items[id].shouldOverrideMultiplayerNBT()) - { - item->tag = readNbt(dis); - } + { item->tag = readNbt(dis); } } return item; @@ -693,9 +691,7 @@ void Packet::writeItem(std::shared_ptr item, // 4J Stu - Always read/write the tag // if (item.getItem().canBeDepleted() || // item.getItem().shouldOverrideMultiplayerNBT()) - { - writeNbt(item->tag, dos); - } + { writeNbt(item->tag, dos); } } } diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index 95e226d30..9a90c1c8c 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,7 +1,7 @@ -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #ifndef __linux__ diff --git a/targets/minecraft/network/packet/PreLoginPacket.cpp b/targets/minecraft/network/packet/PreLoginPacket.cpp index 7b6334e5b..83a4d44d6 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.cpp +++ b/targets/minecraft/network/packet/PreLoginPacket.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PreLoginPacket.h" #include #include -#include "minecraft/BuildVer.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/BuildVer.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" PreLoginPacket::PreLoginPacket() { loginKey = ""; diff --git a/targets/minecraft/network/packet/PreLoginPacket.h b/targets/minecraft/network/packet/PreLoginPacket.h index 14d47bb5e..35f5161a4 100644 --- a/targets/minecraft/network/packet/PreLoginPacket.h +++ b/targets/minecraft/network/packet/PreLoginPacket.h @@ -4,9 +4,9 @@ #include #include -#include "platform/PlatformTypes.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "platform/PlatformTypes.h" class PreLoginPacket : public Packet, public std::enable_shared_from_this { diff --git a/targets/minecraft/network/packet/RespawnPacket.cpp b/targets/minecraft/network/packet/RespawnPacket.cpp index 5302dc749..54e1e731d 100644 --- a/targets/minecraft/network/packet/RespawnPacket.cpp +++ b/targets/minecraft/network/packet/RespawnPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RespawnPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp index 80bc466de..bedb6c72a 100644 --- a/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp +++ b/targets/minecraft/network/packet/ServerSettingsChangedPacket.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "ServerSettingsChangedPacket.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" const int ServerSettingsChangedPacket::HOST_DIFFICULTY = 0; const int ServerSettingsChangedPacket::HOST_OPTIONS = 1; diff --git a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp index 8befc915a..ba2a003da 100644 --- a/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp +++ b/targets/minecraft/network/packet/SetPlayerTeamPacket.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SetPlayerTeamPacket.h" #include @@ -6,6 +5,7 @@ #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/scores/Objective.h" #include "minecraft/world/scores/PlayerTeam.h" diff --git a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp index 8b0834ed3..1f91ecde2 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryChangePacket.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/Minecraft_Macros.h" #include "PacketListener.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/world/entity/Entity.h" TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() { diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 3fe50e8b3..9f845a138 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -3,11 +3,11 @@ #include #include -#include "minecraft/Minecraft_Macros.h" -#include "app/common/DLC/DLCSkinFile.h" #include "PacketListener.h" +#include "app/common/DLC/DLCSkinFile.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Minecraft_Macros.h" TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = ""; diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 9f8735587..8b7548c9f 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/client/model/SkinBox.h" #include "Packet.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/client/model/geom/Model.h" #include "minecraft/network/packet/Packet.h" diff --git a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h index 754aa4877..971e7bdf5 100644 --- a/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h +++ b/targets/minecraft/network/packet/UpdateGameRuleProgressPacket.h @@ -6,9 +6,9 @@ #include #include -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "Packet.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" class UpdateGameRuleProgressPacket : public Packet, diff --git a/targets/minecraft/server/ConsoleInput.cpp b/targets/minecraft/server/ConsoleInput.cpp index b638904df..970ed5405 100644 --- a/targets/minecraft/server/ConsoleInput.cpp +++ b/targets/minecraft/server/ConsoleInput.cpp @@ -2,8 +2,7 @@ class ConsoleInputSource; -ConsoleInput::ConsoleInput(const std::string& msg, - ConsoleInputSource* source) { +ConsoleInput::ConsoleInput(const std::string& msg, ConsoleInputSource* source) { this->msg = msg; this->source = source; } \ No newline at end of file diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 68cb66bf9..3092f8a9f 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MinecraftServer.h" #include @@ -12,43 +10,41 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "ConsoleInput.h" #include "DispenserBootstrap.h" -#include "minecraft/GameEnums.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerList.h" #include "Settings.h" -#include "util/Timer.h" +#include "app/common/GameRules/GameRuleManager.h" #include "java/Class.h" #include "java/File.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Options.h" #include "minecraft/commands/Command.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/network/packet/SetTimePacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/DerivedServerLevel.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -61,17 +57,18 @@ #include "minecraft/world/level/storage/McRegionLevelStorage.h" #include "minecraft/world/level/storage/McRegionLevelStorageSource.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/PlatformTypes.h" +#include "platform/profile/profile.h" +#include "platform/storage/storage.h" #include "strings.h" +#include "util/Timer.h" #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "platform/input/input.h" -#include "platform/ShutdownManager.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/Network/Socket.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/renderer/GameRenderer.h" @@ -83,6 +80,9 @@ #include "minecraft/world/level/chunk/SparseDataStorage.h" #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" class ConsoleInputSource; @@ -151,22 +151,26 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, Log::info("\n*** SERVER SETTINGS ***\n"); Log::info( "ServerSettings: host-friends-only is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) ? "on" - : "off"); + (gameServices().getGameHostOption(eGameHostOption_FriendsOfFriends) > 0) + ? "on" + : "off"); Log::info("ServerSettings: game-type is %s\n", - (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) - ? "Survival Mode" - : "Creative Mode"); + (gameServices().getGameHostOption(eGameHostOption_GameType) == 0) + ? "Survival Mode" + : "Creative Mode"); + Log::info("ServerSettings: pvp is %s\n", + (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) + ? "on" + : "off"); Log::info( - "ServerSettings: pvp is %s\n", - (gameServices().getGameHostOption(eGameHostOption_PvP) > 0) ? "on" : "off"); - Log::info("ServerSettings: fire spreads is %s\n", - (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) - ? "on" - : "off"); - Log::info( - "ServerSettings: tnt explodes is %s\n", - (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) ? "on" : "off"); + "ServerSettings: fire spreads is %s\n", + (gameServices().getGameHostOption(eGameHostOption_FireSpreads) > 0) + ? "on" + : "off"); + Log::info("ServerSettings: tnt explodes is %s\n", + (gameServices().getGameHostOption(eGameHostOption_TNT) > 0) + ? "on" + : "off"); Log::info("\n"); // TODO 4J Stu - Init a load of settings based on data passed as params @@ -384,7 +388,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, LevelSettings* levelSettings = new LevelSettings( levelSeed, gameType, - gameServices().getGameHostOption(eGameHostOption_Structures) > 0 ? true : false, + gameServices().getGameHostOption(eGameHostOption_Structures) > 0 + ? true + : false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale); if (gameServices().getGameHostOption(eGameHostOption_BonusChest)) levelSettings->enableStartingBonusItems(); @@ -419,7 +425,8 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // We are loading a save from the storage manager #if defined(SPLIT_SAVES) bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (levelGen != nullptr && levelGen->requiresBaseSave()) { unsigned int fileSize = 0; std::uint8_t* pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -485,7 +492,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, levels[i]->difficulty = gameServices().getGameHostOption( eGameHostOption_Difficulty); // pMinecraft->options->difficulty; Log::info("MinecraftServer::loadLevel - Difficulty = %d\n", - levels[i]->difficulty); + levels[i]->difficulty); #if DEBUG_SERVER_DONT_SPAWN_MOBS levels[i]->setSpawnSettings(false, false); @@ -514,7 +521,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, eGameHostOption_HasBeenInCreative, gameType == GameType::CREATIVE || levels[0]->getHasBeenInCreative()); gameServices().setGameHostOption(eGameHostOption_Structures, - levels[0]->isGenerateMapFeatures()); + levels[0]->isGenerateMapFeatures()); if (s_bServerHalted || !NetworkService.IsInSession()) return false; @@ -559,10 +566,12 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, int64_t lastTime = System::currentTimeMillis(); #if defined(_LARGE_WORLDS) - if (gameServices().getGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld()) { - if (!gameServices().getGameNewWorldSizeUseMoat()) // check the moat settings to - // see if we should be - // overwriting the edge tiles + if (gameServices().getGameNewWorldSize() > + levels[0]->getLevelData()->getXZSizeOld()) { + if (!gameServices() + .getGameNewWorldSizeUseMoat()) // check the moat settings to + // see if we should be + // overwriting the edge tiles { overwriteBordersForNewWorldSize(levels[0]); } @@ -651,14 +660,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, if (!levels[0]->getLevelData()->getHasStronghold()) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { levels[0]->getLevelData()->setXStronghold(x); levels[0]->getLevelData()->setZStronghold(z); levels[0]->getLevelData()->setHasStronghold(); - Log::info( - "=== FOUND stronghold in terrain features list\n"); + Log::info("=== FOUND stronghold in terrain features list\n"); } else { // can't find the stronghold position in the terrain feature @@ -880,7 +888,7 @@ void MinecraftServer::Suspend() { m_suspending = false; Log::info("Suspend server: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); } bool MinecraftServer::IsSuspending() { return m_suspending; } @@ -888,9 +896,7 @@ bool MinecraftServer::IsSuspending() { return m_suspending; } void MinecraftServer::stopServer(bool didInit) { // 4J-PB - need to halt the rendering of the data, since we're about to // remove it - { - Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); - } + { Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); } connection->stop(); @@ -1078,8 +1084,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (pLevelData && pLevelData->getHasStronghold() == false) { int x, z; - if (gameServices().getTerrainFeaturePosition(eTerrainFeature_Stronghold, &x, - &z)) { + if (gameServices().getTerrainFeaturePosition( + eTerrainFeature_Stronghold, &x, &z)) { pLevelData->setXStronghold(x); pLevelData->setZStronghold(z); pLevelData->setHasStronghold(); @@ -1238,8 +1244,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { if (!id) break; std::shared_ptr player = players->players.at(0); - eINSTANCEOF factory = - static_cast(*id); + eINSTANCEOF factory = static_cast(*id); std::shared_ptr mob = std::dynamic_pointer_cast( EntityIO::newByEnumType(factory, @@ -1314,14 +1319,15 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { // UpdateProgressPacket(20) ) ); if (!s_bServerHalted) { - auto* owned = std::get_if< - std::unique_ptr>( - ¶m); + auto* owned = std::get_if>(¶m); ConsoleSchematicFile::XboxSchematicInitParam* - initData = owned ? dynamic_cast< - ConsoleSchematicFile::XboxSchematicInitParam*>( - owned->get()) - : nullptr; + initData = + owned ? dynamic_cast< + ConsoleSchematicFile:: + XboxSchematicInitParam*>( + owned->get()) + : nullptr; if (initData) { File targetFileDir("Schematics"); if (!targetFileDir.exists()) @@ -1338,7 +1344,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { File dataFile = File(targetFileDir, std::string(filename)); if (dataFile.exists()) dataFile._delete(); - FileOutputStream fos = FileOutputStream(dataFile); + FileOutputStream fos = + FileOutputStream(dataFile); DataOutputStream dos = DataOutputStream(&fos); ConsoleSchematicFile::generateSchematicFile( &dos, levels[0], initData->startX, @@ -1348,7 +1355,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { initData->compressionType); dos.close(); // owned unique_ptr is destroyed when the - // payload is overwritten on the next setXuiServerAction + // payload is overwritten on the next + // setXuiServerAction } } gameServices().unlockSaveNotification(); @@ -1618,11 +1626,11 @@ void MinecraftServer::chunkPacketManagement_PreTick() { s_tickStartTime = System::currentTimeMillis(); s_sentTo.clear(); - std::vector >* players = + std::vector>* players = connection->getPlayers(); if (players->size()) { - std::vector > playersOrig = *players; + std::vector> playersOrig = *players; players->clear(); do { @@ -1655,7 +1663,8 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer* player) { auto now = time_util::clock::now(); if (player->GetSessionIndex() == s_slowQueuePlayerIndex && - (now - s_slowQueueLastTime) > std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { + (now - s_slowQueueLastTime) > + std::chrono::milliseconds(MINECRAFT_SERVER_SLOW_QUEUE_DELAY)) { // Log::info("Slow queue OK for player #%d\n", // player->GetSessionIndex()); return true; @@ -1674,8 +1683,9 @@ void MinecraftServer::chunkPacketManagement_PostTick() { // 4J Ensure that the slow queue owner keeps cycling if it's not been used // in a while auto now = time_util::clock::now(); - if ((s_slowQueuePacketSent) || ((now - s_slowQueueLastTime) > - std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { + if ((s_slowQueuePacketSent) || + ((now - s_slowQueueLastTime) > + std::chrono::milliseconds(2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY))) { // Log::info("Considering cycling: (%d) %d - %d -> %d //> %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - // s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index de67ec84e..f7c9a746c 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -7,11 +7,11 @@ #include #include "ConsoleInputSource.h" -#include "platform/C4JThread.h" -#include "util/Timer.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "platform/C4JThread.h" +#include "util/Timer.h" class ServerConnection; class Settings; @@ -204,8 +204,7 @@ private: void tick(); public: - void handleConsoleInput(const std::string& msg, - ConsoleInputSource* source); + void handleConsoleInput(const std::string& msg, ConsoleInputSource* source); void handleConsoleInputs(); // void addTickable(Tickable tickable); // 4J removed static void main(int64_t seed, void* lpParameter); diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 3e0718f14..2cd52e4fb 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PlayerList.h" #include @@ -10,26 +8,21 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "MinecraftServer.h" +#include "Settings.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" -#include "platform/NetTypes.h" -#include "MinecraftServer.h" -#include "Settings.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "java/Class.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/GameEventPacket.h" @@ -45,6 +38,7 @@ #include "minecraft/network/packet/TexturePacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/XZPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/PlayerChunkMap.h" #include "minecraft/server/level/ServerChunkCache.h" @@ -54,6 +48,7 @@ #include "minecraft/server/network/PendingConnection.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/server/network/ServerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -61,10 +56,13 @@ #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/PortalForcer.h" @@ -74,6 +72,8 @@ #include "minecraft/world/level/storage/LevelStorage.h" #include "minecraft/world/level/storage/PlayerIO.h" #include "nbt/CompoundTag.h" +#include "platform/NetTypes.h" +#include "platform/profile/profile.h" #include "strings.h" class MobEffectInstance; @@ -206,9 +206,11 @@ void PlayerList::placeNewPlayer(Connection* connection, 0))); } } else if (!player->customTextureUrl.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl, nullptr, + 0); } if (!player->customTextureUrl2.empty() && @@ -226,9 +228,11 @@ void PlayerList::placeNewPlayer(Connection* connection, new TexturePacket(player->customTextureUrl2, nullptr, 0))); } } else if (!player->customTextureUrl2.empty() && - gameServices().isFileInMemoryTextures(player->customTextureUrl2)) { + gameServices().isFileInMemoryTextures( + player->customTextureUrl2)) { // Update the ref count on the memory texture data - gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, 0); + gameServices().addMemoryTextureFile(player->customTextureUrl2, nullptr, + 0); } player->setIsGuest(packet->m_isGuest); @@ -417,7 +421,7 @@ void PlayerList::validatePlayerSpawnPosition( // correct Make sure that the player is on the ground, and in the centre x/z // of the current column Log::info("Original pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + player->y, player->z, player->dimension); bool spawnForced = player->isRespawnForced(); @@ -437,15 +441,15 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(targetX, targetY, targetZ); - Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("New pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); ServerLevel* level = server->getLevel(player->dimension); while (level->getCubes(player, &player->bb)->size() != 0) { player->setPos(player->x, player->y + 1, player->z); } - Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, - player->y, player->z, player->dimension); + Log::info("Final pos is %f, %f, %f in dimension %d\n", player->x, player->y, + player->z, player->dimension); // 4J Stu - If we are in the nether and the above while loop has put us // above the nether then we have a problem Finding a valid, safe spawn point @@ -485,8 +489,8 @@ void PlayerList::validatePlayerSpawnPosition( player->setPos(player->x, player->y + 1, player->z); } - Log::info("Updated pos is %f, %f, %f in dimension %d\n", - player->x, player->y, player->z, player->dimension); + Log::info("Updated pos is %f, %f, %f in dimension %d\n", player->x, + player->y, player->z, player->dimension); } } @@ -1165,7 +1169,8 @@ bool PlayerList::isWhiteListed(const std::string& name) { return true; } bool PlayerList::isOp(const std::string& name) { return false; } bool PlayerList::isOp(std::shared_ptr player) { - bool cheatsEnabled = gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); + bool cheatsEnabled = + gameServices().getGameHostOption(eGameHostOption_CheatsEnabled); #if defined(_DEBUG_MENUS_ENABLED) cheatsEnabled = cheatsEnabled || gameServices().getUseDPadForDebug(); #endif @@ -1231,8 +1236,7 @@ std::vector* PlayerList::getPlayers( Pos* position, int rangeMin, int rangeMax, int count, int mode, int levelMin, int levelMax, std::unordered_map* scoreRequirements, - const std::string& playerName, const std::string& teamName, - Level* level) { + const std::string& playerName, const std::string& teamName, Level* level) { Log::info("getPlayers NOT IMPLEMENTED!"); return nullptr; @@ -1523,7 +1527,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, #if !defined(_CONTENT_PACKAGE) Log::info("Requesting remove player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + player->name.c_str(), dimIndex); #endif bool playerRemoved = false; @@ -1531,9 +1535,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) - Log::info( - "Remove: Removing player %s as primary in dimension %d\n", - player->name.c_str(), dimIndex); + Log::info("Remove: Removing player %s as primary in dimension %d\n", + player->name.c_str(), dimIndex); #endif receiveAllPlayers[dimIndex].erase(it); playerRemoved = true; @@ -1615,7 +1618,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { #if !defined(_CONTENT_PACKAGE) Log::info("Requesting add player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif bool shouldAddPlayer = true; @@ -1646,7 +1649,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { if (shouldAddPlayer) { #if !defined(_CONTENT_PACKAGE) Log::info("Add: Adding player %s as primary in dimension %d\n", - player->name.c_str(), playerDim); + player->name.c_str(), playerDim); #endif receiveAllPlayers[playerDim].push_back(player); } diff --git a/targets/minecraft/server/PlayerList.h b/targets/minecraft/server/PlayerList.h index 401c89ba1..3493c4087 100644 --- a/targets/minecraft/server/PlayerList.h +++ b/targets/minecraft/server/PlayerList.h @@ -8,8 +8,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ServerPlayer; class PlayerChunkMap; diff --git a/targets/minecraft/server/ServerInterface.h b/targets/minecraft/server/ServerInterface.h index 29c42ae7b..d23f8a250 100644 --- a/targets/minecraft/server/ServerInterface.h +++ b/targets/minecraft/server/ServerInterface.h @@ -3,7 +3,7 @@ class ServerInterface { virtual int getConfigInt(const std::string& name, int defaultValue) = 0; virtual std::string getConfigString(const std::string& name, - const std::string& defaultValue) = 0; + const std::string& defaultValue) = 0; virtual bool getConfigBoolean(const std::string& name, bool defaultValue) = 0; virtual void setProperty(std::string& propertyName, void* value) = 0; diff --git a/targets/minecraft/server/Settings.cpp b/targets/minecraft/server/Settings.cpp index 39ac1c996..107746d92 100644 --- a/targets/minecraft/server/Settings.cpp +++ b/targets/minecraft/server/Settings.cpp @@ -10,7 +10,7 @@ void Settings::generateNewProperties() {} void Settings::saveProperties() {} std::string Settings::getString(const std::string& key, - const std::string& defaultValue) { + const std::string& defaultValue) { if (properties.find(key) == properties.end()) { properties[key] = defaultValue; saveProperties(); diff --git a/targets/minecraft/server/Settings.h b/targets/minecraft/server/Settings.h index b74af9621..9a184dbbc 100644 --- a/targets/minecraft/server/Settings.h +++ b/targets/minecraft/server/Settings.h @@ -18,7 +18,7 @@ public: void generateNewProperties(); void saveProperties(); std::string getString(const std::string& key, - const std::string& defaultValue); + const std::string& defaultValue); int getInt(const std::string& key, int defaultValue); bool getBoolean(const std::string& key, bool defaultValue); void setBooleanAndSave(const std::string& key, bool value); diff --git a/targets/minecraft/server/commands/TeleportCommand.h b/targets/minecraft/server/commands/TeleportCommand.h index 7eb654cd6..2d3c7c150 100644 --- a/targets/minecraft/server/commands/TeleportCommand.h +++ b/targets/minecraft/server/commands/TeleportCommand.h @@ -4,10 +4,10 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/commands/Command.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/packet/GameCommandPacket.h" +#include "platform/PlatformTypes.h" class TeleportCommand : public Command { public: diff --git a/targets/minecraft/server/level/CreativeMode.cpp b/targets/minecraft/server/level/CreativeMode.cpp index 200ddf34b..3d4929eea 100644 --- a/targets/minecraft/server/level/CreativeMode.cpp +++ b/targets/minecraft/server/level/CreativeMode.cpp @@ -4,11 +4,6 @@ #include "minecraft/client/User.h" #include "minecraft/client/player/LocalPlayer.h" - - - - - CreativeMode::CreativeMode(Minecraft* minecraft) : GameMode(minecraft) { destroyDelay = 0; instaBuild = true; diff --git a/targets/minecraft/server/level/DemoMode.cpp b/targets/minecraft/server/level/DemoMode.cpp index 5caa2ed0f..43939df2c 100644 --- a/targets/minecraft/server/level/DemoMode.cpp +++ b/targets/minecraft/server/level/DemoMode.cpp @@ -1,8 +1,6 @@ #include "DemoMode.h" - - DemoMode::DemoMode(Minecraft* minecraft) : SurvivalMode(minecraft) { demoHasEnded = false; demoEndedReminder = 0; diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 2a47cf946..6a3f3e1bd 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -7,11 +7,11 @@ #include #include -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayer.h" #include "TrackedEntity.h" #include "java/Class.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -26,7 +26,7 @@ EntityTracker::EntityTracker(ServerLevel* level) { } void EntityTracker::addEntity(std::shared_ptr e) { - if (e->instanceof(eTYPE_SERVERPLAYER)) { + if (e->instanceof (eTYPE_SERVERPLAYER)) { addEntity(e, 32 * 16, 2); std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -35,57 +35,57 @@ void EntityTracker::addEntity(std::shared_ptr e) { (*it)->updatePlayer(this, player); } } - } else if (e->instanceof(eTYPE_FISHINGHOOK)) + } else if (e->instanceof (eTYPE_FISHINGHOOK)) addEntity(e, 16 * 4, 5, true); - else if (e->instanceof(eTYPE_SMALL_FIREBALL)) + else if (e->instanceof (eTYPE_SMALL_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof(eTYPE_DRAGON_FIREBALL)) + else if (e->instanceof (eTYPE_DRAGON_FIREBALL)) addEntity(e, 16 * 4, 10, false); // 4J Added TU9 - else if (e->instanceof(eTYPE_ARROW)) + else if (e->instanceof (eTYPE_ARROW)) addEntity(e, 16 * 4, 20, false); - else if (e->instanceof(eTYPE_FIREBALL)) + else if (e->instanceof (eTYPE_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof(eTYPE_SNOWBALL)) + else if (e->instanceof (eTYPE_SNOWBALL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNENDERPEARL)) + else if (e->instanceof (eTYPE_THROWNENDERPEARL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) + else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) addEntity(e, 16 * 4, 4, true); - else if (e->instanceof(eTYPE_THROWNEGG)) + else if (e->instanceof (eTYPE_THROWNEGG)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNPOTION)) + else if (e->instanceof (eTYPE_THROWNPOTION)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) + else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) + else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof(eTYPE_ITEMENTITY)) + else if (e->instanceof (eTYPE_ITEMENTITY)) addEntity(e, 16 * 4, 20, true); - else if (e->instanceof(eTYPE_MINECART)) + else if (e->instanceof (eTYPE_MINECART)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_BOAT)) + else if (e->instanceof (eTYPE_BOAT)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_SQUID)) + else if (e->instanceof (eTYPE_SQUID)) addEntity(e, 16 * 4, 3, true); - else if (e->instanceof(eTYPE_WITHERBOSS)) + else if (e->instanceof (eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 3, false); - else if (e->instanceof(eTYPE_BAT)) + else if (e->instanceof (eTYPE_BAT)) addEntity(e, 16 * 5, 3, false); else if (std::dynamic_pointer_cast(e) != nullptr) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof(eTYPE_ENDERDRAGON)) + else if (e->instanceof (eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 3, true); - else if (e->instanceof(eTYPE_PRIMEDTNT)) + else if (e->instanceof (eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); - else if (e->instanceof(eTYPE_FALLINGTILE)) + else if (e->instanceof (eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof(eTYPE_HANGING_ENTITY)) + else if (e->instanceof (eTYPE_HANGING_ENTITY)) addEntity(e, 16 * 10, INT_MAX, false); - else if (e->instanceof(eTYPE_EXPERIENCEORB)) + else if (e->instanceof (eTYPE_EXPERIENCEORB)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) + else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) addEntity(e, 16 * 16, INT_MAX, false); - else if (e->instanceof(eTYPE_ITEM_FRAME)) + else if (e->instanceof (eTYPE_ITEM_FRAME)) addEntity(e, 16 * 10, INT_MAX, false); } diff --git a/targets/minecraft/server/level/GameMode.cpp b/targets/minecraft/server/level/GameMode.cpp index 23eb4c5d6..18d881a84 100644 --- a/targets/minecraft/server/level/GameMode.cpp +++ b/targets/minecraft/server/level/GameMode.cpp @@ -4,13 +4,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - - - - GameMode::GameMode(Minecraft* minecraft) { instaBuild = false; // 4J - added this->minecraft = minecraft; diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index 2505f2251..e5f96814e 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "PlayerChunkMap.h" #include @@ -10,20 +9,21 @@ #include #include -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerChunkCache.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" #include "minecraft/network/packet/ChunkTilesUpdatePacket.h" #include "minecraft/network/packet/ChunkVisibilityAreaPacket.h" #include "minecraft/network/packet/ChunkVisibilityPacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/TileUpdatePacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index 6ba4cefbe..c7e35790a 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" -#include #include "ServerChunkCache.h" #include @@ -7,11 +5,12 @@ #include #include +#include -#include "minecraft/IGameServices.h" #include "ServerLevel.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/IGameServices.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -21,6 +20,7 @@ #include "minecraft/world/level/chunk/storage/ChunkStorage.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, @@ -104,9 +104,7 @@ void ServerChunkCache::drop(int x, int z) { //} // } // else - { - canDrop = true; - } + { canDrop = true; } if (canDrop) { int ix = x + XZOFFSET; int iz = z + XZOFFSET; @@ -817,7 +815,7 @@ bool ServerChunkCache::shouldSave() { return !level->noSave; } std::string ServerChunkCache::gatherStats() { return "ServerChunkCache: "; // + toWString(loadedChunks.size()) + " - // Drop: " + toWString(toDrop.size()); + // Drop: " + toWString(toDrop.size()); } std::vector* ServerChunkCache::getMobsAt( @@ -825,8 +823,9 @@ std::vector* ServerChunkCache::getMobsAt( return source->getMobsAt(mobCategory, x, y, z); } -TilePos* ServerChunkCache::findNearestMapFeature( - Level* level, const std::string& featureName, int x, int y, int z) { +TilePos* ServerChunkCache::findNearestMapFeature(Level* level, + const std::string& featureName, + int x, int y, int z) { return source->findNearestMapFeature(level, featureName, x, y, z); } diff --git a/targets/minecraft/server/level/ServerChunkCache.h b/targets/minecraft/server/level/ServerChunkCache.h index 86cb3a6eb..12554b626 100644 --- a/targets/minecraft/server/level/ServerChunkCache.h +++ b/targets/minecraft/server/level/ServerChunkCache.h @@ -5,14 +5,12 @@ #include #include -#include "platform/C4JThread.h" #include "java/File.h" #include "java/JavaIntHash.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/levelgen/RandomLevelSource.h" - - +#include "platform/C4JThread.h" class ServerLevel; class ChunkStorage; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index f0a1cc5a0..ce522df1b 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerLevel.h" #include @@ -7,21 +5,18 @@ #include #include -#include "platform/input/input.h" -#include "platform/storage/storage.h" #include "EntityTracker.h" -#include "platform/ShutdownManager.h" -#include "minecraft/Console_Debug_enum.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "PlayerChunkMap.h" #include "Pos.h" #include "ServerChunkCache.h" #include "ServerLevelListener.h" #include "ServerPlayer.h" +#include "app/common/DLC/DLCManager.h" +#include "app/common/DLC/DLCPack.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" @@ -31,10 +26,12 @@ #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/LevelParticlesPacket.h" #include "minecraft/network/packet/TileEventPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerScoreboard.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/util/ProgressListener.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/util/WeighedTreasure.h" @@ -65,6 +62,9 @@ #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/ShutdownManager.h" +#include "platform/input/input.h" +#include "platform/storage/storage.h" #include "strings.h" class ChunkStorage; @@ -227,15 +227,9 @@ ServerLevel::~ServerLevel() { } // Make sure that the update thread isn't actually doing any updating - { - std::lock_guard lock(m_updateCS[0]); - } - { - std::lock_guard lock(m_updateCS[1]); - } - { - std::lock_guard lock(m_updateCS[2]); - } + { std::lock_guard lock(m_updateCS[0]); } + { std::lock_guard lock(m_updateCS[1]); } + { std::lock_guard lock(m_updateCS[2]); } m_updateTrigger->clearAll(); } @@ -762,7 +756,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && - (e->instanceof(eTYPE_ANIMAL) || e->instanceof(eTYPE_WATERANIMAL))) { + (e->instanceof (eTYPE_ANIMAL) || e->instanceof (eTYPE_WATERANIMAL))) { e->remove(); } if (!server->isNpcsEnabled() && @@ -850,8 +844,7 @@ void ServerLevel::setInitialSpawn(LevelSettings* levelSettings) { zSpawn = findBiome->z; delete findBiome; } else { - Log::info( - "Level::setInitialSpawn - Unable to find spawn biome\n"); + Log::info("Level::setInitialSpawn - Unable to find spawn biome\n"); } int tries = 0; @@ -1248,7 +1241,7 @@ void ServerLevel::runQueuedSendTileUpdates() { // removed and added so we can limit the number of itementities created bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1259,7 +1252,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an hanging entity, and we've got to our capacity, delete the // oldest - else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + else if (e->instanceof (eTYPE_HANGING_ENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1274,7 +1267,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } } // If its an arrow entity, and we've got to our capacity, delete the oldest - else if (e->instanceof(eTYPE_ARROW)) { + else if (e->instanceof (eTYPE_ARROW)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1285,7 +1278,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an experience orb entity, and we've got to our capacity, delete // the oldest - else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + else if (e->instanceof (eTYPE_EXPERIENCEORB)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1304,16 +1297,16 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { bool atLimit = false; - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_itemEntities.size() >= MAX_ITEM_ENTITIES; - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_hangingEntities.size() >= MAX_HANGING_ENTITIES; - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); atLimit = m_arrowEntities.size() >= MAX_ARROW_ENTITIES; - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); atLimit = m_experienceOrbEntities.size() >= MAX_EXPERIENCEORB_ENTITIES; } @@ -1323,30 +1316,30 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level void ServerLevel::entityAddedExtra(std::shared_ptr e) { - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); m_itemEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); m_hangingEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); m_arrowEntities.push_back(e); // printf("entity added: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); m_experienceOrbEntities.push_back(e); // printf("entity added: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount++; - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount++; } @@ -1355,7 +1348,7 @@ void ServerLevel::entityAddedExtra(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level, and remove any // item entities from our list void ServerLevel::entityRemovedExtra(std::shared_ptr e) { - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1366,7 +1359,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1377,7 +1370,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: arrow entity count //%d\n",m_arrowEntities.size()); @@ -1388,7 +1381,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); @@ -1400,10 +1393,10 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount--; - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount--; } diff --git a/targets/minecraft/server/level/ServerLevel.h b/targets/minecraft/server/level/ServerLevel.h index 8407324b6..8490d3910 100644 --- a/targets/minecraft/server/level/ServerLevel.h +++ b/targets/minecraft/server/level/ServerLevel.h @@ -12,14 +12,13 @@ #include #include "SharedConstants.h" -#include "platform/C4JThread.h" #include "java/JavaIntHash.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TickNextTickData.h" #include "minecraft/world/level/TileEventData.h" #include "minecraft/world/level/biome/Biome.h" - +#include "platform/C4JThread.h" class ServerChunkCache; class MinecraftServer; diff --git a/targets/minecraft/server/level/ServerLevelListener.cpp b/targets/minecraft/server/level/ServerLevelListener.cpp index 23bec4f7a..5c342e89f 100644 --- a/targets/minecraft/server/level/ServerLevelListener.cpp +++ b/targets/minecraft/server/level/ServerLevelListener.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ServerLevelListener.h" #include @@ -15,6 +14,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 8bd0d39e5..da588f35a 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerPlayer.h" #include @@ -10,12 +8,7 @@ #include #include -#include "platform/input/input.h" #include "EntityTracker.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerLevel.h" #include "ServerPlayerGameMode.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -24,10 +17,13 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/AwardStatPacket.h" #include "minecraft/network/packet/BlockRegionUpdatePacket.h" @@ -49,11 +45,13 @@ #include "minecraft/network/packet/SetHealthPacket.h" #include "minecraft/network/packet/TileEditorOpenPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -90,6 +88,7 @@ #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/GameRules.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/biome/Biome.h" @@ -108,6 +107,7 @@ #include "minecraft/world/scores/Scoreboard.h" #include "minecraft/world/scores/criteria/ObjectiveCriteria.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" #include "strings.h" class Objective; @@ -450,8 +450,8 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { if (dontDelayChunks || (canSendToPlayer && (connection->countDelayedPackets() < 4) && - (NetworkService.GetHostPlayer() - ->GetSendQueueSizeMessages(nullptr, true) < 4) && + (NetworkService.GetHostPlayer()->GetSendQueueSizeMessages( + nullptr, true) < 4) && //(tickCount - lastBrupSendTickCount) > //(connection->getNetworkPlayer()->GetCurrentRtt()>>4) && !connection->done)) { @@ -716,19 +716,20 @@ bool ServerPlayer::hurt(DamageSource* dmgSource, float dmg) { // sometimes nullptr. std::shared_ptr source = dmgSource->getDirectEntity(); - if (source->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(source)->canHarmPlayer( - std::dynamic_pointer_cast(shared_from_this()))) { + if (source->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(source)->canHarmPlayer( + std::dynamic_pointer_cast(shared_from_this()))) { return false; } - if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); - if ((arrow->owner != nullptr) && - arrow->owner->instanceof(eTYPE_PLAYER) && - !canHarmPlayer( - std::dynamic_pointer_cast(arrow->owner))) { + if ((arrow->owner != nullptr) && arrow->owner->instanceof + (eTYPE_PLAYER) && + !canHarmPlayer( + std::dynamic_pointer_cast(arrow->owner))) { return false; } } @@ -780,8 +781,7 @@ void ServerPlayer::changeDimension(int i) { true; // We only flag this for the player in the portal connection->send(std::make_shared( GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex())); - Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + Log::info("Sending packet to %d\n", thisPlayer->GetUserIndex()); } if (thisPlayer != nullptr) { for (auto it = MinecraftServer::getInstance() @@ -802,7 +802,7 @@ void ServerPlayer::changeDimension(int i) { new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex()))); Log::info("Sending packet to %d\n", - thisPlayer->GetUserIndex()); + thisPlayer->GetUserIndex()); } } } @@ -978,8 +978,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) { if (containerMenu == inventoryMenu) { nextContainerCounter(); connection->send(std::make_shared( - containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, - false)); + containerCounter, ContainerOpenPacket::REPAIR_TABLE, "", 9, false)); containerMenu = new AnvilMenu( inventory, level, x, y, z, std::dynamic_pointer_cast(shared_from_this())); diff --git a/targets/minecraft/server/level/ServerPlayer.h b/targets/minecraft/server/level/ServerPlayer.h index aea142f5d..86948418c 100644 --- a/targets/minecraft/server/level/ServerPlayer.h +++ b/targets/minecraft/server/level/ServerPlayer.h @@ -13,8 +13,6 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/net.minecraft.world.inventory.ContainerListener.h" - - #include "minecraft/world/level/ChunkPos.h" class PlayerConnection; @@ -64,8 +62,8 @@ private: int lastBrupSendTickCount; // 4J Added public: - ServerPlayer(MinecraftServer* server, Level* level, - const std::string& name, ServerPlayerGameMode* gameMode); + ServerPlayer(MinecraftServer* server, Level* level, const std::string& name, + ServerPlayerGameMode* gameMode); ~ServerPlayer(); void flagEntitiesToBeRemoved(unsigned int* flags, bool* removedFound); // 4J added @@ -131,7 +129,7 @@ public: virtual bool openFireworks(int x, int y, int z); // 4J added virtual bool startEnchanting( int x, int y, int z, const std::string& name); // 4J added bool return - virtual bool startRepairing(int x, int y, int z); // 4J added bool return + virtual bool startRepairing(int x, int y, int z); // 4J added bool return virtual bool openContainer( std::shared_ptr container); // 4J added bool return virtual bool openHopper(std::shared_ptr container); diff --git a/targets/minecraft/server/level/ServerPlayerGameMode.cpp b/targets/minecraft/server/level/ServerPlayerGameMode.cpp index c1dcad91c..bad2c2790 100644 --- a/targets/minecraft/server/level/ServerPlayerGameMode.cpp +++ b/targets/minecraft/server/level/ServerPlayerGameMode.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "ServerPlayerGameMode.h" #include -#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "ServerLevel.h" #include "ServerPlayer.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/renderer/LevelRenderer.h" @@ -16,6 +15,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/WeaponItem.h" +#include "minecraft/world/level/GameRules/GameRulesInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/LevelChunk.h" diff --git a/targets/minecraft/server/level/SurvivalMode.cpp b/targets/minecraft/server/level/SurvivalMode.cpp index 9105d2259..0edcd73b4 100644 --- a/targets/minecraft/server/level/SurvivalMode.cpp +++ b/targets/minecraft/server/level/SurvivalMode.cpp @@ -6,10 +6,6 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" - - - - SurvivalMode::SurvivalMode(Minecraft* minecraft) : GameMode(minecraft) { // 4J - added initialisers xDestroyBlock = -1; diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index 2f8162e82..47bfb3a04 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "TrackedEntity.h" #include @@ -9,9 +8,7 @@ #include #include -#include "platform/PlatformTypes.h" #include "EntityTracker.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "ServerPlayer.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" @@ -32,9 +29,11 @@ #include "minecraft/network/packet/TeleportEntityPacket.h" #include "minecraft/network/packet/UpdateAttributesPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Creature.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/ExperienceOrb.h" @@ -56,6 +55,7 @@ #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" +#include "platform/PlatformTypes.h" class AttributeInstance; class MobEffectInstance; @@ -191,8 +191,8 @@ void TrackedEntity::tick(EntityTracker* tracker, // FallingTile depends on this because it removes its source block // in the first tick() - if (tickCount > 0 || e->instanceof(eTYPE_ARROW) || - e->instanceof(eTYPE_PLAYER)) // 4J: Modifed, see above + if (tickCount > 0 || e->instanceof (eTYPE_ARROW) || e->instanceof + (eTYPE_PLAYER)) // 4J: Modifed, see above { if (xa < -128 || xa >= 128 || ya < -128 || ya >= 128 || za < -128 || za >= 128 || @@ -385,7 +385,7 @@ void TrackedEntity::sendDirtyEntityData() { new SetEntityDataPacket(e->entityId, entityData, false))); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -470,10 +470,9 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { std::vector > sentTo; broadcast(packet); - std::shared_ptr sp = - e->instanceof(eTYPE_SERVERPLAYER) - ? std::dynamic_pointer_cast(e) - : nullptr; + std::shared_ptr sp = e->instanceof + (eTYPE_SERVERPLAYER) ? std::dynamic_pointer_cast(e) + : nullptr; if (sp != nullptr && sp->connection) { sp->connection->send(packet); } @@ -595,7 +594,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, yap = e->yd; zap = e->zd; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr plr = std::dynamic_pointer_cast(e); Log::info( "TrackedEntity:: Player '%s' is now visible to player '%s', " @@ -613,7 +612,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, e->entityId, e->getEntityData(), true)); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -637,14 +636,16 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, sp->connection->send(std::make_shared( SetEntityLinkPacket::RIDING, e, e->riding)); } - if (e->instanceof(eTYPE_MOB) && - std::dynamic_pointer_cast(e)->getLeashHolder() != nullptr) { + if (e->instanceof + (eTYPE_MOB) && + std::dynamic_pointer_cast(e)->getLeashHolder() != + nullptr) { sp->connection->send(std::make_shared( SetEntityLinkPacket::LEASH, e, std::dynamic_pointer_cast(e)->getLeashHolder())); } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { for (int i = 0; i < 5; i++) { std::shared_ptr item = std::dynamic_pointer_cast(e)->getCarried(i); @@ -654,7 +655,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr spe = std::dynamic_pointer_cast(e); if (spe->isSleeping()) { sp->connection->send( @@ -666,7 +667,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); std::vector* activeEffects = @@ -712,7 +713,7 @@ void TrackedEntity::updatePlayers( std::shared_ptr TrackedEntity::getAddEntityPacket() { if (e->removed) { Log::info("Fetching addPacket for removed entity - %s\n", - e->getAName().c_str()); + e->getAName().c_str()); } // 4J-PB - replacing with a switch, rather than tons of ifs @@ -723,12 +724,12 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { xp, yp, zp, yHeadRotp)); } - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { std::shared_ptr packet = std::make_shared(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp); return packet; - } else if (e->instanceof(eTYPE_SERVERPLAYER)) { + } else if (e->instanceof (eTYPE_SERVERPLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -743,55 +744,55 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { // degrees. return std::make_shared( player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp); - } else if (e->instanceof(eTYPE_MINECART)) { + } else if (e->instanceof (eTYPE_MINECART)) { std::shared_ptr minecart = std::dynamic_pointer_cast(e); return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp)); - } else if (e->instanceof(eTYPE_BOAT)) { + } else if (e->instanceof (eTYPE_BOAT)) { return std::make_shared(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ENDERDRAGON)) { + } else if (e->instanceof (eTYPE_ENDERDRAGON)) { yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp)); - } else if (e->instanceof(eTYPE_FISHINGHOOK)) { + } else if (e->instanceof (eTYPE_FISHINGHOOK)) { std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; return std::make_shared( e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; return std::make_shared( e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_SNOWBALL)) { + } else if (e->instanceof (eTYPE_SNOWBALL)) { return std::make_shared(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNPOTION)) { + } else if (e->instanceof (eTYPE_THROWNPOTION)) { return std::make_shared( e, AddEntityPacket::THROWN_POTION, ((std::dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) { + } else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) { return std::make_shared( e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_THROWNENDERPEARL)) { + } else if (e->instanceof (eTYPE_THROWNENDERPEARL)) { return std::make_shared( e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) { + } else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) { return std::make_shared( e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) { + } else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) { return std::make_shared(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FIREBALL)) { + } else if (e->instanceof (eTYPE_FIREBALL)) { eINSTANCEOF classType = e->GetType(); int type = AddEntityPacket::FIREBALL; if (classType == eTYPE_SMALL_FIREBALL) { @@ -815,25 +816,25 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { aep->ya = (int)(fb->yPower * 8000); aep->za = (int)(fb->zPower * 8000); return aep; - } else if (e->instanceof(eTYPE_THROWNEGG)) { + } else if (e->instanceof (eTYPE_THROWNEGG)) { return std::make_shared(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_PRIMEDTNT)) { + } else if (e->instanceof (eTYPE_PRIMEDTNT)) { return std::make_shared(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) { + } else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) { return std::make_shared( e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_FALLINGTILE)) { + } else if (e->instanceof (eTYPE_FALLINGTILE)) { std::shared_ptr ft = std::dynamic_pointer_cast(e); return std::make_shared(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof(eTYPE_PAINTING)) { + } else if (e->instanceof (eTYPE_PAINTING)) { return std::shared_ptr( new AddPaintingPacket(std::dynamic_pointer_cast(e))); - } else if (e->instanceof(eTYPE_ITEM_FRAME)) { + } else if (e->instanceof (eTYPE_ITEM_FRAME)) { std::shared_ptr frame = std::dynamic_pointer_cast(e); @@ -852,7 +853,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor(frame->yTile * 32.0f); packet->z = std::floor(frame->zTile * 32.0f); return packet; - } else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) { + } else if (e->instanceof (eTYPE_LEASHFENCEKNOT)) { std::shared_ptr knot = std::dynamic_pointer_cast(e); std::shared_ptr packet = @@ -862,7 +863,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor((float)knot->yTile * 32); packet->z = std::floor((float)knot->zTile * 32); return packet; - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { return std::shared_ptr( new AddExperienceOrbPacket( std::dynamic_pointer_cast(e))); diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 0a27fa3a1..7c1c257c3 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PendingConnection.h" #include @@ -7,23 +5,25 @@ #include #include -#include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/NetTypes.h" #include "PlayerConnection.h" #include "ServerConnection.h" #include "java/Random.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/LoginPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/storage/storage.h" class Packet; // #if 0 @@ -77,7 +77,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason) { void PendingConnection::handlePreLogin(std::shared_ptr packet) { if (packet->m_netcodeVersion != MINECRAFT_NET_VERSION) { Log::info("Netcode version is %d not equal to %d\n", - packet->m_netcodeVersion, MINECRAFT_NET_VERSION); + packet->m_netcodeVersion, MINECRAFT_NET_VERSION); if (packet->m_netcodeVersion > MINECRAFT_NET_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { @@ -133,11 +133,11 @@ void PendingConnection::sendPreLoginResponse() { } { - connection->send(std::shared_ptr( - new PreLoginPacket("-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, - server->m_ugcPlayersVersion, szUniqueMapName, - gameServices().getGameHostOption(eGameHostOption_All), - hostIndex, server->m_texturePackId))); + connection->send(std::shared_ptr(new PreLoginPacket( + "-", ugcXuids, ugcXuidCount, ugcFriendsOnlyBits, + server->m_ugcPlayersVersion, szUniqueMapName, + gameServices().getGameHostOption(eGameHostOption_All), hostIndex, + server->m_texturePackId))); } } @@ -147,8 +147,8 @@ void PendingConnection::handleLogin(std::shared_ptr packet) { // name = packet->userName; if (packet->clientVersion != SharedConstants::NETWORK_PROTOCOL_VERSION) { Log::info("Client version is %d not equal to %d\n", - packet->clientVersion, - SharedConstants::NETWORK_PROTOCOL_VERSION); + packet->clientVersion, + SharedConstants::NETWORK_PROTOCOL_VERSION); if (packet->clientVersion > SharedConstants::NETWORK_PROTOCOL_VERSION) { disconnect(DisconnectPacket::eDisconnect_OutdatedServer); } else { diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index e149367cf..4c80c8c36 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/util/Log.h" #include "PlayerConnection.h" #include @@ -11,26 +8,26 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/world/level/dlc/DLCConstants.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "app/common/Network/Socket.h" -#include "minecraft/client/model/SkinBox.h" #include "ServerConnection.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Network/Socket.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/JavaMath.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" +#include "minecraft/client/model/SkinBox.h" #include "minecraft/commands/CommandDispatcher.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/AnimatePacket.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/network/packet/ClientCommandPacket.h" @@ -65,12 +62,14 @@ #include "minecraft/network/packet/TileUpdatePacket.h" #include "minecraft/network/packet/TradeItemPacket.h" #include "minecraft/network/packet/UseItemPacket.h" +#include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/level/ServerPlayerGameMode.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -96,6 +95,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/BeaconTileEntity.h" @@ -138,8 +138,10 @@ PlayerConnection::PlayerConnection(MinecraftServer* server, m_onlineXUID = INVALID_XUID; m_bHasClientTickedOnce = false; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(gameServices().getGameHostOption(eGameHostOption_Gamertags) != + 0 + ? true + : false); } PlayerConnection::~PlayerConnection() { delete connection; } @@ -383,8 +385,7 @@ void PlayerConnection::handleMovePlayer( #if !defined(_CONTENT_PACKAGE) printf("%s moved wrongly!\n", player->name.c_str()); Log::info("Got position %f, %f, %f\n", xt, yt, zt); - Log::info("Expected %f, %f, %f\n", player->x, player->y, - player->z); + Log::info("Expected %f, %f, %f\n", player->x, player->y, player->z); #endif } player->absMoveTo(xt, yt, zt, yRotT, xRotT); @@ -407,7 +408,7 @@ void PlayerConnection::handleMovePlayer( // kicked for floating too long!"); #if !defined(_CONTENT_PACKAGE) printf("%s was kicked for floating too long!\n", - player->name.c_str()); + player->name.c_str()); #endif disconnect(DisconnectPacket::eDisconnect_NoFlying); return; @@ -720,8 +721,8 @@ void PlayerConnection::handlePlayerCommand( } } else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { // also only supported by horses... - if ((player->riding != nullptr) && - player->riding->instanceof(eTYPE_HORSE)) { + if ((player->riding != nullptr) && player->riding->instanceof + (eTYPE_HORSE)) { std::dynamic_pointer_cast(player->riding) ->openInventory(player); } @@ -809,11 +810,12 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Request for texture #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwBytes); if (dwBytes != 0) { send(std::shared_ptr( @@ -825,10 +827,10 @@ void PlayerConnection::handleTexture(std::shared_ptr packet) { // Response with texture data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dataBytes); + packet->dataBytes); server->connection->handleTextureReceived(packet->textureName); } } @@ -842,11 +844,12 @@ void PlayerConnection::handleTextureAndGeometry( // Request for texture and geometry #if !defined(_CONTENT_PACKAGE) printf("Server received request for custom texture %s\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; - gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); + gameServices().getMemFileDetails(packet->textureName, &pbData, + &dwTextureBytes); DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(packet->textureName); @@ -882,23 +885,23 @@ void PlayerConnection::handleTextureAndGeometry( // Response with texture and geometry data #if !defined(_CONTENT_PACKAGE) printf("Server received custom texture %s and geometry\n", - packet->textureName.c_str()); + packet->textureName.c_str()); #endif gameServices().addMemoryTextureFile(packet->textureName, packet->pbData, - packet->dwTextureBytes); + packet->dwTextureBytes); // add the geometry to the app list if (packet->dwBoxC != 0) { #if !defined(_CONTENT_PACKAGE) printf("Adding skin boxes for skin id %X, box count %d\n", - packet->dwSkinID, packet->dwBoxC); + packet->dwSkinID, packet->dwBoxC); #endif - gameServices().setAdditionalSkinBoxes(packet->dwSkinID, packet->BoxDataA, - packet->dwBoxC); + gameServices().setAdditionalSkinBoxes( + packet->dwSkinID, packet->BoxDataA, packet->dwBoxC); } // Add the anim override gameServices().setAnimOverrideBitmask(packet->dwSkinID, - packet->uiAnimOverrideBitmask); + packet->uiAnimOverrideBitmask); player->setCustomSkin(packet->dwSkinID); @@ -945,7 +948,8 @@ void PlayerConnection::handleTextureAndGeometryReceived( textureName, pbData, dwTextureBytes, pDLCSkinFile))); } else { // get the data from the app - std::uint32_t dwSkinID = gameServices().getSkinIdFromPath(textureName); + std::uint32_t dwSkinID = + gameServices().getSkinIdFromPath(textureName); std::vector* pvSkinBoxes = gameServices().getAdditionalSkinBoxes(dwSkinID); unsigned int uiAnimOverrideBitmask = @@ -965,11 +969,12 @@ void PlayerConnection::handleTextureChange( std::shared_ptr packet) { switch (packet->action) { case TextureChangePacket::e_TextureChange_Skin: - player->setCustomSkin(gameServices().getSkinIdFromPath(packet->path)); + player->setCustomSkin( + gameServices().getSkinIdFromPath(packet->path)); #if !defined(_CONTENT_PACKAGE) printf("Skin for server player %s has changed to %s (%d)\n", - player->name.c_str(), player->customTextureUrl.c_str(), - static_cast(player->getPlayerDefaultSkin())); + player->name.c_str(), player->customTextureUrl.c_str(), + static_cast(player->getPlayerDefaultSkin())); #endif break; case TextureChangePacket::e_TextureChange_Cape: @@ -977,7 +982,7 @@ void PlayerConnection::handleTextureChange( // player->customTextureUrl2 = packet->path; #if !defined(_CONTENT_PACKAGE) printf("Cape for server player %s has changed to %s\n", - player->name.c_str(), player->customTextureUrl2.c_str()); + player->name.c_str(), player->customTextureUrl2.c_str()); #endif break; } @@ -1059,43 +1064,44 @@ void PlayerConnection::handleServerSettingsChanged( gameServices().setGameHostOption( eGameHostOption_FireSpreads, GameHostOptions::get(packet->data, - eGameHostOption_FireSpreads)); + eGameHostOption_FireSpreads)); gameServices().setGameHostOption( eGameHostOption_TNT, GameHostOptions::get(packet->data, eGameHostOption_TNT)); gameServices().setGameHostOption( eGameHostOption_MobGriefing, GameHostOptions::get(packet->data, - eGameHostOption_MobGriefing)); + eGameHostOption_MobGriefing)); gameServices().setGameHostOption( eGameHostOption_KeepInventory, GameHostOptions::get(packet->data, - eGameHostOption_KeepInventory)); + eGameHostOption_KeepInventory)); gameServices().setGameHostOption( eGameHostOption_DoMobSpawning, GameHostOptions::get(packet->data, - eGameHostOption_DoMobSpawning)); + eGameHostOption_DoMobSpawning)); gameServices().setGameHostOption( eGameHostOption_DoMobLoot, GameHostOptions::get(packet->data, eGameHostOption_DoMobLoot)); gameServices().setGameHostOption( eGameHostOption_DoTileDrops, GameHostOptions::get(packet->data, - eGameHostOption_DoTileDrops)); + eGameHostOption_DoTileDrops)); gameServices().setGameHostOption( eGameHostOption_DoDaylightCycle, GameHostOptions::get(packet->data, - eGameHostOption_DoDaylightCycle)); + eGameHostOption_DoDaylightCycle)); gameServices().setGameHostOption( eGameHostOption_NaturalRegeneration, GameHostOptions::get(packet->data, - eGameHostOption_NaturalRegeneration)); + eGameHostOption_NaturalRegeneration)); server->getPlayers()->broadcastAll( std::shared_ptr( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, - gameServices().getGameHostOption(eGameHostOption_All)))); + gameServices().getGameHostOption( + eGameHostOption_All)))); // Update the QoS data NetworkService.UpdateAndSetGameSessionData(); @@ -1407,10 +1413,10 @@ void PlayerConnection::handlePlayerInfo( if (serverPlayer != nullptr) { unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); - bool trustPlayers = - gameServices().getGameHostOption(eGameHostOption_TrustPlayers) != 0; - bool cheats = - gameServices().getGameHostOption(eGameHostOption_CheatsEnabled) != 0; + bool trustPlayers = gameServices().getGameHostOption( + eGameHostOption_TrustPlayers) != 0; + bool cheats = gameServices().getGameHostOption( + eGameHostOption_CheatsEnabled) != 0; if (serverPlayer == player) { GameType* gameType = Player::getPlayerGamePrivilege( @@ -1423,7 +1429,7 @@ void PlayerConnection::handlePlayerInfo( gameType) { #if !defined(_CONTENT_PACKAGE) printf("Setting %s to game mode %d\n", - serverPlayer->name.c_str(), gameType->getId()); + serverPlayer->name.c_str(), gameType->getId()); #endif serverPlayer->setPlayerGamePrivilege( Player::ePlayerGamePrivilege_CreativeMode, @@ -1438,7 +1444,7 @@ void PlayerConnection::handlePlayerInfo( } else { #if !defined(_CONTENT_PACKAGE) printf("%s already has game mode %d\n", - serverPlayer->name.c_str(), gameType->getId()); + serverPlayer->name.c_str(), gameType->getId()); #endif } if (cheats) { diff --git a/targets/minecraft/server/network/PlayerConnection.h b/targets/minecraft/server/network/PlayerConnection.h index 054b7c0e0..71808f575 100644 --- a/targets/minecraft/server/network/PlayerConnection.h +++ b/targets/minecraft/server/network/PlayerConnection.h @@ -7,11 +7,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "java/JavaIntHash.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PacketListener.h" #include "minecraft/server/ConsoleInputSource.h" +#include "platform/PlatformTypes.h" class MinecraftServer; class Connection; diff --git a/targets/minecraft/server/network/ServerConnection.cpp b/targets/minecraft/server/network/ServerConnection.cpp index 7a62aac35..89430951b 100644 --- a/targets/minecraft/server/network/ServerConnection.cpp +++ b/targets/minecraft/server/network/ServerConnection.cpp @@ -1,18 +1,18 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ServerConnection.h" #include #include "PendingConnection.h" #include "PlayerConnection.h" -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/util/Log.h" +#include "util/StringHelpers.h" ServerConnection::ServerConnection(MinecraftServer* server) { // 4J - added initialiser diff --git a/targets/minecraft/stats/Achievement.cpp b/targets/minecraft/stats/Achievement.cpp index 774b02595..3e134bd40 100644 --- a/targets/minecraft/stats/Achievement.cpp +++ b/targets/minecraft/stats/Achievement.cpp @@ -52,8 +52,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Item* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -63,8 +62,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Tile* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(new ItemInstance(icon)), x(x), y(y), @@ -75,8 +73,7 @@ Achievement::Achievement(int id, const std::string& name, int x, int y, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::string("achievement.").append(name))), - desc(I18n::get( - std::string("achievement.").append(name).append(".desc"))), + desc(I18n::get(std::string("achievement.").append(name).append(".desc"))), icon(icon), x(x), y(y), diff --git a/targets/minecraft/stats/Achievements.cpp b/targets/minecraft/stats/Achievements.cpp index 121912f1e..839f3d685 100644 --- a/targets/minecraft/stats/Achievements.cpp +++ b/targets/minecraft/stats/Achievements.cpp @@ -220,8 +220,8 @@ void Achievements::staticCtor() { Tile::treeTrunk, (Achievement*)buildSword)) ->postConstruct(); Achievements::socialPost = - (new Achievement(eAward_socialPost, "socialPost", 0, 0, - Tile::treeTrunk, (Achievement*)buildSword)) + (new Achievement(eAward_socialPost, "socialPost", 0, 0, Tile::treeTrunk, + (Achievement*)buildSword)) ->postConstruct(); // WARNING: NO NEW ACHIEVMENTS CAN BE ADDED HERE @@ -235,8 +235,8 @@ void Achievements::staticCtor() { // 4J Stu - This achievment added in 1.8.2, but does not map to any Xbox // achievements Achievements::snipeSkeleton = - (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, - Item::bow, (Achievement*)killEnemy)) + (new Achievement(eAward_snipeSkeleton, "snipeSkeleton", 7, 0, Item::bow, + (Achievement*)killEnemy)) ->setGolden() ->postConstruct(); @@ -317,13 +317,13 @@ void Achievements::staticCtor() { // 0,0, Tile::bookshelf, (Achievement*) nullptr) // )->postConstruct(); Achievements::theHaggler = - (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_theHaggler, "theHaggler", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::potPlanter = - (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, - Tile::bookshelf, (Achievement*)nullptr)) + (new Achievement(eAward_potPlanter, "potPlanter", 0, 0, Tile::bookshelf, + (Achievement*)nullptr)) ->setAwardLocallyOnly() ->postConstruct(); Achievements::itsASign = diff --git a/targets/minecraft/stats/CommonStats.h b/targets/minecraft/stats/CommonStats.h index 41b2f053b..2ce7232ce 100644 --- a/targets/minecraft/stats/CommonStats.h +++ b/targets/minecraft/stats/CommonStats.h @@ -6,8 +6,8 @@ #include #include "GenericStats.h" -#include "minecraft/stats/Console_Awards_enum.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class CommonStats : public GenericStats { protected: diff --git a/targets/minecraft/stats/GenericStats.h b/targets/minecraft/stats/GenericStats.h index 9e45171bc..374915e5c 100644 --- a/targets/minecraft/stats/GenericStats.h +++ b/targets/minecraft/stats/GenericStats.h @@ -6,10 +6,10 @@ #include #include -#include "minecraft/stats/Console_Awards_enum.h" #include "Stat.h" #include "Stats.h" #include "java/Class.h" +#include "minecraft/stats/Console_Awards_enum.h" class DamageSource; class ItemInstance; diff --git a/targets/minecraft/stats/NumberFormatters.h b/targets/minecraft/stats/NumberFormatters.h index 3547dd13b..691bb1105 100644 --- a/targets/minecraft/stats/NumberFormatters.h +++ b/targets/minecraft/stats/NumberFormatters.h @@ -30,5 +30,5 @@ public: // 4J Stu - The java code took a string format, we take a printf format // string - DecimalFormat(std::string x) : formatString(x) {}; + DecimalFormat(std::string x) : formatString(x){}; }; \ No newline at end of file diff --git a/targets/minecraft/stats/Stat.h b/targets/minecraft/stats/Stat.h index f6e953515..744bd2b2b 100644 --- a/targets/minecraft/stats/Stat.h +++ b/targets/minecraft/stats/Stat.h @@ -8,8 +8,8 @@ #include #include "GenericStats.h" -#include "minecraft/IGameServices.h" #include "StatFormatter.h" +#include "minecraft/IGameServices.h" class DecimalFormat; class LocalPlayer; diff --git a/targets/minecraft/stats/Stats.cpp b/targets/minecraft/stats/Stats.cpp index 804d6a6b2..3636bd8f4 100644 --- a/targets/minecraft/stats/Stats.cpp +++ b/targets/minecraft/stats/Stats.cpp @@ -6,7 +6,6 @@ #include "Achievements.h" #include "GeneralStat.h" #include "ItemStat.h" -#include "util/StringHelpers.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/item/FishingRodItem.h" @@ -14,6 +13,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/tile/GrassTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class StatFormatter; @@ -171,8 +171,8 @@ bool Stats::blockStatsLoaded = false; void Stats::buildBlockStats() { blocksMined = std::vector(32000); - ItemStat* newStat = new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", - Tile::dirt->id); + ItemStat* newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 0, "mineBlock.dirt", Tile::dirt->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::dirt->id] = newStat; blocksMined[Tile::grass->id] = newStat; @@ -185,8 +185,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::cobblestone->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", - Tile::sand->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 2, "mineBlock.sand", Tile::sand->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::sand->id] = newStat; newStat->postConstruct(); @@ -203,8 +203,8 @@ void Stats::buildBlockStats() { blocksMined[Tile::gravel->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", - Tile::clay->id); + newStat = + new ItemStat(BLOCKS_MINED_OFFSET + 5, "mineBlock.clay", Tile::clay->id); blocksMinedStats->push_back(newStat); blocksMined[Tile::clay->id] = newStat; newStat->postConstruct(); @@ -390,9 +390,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::pickAxe_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", - Item::pickAxe_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 7, "craftItem.diamondPickAxe", + Item::pickAxe_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::pickAxe_diamond->id] = newStat; newStat->postConstruct(); @@ -415,9 +414,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::shovel_iron->id] = newStat; newStat->postConstruct(); - newStat = - new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", - Item::shovel_diamond->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 11, "craftItem.diamondShovel", + Item::shovel_diamond->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::shovel_diamond->id] = newStat; newStat->postConstruct(); @@ -512,8 +510,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::bucket_empty->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, - "craftItem.flintAndSteel", Item::flintAndSteel->id); + newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 27, "craftItem.flintAndSteel", + Item::flintAndSteel->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::flintAndSteel->id] = newStat; newStat->postConstruct(); @@ -536,8 +534,8 @@ void Stats::buildCraftableStats() { itemsCrafted[Item::compass->id] = newStat; newStat->postConstruct(); - newStat = new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", - Item::map->id); + newStat = + new ItemStat(ITEMS_CRAFTED_OFFSET + 31, "craftItem.map", Item::map->id); itemsCraftedStats->push_back(newStat); itemsCrafted[Item::map->id] = newStat; newStat->postConstruct(); @@ -602,8 +600,8 @@ void Stats::buildAdditionalStats() { // we don't need those record items (and we only need 2). blocksPlaced = std::vector(1000); - itemStat = new ItemStat(offset++, "blockPlaced.flowerPot", - Tile::flowerPot_Id); + itemStat = + new ItemStat(offset++, "blockPlaced.flowerPot", Tile::flowerPot_Id); blocksPlacedStats->push_back(itemStat); blocksPlaced[itemStat->getItemId()] = itemStat; itemStat->postConstruct(); diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 6f3e77bd2..c8f496e84 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "StatsCounter.h" #include @@ -10,7 +9,6 @@ #include #include -#include "platform/profile/profile.h" #include "app/common/App_structs.h" #include "app/common/Leaderboards/LeaderboardManager.h" #include "app/linux/LinuxGame.h" @@ -19,8 +17,10 @@ #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/profile/profile.h" Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, &Stats::fallOneM, &Stats::climbOneM, @@ -69,7 +69,7 @@ void StatsCounter::award(Stat* stat, unsigned int difficulty, statBoards.find(stat); if (leaderboardEntry != statBoards.end()) { Log::info("[StatsCounter] award(): %X\n", - leaderboardEntry->second << difficulty); + leaderboardEntry->second << difficulty); modifiedBoards |= (leaderboardEntry->second << difficulty); if (flushCounter == 0) flushCounter = FLUSH_DELAY; } @@ -186,8 +186,7 @@ void StatsCounter::save(int player, bool force) { (LARGE_STATS_COUNT * 4 * (sizeof(unsigned int) - sizeof(unsigned short))); assert(uiTotalStatsSize <= - (Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS))); + (Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS))); // Retrieve the data pointer from the profile std::uint8_t* pbData = reinterpret_cast( @@ -199,8 +198,7 @@ void StatsCounter::save(int player, bool force) { // Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, - Game::GAME_DEFINED_PROFILE_DATA_BYTES - - sizeof(GAME_SETTINGS)); + Game::GAME_DEFINED_PROFILE_DATA_BYTES - sizeof(GAME_SETTINGS)); // For each stat StatsMap::iterator val; @@ -357,8 +355,8 @@ void StatsCounter::dumpStatsToTTY() { for (std::vector::iterator statsIter = Stats::all->begin(); statsIter != statsEnd; ++statsIter) { Log::info("%s\t\t%u\t%u\t%u\t%u\n", (*statsIter)->name.c_str(), - getValue(*statsIter, 0), getValue(*statsIter, 1), - getValue(*statsIter, 2), getValue(*statsIter, 3)); + getValue(*statsIter, 0), getValue(*statsIter, 1), + getValue(*statsIter, 2), getValue(*statsIter, 3)); } } diff --git a/targets/minecraft/util/HtmlString.h b/targets/minecraft/util/HtmlString.h index c8c73bbb0..a01d366c9 100644 --- a/targets/minecraft/util/HtmlString.h +++ b/targets/minecraft/util/HtmlString.h @@ -9,7 +9,7 @@ // 4J: Simple std::string wrapper that includes basic formatting information class HtmlString { public: - std::string text; // Text content of std::string + std::string text; // Text content of std::string eMinecraftColour color; // Hex color bool italics; // Show text in italics bool indent; // Indent text diff --git a/targets/minecraft/util/WeighedRandom.cpp b/targets/minecraft/util/WeighedRandom.cpp index 60c1a9bed..55705a30d 100644 --- a/targets/minecraft/util/WeighedRandom.cpp +++ b/targets/minecraft/util/WeighedRandom.cpp @@ -1,8 +1,8 @@ #include "minecraft/util/WeighedRandom.h" -#include #include +#include #include "java/Random.h" diff --git a/targets/minecraft/world/CompoundContainer.cpp b/targets/minecraft/world/CompoundContainer.cpp index 568ff54cd..71d187fe6 100644 --- a/targets/minecraft/world/CompoundContainer.cpp +++ b/targets/minecraft/world/CompoundContainer.cpp @@ -1,6 +1,6 @@ -#include "minecraft/IGameServices.h" #include "CompoundContainer.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/world/Container.h" diff --git a/targets/minecraft/world/SimpleContainer.cpp b/targets/minecraft/world/SimpleContainer.cpp index 469fbe7db..9eaafc93a 100644 --- a/targets/minecraft/world/SimpleContainer.cpp +++ b/targets/minecraft/world/SimpleContainer.cpp @@ -1,8 +1,8 @@ -#include "minecraft/IGameServices.h" #include "SimpleContainer.h" #include +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/item/ItemInstance.h" #include "net.minecraft.world.ContainerListener.h" diff --git a/targets/minecraft/world/damageSource/CombatEntry.cpp b/targets/minecraft/world/damageSource/CombatEntry.cpp index ecc3f1f8e..68f163edb 100644 --- a/targets/minecraft/world/damageSource/CombatEntry.cpp +++ b/targets/minecraft/world/damageSource/CombatEntry.cpp @@ -36,8 +36,8 @@ float CombatEntry::getHealthBeforeDamage() { return health; } float CombatEntry::getHealthAfterDamage() { return health - damage; } bool CombatEntry::isCombatRelated() { - return source->getEntity() && - source->getEntity()->instanceof(eTYPE_LIVINGENTITY); + return source->getEntity() && source->getEntity()->instanceof + (eTYPE_LIVINGENTITY); } CombatTracker::eLOCATION CombatEntry::getLocation() { return location; } diff --git a/targets/minecraft/world/damageSource/CombatTracker.cpp b/targets/minecraft/world/damageSource/CombatTracker.cpp index 9970b7c3b..33cdbdb3e 100644 --- a/targets/minecraft/world/damageSource/CombatTracker.cpp +++ b/targets/minecraft/world/damageSource/CombatTracker.cpp @@ -100,7 +100,8 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { (killingEntity == nullptr || attackerEntity != killingEntity)) { std::shared_ptr attackerItem = - attackerEntity->instanceof(eTYPE_LIVINGENTITY) + attackerEntity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(attackerEntity) ->getCarriedItem() : nullptr; @@ -118,8 +119,8 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { attackerEntity->getNetworkName()); } } else if (killingEntity != nullptr) { - std::shared_ptr killerItem = - killingEntity->instanceof(eTYPE_LIVINGENTITY) + std::shared_ptr killerItem = killingEntity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(killingEntity) ->getCarriedItem() : nullptr; @@ -155,18 +156,20 @@ std::shared_ptr CombatTracker::getKiller() { for (auto it = entries.begin(); it != entries.end(); ++it) { CombatEntry* entry = *it; if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && - (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof + (eTYPE_PLAYER) && (bestPlayer == nullptr || + entry->getDamage() > bestPlayerDamage)) { bestPlayerDamage = entry->getDamage(); bestPlayer = std::dynamic_pointer_cast( entry->getSource()->getEntity()); } if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && - (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof + (eTYPE_LIVINGENTITY) && + (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { bestMobDamage = entry->getDamage(); bestMob = std::dynamic_pointer_cast( entry->getSource()->getEntity()); diff --git a/targets/minecraft/world/damageSource/EntityDamageSource.cpp b/targets/minecraft/world/damageSource/EntityDamageSource.cpp index 3c5aab7a5..8bffcdd24 100644 --- a/targets/minecraft/world/damageSource/EntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/EntityDamageSource.cpp @@ -35,14 +35,15 @@ std::shared_ptr EntityDamageSource::getEntity() { return entity; } std::shared_ptr EntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { std::shared_ptr held = - (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) + (entity != nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; - if (entity->instanceof(eTYPE_SERVERPLAYER)) { + if (entity->instanceof (eTYPE_SERVERPLAYER)) { additional = std::dynamic_pointer_cast(entity)->name; - } else if (entity->instanceof(eTYPE_MOB)) { + } else if (entity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->hasCustomName()) { additional = mob->getCustomName(); @@ -60,8 +61,8 @@ std::shared_ptr EntityDamageSource::getDeathMessagePacket( } bool EntityDamageSource::scalesWithDifficulty() { - return (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) && - !entity->instanceof(eTYPE_PLAYER); + return (entity != nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY) && !entity->instanceof (eTYPE_PLAYER); } // 4J: Copy function diff --git a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp index fc5040d68..32875f28d 100644 --- a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp @@ -42,8 +42,8 @@ std::shared_ptr IndirectEntityDamageSource::getEntity() { std::shared_ptr IndirectEntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { - std::shared_ptr held = - entity->instanceof(eTYPE_LIVINGENTITY) + std::shared_ptr held = entity->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; diff --git a/targets/minecraft/world/effect/AbsoptionMobEffect.h b/targets/minecraft/world/effect/AbsoptionMobEffect.h index 6796292a3..048ae000d 100644 --- a/targets/minecraft/world/effect/AbsoptionMobEffect.h +++ b/targets/minecraft/world/effect/AbsoptionMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; diff --git a/targets/minecraft/world/effect/AttackDamageMobEffect.h b/targets/minecraft/world/effect/AttackDamageMobEffect.h index fdf709fe0..649b3dbd8 100644 --- a/targets/minecraft/world/effect/AttackDamageMobEffect.h +++ b/targets/minecraft/world/effect/AttackDamageMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class AttributeModifier; diff --git a/targets/minecraft/world/effect/HealthBoostMobEffect.h b/targets/minecraft/world/effect/HealthBoostMobEffect.h index a84c6d0f4..a4be079df 100644 --- a/targets/minecraft/world/effect/HealthBoostMobEffect.h +++ b/targets/minecraft/world/effect/HealthBoostMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class LivingEntity; class BaseAttributeMap; diff --git a/targets/minecraft/world/effect/InstantaneousMobEffect.h b/targets/minecraft/world/effect/InstantaneousMobEffect.h index da911bb52..871c355dd 100644 --- a/targets/minecraft/world/effect/InstantaneousMobEffect.h +++ b/targets/minecraft/world/effect/InstantaneousMobEffect.h @@ -1,7 +1,7 @@ #pragma once -#include "minecraft/GameEnums.h" #include "MobEffect.h" +#include "minecraft/GameEnums.h" class InstantenousMobEffect : public MobEffect { public: diff --git a/targets/minecraft/world/effect/MobEffect.cpp b/targets/minecraft/world/effect/MobEffect.cpp index f282e7fc7..9037716fd 100644 --- a/targets/minecraft/world/effect/MobEffect.cpp +++ b/targets/minecraft/world/effect/MobEffect.cpp @@ -9,8 +9,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/AbsoptionMobEffect.h" @@ -274,12 +274,12 @@ void MobEffect::applyEffectTick(std::shared_ptr mob, } } else if (id == wither->id) { mob->hurt(DamageSource::wither, 1); - } else if ((id == hunger->id) && mob->instanceof(eTYPE_PLAYER)) { + } else if ((id == hunger->id) && mob->instanceof (eTYPE_PLAYER)) { // every tick, cause the same amount of exhaustion as when removing // a block, times amplification std::dynamic_pointer_cast(mob)->causeFoodExhaustion( FoodConstants::EXHAUSTION_MINE * (amplification + 1)); - } else if ((id == saturation->id) && mob->instanceof(eTYPE_PLAYER)) { + } else if ((id == saturation->id) && mob->instanceof (eTYPE_PLAYER)) { if (!mob->level->isClientSide) { std::dynamic_pointer_cast(mob)->getFoodData()->eat( amplification + 1, FoodConstants::FOOD_SATURATION_MAX); diff --git a/targets/minecraft/world/effect/MobEffectInstance.cpp b/targets/minecraft/world/effect/MobEffectInstance.cpp index 29a5aca77..c58290bde 100644 --- a/targets/minecraft/world/effect/MobEffectInstance.cpp +++ b/targets/minecraft/world/effect/MobEffectInstance.cpp @@ -1,5 +1,3 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/effect/MobEffectInstance.h" #include @@ -7,6 +5,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/effect/MobEffect.h" #include "nbt/CompoundTag.h" @@ -49,8 +48,7 @@ MobEffectInstance::MobEffectInstance(MobEffectInstance* copy) { void MobEffectInstance::update(MobEffectInstance* takeOver) { if (id != takeOver->id) { - Log::info( - "This method should only be called for matching effects!"); + Log::info("This method should only be called for matching effects!"); } if (takeOver->amplifier > amplifier) { amplifier = takeOver->amplifier; diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 42c04844b..f17dc2ec4 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Entity.h" #include @@ -17,10 +15,11 @@ #include "EntityIO.h" #include "EntityPos.h" #include "SyncedEntityData.h" -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -29,6 +28,7 @@ #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -681,8 +681,8 @@ void Entity::move(double xa, double ya, double za, AABB bbOrg = bb; - bool isPlayerSneaking = - onGround && isSneaking() && instanceof(eTYPE_PLAYER); + bool isPlayerSneaking = onGround && isSneaking() && instanceof + (eTYPE_PLAYER); if (isPlayerSneaking) { double d = 0.05; @@ -1784,7 +1784,7 @@ void Entity::changeDimension(int i) { // 4J: Restrictions on what can go through { // 4J: Some things should just be destroyed when they hit a portal - if (instanceof(eTYPE_FALLINGTILE)) { + if (instanceof (eTYPE_FALLINGTILE)) { removed = true; return; } @@ -1794,8 +1794,9 @@ void Entity::changeDimension(int i) { if (newLevel->atEntityLimit(shared_from_this())) return; // 4J: Check level limit on living entities, minecarts and boats - if (!instanceof(eTYPE_PLAYER) && - !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) + if (! instanceof + (eTYPE_PLAYER) && + !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) return; } diff --git a/targets/minecraft/world/entity/Entity.h b/targets/minecraft/world/entity/Entity.h index 726691e50..0eeb8d12b 100644 --- a/targets/minecraft/world/entity/Entity.h +++ b/targets/minecraft/world/entity/Entity.h @@ -53,10 +53,10 @@ public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts virtual eINSTANCEOF GetType() = 0; - inline bool instanceof(eINSTANCEOF super) { + inline bool instanceof (eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, GetType()); } - inline static bool instanceof(eINSTANCEOF type, eINSTANCEOF super) { + inline static bool instanceof (eINSTANCEOF type, eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, type); } diff --git a/targets/minecraft/world/entity/EntityIO.cpp b/targets/minecraft/world/entity/EntityIO.cpp index 598f676cf..04be0a7b3 100644 --- a/targets/minecraft/world/entity/EntityIO.cpp +++ b/targets/minecraft/world/entity/EntityIO.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityIO.h" #include @@ -7,6 +6,7 @@ #include "Painting.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/ItemFrame.h" #include "minecraft/world/entity/LeashFenceKnotEntity.h" @@ -90,7 +90,7 @@ void EntityIO::setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum) { idCreateMap->insert( std::unordered_map::value_type(id, - createFn)); + createFn)); classIdMap->insert( std::unordered_map::value_type(clas, id)); @@ -142,8 +142,8 @@ void EntityIO::staticCtor() { "FireworksRocketEntity", 22); setId(Boat::create, eTYPE_BOAT, "Boat", 41); - setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, - "MinecartRideable", 42); + setId(MinecartRideable::create, eTYPE_MINECART_RIDEABLE, "MinecartRideable", + 42); setId(MinecartChest::create, eTYPE_MINECART_CHEST, "MinecartChest", 43); setId(MinecartFurnace::create, eTYPE_MINECART_FURNACE, "MinecartFurnace", 44); @@ -330,8 +330,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { entity->load(tag); } else { #ifdef _DEBUG - Log::info("Skipping Entity with id %s\n", - tag->getString("id").c_str()); + Log::info("Skipping Entity with id %s\n", tag->getString("id").c_str()); #endif } return entity; diff --git a/targets/minecraft/world/entity/EntityIO.h b/targets/minecraft/world/entity/EntityIO.h index e309b6876..b214b6a50 100644 --- a/targets/minecraft/world/entity/EntityIO.h +++ b/targets/minecraft/world/entity/EntityIO.h @@ -5,10 +5,10 @@ #include #include "Entity.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/JavaIntHash.h" +#include "minecraft/GameEnums.h" +#include "minecraft/client/resources/Colours/ColourTable.h" class Level; class CompoundTag; @@ -51,9 +51,8 @@ private: static void setId(entityCreateFn createFn, eINSTANCEOF clas, const std::string& id, int idNum); static void setId(entityCreateFn createFn, eINSTANCEOF clas, - const std::string& id, int idNum, - eMinecraftColour color1, eMinecraftColour color2, - int nameId); + const std::string& id, int idNum, eMinecraftColour color1, + eMinecraftColour color2, int nameId); public: static void staticCtor(); diff --git a/targets/minecraft/world/entity/EntitySelector.cpp b/targets/minecraft/world/entity/EntitySelector.cpp index c25227ad5..66ce2c890 100644 --- a/targets/minecraft/world/entity/EntitySelector.cpp +++ b/targets/minecraft/world/entity/EntitySelector.cpp @@ -30,7 +30,7 @@ MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector( bool MobCanWearArmourEntitySelector::matches( std::shared_ptr entity) const { if (!entity->isAlive()) return false; - if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; std::shared_ptr mob = std::dynamic_pointer_cast(entity); @@ -38,9 +38,9 @@ bool MobCanWearArmourEntitySelector::matches( if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != nullptr) return false; - if (mob->instanceof(eTYPE_MOB)) { + if (mob->instanceof (eTYPE_MOB)) { return std::dynamic_pointer_cast(mob)->canPickUpLoot(); - } else if (mob->instanceof(eTYPE_PLAYER)) { + } else if (mob->instanceof (eTYPE_PLAYER)) { return true; } diff --git a/targets/minecraft/world/entity/HangingEntity.cpp b/targets/minecraft/world/entity/HangingEntity.cpp index 23a7f5545..7acc18a15 100644 --- a/targets/minecraft/world/entity/HangingEntity.cpp +++ b/targets/minecraft/world/entity/HangingEntity.cpp @@ -145,7 +145,7 @@ bool HangingEntity::survives() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); - if (e->instanceof(eTYPE_HANGING_ENTITY)) { + if (e->instanceof (eTYPE_HANGING_ENTITY)) { return false; } } @@ -172,10 +172,10 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr sourceEntity = source->getDirectEntity(); - if ((sourceEntity != nullptr) && - sourceEntity->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(sourceEntity) - ->isAllowedToHurtEntity(shared_from_this())) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(sourceEntity) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -185,9 +185,8 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { std::shared_ptr player = nullptr; std::shared_ptr e = source->getEntity(); - if ((e != nullptr) && - e->instanceof( - eTYPE_PLAYER)) // check if it's serverplayer or player + if ((e != nullptr) && e->instanceof + (eTYPE_PLAYER)) // check if it's serverplayer or player { player = std::dynamic_pointer_cast(e); } diff --git a/targets/minecraft/world/entity/ItemFrame.cpp b/targets/minecraft/world/entity/ItemFrame.cpp index 3fe0086d3..2d7ca7222 100644 --- a/targets/minecraft/world/entity/ItemFrame.cpp +++ b/targets/minecraft/world/entity/ItemFrame.cpp @@ -49,7 +49,7 @@ bool ItemFrame::shouldRenderAtSqrDistance(double distance) { void ItemFrame::dropItem(std::shared_ptr causedBy) { std::shared_ptr item = getItem(); - if (causedBy != nullptr && causedBy->instanceof(eTYPE_PLAYER)) { + if (causedBy != nullptr && causedBy->instanceof (eTYPE_PLAYER)) { if (std::dynamic_pointer_cast(causedBy)->abilities.instabuild) { removeFramedMap(item); return; diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 54fed9788..6e924f52c 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LivingEntity.h" #include @@ -26,6 +25,7 @@ #include "minecraft/server/level/ServerLevel.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/CombatTracker.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -244,8 +244,8 @@ void LivingEntity::baseTick() { } clearFire(); - if (!level->isClientSide && isRiding() && - riding->instanceof(eTYPE_LIVINGENTITY)) { + if (!level->isClientSide && isRiding() && riding->instanceof + (eTYPE_LIVINGENTITY)) { ride(nullptr); } } else { @@ -335,10 +335,9 @@ int LivingEntity::decreaseAirSupply(int currentSupply) { return currentSupply; } } - if (instanceof(eTYPE_PLAYER)) { + if (instanceof (eTYPE_PLAYER)) { Log::info("++++++++++ %s: Player decreasing air supply to %d\n", - level->isClientSide ? "CLIENT" : "SERVER", - currentSupply - 1); + level->isClientSide ? "CLIENT" : "SERVER", currentSupply - 1); } return currentSupply - 1; } @@ -369,7 +368,7 @@ std::shared_ptr LivingEntity::getLastHurtMob() { int LivingEntity::getLastHurtMobTimestamp() { return lastHurtMobTimestamp; } void LivingEntity::setLastHurtMob(std::shared_ptr target) { - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { lastHurtMob = std::dynamic_pointer_cast(target); } else { lastHurtMob = nullptr; @@ -422,8 +421,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("Attributes") && level != nullptr && !level->isClientSide) { SharedMonsterAttributes::loadAttributes( - getAttributes(), - (ListTag*)tag->getList("Attributes")); + getAttributes(), (ListTag*)tag->getList("Attributes")); } if (tag->contains("ActiveEffects")) { @@ -725,9 +723,10 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { if (source->isFire() && hasEffect(MobEffect::fireResistance)) { // 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java // version. - if (this->instanceof(eTYPE_PLAYER) && - (source == - DamageSource::lava)) // Only award when in lava (not any fire). + if (this->instanceof + (eTYPE_PLAYER) && + (source == DamageSource::lava)) // Only award when in lava (not + // any fire). { std::shared_ptr plr = std::dynamic_pointer_cast(shared_from_this()); @@ -766,15 +765,15 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_LIVINGENTITY)) { + if (sourceEntity->instanceof (eTYPE_LIVINGENTITY)) { setLastHurtByMob( std::dynamic_pointer_cast(sourceEntity)); } - if (sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME; lastHurtByPlayer = std::dynamic_pointer_cast(sourceEntity); - } else if (sourceEntity->instanceof(eTYPE_WOLF)) { + } else if (sourceEntity->instanceof (eTYPE_WOLF)) { std::shared_ptr w = std::dynamic_pointer_cast(sourceEntity); if (w->isTame()) { @@ -853,8 +852,8 @@ void LivingEntity::die(DamageSource* source) { int playerBonus = 0; std::shared_ptr player = nullptr; - if ((sourceEntity != nullptr) && - sourceEntity->instanceof(eTYPE_PLAYER)) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof + (eTYPE_PLAYER)) { player = std::dynamic_pointer_cast(sourceEntity); playerBonus = EnchantmentHelper::getKillingLootBonus( std::dynamic_pointer_cast(player)); @@ -1005,7 +1004,7 @@ float LivingEntity::getDamageAfterArmorAbsorb(DamageSource* damageSource, float LivingEntity::getDamageAfterMagicAbsorb(DamageSource* damageSource, float damage) { // [EB]: Stupid hack :( - if (this->instanceof(eTYPE_ZOMBIE)) { + if (this->instanceof (eTYPE_ZOMBIE)) { damage = damage; } if (hasEffect(MobEffect::damageResistance) && @@ -1313,8 +1312,8 @@ void LivingEntity::travel(float xa, float ya) { if (zd > max) zd = max; fallDistance = 0; if (yd < -0.15) yd = -0.15; - bool playerSneaking = - isSneaking() && this->instanceof(eTYPE_PLAYER); + bool playerSneaking = isSneaking() && this->instanceof + (eTYPE_PLAYER); if (playerSneaking && yd < 0) yd = 0; } @@ -1644,15 +1643,15 @@ void LivingEntity::setJumping(bool jump) { jumping = jump; } void LivingEntity::take(std::shared_ptr e, int orgCount) { if (!e->removed && !level->isClientSide) { EntityTracker* entityTracker = ((ServerLevel*)level)->getTracker(); - if (e->instanceof(eTYPE_ITEMENTITY)) { + if (e->instanceof (eTYPE_ITEMENTITY)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof(eTYPE_ARROW)) { + } else if (e->instanceof (eTYPE_ARROW)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); diff --git a/targets/minecraft/world/entity/Mob.cpp b/targets/minecraft/world/entity/Mob.cpp index 80fda456d..88565b033 100644 --- a/targets/minecraft/world/entity/Mob.cpp +++ b/targets/minecraft/world/entity/Mob.cpp @@ -9,7 +9,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -50,6 +49,7 @@ #include "nbt/CompoundTag.h" #include "nbt/FloatTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" const float Mob::MAX_WEARING_ARMOR_CHANCE = 0.15f; const float Mob::MAX_PICKUP_LOOT_CHANCE = 0.55f; @@ -254,10 +254,10 @@ void Mob::addAdditonalSaveData(CompoundTag* entityTag) { entityTag->putBoolean("Leashed", _isLeashed); if (leashHolder != nullptr) { CompoundTag* leashTag = new CompoundTag("Leash"); - if (leashHolder->instanceof(eTYPE_LIVINGENTITY)) { + if (leashHolder->instanceof (eTYPE_LIVINGENTITY)) { // a walking, talking, leash holder leashTag->putString("UUID", leashHolder->getUUID()); - } else if (leashHolder->instanceof(eTYPE_HANGING_ENTITY)) { + } else if (leashHolder->instanceof (eTYPE_HANGING_ENTITY)) { // a fixed holder (that doesn't save itself) std::shared_ptr hangInThere = std::dynamic_pointer_cast(leashHolder); @@ -493,7 +493,7 @@ void Mob::lookAt(std::shared_ptr e, float yMax, float xMax) { double yd; double zd = e->z - z; - if (e->instanceof(eTYPE_LIVINGENTITY)) { + if (e->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); yd = (mob->y + mob->getHeadHeight()) - (y + getHeadHeight()); @@ -760,12 +760,14 @@ bool Mob::interact(std::shared_ptr player) { if (itemstack->id == Item::lead_Id) { if (canBeLeashed()) { std::shared_ptr tamableAnimal = nullptr; - if (shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) && - (tamableAnimal = std::dynamic_pointer_cast( - shared_from_this())) - ->isTame()) // 4J-JEV: excuse the assignment operator - // in here, don't want to dyn-cast if it's - // avoidable. + if (shared_from_this()->instanceof + (eTYPE_TAMABLE_ANIMAL) && + (tamableAnimal = + std::dynamic_pointer_cast( + shared_from_this())) + ->isTame()) // 4J-JEV: excuse the assignment + // operator in here, don't want to + // dyn-cast if it's avoidable. { if (player->getUUID().compare( tamableAnimal->getOwnerUUID()) == 0) { @@ -824,7 +826,7 @@ void Mob::dropLeash(bool synch, bool createItemDrop) { } bool Mob::canBeLeashed() { - return !isLeashed() && !shared_from_this()->instanceof(eTYPE_ENEMY); + return !isLeashed() && !shared_from_this()->instanceof (eTYPE_ENEMY); } bool Mob::isLeashed() { return _isLeashed; } @@ -862,8 +864,7 @@ void Mob::restoreLeashFromSave() { } } delete livingEnts; - } else if (leashInfoTag->contains("X") && - leashInfoTag->contains("Y") && + } else if (leashInfoTag->contains("X") && leashInfoTag->contains("Y") && leashInfoTag->contains("Z")) { int x = leashInfoTag->getInt("X"); int y = leashInfoTag->getInt("Y"); diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 1f70f23c1..651db9d30 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "Painting.h" #include #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/HangingEntity.h" #include "minecraft/world/entity/player/Abilities.h" @@ -138,7 +138,7 @@ int Painting::getWidth() { return motive->w; } int Painting::getHeight() { return motive->h; } void Painting::dropItem(std::shared_ptr causedBy) { - if ((causedBy != nullptr) && causedBy->instanceof(eTYPE_PLAYER)) { + if ((causedBy != nullptr) && causedBy->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(causedBy); if (player->abilities.instabuild) { diff --git a/targets/minecraft/world/entity/Painting.h b/targets/minecraft/world/entity/Painting.h index 1f94ce25e..ba201f3b1 100644 --- a/targets/minecraft/world/entity/Painting.h +++ b/targets/minecraft/world/entity/Painting.h @@ -69,7 +69,7 @@ public: // private: Motive(std::string name, int w, int h, int uo, int vo) - : name(name), w(w), h(h), uo(uo), vo(vo) {}; + : name(name), w(w), h(h), uo(uo), vo(vo){}; }; public: diff --git a/targets/minecraft/world/entity/PathfinderMob.cpp b/targets/minecraft/world/entity/PathfinderMob.cpp index bb907cab2..7abfbe7ca 100644 --- a/targets/minecraft/world/entity/PathfinderMob.cpp +++ b/targets/minecraft/world/entity/PathfinderMob.cpp @@ -293,7 +293,8 @@ void PathfinderMob::tickLeash() { float _distanceTo = distanceTo(leashHolder); std::shared_ptr tamabaleAnimal = - shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) + shared_from_this()->instanceof + (eTYPE_TAMABLE_ANIMAL) ? std::dynamic_pointer_cast(shared_from_this()) : nullptr; if ((tamabaleAnimal != nullptr) && tamabaleAnimal->isSitting()) { diff --git a/targets/minecraft/world/entity/SyncedEntityData.cpp b/targets/minecraft/world/entity/SyncedEntityData.cpp index e688c554a..bbcae4ac0 100644 --- a/targets/minecraft/world/entity/SyncedEntityData.cpp +++ b/targets/minecraft/world/entity/SyncedEntityData.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SyncedEntityData.h" #include @@ -8,6 +7,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/Packet.h" +#include "minecraft/util/Log.h" class ItemInstance; diff --git a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp index b8f844b97..763b83372 100644 --- a/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp +++ b/targets/minecraft/world/entity/ai/attributes/AttributeModifier.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "AttributeModifier.h" #include #include #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" diff --git a/targets/minecraft/world/entity/ai/control/LookControl.cpp b/targets/minecraft/world/entity/ai/control/LookControl.cpp index cd79a000c..f25c65280 100644 --- a/targets/minecraft/world/entity/ai/control/LookControl.cpp +++ b/targets/minecraft/world/entity/ai/control/LookControl.cpp @@ -23,7 +23,7 @@ LookControl::LookControl(Mob* mob) { void LookControl::setLookAt(std::shared_ptr target, float yMax, float xMax) { wantedX = target->x; - if (target->instanceof(eTYPE_LIVINGENTITY)) + if (target->instanceof (eTYPE_LIVINGENTITY)) wantedY = target->y + std::dynamic_pointer_cast(target)->getHeadHeight(); diff --git a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp index 14bbec987..690890dc6 100644 --- a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp @@ -56,8 +56,8 @@ void ControlledByPlayerGoal::stop() { bool ControlledByPlayerGoal::canUse() { return mob->isAlive() && mob->rider.lock() != nullptr && - mob->rider.lock()->instanceof(eTYPE_PLAYER) && - (boosting || mob->canBeControlledByRider()); + mob->rider.lock()->instanceof + (eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() { diff --git a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp index 983edc1fe..210b60fc7 100644 --- a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp @@ -45,7 +45,7 @@ bool MeleeAttackGoal::canUse() { std::shared_ptr target = mob->getTarget(); if (target == nullptr) return false; if (!target->isAlive()) return false; - if (attackType != eTYPE_NOTSET && !target->instanceof(attackType)) + if (attackType != eTYPE_NOTSET && !target->instanceof (attackType)) return false; path.reset(mob->getNavigation()->createPath(target)); return path != nullptr; diff --git a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp index 17ec10374..3546061ba 100644 --- a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp @@ -46,7 +46,7 @@ bool RunAroundLikeCrazyGoal::canContinueToUse() { void RunAroundLikeCrazyGoal::tick() { if (horse->getRandom()->nextInt(50) == 0) { - if (horse->rider.lock()->instanceof(eTYPE_PLAYER)) { + if (horse->rider.lock()->instanceof (eTYPE_PLAYER)) { int temper = horse->getTemper(); int maxTemper = horse->getMaxTemper(); if (maxTemper > 0 && diff --git a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp index a608824b8..f99285bdf 100644 --- a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp @@ -22,7 +22,7 @@ SubselectEntitySelector::SubselectEntitySelector( SubselectEntitySelector::~SubselectEntitySelector() { delete m_subselector; } bool SubselectEntitySelector::matches(std::shared_ptr entity) const { - if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; return m_parent->canAttack(std::dynamic_pointer_cast(entity), diff --git a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp index 006d06428..4327a9759 100644 --- a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp @@ -88,7 +88,7 @@ bool TargetGoal::canAttack(std::shared_ptr target, // We're attacking our owner return false; } - } else if (target->instanceof(eTYPE_PLAYER)) { + } else if (target->instanceof (eTYPE_PLAYER)) { if (!allowInvulnerable && (std::dynamic_pointer_cast(target))->abilities.invulnerable) return false; diff --git a/targets/minecraft/world/entity/animal/Animal.cpp b/targets/minecraft/world/entity/animal/Animal.cpp index 8b2626a11..646bde3f8 100644 --- a/targets/minecraft/world/entity/animal/Animal.cpp +++ b/targets/minecraft/world/entity/animal/Animal.cpp @@ -77,7 +77,7 @@ void Animal::aiStep() { void Animal::checkHurtTarget(std::shared_ptr target, float d) { // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (target->instanceof(eTYPE_PLAYER)) { + if (target->instanceof (eTYPE_PLAYER)) { if (d < 3) { double xd = target->x - x; double zd = target->z - z; @@ -93,7 +93,7 @@ void Animal::checkHurtTarget(std::shared_ptr target, float d) { } // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - else if (target->instanceof(eTYPE_ANIMAL)) { + else if (target->instanceof (eTYPE_ANIMAL)) { std::shared_ptr a = std::dynamic_pointer_cast(target); if (getAge() > 0 && a->getAge() < 0) { if (d < 2.5) { @@ -179,22 +179,22 @@ bool Animal::hurt(DamageSource* dmgSource, float dmg) { std::shared_ptr source = dmgSource->getDirectEntity(); // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (source->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(source) - ->isAllowedToAttackAnimals()) { + if (source->instanceof + (eTYPE_PLAYER) && !std::dynamic_pointer_cast(source) + ->isAllowedToAttackAnimals()) { return false; } - if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); // 4J: Check that the arrow's owner can attack animals (dispenser // arrows are not owned) - if (arrow->owner != nullptr && - arrow->owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(arrow->owner) - ->isAllowedToAttackAnimals()) { + if (arrow->owner != nullptr && arrow->owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(arrow->owner) + ->isAllowedToAttackAnimals()) { return false; } } @@ -352,7 +352,7 @@ bool Animal::mobInteract(std::shared_ptr player) { return false; } - } else if (instanceof(eTYPE_MONSTER)) { + } else if (instanceof (eTYPE_MONSTER)) { } break; } diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index e85b371c1..25a164de7 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EntityHorse.h" #include @@ -7,11 +6,11 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" @@ -51,6 +50,7 @@ #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class EntitySelector; class Path; @@ -70,8 +70,8 @@ std::string EntityHorse::ARMOR_TEXTURES[EntityHorse::ARMORS] = { int EntityHorse::ARMOR_TEXTURES_ID[EntityHorse::ARMORS] = { -1, TN_MOB_HORSE_ARMOR_IRON, TN_MOB_HORSE_ARMOR_GOLD, TN_MOB_HORSE_ARMOR_DIAMOND}; -std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", - "goo", "dio"}; +std::string EntityHorse::ARMOR_HASHES[EntityHorse::ARMORS] = {"", "meo", "goo", + "dio"}; int EntityHorse::ARMOR_PROTECTION[EntityHorse::ARMORS] = {0, 5, 7, 11}; std::string EntityHorse::VARIANT_TEXTURES[EntityHorse::VARIANTS] = { @@ -96,8 +96,9 @@ std::string EntityHorse::MARKING_HASHES[EntityHorse::MARKINGS] = { "", "wo_", "wmo", "wdo", "bdo"}; bool HorseEntitySelector::matches(std::shared_ptr entity) const { - return entity->instanceof(eTYPE_HORSE) && - std::dynamic_pointer_cast(entity)->isBred(); + return entity->instanceof + (eTYPE_HORSE) && + std::dynamic_pointer_cast(entity)->isBred(); } EntityHorse::EntityHorse(Level* level) : Animal(level) { @@ -311,7 +312,7 @@ bool EntityHorse::hurt(DamageSource* damagesource, float dmg) { // 4J: Protect owned horses from untrusted players if (isTamed()) { std::shared_ptr entity = damagesource->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerName()); @@ -840,10 +841,9 @@ bool EntityHorse::mobInteract(std::shared_ptr player) { } doPlayerRide(player); - Log::info( - " Horse speed: %f\n", - (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) - ->getValue())); + Log::info(" Horse speed: %f\n", + (float)(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED) + ->getValue())); return true; } else { @@ -1224,11 +1224,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag* tag) { if (inventory->getItem(INV_SLOT_ARMOR) != nullptr) { tag->put("ArmorItem", inventory->getItem(INV_SLOT_ARMOR) - ->save(new CompoundTag("ArmorItem"))); + ->save(new CompoundTag("ArmorItem"))); } if (inventory->getItem(INV_SLOT_SADDLE) != nullptr) { tag->put("SaddleItem", inventory->getItem(INV_SLOT_SADDLE) - ->save(new CompoundTag("SaddleItem"))); + ->save(new CompoundTag("SaddleItem"))); } } @@ -1508,7 +1508,7 @@ void EntityHorse::positionRider() { y + getRideHeight() + rider.lock()->getRidingHeight() + height, z - dist * cos); - if (rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock()->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); livingRider->yBodyRot = yBodyRot; diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 235866317..61fdd4298 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Ocelot.h" #include @@ -6,9 +5,8 @@ #include #include -#include "platform/input/input.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -49,6 +47,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "platform/input/input.h" +#include "util/StringHelpers.h" const double Ocelot::SNEAK_SPEED_MOD = 0.6; const double Ocelot::WALK_SPEED_MOD = 0.8; diff --git a/targets/minecraft/world/entity/animal/Pig.cpp b/targets/minecraft/world/entity/animal/Pig.cpp index e432cbdaa..475152b3a 100644 --- a/targets/minecraft/world/entity/animal/Pig.cpp +++ b/targets/minecraft/world/entity/animal/Pig.cpp @@ -150,8 +150,8 @@ void Pig::thunderHit(const LightningBolt* lightningBolt) { void Pig::causeFallDamage(float distance) { Animal::causeFallDamage(distance); - if ((distance > 5) && rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_PLAYER)) { + if ((distance > 5) && rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_PLAYER)) { (std::dynamic_pointer_cast(rider.lock())) ->awardStat(GenericStats::flyPig(), GenericStats::param_flyPig()); } diff --git a/targets/minecraft/world/entity/animal/VillagerGolem.cpp b/targets/minecraft/world/entity/animal/VillagerGolem.cpp index bc1ee2630..51f18ca7c 100644 --- a/targets/minecraft/world/entity/animal/VillagerGolem.cpp +++ b/targets/minecraft/world/entity/animal/VillagerGolem.cpp @@ -110,7 +110,7 @@ int VillagerGolem::decreaseAirSupply(int currentSupply) { } void VillagerGolem::doPush(std::shared_ptr e) { - if (e->instanceof(eTYPE_ENEMY)) { + if (e->instanceof (eTYPE_ENEMY)) { if (getRandom()->nextInt(20) == 0) { setTarget(std::dynamic_pointer_cast(e)); } @@ -239,7 +239,7 @@ bool VillagerGolem::hurt(DamageSource* source, float dmg) { // 4J: Protect owned golem from untrusted players if (isPlayerCreated()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToAttackPlayers()) return false; diff --git a/targets/minecraft/world/entity/animal/Wolf.cpp b/targets/minecraft/world/entity/animal/Wolf.cpp index fb0ce2c3c..293adc7ad 100644 --- a/targets/minecraft/world/entity/animal/Wolf.cpp +++ b/targets/minecraft/world/entity/animal/Wolf.cpp @@ -6,7 +6,6 @@ #include #include "Sheep.h" -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" @@ -50,6 +49,7 @@ #include "minecraft/world/level/tile/ColoredTile.h" #include "minecraft/world/phys/AABB.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" Wolf::Wolf(Level* level) : TamableAnimal(level) { // 4J Stu - This function call had to be moved here from the Entity ctor to @@ -262,7 +262,7 @@ bool Wolf::hurt(DamageSource* source, float dmg) { // 4J: Protect owned wolves from untrusted players if (isTame()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerUUID()); @@ -272,8 +272,9 @@ bool Wolf::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; std::shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); - if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || - sourceEntity->instanceof(eTYPE_ARROW))) { + if (sourceEntity != nullptr && + !(sourceEntity->instanceof (eTYPE_PLAYER) || sourceEntity->instanceof + (eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; } @@ -487,7 +488,7 @@ bool Wolf::canMate(std::shared_ptr animal) { if (animal == shared_from_this()) return false; if (!isTame()) return false; - if (!animal->instanceof(eTYPE_WOLF)) return false; + if (!animal->instanceof (eTYPE_WOLF)) return false; std::shared_ptr partner = std::dynamic_pointer_cast(animal); if (partner == nullptr) return false; @@ -520,9 +521,10 @@ bool Wolf::wantsToAttack(std::shared_ptr target, return false; } } - if (target->instanceof(eTYPE_PLAYER) && owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - std::dynamic_pointer_cast(target))) { + if (target->instanceof (eTYPE_PLAYER) && owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + std::dynamic_pointer_cast(target))) { // pvp is off return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp index 5fb271662..9b8b9874f 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp @@ -74,8 +74,8 @@ bool EnderCrystal::hurt(DamageSource* source, float damage) { // 4J-PB - if the owner of the source is the enderdragon, then ignore it // (where the dragon's fireball hits an endercrystal) - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_ENDERDRAGON)) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_ENDERDRAGON)) { return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index 046b974e4..9c29013d4 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EnderDragon.h" #include @@ -10,6 +9,7 @@ #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -482,7 +482,7 @@ void EnderDragon::aiStep() { level->getEntities(shared_from_this(), &m_acidArea); for (auto it = targets->begin(); it != targets->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) { // Log::info("Attacking entity with acid\n"); std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -878,7 +878,7 @@ void EnderDragon::knockBack(std::vector >* entities) { // for (Entity e : entities) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -893,7 +893,7 @@ void EnderDragon::knockBack(std::vector >* entities) { void EnderDragon::hurt(std::vector >* entities) { // for (int i = 0; i < entities->size(); i++) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast( @@ -1147,9 +1147,8 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, // zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2; // attackTarget = nullptr; - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER) || - source->isExplosion()) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER) || source->isExplosion()) { int healthBefore = getHealth(); reallyHurt(source, damage); @@ -1433,7 +1432,7 @@ bool EnderDragon::setSynchedAction(EEnderdragonAction action, entityData->set(DATA_ID_SYNCHED_ACTION, action); } else { Log::info("EnderDragon: Invalid state transition from %d to %d\n", - getSynchedAction(), action); + getSynchedAction(), action); } return force || validTransition; @@ -1469,8 +1468,8 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { Log::info("Dragon action is now: LandingApproach\n"); #endif } - } else if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + } else if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER)) { if (setSynchedAction(e_EnderdragonAction_StrafePlayer)) { attackTarget = std::dynamic_pointer_cast(source->getEntity()); @@ -1529,10 +1528,9 @@ void EnderDragon::navigateToNextPathNode() { } while (yTarget < (curr.y)); } zTarget = curr.z; - Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, - curr.z); + Log::info("Path node pos is (%f,%f,%f)\n", curr.x, curr.y, curr.z); Log::info("Setting new target to (%f,%f,%f)\n", xTarget, yTarget, - zTarget); + zTarget); } } @@ -1576,8 +1574,7 @@ int EnderDragon::findClosestNode() { std::max((level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment); - Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, - nodeZ); + Log::info("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, nodeZ); (*m_nodes)[i] = new Node(nodeX, nodeY, nodeZ); @@ -1726,8 +1723,7 @@ Path* EnderDragon::findPath(int startIndex, int endIndex, } if (closest == from) return nullptr; - Log::info("Failed to find path from %d to %d\n", startIndex, - endIndex); + Log::info("Failed to find path from %d to %d\n", startIndex, endIndex); if (finalNode != nullptr) { finalNode->cameFrom = closest; closest = finalNode; @@ -1875,9 +1871,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, // result = m_headYRot / (7 - partIndex); // } // else - { - result = partPos[0] - bodyPos[0]; - } + { result = partPos[0] - bodyPos[0]; } // Log::info("Part %d is at %f\n", partIndex, result); return result; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h index 63b05728a..5331dc29c 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.h @@ -5,8 +5,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/Mob.h" @@ -207,7 +207,9 @@ public: std::vector& partPos); Vec3 getHeadLookVector(float a); - virtual std::string getAName() { return gameServices().getString(IDS_ENDERDRAGON); }; + virtual std::string getAName() { + return gameServices().getString(IDS_ENDERDRAGON); + }; virtual float getHealth() { return LivingEntity::getHealth(); }; virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); }; }; diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp index 8dce2a1c3..864d58001 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp @@ -43,7 +43,7 @@ #include "nbt/CompoundTag.h" bool LivingEntitySelector::matches(std::shared_ptr entity) const { - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { return std::dynamic_pointer_cast(entity)->getMobType() != UNDEAD; } else { @@ -261,10 +261,9 @@ void WitherBoss::newServerAiStep() { // 4J: Added check for instance of living entity, had a problem // with IDs being recycled to other entities - if (current == nullptr || - !current->instanceof(eTYPE_LIVINGENTITY) || - !current->isAlive() || distanceToSqr(current) > 30 * 30 || - !canSee(current)) { + if (current == nullptr || !current->instanceof + (eTYPE_LIVINGENTITY) || !current->isAlive() || + distanceToSqr(current) > 30 * 30 || !canSee(current)) { setAlternativeTarget(i, 0); } else { performRangedAttack( @@ -290,16 +289,16 @@ void WitherBoss::newServerAiStep() { if (selected != shared_from_this() && selected->isAlive() && canSee(selected)) { - if (selected->instanceof(eTYPE_PLAYER)) { + if (selected->instanceof (eTYPE_PLAYER)) { if (!std::dynamic_pointer_cast(selected) ->abilities.invulnerable) { - assert( - selected->instanceof(eTYPE_LIVINGENTITY)); + assert(selected->instanceof + (eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); } break; } else { - assert(selected->instanceof(eTYPE_LIVINGENTITY)); + assert(selected->instanceof (eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); break; } @@ -312,7 +311,7 @@ void WitherBoss::newServerAiStep() { } } if (getTarget() != nullptr) { - assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); + assert(getTarget()->instanceof (eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); } else { setAlternativeTarget(0, 0); @@ -458,10 +457,11 @@ bool WitherBoss::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_PLAYER)) { - } else if (sourceEntity->instanceof(eTYPE_LIVINGENTITY) && - std::dynamic_pointer_cast(sourceEntity) - ->getMobType() == getMobType()) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { + } else if (sourceEntity->instanceof + (eTYPE_LIVINGENTITY) && + std::dynamic_pointer_cast(sourceEntity) + ->getMobType() == getMobType()) { // can't be harmed by other undead return false; } diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.h b/targets/minecraft/world/entity/boss/wither/WitherBoss.h index 77031b494..c821f0f8d 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.h +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.h @@ -3,8 +3,8 @@ #include #include -#include "minecraft/IGameServices.h" #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/stdafx.h" #include "minecraft/world/entity/EntitySelector.h" #include "minecraft/world/entity/MobType.h" @@ -120,5 +120,7 @@ public: // 4J Stu - These are required for the BossMob interface virtual float getMaxHealth() { return Monster::getMaxHealth(); }; virtual float getHealth() { return Monster::getHealth(); }; - virtual std::string getAName() { return gameServices().getString(IDS_WITHER); }; + virtual std::string getAName() { + return gameServices().getString(IDS_WITHER); + }; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/GlobalEntity.h b/targets/minecraft/world/entity/global/GlobalEntity.h index 2247ce7f6..b7c5ae576 100644 --- a/targets/minecraft/world/entity/global/GlobalEntity.h +++ b/targets/minecraft/world/entity/global/GlobalEntity.h @@ -6,5 +6,5 @@ class Level; // class GlobalEntity : public Entity class GlobalEntity : public Entity { public: - GlobalEntity(Level* level) : Entity(level) {}; + GlobalEntity(Level* level) : Entity(level){}; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/LightningBolt.h b/targets/minecraft/world/entity/global/LightningBolt.h index b9a24565f..06da70736 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.h +++ b/targets/minecraft/world/entity/global/LightningBolt.h @@ -5,7 +5,6 @@ #include "GlobalEntity.h" #include "java/Class.h" - class Level; // class LightningBolt : public GlobalEntity diff --git a/targets/minecraft/world/entity/item/Boat.cpp b/targets/minecraft/world/entity/item/Boat.cpp index 9c438d17d..afa2118f6 100644 --- a/targets/minecraft/world/entity/item/Boat.cpp +++ b/targets/minecraft/world/entity/item/Boat.cpp @@ -87,9 +87,10 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( - shared_from_this())) { + if (attacker->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -111,9 +112,9 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { // Minecarts and boat requires more hits than one to be destroyed in // creative mode 4J-PB - Fix for XB1 #175735 - [CRASH] [Multi-Plat]: Code: // Gameplay: Placing a boat on harmful surfaces causes the game to crash - bool creativePlayer = (source->getEntity() != nullptr) && - source->getEntity()->instanceof(eTYPE_PLAYER) && - std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = + (source->getEntity() != nullptr) && source->getEntity()->instanceof + (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -253,8 +254,8 @@ void Boat::tick() { yd += 0.007f; } - if (rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; @@ -379,8 +380,8 @@ float Boat::getShadowHeightOffs() { return 0; } std::string Boat::getName() { return "Boat"; } bool Boat::interact(std::shared_ptr player) { - if ((rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && - (rider.lock() != player)) + if ((rider.lock() != nullptr) && rider.lock()->instanceof + (eTYPE_PLAYER) && (rider.lock() != player)) return true; if (!level->isClientSide) { // 4J HEG - Fixed issue with player not being able to dismount boat diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 98935d20c..6efb5e5a2 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ItemEntity.h" #include @@ -12,6 +11,7 @@ #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/item/Minecart.cpp b/targets/minecraft/world/entity/item/Minecart.cpp index 6a732674a..db3694254 100644 --- a/targets/minecraft/world/entity/item/Minecart.cpp +++ b/targets/minecraft/world/entity/item/Minecart.cpp @@ -153,9 +153,10 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( - shared_from_this())) { + if (attacker->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -172,9 +173,9 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (rider.lock() != nullptr && rider.lock() == source->getEntity()) hurtDamage += 1; - bool creativePlayer = source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER) && - std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = + source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -335,8 +336,8 @@ void Minecart::tick() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); - if (e != rider.lock() && e->isPushable() && - e->instanceof(eTYPE_MINECART)) { + if (e != rider.lock() && e->isPushable() && e->instanceof + (eTYPE_MINECART)) { std::shared_ptr cart = std::dynamic_pointer_cast(e); cart->m_bHasPushedCartThisTick = false; @@ -430,8 +431,8 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, xd = pow * xD / dd; zd = pow * zD / dd; - if (rider.lock() != nullptr && - rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(rider.lock()); @@ -718,9 +719,10 @@ void Minecart::push(std::shared_ptr e) { if (level->isClientSide) return; if (e == rider.lock()) return; - if (e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_PLAYER) && - !e->instanceof(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && - (xd * xd + zd * zd > 0.01)) { + if (e->instanceof (eTYPE_LIVINGENTITY) && !e->instanceof + (eTYPE_PLAYER) && !e->instanceof + (eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && + (xd * xd + zd * zd > 0.01)) { if ((rider.lock() == nullptr) && (e->riding == nullptr)) { e->ride(shared_from_this()); } @@ -746,7 +748,7 @@ void Minecart::push(std::shared_ptr e) { xa *= 0.5; za *= 0.5; - if (e->instanceof(eTYPE_MINECART)) { + if (e->instanceof (eTYPE_MINECART)) { double xo = e->x - x; double zo = e->z - z; diff --git a/targets/minecraft/world/entity/item/MinecartContainer.cpp b/targets/minecraft/world/entity/item/MinecartContainer.cpp index 08294dbd2..1a2113c35 100644 --- a/targets/minecraft/world/entity/item/MinecartContainer.cpp +++ b/targets/minecraft/world/entity/item/MinecartContainer.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "MinecartContainer.h" #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/item/ItemEntity.h" #include "minecraft/world/entity/item/Minecart.h" diff --git a/targets/minecraft/world/entity/item/MinecartRideable.cpp b/targets/minecraft/world/entity/item/MinecartRideable.cpp index e094947a2..69e58982f 100644 --- a/targets/minecraft/world/entity/item/MinecartRideable.cpp +++ b/targets/minecraft/world/entity/item/MinecartRideable.cpp @@ -21,8 +21,8 @@ MinecartRideable::MinecartRideable(Level* level, double x, double y, double z) } bool MinecartRideable::interact(std::shared_ptr player) { - if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_PLAYER) && - rider.lock() != player) + if (rider.lock() != nullptr && rider.lock()->instanceof + (eTYPE_PLAYER) && rider.lock() != player) return true; if (rider.lock() != nullptr && rider.lock() != player) return false; if (!level->isClientSide) { diff --git a/targets/minecraft/world/entity/monster/CaveSpider.cpp b/targets/minecraft/world/entity/monster/CaveSpider.cpp index 7ac2661e6..6e8cf0c2f 100644 --- a/targets/minecraft/world/entity/monster/CaveSpider.cpp +++ b/targets/minecraft/world/entity/monster/CaveSpider.cpp @@ -29,7 +29,7 @@ void CaveSpider::registerAttributes() { bool CaveSpider::doHurtTarget(std::shared_ptr target) { if (Spider::doHurtTarget(target)) { - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { int poisonTime = 0; if (level->difficulty <= Difficulty::EASY) { // No poison! diff --git a/targets/minecraft/world/entity/monster/Creeper.cpp b/targets/minecraft/world/entity/monster/Creeper.cpp index a2efbdadf..0e379afd2 100644 --- a/targets/minecraft/world/entity/monster/Creeper.cpp +++ b/targets/minecraft/world/entity/monster/Creeper.cpp @@ -140,8 +140,8 @@ int Creeper::getDeathSound() { return eSoundType_MOB_CREEPER_DEATH; } void Creeper::die(DamageSource* source) { Monster::die(source); - if (source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_SKELETON)) { + if (source->getEntity() != nullptr && source->getEntity()->instanceof + (eTYPE_SKELETON)) { int recordId = Item::record_01_Id + random->nextInt(Item::record_12_Id - Item::record_01_Id + 1); @@ -149,9 +149,10 @@ void Creeper::die(DamageSource* source) { } if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof(eTYPE_ARROW) && - source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof + (eTYPE_ARROW) && source->getEntity() != nullptr && + source->getEntity()->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); player->awardStat(GenericStats::archer(), GenericStats::param_archer()); diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index 0f7362210..e7f56423f 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "EnderMan.h" #include @@ -9,6 +8,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" @@ -239,9 +239,10 @@ void EnderMan::aiStep() { if (!level->isClientSide && isAlive()) { if (attackTarget != nullptr) { - if (attackTarget->instanceof(eTYPE_PLAYER) && - isLookingAtMe( - std::dynamic_pointer_cast(attackTarget))) { + if (attackTarget->instanceof + (eTYPE_PLAYER) && + isLookingAtMe( + std::dynamic_pointer_cast(attackTarget))) { if (attackTarget->distanceToSqr(shared_from_this()) < 4 * 4) { teleport(); } @@ -380,7 +381,8 @@ bool EnderMan::hurt(DamageSource* source, float damage) { setCreepy(true); if (dynamic_cast(source) != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getEntity()->instanceof + (eTYPE_PLAYER)) { aggroedByPlayer = true; } diff --git a/targets/minecraft/world/entity/monster/Enemy.cpp b/targets/minecraft/world/entity/monster/Enemy.cpp index 2287f73d3..919b72fb1 100644 --- a/targets/minecraft/world/entity/monster/Enemy.cpp +++ b/targets/minecraft/world/entity/monster/Enemy.cpp @@ -10,5 +10,5 @@ class EntitySelector; EntitySelector* Enemy::ENEMY_SELECTOR = new Enemy::EnemyEntitySelector(); bool Enemy::EnemyEntitySelector::matches(std::shared_ptr entity) const { - return (entity != nullptr) && entity->instanceof(eTYPE_ENEMY); + return (entity != nullptr) && entity->instanceof (eTYPE_ENEMY); } \ No newline at end of file diff --git a/targets/minecraft/world/entity/monster/Ghast.cpp b/targets/minecraft/world/entity/monster/Ghast.cpp index 50d675a27..08480e32e 100644 --- a/targets/minecraft/world/entity/monster/Ghast.cpp +++ b/targets/minecraft/world/entity/monster/Ghast.cpp @@ -61,8 +61,8 @@ bool Ghast::isCharging() { return entityData->getByte(DATA_IS_CHARGING) != 0; } bool Ghast::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) { - if ((source->getEntity() != nullptr) && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + if ((source->getEntity() != nullptr) && source->getEntity()->instanceof + (eTYPE_PLAYER)) { // reflected fireball, kill the ghast FlyingMob::hurt(source, 1000); std::dynamic_pointer_cast(source->getEntity()) diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index f67789c4d..a474b9934 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Monster.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -84,7 +84,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { (float)getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); int knockback = 0; - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); dmg += EnchantmentHelper::getDamageBonus( @@ -115,7 +115,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { target->setOnFire(fireAspect * 4); } - if (target->instanceof(eTYPE_LIVINGENTITY)) { + if (target->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 33181d774..69ab1e76a 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PigZombie.h" #include #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -105,14 +105,14 @@ std::shared_ptr PigZombie::findAttackTarget() { bool PigZombie::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity != nullptr && sourceEntity->instanceof (eTYPE_PLAYER)) { AABB grown = bb.grow(32, 32, 32); std::vector >* nearby = level->getEntities(shared_from_this(), &grown); auto itEnd = nearby->end(); for (auto it = nearby->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // nearby->at(i); - if (e->instanceof(eTYPE_PIGZOMBIE)) { + if (e->instanceof (eTYPE_PIGZOMBIE)) { std::shared_ptr pigZombie = std::dynamic_pointer_cast(e); pigZombie->alert(sourceEntity); diff --git a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp index 22e54d356..6f1fcc531 100644 --- a/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp +++ b/targets/minecraft/world/entity/monster/SharedMonsterAttributes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "SharedMonsterAttributes.h" #include @@ -6,6 +5,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/entity/ai/attributes/Attribute.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/attributes/AttributeModifier.h" @@ -93,8 +93,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap* attributes, if (instance != nullptr) { loadAttribute(instance, tag); } else { - Log::info("Ignoring unknown attribute '%d'", - tag->getInt("ID")); + Log::info("Ignoring unknown attribute '%d'", tag->getInt("ID")); } } } diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index deb93e43b..b0d4fe7d8 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "Silverfish.h" #include #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Skeleton.cpp b/targets/minecraft/world/entity/monster/Skeleton.cpp index da25e0d57..2d7d21662 100644 --- a/targets/minecraft/world/entity/monster/Skeleton.cpp +++ b/targets/minecraft/world/entity/monster/Skeleton.cpp @@ -106,8 +106,8 @@ void Skeleton::playStepSound(int xt, int yt, int zt, int t) { bool Skeleton::doHurtTarget(std::shared_ptr target) { if (Monster::doHurtTarget(target)) { - if ((getSkeletonType() == TYPE_WITHER) && - target->instanceof(eTYPE_LIVINGENTITY)) { + if ((getSkeletonType() == TYPE_WITHER) && target->instanceof + (eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(target)->addEffect( new MobEffectInstance(MobEffect::wither->id, SharedConstants::TICKS_PER_SECOND * 10)); @@ -158,7 +158,7 @@ void Skeleton::aiStep() { void Skeleton::rideTick() { Monster::rideTick(); - if (riding != nullptr && riding->instanceof(eTYPE_PATHFINDER_MOB)) { + if (riding != nullptr && riding->instanceof (eTYPE_PATHFINDER_MOB)) { yBodyRot = std::dynamic_pointer_cast(riding)->yBodyRot; } } @@ -167,9 +167,10 @@ void Skeleton::die(DamageSource* source) { Monster::die(source); if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof(eTYPE_ARROW) && - source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof + (eTYPE_ARROW) && source->getEntity() != nullptr && + source->getEntity()->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index ba3ef339d..c2652b171 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Spider.h" #include @@ -8,6 +7,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/monster/Zombie.cpp b/targets/minecraft/world/entity/monster/Zombie.cpp index 77df90fa1..a12b3ee7b 100644 --- a/targets/minecraft/world/entity/monster/Zombie.cpp +++ b/targets/minecraft/world/entity/monster/Zombie.cpp @@ -179,10 +179,12 @@ bool Zombie::hurt(DamageSource* source, float dmg) { if (Monster::hurt(source, dmg)) { std::shared_ptr target = getTarget(); if ((target == nullptr) && getAttackTarget() != nullptr && - getAttackTarget()->instanceof(eTYPE_LIVINGENTITY)) + getAttackTarget()->instanceof + (eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(getAttackTarget()); if ((target == nullptr) && source->getEntity() != nullptr && - source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) + source->getEntity()->instanceof + (eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(source->getEntity()); @@ -314,8 +316,7 @@ void Zombie::addAdditonalSaveData(CompoundTag* tag) { if (isBaby()) tag->putBoolean("IsBaby", true); if (isVillager()) tag->putBoolean("IsVillager", true); - tag->putInt("ConversionTime", - isConverting() ? villagerConversionTime : -1); + tag->putInt("ConversionTime", isConverting() ? villagerConversionTime : -1); } void Zombie::readAdditionalSaveData(CompoundTag* tag) { diff --git a/targets/minecraft/world/entity/npc/ClientSideMerchant.h b/targets/minecraft/world/entity/npc/ClientSideMerchant.h index 6a594faa8..c613594d4 100644 --- a/targets/minecraft/world/entity/npc/ClientSideMerchant.h +++ b/targets/minecraft/world/entity/npc/ClientSideMerchant.h @@ -21,8 +21,7 @@ private: std::string m_name; public: - ClientSideMerchant(std::shared_ptr source, - const std::string& name); + ClientSideMerchant(std::shared_ptr source, const std::string& name); ~ClientSideMerchant(); void createContainer(); // 4J Added diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 2685626b2..783e82118 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Villager.h" #include @@ -8,6 +7,7 @@ #include "Pos.h" #include "SharedConstants.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/Mth.h" @@ -272,7 +272,7 @@ void Villager::setLastHurtByMob(std::shared_ptr mob) { if (_village != nullptr && mob != nullptr) { _village->addAggressor(mob); - if (mob->instanceof(eTYPE_PLAYER)) { + if (mob->instanceof (eTYPE_PLAYER)) { int amount = -1; if (isBaby()) { amount = -3; @@ -292,11 +292,11 @@ void Villager::die(DamageSource* source) { if (_village != nullptr) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof(eTYPE_PLAYER)) { + if (sourceEntity->instanceof (eTYPE_PLAYER)) { _village->modifyStanding( std::dynamic_pointer_cast(sourceEntity)->getName(), -2); - } else if (sourceEntity->instanceof(eTYPE_ENEMY)) { + } else if (sourceEntity->instanceof (eTYPE_ENEMY)) { _village->resetNoBreedTimer(); } } else if (sourceEntity == nullptr) { diff --git a/targets/minecraft/world/entity/player/Inventory.cpp b/targets/minecraft/world/entity/player/Inventory.cpp index 21a59b055..79c5d9cd3 100644 --- a/targets/minecraft/world/entity/player/Inventory.cpp +++ b/targets/minecraft/world/entity/player/Inventory.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Inventory.h" #include #include +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -393,15 +393,14 @@ void Inventory::setItem(unsigned int slot, std::shared_ptr item) { if (item != nullptr) { std::string itemstring = item->toString(); Log::info("Inventory::setItem - slot = %d,\t item = %d ", slot, - item->id); + item->id); // OutputDebugStringW(itemstring.c_str()); Log::info("\n"); } #else if (item != nullptr) { - Log::info( - "Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", slot, - item->id, item->getAuxValue()); + Log::info("Inventory::setItem - slot = %d,\t item = %d, aux = %d\n", + slot, item->id, item->getAuxValue()); } #endif // 4J Stu - Changed this a little from Java to be less funn @@ -489,7 +488,9 @@ std::shared_ptr Inventory::getItem(unsigned int slot) { */ } -std::string Inventory::getName() { return gameServices().getString(IDS_INVENTORY); } +std::string Inventory::getName() { + return gameServices().getString(IDS_INVENTORY); +} std::string Inventory::getCustomName() { return ""; } diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 1baeb7927..ab6107849 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -9,8 +9,6 @@ // derives from, and not to find the derived class itself (which should own the // virtual GetType function) -#include "Player.h" - #include #include @@ -22,14 +20,14 @@ #include #include "Inventory.h" -#include "minecraft/GameEnums.h" +#include "Player.h" #include "app/common/App_structs.h" -#include "minecraft/Minecraft_Macros.h" -#include "minecraft/world/level/dlc/DLCConstants.h" #include "app/common/DLC/DLCSkinFile.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/GameEnums.h" +#include "minecraft/Minecraft_Macros.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" @@ -74,6 +72,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/dlc/DLCConstants.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BedTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -182,8 +181,10 @@ Player::Player(Level* level, const std::string& name) : LivingEntity(level) { m_xuid = INVALID_XUID; m_OnlineXuid = INVALID_XUID; // m_bShownOnMaps = true; - setShowOnMaps( - gameServices().getGameHostOption(eGameHostOption_Gamertags) != 0 ? true : false); + setShowOnMaps(gameServices().getGameHostOption(eGameHostOption_Gamertags) != + 0 + ? true + : false); m_bIsGuest = false; // 4J: Set UUID to name on none-XB1 consoles, may change in future but for @@ -534,7 +535,8 @@ void Player::ride(std::shared_ptr e) { void Player::setPlayerDefaultSkin(EDefaultSkins skin) { #if !defined(_CONTENT_PACKAGE) - printf("Setting default skin to %d for player %s\n", std::to_underlying(skin), name.c_str()); + printf("Setting default skin to %d for player %s\n", + std::to_underlying(skin), name.c_str()); #endif m_skinIndex = skin; } @@ -542,7 +544,7 @@ void Player::setPlayerDefaultSkin(EDefaultSkins skin) { void Player::setCustomSkin(std::uint32_t skinId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set skin to %08X for player %s\n", skinId, - name.c_str()); + name.c_str()); #endif EDefaultSkins playerSkin = EDefaultSkins::ServerSelected; @@ -573,7 +575,8 @@ void Player::setCustomSkin(std::uint32_t skinId) { this->customTextureUrl = gameServices().getSkinPathFromId(skinId); // set the new player additional boxes - /*vector *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); + /*vector + *pvModelParts=gameServices().getAdditionalModelParts(m_dwSkinId); if(pvModelParts==nullptr) { @@ -663,7 +666,7 @@ void Player::setXuid(PlayerUID xuid) { m_xuid = xuid; } void Player::setCustomCape(std::uint32_t capeId) { #if !defined(_CONTENT_PACKAGE) printf("Attempting to set cape to %08X for player %s\n", capeId, - name.c_str()); + name.c_str()); #endif m_dwCapeId = capeId; @@ -671,7 +674,8 @@ void Player::setCustomCape(std::uint32_t capeId) { if (capeId > 0) { this->customTextureUrl2 = Player::getCapePathFromId(capeId); } else { - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Cape if (pMojangData->wchCape[0] != 0) { @@ -761,7 +765,8 @@ void Player::ChangePlayerSkin() { } void Player::prepareCustomTextures() { - MOJANG_DATA* pMojangData = gameServices().getMojangDataForXuid(getOnlineXuid()); + MOJANG_DATA* pMojangData = + gameServices().getMojangDataForXuid(getOnlineXuid()); if (pMojangData) { // Skin @@ -1204,7 +1209,7 @@ bool Player::hurt(DamageSource* source, float dmg) { if (dmg == 0) return false; std::shared_ptr attacker = source->getEntity(); - if (attacker != nullptr && attacker->instanceof(eTYPE_ARROW)) { + if (attacker != nullptr && attacker->instanceof (eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(attacker); if (arrow->owner != nullptr) { @@ -1315,7 +1320,7 @@ bool Player::interact(std::shared_ptr entity) { return true; } - if ((item != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && entity->instanceof (eTYPE_LIVINGENTITY)) { // 4J - PC Comments // Hack to prevent item stacks from decrementing if the player has // the ability to instabuild @@ -1359,7 +1364,7 @@ void Player::attack(std::shared_ptr entity) { int knockback = 0; float magicBoost = 0; - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr thisPlayer = std::dynamic_pointer_cast(shared_from_this()); std::shared_ptr mob = @@ -1374,8 +1379,8 @@ void Player::attack(std::shared_ptr entity) { if (dmg > 0 || magicBoost > 0) { bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && - (riding == nullptr) && - entity->instanceof(eTYPE_LIVINGENTITY); + (riding == nullptr) && entity->instanceof + (eTYPE_LIVINGENTITY); if (bCrit && dmg > 0) { dmg *= 1.5f; } @@ -1386,8 +1391,8 @@ void Player::attack(std::shared_ptr entity) { bool setOnFireTemporatily = false; int fireAspect = EnchantmentHelper::getFireAspect( std::dynamic_pointer_cast(shared_from_this())); - if (entity->instanceof(eTYPE_MOB) && fireAspect > 0 && - !entity->isOnFire()) { + if (entity->instanceof + (eTYPE_MOB) && fireAspect > 0 && !entity->isOnFire()) { setOnFireTemporatily = true; entity->setOnFire(1); } @@ -1419,7 +1424,7 @@ void Player::attack(std::shared_ptr entity) { } setLastHurtMob(entity); - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, @@ -1429,17 +1434,17 @@ void Player::attack(std::shared_ptr entity) { std::shared_ptr item = getSelectedItem(); std::shared_ptr hurtTarget = entity; - if (entity->instanceof(eTYPE_MULTIENTITY_MOB_PART)) { + if (entity->instanceof (eTYPE_MULTIENTITY_MOB_PART)) { std::shared_ptr multiMob = std::dynamic_pointer_cast( (std::dynamic_pointer_cast(entity)) ->parentMob.lock()); - if ((multiMob != nullptr) && - multiMob->instanceof(eTYPE_LIVINGENTITY)) { + if ((multiMob != nullptr) && multiMob->instanceof + (eTYPE_LIVINGENTITY)) { hurtTarget = std::dynamic_pointer_cast(multiMob); } } - if ((item != nullptr) && hurtTarget->instanceof(eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && hurtTarget->instanceof (eTYPE_LIVINGENTITY)) { item->hurtEnemy( std::dynamic_pointer_cast(hurtTarget), std::dynamic_pointer_cast(shared_from_this())); @@ -1447,7 +1452,7 @@ void Player::attack(std::shared_ptr entity) { removeSelectedItem(); } } - if (entity->instanceof(eTYPE_LIVINGENTITY)) { + if (entity->instanceof (eTYPE_LIVINGENTITY)) { // awardStat(Stats.damageDealt, (int) Math.round(dmg * 10)); if (fireAspect > 0 && wasHurt) { @@ -1864,7 +1869,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { int distance = (int)Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); if (distance > 0) { - if (riding->instanceof(eTYPE_MINECART)) { + if (riding->instanceof (eTYPE_MINECART)) { distanceMinecart += distance; if (distanceMinecart >= 100) { int newDistance = @@ -1893,7 +1898,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { } } - } else if (riding->instanceof(eTYPE_BOAT)) { + } else if (riding->instanceof (eTYPE_BOAT)) { distanceBoat += distance; if (distanceBoat >= 100) { int newDistance = distanceBoat - (distanceBoat % 100); @@ -1901,7 +1906,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { awardStat(GenericStats::boatOneM(), GenericStats::param_boat(newDistance / 100)); } - } else if (riding->instanceof(eTYPE_PIG)) { + } else if (riding->instanceof (eTYPE_PIG)) { distancePig += distance; if (distancePig >= 100) { int newDistance = distancePig - (distancePig % 100); @@ -1933,9 +1938,10 @@ void Player::killed(std::shared_ptr mob) { // 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: // Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster // Hunter" Achievement. - if (mob->instanceof(eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || - mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || - mob->GetType() == eTYPE_ENDERDRAGON) { + if (mob->instanceof (eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || + mob->GetType() == eTYPE_SLIME || + mob->GetType() == eTYPE_LAVASLIME || + mob->GetType() == eTYPE_ENDERDRAGON) { awardStat(GenericStats::killEnemy(), GenericStats::param_noArgs()); switch (mob->GetType()) { @@ -2504,7 +2510,7 @@ bool Player::isAllowedToUse(std::shared_ptr item) { bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { - if (target->instanceof(eTYPE_MINECART)) { + if (target->instanceof (eTYPE_MINECART)) { if (getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CanUseContainers) == 0) { std::shared_ptr minecart = @@ -2543,7 +2549,8 @@ bool Player::isAllowedToMine() { bool Player::isAllowedToAttackPlayers() { bool allowed = true; if (hasInvisiblePrivilege() || - ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) && + ((gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == + 0) && getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CannotAttackPlayers))) { allowed = false; @@ -2596,7 +2603,8 @@ bool Player::isAllowedToFly() { bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if ((gameServices().getGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && + if ((gameServices().getGameHostOption( + eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying)) { @@ -2616,7 +2624,8 @@ bool Player::isAllowedToTeleport() { bool Player::hasInvisiblePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) { enabled = true; } @@ -2625,7 +2634,8 @@ bool Player::hasInvisiblePrivilege() { bool Player::hasInvulnerablePrivilege() { bool enabled = false; - if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && + if (gameServices().getGameHostOption(eGameHostOption_HostCanBeInvisible) != + 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) { enabled = true; @@ -2672,7 +2682,8 @@ std::vector* Player::GetAdditionalModelParts() { customTextureUrl.substr(0, 3).compare("def") == 0; // see if we can find the parts - m_ppAdditionalModelParts = gameServices().getAdditionalModelParts(m_dwSkinId); + m_ppAdditionalModelParts = + gameServices().getAdditionalModelParts(m_dwSkinId); // If it's a default texture (which has no parts), we have the parts, or // we already have the texture (in which case we should have parts if @@ -2704,8 +2715,9 @@ std::vector* Player::GetAdditionalModelParts() { "m_bCheckedForModelParts Got model parts from DLCskin " "for skin %X\n", m_dwSkinId); - m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( - m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); + m_ppAdditionalModelParts = + gameServices().setAdditionalSkinBoxesFromVec( + m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); } gameServices().setAnimOverrideBitmask( diff --git a/targets/minecraft/world/entity/player/Player.h b/targets/minecraft/world/entity/player/Player.h index a529c1ca6..369b4778f 100644 --- a/targets/minecraft/world/entity/player/Player.h +++ b/targets/minecraft/world/entity/player/Player.h @@ -6,18 +6,18 @@ #include #include -#include "platform/PlatformTypes.h" #include "Abilities.h" -#include "minecraft/world/entity/player/SkinTypes.h" #include "java/Class.h" #include "minecraft/commands/CommandSender.h" #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" +#include "minecraft/world/entity/player/SkinTypes.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/inventory/PlayerEnderChestContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/scores/ScoreHolder.h" +#include "platform/PlatformTypes.h" class AbstractContainerMenu; class Stats; @@ -238,7 +238,7 @@ public: std::shared_ptr container); virtual bool startEnchanting( int x, int y, int z, - const std::string& name); // 4J - added bool return + const std::string& name); // 4J - added bool return virtual bool startRepairing(int x, int y, int z); // 4J - added bool return virtual bool startCrafting(int x, int y, int z); // 4J - added bool return virtual bool openFireworks(int x, int y, int z); // 4J - added @@ -259,7 +259,7 @@ public: virtual bool canHarmPlayer(std::shared_ptr target); virtual bool canHarmPlayer( std::string targetName); // 4J: Added for ServerPlayer when only - // player name is provided + // player name is provided protected: virtual void hurtArmor(float damage); diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index 2882947bd..e8a27a1bc 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Arrow.h" #include @@ -16,6 +15,7 @@ #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -75,7 +75,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, viewScale = 10; owner = mob; - if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; y = mob->y + mob->getHeadHeight() - 0.1f; @@ -113,7 +113,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, float power) viewScale = 10; owner = mob; - if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; setSize(0.5f, 0.5f); @@ -275,16 +275,17 @@ void Arrow::tick() { res = new HitResult(hitEntity); } - if ((res != nullptr) && (res->entity != nullptr) && - res->entity->instanceof(eTYPE_PLAYER)) { + if ((res != nullptr) && (res->entity != nullptr) && res->entity->instanceof + (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(res->entity); // 4J: Check for owner being null if (player->abilities.invulnerable || ((owner != nullptr) && - (owner->instanceof(eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - player)))) { + (owner->instanceof + (eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + player)))) { res = nullptr; } } @@ -318,7 +319,7 @@ void Arrow::tick() { res->entity->setOnFire(5); } - if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(res->entity); @@ -350,11 +351,11 @@ void Arrow::tick() { // 4J : WESTY : For award, need to track if creeper was killed // by arrow from the player. - if (owner != nullptr && - owner->instanceof(eTYPE_PLAYER) // arrow owner is a player - && !res->entity->isAlive() // target is now dead - && (res->entity->GetType() == - eTYPE_CREEPER)) // target is a creeper + if (owner != nullptr && owner->instanceof + (eTYPE_PLAYER) // arrow owner is a player + && !res->entity->isAlive() // target is now dead + && (res->entity->GetType() == + eTYPE_CREEPER)) // target is a creeper { std::dynamic_pointer_cast(owner)->awardStat( @@ -480,8 +481,7 @@ void Arrow::readAdditionalSaveData(CompoundTag* tag) { if (tag->contains("pickup")) { pickup = tag->getByte("pickup"); } else if (tag->contains("player")) { - pickup = - tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; + pickup = tag->getBoolean("player") ? PICKUP_ALLOWED : PICKUP_DISALLOWED; } } diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index ff55f7155..ed1c7e281 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Fireball.h" #include @@ -13,6 +12,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" @@ -324,7 +324,7 @@ bool Fireball::hurt(DamageSource* source, float damage) { zPower = zd * 0.1; } - if (source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) { + if (source->getEntity()->instanceof (eTYPE_LIVINGENTITY)) { owner = std::dynamic_pointer_cast(source->getEntity()); } diff --git a/targets/minecraft/world/entity/projectile/Snowball.cpp b/targets/minecraft/world/entity/projectile/Snowball.cpp index 787846ef3..8d6489aba 100644 --- a/targets/minecraft/world/entity/projectile/Snowball.cpp +++ b/targets/minecraft/world/entity/projectile/Snowball.cpp @@ -30,7 +30,7 @@ Snowball::Snowball(Level* level, double x, double y, double z) void Snowball::onHit(HitResult* res) { if (res->entity != nullptr) { int damage = 0; - if (res->entity->instanceof(eTYPE_BLAZE)) { + if (res->entity->instanceof (eTYPE_BLAZE)) { damage = 3; } diff --git a/targets/minecraft/world/entity/projectile/Throwable.cpp b/targets/minecraft/world/entity/projectile/Throwable.cpp index 728b15944..7cb64e44b 100644 --- a/targets/minecraft/world/entity/projectile/Throwable.cpp +++ b/targets/minecraft/world/entity/projectile/Throwable.cpp @@ -249,8 +249,8 @@ void Throwable::addAdditonalSaveData(CompoundTag* tag) { tag->putByte("shake", (uint8_t)shakeTime); tag->putByte("inGround", (uint8_t)(inGround ? 1 : 0)); - if (ownerName.empty() && (owner != nullptr) && - owner->instanceof(eTYPE_PLAYER)) { + if (ownerName.empty() && (owner != nullptr) && owner->instanceof + (eTYPE_PLAYER)) { ownerName = owner->getAName(); } diff --git a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp index 0ada74647..abf679bd5 100644 --- a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp +++ b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp @@ -52,8 +52,8 @@ void ThrownEnderpearl::onHit(HitResult* res) { // the ground. If the owner has been removed, then ignore // 4J-JEV: Cheap type check first. - if ((getOwner() != nullptr) && - getOwner()->instanceof(eTYPE_SERVERPLAYER)) { + if ((getOwner() != nullptr) && getOwner()->instanceof + (eTYPE_SERVERPLAYER)) { std::shared_ptr serverPlayer = std::dynamic_pointer_cast(getOwner()); if (!serverPlayer->removed) { diff --git a/targets/minecraft/world/entity/projectile/WitherSkull.cpp b/targets/minecraft/world/entity/projectile/WitherSkull.cpp index e1646e35e..b9b2b4f47 100644 --- a/targets/minecraft/world/entity/projectile/WitherSkull.cpp +++ b/targets/minecraft/world/entity/projectile/WitherSkull.cpp @@ -74,7 +74,7 @@ void WitherSkull::onHit(HitResult* res) { } else { res->entity->hurt(DamageSource::magic, 5); } - if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { int witherSeconds = 0; if (level->difficulty <= Difficulty::EASY) { // Nothing diff --git a/targets/minecraft/world/inventory/AnvilMenu.cpp b/targets/minecraft/world/inventory/AnvilMenu.cpp index 43852607f..3da3a17e6 100644 --- a/targets/minecraft/world/inventory/AnvilMenu.cpp +++ b/targets/minecraft/world/inventory/AnvilMenu.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "AnvilMenu.h" #include @@ -6,7 +5,7 @@ #include #include -#include "util/StringHelpers.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" AnvilMenu::AnvilMenu(std::shared_ptr inventory, Level* level, int xt, int yt, int zt, std::shared_ptr player) { @@ -232,9 +232,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info( - "Un-naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Un-naming cost; price is now %d (went up by %d)", + price, namingCost); } result->resetHoverName(); } @@ -245,8 +244,8 @@ void AnvilMenu::createResult() { price += namingCost; if (DEBUG_COST) { - Log::info("Naming cost; price is now %d (went up by %d)", - price, namingCost); + Log::info("Naming cost; price is now %d (went up by %d)", price, + namingCost); } if (input->hasCustomHoverName()) { @@ -290,9 +289,8 @@ void AnvilMenu::createResult() { tax += count + level * fee; if (DEBUG_COST) { - Log::info( - "Enchantment tax; tax is now %d (went up by %d)", tax, - (count + level * fee)); + Log::info("Enchantment tax; tax is now %d (went up by %d)", tax, + (count + level * fee)); } } @@ -334,11 +332,11 @@ void AnvilMenu::createResult() { if (DEBUG_COST) { if (level->isClientSide) { - Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("CLIENT Cost is %d (%d price, %d tax)\n", cost, price, + tax); } else { - Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, - price, tax); + Log::info("SERVER Cost is %d (%d price, %d tax)\n", cost, price, + tax); } } } diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index 9600b2a98..ba9a78897 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -5,9 +5,9 @@ #include #include -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/BehaviorRegistry.h" #include "minecraft/core/BlockSource.h" #include "minecraft/core/DefaultDispenseItemBehavior.h" @@ -29,8 +29,8 @@ class Icon; const int ArmorItem::healthPerSlot[] = {11, 16, 15, 13}; const std::string ArmorItem::LEATHER_OVERLAYS[] = { - "helmetCloth_overlay", "chestplateCloth_overlay", - "leggingsCloth_overlay", "bootsCloth_overlay"}; + "helmetCloth_overlay", "chestplateCloth_overlay", "leggingsCloth_overlay", + "bootsCloth_overlay"}; const std::string ArmorItem::TEXTURE_EMPTY_SLOTS[] = { "slot_empty_helmet", "slot_empty_chestplate", "slot_empty_leggings", @@ -53,12 +53,12 @@ std::shared_ptr ArmorItem::ArmorDispenseItemBehavior::execute( if (entities->size() > 0) { std::shared_ptr target = std::dynamic_pointer_cast(entities->at(0)); - int offset = target->instanceof(eTYPE_PLAYER) ? 1 : 0; + int offset = target->instanceof (eTYPE_PLAYER) ? 1 : 0; int slot = Mob::getEquipmentSlotForItem(dispensed); std::shared_ptr equip = dispensed->copy(); equip->count = 1; target->setEquippedSlot(slot - offset, equip); - if (target->instanceof(eTYPE_MOB)) + if (target->instanceof (eTYPE_MOB)) std::dynamic_pointer_cast(target)->setDropChance(slot, 2); dispensed->count--; diff --git a/targets/minecraft/world/item/BowItem.cpp b/targets/minecraft/world/item/BowItem.cpp index ad63775d4..77dc67bba 100644 --- a/targets/minecraft/world/item/BowItem.cpp +++ b/targets/minecraft/world/item/BowItem.cpp @@ -18,7 +18,7 @@ class Icon; const std::string BowItem::TEXTURE_PULL[] = {"bow_pull_0", "bow_pull_1", - "bow_pull_2"}; + "bow_pull_2"}; BowItem::BowItem(int id) : Item(id) { maxStackSize = 1; diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index 2e22034d0..90806fb8c 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "BucketItem.h" #include @@ -13,6 +12,7 @@ #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/minecraft/world/item/ClockItem.h b/targets/minecraft/world/item/ClockItem.h index f5628cebb..fba8dab71 100644 --- a/targets/minecraft/world/item/ClockItem.h +++ b/targets/minecraft/world/item/ClockItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/CompassItem.h b/targets/minecraft/world/item/CompassItem.h index c61ae9c57..b151aadc3 100644 --- a/targets/minecraft/world/item/CompassItem.h +++ b/targets/minecraft/world/item/CompassItem.h @@ -4,8 +4,8 @@ #include -#include "platform/PlatformTypes.h" #include "Item.h" +#include "platform/PlatformTypes.h" class Icon; diff --git a/targets/minecraft/world/item/DyePowderItem.cpp b/targets/minecraft/world/item/DyePowderItem.cpp index dd8c87191..5d065d849 100644 --- a/targets/minecraft/world/item/DyePowderItem.cpp +++ b/targets/minecraft/world/item/DyePowderItem.cpp @@ -300,7 +300,7 @@ void DyePowderItem::registerIcons(IconRegister* iconRegister) { icons = new Icon*[DYE_POWDER_ITEM_TEXTURE_COUNT]; for (int i = 0; i < DYE_POWDER_ITEM_TEXTURE_COUNT; i++) { - icons[i] = iconRegister->registerIcon(getIconName() + "_" + - COLOR_TEXTURES[i]); + icons[i] = + iconRegister->registerIcon(getIconName() + "_" + COLOR_TEXTURES[i]); } } \ No newline at end of file diff --git a/targets/minecraft/world/item/EnchantedBookItem.cpp b/targets/minecraft/world/item/EnchantedBookItem.cpp index 0d33cd2e9..ecc40e283 100644 --- a/targets/minecraft/world/item/EnchantedBookItem.cpp +++ b/targets/minecraft/world/item/EnchantedBookItem.cpp @@ -58,8 +58,7 @@ void EnchantedBookItem::appendHoverText( if (list != nullptr) { std::string unformatted = ""; for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -104,8 +103,7 @@ void EnchantedBookItem::addEnchantment(std::shared_ptr item, } if (!item->hasTag()) item->setTag(new CompoundTag()); - item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), - enchantments); + item->getTag()->put((char*)TAG_STORED_ENCHANTMENTS.c_str(), enchantments); } std::shared_ptr EnchantedBookItem::createForEnchantment( diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index a90cecd5f..b0335f1c1 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "EnderEyeItem.h" #include @@ -7,6 +6,7 @@ #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/EyeOfEnderSignal.h" diff --git a/targets/minecraft/world/item/FireworksChargeItem.cpp b/targets/minecraft/world/item/FireworksChargeItem.cpp index 8b55f3b6a..dc6ae7edb 100644 --- a/targets/minecraft/world/item/FireworksChargeItem.cpp +++ b/targets/minecraft/world/item/FireworksChargeItem.cpp @@ -1,8 +1,8 @@ -#include "minecraft/IGameServices.h" #include "FireworksChargeItem.h" #include +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/DyePowderItem.h" @@ -98,10 +98,11 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // shape uint8_t type = expTag->getByte(FireworksItem::TAG_E_TYPE); if (type >= FireworksItem::TYPE_MIN && type <= FireworksItem::TYPE_MAX) { - lines->push_back( - HtmlString(gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); + lines->push_back(HtmlString( + gameServices().getString(FIREWORKS_CHARGE_TYPE_NAME[type]))); } else { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TYPE))); } // colors @@ -115,7 +116,7 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -124,7 +125,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -140,14 +142,15 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, expTag->getIntArray(FireworksItem::TAG_E_FADECOLORS); if (fadeList.size() > 0) { bool first = true; - std::string output = - std::string(gameServices().getString(IDS_FIREWORKS_CHARGE_FADE_TO)) + " "; + std::string output = std::string(gameServices().getString( + IDS_FIREWORKS_CHARGE_FADE_TO)) + + " "; for (unsigned int i = 0; i < fadeList.size(); ++i) { int c = fadeList[i]; if (!first) { output += ",\n"; // 4J-PB - without the newline, they tend to go - // offscreen in split-screen or localised languages + // offscreen in split-screen or localised languages } first = false; @@ -156,7 +159,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, for (int dc = 0; dc < 16; dc++) { if (c == DyePowderItem::COLOR_RGB[dc]) { found = true; - output += gameServices().getString(FIREWORKS_CHARGE_COLOUR_NAME[dc]); + output += gameServices().getString( + FIREWORKS_CHARGE_COLOUR_NAME[dc]); break; } } @@ -170,7 +174,8 @@ void FireworksChargeItem::appendHoverText(CompoundTag* expTag, // has trail bool trail = expTag->getBoolean(FireworksItem::TAG_E_TRAIL); if (trail) { - lines->push_back(HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); + lines->push_back( + HtmlString(gameServices().getString(IDS_FIREWORKS_CHARGE_TRAIL))); } // has flicker diff --git a/targets/minecraft/world/item/FireworksItem.cpp b/targets/minecraft/world/item/FireworksItem.cpp index 3f4041a50..c93b3cf3c 100644 --- a/targets/minecraft/world/item/FireworksItem.cpp +++ b/targets/minecraft/world/item/FireworksItem.cpp @@ -1,10 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FireworksItem.h" #include #include -#include "util/StringHelpers.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" @@ -16,6 +15,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" const std::string FireworksItem::TAG_FIREWORKS = "Fireworks"; const std::string FireworksItem::TAG_EXPLOSION = "Explosion"; @@ -65,8 +65,8 @@ void FireworksItem::appendHoverText(std::shared_ptr itemInstance, } if (fireTag->contains(TAG_FLIGHT)) { lines->push_back( - std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + " " + - toWString((fireTag->getByte(TAG_FLIGHT)))); + std::string(gameServices().getString(IDS_ITEM_FIREWORKS_FLIGHT)) + + " " + toWString((fireTag->getByte(TAG_FLIGHT)))); } ListTag* explosions = diff --git a/targets/minecraft/world/item/HangingEntityItem.cpp b/targets/minecraft/world/item/HangingEntityItem.cpp index ef2238b72..9bd00b20e 100644 --- a/targets/minecraft/world/item/HangingEntityItem.cpp +++ b/targets/minecraft/world/item/HangingEntityItem.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HangingEntityItem.h" #include @@ -10,6 +9,7 @@ #include "Direction.h" #include "Facing.h" #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/HangingEntity.h" diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index 20f6dc92d..74e7200ce 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1,6 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - #include "Item.h" #include @@ -11,7 +8,9 @@ #include "MapItem.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/item/ItemInstance.cpp b/targets/minecraft/world/item/ItemInstance.cpp index 1bd665d2d..fa3fb9774 100644 --- a/targets/minecraft/world/item/ItemInstance.cpp +++ b/targets/minecraft/world/item/ItemInstance.cpp @@ -11,7 +11,6 @@ #include #include "Item.h" -#include "util/StringHelpers.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/LivingEntity.h" @@ -31,6 +30,7 @@ #include "nbt/CompoundTag.h" #include "nbt/IntTag.h" #include "nbt/ListTag.h" +#include "util/StringHelpers.h" class Tag; @@ -370,8 +370,8 @@ std::string ItemInstance::toString() { std::ostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed if (Item::items[id] == nullptr) { - oss << std::dec << count << "x" << " Item::items[id] is nullptr " - << "@" << auxValue; + oss << std::dec << count << "x" << " Item::items[id] is nullptr " << "@" + << auxValue; } else { oss << std::dec << count << "x" << Item::items[id]->getDescription(shared_from_this()) << "@" diff --git a/targets/minecraft/world/item/MapItem.cpp b/targets/minecraft/world/item/MapItem.cpp index a1fb0c5c1..7cd5c8cb4 100644 --- a/targets/minecraft/world/item/MapItem.cpp +++ b/targets/minecraft/world/item/MapItem.cpp @@ -7,7 +7,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/network/packet/ComplexItemDataPacket.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class SavedData; @@ -105,8 +105,8 @@ std::shared_ptr MapItem::getSavedData( void MapItem::update(Level* level, std::shared_ptr player, std::shared_ptr data) { - if ((level->dimension->id != data->dimension) || - !player->instanceof(eTYPE_PLAYER)) { + if ((level->dimension->id != data->dimension) || !player->instanceof + (eTYPE_PLAYER)) { // Wrong dimension, abort return; } @@ -267,7 +267,7 @@ void MapItem::inventoryTick(std::shared_ptr itemInstance, if (level->isClientSide) return; std::shared_ptr data = getSavedData(itemInstance, level); - if (owner->instanceof(eTYPE_PLAYER)) { + if (owner->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); diff --git a/targets/minecraft/world/item/NameTagItem.cpp b/targets/minecraft/world/item/NameTagItem.cpp index 07912462c..a1c7e6148 100644 --- a/targets/minecraft/world/item/NameTagItem.cpp +++ b/targets/minecraft/world/item/NameTagItem.cpp @@ -16,7 +16,7 @@ bool NameTagItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr target) { if (!itemInstance->hasCustomHoverName()) return false; - if ((target != nullptr) && target->instanceof(eTYPE_MOB)) { + if ((target != nullptr) && target->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(target); mob->setCustomName(itemInstance->getHoverName()); mob->setPersistenceRequired(); diff --git a/targets/minecraft/world/item/PlanterTileItem.cpp b/targets/minecraft/world/item/PlanterTileItem.cpp index 82eed36fb..71812c91b 100644 --- a/targets/minecraft/world/item/PlanterTileItem.cpp +++ b/targets/minecraft/world/item/PlanterTileItem.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PlanterTileItem.h" #include #include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index a89a80dce..276efda45 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -1,11 +1,10 @@ -#include "minecraft/IGameServices.h" #include "PotionItem.h" #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/util/HtmlString.h" @@ -26,6 +25,7 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "strings.h" +#include "util/StringHelpers.h" class Icon; @@ -213,8 +213,9 @@ std::string PotionItem::getHoverName( if (isThrowable(itemInstance->getAuxValue())) { // elementName = I18n.get("potion.prefix.grenade").trim() + " " + // elementName; - elementName = replaceAll(elementName, "{*splash*}", - gameServices().getString(IDS_POTION_PREFIX_GRENADE)); + elementName = + replaceAll(elementName, "{*splash*}", + gameServices().getString(IDS_POTION_PREFIX_GRENADE)); } else { elementName = replaceAll(elementName, "{*splash*}", ""); } @@ -227,17 +228,19 @@ std::string PotionItem::getHoverName( // return elementName + " " + I18n.get(postfixString).trim(); elementName = replaceAll(elementName, "{*prefix*}", ""); - elementName = replaceAll( - elementName, "{*postfix*}", - gameServices().getString(effects->at(0)->getPostfixDescriptionId())); + elementName = + replaceAll(elementName, "{*postfix*}", + gameServices().getString( + effects->at(0)->getPostfixDescriptionId())); } else { // String appearanceName = // PotionBrewing.getAppearanceName(itemInstance.getAuxValue()); return // I18n.get(appearanceName).trim() + " " + elementName; - elementName = replaceAll(elementName, "{*prefix*}", - gameServices().getString(PotionBrewing::getAppearanceName( - itemInstance->getAuxValue()))); + elementName = replaceAll( + elementName, "{*prefix*}", + gameServices().getString( + PotionBrewing::getAppearanceName(itemInstance->getAuxValue()))); elementName = replaceAll(elementName, "{*postfix*}", ""); } return elementName; @@ -288,18 +291,22 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, switch (effect->getAmplifier()) { case 1: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_1); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_1); break; case 2: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_2); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_2); break; case 3: potencyString = " "; - potencyString += gameServices().getString(IDS_POTION_POTENCY_3); + potencyString += + gameServices().getString(IDS_POTION_POTENCY_3); break; default: - potencyString = gameServices().getString(IDS_POTION_POTENCY_0); + potencyString = + gameServices().getString(IDS_POTION_POTENCY_0); break; } effectString += @@ -307,8 +314,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, // effect.getAmplifier()).trim(); } if (effect->getDuration() > SharedConstants::TICKS_PER_SECOND) { - effectString += - " (" + MobEffect::formatDuration(effect) + ")"; + effectString += " (" + MobEffect::formatDuration(effect) + ")"; } eMinecraftColour color = eMinecraftColour_NOT_SET; @@ -331,8 +337,9 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, if (!modifiers.empty()) { // Add new line lines->push_back(HtmlString("")); - lines->push_back(HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), - eHTMLColor_5)); + lines->push_back( + HtmlString(gameServices().getString(IDS_POTION_EFFECTS_WHENDRANK), + eHTMLColor_5)); // Add modifier descriptions for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { diff --git a/targets/minecraft/world/item/SaddleItem.cpp b/targets/minecraft/world/item/SaddleItem.cpp index 3e91f56e2..b8bfecf95 100644 --- a/targets/minecraft/world/item/SaddleItem.cpp +++ b/targets/minecraft/world/item/SaddleItem.cpp @@ -13,7 +13,7 @@ SaddleItem::SaddleItem(int id) : Item(id) { maxStackSize = 1; } bool SaddleItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr player, std::shared_ptr mob) { - if ((mob != nullptr) && mob->instanceof(eTYPE_PIG)) { + if ((mob != nullptr) && mob->instanceof (eTYPE_PIG)) { std::shared_ptr pig = std::dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) { pig->setSaddle(true); diff --git a/targets/minecraft/world/item/SkullItem.cpp b/targets/minecraft/world/item/SkullItem.cpp index cf294fe60..f61e3ebad 100644 --- a/targets/minecraft/world/item/SkullItem.cpp +++ b/targets/minecraft/world/item/SkullItem.cpp @@ -19,8 +19,8 @@ const unsigned int SkullItem::NAMES[SKULL_COUNT] = { IDS_ITEM_SKULL_SKELETON, IDS_ITEM_SKULL_WITHER, IDS_ITEM_SKULL_ZOMBIE, IDS_ITEM_SKULL_CHARACTER, IDS_ITEM_SKULL_CREEPER}; -std::string SkullItem::ICON_NAMES[SKULL_COUNT] = { - "skeleton", "wither", "zombie", "char", "creeper"}; +std::string SkullItem::ICON_NAMES[SKULL_COUNT] = {"skeleton", "wither", + "zombie", "char", "creeper"}; SkullItem::SkullItem(int id) : Item(id) { // setItemCategory(CreativeModeTab.TAB_DECORATIONS); @@ -125,9 +125,7 @@ unsigned int SkullItem::getDescriptionId( std::string SkullItem::getHoverName( std::shared_ptr itemInstance) { - { - return Item::getHoverName(itemInstance); - } + { return Item::getHoverName(itemInstance); } } void SkullItem::registerIcons(IconRegister* iconRegister) { diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index 2acc074fe..629a3d8bd 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -1,15 +1,14 @@ -#include "minecraft/IGameServices.h" #include "SpawnEggItem.h" #include #include #include "Facing.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/IconRegister.h" @@ -25,6 +24,7 @@ #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "minecraft/world/phys/HitResult.h" #include "strings.h" +#include "util/StringHelpers.h" SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll @@ -39,8 +39,8 @@ std::string SpawnEggItem::getHoverName( int nameId = EntityIO::getNameId(itemInstance->getAuxValue()); if (nameId >= 0) { - elementName = - replaceAll(elementName, "{*CREATURE*}", gameServices().getString(nameId)); + elementName = replaceAll(elementName, "{*CREATURE*}", + gameServices().getString(nameId)); // elementName += " " + I18n.get("entity." + encodeId + ".name"); } else { elementName = replaceAll(elementName, "{*CREATURE*}", ""); @@ -140,7 +140,7 @@ std::shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level* level, } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (newEntity->instanceof(eTYPE_ENEMY)) { + else if (newEntity->instanceof (eTYPE_ENEMY)) { // 4J-PB - check if the player is trying to spawn an enemy // in peaceful mode if (level->difficulty == Difficulty::PEACEFUL) { @@ -218,8 +218,8 @@ bool SpawnEggItem::useOn(std::shared_ptr itemInstance, if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; so change // instanceof to check for Mobs. - if (result->instanceof(eTYPE_MOB) && - itemInstance->hasCustomHoverName()) { + if (result->instanceof + (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -263,8 +263,8 @@ std::shared_ptr SpawnEggItem::use( if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; // so change instanceof to check for Mobs. - if (result->instanceof(eTYPE_MOB) && - itemInstance->hasCustomHoverName()) { + if (result->instanceof + (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -301,7 +301,7 @@ std::shared_ptr SpawnEggItem::spawnMobAt(Level* level, int auxVal, // 4J-JEV: DynCasting to Mob not LivingEntity; so change instanceof to // check for Mobs. - if (newEntity != nullptr && newEntity->instanceof(eTYPE_MOB)) { + if (newEntity != nullptr && newEntity->instanceof (eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(newEntity); newEntity->moveTo( diff --git a/targets/minecraft/world/item/TileItem.cpp b/targets/minecraft/world/item/TileItem.cpp index 735064e40..791681074 100644 --- a/targets/minecraft/world/item/TileItem.cpp +++ b/targets/minecraft/world/item/TileItem.cpp @@ -1,15 +1,13 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" - - #include "TileItem.h" #include -#include "minecraft/Console_Debug_enum.h" #include "java/Class.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/Icon.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -156,8 +154,8 @@ bool TileItem::useOn(std::shared_ptr instance, // Log::info("Place Sound - %s, Step Sound - // %s\n",szPlaceSoundName,szStepSoundName); - Log::info("Place Sound - %d, Step Sound - %d\n", - iPlaceSound, iStepSound); + Log::info("Place Sound - %d, Step Sound - %d\n", iPlaceSound, + iStepSound); #endif level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, tile->soundType->getPlaceSound(), diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp index acb0c336b..915818e8e 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/JavaMath.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "strings.h" @@ -75,7 +75,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = // with water bottle and gunpowder const std::string PotionBrewing::MOD_GUNPOWDER = "+14"; //&13-13"; // gunpowder makes them throwable! // gunpowder requires - // 13 and sets 14 + // 13 and sets 14 #else const std::string PotionBrewing::MOD_WATER = "-1-3-5-7-9-11-13"; const std::string PotionBrewing::MOD_SUGAR = "+0"; @@ -91,7 +91,7 @@ const std::string PotionBrewing::MOD_GLOWSTONE = ""; // glowstone increases amplification const std::string PotionBrewing::MOD_GUNPOWDER = ""; // gunpowder makes them throwable! // gunpowder requires 13 and sets - // 14 + // 14 #endif PotionBrewing::intStringMap PotionBrewing::potionEffectDuration; diff --git a/targets/minecraft/world/item/alchemy/PotionBrewing.h b/targets/minecraft/world/item/alchemy/PotionBrewing.h index 546e83747..59dfcec24 100644 --- a/targets/minecraft/world/item/alchemy/PotionBrewing.h +++ b/targets/minecraft/world/item/alchemy/PotionBrewing.h @@ -98,8 +98,8 @@ private: int countCompare, int valuePart, int multiplierPart, int brew); static int countOnes(int brew); - static int parseEffectFormulaValue(const std::string& definition, - int start, int end, int brew); + static int parseEffectFormulaValue(const std::string& definition, int start, + int end, int brew); public: static std::vector* getEffects( diff --git a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp index 7f8fa3ad3..8be5a539c 100644 --- a/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp +++ b/targets/minecraft/world/item/crafting/ArmorDyeRecipe.cpp @@ -5,7 +5,6 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/entity/animal/Sheep.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ArmorItem.h" @@ -15,6 +14,7 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/item/crafting/ShapedRecipy.h" #include "minecraft/world/level/tile/ColoredTile.h" +#include "platform/PlatformTypes.h" bool ArmorDyeRecipe::matches(std::shared_ptr craftSlots, Level* level) { diff --git a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp index 25488a652..04e01d33c 100644 --- a/targets/minecraft/world/item/crafting/ArmorRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ArmorRecipes.cpp @@ -12,18 +12,18 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string ArmorRecipes::shapes[][4] = { - {"XXX", // + {"XXX", // "X X", ""}, // - {"X X", // - "XXX", // + {"X X", // + "XXX", // "XXX", ""}, // - {"XXX", // - "X X", // + {"XXX", // + "X X", // "X X", ""}, // - {"X X", // + {"X X", // "X X", ""}, // }; diff --git a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp index 45717de60..e1f81d734 100644 --- a/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp +++ b/targets/minecraft/world/item/crafting/ClothDyeRecipes.cpp @@ -104,7 +104,6 @@ void ClothDyeRecipes::addRecipes(Recipes* r) { for (int i = 0; i < 16; i++) { r->addShapedRecipy(new ItemInstance(Tile::woolCarpet, 3, i), "sczg", - "##", '#', new ItemInstance(Tile::wool, 1, i), - 'D'); + "##", '#', new ItemInstance(Tile::wool, 1, i), 'D'); } } diff --git a/targets/minecraft/world/item/crafting/Recipes.cpp b/targets/minecraft/world/item/crafting/Recipes.cpp index 68509e580..912f29d15 100644 --- a/targets/minecraft/world/item/crafting/Recipes.cpp +++ b/targets/minecraft/world/item/crafting/Recipes.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "minecraft/world/item/crafting/Recipes.h" #include @@ -9,6 +8,7 @@ #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/Item.h" @@ -79,13 +79,12 @@ Recipes::Recipes() { '#', new ItemInstance(Tile::treeTrunk, 1, 0), 'S'); // TU9 - adding coloured wood - addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // - "sczg", - "#", // + addShapedRecipy( + new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // + "sczg", + "#", // - '#', - new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), 'S'); addShapedRecipy( new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // @@ -99,8 +98,7 @@ Recipes::Recipes() { "sczg", "#", // - '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), - 'S'); + '#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), 'S'); addShapedRecipy(new ItemInstance(Item::stick, 4), // "ssctg", @@ -261,14 +259,14 @@ Recipes::Recipes() { '#', Tile::sandStone, 'S'); - addShapedRecipy( - new ItemInstance(Tile::woodStairsBirch, 4), // - "sssczg", - "# ", // - "## ", // - "###", // + addShapedRecipy(new ItemInstance(Tile::woodStairsBirch, 4), // + "sssczg", + "# ", // + "## ", // + "###", // - '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), 'S'); + '#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), + 'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsDark, 4), // "sssczg", @@ -669,8 +667,8 @@ Recipes::Recipes() { "#X#", // "III", // - '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, - 'I', Tile::stone, 'M'); + '#', Tile::redstoneTorch_on, 'X', Item::netherQuartz, 'I', + Tile::stone, 'M'); addShapedRecipy(new ItemInstance(Tile::daylightDetector), "sssctcictg", "GGG", "QQQ", "WWW", @@ -767,8 +765,8 @@ Recipes::Recipes() { "###", // "#X#", // "#R#", // - '#', Tile::cobblestone, 'X', Item::bow, 'R', - Item::redStone, 'M'); + '#', Tile::cobblestone, 'X', Item::bow, 'R', Item::redStone, + 'M'); addShapedRecipy(new ItemInstance(Tile::dropper, 1), // "sssctcig", diff --git a/targets/minecraft/world/item/crafting/Recipes.h b/targets/minecraft/world/item/crafting/Recipes.h index 33f9bc0bc..b119769ad 100644 --- a/targets/minecraft/world/item/crafting/Recipes.h +++ b/targets/minecraft/world/item/crafting/Recipes.h @@ -79,7 +79,7 @@ public: iteminstance = i; } - eINSTANCEOF instanceof() { return eType; } + eINSTANCEOF instanceof () { return eType; } eINSTANCEOF GetType() { return eType; }; private: diff --git a/targets/minecraft/world/item/crafting/Recipy.h b/targets/minecraft/world/item/crafting/Recipy.h index 9f0ff125c..a1460182e 100644 --- a/targets/minecraft/world/item/crafting/Recipy.h +++ b/targets/minecraft/world/item/crafting/Recipy.h @@ -5,8 +5,8 @@ #pragma once -#include "platform/PlatformTypes.h" #include "minecraft/world/inventory/CraftingContainer.h" +#include "platform/PlatformTypes.h" #define RECIPE_TYPE_2x2 0 #define RECIPE_TYPE_3x3 1 diff --git a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp index c66fc3fe4..50ba3af68 100644 --- a/targets/minecraft/world/item/crafting/ShapedRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapedRecipy.cpp @@ -4,16 +4,15 @@ // import net.minecraft.world.inventory.CraftingContainer; // import net.minecraft.world.item.ItemInstance; -#include "ShapedRecipy.h" - #include -#include "platform/PlatformTypes.h" #include "Recipes.h" +#include "ShapedRecipy.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" // 4J-PB - for new crafting - Adding group to define type of item that the // recipe produces diff --git a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp index 5b8ba09ad..d4c304491 100644 --- a/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp +++ b/targets/minecraft/world/item/crafting/ShapelessRecipy.cpp @@ -12,11 +12,11 @@ #include #include -#include "platform/PlatformTypes.h" #include "Recipes.h" #include "minecraft/world/inventory/CraftingContainer.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "platform/PlatformTypes.h" ShapelessRecipy::ShapelessRecipy(ItemInstance* result, std::vector* ingredients, diff --git a/targets/minecraft/world/item/crafting/StructureRecipes.cpp b/targets/minecraft/world/item/crafting/StructureRecipes.cpp index 6d4a382d7..dc29a4400 100644 --- a/targets/minecraft/world/item/crafting/StructureRecipes.cpp +++ b/targets/minecraft/world/item/crafting/StructureRecipes.cpp @@ -34,8 +34,7 @@ void StructureRecipies::addRecipes(Recipes* r) { "#", // "#", // - '#', - new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), + '#', new ItemInstance(Tile::stoneSlabHalf, 1, StoneSlabTile::SAND_SLAB), 'S'); r->addShapedRecipy( diff --git a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp index a3c14af3c..3ac71fa01 100644 --- a/targets/minecraft/world/item/crafting/WeaponRecipes.cpp +++ b/targets/minecraft/world/item/crafting/WeaponRecipes.cpp @@ -10,8 +10,8 @@ // 4J-PB - adding "" on the end of these so we can detect it std::string WeaponRecipies::shapes[][4] = { - {"X", // - "X", // + {"X", // + "X", // "#", ""}, // }; diff --git a/targets/minecraft/world/item/enchantment/Enchantment.cpp b/targets/minecraft/world/item/enchantment/Enchantment.cpp index f4e3afedd..6b0147ed5 100644 --- a/targets/minecraft/world/item/enchantment/Enchantment.cpp +++ b/targets/minecraft/world/item/enchantment/Enchantment.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Enchantment.h" #include @@ -6,6 +5,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/util/HtmlString.h" +#include "minecraft/util/Log.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/enchantment/ArrowDamageEnchantment.h" #include "minecraft/world/item/enchantment/ArrowFireEnchantment.h" @@ -162,7 +162,8 @@ int Enchantment::getDescriptionId() { return descriptionId; } // 4jcraft: re-added old TU18 overload for java gui std::string Enchantment::getFullname(int level, std::string& unformatted) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); unformatted = formatted; snprintf(formatted, 256, "%s", @@ -172,7 +173,8 @@ std::string Enchantment::getFullname(int level, std::string& unformatted) { HtmlString Enchantment::getFullname(int level) { char formatted[256]; - snprintf(formatted, 256, "%s %s", gameServices().getString(getDescriptionId()), + snprintf(formatted, 256, "%s %s", + gameServices().getString(getDescriptionId()), getLevelString(level).c_str()); return HtmlString(formatted, eHTMLColor_f); @@ -214,5 +216,6 @@ std::string Enchantment::getLevelString(int level) { stringId = IDS_ENCHANTMENT_LEVEL_10; break; }; - return gameServices().getString(stringId); // I18n.get("enchantment.level." + level); + return gameServices().getString( + stringId); // I18n.get("enchantment.level." + level); } \ No newline at end of file diff --git a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp index ec6a96030..b88a730e6 100644 --- a/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp +++ b/targets/minecraft/world/item/enchantment/EnchantmentHelper.cpp @@ -29,8 +29,8 @@ int EnchantmentHelper::getEnchantmentLevel( return 0; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); @@ -51,8 +51,7 @@ std::unordered_map* EnchantmentHelper::getEnchantments( if (list != nullptr) { for (int i = 0; i < list->size(); i++) { - int type = - list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); + int type = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((char*)ItemInstance::TAG_ENCH_LEVEL); @@ -119,8 +118,8 @@ void EnchantmentHelper::runIterationOnItem( return; } for (int i = 0; i < enchantmentTags->size(); i++) { - int type = enchantmentTags->get(i)->getShort( - (char*)ItemInstance::TAG_ENCH_ID); + int type = + enchantmentTags->get(i)->getShort((char*)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort( (char*)ItemInstance::TAG_ENCH_LEVEL); diff --git a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp index 6a8864d1c..75c2b52b6 100644 --- a/targets/minecraft/world/item/trading/MerchantRecipeList.cpp +++ b/targets/minecraft/world/item/trading/MerchantRecipeList.cpp @@ -135,8 +135,7 @@ MerchantRecipeList* MerchantRecipeList::createFromStream( } void MerchantRecipeList::load(CompoundTag* tag) { - ListTag* list = - (ListTag*)tag->getList("Recipes"); + ListTag* list = (ListTag*)tag->getList("Recipes"); for (int i = 0; i < list->size(); i++) { CompoundTag* recipeTag = list->get(i); diff --git a/targets/minecraft/world/level/BaseMobSpawner.cpp b/targets/minecraft/world/level/BaseMobSpawner.cpp index 893085100..3356314c8 100644 --- a/targets/minecraft/world/level/BaseMobSpawner.cpp +++ b/targets/minecraft/world/level/BaseMobSpawner.cpp @@ -114,10 +114,8 @@ void BaseMobSpawner::tick() { double zp = getZ() + (getLevel()->random->nextDouble() - getLevel()->random->nextDouble()) * spawnRange; - std::shared_ptr mob = - entity->instanceof(eTYPE_MOB) - ? std::dynamic_pointer_cast(entity) - : nullptr; + std::shared_ptr mob = entity->instanceof + (eTYPE_MOB) ? std::dynamic_pointer_cast(entity) : nullptr; entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0); @@ -181,8 +179,8 @@ std::shared_ptr BaseMobSpawner::loadDataAndAddEntity( data = ridingTag; } - } else if (entity->instanceof(eTYPE_LIVINGENTITY) && - entity->level != nullptr) { + } else if (entity->instanceof + (eTYPE_LIVINGENTITY) && entity->level != nullptr) { std::dynamic_pointer_cast(entity)->finalizeMobSpawn(nullptr); getLevel()->addEntity(entity); } diff --git a/targets/minecraft/world/level/ChunkPos.cpp b/targets/minecraft/world/level/ChunkPos.cpp index 7bd788bf9..5e47710ec 100644 --- a/targets/minecraft/world/level/ChunkPos.cpp +++ b/targets/minecraft/world/level/ChunkPos.cpp @@ -4,9 +4,9 @@ #include #include -#include "util/StringHelpers.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/TilePos.h" +#include "util/StringHelpers.h" ChunkPos::ChunkPos(int x, int z) : x(x), z(z) {} diff --git a/targets/minecraft/world/level/Coord.h b/targets/minecraft/world/level/Coord.h index e1add5020..f2f94d092 100644 --- a/targets/minecraft/world/level/Coord.h +++ b/targets/minecraft/world/level/Coord.h @@ -5,5 +5,5 @@ public: const int x, y, z; public: - Coord(int x, int y, int z) : x(x), y(y), z(z) {}; + Coord(int x, int y, int z) : x(x), y(y), z(z){}; }; \ No newline at end of file diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 16516e658..e942a9d4a 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Explosion.h" #include @@ -11,6 +10,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -170,7 +170,7 @@ void Explosion::explode() { e->yd += ya * kbPower; e->zd += za * kbPower; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); // Log::info("Adding player knockback (%f,%f,%f)\n", xa * @@ -300,9 +300,9 @@ Vec3 Explosion::getHitPlayerKnockback(std::shared_ptr player) { std::shared_ptr Explosion::getSourceMob() { if (source == nullptr) return nullptr; - if (source->instanceof(eTYPE_PRIMEDTNT)) + if (source->instanceof (eTYPE_PRIMEDTNT)) return std::dynamic_pointer_cast(source)->getOwner(); - if (source->instanceof(eTYPE_LIVINGENTITY)) + if (source->instanceof (eTYPE_LIVINGENTITY)) return std::dynamic_pointer_cast(source); return nullptr; } diff --git a/targets/minecraft/world/level/FoliageColor.cpp b/targets/minecraft/world/level/FoliageColor.cpp index 32b64bc16..77aae202e 100644 --- a/targets/minecraft/world/level/FoliageColor.cpp +++ b/targets/minecraft/world/level/FoliageColor.cpp @@ -1,8 +1,8 @@ #include "FoliageColor.h" #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" // 4J Stu - Don't use this any more // std::vector FoliageColor::pixels; diff --git a/targets/minecraft/world/level/GameRules.cpp b/targets/minecraft/world/level/GameRules.cpp index b3682d251..d97eebf7b 100644 --- a/targets/minecraft/world/level/GameRules.cpp +++ b/targets/minecraft/world/level/GameRules.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "GameRules.h" #include #include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" // 4J: GameRules isn't in use anymore, just routes any requests to app game host // options, kept things commented out for context @@ -40,21 +40,28 @@ GameRules::~GameRules() { bool GameRules::getBoolean(const int rule) { switch (rule) { case GameRules::RULE_DOFIRETICK: - return gameServices().getGameHostOption(eGameHostOption_FireSpreads); + return gameServices().getGameHostOption( + eGameHostOption_FireSpreads); case GameRules::RULE_MOBGRIEFING: - return gameServices().getGameHostOption(eGameHostOption_MobGriefing); + return gameServices().getGameHostOption( + eGameHostOption_MobGriefing); case GameRules::RULE_KEEPINVENTORY: - return gameServices().getGameHostOption(eGameHostOption_KeepInventory); + return gameServices().getGameHostOption( + eGameHostOption_KeepInventory); case GameRules::RULE_DOMOBSPAWNING: - return gameServices().getGameHostOption(eGameHostOption_DoMobSpawning); + return gameServices().getGameHostOption( + eGameHostOption_DoMobSpawning); case GameRules::RULE_DOMOBLOOT: return gameServices().getGameHostOption(eGameHostOption_DoMobLoot); case GameRules::RULE_DOTILEDROPS: - return gameServices().getGameHostOption(eGameHostOption_DoTileDrops); + return gameServices().getGameHostOption( + eGameHostOption_DoTileDrops); case GameRules::RULE_NATURAL_REGENERATION: - return gameServices().getGameHostOption(eGameHostOption_NaturalRegeneration); + return gameServices().getGameHostOption( + eGameHostOption_NaturalRegeneration); case GameRules::RULE_DAYLIGHT: - return gameServices().getGameHostOption(eGameHostOption_DoDaylightCycle); + return gameServices().getGameHostOption( + eGameHostOption_DoDaylightCycle); default: assert(0); return false; diff --git a/targets/minecraft/world/level/GameRules/GameRuleDefinition.h b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h index 3f87bb51b..9117995a0 100644 --- a/targets/minecraft/world/level/GameRules/GameRuleDefinition.h +++ b/targets/minecraft/world/level/GameRules/GameRuleDefinition.h @@ -6,9 +6,9 @@ #include #include +#include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRulesInstance.h" -#include "minecraft/world/item/ItemInstance.h" class GameRule; class LevelRuleset; @@ -81,7 +81,6 @@ public: GameRulesInstance::EGameRulesInstanceType type, LevelRuleset* rules, Connection* connection); static std::string generateDescriptionString( - ConsoleGameRules::EGameRuleType defType, - const std::string& description, void* data = nullptr, - int dataLength = 0); + ConsoleGameRules::EGameRuleType defType, const std::string& description, + void* data = nullptr, int dataLength = 0); }; diff --git a/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h index f39dc5794..c667076ab 100644 --- a/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h +++ b/targets/minecraft/world/level/GameRules/LevelGenerationOptions.h @@ -8,9 +8,9 @@ #include #include +#include "minecraft/locale/StringTable.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" -#include "minecraft/locale/StringTable.h" #include "minecraft/world/level/levelgen/structure/StructureFeature.h" class ApplySchematicRuleDefinition; @@ -188,7 +188,8 @@ private: bool m_bHaveMinY; int m_minY; std::unordered_map m_schematics; - std::unordered_map + std::unordered_map m_chunkRuleCache; std::vector m_biomeOverrides; std::vector m_features; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index ea7f6961d..1b984f1f9 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "Level.h" #include @@ -15,23 +13,23 @@ #include #include "Explosion.h" -#include "platform/input/input.h" #include "LevelListener.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/network/INetworkService.h" -#include "util/FrameProfiler.h" #include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/Entity.h" @@ -71,6 +69,8 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "minecraft/world/scores/Scoreboard.h" +#include "platform/input/input.h" +#include "util/FrameProfiler.h" class CompoundTag; class ItemInstance; @@ -1574,12 +1574,12 @@ bool Level::addEntity(std::shared_ptr e) { } bool forced = e->forcedLoading; - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { forced = true; } if (forced || hasChunk(xc, zc)) { - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -1634,7 +1634,7 @@ void Level::removeEntity(std::shared_ptr e) { e->ride(nullptr); } e->remove(); - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -1653,7 +1653,7 @@ void Level::removeEntity(std::shared_ptr e) { void Level::removeEntityImmediately(std::shared_ptr e) { e->remove(); - if (e->instanceof(eTYPE_PLAYER)) { + if (e->instanceof (eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -2112,8 +2112,9 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) - if (!(gameServices().debugSettingsOn() && gameServices().debugMobsDontTick() && - e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) + if (!(gameServices().debugSettingsOn() && + gameServices().debugMobsDontTick() && e->instanceof + (eTYPE_MOB) && !e->instanceof (eTYPE_PLAYER))) #endif { tick(e); @@ -3444,7 +3445,7 @@ unsigned int Level::countInstanceOf( count++; } } else { - if (e->instanceof(clas)) count++; + if (e->instanceof (clas)) count++; } } } @@ -3471,7 +3472,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, count++; } } else { - if (e->instanceof(clas)) count++; + if (e->instanceof (clas)) count++; } } } @@ -4223,7 +4224,7 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (Entity::instanceof(type, eTYPE_ENEMY)) { + else if (Entity:: instanceof (type, eTYPE_ENEMY)) { count = countInstanceOf(eTYPE_ENEMY, false); max = MobCategory::MAX_XBOX_MONSTERS_WITH_SPAWN_EGG; } else if ((type & eTYPE_AMBIENT) == eTYPE_AMBIENT) { @@ -4231,10 +4232,10 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { max = MobCategory::MAX_AMBIENT_WITH_SPAWN_EGG; } // 4J: Added minecart and boats - else if (Entity::instanceof(type, eTYPE_MINECART)) { + else if (Entity:: instanceof (type, eTYPE_MINECART)) { count = countInstanceOf(eTYPE_MINECART, false); max = Level::MAX_CONSOLE_MINECARTS; - } else if (Entity::instanceof(type, eTYPE_BOAT)) { + } else if (Entity:: instanceof (type, eTYPE_BOAT)) { count = countInstanceOf(eTYPE_BOAT, true); max = Level::MAX_XBOX_BOATS; } diff --git a/targets/minecraft/world/level/Level.h b/targets/minecraft/world/level/Level.h index 64ff774f0..43fa76d0b 100644 --- a/targets/minecraft/world/level/Level.h +++ b/targets/minecraft/world/level/Level.h @@ -10,12 +10,10 @@ #include #include -#include "platform/PlatformTypes.h" #include "ChunkPos.h" #include "LevelSource.h" #include "LightLayer.h" #include "TickNextTickData.h" -#include "platform/C4JThread.h" #include "java/Class.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/level/ChunkPos.h" @@ -24,6 +22,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "minecraft/world/phys/AABB.h" +#include "platform/C4JThread.h" +#include "platform/PlatformTypes.h" class CompoundTag; class ItemInstance; @@ -635,8 +635,8 @@ public: int source); virtual float getDifficulty(double x, double y, double z); virtual float getDifficulty(int x, int y, int z); - TilePos* findNearestMapFeature(const std::string& featureName, int x, - int y, int z); + TilePos* findNearestMapFeature(const std::string& featureName, int x, int y, + int z); // 4J Added int getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, diff --git a/targets/minecraft/world/level/PortalForcer.cpp b/targets/minecraft/world/level/PortalForcer.cpp index 505b37645..8529fd156 100644 --- a/targets/minecraft/world/level/PortalForcer.cpp +++ b/targets/minecraft/world/level/PortalForcer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "PortalForcer.h" #include @@ -8,6 +7,7 @@ #include "minecraft/Direction.h" #include "minecraft/SharedConstants.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/ChunkPos.h" diff --git a/targets/minecraft/world/level/biome/Biome.cpp b/targets/minecraft/world/level/biome/Biome.cpp index 6dc0e967c..cdf85d28d 100644 --- a/targets/minecraft/world/level/biome/Biome.cpp +++ b/targets/minecraft/world/level/biome/Biome.cpp @@ -6,11 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/biome/BeachBiome.h" #include "minecraft/world/level/biome/BiomeDecorator.h" diff --git a/targets/minecraft/world/level/biome/Biome.h b/targets/minecraft/world/level/biome/Biome.h index 57a1fe990..ad67a09a2 100644 --- a/targets/minecraft/world/level/biome/Biome.h +++ b/targets/minecraft/world/level/biome/Biome.h @@ -6,8 +6,8 @@ #include #include -#include "minecraft/GameEnums.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/util/WeighedRandom.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/biome/BiomeCache.cpp b/targets/minecraft/world/level/biome/BiomeCache.cpp index 65a8f3b3e..8912ac2b8 100644 --- a/targets/minecraft/world/level/biome/BiomeCache.cpp +++ b/targets/minecraft/world/level/biome/BiomeCache.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "BiomeCache.h" #include #include "BiomeSource.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/biome/Biome.h" BiomeCache::Block::Block(int x, int z, BiomeCache* parent) { diff --git a/targets/minecraft/world/level/biome/BiomeDecorator.cpp b/targets/minecraft/world/level/biome/BiomeDecorator.cpp index a02a9a159..76a256ba5 100644 --- a/targets/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/targets/minecraft/world/level/biome/BiomeDecorator.cpp @@ -1,8 +1,7 @@ -#include "minecraft/util/Log.h" - #include "minecraft/world/level/biome/BiomeDecorator.h" #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/WaterlilyFeature.h" diff --git a/targets/minecraft/world/level/biome/BiomeSource.cpp b/targets/minecraft/world/level/biome/BiomeSource.cpp index 3d5ac8dc3..bfbab599a 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.cpp +++ b/targets/minecraft/world/level/biome/BiomeSource.cpp @@ -1,17 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BiomeSource.h" #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" #include "java/Random.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/ChunkPos.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" @@ -19,6 +18,7 @@ #include "minecraft/world/level/biome/BiomeCache.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/input/input.h" #include "strings.h" // 4J - removal of separate temperature & downfall layers brought forward @@ -425,8 +425,8 @@ int64_t BiomeSource::findSeed(LevelType* generator) { delete pr; #if defined(DEBUG_SEEDS) - Log::info("%d: %d tries taken, seed used is %lld\n", k, - tryCount, bestSeed); + Log::info("%d: %d tries taken, seed used is %lld\n", k, tryCount, + bestSeed); BiomeSource* biomeSource = new BiomeSource(bestSeed); std::vector biomes = biomeSource->getBiomeBlock( diff --git a/targets/minecraft/world/level/biome/BiomeSource.h b/targets/minecraft/world/level/biome/BiomeSource.h index c6b15c4bc..99796531c 100644 --- a/targets/minecraft/world/level/biome/BiomeSource.h +++ b/targets/minecraft/world/level/biome/BiomeSource.h @@ -10,7 +10,6 @@ #include "BiomeSource.h" #include "minecraft/world/level/biome/BiomeSource.h" - class ChunkPos; class Level; class Layer; diff --git a/targets/minecraft/world/level/biome/IceBiome.cpp b/targets/minecraft/world/level/biome/IceBiome.cpp index e9e076cb7..2354d4642 100644 --- a/targets/minecraft/world/level/biome/IceBiome.cpp +++ b/targets/minecraft/world/level/biome/IceBiome.cpp @@ -2,4 +2,4 @@ #include "minecraft/world/level/biome/Biome.h" -IceBiome::IceBiome(int id) : Biome(id) {}; \ No newline at end of file +IceBiome::IceBiome(int id) : Biome(id){}; \ No newline at end of file diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index a6aae31d4..1d0a72562 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -1,18 +1,18 @@ #include "CompressedTileStorage.h" #include -#include #include #include #include +#include #include -#include "platform/NetTypes.h" -#include "util/Definitions.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "platform/NetTypes.h" +#include "util/Definitions.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index 14556ef88..40c9779cb 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "LevelChunk.h" #include @@ -9,15 +8,16 @@ #include #include -#include "minecraft/network/INetworkService.h" #include "SparseLightStorage.h" #include "java/Class.h" #include "java/Random.h" #include "java/System.h" #include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerChunkCache.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" @@ -1332,7 +1332,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { if (te != nullptr) { if (level->isClientSide) { Log::info("Removing tile entity of type %d\n", - te->GetType()); + te->GetType()); } te->setRemoved(); } @@ -1578,21 +1578,21 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb, // that our class may be derived from, otherwise do a direct // comparison of type_info if (ec == typeid(Player)) - isAssignableFrom = e->instanceof(eTYPE_PLAYER); + isAssignableFrom = e->instanceof (eTYPE_PLAYER); else if (ec == typeid(Entity)) - isAssignableFrom = e->instanceof(eTYPE_ENTITY); + isAssignableFrom = e->instanceof (eTYPE_ENTITY); else if (ec == typeid(Mob)) - isAssignableFrom = e->instanceof(eTYPE_MOB); + isAssignableFrom = e->instanceof (eTYPE_MOB); else if (ec == typeid(LivingEntity)) - isAssignableFrom = e->instanceof(eTYPE_LIVINGENTITY); + isAssignableFrom = e->instanceof (eTYPE_LIVINGENTITY); else if (ec == typeid(ItemEntity)) - isAssignableFrom = e->instanceof(eTYPE_ITEMENTITY); + isAssignableFrom = e->instanceof (eTYPE_ITEMENTITY); else if (ec == typeid(Minecart)) - isAssignableFrom = e->instanceof(eTYPE_MINECART); + isAssignableFrom = e->instanceof (eTYPE_MINECART); else if (ec == typeid(Monster)) - isAssignableFrom = e->instanceof(eTYPE_MONSTER); + isAssignableFrom = e->instanceof (eTYPE_MONSTER); else if (ec == typeid(Zombie)) - isAssignableFrom = e->instanceof(eTYPE_ZOMBIE); + isAssignableFrom = e->instanceof (eTYPE_ZOMBIE); else if (Entity* entity = e.get(); entity != nullptr && ec == typeid(*entity)) isAssignableFrom = true; diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index b3b56e24c..14cc70b8a 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -1,15 +1,15 @@ #include "SparseDataStorage.h" -#include #include #include #include +#include #include -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/NetTypes.h" // Note: See header for an overview of this class @@ -90,9 +90,7 @@ SparseDataStorage::~SparseDataStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(indicesAndData); - } + { free(indicesAndData); } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -474,9 +472,7 @@ void SparseDataStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(toFree); - } + { free(toFree); } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 5a29b0d52..3f9c8773d 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -1,15 +1,15 @@ #include "SparseLightStorage.h" -#include #include #include #include +#include #include -#include "platform/NetTypes.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "platform/NetTypes.h" // Note: See header for an overview of this class @@ -91,9 +91,7 @@ SparseLightStorage::~SparseLightStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(indicesAndData); - } + { free(indicesAndData); } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -478,9 +476,7 @@ void SparseLightStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { - free(toFree); - } + { free(toFree); } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 4fc2e4e70..782074473 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "ChunkStorageProfileDecorator.h" #include #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/ChunkStorage.h" ChunkStorageProfilerDecorator::ChunkStorageProfilerDecorator( diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 6ec930a2e..f7dd05eda 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionChunkStorage.h" #include @@ -10,15 +8,14 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" -#include "platform/C4JThread.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" @@ -28,9 +25,12 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOutputStream.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" +#include "platform/C4JThread.h" +#include "platform/input/input.h" class DataInput; @@ -206,15 +206,16 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) { DataOutputStream* output = RegionFileCache::getChunkDataOutputStream( m_saveFile, m_prefix, levelChunk->x, levelChunk->z); - if (m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - OldChunkStorage::save(levelChunk, level, output); + if (m_saveFile->getOriginalSaveVersion() >= + SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { + OldChunkStorage::save(levelChunk, level, output); - { - std::lock_guard lock(cs_memory); - s_chunkDataQueue.push_back(output); - } - // 4jcraft: WAKE UP, WAKE THE FUCK.. UP - s_queueCondition.notify_one(); + { + std::lock_guard lock(cs_memory); + s_chunkDataQueue.push_back(output); + } + // 4jcraft: WAKE UP, WAKE THE FUCK.. UP + s_queueCondition.notify_one(); } else { CompoundTag* tag; @@ -349,11 +350,12 @@ int McRegionChunkStorage::runSaveThreadProc(void* lpParam) { while (running) { { std::unique_lock lock(cs_memory); - s_queueCondition.wait(lock, [] { return !s_chunkDataQueue.empty(); }); + s_queueCondition.wait(lock, + [] { return !s_chunkDataQueue.empty(); }); dos = s_chunkDataQueue.front(); s_chunkDataQueue.pop_front(); s_runningThreadCount++; - } // Unlock so the main thread can keep working + } // Unlock so the main thread can keep working if (dos) { dos->close(); @@ -394,12 +396,10 @@ void McRegionChunkStorage::WaitForSaves() { static const int MAX_QUEUE_SIZE = 12; static const int DESIRED_QUEUE_SIZE = 6; - std::unique_lock lock(cs_memory); if (s_chunkDataQueue.size() > MAX_QUEUE_SIZE) { // Pause until the queue drains down to the desired size - s_waitCondition.wait(lock, [] { - return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; - }); + s_waitCondition.wait( + lock, [] { return s_chunkDataQueue.size() <= DESIRED_QUEUE_SIZE; }); } } diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h index 2938d9a37..644379c9b 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.h @@ -2,6 +2,7 @@ #include +#include // 4jcraft: im pretty sure there's a better alternative to this. #include #include #include @@ -14,7 +15,6 @@ #include "RegionFileCache.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "nbt/NbtIo.h" -#include // 4jcraft: im pretty sure there's a better alternative to this. class ConsoleSaveFile; class C4JThread; diff --git a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp index 3023cbf3b..8f5237b2d 100644 --- a/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/MemoryChunkStorage.cpp @@ -1,8 +1,5 @@ #include "MemoryChunkStorage.h" - - - LevelChunk* MemoryChunkStorage::load(Level* level, int x, int z) // throws IOException { diff --git a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp index 2e4fb78ee..325ba6ced 100644 --- a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp @@ -12,7 +12,8 @@ std::FILE* OpenBinaryFileForReadWrite(const File& file) { stream = _wfopen(file.getPath().c_str(), "w+b"); } #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index edab83d55..eff498ad8 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OldChunkStorage.h" #include @@ -12,14 +10,14 @@ #include #include -#include "platform/input/input.h" -#include "minecraft/Console_Debug_enum.h" -#include "util/Definitions.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/FileOutputStream.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/level/Level.h" @@ -32,6 +30,8 @@ #include "nbt/CompoundTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" +#include "util/Definitions.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; @@ -469,10 +469,9 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } @@ -578,10 +577,9 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { for (int i = 0; i < tileTicks->size(); i++) { CompoundTag* teTag = tileTicks->get(i); - level->forceAddTileTick( - teTag->getInt("x"), teTag->getInt("y"), - teTag->getInt("z"), teTag->getInt("i"), - teTag->getInt("t"), teTag->getInt("p")); + level->forceAddTileTick(teTag->getInt("x"), teTag->getInt("y"), + teTag->getInt("z"), teTag->getInt("i"), + teTag->getInt("t"), teTag->getInt("p")); } } } diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp index 31f1d0b49..ae3a8db5a 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "RegionFile.h" #include @@ -7,14 +6,15 @@ #include #include -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" std::vector RegionFile::emptySector(SECTOR_BYTES); diff --git a/targets/minecraft/world/level/chunk/storage/RegionFile.h b/targets/minecraft/world/level/chunk/storage/RegionFile.h index bca5b99d4..1d1475836 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFile.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFile.h @@ -4,9 +4,9 @@ #include #include -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" class FileEntry; class ConsoleSaveFile; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp index 273cf8266..2eda9aacf 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.cpp @@ -2,11 +2,11 @@ #include -#include "util/StringHelpers.h" #include "java/File.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/StringHelpers.h" class DataInputStream; class DataOutputStream; @@ -37,11 +37,11 @@ RegionFile* RegionFileCache::_getRegionFile( // toWString(chunkZ>>5) + ".mcr" ); File file; if (useSplitSaves(saveFile->getSavePlatform())) { - file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + - "." + toWString(chunkZ >> 4) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 4) + "." + + toWString(chunkZ >> 4) + ".mcr"); } else { - file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + - "." + toWString(chunkZ >> 5) + ".mcr"); + file = File(prefix + std::string("r.") + toWString(chunkX >> 5) + "." + + toWString(chunkZ >> 5) + ".mcr"); } RegionFile* ref = nullptr; diff --git a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h index 36dfe0547..e07bc8cba 100644 --- a/targets/minecraft/world/level/chunk/storage/RegionFileCache.h +++ b/targets/minecraft/world/level/chunk/storage/RegionFileCache.h @@ -49,8 +49,7 @@ public: } static void clear() { s_defaultCache._clear(); } static int getSizeDelta(ConsoleSaveFile* saveFile, - const std::string& prefix, int chunkX, - int chunkZ) { + const std::string& prefix, int chunkX, int chunkZ) { return s_defaultCache._getSizeDelta(saveFile, prefix, chunkX, chunkZ); } static DataInputStream* getChunkDataInputStream(ConsoleSaveFile* saveFile, @@ -59,9 +58,9 @@ public: return s_defaultCache._getChunkDataInputStream(saveFile, prefix, chunkX, chunkZ); } - static DataOutputStream* getChunkDataOutputStream( - ConsoleSaveFile* saveFile, const std::string& prefix, int chunkX, - int chunkZ) { + static DataOutputStream* getChunkDataOutputStream(ConsoleSaveFile* saveFile, + const std::string& prefix, + int chunkX, int chunkZ) { return s_defaultCache._getChunkDataOutputStream(saveFile, prefix, chunkX, chunkZ); } diff --git a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp index 7babd8962..cbf5e30ed 100644 --- a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp @@ -13,7 +13,8 @@ std::FILE* OpenBinaryFileForReadWrite(const File& file) { stream = _wfopen(file.getPath().c_str(), "w+b"); } #else - const std::string nativePath = std::filesystem::path(file.getPath()).string(); + const std::string nativePath = + std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); diff --git a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp index 7dfd1135e..8574cb912 100644 --- a/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZonedChunkStorage.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "ZonedChunkStorage.h" #include @@ -7,10 +6,7 @@ #include "ZoneFile.h" #include "java/ByteBuffer.h" #include "java/File.h" - - - - +#include "minecraft/util/Log.h" // 4J Stu - There are changes to this class for 1.8.2, but since we never use it // anyway lets not worry about it @@ -63,14 +59,15 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) { char zRadix36[64]; _itow(x, xRadix36, 36); _itow(z, zRadix36, 36); - File file = File(dir, std::string("zone_") + toString(xRadix36) + - "_" + toString(zRadix36) + ".dat"); + File file = File(dir, std::string("zone_") + toString(xRadix36) + "_" + + toString(zRadix36) + ".dat"); if (!file.exists()) { if (!create) return nullptr; - void* ch = CreateFile(std::filesystem::path(file.getPath()).string().c_str(), - GENERIC_READ | GENERIC_WRITE, 0, nullptr, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + void* ch = CreateFile( + std::filesystem::path(file.getPath()).string().c_str(), + GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, nullptr); CloseHandle(ch); } diff --git a/targets/minecraft/world/level/dimension/Dimension.cpp b/targets/minecraft/world/level/dimension/Dimension.cpp index 7fba66a4f..838508367 100644 --- a/targets/minecraft/world/level/dimension/Dimension.cpp +++ b/targets/minecraft/world/level/dimension/Dimension.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "Dimension.h" #include @@ -6,13 +5,13 @@ #include #include "HellDimension.h" -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/Console_Debug_enum.h" #include "NormalDimension.h" #include "TheEndDimension.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -26,6 +25,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" class Pos; diff --git a/targets/minecraft/world/level/dimension/HellDimension.cpp b/targets/minecraft/world/level/dimension/HellDimension.cpp index aeb72fc0d..36e78808e 100644 --- a/targets/minecraft/world/level/dimension/HellDimension.cpp +++ b/targets/minecraft/world/level/dimension/HellDimension.cpp @@ -1,13 +1,12 @@ -#include "minecraft/IGameServices.h" #include "HellDimension.h" #include -#include "platform/input/input.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/biome/Biome.h" @@ -16,6 +15,7 @@ #include "minecraft/world/level/levelgen/HellRandomLevelSource.h" #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/phys/Vec3.h" +#include "platform/input/input.h" void HellDimension::init() { biomeSource = new FixedBiomeSource(Biome::hell, 1, 0); diff --git a/targets/minecraft/world/level/dimension/TheEndDimension.cpp b/targets/minecraft/world/level/dimension/TheEndDimension.cpp index 5558b808d..3959cd442 100644 --- a/targets/minecraft/world/level/dimension/TheEndDimension.cpp +++ b/targets/minecraft/world/level/dimension/TheEndDimension.cpp @@ -5,9 +5,9 @@ #include #include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/Pos.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/FixedBiomeSource.h" diff --git a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp index e3931d2e8..dec6f2565 100644 --- a/targets/minecraft/world/level/levelgen/CanyonFeature.cpp +++ b/targets/minecraft/world/level/levelgen/CanyonFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" #include "CanyonFeature.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" @@ -182,7 +182,7 @@ void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, thickness, yRot, xRot, 0, 0, 3.0); // 4J Add to feature list - gameServices().addTerrainFeaturePosition(eTerrainFeature_Ravine, - (int)(xCave / 16.0), (int)(yCave / 16.0)); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_Ravine, (int)(xCave / 16.0), (int)(yCave / 16.0)); } } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 45e17ba87..71f528ed3 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -1,15 +1,15 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CustomLevelSource.h" #include #include #include +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "platform/fs/fs.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" +#include "platform/fs/fs.h" #if defined(__linux__) #endif #include "java/Random.h" @@ -61,9 +61,9 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, { const char* waterHeightPath = "GameRules/waterheight.bin"; - auto result = PlatformFilesystem.readFile( - waterHeightPath, m_waterheightOverride.data(), - m_waterheightOverride.size()); + auto result = PlatformFilesystem.readFile(waterHeightPath, + m_waterheightOverride.data(), + m_waterheightOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { memset(m_waterheightOverride.data(), level->seaLevel, m_waterheightOverride.size()); @@ -260,7 +260,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* lgo = + gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } diff --git a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp index 5c4db433b..199527881 100644 --- a/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/FlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "FlatLevelSource.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" diff --git a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp index b63f9a61f..1f692fd8c 100644 --- a/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellFlatLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellFlatLevelSource.h" #include @@ -8,6 +7,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" @@ -192,9 +192,7 @@ bool HellFlatLevelSource::tick() { return false; } bool HellFlatLevelSource::shouldSave() { return true; } -std::string HellFlatLevelSource::gatherStats() { - return "HellFlatLevelSource"; -} +std::string HellFlatLevelSource::gatherStats() { return "HellFlatLevelSource"; } std::vector* HellFlatLevelSource::getMobsAt( MobCategory* mobCategory, int x, int y, int z) { diff --git a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp index 47c1ad8f0..f7e4f435f 100644 --- a/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/HellRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HellRandomLevelSource.h" #include @@ -9,6 +8,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp index f56d9c44f..78c68988b 100644 --- a/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "RandomLevelSource.h" #include @@ -6,11 +5,11 @@ #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "util/Timer.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/MobCategory.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/MobSpawner.h" #include "minecraft/world/level/biome/Biome.h" @@ -31,6 +30,7 @@ #include "minecraft/world/level/tile/HeavyTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/Vec3.h" +#include "util/Timer.h" const double RandomLevelSource::SNOW_SCALE = 0.3; const double RandomLevelSource::SNOW_CUTOFF = 0.5; @@ -408,7 +408,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, uint8_t top = b->topMaterial; uint8_t material = b->material; - LevelGenerationOptions* lgo = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* lgo = + gameServices().getLevelGenerationOptions(); if (lgo != nullptr) { lgo->getBiomeOverride(b->id, material, top); } diff --git a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp index e7d49ab9e..945ba6fee 100644 --- a/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/TheEndLevelRandomLevelSource.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "TheEndLevelRandomLevelSource.h" #include @@ -7,6 +6,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index 1abccac72..9337440bf 100644 --- a/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BasicTreeFeature.h" #include @@ -7,9 +5,11 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp index d228f701c..69cb44d15 100644 --- a/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/BirchFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "BirchFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp index ddaef9032..9869f8c77 100644 --- a/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/CaveFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "CaveFeature.h" #include @@ -7,9 +5,11 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/levelgen/feature/Feature.h b/targets/minecraft/world/level/levelgen/feature/Feature.h index bae9a41ce..298b13852 100644 --- a/targets/minecraft/world/level/levelgen/feature/Feature.h +++ b/targets/minecraft/world/level/levelgen/feature/Feature.h @@ -10,7 +10,7 @@ private: public: Feature(); Feature(bool doUpdate); - virtual ~Feature() {}; + virtual ~Feature(){}; virtual bool place(Level* level, Random* random, int x, int y, int z) = 0; virtual bool placeWithIndex(Level* level, Random* random, int x, int y, diff --git a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp index d89fe6b1c..7a47479c6 100644 --- a/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/FlowerFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "FlowerFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp index c67658f41..044972f15 100644 --- a/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/LakeFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "LakeFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LightLayer.h" #include "minecraft/world/level/biome/Biome.h" diff --git a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index 214bde128..dfb384dcc 100644 --- a/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "MegaTreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp index 37349752a..f813a49b2 100644 --- a/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "OreFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp index eb9d1fe87..f97635dce 100644 --- a/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/PineFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "PineFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/LeafTile.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp index 490da93af..98b5561e5 100644 --- a/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/ReedsFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "ReedsFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp index cb9d74b75..d1cb2e072 100644 --- a/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SandFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SandFeature.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp index 78f0a89f4..e19d76c11 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpikeFeature.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "SpikeFeature.h" #include #include "java/Random.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp index 9ddb6aa2b..8c4e59c03 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpringFeature.cpp @@ -1,7 +1,7 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpringFeature.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp index 2bb1579fe..862259be1 100644 --- a/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SpruceFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SpruceFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/LeafTile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp index 72664fbc3..e87779b0c 100644 --- a/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/SwampTreeFeature.cpp @@ -1,11 +1,11 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "SwampTreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 50bd605dd..d89f5741f 100644 --- a/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "TreeFeature.h" #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/levelgen/feature/Feature.h" #include "minecraft/world/level/tile/Tile.h" diff --git a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp index b3e577f17..13e6f694b 100644 --- a/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp +++ b/targets/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.cpp @@ -1,16 +1,15 @@ #include "FlatGeneratorInfo.h" -#include "util/StringHelpers.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/levelgen/flat/FlatLayerInfo.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" const std::string FlatGeneratorInfo::STRUCTURE_VILLAGE = "village"; const std::string FlatGeneratorInfo::STRUCTURE_BIOME_SPECIFIC = "biome_1"; const std::string FlatGeneratorInfo::STRUCTURE_STRONGHOLD = "stronghold"; const std::string FlatGeneratorInfo::STRUCTURE_MINESHAFT = "mineshaft"; -const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = - "decoration"; +const std::string FlatGeneratorInfo::STRUCTURE_BIOME_DECORATION = "decoration"; const std::string FlatGeneratorInfo::STRUCTURE_LAKE = "lake"; const std::string FlatGeneratorInfo::STRUCTURE_LAVA_LAKE = "lava_lake"; const std::string FlatGeneratorInfo::STRUCTURE_DUNGEON = "dungeon"; @@ -27,8 +26,7 @@ int FlatGeneratorInfo::getBiome() { return biome; } void FlatGeneratorInfo::setBiome(int biome) { this->biome = biome; } -std::unordered_map >* +std::unordered_map >* FlatGeneratorInfo::getStructures() { return &structures; } diff --git a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp index aa7b4061d..ca634a00e 100644 --- a/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp +++ b/targets/minecraft/world/level/levelgen/structure/BoundingBox.cpp @@ -5,10 +5,10 @@ #include #include -#include "util/StringHelpers.h" #include "java/JavaMath.h" #include "minecraft/Direction.h" #include "nbt/IntArrayTag.h" +#include "util/StringHelpers.h" BoundingBox::BoundingBox() { // 4J added initialisers diff --git a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp index ce2517043..30bbcb970 100644 --- a/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/MineShaftFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" - #include "minecraft/world/level/levelgen/structure/MineShaftFeature.h" #include @@ -9,10 +7,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" const std::string MineShaftFeature::OPTION_CHANCE = "chance"; @@ -34,7 +33,8 @@ MineShaftFeature::MineShaftFeature( bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Mineshaft); diff --git a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp index 039adbf3a..9a9dc7151 100644 --- a/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/NetherBridgeFeature.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "NetherBridgeFeature.h" #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "NetherBridgePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -59,7 +59,8 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { } bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_NetherBridge); diff --git a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp index 078f0eb2a..26f4c590b 100644 --- a/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/RandomScatteredLargeFeature.cpp @@ -1,14 +1,14 @@ -#include "minecraft/IGameServices.h" #include "RandomScatteredLargeFeature.h" #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "ScatteredFeaturePieces.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -67,7 +67,8 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Temples); diff --git a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp index 1716d3a3b..71d300c68 100644 --- a/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/ScatteredFeaturePieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ScatteredFeaturePieces.h" #include @@ -6,15 +5,16 @@ #include #include -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/entity/monster/Witch.h" #include "minecraft/world/item/DyePowderItem.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" @@ -60,7 +60,8 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece( orientation = random->nextInt(4); - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { int tempOrientation = 0; if (levelGenOptions->isFeatureChunk(west >> 4, north >> 4, diff --git a/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp index a317fe9e6..be517ba77 100644 --- a/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp +++ b/targets/minecraft/world/level/levelgen/structure/SkyIslandDimension.cpp @@ -1,10 +1,5 @@ #include "SkyIslandDimension.h" - - - - - void SkyIslandDimension::init() { biomeSource = new FixedBiomeSource(Biome::sky, 0.5f, 0); id = 1; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp index 7eccbe1ce..777392973 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdFeature.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "StrongholdFeature.h" #include @@ -10,13 +8,15 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "StrongholdPieces.h" #include "java/JavaMath.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/level/ChunkPos.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/TilePos.h" #include "minecraft/world/level/biome/Biome.h" @@ -166,8 +166,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { "%d)\n", selectedX, selectedZ, position->x, position->z); // 4J added - gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - selectedX, selectedZ); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_Stronghold, selectedX, selectedZ); // 4J Added hasFoundValidPos = true; @@ -197,8 +197,8 @@ bool StrongholdFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { // for #81933 - GAMEPLAY: The Eye of Ender occasionally does not // appear when used to try and locate the End Portal. gameServices().addTerrainFeaturePosition(eTerrainFeature_Stronghold, - strongholdPos[0]->x, - strongholdPos[0]->z); + strongholdPos[0]->x, + strongholdPos[0]->z); } isSpotSelected = true; diff --git a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp index 3b4f25cbd..9e5021c69 100644 --- a/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StrongholdPieces.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "StrongholdPieces.h" #include @@ -7,11 +6,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/WeighedTreasure.h" #include "minecraft/world/item/CoalItem.h" #include "minecraft/world/item/EnchantedBookItem.h" @@ -30,6 +29,7 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/MobSpawnerTileEntity.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" int StrongholdPieces::totalWeight = 0; std::list StrongholdPieces::currentPieces; @@ -1970,8 +1970,8 @@ bool StrongholdPieces::PortalRoom::postProcess(Level* level, Random* random, // 4J Stu - The mob spawner location is close enough for the map // icon display, and this ensures that we only need to set the // position once - gameServices().addTerrainFeaturePosition(eTerrainFeature_StrongholdEndPortal, - x, z); + gameServices().addTerrainFeaturePosition( + eTerrainFeature_StrongholdEndPortal, x, z); level->getLevelData()->setXStrongholdEndPortal(x); level->getLevelData()->setZStrongholdEndPortal(z); level->getLevelData()->setHasStrongholdEndPortal(); diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp index 17741eb9f..9516fa122 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureIO.cpp @@ -1,10 +1,10 @@ -#include "minecraft/util/Log.h" #include "StructureFeatureIO.h" #include #include #include +#include "minecraft/util/Log.h" #include "minecraft/world/level/levelgen/structure/MineShaftPieces.h" #include "minecraft/world/level/levelgen/structure/MineShaftStart.h" #include "minecraft/world/level/levelgen/structure/NetherBridgeFeature.h" @@ -96,7 +96,7 @@ StructureStart* StructureFeatureIO::loadStaticStart(CompoundTag* tag, start->load(level, tag); } else { Log::info("Skipping Structure with id %s", - tag->getString("id").c_str()); + tag->getString("id").c_str()); } return start; } @@ -113,8 +113,7 @@ StructurePiece* StructureFeatureIO::loadStaticPiece(CompoundTag* tag, if (piece != nullptr) { piece->load(level, tag); } else { - Log::info("Skipping Piece with id %s", - tag->getString("id").c_str()); + Log::info("Skipping Piece with id %s", tag->getString("id").c_str()); } return piece; } \ No newline at end of file diff --git a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp index 3efefcfd8..21222c680 100644 --- a/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp +++ b/targets/minecraft/world/level/levelgen/structure/StructureFeatureSavedData.cpp @@ -2,9 +2,9 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "nbt/CompoundTag.h" +#include "util/StringHelpers.h" std::string StructureFeatureSavedData::TAG_FEATURES = "Features"; @@ -35,7 +35,7 @@ void StructureFeatureSavedData::putFeatureTag(CompoundTag* tag, int chunkX, } std::string StructureFeatureSavedData::createFeatureTagId(int chunkX, - int chunkZ) { + int chunkZ) { return "[" + toWString(chunkX) + "," + toWString(chunkZ) + "]"; } diff --git a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp index 7809d2e75..818b189b1 100644 --- a/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp +++ b/targets/minecraft/world/level/levelgen/structure/VillageFeature.cpp @@ -1,16 +1,16 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "VillageFeature.h" #include #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "VillagePieces.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" @@ -85,7 +85,8 @@ bool VillageFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { z = zz; bool forcePlacement = false; - LevelGenerationOptions* levelGenOptions = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGenOptions = + gameServices().getLevelGenerationOptions(); if (levelGenOptions != nullptr) { forcePlacement = levelGenOptions->isFeatureChunk(x, z, eFeature_Village); diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index ac5c7ba22..f11c6a6d7 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -1,11 +1,11 @@ -#include "minecraft/util/Log.h" #include "BiomeOverrideLayer.h" #include #include "minecraft/IGameServices.h" -#include "platform/fs/fs.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/newbiome/layer/Layer.h" +#include "platform/fs/fs.h" #if defined(__linux__) #endif #include "minecraft/world/level/biome/Biome.h" @@ -15,8 +15,8 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { { const char* path = "GameRules/biomemap.bin"; - auto result = PlatformFilesystem.readFile( - path, m_biomeOverride.data(), m_biomeOverride.size()); + auto result = PlatformFilesystem.readFile(path, m_biomeOverride.data(), + m_biomeOverride.size()); if (result.status == IPlatformFilesystem::ReadStatus::NotFound) { Log::info("Biome override not found, using plains as default\n"); memset(m_biomeOverride.data(), Biome::plains->id, diff --git a/targets/minecraft/world/level/newbiome/layer/Layer.cpp b/targets/minecraft/world/level/newbiome/layer/Layer.cpp index 2260891db..bacde1c54 100644 --- a/targets/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/Layer.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include @@ -7,8 +6,8 @@ #include #include "BiomeOverrideLayer.h" -#include "platform/input/input.h" #include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/LevelType.h" #include "minecraft/world/level/newbiome/layer/AddIslandLayer.h" #include "minecraft/world/level/newbiome/layer/AddMushroomIslandLayer.h" @@ -26,6 +25,7 @@ #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/input/input.h" std::vector> Layer::getDefaultLayers( int64_t seed, LevelType* levelType) { diff --git a/targets/minecraft/world/level/pathfinder/Node.cpp b/targets/minecraft/world/level/pathfinder/Node.cpp index e5fe4fb07..222df853f 100644 --- a/targets/minecraft/world/level/pathfinder/Node.cpp +++ b/targets/minecraft/world/level/pathfinder/Node.cpp @@ -7,8 +7,8 @@ #include -#include "util/StringHelpers.h" #include "minecraft/util/Mth.h" +#include "util/StringHelpers.h" void Node::_init() { heapIdx = -1; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h index b58a8dd20..1565a00c4 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h @@ -10,7 +10,7 @@ enum class SaveFileSeekOrigin { Begin, Current, End }; class ConsoleSaveFile { public: - virtual ~ConsoleSaveFile() {}; + virtual ~ConsoleSaveFile(){}; virtual FileEntry* createFile(const ConsoleSavePath& fileName) = 0; virtual void deleteFile(FileEntry* file) = 0; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp index dc3b599ae..75290bc2d 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp @@ -116,7 +116,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, FileEntry* targetFe = targetSave->createFile(targetPlayerDatPath); printf("Processing player dat file %s\n", - playerFiles->at(fileIdx)->data.filename); + playerFiles->at(fileIdx)->data.filename); ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe); targetFe->data.lastModifiedTime = @@ -169,8 +169,8 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, if (dis) { int read = dis->read(); DataOutputStream* dos = - targetCache._getChunkDataOutputStream(targetSave, "", - x, z); + targetCache._getChunkDataOutputStream(targetSave, "", x, + z); BufferedOutputStream bos(dos, 1024 * 1024); while (read != -1) { bos.write(read & 0xff); @@ -303,7 +303,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, } else { #if !defined(_CONTENT_PACKAGE) printf("%s is not a region file, ignoring\n", - fe->data.filename); + fe->data.filename); #endif } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index b1e4f1370..052bd2851 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include @@ -14,26 +12,27 @@ #include #include -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/storage/storage.h" +#include "platform/PlatformTypes.h" #include "platform/fs/fs.h" - +#include "platform/storage/storage.h" ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( const std::string& fileName, void* pvSaveData /*= nullptr*/, @@ -46,7 +45,8 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -68,7 +68,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } void* pvSourceData = pvSaveMem; @@ -548,8 +548,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); std::uint8_t* pbThumbnailData = nullptr; unsigned int dwThumbnailDataSize = 0; @@ -559,7 +558,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { #ifdef _WINDOWS64 gameServices().getSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize, - &pbDataSaveImage, &dwDataSizeSaveImage); + &pbDataSaveImage, &dwDataSizeSaveImage); #endif std::uint8_t bTextMetadata[88] = {}; @@ -785,8 +784,7 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index 6e5be08ff..af1771527 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -4,10 +4,10 @@ #include #include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" class ConsoleSaveFileOriginal : public ConsoleSaveFile { private: diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index b1bb7a155..40fcd3baf 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #include @@ -15,32 +13,33 @@ #include #include -#include "platform/fs/fs.h" -#include "platform/PlatformTypes.h" -#include "minecraft/GameEnums.h" -#include "minecraft/BuildVer.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "util/Timer.h" -#include "util/StringHelpers.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "java/File.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/BuildVer.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/level/ServerLevel.h" +#include "minecraft/util/Log.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/storage/LevelData.h" +#include "platform/PlatformTypes.h" +#include "platform/fs/fs.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" +#include "util/Timer.h" class ProgressListener; - ConsoleSaveFileSplit::RegionFileReference::RegionFileReference( int index, unsigned int regionIndex, unsigned int length /*=0*/, unsigned char* data /*=nullptr*/) { @@ -363,7 +362,8 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit( // Load a save from the game rules bool bLevelGenBaseSave = false; - LevelGenerationOptions* levelGen = gameServices().getLevelGenerationOptions(); + LevelGenerationOptions* levelGen = + gameServices().getLevelGenerationOptions(); if (pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); @@ -450,7 +450,7 @@ void ConsoleSaveFileSplit::_init(const std::string& fileName, void* pvSaveData, unsigned int storageLength; PlatformStorage.GetSaveData(pvSaveMem, &storageLength); Log::info("Filesize - %d, Adjusted size - %d\n", fileSize, - storageLength); + storageLength); fileSize = storageLength; } @@ -932,9 +932,8 @@ void ConsoleSaveFileSplit::tick() { #endif if (writeRequired) { - PlatformStorage.SaveSubfiles([this](bool bRes) { - return SaveRegionFilesCallback(this, bRes); - }); + PlatformStorage.SaveSubfiles( + [this](bool bRes) { return SaveRegionFilesCallback(this, bRes); }); } ReleaseSaveAccess(); @@ -1151,7 +1150,7 @@ std::string ConsoleSaveFileSplit::GetNameFromNumericIdentifier( signed char regionX = (idIn >> 8) & 255; signed char regionZ = idIn & 255; std::string region = (prefix + std::string("r.") + toWString(regionX) + - "." + toWString(regionZ) + ".mcr"); + "." + toWString(regionZ) + ".mcr"); return region; } @@ -1236,7 +1235,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { fileSize); Log::info("Check buffer size: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -1253,15 +1252,14 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { pvSaveMem, fileSize); Log::info("Compress: Elapsed time %f\n", - static_cast(timer.elapsed_seconds())); + static_cast(timer.elapsed_seconds())); memset(compData, 0, 8); int saveVer = 0; memcpy(compData, &saveVer, sizeof(int)); memcpy(compData + 4, &fileSize, sizeof(int)); - Log::info("Save data compressed from %d to %d\n", fileSize, - compLength); + Log::info("Save data compressed from %d to %d\n", fileSize, compLength); if (updateThumbnail) { std::uint8_t* pbThumbnailData = nullptr; @@ -1301,9 +1299,8 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { PlatformStorage.GetSaveUniqueNumber(&saveOrCheckpointId); // save the data - PlatformStorage.SaveSaveData([this](bool bRes) { - return SaveSaveDataCallback(this, bRes); - }); + PlatformStorage.SaveSaveData( + [this](bool bRes) { return SaveSaveDataCallback(this, bRes); }); #if !defined(_CONTENT_PACKAGE) if (gameServices().debugSettingsOn()) { if (gameServices().getWriteSavesToFolderEnabled()) { @@ -1517,8 +1514,7 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { Log::info("Processing a region file: %s\n", fName.c_str()); ConvertRegionFile(File(fe->data.filename)); } else { - Log::info("%s is not a region file, ignoring\n", - fName.c_str()); + Log::info("%s is not a region file, ignoring\n", fName.c_str()); } } diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index bfc05165f..a62d12407 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -5,10 +5,10 @@ #include #include -#include "util/Definitions.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" class ProgressRenderer; class ProgressListener; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 991a8af5b..946f107c5 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -2,8 +2,6 @@ // #define _DEBUG_FILE_HEADER -#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" - #include #include @@ -13,8 +11,9 @@ #include #include "app/linux/LinuxGame.h" -#include "util/Definitions.h" #include "java/System.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" +#include "util/Definitions.h" extern LinuxGame app; @@ -114,8 +113,8 @@ void FileHeader::WriteHeader(void* saveMem) { char* headerPosition = (char*)saveMem + headerOffset; #if defined(_DEBUG_FILE_HEADER) - Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nWrite file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif // Write the header @@ -181,8 +180,8 @@ void FileHeader::ReadHeader( Log::info( "Read save file with orignal version: %d, and current version %d\n", m_originalSaveVersion, m_saveVersion); - Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", - headerOffset, headerSize); + Log::info("\n\nRead file Header: Offset = %d, Size = %d\n", headerOffset, + headerSize); #endif char* headerPosition = (char*)saveMem + headerOffset; @@ -268,11 +267,10 @@ void FileHeader::ReadHeader( lastFile = entry; fileTable.push_back(entry); #if defined(_DEBUG_FILE_HEADER) - Log::info( - "File: %s, Start = %d, Length = %d, End = %d\n", - entry->data.filename, entry->data.startOffset, - entry->data.length, - entry->data.startOffset + entry->data.length); + Log::info("File: %s, Start = %d, Length = %d, End = %d\n", + entry->data.filename, entry->data.startOffset, + entry->data.length, + entry->data.startOffset + entry->data.length); #endif i += sizeof(FileEntrySaveDataV1); @@ -281,8 +279,7 @@ void FileHeader::ReadHeader( } break; default: #if !defined(_CONTENT_PACKAGE) - Log::info("********** Invalid save version %d\n", - m_saveVersion); + Log::info("********** Invalid save version %d\n", m_saveVersion); assert(0); #endif break; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h index c0955c660..fdc151b46 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h @@ -1,13 +1,12 @@ #pragma once +#include #include #include #include #include #include -#include - #define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ (static_cast(static_cast(ch0)) | \ (static_cast(static_cast(ch1)) << 8) | \ @@ -81,8 +80,8 @@ enum ESavePlatform { struct FileEntrySaveDataV1 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B // This is only valid once the save file has been written/loaded at least // once @@ -93,8 +92,8 @@ public: // updating 4J Stu - As of writing the tutorial level uses a V1 save file struct FileEntrySaveDataV2 { public: - char filename[64]; // 64 * 2B - unsigned int length; // In bytes // 4B + char filename[64]; // 64 * 2B + unsigned int length; // In bytes // 4B union { // This is only valid once the save file has been written/loaded at diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp index 0397adb6d..26b8f0156 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/compression.cpp @@ -2,12 +2,11 @@ #include #include +#include #include #include -#include - thread_local Compression::ThreadStorage* Compression::m_tlsCompression = nullptr; Compression::ThreadStorage* Compression::m_tlsCompressionDefault = nullptr; @@ -41,8 +40,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, void* pSource, unsigned int SrcSize) { std::lock_guard lock(rleCompressLock); - if (rleCompressBuf.size() < SrcSize * 2) - rleCompressBuf.resize(SrcSize * 2); + if (rleCompressBuf.size() < SrcSize * 2) rleCompressBuf.resize(SrcSize * 2); unsigned char* pucIn = (unsigned char*)pSource; unsigned char* pucEnd = pucIn + SrcSize; @@ -60,8 +58,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, *pucOut++ = 255; *pucOut++ = count - 1; } else { - for (unsigned int i = 0; i < count; i++) - *pucOut++ = thisOne; + for (unsigned int i = 0; i < count; i++) *pucOut++ = thisOne; } } else { *pucOut++ = 255; @@ -81,8 +78,7 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, std::lock_guard lock(rleDecompressLock); unsigned int rleSize = *pDestSize; - if (rleDecompressBuf.size() < rleSize) - rleDecompressBuf.resize(rleSize); + if (rleDecompressBuf.size() < rleSize) rleDecompressBuf.resize(rleSize); Decompress(rleDecompressBuf.data(), &rleSize, pSource, SrcSize); @@ -96,13 +92,11 @@ int32_t Compression::DecompressLZXRLE(void* pDestination, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; @@ -172,13 +166,11 @@ int32_t Compression::DecompressRLE(void* pDestination, unsigned int* pDestSize, unsigned int count = *pucIn++; if (count < 3) { count++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = 255; + for (unsigned int i = 0; i < count; i++) *pucOut++ = 255; } else { count++; unsigned char data = *pucIn++; - for (unsigned int i = 0; i < count; i++) - *pucOut++ = data; + for (unsigned int i = 0; i < count; i++) *pucOut++ = data; } } else { *pucOut++ = thisOne; diff --git a/targets/minecraft/world/level/storage/DerivedLevelData.cpp b/targets/minecraft/world/level/storage/DerivedLevelData.cpp index 6a4da8059..a70321548 100644 --- a/targets/minecraft/world/level/storage/DerivedLevelData.cpp +++ b/targets/minecraft/world/level/storage/DerivedLevelData.cpp @@ -38,9 +38,7 @@ CompoundTag* DerivedLevelData::getLoadedPlayerTag() { return wrapped->getLoadedPlayerTag(); } -std::string DerivedLevelData::getLevelName() { - return wrapped->getLevelName(); -} +std::string DerivedLevelData::getLevelName() { return wrapped->getLevelName(); } int DerivedLevelData::getVersion() { return wrapped->getVersion(); } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 050851a20..c3881941d 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "DirectoryLevelStorage.h" #include @@ -12,11 +10,8 @@ #include #include -#include "platform/input/input.h" #include "LevelData.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/GameRules/GameRuleManager.h" -#include "util/StringHelpers.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" @@ -24,6 +19,9 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/InputOutputStream/FileOutputStream.h" #include "java/System.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" @@ -40,7 +38,9 @@ #include "nbt/DoubleTag.h" #include "nbt/ListTag.h" #include "nbt/NbtIo.h" +#include "platform/input/input.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" const std::string DirectoryLevelStorage::sc_szPlayerDir("players/"); @@ -165,7 +165,7 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings( dos->writeInt(m_mappings.size()); for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { Log::info(" -- %lld (0x%016llx) = %d\n", it->first, it->first, - it->second); + it->second); dos->writeLong(it->first); dos->writeInt(it->second); } @@ -401,9 +401,8 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { delete it->second; } m_cachedSaveData[realFile.getName()] = bos; - Log::info( - "Cached saving of file %s due to saves being disabled\n", - realFile.getName().c_str()); + Log::info("Cached saving of file %s due to saves being disabled\n", + realFile.getName().c_str()); } else { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); @@ -436,7 +435,7 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { CompoundTag* tag = NbtIo::readCompressed(&bis); bis.reset(); Log::info("Loaded player data from cached file %s\n", - realFile.getName().c_str()); + realFile.getName().c_str()); return tag; } else if (m_saveFile->doesFileExist(realFile)) { ConsoleSaveFileInputStream fis = @@ -755,8 +754,7 @@ void DirectoryLevelStorage::saveAllCachedData() { ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, realFile); - Log::info("Actually writing cached file %s\n", - it->first.c_str()); + Log::info("Actually writing cached file %s\n", it->first.c_str()); fos.write(bos->buf, 0, bos->size()); delete bos; } diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h index 2c47e9d8a..43372bbfb 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.h @@ -31,12 +31,12 @@ #include #include -#include "platform/PlatformTypes.h" #include "LevelStorage.h" #include "PlayerIO.h" #include "java/File.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class ByteArrayOutputStream; diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp index 3b3a90340..826bd1651 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorageSource.cpp @@ -47,8 +47,8 @@ LevelData* DirectoryLevelStorageSource::getDataTagFor( return nullptr; } -void DirectoryLevelStorageSource::renameLevel( - const std::string& levelId, const std::string& newLevelName) { +void DirectoryLevelStorageSource::renameLevel(const std::string& levelId, + const std::string& newLevelName) { ConsoleSaveFileOriginal tempSave(levelId); // File dataFile = File(dir, "level.dat"); diff --git a/targets/minecraft/world/level/storage/LevelData.cpp b/targets/minecraft/world/level/storage/LevelData.cpp index 6c2070685..f9c2f368a 100644 --- a/targets/minecraft/world/level/storage/LevelData.cpp +++ b/targets/minecraft/world/level/storage/LevelData.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "LevelData.h" #include @@ -6,9 +5,10 @@ #include #include +#include "java/System.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" -#include "java/System.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/LevelType.h" @@ -85,11 +85,11 @@ LevelData::LevelData(CompoundTag* tag) { newSeaLevel = tag->getBoolean( "newSeaLevel"); // 4J added - only use new sea level for newly created - // maps. This read defaults to false. (sea level - // changes in 1.8.2) + // maps. This read defaults to false. (sea level + // changes in 1.8.2) hasBeenInCreative = tag->getBoolean( "hasBeenInCreative"); // 4J added so we can not award achievements to - // levels modified in creative + // levels modified in creative // 4J added - for stronghold position bStronghold = tag->getBoolean("hasStronghold"); @@ -182,7 +182,8 @@ LevelData::LevelData(CompoundTag* tag) { assert(0); break; } - gameServices().setGameHostOption(eGameHostOption_WorldSize, hostOptionworldSize); + gameServices().setGameHostOption(eGameHostOption_WorldSize, + hostOptionworldSize); #endif /* 4J - we don't store this anymore diff --git a/targets/minecraft/world/level/storage/LevelStorage.h b/targets/minecraft/world/level/storage/LevelStorage.h index 84aecf363..ff4e53793 100644 --- a/targets/minecraft/world/level/storage/LevelStorage.h +++ b/targets/minecraft/world/level/storage/LevelStorage.h @@ -4,8 +4,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" +#include "platform/PlatformTypes.h" class PlayerIO; class Dimension; diff --git a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp index 1d23e0831..d7345ba6b 100644 --- a/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/McRegionLevelStorage.cpp @@ -1,5 +1,3 @@ -#include "minecraft/IGameServices.h" -#include "minecraft/util/Log.h" #include "McRegionLevelStorage.h" #include @@ -9,6 +7,8 @@ #include "LevelData.h" #include "java/File.h" +#include "minecraft/IGameServices.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/chunk/storage/McRegionChunkStorage.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp index f233a29b9..1361fa7f3 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.cpp @@ -1,9 +1,5 @@ #include "MemoryLevelStorage.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileIO.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorage.h b/targets/minecraft/world/level/storage/MemoryLevelStorage.h index 5a00c45b6..6bc1d34fb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorage.h +++ b/targets/minecraft/world/level/storage/MemoryLevelStorage.h @@ -2,10 +2,6 @@ #include "LevelStorage.h" #include "PlayerIO.h" - - - - #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "nbt/NbtIo.h" diff --git a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp index 2ff75f643..e2ee62feb 100644 --- a/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp +++ b/targets/minecraft/world/level/storage/MemoryLevelStorageSource.cpp @@ -3,7 +3,6 @@ #include "LevelSummary.h" #include "MemoryLevelStorage.h" - MemoryLevelStorageSource::MemoryLevelStorageSource() {} std::string MemoryLevelStorageSource::getName() { return "Memory Storage"; } @@ -19,8 +18,7 @@ std::vector* MemoryLevelStorageSource::getLevelList() { void MemoryLevelStorageSource::clearAll() {} -LevelData* MemoryLevelStorageSource::getDataTagFor( - const std::string& levelId) { +LevelData* MemoryLevelStorageSource::getDataTagFor(const std::string& levelId) { return nullptr; } diff --git a/targets/minecraft/world/level/storage/SavedDataStorage.h b/targets/minecraft/world/level/storage/SavedDataStorage.h index 707e967c6..eaa1df0e4 100644 --- a/targets/minecraft/world/level/storage/SavedDataStorage.h +++ b/targets/minecraft/world/level/storage/SavedDataStorage.h @@ -6,8 +6,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/world/level/saveddata/SavedData.h" +#include "platform/PlatformTypes.h" class ConsoleSaveFile; class LevelStorage; diff --git a/targets/minecraft/world/level/tile/CarrotTile.cpp b/targets/minecraft/world/level/tile/CarrotTile.cpp index 1ad45648a..7e362b287 100644 --- a/targets/minecraft/world/level/tile/CarrotTile.cpp +++ b/targets/minecraft/world/level/tile/CarrotTile.cpp @@ -2,10 +2,10 @@ #include -#include "util/StringHelpers.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" CarrotTile::CarrotTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/CauldronTile.cpp b/targets/minecraft/world/level/tile/CauldronTile.cpp index 923512936..b0285c05f 100644 --- a/targets/minecraft/world/level/tile/CauldronTile.cpp +++ b/targets/minecraft/world/level/tile/CauldronTile.cpp @@ -122,7 +122,7 @@ bool CauldronTile::use(Level* level, int x, int y, int z, } // 4J Stu - Brought forward change to update inventory when filling // bottles with water - else if (player->instanceof(eTYPE_SERVERPLAYER)) { + else if (player->instanceof (eTYPE_SERVERPLAYER)) { std::dynamic_pointer_cast(player) ->refreshContainer(player->inventoryMenu); } diff --git a/targets/minecraft/world/level/tile/CocoaTile.cpp b/targets/minecraft/world/level/tile/CocoaTile.cpp index a318de664..034da2453 100644 --- a/targets/minecraft/world/level/tile/CocoaTile.cpp +++ b/targets/minecraft/world/level/tile/CocoaTile.cpp @@ -20,8 +20,7 @@ class Icon; -const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", - "cocoa_2"}; +const std::string CocoaTile::TEXTURE_AGES[] = {"cocoa_0", "cocoa_1", "cocoa_2"}; CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, false) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/CropTile.cpp b/targets/minecraft/world/level/tile/CropTile.cpp index 301bdc6d6..39446245f 100644 --- a/targets/minecraft/world/level/tile/CropTile.cpp +++ b/targets/minecraft/world/level/tile/CropTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" class Icon; diff --git a/targets/minecraft/world/level/tile/DispenserTile.h b/targets/minecraft/world/level/tile/DispenserTile.h index 03583f27f..9e1fa4c09 100644 --- a/targets/minecraft/world/level/tile/DispenserTile.h +++ b/targets/minecraft/world/level/tile/DispenserTile.h @@ -3,7 +3,6 @@ #include "BaseEntityTile.h" - class Player; class Mob; class ChunkRebuildData; diff --git a/targets/minecraft/world/level/tile/DoorTile.cpp b/targets/minecraft/world/level/tile/DoorTile.cpp index c1d90edb0..3f46a894e 100644 --- a/targets/minecraft/world/level/tile/DoorTile.cpp +++ b/targets/minecraft/world/level/tile/DoorTile.cpp @@ -15,8 +15,8 @@ #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/AABB.h" -const std::string DoorTile::TEXTURES[] = { - "doorWood_lower", "doorWood_upper", "doorIron_lower", "doorIron_upper"}; +const std::string DoorTile::TEXTURES[] = {"doorWood_lower", "doorWood_upper", + "doorIron_lower", "doorIron_upper"}; DoorTile::DoorTile(int id, Material* material) : Tile(id, material, false) { if (material == Material::metal) { diff --git a/targets/minecraft/world/level/tile/DropperTile.cpp b/targets/minecraft/world/level/tile/DropperTile.cpp index 2fba41574..d6d562edd 100644 --- a/targets/minecraft/world/level/tile/DropperTile.cpp +++ b/targets/minecraft/world/level/tile/DropperTile.cpp @@ -25,8 +25,7 @@ DropperTile::DropperTile(int id) : DispenserTile(id) { void DropperTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); iconTop = iconRegister->registerIcon("furnace_top"); - iconFront = - iconRegister->registerIcon(getIconName() + "_front_horizontal"); + iconFront = iconRegister->registerIcon(getIconName() + "_front_horizontal"); iconFrontVertical = iconRegister->registerIcon(getIconName() + "_front_vertical"); } diff --git a/targets/minecraft/world/level/tile/FarmTile.cpp b/targets/minecraft/world/level/tile/FarmTile.cpp index 5aefb4056..1e8801522 100644 --- a/targets/minecraft/world/level/tile/FarmTile.cpp +++ b/targets/minecraft/world/level/tile/FarmTile.cpp @@ -69,7 +69,7 @@ void FarmTile::fallOn(Level* level, int x, int y, int z, // the client based on random values! if (!level->isClientSide && level->random->nextFloat() < (fallDistance - .5f)) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToMine()) { diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index 75552e023..c12bf63b0 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "FireTile.h" #include #include -#include "minecraft/GameEnums.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" diff --git a/targets/minecraft/world/level/tile/FurnaceTile.cpp b/targets/minecraft/world/level/tile/FurnaceTile.cpp index 07c8535cc..c5cde70b1 100644 --- a/targets/minecraft/world/level/tile/FurnaceTile.cpp +++ b/targets/minecraft/world/level/tile/FurnaceTile.cpp @@ -72,8 +72,8 @@ Icon* FurnaceTile::getTexture(int face, int data) { void FurnaceTile::registerIcons(IconRegister* iconRegister) { icon = iconRegister->registerIcon("furnace_side"); - iconFront = iconRegister->registerIcon(lit ? "furnace_front_lit" - : "furnace_front"); + iconFront = + iconRegister->registerIcon(lit ? "furnace_front_lit" : "furnace_front"); iconTop = iconRegister->registerIcon("furnace_top"); } diff --git a/targets/minecraft/world/level/tile/GrassTile.cpp b/targets/minecraft/world/level/tile/GrassTile.cpp index ffba0293c..f59aa04e4 100644 --- a/targets/minecraft/world/level/tile/GrassTile.cpp +++ b/targets/minecraft/world/level/tile/GrassTile.cpp @@ -2,11 +2,11 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp index cf9f036ef..b07cc2197 100644 --- a/targets/minecraft/world/level/tile/HugeMushroomTile.cpp +++ b/targets/minecraft/world/level/tile/HugeMushroomTile.cpp @@ -9,8 +9,7 @@ class Material; const std::string HugeMushroomTile::TEXTURE_STEM = "skin_stem"; const std::string HugeMushroomTile::TEXTURE_INSIDE = "inside"; -const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", - "skin_red"}; +const std::string HugeMushroomTile::TEXTURE_TYPE[] = {"skin_brown", "skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material* material, int type) : Tile(id, material) { diff --git a/targets/minecraft/world/level/tile/LeafTile.cpp b/targets/minecraft/world/level/tile/LeafTile.cpp index e37d26e44..008b68c5b 100644 --- a/targets/minecraft/world/level/tile/LeafTile.cpp +++ b/targets/minecraft/world/level/tile/LeafTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/world/level/tile/NetherWartTile.cpp b/targets/minecraft/world/level/tile/NetherWartTile.cpp index 976f203ef..8459091c7 100644 --- a/targets/minecraft/world/level/tile/NetherWartTile.cpp +++ b/targets/minecraft/world/level/tile/NetherWartTile.cpp @@ -3,7 +3,6 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" @@ -11,6 +10,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/PlantTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "util/StringHelpers.h" NetherWartTile::NetherWartTile(int id) : Bush(id) { setTicking(true); diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index 8185e35a1..45481e685 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "NotGateTile.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/redstone/Redstone.h" @@ -122,9 +122,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); if (isToggledTooFrequently(level, x, y, z, true)) { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, @@ -148,9 +147,8 @@ void NotGateTile::tick(Level* level, int x, int y, int z, Random* random) { level->getData(x, y, z), Tile::UPDATE_ALL); } else { - Log::info( - "Torch at (%d,%d,%d) has toggled too many times\n", x, y, - z); + Log::info("Torch at (%d,%d,%d) has toggled too many times\n", x, + y, z); } } } diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index 81fa73386..a77f8fd60 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "NoteBlockTile.h" #include @@ -6,6 +5,7 @@ #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/sounds/SoundTypes.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/level/tile/BaseEntityTile.h" @@ -21,7 +21,7 @@ void NoteBlockTile::neighborChanged(Level* level, int x, int y, int z, std::dynamic_pointer_cast( level->getTileEntity(x, y, z)); Log::info("-------- Signal is %s, tile is currently %s\n", - signal ? "true" : "false", mte->on ? "ON" : "OFF"); + signal ? "true" : "false", mte->on ? "ON" : "OFF"); if (mte != nullptr && mte->on != signal) { if (signal) { mte->playNote(level, x, y, z); @@ -85,8 +85,7 @@ bool NoteBlockTile::triggerEvent(Level* level, int x, int y, int z, int i, iSound = eSoundType_NOTE_HARP; break; } - Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", - pitch); + Log::info("NoteBlockTile::triggerEvent - playSound - pitch = %f\n", pitch); level->playSound(x + 0.5, y + 0.5, z + 0.5, iSound, 3, pitch); level->addParticle(eParticleType_note, x + 0.5, y + 1.2, z + 0.5, note / 24.0, 0, 0); diff --git a/targets/minecraft/world/level/tile/PotatoTile.cpp b/targets/minecraft/world/level/tile/PotatoTile.cpp index 79519081f..f4f39dd2b 100644 --- a/targets/minecraft/world/level/tile/PotatoTile.cpp +++ b/targets/minecraft/world/level/tile/PotatoTile.cpp @@ -3,13 +3,13 @@ #include #include -#include "util/StringHelpers.h" #include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/CropTile.h" +#include "util/StringHelpers.h" PotatoTile::PotatoTile(int id) : CropTile(id) {} diff --git a/targets/minecraft/world/level/tile/PressurePlateTile.cpp b/targets/minecraft/world/level/tile/PressurePlateTile.cpp index f231bd67d..7ce79210c 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) { entities = level->getEntitiesOfClass(typeid(Player), &at_bb); else assert(0); // 4J-JEV: We're going to delete something at a random - // location. + // location. if (entities != nullptr && !entities->empty()) { for (auto it = entities->begin(); it != entities->end(); ++it) { diff --git a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp index 49a593141..3496834f7 100644 --- a/targets/minecraft/world/level/tile/RedStoneDustTile.cpp +++ b/targets/minecraft/world/level/tile/RedStoneDustTile.cpp @@ -6,12 +6,12 @@ #include #include "DiodeTile.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp index 6339f1add..bbb966ce7 100644 --- a/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp +++ b/targets/minecraft/world/level/tile/SmoothStoneBrickTile.cpp @@ -7,8 +7,8 @@ class Icon; -const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = { - "", "mossy", "cracked", "carved"}; +const std::string SmoothStoneBrickTile::TEXTURE_NAMES[] = {"", "mossy", + "cracked", "carved"}; const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES [SMOOTH_STONE_BRICK_NAMES_LENGTH] = {IDS_TILE_STONE_BRICK_SMOOTH, diff --git a/targets/minecraft/world/level/tile/StemTile.cpp b/targets/minecraft/world/level/tile/StemTile.cpp index e46db21c9..e1c08b849 100644 --- a/targets/minecraft/world/level/tile/StemTile.cpp +++ b/targets/minecraft/world/level/tile/StemTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp index 8f5f79554..b3d5cb22f 100644 --- a/targets/minecraft/world/level/tile/StoneMonsterTile.cpp +++ b/targets/minecraft/world/level/tile/StoneMonsterTile.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "StoneMonsterTile.h" #include #include "java/Class.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/monster/Silverfish.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp index 5925a7066..adae70e40 100644 --- a/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Random.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" @@ -31,7 +31,7 @@ const unsigned int }; const std::string TallGrass::TEXTURE_NAMES[] = {"deadbush", "tallgrass", - "fern"}; + "fern"}; TallGrass::TallGrass(int id) : Bush(id, Material::replaceable_plant) { this->updateDefaultShape(); diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index cc772c83a..6e80029c5 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -1,4 +1,3 @@ -#include "minecraft/util/Log.h" #include "Tile.h" #include @@ -6,12 +5,12 @@ #include #include "Facing.h" -#include "util/StringHelpers.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stats.h" +#include "minecraft/util/Log.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/ExperienceOrb.h" #include "minecraft/world/entity/item/ItemEntity.h" @@ -152,6 +151,7 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "strings.h" +#include "util/StringHelpers.h" std::string Tile::TILE_DESCRIPTION_PREFIX = "Tile."; @@ -2623,8 +2623,8 @@ Tile* Tile::setIconName(const std::string& iconName) { } std::string Tile::getIconName() { - return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + - "_" + toWString(descriptionId) + return iconName.empty() ? "MISSING_ICON_TILE_" + toWString(id) + "_" + + toWString(descriptionId) : iconName; } diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 164b88a44..5e0992e57 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -1,12 +1,12 @@ -#include "minecraft/IGameServices.h" #include "TntTile.h" #include -#include "minecraft/GameEnums.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Facing.h" +#include "minecraft/GameEnums.h" +#include "minecraft/IGameServices.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -116,8 +116,8 @@ void TntTile::entityInside(Level* level, int x, int y, int z, if (entity->isOnFire()) { std::shared_ptr arrow = std::dynamic_pointer_cast(entity); - destroy(level, x, y, z, EXPLODE_BIT, - arrow->owner->instanceof(eTYPE_LIVINGENTITY) + destroy(level, x, y, z, EXPLODE_BIT, arrow->owner->instanceof + (eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(arrow->owner) : nullptr); level->removeTile(x, y, z); diff --git a/targets/minecraft/world/level/tile/TreeTile.cpp b/targets/minecraft/world/level/tile/TreeTile.cpp index 97c6acd97..7eeed779f 100644 --- a/targets/minecraft/world/level/tile/TreeTile.cpp +++ b/targets/minecraft/world/level/tile/TreeTile.cpp @@ -19,7 +19,7 @@ const std::string TreeTile::TREE_STRING_NAMES[TreeTile::TREE_NAMES_LENGTH] = { "oak", "spruce", "birch", "jungle"}; const std::string TreeTile::TREE_TEXTURES[] = {"tree_side", "tree_spruce", - "tree_birch", "tree_jungle"}; + "tree_birch", "tree_jungle"}; TreeTile::TreeTile(int id) : RotatedPillarTile(id, Material::wood) {} diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index 0b5093458..e096ba19f 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -3,10 +3,10 @@ #include #include -#include "minecraft/GameEnums.h" -#include "minecraft/client/resources/Colours/ColourTable.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" +#include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" @@ -30,7 +30,7 @@ int WaterlilyTile::getRenderShape() { return Tile::SHAPE_LILYPAD; } void WaterlilyTile::addAABBs(Level* level, int x, int y, int z, AABB* box, std::vector* boxes, std::shared_ptr source) { - if (source == nullptr || !source->instanceof(eTYPE_BOAT)) { + if (source == nullptr || !source->instanceof (eTYPE_BOAT)) { Bush::addAABBs(level, x, y, z, box, boxes, source); } } diff --git a/targets/minecraft/world/level/tile/WoodTile.cpp b/targets/minecraft/world/level/tile/WoodTile.cpp index 68743203a..0a71cf229 100644 --- a/targets/minecraft/world/level/tile/WoodTile.cpp +++ b/targets/minecraft/world/level/tile/WoodTile.cpp @@ -15,7 +15,7 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { }; const std::string WoodTile::TEXTURE_NAMES[] = {"oak", "spruce", "birch", - "jungle"}; + "jungle"}; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp index b48dc9fe2..7c1726a50 100644 --- a/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BeaconTileEntity.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "BeaconTileEntity.h" #include #include #include "SharedConstants.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/TileEntityDataPacket.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" @@ -281,7 +281,8 @@ void BeaconTileEntity::setItem(unsigned int slot, } std::string BeaconTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_BEACON); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_BEACON); } std::string BeaconTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 37e4b5077..bed079723 100644 --- a/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "BrewingStandTileEntity.h" #include @@ -7,6 +6,7 @@ #include #include "Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" @@ -40,7 +40,8 @@ BrewingStandTileEntity::BrewingStandTileEntity() { BrewingStandTileEntity::~BrewingStandTileEntity() {} std::string BrewingStandTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_BREWINGSTAND); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_BREWINGSTAND); } std::string BrewingStandTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index 0c25656e0..a54db394b 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "ChestTileEntity.h" #include @@ -9,6 +8,7 @@ #include "SharedConstants.h" #include "TileEntity.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" #include "minecraft/sounds/SoundTypes.h" #include "minecraft/world/CompoundContainer.h" diff --git a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp index 654309fa7..6ce14da25 100644 --- a/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/CommandBlockEntity.cpp @@ -34,9 +34,7 @@ int CommandBlockEntity::performCommand(Level* level) { std::string CommandBlockEntity::getName() { return name; } -void CommandBlockEntity::setName(const std::string& name) { - this->name = name; -} +void CommandBlockEntity::setName(const std::string& name) { this->name = name; } void CommandBlockEntity::sendMessage(const std::string& message, ChatPacket::EChatPacketMessage type, diff --git a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp index b8a62f988..e62efb43a 100644 --- a/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DispenserTileEntity.cpp @@ -1,10 +1,10 @@ -#include "minecraft/IGameServices.h" #include "DispenserTileEntity.h" #include #include "TileEntity.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" @@ -124,7 +124,8 @@ int DispenserTileEntity::addItem(std::shared_ptr item) { } std::string DispenserTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_TILE_DISPENSER); + return hasCustomName() ? name + : gameServices().getString(IDS_TILE_DISPENSER); } std::string DispenserTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp index 5fce7b32d..9c9df6cf5 100644 --- a/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/DropperTileEntity.cpp @@ -1,14 +1,15 @@ -#include "minecraft/IGameServices.h" #include "DropperTileEntity.h" #include #include +#include "minecraft/IGameServices.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "strings.h" std::string DropperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_DROPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_DROPPER); } // 4J Added diff --git a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 61ad6a322..b59b521b0 100644 --- a/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "EnchantmentTableTileEntity.h" #include @@ -6,6 +5,7 @@ #include #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" diff --git a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp index 0e4afcf8e..6fa2f5c61 100644 --- a/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/FurnaceTileEntity.cpp @@ -1,9 +1,9 @@ -#include "minecraft/IGameServices.h" #include "FurnaceTileEntity.h" #include #include "Facing.h" +#include "minecraft/IGameServices.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/CoalItem.h" diff --git a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp index a2aaeb1c2..3f28f6666 100644 --- a/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -1,4 +1,3 @@ -#include "minecraft/IGameServices.h" #include "HopperTileEntity.h" #include @@ -8,6 +7,7 @@ #include "Facing.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/util/Mth.h" #include "minecraft/world/WorldlyContainer.h" #include "minecraft/world/entity/EntitySelector.h" @@ -109,7 +109,8 @@ void HopperTileEntity::setItem(unsigned int slot, } std::string HopperTileEntity::getName() { - return hasCustomName() ? name : gameServices().getString(IDS_CONTAINER_HOPPER); + return hasCustomName() ? name + : gameServices().getString(IDS_CONTAINER_HOPPER); } std::string HopperTileEntity::getCustomName() { diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index e117afd61..3ed30663b 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -32,7 +32,8 @@ SignTileEntity::SignTileEntity() : TileEntity() { SignTileEntity::~SignTileEntity() { // TODO ORBIS_STUBBED; // 4J-PB - we don't need to verify strings anymore - - // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); }); + // PlatformInput.CancelQueuedVerifyStrings([this](STRING_VERIFY_RESPONSE* r) + // { return handleStringVerify(r); }); } void SignTileEntity::save(CompoundTag* tag) { @@ -121,7 +122,8 @@ sizeof(char)*(MAX_LINE_LENGTH+1)); if(m_wsmessages[i].length()>0) // at this point, we can ask the online string verifier if our sign text is ok #if 0 m_bVerified=true; #else - if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* r) { return handleStringVerify(r); })) + if(!PlatformInput.VerifyStrings((char**)&wcMessages,MAX_SIGN_LINES,[this](STRING_VERIFY_RESPONSE* +r) { return handleStringVerify(r); })) { // Nothing to verify m_bVerified=true; diff --git a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp index 183cd131d..5b34815b5 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -2,10 +2,10 @@ #include -#include "minecraft/IGameServices.h" #include "TheEndPortalTileEntity.h" #include "java/Class.h" #include "java/Random.h" +#include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" @@ -64,7 +64,7 @@ void TheEndPortal::entityInside(Level* level, int x, int y, int z, if (entity->riding == nullptr && entity->rider.lock() == nullptr) { if (!level->isClientSide) { - if (entity->instanceof(eTYPE_PLAYER)) { + if (entity->instanceof (eTYPE_PLAYER)) { // 4J Stu - Update the level data position so that the // stronghold portal can be shown on the maps int x, z; diff --git a/targets/minecraft/world/level/tile/entity/TileEntity.cpp b/targets/minecraft/world/level/tile/entity/TileEntity.cpp index 1f13b4f89..47dcaa866 100644 --- a/targets/minecraft/world/level/tile/entity/TileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/TileEntity.cpp @@ -1,9 +1,9 @@ -#include "minecraft/util/Log.h" #include "TileEntity.h" #include #include "PistonPieceTileEntity.h" +#include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/JukeboxTile.h" #include "minecraft/world/level/tile/Tile.h" @@ -137,7 +137,7 @@ std::shared_ptr TileEntity::loadStatic(CompoundTag* tag) { } else { #ifdef _DEBUG Log::info("Skipping TileEntity with id %s.\n", - tag->getString("id").c_str()); + tag->getString("id").c_str()); #endif } diff --git a/targets/minecraft/world/scores/PlayerTeam.cpp b/targets/minecraft/world/scores/PlayerTeam.cpp index c23229712..4270cb479 100644 --- a/targets/minecraft/world/scores/PlayerTeam.cpp +++ b/targets/minecraft/world/scores/PlayerTeam.cpp @@ -55,8 +55,7 @@ std::string PlayerTeam::formatNameForTeam(PlayerTeam* team) { return formatNameForTeam(team, team->getDisplayName()); } -std::string PlayerTeam::formatNameForTeam(Team* team, - const std::string& name) { +std::string PlayerTeam::formatNameForTeam(Team* team, const std::string& name) { if (team == nullptr) return name; return team->getFormattedName(name); } diff --git a/targets/minecraft/world/scores/Team.h b/targets/minecraft/world/scores/Team.h index e29ac65c4..7d92bf2bf 100644 --- a/targets/minecraft/world/scores/Team.h +++ b/targets/minecraft/world/scores/Team.h @@ -7,8 +7,7 @@ public: virtual bool isAlliedTo(Team* other); virtual std::string getName() = 0; - virtual std::string getFormattedName( - const std::string& teamMemberName) = 0; + virtual std::string getFormattedName(const std::string& teamMemberName) = 0; virtual bool canSeeFriendlyInvisibles() = 0; virtual bool isAllowFriendlyFire() = 0; }; \ No newline at end of file diff --git a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h index 828fbc243..651524d63 100644 --- a/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h +++ b/targets/minecraft/world/scores/criteria/ObjectiveCriteria.h @@ -9,8 +9,7 @@ class Player; class ObjectiveCriteria { public: - static std::unordered_map - CRITERIA_BY_NAME; + static std::unordered_map CRITERIA_BY_NAME; static ObjectiveCriteria* DUMMY; static ObjectiveCriteria* DEATH_COUNT; diff --git a/targets/nbt/include/nbt/IntTag.h b/targets/nbt/include/nbt/IntTag.h index e7aaa2610..5e48fb44e 100644 --- a/targets/nbt/include/nbt/IntTag.h +++ b/targets/nbt/include/nbt/IntTag.h @@ -5,9 +5,7 @@ class IntTag : public Tag { public: int data; IntTag(const std::string& name) : Tag(name) {} - IntTag(const std::string& name, int data) : Tag(name) { - this->data = data; - } + IntTag(const std::string& name, int data) : Tag(name) { this->data = data; } void write(DataOutput* dos) { dos->writeInt(data); } void load(DataInput* dis, int tagDepth) { data = dis->readInt(); } diff --git a/targets/platform/C4JThread.cpp b/targets/platform/C4JThread.cpp index fc793bc93..a0838a2fe 100644 --- a/targets/platform/C4JThread.cpp +++ b/targets/platform/C4JThread.cpp @@ -26,8 +26,8 @@ #include #endif -#include "platform/ShutdownManager.h" #include "platform/C4JThread.h" +#include "platform/ShutdownManager.h" class Level; @@ -563,4 +563,3 @@ void C4JThread::EventQueue::threadPoll() { ShutdownManager::HasFinished(ShutdownManager::eEventQueueThreads); } - diff --git a/targets/platform/PlatformTypes.h b/targets/platform/PlatformTypes.h index 4e78dfc2a..9eda7366a 100644 --- a/targets/platform/PlatformTypes.h +++ b/targets/platform/PlatformTypes.h @@ -23,7 +23,9 @@ struct ImageFileBuffer { ImageFileBuffer& operator=(const ImageFileBuffer&) = delete; [[nodiscard]] EImageType GetType() const { return m_type; } - [[nodiscard]] std::byte* GetBufferPointer() const { return m_pBuffer.get(); } + [[nodiscard]] std::byte* GetBufferPointer() const { + return m_pBuffer.get(); + } [[nodiscard]] std::size_t GetBufferSize() const { return m_bufferSize; } [[nodiscard]] bool Allocated() const { return m_pBuffer != nullptr; } void Release() { @@ -125,11 +127,15 @@ struct XMARKETPLACE_CONTENTOFFER_INFO { using PXMARKETPLACE_CONTENTOFFER_INFO = XMARKETPLACE_CONTENTOFFER_INFO*; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = 0x00000040; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = + 0x00000020; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_GAME_TRAILER = + 0x00000040; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_THEME = 0x00000080; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_TILE = 0x00000800; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_ARCADE = 0x00002000; inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_VIDEO = 0x00004000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = 0x00010000; -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = 0x00100000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONSUMABLE = + 0x00010000; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_AVATARITEM = + 0x00100000; diff --git a/targets/platform/ShutdownManager.cpp b/targets/platform/ShutdownManager.cpp index cd3b82678..ae78d1847 100644 --- a/targets/platform/ShutdownManager.cpp +++ b/targets/platform/ShutdownManager.cpp @@ -1,6 +1,7 @@ // Linux stub implementations for ShutdownManager // The PS3/PSVita versions have full implementations; on Linux these are no-ops. #include "platform/ShutdownManager.h" + #include "platform/C4JThread.h" void ShutdownManager::Initialise() {} diff --git a/targets/platform/fs/IPlatformFilesystem.h b/targets/platform/fs/IPlatformFilesystem.h index 0e0ca3b7d..493af1bc0 100644 --- a/targets/platform/fs/IPlatformFilesystem.h +++ b/targets/platform/fs/IPlatformFilesystem.h @@ -24,9 +24,9 @@ public: virtual ~IPlatformFilesystem() = default; // Read an entire file into a caller-provided buffer. - [[nodiscard]] virtual ReadResult readFile( - const std::filesystem::path& path, void* buffer, - std::size_t capacity) = 0; + [[nodiscard]] virtual ReadResult readFile(const std::filesystem::path& path, + void* buffer, + std::size_t capacity) = 0; // Read a segment of a file. [[nodiscard]] virtual ReadResult readFileSegment( diff --git a/targets/platform/fs/fs.h b/targets/platform/fs/fs.h index cd2640925..65de540ee 100644 --- a/targets/platform/fs/fs.h +++ b/targets/platform/fs/fs.h @@ -4,13 +4,13 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading PlatformFilesystem -// during another translation unit's static init was UB. +// `extern IPlatformFilesystem& PlatformFilesystem;` form had: anything reading +// PlatformFilesystem during another translation unit's static init was UB. // -// The macro lets the existing call sites keep writing `PlatformFilesystem.foo()` -// without each call site having to add the `()`. The expansion is just -// a call to a function returning a reference, so codegen is unchanged -// once inlined. +// The macro lets the existing call sites keep writing +// `PlatformFilesystem.foo()` without each call site having to add the `()`. The +// expansion is just a call to a function returning a reference, so codegen is +// unchanged once inlined. namespace platform_internal { IPlatformFilesystem& PlatformFilesystem_get(); } diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp index e813b28d3..84421efde 100644 --- a/targets/platform/fs/std/StdFilesystem.cpp +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -11,10 +11,10 @@ IPlatformFilesystem& PlatformFilesystem_get() { static StdFilesystem instance; return instance; } -} +} // namespace platform_internal -IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::path& path, - void* buffer, std::size_t capacity) { +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}; @@ -29,9 +29,9 @@ IPlatformFilesystem::ReadResult StdFilesystem::readFile(const std::filesystem::p static_cast(size)}; } -IPlatformFilesystem::ReadResult StdFilesystem::readFileSegment(const std::filesystem::path& path, - std::size_t offset, void* buffer, - std::size_t bytesToRead) { +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}; diff --git a/targets/platform/fs/std/StdFilesystem.h b/targets/platform/fs/std/StdFilesystem.h index 6e494e5e1..bb56ecb20 100644 --- a/targets/platform/fs/std/StdFilesystem.h +++ b/targets/platform/fs/std/StdFilesystem.h @@ -1,10 +1,10 @@ #pragma once -#include "../IPlatformFilesystem.h" - +#include #include #include -#include + +#include "../IPlatformFilesystem.h" // Standard filesystem implementation for desktop platforms. class StdFilesystem : public IPlatformFilesystem { diff --git a/targets/platform/input/IPlatformInput.h b/targets/platform/input/IPlatformInput.h index 506839170..f988975c5 100644 --- a/targets/platform/input/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -2,8 +2,8 @@ #include -#include "PlatformTypes.h" #include "InputConstants.h" +#include "PlatformTypes.h" class IPlatformInput { public: @@ -80,9 +80,8 @@ public: [[nodiscard]] virtual int GetScrollDelta() = 0; // Keyboard - virtual EKeyboardResult RequestKeyboard(const char* Title, - const char* Text, int iPad, - unsigned int uiMaxChars, + virtual EKeyboardResult RequestKeyboard(const char* Title, const char* Text, + int iPad, unsigned int uiMaxChars, std::function callback, EKeyboardMode eMode) = 0; [[nodiscard]] virtual const char* GetText() = 0; diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h index d3f5ec9c8..fbc78a5c8 100644 --- a/targets/platform/input/input.h +++ b/targets/platform/input/input.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformInput& PlatformInput;` form had: anything reading PlatformInput -// during another translation unit's static init was UB. +// `extern IPlatformInput& PlatformInput;` form had: anything reading +// PlatformInput during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformInput.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 1f56f76bf..ba377ec00 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -17,15 +17,15 @@ #include #include -#include "../InputConstants.h" #include "../../PlatformTypes.h" +#include "../InputConstants.h" namespace platform_internal { IPlatformInput& PlatformInput_get() { static SDL2Input instance; return instance; } -} +} // namespace platform_internal static const int KEY_COUNT = SDL_NUM_SCANCODES; static const int BTN_COUNT = SDL_CONTROLLER_BUTTON_MAX; diff --git a/targets/platform/profile/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h index 64ab8591c..fbde8d1fa 100644 --- a/targets/platform/profile/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -35,11 +35,11 @@ public: [[nodiscard]] virtual bool IsSignedIn(int iQuadrant) = 0; [[nodiscard]] virtual bool IsSignedInLive(int iProf) = 0; [[nodiscard]] virtual bool IsGuest(int iQuadrant) = 0; - virtual unsigned int RequestSignInUI( - bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, - bool bMultiplayerSignIn, bool bAddUser, - std::function callback, - int iQuadrant = XUSER_INDEX_ANY) = 0; + virtual unsigned int RequestSignInUI(bool bFromInvite, bool bLocalGame, + bool bNoGuestsAllowed, + bool bMultiplayerSignIn, bool bAddUser, + std::function callback, + int iQuadrant = XUSER_INDEX_ANY) = 0; virtual unsigned int DisplayOfflineProfile( std::function callback, int iQuadrant = XUSER_INDEX_ANY) = 0; @@ -96,8 +96,7 @@ public: unsigned int xuidCount) = 0; virtual void ShowProfileCard(int iPad, PlayerUID targetUid) = 0; [[nodiscard]] virtual bool GetProfileAvatar( - int iPad, - std::function callback) = 0; + int iPad, std::function callback) = 0; virtual void CancelProfileAvatarRequest() = 0; // Achievements diff --git a/targets/platform/profile/ProfileConstants.h b/targets/platform/profile/ProfileConstants.h index 4c90ceab1..db1ab2dbf 100644 --- a/targets/platform/profile/ProfileConstants.h +++ b/targets/platform/profile/ProfileConstants.h @@ -65,7 +65,6 @@ #define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13 #define MINECRAFT_LANGUAGE_GREEK 0x14 - #define CONTEXT_GAME_STATE 0 #define CONTEXT_GAME_STATE_BLANK 0 #define CONTEXT_GAME_STATE_RIDING_PIG 1 diff --git a/targets/platform/profile/profile.h b/targets/platform/profile/profile.h index d98421bfc..4097e056b 100644 --- a/targets/platform/profile/profile.h +++ b/targets/platform/profile/profile.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformProfile& PlatformProfile;` form had: anything reading PlatformProfile -// during another translation unit's static init was UB. +// `extern IPlatformProfile& PlatformProfile;` form had: anything reading +// PlatformProfile during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformProfile.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index c30617f3b..24b660aa2 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -12,7 +12,7 @@ IPlatformProfile& PlatformProfile_get() { static StubProfile instance; return instance; } -} +} // namespace platform_internal namespace { constexpr PlayerUID kFakeXuidBase = 0xe000d45248242f2eULL; @@ -194,9 +194,5 @@ bool StubProfile::CanViewPlayerCreatedContent(int, bool, PlayerUID*, // GetPrimaryPad/SetPrimaryPad — delegates to PlatformPlatft. // Kept here temporarily for call sites that still use PlatformPlatfore. // These forward to the canonical copies in SDL2Input. -int StubProfile::GetPrimaryPad() { - return PlatformInput.GetPrimaryPad(); -} -void StubProfile::SetPrimaryPad(int iPad) { - PlatformInput.SetPrimaryPad(iPad); -} +int StubProfile::GetPrimaryPad() { return PlatformInput.GetPrimaryPad(); } +void StubProfile::SetPrimaryPad(int iPad) { PlatformInput.SetPrimaryPad(iPad); } diff --git a/targets/platform/profile/stub/StubProfile.h b/targets/platform/profile/stub/StubProfile.h index ba04e8a5f..72d5a865f 100644 --- a/targets/platform/profile/stub/StubProfile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -4,9 +4,8 @@ #include #include -#include "PlatformTypes.h" - #include "../IPlatformProfile.h" +#include "PlatformTypes.h" class StubProfile : public IPlatformProfile { public: @@ -61,7 +60,8 @@ public: } void SetPrimaryPlayerChanged(bool) {} void ShowProfileCard(int, PlayerUID) {} - bool GetProfileAvatar(int, std::function) { + bool GetProfileAvatar(int, + std::function) { return false; } void CancelProfileAvatarRequest() {} diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 96b5474da..13e97877a 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,16 +1,15 @@ #include "GLRenderer.h" -#include "renderer/renderer.h" #include "PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" #include "SDL_stdinc.h" #include "SDL_video.h" - #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" #include "java/IntBuffer.h" +#include "renderer/renderer.h" // undefine macros from header to avoid argument mismatch #undef glGenTextures @@ -60,7 +59,7 @@ IPlatformRenderer& PlatformRenderer_get() { static GLRenderer instance; return instance; } -} +} // namespace platform_internal // MARK: Shaders @@ -389,8 +388,8 @@ static void glShadowSetDepthTest(bool e) { } static void glShadowSetBlendFunc(GLint s, GLint d) { - if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || - s_gl_state.blendSrc != s || s_gl_state.blendDst != d) { + if (!(s_gl_shadow_mask & SHADOW_BLEND_FUNC) || s_gl_state.blendSrc != s || + s_gl_state.blendDst != d) { ::glBlendFunc(s, d); s_gl_state.blendSrc = s; s_gl_state.blendDst = d; @@ -399,8 +398,7 @@ static void glShadowSetBlendFunc(GLint s, GLint d) { } static void glShadowSetDepthMask(GLboolean e) { - if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || - s_gl_state.depthMask != e) { + if (!(s_gl_shadow_mask & SHADOW_DEPTH_MASK) || s_gl_state.depthMask != e) { ::glDepthMask(e); s_gl_state.depthMask = e; s_gl_shadow_mask |= SHADOW_DEPTH_MASK; @@ -511,8 +509,7 @@ static void pushRenderState() { glUniform1f(s_shader.uFogStart, s_rs.fogStart); glUniform1f(s_shader.uFogEnd, s_rs.fogEnd); glUniform1f(s_shader.uFogDensity, s_rs.fogDensity); - glUniform4fv(s_shader.uFogColor, 1, - glm::value_ptr(s_rs.fogColor)); + glUniform4fv(s_shader.uFogColor, 1, glm::value_ptr(s_rs.fogColor)); glUniform1i(s_shader.uFogEnable, s_rs.fogEnable ? 1 : 0); } if (s_rs_dirty_mask & DIRTY_TEXTURE) { @@ -524,11 +521,9 @@ static void pushRenderState() { if (s_rs_dirty_mask & DIRTY_GAMMA) glUniform1f(s_shader.uInvGamma, 1.0f / s_rs.gamma); if (s_rs_dirty_mask & DIRTY_LMT) - glUniform4fv(s_shader.uLMTransform, 1, - glm::value_ptr(s_rs.lmt)); + glUniform4fv(s_shader.uLMTransform, 1, glm::value_ptr(s_rs.lmt)); if (s_rs_dirty_mask & DIRTY_GLOBAL_LM) - glUniform2fv(s_shader.uGlobalLM, 1, - glm::value_ptr(s_rs.globalLM)); + glUniform2fv(s_shader.uGlobalLM, 1, glm::value_ptr(s_rs.globalLM)); s_rs_dirty_mask = 0; } flushMatrices(); @@ -817,7 +812,7 @@ void GLRenderer::Shutdown() { } void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, - eVertexType vType, ePixelShaderType) { + eVertexType vType, ePixelShaderType) { if (count <= 0 || !dataIn) return; bool wasQuad = isQuadPrim((int)ptype); @@ -1081,7 +1076,7 @@ void GLRenderer::MatrixPerspective(float fovy, float asp, float zn, float zf) { markMatrixDirty(); } void GLRenderer::MatrixOrthogonal(float l, float r, float b, float t, float zn, - float zf) { + float zf) { s_proj.cur() = glm::ortho(l, r, b, t, zn, zf); markMatrixDirty(); } @@ -1104,7 +1099,7 @@ void GLRenderer::Set_matrixDirty() { s_boundProgram = 0; s_rs_dirty_mask = 0xFFFFFFFF; s_gl_shadow_mask = 0; - s_normalMatDirty = true; // normal matrix dirt after iggy reset + s_normalMatDirty = true; // normal matrix dirt after iggy reset s_matDirty = true; s_chunkOffsetValid = false; if (s_shader.prog) { @@ -1141,9 +1136,7 @@ void GLRenderer::StateSetDepthMask(bool e) { glShadowSetDepthMask(e ? GL_TRUE : GL_FALSE); } void GLRenderer::StateSetBlendEnable(bool e) { glShadowSetBlend(e); } -void GLRenderer::StateSetBlendFunc(int s, int d) { - glShadowSetBlendFunc(s, d); -} +void GLRenderer::StateSetBlendFunc(int s, int d) { glShadowSetBlendFunc(s, d); } void GLRenderer::StateSetDepthFunc(int f) { ::glDepthFunc(f); } void GLRenderer::StateSetFaceCull(bool e) { glShadowSetCull(e); } void GLRenderer::StateSetFaceCullCW(bool e) { @@ -1190,7 +1183,10 @@ void GLRenderer::StateSetFogEnable(bool e) { } } void GLRenderer::StateSetFogMode(int mode) { - int v = (mode == GL_LINEAR) ? 1 : (mode == GL_EXP) ? 2 : (mode == 0x0801) ? 3 : 0; + 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); @@ -1266,7 +1262,7 @@ void GLRenderer::StateSetVertexTextureUV(float u, float v) { } } void GLRenderer::StateSetStencil(int fn, uint8_t ref, uint8_t fmask, - uint8_t wmask) { + uint8_t wmask) { glShadowSetStencil(fn, ref, fmask, wmask); } void GLRenderer::StateSetTextureEnable(bool e) { @@ -1312,9 +1308,9 @@ void GLRenderer::TextureBindVertex(int idx, bool scaleLight) { s_rs.useLightmap = true; markDirty(DIRTY_TEXTURE); } - glm::vec4 newLmt = - scaleLight ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} - : glm::vec4{1.f, 1.f, 0.f, 0.f}; + glm::vec4 newLmt = scaleLight + ? glm::vec4{1.f, 1.f, 8.f / 256.f, 8.f / 256.f} + : glm::vec4{1.f, 1.f, 0.f, 0.f}; if (s_rs.lmt != newLmt) { s_rs.lmt = newLmt; markDirty(DIRTY_LMT); @@ -1341,7 +1337,7 @@ void GLRenderer::TextureData(int w, int h, void* d, int lvl, eTextureFormat) { } } void GLRenderer::TextureDataUpdate(int xo, int yo, int w, int h, void* d, - int lvl) { + int lvl) { glTexSubImage2D(GL_TEXTURE_2D, lvl, xo, yo, w, h, GL_RGBA, GL_UNSIGNED_BYTE, d); } @@ -1373,7 +1369,7 @@ int GLRenderer::LoadTextureData(const char* fn, D3DXIMAGE_INFO* i, int** o) { return hr; } int GLRenderer::LoadTextureData(uint8_t* pb, uint32_t nb, D3DXIMAGE_INFO* i, - int** o) { + int** o) { int w, h, c; unsigned char* d = stbi_load_from_memory(pb, (int)nb, &w, &h, &c, 4); if (!d) return -1; // Failure @@ -1462,19 +1458,19 @@ void glFogfv(GLenum pname, const GLfloat* params) { } void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { if (pname == 0x1203) - PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); + PlatformRenderer.StateSetLightDirection( + light == 0x4000 ? 0 : 1, params[0], params[1], params[2]); else if (pname == 0x1200) PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); + params[2]); else if (pname == 0x1201) PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); + params[1], params[2]); } void glLightModelfv(GLenum pname, const GLfloat* params) { if (pname == 0x0B53) PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); + params[2]); } void glShadeModel(GLenum) {} void glColorMaterial(GLenum, GLenum) {} @@ -1528,7 +1524,7 @@ void glTexImage2D_4J(int target, int level, int internalformat, int width, (void)format; (void)type; PlatformRenderer.TextureData(width, height, getBytePtr(pixels), level, - IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); + IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw); } void glLight_4J(int light, int pname, FloatBuffer* params) { diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index e4d3f7b86..98f395eeb 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -152,4 +152,3 @@ public: void Close(); void Shutdown(); }; - diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index f7c84e535..280fef444 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -284,75 +284,75 @@ #endif #undef glTranslatef -#define glTranslatef(x, y, z) \ - do { \ +#define glTranslatef(x, y, z) \ + do { \ PlatformRenderer.MatrixTranslate(x, y, z); \ } while (0) #undef glRotatef -#define glRotatef(a, x, y, z) \ - do { \ +#define glRotatef(a, x, y, z) \ + do { \ PlatformRenderer.MatrixRotate((a) * (3.14159265358979f / 180.f), x, y, \ - z); \ + z); \ } while (0) #undef glScalef -#define glScalef(x, y, z) \ - do { \ +#define glScalef(x, y, z) \ + do { \ PlatformRenderer.MatrixScale(x, y, z); \ } while (0) #undef glScaled -#define glScaled(x, y, z) \ - do { \ +#define glScaled(x, y, z) \ + do { \ PlatformRenderer.MatrixScale((float)(x), (float)(y), (float)(z)); \ } while (0) #undef glPushMatrix -#define glPushMatrix() \ - do { \ +#define glPushMatrix() \ + do { \ PlatformRenderer.MatrixPush(); \ } while (0) #undef glPopMatrix -#define glPopMatrix() \ - do { \ +#define glPopMatrix() \ + do { \ PlatformRenderer.MatrixPop(); \ } while (0) #undef glLoadIdentity -#define glLoadIdentity() \ - do { \ +#define glLoadIdentity() \ + do { \ PlatformRenderer.MatrixSetIdentity(); \ } while (0) #undef glMatrixMode -#define glMatrixMode(mode) \ - do { \ +#define glMatrixMode(mode) \ + do { \ PlatformRenderer.MatrixMode(mode); \ } while (0) #undef glMultMatrixf -#define glMultMatrixf(m) \ - do { \ +#define glMultMatrixf(m) \ + do { \ PlatformRenderer.MatrixMult(m); \ } while (0) #undef glColor4f -#define glColor4f(r, g, b, a) \ - do { \ +#define glColor4f(r, g, b, a) \ + do { \ PlatformRenderer.StateSetColour(r, g, b, a); \ } while (0) #undef glColor3f -#define glColor3f(r, g, b) \ - do { \ +#define glColor3f(r, g, b) \ + do { \ PlatformRenderer.StateSetColour(r, g, b, 1.0f); \ } while (0) #undef glAlphaFunc -#define glAlphaFunc(func, ref) \ - do { \ +#define glAlphaFunc(func, ref) \ + do { \ PlatformRenderer.StateSetAlphaFunc(func, ref); \ } while (0) @@ -360,23 +360,23 @@ #define glEnable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(true); \ + PlatformRenderer.StateSetFogEnable(true); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(true); \ + PlatformRenderer.StateSetLightingEnable(true); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(true); \ + PlatformRenderer.StateSetAlphaTestEnable(true); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(true); \ + PlatformRenderer.StateSetTextureEnable(true); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(true); \ + PlatformRenderer.StateSetBlendEnable(true); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(true); \ + PlatformRenderer.StateSetFaceCull(true); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(true); \ + PlatformRenderer.StateSetDepthTestEnable(true); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, true); \ + PlatformRenderer.StateSetLightEnable(0, true); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, true); \ + PlatformRenderer.StateSetLightEnable(1, true); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -392,23 +392,23 @@ #define glDisable(cap) \ do { \ if ((cap) == 0x0B60 /*GL_FOG*/) \ - PlatformRenderer.StateSetFogEnable(false); \ + PlatformRenderer.StateSetFogEnable(false); \ else if ((cap) == 0x0B50 /*GL_LIGHTING*/) \ - PlatformRenderer.StateSetLightingEnable(false); \ + PlatformRenderer.StateSetLightingEnable(false); \ else if ((cap) == 0x0BC0 /*GL_ALPHA_TEST*/) \ - PlatformRenderer.StateSetAlphaTestEnable(false); \ + PlatformRenderer.StateSetAlphaTestEnable(false); \ else if ((cap) == 0x0DE1 /*GL_TEXTURE_2D*/) \ - PlatformRenderer.StateSetTextureEnable(false); \ + PlatformRenderer.StateSetTextureEnable(false); \ else if ((cap) == 0x0BE2 /*GL_BLEND*/) \ - PlatformRenderer.StateSetBlendEnable(false); \ + PlatformRenderer.StateSetBlendEnable(false); \ else if ((cap) == 0x0B44 /*GL_CULL_FACE*/) \ - PlatformRenderer.StateSetFaceCull(false); \ + PlatformRenderer.StateSetFaceCull(false); \ else if ((cap) == 0x0B71 /*GL_DEPTH_TEST*/) \ - PlatformRenderer.StateSetDepthTestEnable(false); \ + PlatformRenderer.StateSetDepthTestEnable(false); \ else if ((cap) == 0x4000 /*GL_LIGHT0*/) \ - PlatformRenderer.StateSetLightEnable(0, false); \ + PlatformRenderer.StateSetLightEnable(0, false); \ else if ((cap) == 0x4001 /*GL_LIGHT1*/) \ - PlatformRenderer.StateSetLightEnable(1, false); \ + PlatformRenderer.StateSetLightEnable(1, false); \ else if ((cap) == 0x0B57 /*GL_COLOR_MATERIAL*/ \ || (cap) == 0x0BA1 /*GL_NORMALIZE*/ \ || (cap) == 0x803A /*GL_RESCALE_NORMAL*/ \ @@ -421,46 +421,47 @@ } while (0) #undef glFogi -#define glFogi(pname, param) \ - do { \ - if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ +#define glFogi(pname, param) \ + do { \ + if ((pname) == 0x0B65 /*GL_FOG_MODE*/) \ PlatformRenderer.StateSetFogMode(param); \ } while (0) #undef glFogf -#define glFogf(pname, param) \ - do { \ - if ((pname) == 0x0B63 /*GL_FOG_START*/) \ +#define glFogf(pname, param) \ + do { \ + if ((pname) == 0x0B63 /*GL_FOG_START*/) \ PlatformRenderer.StateSetFogNearDistance(param); \ - else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ + else if ((pname) == 0x0B64 /*GL_FOG_END*/) \ PlatformRenderer.StateSetFogFarDistance(param); \ - else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ + else if ((pname) == 0x0B62 /*GL_FOG_DENSITY*/) \ PlatformRenderer.StateSetFogDensity(param); \ } while (0) #undef glOrtho -#define glOrtho(left, right, bottom, top, zNear, zFar) \ - do { \ - PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, zFar); \ +#define glOrtho(left, right, bottom, top, zNear, zFar) \ + do { \ + PlatformRenderer.MatrixOrthogonal(left, right, bottom, top, zNear, \ + zFar); \ } while (0) #undef glMultiTexCoord2f -#define glMultiTexCoord2f(tex, u, v) \ - do { \ - if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ +#define glMultiTexCoord2f(tex, u, v) \ + do { \ + if ((tex) == 0x84C1 /*GL_TEXTURE1*/) \ PlatformRenderer.StateSetVertexTextureUV(u, v); \ } while (0) #undef glActiveTexture -#define glActiveTexture(tex) \ - do { \ +#define glActiveTexture(tex) \ + do { \ PlatformRenderer.StateSetActiveTexture(tex); \ - ::glActiveTexture(tex); \ + ::glActiveTexture(tex); \ } while (0) #undef glClientActiveTexture -#define glClientActiveTexture(tex) \ - do { \ +#define glClientActiveTexture(tex) \ + do { \ PlatformRenderer.StateSetActiveTexture(tex); \ } while (0) @@ -542,12 +543,12 @@ inline void glLight_4J(int light, int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x1203 /* GL_POSITION */) PlatformRenderer.StateSetLightDirection(light == 0x4000 ? 0 : 1, p[0], - p[1], p[2]); + p[1], p[2]); else if (pname == 0x1200 /* GL_AMBIENT */) PlatformRenderer.StateSetLightAmbientColour(p[0], p[1], p[2]); else if (pname == 0x1201 /* GL_DIFFUSE */) - PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], p[1], - p[2]); + PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, p[0], + p[1], p[2]); } template inline void glLightModel_4J(int pname, T* params) { diff --git a/targets/platform/renderer/gl/render_stubs.cpp b/targets/platform/renderer/gl/render_stubs.cpp index b4dc08d4b..531ee9f05 100644 --- a/targets/platform/renderer/gl/render_stubs.cpp +++ b/targets/platform/renderer/gl/render_stubs.cpp @@ -19,7 +19,9 @@ void GLRenderer::TextureDynamicUpdateEnd() {} void GLRenderer::TextureGetStats() {} void* GLRenderer::TextureGetTexture(int) { return nullptr; } -int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { return 0; } +int GLRenderer::SaveTextureData(const char*, D3DXIMAGE_INFO*, int*) { + return 0; +} int GLRenderer::SaveTextureDataToMemory(void*, int, int*, int, int, int*) { return 0; } diff --git a/targets/platform/renderer/renderer.h b/targets/platform/renderer/renderer.h index aaf9dd4fc..d6588cfdb 100644 --- a/targets/platform/renderer/renderer.h +++ b/targets/platform/renderer/renderer.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading PlatformRenderer -// during another translation unit's static init was UB. +// `extern IPlatformRenderer& PlatformRenderer;` form had: anything reading +// PlatformRenderer during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformRenderer.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/sound/IPlatformSound.h b/targets/platform/sound/IPlatformSound.h index 7541dc967..5fb3ad171 100644 --- a/targets/platform/sound/IPlatformSound.h +++ b/targets/platform/sound/IPlatformSound.h @@ -24,10 +24,10 @@ struct PlaySoundParams { float z = 0.0f; float volume = 1.0f; float pitch = 1.0f; - bool spatial = true; // 3D sound positioned in the world + bool spatial = true; // 3D sound positioned in the world bool looping = false; - float minDistance = 1.0f; // distance below which the sound is full-volume - float maxDistance = 16.0f; // distance above which the sound is silent + float minDistance = 1.0f; // distance below which the sound is full-volume + float maxDistance = 16.0f; // distance above which the sound is silent }; struct PlayMusicParams { diff --git a/targets/platform/sound/miniaudio/MiniaudioSound.cpp b/targets/platform/sound/miniaudio/MiniaudioSound.cpp index 5aa8c3424..dd9c6ba41 100644 --- a/targets/platform/sound/miniaudio/MiniaudioSound.cpp +++ b/targets/platform/sound/miniaudio/MiniaudioSound.cpp @@ -4,7 +4,6 @@ #include #include "miniaudio.h" - #include "platform/sound/sound.h" namespace platform::sound::miniaudio { @@ -81,8 +80,7 @@ void MiniaudioSound::tick() { // game's music system. for (auto it = m_state->sounds.begin(); it != m_state->sounds.end();) { auto& voice = it->second; - if (voice && voice->inUse && - !ma_sound_is_playing(&voice->sound) && + if (voice && voice->inUse && !ma_sound_is_playing(&voice->sound) && !ma_sound_is_looping(&voice->sound)) { ma_sound_uninit(&voice->sound); voice->inUse = false; @@ -209,15 +207,13 @@ bool MiniaudioSound::isMusicPlaying(MusicHandle handle) const { void MiniaudioSound::setMusicVolume(MusicHandle handle, float volume) { auto it = m_state->music.find(handle.id); - if (it == m_state->music.end() || !it->second || !it->second->inUse) - return; + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; ma_sound_set_volume(&it->second->sound, volume); } void MiniaudioSound::setMusicPitch(MusicHandle handle, float pitch) { auto it = m_state->music.find(handle.id); - if (it == m_state->music.end() || !it->second || !it->second->inUse) - return; + if (it == m_state->music.end() || !it->second || !it->second->inUse) return; ma_sound_set_pitch(&it->second->sound, pitch); } @@ -234,9 +230,8 @@ void MiniaudioSound::releaseMusic(MusicHandle handle) { void MiniaudioSound::setListenerPosition(int listenerIndex, float x, float y, float z) { if (!m_state->engineReady) return; - ma_engine_listener_set_position(&m_state->engine, - static_cast(listenerIndex), x, - y, z); + ma_engine_listener_set_position( + &m_state->engine, static_cast(listenerIndex), x, y, z); } void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, @@ -246,9 +241,8 @@ void MiniaudioSound::setListenerOrientation(int listenerIndex, float forwardX, ma_engine_listener_set_direction(&m_state->engine, static_cast(listenerIndex), forwardX, forwardY, forwardZ); - ma_engine_listener_set_world_up(&m_state->engine, - static_cast(listenerIndex), - upX, upY, upZ); + ma_engine_listener_set_world_up( + &m_state->engine, static_cast(listenerIndex), upX, upY, upZ); } } // namespace platform::sound::miniaudio diff --git a/targets/platform/storage/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h index e65b86211..d7de03761 100644 --- a/targets/platform/storage/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -36,8 +36,6 @@ using PSAVE_DETAILS = SAVE_DETAILS*; class C4JStringTable; - - class IPlatformStorage { public: // Enums live here so both the interface consumer and the concrete @@ -198,9 +196,10 @@ public: unsigned int textDataBytes) = 0; virtual ESaveGameState SaveSaveData( std::function callback) = 0; - virtual void CopySaveDataToNewSave( - std::uint8_t* pbThumbnail, unsigned int cbThumbnail, - char* wchNewName, std::function callback) = 0; + virtual void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) = 0; virtual ESaveGameState DoesSaveExist(bool* pbExists) = 0; virtual bool EnoughSpaceForAMinSaveGame() = 0; virtual void SetSaveMessageVPosition(float fY) = 0; @@ -211,10 +210,9 @@ public: virtual PSAVE_DETAILS ReturnSavesInfo() = 0; virtual void ClearSavesInfo() = 0; virtual ESaveGameState LoadSaveDataThumbnail( - PSAVE_INFO pSaveInfo, - std::function - callback) = 0; + PSAVE_INFO pSaveInfo, std::function + callback) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData) = 0; virtual void GetSaveCacheFileInfo(unsigned int fileIndex, @@ -224,16 +222,14 @@ public: PSAVE_INFO pSaveInfo, std::function callback) = 0; virtual ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) = 0; + PSAVE_INFO pSaveInfo, std::function callback) = 0; // DLC virtual void RegisterMarketplaceCountsCallback( std::function callback) = 0; virtual void SetDLCPackageRoot(char* pszDLCRoot) = 0; virtual EDLCStatus GetDLCOffers( - int iPad, - std::function callback, + int iPad, std::function callback, std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT) = 0; virtual unsigned int CancelGetDLCOffers() = 0; @@ -260,8 +256,7 @@ public: // Title storage virtual ETMSStatus ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, eTMS_FileType eFileType, - char* pwchFilename, std::uint8_t** ppBuffer, - unsigned int* pBufferSize, + char* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, std::function callback = nullptr, int iAction = 0) = 0; virtual bool WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, diff --git a/targets/platform/storage/storage.h b/targets/platform/storage/storage.h index 177050af8..624af2ddb 100644 --- a/targets/platform/storage/storage.h +++ b/targets/platform/storage/storage.h @@ -4,8 +4,8 @@ // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous -// `extern IPlatformStorage& PlatformStorage;` form had: anything reading PlatformStorage -// during another translation unit's static init was UB. +// `extern IPlatformStorage& PlatformStorage;` form had: anything reading +// PlatformStorage during another translation unit's static init was UB. // // The macro lets the existing call sites keep writing `PlatformStorage.foo()` // without each call site having to add the `()`. The expansion is just diff --git a/targets/platform/storage/stub/StubStorage.cpp b/targets/platform/storage/stub/StubStorage.cpp index 748b2e2b4..8d6518e5c 100644 --- a/targets/platform/storage/stub/StubStorage.cpp +++ b/targets/platform/storage/stub/StubStorage.cpp @@ -11,7 +11,7 @@ IPlatformStorage& PlatformStorage_get() { static StubStorage instance; return instance; } -} +} // namespace platform_internal static XMARKETPLACE_CONTENTOFFER_INFO s_dummyOffer = {}; static XCONTENT_DATA s_dummyContentData = {}; @@ -34,15 +34,15 @@ StubStorage::EMessageResult StubStorage::GetMessageBoxResult() { } bool StubStorage::SetSaveDevice(std::function callback, - bool bForceResetOfSaveDevice) { + bool bForceResetOfSaveDevice) { return true; } void StubStorage::Init(unsigned int uiSaveVersion, - const char* pwchDefaultSaveName, char* pszSavePackName, - int iMinimumSaveSize, - std::function callback, - const char* szGroupID) {} + const char* pwchDefaultSaveName, char* pszSavePackName, + int iMinimumSaveSize, + std::function callback, + const char* szGroupID) {} void StubStorage::ResetSaveData() {} void StubStorage::SetDefaultSaveNameForKeyboardDisplay( const char* pwchDefaultSaveName) {} @@ -57,7 +57,7 @@ bool StubStorage::GetSaveUniqueFilename(char* pszName) { } void StubStorage::SetSaveUniqueFilename(char* szFilename) {} void StubStorage::SetState(ESaveGameControlState eControlState, - std::function callback) {} + std::function callback) {} void StubStorage::SetSaveDisabled(bool bDisable) {} bool StubStorage::GetSaveDisabled(void) { return false; } unsigned int StubStorage::GetSaveSize() { return 0; } @@ -68,18 +68,18 @@ void* StubStorage::AllocateSaveData(unsigned int uiBytes) { return malloc(uiBytes); } void StubStorage::SetSaveImages(std::uint8_t* pbThumbnail, - unsigned int thumbnailBytes, - std::uint8_t* pbImage, unsigned int imageBytes, - std::uint8_t* pbTextData, - unsigned int textDataBytes) {} + unsigned int thumbnailBytes, + std::uint8_t* pbImage, unsigned int imageBytes, + std::uint8_t* pbTextData, + unsigned int textDataBytes) {} StubStorage::ESaveGameState StubStorage::SaveSaveData( std::function callback) { return ESaveGame_Idle; } void StubStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, - unsigned int cbThumbnail, - char* wchNewName, - std::function callback) {} + unsigned int cbThumbnail, + char* wchNewName, + std::function callback) {} void StubStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} bool StubStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } StubStorage::ESaveGameState StubStorage::DoesSaveExist(bool* pbExists) { @@ -98,29 +98,26 @@ PSAVE_DETAILS StubStorage::ReturnSavesInfo() { return nullptr; } void StubStorage::ClearSavesInfo() {} StubStorage::ESaveGameState StubStorage::LoadSaveDataThumbnail( PSAVE_INFO pSaveInfo, - std::function + std::function callback) { return ESaveGame_Idle; } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - XCONTENT_DATA& xContentData) { + XCONTENT_DATA& xContentData) { memset(&xContentData, 0, sizeof(xContentData)); } void StubStorage::GetSaveCacheFileInfo(unsigned int fileIndex, - std::uint8_t** ppbImageData, - unsigned int* pImageBytes) { + std::uint8_t** ppbImageData, + unsigned int* pImageBytes) { if (ppbImageData) *ppbImageData = nullptr; if (pImageBytes) *pImageBytes = 0; } StubStorage::ESaveGameState StubStorage::LoadSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } StubStorage::ESaveGameState StubStorage::DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback) { + PSAVE_INFO pSaveInfo, std::function callback) { return ESaveGame_Idle; } void StubStorage::RegisterMarketplaceCountsCallback( @@ -137,9 +134,10 @@ XMARKETPLACE_CONTENTOFFER_INFO& StubStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } int StubStorage::GetOfferCount() { return 0; } -unsigned int StubStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, - std::function callback, - bool bTrial) { +unsigned int StubStorage::InstallOffer(int iOfferIDC, + std::uint64_t* ullOfferIDA, + std::function callback, + bool bTrial) { return 0; } unsigned int StubStorage::GetAvailableDLCCount(int iPad) { return 0; } @@ -163,7 +161,7 @@ unsigned int StubStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } void StubStorage::GetMountedDLCFileList(const char* szMountDrive, - std::vector& fileList) { + std::vector& fileList) { fileList.clear(); } std::string StubStorage::GetMountedPath(std::string szMount) { return ""; } @@ -175,12 +173,12 @@ StubStorage::ETMSStatus StubStorage::ReadTMSFile( return ETMSStatus_Fail; } bool StubStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename, std::uint8_t* pBuffer, - unsigned int bufferSize) { + char* pwchFilename, std::uint8_t* pBuffer, + unsigned int bufferSize) { return false; } bool StubStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, - char* pwchFilename) { + char* pwchFilename) { return false; } void StubStorage::StoreTMSPathName(char* pwchName) {} @@ -208,7 +206,7 @@ int StubStorage::AddSubfile(int regionIndex) { } unsigned int StubStorage::GetSubfileCount() { return 0; } void StubStorage::GetSubfileDetails(unsigned int i, int* regionIndex, - void** data, unsigned int* size) { + void** data, unsigned int* size) { (void)i; if (regionIndex) *regionIndex = 0; if (data) *data = 0; @@ -223,5 +221,7 @@ void StubStorage::UpdateSubfile(int index, void* data, unsigned int size) { void StubStorage::SaveSubfiles(std::function callback) { if (callback) callback(true); } -StubStorage::ESaveGameState StubStorage::GetSaveState() { return ESaveGame_Idle; } +StubStorage::ESaveGameState StubStorage::GetSaveState() { + return ESaveGame_Idle; +} void StubStorage::ContinueIncompleteOperation() {} diff --git a/targets/platform/storage/stub/StubStorage.h b/targets/platform/storage/stub/StubStorage.h index ce0d57440..813a4d888 100644 --- a/targets/platform/storage/stub/StubStorage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -7,8 +7,8 @@ #include // #include -#include "PlatformTypes.h" #include "../IPlatformStorage.h" +#include "PlatformTypes.h" class C4JStringTable; @@ -87,8 +87,7 @@ public: const char* szGroupID); void ResetSaveData(); // Call before a new save to clear out stored save // file name - void SetDefaultSaveNameForKeyboardDisplay( - const char* pwchDefaultSaveName); + void SetDefaultSaveNameForKeyboardDisplay(const char* pwchDefaultSaveName); void SetSaveTitle(const char* pwchDefaultSaveName); bool GetSaveUniqueNumber(int* piVal); bool GetSaveUniqueFilename(char* pszName); @@ -145,8 +144,7 @@ public: PSAVE_INFO pSaveInfo, std::function callback); StubStorage::ESaveGameState DeleteSaveData( - PSAVE_INFO pSaveInfo, - std::function callback); + PSAVE_INFO pSaveInfo, std::function callback); // DLC void RegisterMarketplaceCountsCallback( @@ -194,8 +192,9 @@ public: #ifdef _XBOX StubStorage::ETMSStatus WriteTMSFile( int iPad, StubStorage::eGlobalStorage eStorageFacility, - StubStorage::eTMS_FileType eFileType, char* pchFilePath, char* pchBuffer, - unsigned int bufferSize, TMSCLIENT_CALLBACK Func, void* lpParam); + 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 diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index bcd243d02..5ef9a019f 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -3,10 +3,11 @@ #include #ifdef __linux__ -#include "renderer/gl/gl_compat.h" #include #include +#include "renderer/gl/gl_compat.h" + #undef GL_SMOOTH #undef GL_FLAT static const int GL_SMOOTH = 0x1D01; diff --git a/targets/util/StringHelpers.h b/targets/util/StringHelpers.h index d7de053ab..d672c630b 100644 --- a/targets/util/StringHelpers.h +++ b/targets/util/StringHelpers.h @@ -7,7 +7,7 @@ std::string toLower(const std::string& a); std::string trimString(const std::string& a); std::string replaceAll(const std::string& in, const std::string& replace, - const std::string& with); + const std::string& with); bool equalsIgnoreCase(const std::string& a, const std::string& b); @@ -41,7 +41,7 @@ std::string wstringtofilename(const std::wstring& name); std::wstring filenametowstring(const char* name); std::vector& stringSplit(const std::string& s, char delim, - std::vector& elems); + std::vector& elems); std::vector stringSplit(const std::string& s, char delim); void stripWhitespaceForHtml(std::string& string, bool bRemoveNewline = true); diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 71ca5e398..5738d0a0c 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -13,7 +13,10 @@ using clock = std::chrono::steady_clock; using time_point = clock::time_point; template -concept Duration = requires { typename T::rep; typename T::period; }; +concept Duration = requires { + typename T::rep; + typename T::period; +}; namespace detail { @@ -62,16 +65,13 @@ public: line_(where.line()) {} template - ScopedTimer( - std::string_view name, - D min_duration_to_log, - std::source_location where = std::source_location::current()) + ScopedTimer(std::string_view name, D min_duration_to_log, + std::source_location where = std::source_location::current()) : name_(name), file_(detail::base_name(where.file_name())), line_(where.line()), - min_duration_to_log_( - std::chrono::duration_cast(min_duration_to_log)) { - } + min_duration_to_log_(std::chrono::duration_cast( + min_duration_to_log)) {} ~ScopedTimer() noexcept { const auto elapsed = timer_.elapsed(); @@ -82,10 +82,10 @@ public: try { name_.empty() - ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", - ms, file_, line_) - : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", - name_, ms, file_, line_); + ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", ms, file_, + line_) + : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", name_, + ms, file_, line_); } catch (...) { std::fprintf(stderr, "[TIMER] %.3f ms\n", ms); } From b7792622a9996ed27ba61641874a61621a64c034 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:27:12 +1000 Subject: [PATCH 032/104] perf: replace EventArray mutex+cv with atomic mask set() is now lock-free; waiters block via std::atomic::wait. --- targets/platform/C4JThread.cpp | 105 +++++++++++++++++++++++---------- targets/platform/C4JThread.h | 5 +- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/targets/platform/C4JThread.cpp b/targets/platform/C4JThread.cpp index a0838a2fe..4a577ff02 100644 --- a/targets/platform/C4JThread.cpp +++ b/targets/platform/C4JThread.cpp @@ -376,77 +376,120 @@ std::uint32_t C4JThread::Event::waitForSignal(int timeoutMs) { } C4JThread::EventArray::EventArray(int size, Mode mode) - : m_size(size), m_mode(mode), m_mutex(), m_condition(), m_signaledMask(0U) { + : m_size(size), m_mode(mode), m_signaledMask(0U) { assert(m_size > 0 && m_size <= 32); } void C4JThread::EventArray::set(int index) { assert(index >= 0 && index < m_size); - { - std::lock_guard lock(m_mutex); - m_signaledMask |= (1U << static_cast(index)); - } - m_condition.notify_all(); + const std::uint32_t bit = 1U << static_cast(index); + m_signaledMask.fetch_or(bit, std::memory_order_release); + m_signaledMask.notify_all(); } void C4JThread::EventArray::clear(int index) { assert(index >= 0 && index < m_size); - std::lock_guard lock(m_mutex); - m_signaledMask &= ~(1U << static_cast(index)); + const std::uint32_t bit = 1U << static_cast(index); + m_signaledMask.fetch_and(~bit, std::memory_order_relaxed); } void C4JThread::EventArray::setAll() { - { - std::lock_guard lock(m_mutex); - m_signaledMask |= buildMaskForSize(m_size); - } - m_condition.notify_all(); + const std::uint32_t mask = buildMaskForSize(m_size); + m_signaledMask.fetch_or(mask, std::memory_order_release); + m_signaledMask.notify_all(); } void C4JThread::EventArray::clearAll() { - std::lock_guard lock(m_mutex); - m_signaledMask = 0U; + m_signaledMask.store(0U, std::memory_order_relaxed); } +namespace { + +// Polling fallback for finite-timeout waits; std::atomic::wait has no timed +// overload until C++26. +template +bool waitForMaskTimed(std::atomic& mask, int timeoutMs, + Predicate&& predicate) { + using clock = std::chrono::steady_clock; + const auto deadline = clock::now() + std::chrono::milliseconds(timeoutMs); + auto interval = std::chrono::microseconds(100); + constexpr auto maxInterval = std::chrono::milliseconds(2); + while (clock::now() < deadline) { + if (predicate(mask.load(std::memory_order_acquire))) return true; + std::this_thread::sleep_for(interval); + if (interval < maxInterval) interval *= 2; + } + return predicate(mask.load(std::memory_order_acquire)); +} + +} // namespace + std::uint32_t C4JThread::EventArray::waitForSingle(int index, int timeoutMs) { assert(index >= 0 && index < m_size); const std::uint32_t bitMask = 1U << static_cast(index); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) != 0U; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - if (m_mode == Mode::AutoClear) m_signaledMask &= ~bitMask; + + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~bitMask, std::memory_order_release); + } return WaitResult::Signaled; } std::uint32_t C4JThread::EventArray::waitForAll(int timeoutMs) { const std::uint32_t bitMask = buildMaskForSize(m_size); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) == bitMask; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) == bitMask; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - if (m_mode == Mode::AutoClear) m_signaledMask &= ~bitMask; + + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~bitMask, std::memory_order_release); + } return WaitResult::Signaled; } std::uint32_t C4JThread::EventArray::waitForAny(int timeoutMs) { const std::uint32_t bitMask = buildMaskForSize(m_size); - std::unique_lock lock(m_mutex); + const auto predicate = [bitMask](std::uint32_t cur) { + return (cur & bitMask) != 0U; + }; - if (!waitForCondition(m_condition, lock, timeoutMs, [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - })) { + if (timeoutMs == kInfiniteTimeout) { + std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + while (!predicate(cur)) { + m_signaledMask.wait(cur, std::memory_order_relaxed); + cur = m_signaledMask.load(std::memory_order_acquire); + } + } else if (!waitForMaskTimed(m_signaledMask, timeoutMs, predicate)) { return WaitResult::Timeout; } - const std::uint32_t readyIndex = firstSetBitIndex(m_signaledMask & bitMask); - if (m_mode == Mode::AutoClear) m_signaledMask &= ~(1U << readyIndex); + const std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); + const std::uint32_t readyIndex = firstSetBitIndex(cur & bitMask); + if (m_mode == Mode::AutoClear) { + m_signaledMask.fetch_and(~(1U << readyIndex), std::memory_order_release); + } return WaitResult::Signaled + readyIndex; } diff --git a/targets/platform/C4JThread.h b/targets/platform/C4JThread.h index 54e08f0f2..ee6d3ded8 100644 --- a/targets/platform/C4JThread.h +++ b/targets/platform/C4JThread.h @@ -51,6 +51,7 @@ public: bool m_signaled; }; + // Lock-free bitmask of up to 32 events; waiters block via std::atomic::wait. class EventArray { public: enum class Mode { AutoClear, ManualClear }; @@ -68,9 +69,7 @@ public: private: int m_size; Mode m_mode; - std::mutex m_mutex; - std::condition_variable m_condition; - std::uint32_t m_signaledMask; + std::atomic m_signaledMask; }; class EventQueue { From fe77d9c2a08569daa8c4182a0f709b53ac2de291 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 13:22:54 +1000 Subject: [PATCH 033/104] build: optional mimalloc replacement for system malloc Toggle with -Denable_mimalloc=enabled/disabled/auto. --- meson.build | 2 ++ meson.options | 7 +++++++ targets/app/meson.build | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2c4817142..8d2821b1b 100644 --- a/meson.build +++ b/meson.build @@ -92,6 +92,8 @@ simdutf_dep = dependency('simdutf', ) miniaudio_dep = dependency('miniaudio') +mimalloc_dep = cc.find_library('mimalloc', required: get_option('enable_mimalloc')) + subdir('targets/util') subdir('targets/java') subdir('targets/nbt') diff --git a/meson.options b/meson.options index 4dc73f322..c2ed70bfc 100644 --- a/meson.options +++ b/meson.options @@ -40,3 +40,10 @@ option( value: 'frustum', description: 'Occlusion culling mode. Off disables ALL CULLING (debug only!), Frustum disables offscreen rendering (default), BFS is experimental connectivity culling, hardware uses GPU queries.', ) + +option( + 'enable_mimalloc', + type: 'feature', + value: 'auto', + description: 'Link mimalloc as the malloc implementation. Requires libmimalloc-dev.', +) diff --git a/targets/app/meson.build b/targets/app/meson.build index 6f90b86e7..e4be7a135 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -8,7 +8,18 @@ if host_machine.system() == 'linux' platform_sources += files(fs.read('linux_sources.txt').strip().split('\n')) endif -client_dependencies = [ +client_dependencies = [] + +# mimalloc must come first so the linker resolves malloc/free symbols to it +# before glibc. --no-as-needed prevents the linker from dropping it as +# "unreferenced" (the override happens via weak symbols, not direct calls). +client_link_args = [] +if mimalloc_dep.found() + client_dependencies += mimalloc_dep + client_link_args += ['-Wl,--no-as-needed'] +endif + +client_dependencies += [ java_dep, nbt_dep, render_dep, @@ -52,6 +63,7 @@ client = executable( '-D_UNICODE', ], c_args: global_cpp_defs + ['-DUNICODE', '-D_UNICODE'], + link_args: client_link_args, install: true, install_dir: '', ) From 45c85fcf79595caf935d96b99b15dc93963fc42e Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 13:23:02 +1000 Subject: [PATCH 034/104] perf: stop heap-allocating mob restriction state and Path nodes Inlines restrictCenter and leashRestrictionGoal as value members and stores Path nodes by value, removing per-mob and per-path malloc churn. --- .../minecraft/world/entity/PathfinderMob.cpp | 37 +++++++-------- .../minecraft/world/entity/PathfinderMob.h | 8 ++-- .../minecraft/world/level/pathfinder/Node.h | 4 +- .../minecraft/world/level/pathfinder/Path.cpp | 45 ++++++------------- .../minecraft/world/level/pathfinder/Path.h | 8 ++-- 5 files changed, 40 insertions(+), 62 deletions(-) diff --git a/targets/minecraft/world/entity/PathfinderMob.cpp b/targets/minecraft/world/entity/PathfinderMob.cpp index 7abfbe7ca..7e079ab9c 100644 --- a/targets/minecraft/world/entity/PathfinderMob.cpp +++ b/targets/minecraft/world/entity/PathfinderMob.cpp @@ -26,25 +26,20 @@ AttributeModifier* PathfinderMob::SPEED_MODIFIER_FLEEING = AttributeModifier::OPERATION_MULTIPLY_TOTAL)) ->setSerialize(false); -PathfinderMob::PathfinderMob(Level* level) : Mob(level) { - path = nullptr; - attackTarget = nullptr; - holdGround = false; - fleeTime = 0; - - restrictRadius = -1; - restrictCenter = new Pos(0, 0, 0); - addedLeashRestrictionGoal = false; - leashRestrictionGoal = new MoveTowardsRestrictionGoal(this, 1.0f); -} +PathfinderMob::PathfinderMob(Level* level) + : Mob(level), + path(nullptr), + attackTarget(nullptr), + holdGround(false), + fleeTime(0), + restrictCenter(0, 0, 0), + restrictRadius(-1), + leashRestrictionGoal(this, 1.0f), + addedLeashRestrictionGoal(false) {} bool PathfinderMob::shouldHoldGround() { return false; } -PathfinderMob::~PathfinderMob() { - delete path; - delete restrictCenter; - delete leashRestrictionGoal; -} +PathfinderMob::~PathfinderMob() { delete path; } void PathfinderMob::serverAiStep() { if (fleeTime > 0) { @@ -264,15 +259,15 @@ bool PathfinderMob::isWithinRestriction() { bool PathfinderMob::isWithinRestriction(int x, int y, int z) { if (restrictRadius == -1) return true; - return restrictCenter->distSqr(x, y, z) < restrictRadius * restrictRadius; + return restrictCenter.distSqr(x, y, z) < restrictRadius * restrictRadius; } void PathfinderMob::restrictTo(int x, int y, int z, int radius) { - restrictCenter->set(x, y, z); + restrictCenter.set(x, y, z); restrictRadius = radius; } -Pos* PathfinderMob::getRestrictCenter() { return restrictCenter; } +Pos* PathfinderMob::getRestrictCenter() { return &restrictCenter; } float PathfinderMob::getRestrictRadius() { return restrictRadius; } @@ -305,7 +300,7 @@ void PathfinderMob::tickLeash() { } if (!addedLeashRestrictionGoal) { - goalSelector.addGoal(2, leashRestrictionGoal, false); + goalSelector.addGoal(2, &leashRestrictionGoal, false); getNavigation()->setAvoidWater(false); addedLeashRestrictionGoal = true; } @@ -332,7 +327,7 @@ void PathfinderMob::tickLeash() { } else if (!isLeashed() && addedLeashRestrictionGoal) { addedLeashRestrictionGoal = false; - goalSelector.removeGoal(leashRestrictionGoal); + goalSelector.removeGoal(&leashRestrictionGoal); getNavigation()->setAvoidWater(true); clearRestriction(); } diff --git a/targets/minecraft/world/entity/PathfinderMob.h b/targets/minecraft/world/entity/PathfinderMob.h index 774e9b620..3f09e96f2 100644 --- a/targets/minecraft/world/entity/PathfinderMob.h +++ b/targets/minecraft/world/entity/PathfinderMob.h @@ -3,14 +3,14 @@ #include #include "Mob.h" +#include "minecraft/Pos.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Mob.h" +#include "minecraft/world/entity/ai/goal/MoveTowardsRestrictionGoal.h" class Level; class Path; class AttributeModifier; -class Goal; -class Pos; class PathfinderMob : public Mob { public: @@ -32,9 +32,9 @@ protected: int fleeTime; private: - Pos* restrictCenter; + Pos restrictCenter; float restrictRadius; - Goal* leashRestrictionGoal; + MoveTowardsRestrictionGoal leashRestrictionGoal; bool addedLeashRestrictionGoal; protected: diff --git a/targets/minecraft/world/level/pathfinder/Node.h b/targets/minecraft/world/level/pathfinder/Node.h index e01c7ac27..3db0f3c4f 100644 --- a/targets/minecraft/world/level/pathfinder/Node.h +++ b/targets/minecraft/world/level/pathfinder/Node.h @@ -11,10 +11,10 @@ class Node { friend class EnderDragon; public: - const int x, y, z; + int x, y, z; private: - const int hash; + int hash; protected: int heapIdx; diff --git a/targets/minecraft/world/level/pathfinder/Path.cpp b/targets/minecraft/world/level/pathfinder/Path.cpp index 5307cacd0..b8b67529e 100644 --- a/targets/minecraft/world/level/pathfinder/Path.cpp +++ b/targets/minecraft/world/level/pathfinder/Path.cpp @@ -1,31 +1,12 @@ #include "Path.h" -#include - #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/pathfinder/Node.h" #include "minecraft/world/phys/Vec3.h" -Path::~Path() { - for (size_t i = 0; i < nodes.size(); i++) delete nodes[i]; -} - -Path::Path(std::vector& nodes) { - index = 0; - - length = nodes.size(); - // 4J - copying these nodes over from a std::vector (which is an - // array of Node - // * references) to just a straight array of Nodes, so that this Path is no - // longer dependent of Nodes allocated elsewhere and can handle its own - // destruction Note: cameFrom pointer will be useless now but that isn't - // used once this is just a path - this->nodes = std::vector(length); - - for (int i = 0; i < length; i++) { - this->nodes[i] = new Node(); - memcpy(this->nodes[i], nodes[i], sizeof(Node)); - } +Path::Path(std::vector& src) + : nodes(src.size()), index(0), length(static_cast(src.size())) { + for (int i = 0; i < length; i++) nodes[i] = *src[i]; } void Path::next() { index++; } @@ -34,12 +15,12 @@ bool Path::isDone() { return index >= length; } Node* Path::last() { if (length > 0) { - return nodes[length - 1]; + return &nodes[length - 1]; } return nullptr; } -Node* Path::get(int i) { return nodes[i]; } +Node* Path::get(int i) { return &nodes[i]; } int Path::getSize() { return length; } @@ -50,25 +31,25 @@ int Path::getIndex() { return index; } void Path::setIndex(int index) { this->index = index; } Vec3 Path::getPos(std::shared_ptr e, int index) { - double x = nodes[index]->x + (int)(e->bbWidth + 1) * 0.5; - double y = nodes[index]->y; - double z = nodes[index]->z + (int)(e->bbWidth + 1) * 0.5; + double x = nodes[index].x + (int)(e->bbWidth + 1) * 0.5; + double y = nodes[index].y; + double z = nodes[index].z + (int)(e->bbWidth + 1) * 0.5; return Vec3(x, y, z); } Vec3 Path::currentPos(std::shared_ptr e) { return getPos(e, index); } Vec3 Path::currentPos() { - return Vec3(nodes[index]->x, nodes[index]->y, nodes[index]->z); + return Vec3(nodes[index].x, nodes[index].y, nodes[index].z); } bool Path::sameAs(Path* path) { if (path == nullptr) return false; if (path->nodes.size() != nodes.size()) return false; - for (int i = 0; i < nodes.size(); ++i) - if (nodes[i]->x != path->nodes[i]->x || - nodes[i]->y != path->nodes[i]->y || - nodes[i]->z != path->nodes[i]->z) + for (size_t i = 0; i < nodes.size(); ++i) + if (nodes[i].x != path->nodes[i].x || + nodes[i].y != path->nodes[i].y || + nodes[i].z != path->nodes[i].z) return false; return true; } diff --git a/targets/minecraft/world/level/pathfinder/Path.h b/targets/minecraft/world/level/pathfinder/Path.h index 9c472824f..082d40468 100644 --- a/targets/minecraft/world/level/pathfinder/Path.h +++ b/targets/minecraft/world/level/pathfinder/Path.h @@ -13,13 +13,16 @@ class Path { friend class PathFinder; private: - std::vector nodes; + // Nodes are stored by value. The vector is sized once in the constructor + // and never resized, so Node* returned by get()/last() remain valid for + // the lifetime of the Path. + std::vector nodes; int index; int length; public: Path(std::vector& nodes); - ~Path(); + ~Path() = default; void next(); bool isDone(); @@ -30,7 +33,6 @@ public: int getIndex(); void setIndex(int index); Vec3 getPos(std::shared_ptr e, int index); - std::vector Getarray(); Vec3 currentPos(std::shared_ptr e); Vec3 currentPos(); bool sameAs(Path* path); From e051527607f553f72234b5efb8a0069066441b7a Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:56:35 +1000 Subject: [PATCH 035/104] refactor: replace XuiActionPayload polling with server-owned typed action queue --- targets/app/common/AppGameServices.cpp | 13 - targets/app/common/AppGameServices.h | 4 - targets/app/common/Game.h | 19 +- .../LevelGeneration/ConsoleSchematicFile.h | 21 - targets/app/common/GameSettingsManager.cpp | 78 ++-- targets/app/common/MenuController.cpp | 1 - targets/app/common/MenuController.h | 21 - .../app/common/Network/GameNetworkManager.cpp | 13 +- targets/app/common/SaveManager.cpp | 9 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 22 +- .../app/common/UI/All Platforms/UIStructs.h | 6 - .../Debug/UIScene_DebugCreateSchematic.cpp | 86 ++-- .../Debug/UIScene_DebugCreateSchematic.h | 6 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 11 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 48 +-- .../UI/Scenes/Debug/UIScene_DebugSetCamera.h | 14 +- .../UIScene_PauseMenu.cpp | 14 +- targets/minecraft/GameEnums.h | 19 - targets/minecraft/IGameServices.h | 6 - targets/minecraft/XuiActionPayload.h | 25 -- targets/minecraft/client/gui/PauseScreen.cpp | 9 +- targets/minecraft/client/gui/Screen.cpp | 7 +- targets/minecraft/server/MinecraftServer.cpp | 386 ++++++++---------- targets/minecraft/server/MinecraftServer.h | 25 ++ targets/minecraft/server/ServerAction.h | 78 ++++ 25 files changed, 438 insertions(+), 503 deletions(-) delete mode 100644 targets/minecraft/XuiActionPayload.h create mode 100644 targets/minecraft/server/ServerAction.h diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index 323996113..139d6af18 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -173,23 +173,10 @@ void AppGameServices::setAction(int iPad, eXuiAction action, void* param) { game_.SetAction(iPad, action, param); } -void AppGameServices::setXuiServerAction(int iPad, eXuiServerAction action, - XuiActionPayload param) { - game_.SetXuiServerAction(iPad, action, std::move(param)); -} - eXuiAction AppGameServices::getXuiAction(int iPad) { return game_.GetXuiAction(iPad); } -eXuiServerAction AppGameServices::getXuiServerAction(int iPad) { - return game_.GetXuiServerAction(iPad); -} - -const XuiActionPayload& AppGameServices::getXuiServerActionParam(int iPad) { - return game_.GetXuiServerActionParam(iPad); -} - void AppGameServices::setGlobalXuiAction(eXuiAction action) { game_.SetGlobalXuiAction(action); } diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index 4cc9b43a1..6e2e4d9bf 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -75,11 +75,7 @@ public: // -- UI dispatch -- void setAction(int iPad, eXuiAction action, void* param) override; - void setXuiServerAction(int iPad, eXuiServerAction action, - XuiActionPayload param) override; eXuiAction getXuiAction(int iPad) override; - eXuiServerAction getXuiServerAction(int iPad) override; - const XuiActionPayload& getXuiServerActionParam(int iPad) override; void setGlobalXuiAction(eXuiAction action) override; void handleButtonPresses() override; void setTMSAction(int iPad, eTMSAction action) override; diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index a67163e99..49e25afe2 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -273,23 +273,6 @@ public: eTMSAction GetTMSAction(int iPad) { return m_menuController.getTMSAction(iPad); } - eXuiServerAction GetXuiServerAction(int iPad) { - return m_menuController.getXuiServerAction(iPad); - } - const XuiActionPayload& GetXuiServerActionParam(int iPad) { - return m_menuController.getXuiServerActionParam(iPad); - } - void SetXuiServerAction(int iPad, eXuiServerAction action, - XuiActionPayload param = {}) { - m_menuController.setXuiServerAction(iPad, action, std::move(param)); - } - eXuiServerAction GetGlobalXuiServerAction() { - return m_menuController.getGlobalXuiServerAction(); - } - void SetGlobalXuiServerAction(eXuiServerAction action) { - m_menuController.setGlobalXuiServerAction(action); - } - DisconnectPacket::eDisconnectReason GetDisconnectReason() { return m_networkController.getDisconnectReason(); } @@ -931,7 +914,7 @@ public: // void OverrideFontRenderer(bool set, bool immediate = true); // void ToggleFontRenderer() { // OverrideFontRenderer(!m_bFontRendererOverridden,false); } - BANNEDLIST (&BannedListA) + BANNEDLIST(&BannedListA) [XUSER_MAX_COUNT] = m_bannedListManager.BannedListA; public: diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h index e51e3d46e..ee0e184f9 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h @@ -13,7 +13,6 @@ #include #include -#include "minecraft/XuiActionPayload.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/phys/Vec3.h" @@ -43,26 +42,6 @@ public: void decrementRefCount() { --m_refCount; } bool shouldDelete() { return m_refCount <= 0; } - struct XboxSchematicInitParam : minecraft::XuiActionOwnedPayload { - char name[64]; - int startX; - int startY; - int startZ; - int endX; - int endY; - int endZ; - bool bSaveMobs; - - Compression::ECompressionTypes compressionType; - - XboxSchematicInitParam() { - memset(name, 0, 64 * (sizeof(char))); - startX = startY = startZ = endX = endY = endZ = 0; - bSaveMobs = false; - compressionType = Compression::eCompressionType_None; - } - }; - private: int m_xSize, m_ySize, m_zSize; std::vector > m_tileEntities; diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 4b7cd0db1..9220fb7d2 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -1,14 +1,16 @@ #include "app/common/GameSettingsManager.h" +#include + +#include "app/common/Audio/SoundEngine.h" #include "app/common/Game.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "platform/profile/ProfileConstants.h" -#include "minecraft/GameEnums.h" -#include "minecraft/Console_Debug_enum.h" #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" #include "minecraft/client/gui/Gui.h" @@ -19,15 +21,14 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/tile/Tile.h" #include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" -#include "app/common/Audio/SoundEngine.h" - -#include GameSettingsManager::GameSettingsManager() { memset(GameSettingsA, 0, sizeof(GameSettingsA)); @@ -125,17 +126,16 @@ int GameSettingsManager::setDefaultOptions( setGameSettings(iPad, eGameSetting_PS3_EULA_Read, 0); if (!app.GetGameStarted()) { - GameSettingsA[iPad]->ucLanguage = - MINECRAFT_LANGUAGE_DEFAULT; - GameSettingsA[iPad]->ucLocale = - MINECRAFT_LANGUAGE_DEFAULT; + GameSettingsA[iPad]->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; + GameSettingsA[iPad]->ucLocale = MINECRAFT_LANGUAGE_DEFAULT; } return 0; } int GameSettingsManager::defaultOptionsCallback( - void* pParam, IPlatformProfile::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); @@ -196,8 +196,7 @@ int GameSettingsManager::oldProfileVersionCallback( pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYHAND; pGameSettings->uiBitmaskValues |= GAMESETTING_CUSTOMSKINANIM; pGameSettings->uiBitmaskValues |= GAMESETTING_DEATHMESSAGES; - pGameSettings->uiBitmaskValues |= - (GAMESETTING_UISIZE & 0x00000800); + pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800); pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; @@ -285,8 +284,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { if (bInGame && g_NetworkManager.IsHost() && (iPad == PlatformProfile.GetPrimaryPad())) { - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_Difficulty); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::BroadcastSettingChanged{ + minecraft::server::BroadcastSettingChanged::Kind:: + Difficulty}); } } else { app.DebugPrintf( @@ -311,30 +312,30 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { case eGameSetting_ControlSouthPaw: if (GameSettingsA[iPad]->usBitmaskValues & 0x80) { PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, - AXIS_MAP_RX); + AXIS_MAP_RX); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, - AXIS_MAP_RY); + AXIS_MAP_RY); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, - AXIS_MAP_LX); + AXIS_MAP_LX); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, - AXIS_MAP_LY); + AXIS_MAP_LY); PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, - TRIGGER_MAP_1); + TRIGGER_MAP_1); PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, - TRIGGER_MAP_0); + TRIGGER_MAP_0); } else { PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LX, - AXIS_MAP_LX); + AXIS_MAP_LX); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_LY, - AXIS_MAP_LY); + AXIS_MAP_LY); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RX, - AXIS_MAP_RX); + AXIS_MAP_RX); PlatformInput.SetJoypadStickAxisMap(iPad, AXIS_MAP_RY, - AXIS_MAP_RY); + AXIS_MAP_RY); PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_0, - TRIGGER_MAP_0); + TRIGGER_MAP_0); PlatformInput.SetJoypadStickTriggerMap(iPad, TRIGGER_MAP_1, - TRIGGER_MAP_1); + TRIGGER_MAP_1); } break; case eGameSetting_SplitScreenVertical: @@ -352,8 +353,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { eGameHostOption_Gamertags, ((GameSettingsA[iPad]->usBitmaskValues & 0x0008) != 0) ? 1 : 0); - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_Gamertags); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::BroadcastSettingChanged{ + minecraft::server::BroadcastSettingChanged::Kind:: + Gamertags}); PlayerList* players = MinecraftServer::getInstance()->getPlayerList(); @@ -409,8 +412,10 @@ void GameSettingsManager::actionGameSettings(int iPad, eGameSetting eVal) { app.SetGameHostOption( eGameHostOption_BedrockFog, getGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); - app.SetXuiServerAction( - iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::BroadcastSettingChanged{ + minecraft::server::BroadcastSettingChanged::Kind:: + BedrockFog}); } } break; case eGameSetting_DisplayHUD: @@ -466,8 +471,7 @@ unsigned char GameSettingsManager::getMinecraftLanguage(int iPad) { } } -void GameSettingsManager::setMinecraftLocale(int iPad, - unsigned char ucLocale) { +void GameSettingsManager::setMinecraftLocale(int iPad, unsigned char ucLocale) { GameSettingsA[iPad]->ucLocale = ucLocale; GameSettingsA[iPad]->bSettingsChanged = true; } @@ -1347,8 +1351,8 @@ void GameSettingsManager::setGameHostOption(unsigned int& uiHostSettings, } } -unsigned int GameSettingsManager::getGameHostOption( - unsigned int uiHostSettings, eGameHostOption eVal) { +unsigned int GameSettingsManager::getGameHostOption(unsigned int uiHostSettings, + eGameHostOption eVal) { switch (eVal) { case eGameHostOption_FriendsOfFriends: return (uiHostSettings & GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS); diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 2c5f6c323..d5e0f541a 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -36,7 +36,6 @@ MenuController::MenuController() { m_uiOpacityCountDown[i] = 0; } m_eGlobalXuiAction = eAppAction_Idle; - m_eGlobalXuiServerAction = eXuiServerAction_Idle; } void MenuController::setAction(int iPad, eXuiAction action, void* param) { diff --git a/targets/app/common/MenuController.h b/targets/app/common/MenuController.h index fbaaa0071..f3fb04008 100644 --- a/targets/app/common/MenuController.h +++ b/targets/app/common/MenuController.h @@ -5,7 +5,6 @@ #include #include "app/common/App_structs.h" -#include "minecraft/XuiActionPayload.h" #include "platform/XboxStubs.h" #include "platform/storage/storage.h" @@ -70,25 +69,8 @@ public: // Action management void setAction(int iPad, eXuiAction action, void* param = nullptr); eXuiAction getXuiAction(int iPad) { return m_eXuiAction[iPad]; } - void setXuiServerAction(int iPad, eXuiServerAction action, - XuiActionPayload param = {}) { - m_eXuiServerAction[iPad] = action; - m_eXuiServerActionParam[iPad] = std::move(param); - } - eXuiServerAction getXuiServerAction(int iPad) { - return m_eXuiServerAction[iPad]; - } - const XuiActionPayload& getXuiServerActionParam(int iPad) { - return m_eXuiServerActionParam[iPad]; - } eXuiAction getGlobalXuiAction() { return m_eGlobalXuiAction; } void setGlobalXuiAction(eXuiAction action) { m_eGlobalXuiAction = action; } - eXuiServerAction getGlobalXuiServerAction() { - return m_eGlobalXuiServerAction; - } - void setGlobalXuiServerAction(eXuiServerAction action) { - m_eGlobalXuiServerAction = action; - } // TMS action void setTMSAction(int iPad, eTMSAction action) { @@ -141,9 +123,6 @@ private: eTMSAction m_eTMSAction[XUSER_MAX_COUNT]; void* m_eXuiActionParam[XUSER_MAX_COUNT]; eXuiAction m_eGlobalXuiAction; - eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT]; - XuiActionPayload m_eXuiServerActionParam[XUSER_MAX_COUNT]; - eXuiServerAction m_eGlobalXuiServerAction; unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index d1f308480..99f39911d 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -35,6 +35,7 @@ #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #include "minecraft/world/entity/Entity.h" @@ -883,13 +884,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { pMinecraft->progressRenderer->progressStage( IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); - while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != - eXuiServerAction_Idle && - !MinecraftServer::serverHalted()) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - } - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + pServer->queueServerAction(minecraft::server::PauseServer{true}); // wait for the server to be in a non-ticking state pServer->m_serverPausedEvent->waitForSignal(C4JThread::kInfiniteTimeout); @@ -1016,8 +1011,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // Start the game again app.SetGameStarted(true); - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); app.SetChangingSessionType(false); app.SetReallyChangingSessionType(false); diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index d3db14610..ae1fa00de 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -6,6 +6,7 @@ #include "app/common/Network/GameNetworkManager.h" #include "app/linux/LinuxGame.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "platform/profile/profile.h" void SaveManager::setAutosaveTimerTime(int settingValue) { @@ -34,8 +35,8 @@ void SaveManager::lock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); } } } @@ -52,8 +53,8 @@ void SaveManager::unlock() { if (g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } } } diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index ad1c9c2f6..bd3f67303 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -9,8 +9,6 @@ #include #include -#include "platform/profile/profile.h" -#include "minecraft/GameEnums.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" @@ -18,7 +16,7 @@ #include "app/common/UI/UIScene.h" #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" @@ -26,6 +24,9 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/profile/profile.h" #include "strings.h" class TexturePack; @@ -211,13 +212,8 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned( int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { bool bAutosave = (bool)lpParameter; - if (bAutosave) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_AutoSaveGame); - } else { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SaveGame); - } + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SaveGame{bAutosave}); // Share AABB & Vec3 pools with default (main thread) - should be ok as long // as we don't tick the main thread whilst this thread is running @@ -229,12 +225,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { app.SetGameStarted(false); - while (app.GetXuiServerAction(PlatformProfile.GetPrimaryPad()) != - eXuiServerAction_Idle && - !MinecraftServer::serverHalted()) { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); - } - if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType()) app.SetGameStarted(true); diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 6ca6d7545..61cb842b3 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -8,7 +8,6 @@ #include "UIEnums.h" #include "minecraft/GameHostOptions.h" -#include "minecraft/XuiActionPayload.h" #include "platform/C4JThread.h" #include "platform/storage/storage.h" @@ -418,11 +417,6 @@ typedef struct _InGamePlayerOptionsInitData { unsigned int playerPrivileges; } InGamePlayerOptionsInitData; -struct DebugSetCameraPosition : minecraft::XuiActionOwnedPayload { - int player; - double m_camX, m_camY, m_camZ, m_yRot, m_elev; -}; - typedef struct _TeleportMenuInitData { int iPad; bool teleportToPlayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index b44a29812..ead8d9ff0 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 "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -13,6 +12,8 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" @@ -52,7 +53,8 @@ UIScene_DebugCreateSchematic::UIScene_DebugCreateSchematic(int iPad, m_buttonCreate.init("Create", eControl_Create); - m_data = new ConsoleSchematicFile::XboxSchematicInitParam(); + m_data = {}; + m_data.compressionType = Compression::eCompressionType_None; } std::string UIScene_DebugCreateSchematic::getMoviePath() { @@ -86,40 +88,36 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_Create: { // We want the start to be even - if (m_data->startX > 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; - else if (m_data->startX < 0 && m_data->startX % 2 != 0) - m_data->startX -= 1; - if (m_data->startY < 0) - m_data->startY = 0; - else if (m_data->startY > 0 && m_data->startY % 2 != 0) - m_data->startY -= 1; - if (m_data->startZ > 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; - else if (m_data->startZ < 0 && m_data->startZ % 2 != 0) - m_data->startZ -= 1; + if (m_data.startX > 0 && m_data.startX % 2 != 0) + m_data.startX -= 1; + else if (m_data.startX < 0 && m_data.startX % 2 != 0) + m_data.startX -= 1; + if (m_data.startY < 0) + m_data.startY = 0; + else if (m_data.startY > 0 && m_data.startY % 2 != 0) + m_data.startY -= 1; + if (m_data.startZ > 0 && m_data.startZ % 2 != 0) + m_data.startZ -= 1; + else if (m_data.startZ < 0 && m_data.startZ % 2 != 0) + m_data.startZ -= 1; // We want the end to be odd to have a total size that is even - if (m_data->endX > 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - else if (m_data->endX < 0 && m_data->endX % 2 == 0) - m_data->endX += 1; - if (m_data->endY > Level::maxBuildHeight) - m_data->endY = Level::maxBuildHeight; - else if (m_data->endY > 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - else if (m_data->endY < 0 && m_data->endY % 2 == 0) - m_data->endY += 1; - if (m_data->endZ > 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; - else if (m_data->endZ < 0 && m_data->endZ % 2 == 0) - m_data->endZ += 1; + if (m_data.endX > 0 && m_data.endX % 2 == 0) + m_data.endX += 1; + else if (m_data.endX < 0 && m_data.endX % 2 == 0) + m_data.endX += 1; + if (m_data.endY > Level::maxBuildHeight) + m_data.endY = Level::maxBuildHeight; + else if (m_data.endY > 0 && m_data.endY % 2 == 0) + m_data.endY += 1; + else if (m_data.endY < 0 && m_data.endY % 2 == 0) + m_data.endY += 1; + if (m_data.endZ > 0 && m_data.endZ % 2 == 0) + m_data.endZ += 1; + else if (m_data.endZ < 0 && m_data.endZ % 2 == 0) + m_data.endZ += 1; - std::unique_ptr payload(m_data); - m_data = nullptr; // ownership transferred to the action - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_ExportSchematic, - std::move(payload)); + MinecraftServer::getInstance()->queueServerAction(m_data); navigateBack(); } break; @@ -145,13 +143,13 @@ void UIScene_DebugCreateSchematic::handleCheckboxToggled(F64 controlId, bool selected) { switch ((int)controlId) { case eControl_SaveMobs: - m_data->bSaveMobs = selected; + m_data.saveMobs = selected; break; case eControl_UseCompression: if (selected) - m_data->compressionType = APPROPRIATE_COMPRESSION_TYPE; + m_data.compressionType = APPROPRIATE_COMPRESSION_TYPE; else - m_data->compressionType = Compression::eCompressionType_RLE; + m_data.compressionType = Compression::eCompressionType_RLE; break; } } @@ -166,9 +164,9 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { case eControl_Name: m_textInputName.setLabel(value); if (!value.empty()) { - snprintf(m_data->name, 64, "%s", value.c_str()); + snprintf(m_data.name, 64, "%s", value.c_str()); } else { - snprintf(m_data->name, 64, "schematic"); + snprintf(m_data.name, 64, "schematic"); } break; case eControl_StartX: @@ -176,7 +174,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startX = iVal; + m_data.startX = iVal; } break; case eControl_StartY: @@ -184,7 +182,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startY = iVal; + m_data.startY = iVal; } break; case eControl_StartZ: @@ -192,7 +190,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->startZ = iVal; + m_data.startZ = iVal; } break; case eControl_EndX: @@ -200,7 +198,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endX = iVal; + m_data.endX = iVal; } break; case eControl_EndY: @@ -208,7 +206,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endY = iVal; + m_data.endY = iVal; } break; case eControl_EndZ: @@ -216,7 +214,7 @@ int UIScene_DebugCreateSchematic::handleKeyboardComplete(bool bRes) { if (iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16)) { - m_data->endZ = iVal; + m_data.endZ = iVal; } break; default: diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h index 8cfeb20da..cf96543d1 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h @@ -2,7 +2,6 @@ #ifdef _DEBUG_MENUS_ENABLED #include -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -10,6 +9,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" +#include "minecraft/server/ServerAction.h" class UILayer; @@ -30,7 +30,9 @@ private: eControls m_keyboardCallbackControl; - ConsoleSchematicFile::XboxSchematicInitParam* m_data; + // Local UI state collected from the form. Sent to the server as an + // ExportSchematic action when the user hits Create. + minecraft::server::ExportSchematic m_data; public: UIScene_DebugCreateSchematic(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index d07d22aac..dcf252c21 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -39,6 +39,7 @@ class UILayer; #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/renderer/GameRenderer.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "util/StringHelpers.h" UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData, @@ -208,9 +209,9 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { case eControl_Mobs: { int id = childId; if (id < m_mobFactories.size()) { - app.SetXuiServerAction( - PlatformProfile.GetPrimaryPad(), eXuiServerAction_SpawnMob, - static_cast(m_mobFactories[id])); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SpawnDebugMob{ + 0, static_cast(m_mobFactories[id])}); } } break; case eControl_Enchantments: { @@ -245,8 +246,8 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { conn->send(ToggleDownfallCommand::preparePacket()); } break; case eControl_Thunder: - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_ToggleThunder); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::ToggleThunder{}); break; case eControl_ResetTutorial: Tutorial::debugResetPlayerSavedProgress( diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 5037a116d..cc301bee4 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 "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -23,6 +22,8 @@ class UILayer; #ifdef _DEBUG_MENUS_ENABLED #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "util/StringHelpers.h" UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, @@ -32,38 +33,38 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void* initData, initialiseMovie(); int playerNo = 0; - currentPosition = new DebugSetCameraPosition(); - currentPosition->player = playerNo; + currentPosition = {}; + currentPosition.player = playerNo; Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft != nullptr) { Vec3 vec = pMinecraft->localplayers[playerNo]->getPos(1.0); - currentPosition->m_camX = vec.x; - currentPosition->m_camY = + currentPosition.m_camX = vec.x; + currentPosition.m_camY = vec.y - 1.62; // pMinecraft->localplayers[playerNo]->getHeadHeight(); - currentPosition->m_camZ = vec.z; + currentPosition.m_camZ = vec.z; - currentPosition->m_yRot = pMinecraft->localplayers[playerNo]->yRot; - currentPosition->m_elev = pMinecraft->localplayers[playerNo]->xRot; + currentPosition.m_yRot = pMinecraft->localplayers[playerNo]->yRot; + currentPosition.m_elev = pMinecraft->localplayers[playerNo]->xRot; } char TempString[256]; - snprintf(TempString, 256, "%f", currentPosition->m_camX); + snprintf(TempString, 256, "%f", currentPosition.m_camX); m_textInputX.init(TempString, eControl_CamX); - snprintf(TempString, 256, "%f", currentPosition->m_camY); + snprintf(TempString, 256, "%f", currentPosition.m_camY); m_textInputY.init(TempString, eControl_CamY); - snprintf(TempString, 256, "%f", currentPosition->m_camZ); + snprintf(TempString, 256, "%f", currentPosition.m_camZ); m_textInputZ.init(TempString, eControl_CamZ); - snprintf(TempString, 256, "%f", currentPosition->m_yRot); + snprintf(TempString, 256, "%f", currentPosition.m_yRot); m_textInputYRot.init(TempString, eControl_YRot); - snprintf(TempString, 256, "%f", currentPosition->m_elev); + snprintf(TempString, 256, "%f", currentPosition.m_elev); m_textInputElevation.init(TempString, eControl_Elevation); m_checkboxLockPlayer.init("Lock Player", eControl_LockPlayer, @@ -106,12 +107,11 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { switch ((int)controlId) { case eControl_Teleport: { - std::unique_ptr payload( - currentPosition); - currentPosition = nullptr; // ownership transferred - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_SetCameraLocation, - std::move(payload)); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::SetCameraLocation{ + currentPosition.player, currentPosition.m_camX, + currentPosition.m_camY, currentPosition.m_camZ, + currentPosition.m_yRot, currentPosition.m_elev}); } break; case eControl_CamX: case eControl_CamY: @@ -147,23 +147,23 @@ int UIScene_DebugSetCamera::handleKeyboardComplete(bool bRes) { switch (m_keyboardCallbackControl) { case eControl_CamX: m_textInputX.setLabel(value); - currentPosition->m_camX = val; + currentPosition.m_camX = val; break; case eControl_CamY: m_textInputY.setLabel(value); - currentPosition->m_camY = val; + currentPosition.m_camY = val; break; case eControl_CamZ: m_textInputZ.setLabel(value); - currentPosition->m_camZ = val; + currentPosition.m_camZ = val; break; case eControl_YRot: m_textInputYRot.setLabel(value); - currentPosition->m_yRot = val; + currentPosition.m_yRot = val; break; case eControl_Elevation: m_textInputElevation.setLabel(value); - currentPosition->m_elev = val; + currentPosition.m_elev = val; break; default: break; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h index 061f00481..aaf5ffd84 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h @@ -3,7 +3,6 @@ #include #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -30,7 +29,18 @@ private: bool freeze; } FreezePlayerParam; - DebugSetCameraPosition* currentPosition; + // Local UI state collected from the form. Sent to the server as a + // SetCameraLocation action when the user hits Teleport. + struct CameraFormState { + int player = 0; + double m_camX = 0.0; + double m_camY = 0.0; + double m_camZ = 0.0; + double m_yRot = 0.0; + double m_elev = 0.0; + }; + + CameraFormState currentPosition; FreezePlayerParam* fpp; eControls m_keyboardCallbackControl; 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 fdf4dba56..59f633013 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 @@ -21,6 +21,8 @@ #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/sounds/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.h" @@ -64,8 +66,8 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, // IsLocalGame() issues on Iggy if (/*g_NetworkManager.IsLocalGame() &&*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); } Minecraft* pMinecraft = Minecraft::GetInstance(); @@ -194,8 +196,8 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, if (iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } ui.PlayUISFX(eSFX_Back); @@ -262,8 +264,8 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { if (m_iPad == PlatformProfile.GetPrimaryPad() && /*g_NetworkManager.IsLocalGame()*/ g_NetworkManager .GetPlayerCount() == 1) { - app.SetXuiServerAction(PlatformProfile.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } navigateBack(); break; diff --git a/targets/minecraft/GameEnums.h b/targets/minecraft/GameEnums.h index 27499d143..f429e10d2 100644 --- a/targets/minecraft/GameEnums.h +++ b/targets/minecraft/GameEnums.h @@ -100,25 +100,6 @@ enum eTMSAction { eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly, }; -// The server runs on its own thread, so we need to call its actions there -// rather than where all other Xui actions are performed In general these are -// debugging options -enum eXuiServerAction { - eXuiServerAction_Idle = 0, - eXuiServerAction_DropItem, // Debug - eXuiServerAction_SaveGame, - eXuiServerAction_AutoSaveGame, - eXuiServerAction_SpawnMob, // Debug - eXuiServerAction_PauseServer, - eXuiServerAction_ToggleRain, // Debug - eXuiServerAction_ToggleThunder, // Debug - eXuiServerAction_ServerSettingChanged_Gamertags, - eXuiServerAction_ServerSettingChanged_Difficulty, - eXuiServerAction_ExportSchematic, // Debug - eXuiServerAction_ServerSettingChanged_BedrockFog, - eXuiServerAction_SetCameraLocation, // Debug -}; - enum eGameSetting { eGameSetting_MusicVolume = 0, eGameSetting_SoundFXVolume, diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index 47a23f155..a4453d2b5 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -16,7 +16,6 @@ class DLCPack; #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "minecraft/XuiActionPayload.h" #include "minecraft/client/IMenuService.h" #include "minecraft/client/model/SkinBox.h" #include "minecraft/network/packet/DisconnectPacket.h" @@ -112,12 +111,7 @@ public: virtual void setAction(int iPad, eXuiAction action, void* param = nullptr) = 0; - virtual void setXuiServerAction(int iPad, eXuiServerAction action, - XuiActionPayload param = {}) = 0; [[nodiscard]] virtual eXuiAction getXuiAction(int iPad) = 0; - [[nodiscard]] virtual eXuiServerAction getXuiServerAction(int iPad) = 0; - [[nodiscard]] virtual const XuiActionPayload& getXuiServerActionParam( - int iPad) = 0; virtual void setGlobalXuiAction(eXuiAction action) = 0; virtual void handleButtonPresses() = 0; virtual void setTMSAction(int iPad, eTMSAction action) = 0; diff --git a/targets/minecraft/XuiActionPayload.h b/targets/minecraft/XuiActionPayload.h deleted file mode 100644 index aeb49dadc..000000000 --- a/targets/minecraft/XuiActionPayload.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include -#include - -// Type-safe payload carried by IGameServices::setAction / -// setXuiServerAction. Replaces the old `void* param` which mixed -// integers, booleans, and heap-allocated pointers without ownership -// tracking. Concrete heap-allocated payload types (e.g. -// _DebugSetCameraPosition, _XboxSchematicInitParam) inherit from -// XuiActionOwnedPayload so they can be destroyed polymorphically through -// the unique_ptr alternative inside the variant. - -namespace minecraft { - -struct XuiActionOwnedPayload { - virtual ~XuiActionOwnedPayload() = default; -}; - -} // namespace minecraft - -using XuiActionPayload = - std::variant>; diff --git a/targets/minecraft/client/gui/PauseScreen.cpp b/targets/minecraft/client/gui/PauseScreen.cpp index d97aef333..de6095493 100644 --- a/targets/minecraft/client/gui/PauseScreen.cpp +++ b/targets/minecraft/client/gui/PauseScreen.cpp @@ -18,6 +18,7 @@ #include "minecraft/locale/I18n.h" #include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "platform/input/input.h" PauseScreen::PauseScreen() { @@ -31,8 +32,8 @@ void PauseScreen::init() { int yo = -16; // 4jcraft: solves the issue of client-side only pausing in the java gui if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, true); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{true}); buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, I18n::get("menu.returnToMenu"))); if (!NetworkService.IsHost()) { @@ -90,8 +91,8 @@ void PauseScreen::buttonClicked(Button* button) { exitWorld(minecraft, true); } if (button->id == 4) { - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{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 adfa8080c..86e51b9f1 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -10,6 +10,8 @@ #include "minecraft/client/gui/particle/GuiParticles.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/network/INetworkService.h" +#include "minecraft/server/MinecraftServer.h" +#include "minecraft/server/ServerAction.h" #include "minecraft/sounds/SoundTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" @@ -42,9 +44,8 @@ void Screen::keyPressed(char eventCharacter, int eventKey) { // unpausing is done in all scenarios if (NetworkService.IsLocalGame() && NetworkService.GetPlayerCount() == 1) - gameServices().setXuiServerAction(PlatformInput.GetPrimaryPad(), - eXuiServerAction_PauseServer, - false); + MinecraftServer::getInstance()->queueServerAction( + minecraft::server::PauseServer{false}); } } diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 3092f8a9f..c286eee64 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -67,7 +67,6 @@ #endif #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "app/common/Network/Socket.h" -#include "app/common/UI/All Platforms/UIStructs.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" @@ -1183,218 +1182,9 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { } } - // Process delayed actions - eXuiServerAction eAction; - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - eAction = gameServices().getXuiServerAction(i); - const XuiActionPayload& param = - gameServices().getXuiServerActionParam(i); - - switch (eAction) { - case eXuiServerAction_AutoSaveGame: - case eXuiServerAction_SaveGame: - gameServices().lockSaveNotification(); - if (players != nullptr) { - players->saveAll( - Minecraft::GetInstance()->progressRenderer); - } - - players->broadcastAll( - std::shared_ptr( - new UpdateProgressPacket(20))); - - for (unsigned int j = 0; j < levels.size(); j++) { - if (s_bServerHalted) break; - // 4J Stu - Save the levels in reverse order so we - // don't overwrite the level.dat with the data from - // the nethers leveldata. Fix for #7418 - - // Functional: Gameplay: Saving after sleeping in a - // bed will place player at nighttime when - // restarting. - ServerLevel* level = levels[levels.size() - 1 - j]; - level->save( - true, - Minecraft::GetInstance()->progressRenderer, - (eAction == eXuiServerAction_AutoSaveGame)); - - players->broadcastAll( - std::shared_ptr( - new UpdateProgressPacket(33 + (j * 33)))); - } - if (!s_bServerHalted) { - saveGameRules(); - - levels[0]->saveToDisc( - Minecraft::GetInstance()->progressRenderer, - (eAction == eXuiServerAction_AutoSaveGame)); - } - gameServices().unlockSaveNotification(); - break; - case eXuiServerAction_DropItem: - // Find the player, and drop the id at their feet - if (auto* id = std::get_if(¶m)) { - std::shared_ptr player = - players->players.at(0); - player->drop(std::shared_ptr( - new ItemInstance(static_cast(*id), 1, 0))); - } - break; - case eXuiServerAction_SpawnMob: { - auto* id = std::get_if(¶m); - if (!id) break; - std::shared_ptr player = - players->players.at(0); - eINSTANCEOF factory = static_cast(*id); - std::shared_ptr mob = - std::dynamic_pointer_cast( - EntityIO::newByEnumType(factory, - player->level)); - mob->moveTo(player->x + 1, player->y, player->z + 1, - player->level->random->nextFloat() * 360, - 0); - mob->setDespawnProtected(); // 4J added, default to - // being protected against - // despawning (has to be - // done after initial - // position is set) - player->level->addEntity(mob); - } break; - case eXuiServerAction_PauseServer: - if (auto* val = std::get_if(¶m)) { - m_isServerPaused = *val; - if (m_isServerPaused) { - m_serverPausedEvent->set(); - } - } - break; - case eXuiServerAction_ToggleRain: { - bool isRaining = levels[0]->getLevelData()->isRaining(); - levels[0]->getLevelData()->setRaining(!isRaining); - levels[0]->getLevelData()->setRainTime( - levels[0]->random->nextInt(Level::TICKS_PER_DAY * - 7) + - Level::TICKS_PER_DAY / 2); - } break; - case eXuiServerAction_ToggleThunder: { - bool isThundering = - levels[0]->getLevelData()->isThundering(); - levels[0]->getLevelData()->setThundering(!isThundering); - levels[0]->getLevelData()->setThunderTime( - levels[0]->random->nextInt(Level::TICKS_PER_DAY * - 7) + - Level::TICKS_PER_DAY / 2); - } break; - case eXuiServerAction_ServerSettingChanged_Gamertags: - players->broadcastAll( - std::shared_ptr( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket::HOST_OPTIONS, - gameServices().getGameHostOption( - eGameHostOption_Gamertags)))); - break; - case eXuiServerAction_ServerSettingChanged_BedrockFog: - players->broadcastAll( - std::shared_ptr( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket:: - HOST_IN_GAME_SETTINGS, - gameServices().getGameHostOption( - eGameHostOption_All)))); - break; - - case eXuiServerAction_ServerSettingChanged_Difficulty: - players->broadcastAll(std::shared_ptr< - ServerSettingsChangedPacket>( - new ServerSettingsChangedPacket( - ServerSettingsChangedPacket::HOST_DIFFICULTY, - Minecraft::GetInstance() - ->options->difficulty))); - break; - case eXuiServerAction_ExportSchematic: -#if !defined(_CONTENT_PACKAGE) - gameServices().lockSaveNotification(); - - // players->broadcastAll( - // shared_ptr( new - // UpdateProgressPacket(20) ) ); - - if (!s_bServerHalted) { - auto* owned = std::get_if>(¶m); - ConsoleSchematicFile::XboxSchematicInitParam* - initData = - owned ? dynamic_cast< - ConsoleSchematicFile:: - XboxSchematicInitParam*>( - owned->get()) - : nullptr; - if (initData) { - File targetFileDir("Schematics"); - if (!targetFileDir.exists()) - targetFileDir.mkdir(); - - char filename[128]; - snprintf( - filename, 128, "%s%dx%dx%d.sch", - initData->name, - (initData->endX - initData->startX + 1), - (initData->endY - initData->startY + 1), - (initData->endZ - initData->startZ + 1)); - - File dataFile = - File(targetFileDir, std::string(filename)); - if (dataFile.exists()) dataFile._delete(); - FileOutputStream fos = - FileOutputStream(dataFile); - DataOutputStream dos = DataOutputStream(&fos); - ConsoleSchematicFile::generateSchematicFile( - &dos, levels[0], initData->startX, - initData->startY, initData->startZ, - initData->endX, initData->endY, - initData->endZ, initData->bSaveMobs, - initData->compressionType); - dos.close(); - // owned unique_ptr is destroyed when the - // payload is overwritten on the next - // setXuiServerAction - } - } - gameServices().unlockSaveNotification(); -#endif - break; - case eXuiServerAction_SetCameraLocation: -#if !defined(_CONTENT_PACKAGE) - { - auto* owned = std::get_if< - std::unique_ptr>( - ¶m); - DebugSetCameraPosition* pos = - owned ? dynamic_cast( - owned->get()) - : nullptr; - if (pos) { - Log::info("DEBUG: Player=%i\n", pos->player); - Log::info( - "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), " - "looking at=(%f.2,%f.2)\n", - pos->m_camX, pos->m_camY, pos->m_camZ, - pos->m_yRot, pos->m_elev); - - std::shared_ptr player = - players->players.at(pos->player); - player->debug_setPosition(pos->m_camX, pos->m_camY, - pos->m_camZ, pos->m_yRot, - pos->m_elev); - } - } -#endif - break; - default: - break; - } - - gameServices().setXuiServerAction(i, eXuiServerAction_Idle); - } + // Drain typed action queue (queued by app/server consumers + // via MinecraftServer::queueServerAction). + drainServerActions(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } @@ -1746,3 +1536,173 @@ bool MinecraftServer::flagEntitiesToBeRemoved(unsigned int* flags) { } return removedFound; } + +void MinecraftServer::queueServerAction( + minecraft::server::ServerAction action) { + std::lock_guard lock(m_actionQueueMutex); + m_actionQueue.push_back(std::move(action)); +} + +void MinecraftServer::drainServerActions() { + std::vector queue; + { + std::lock_guard lock(m_actionQueueMutex); + if (m_actionQueue.empty()) return; + queue.swap(m_actionQueue); + } + for (auto& action : queue) { + std::visit([this](auto& a) { handleServerAction(a); }, action); + } +} + +void MinecraftServer::handleServerAction(const minecraft::server::SaveGame& a) { + gameServices().lockSaveNotification(); + if (players != nullptr) { + players->saveAll(Minecraft::GetInstance()->progressRenderer); + } + + players->broadcastAll( + std::shared_ptr(new UpdateProgressPacket(20))); + + for (unsigned int j = 0; j < levels.size(); j++) { + if (s_bServerHalted) break; + // 4J Stu - Save the levels in reverse order so we don't overwrite + // the level.dat with the data from the nethers leveldata. Fix for + // #7418 - Functional: Gameplay: Saving after sleeping in a bed will + // place player at nighttime when restarting. + ServerLevel* level = levels[levels.size() - 1 - j]; + level->save(true, Minecraft::GetInstance()->progressRenderer, + a.autoSave); + + players->broadcastAll(std::shared_ptr( + new UpdateProgressPacket(33 + (j * 33)))); + } + if (!s_bServerHalted) { + saveGameRules(); + levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, + a.autoSave); + } + gameServices().unlockSaveNotification(); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::DropDebugItem& a) { + if (players == nullptr || players->players.empty()) return; + std::shared_ptr player = players->players.at(a.playerIndex); + player->drop( + std::shared_ptr(new ItemInstance(a.itemId, 1, 0))); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::SpawnDebugMob& a) { + if (players == nullptr || players->players.empty()) return; + std::shared_ptr player = players->players.at(a.playerIndex); + auto factory = static_cast(a.mobFactoryId); + std::shared_ptr mob = std::dynamic_pointer_cast( + EntityIO::newByEnumType(factory, player->level)); + if (mob == nullptr) return; + mob->moveTo(player->x + 1, player->y, player->z + 1, + player->level->random->nextFloat() * 360, 0); + mob->setDespawnProtected(); // 4J added, default to being protected against + // despawning (has to be done after initial + // position is set) + player->level->addEntity(mob); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::PauseServer& a) { + m_isServerPaused = a.paused; + if (m_isServerPaused) { + m_serverPausedEvent->set(); + } +} + +void MinecraftServer::handleServerAction(const minecraft::server::ToggleRain&) { + bool isRaining = levels[0]->getLevelData()->isRaining(); + levels[0]->getLevelData()->setRaining(!isRaining); + levels[0]->getLevelData()->setRainTime( + levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + + Level::TICKS_PER_DAY / 2); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::ToggleThunder&) { + bool isThundering = levels[0]->getLevelData()->isThundering(); + levels[0]->getLevelData()->setThundering(!isThundering); + levels[0]->getLevelData()->setThunderTime( + levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + + Level::TICKS_PER_DAY / 2); +} + +void MinecraftServer::handleServerAction( + const minecraft::server::BroadcastSettingChanged& a) { + using Kind = minecraft::server::BroadcastSettingChanged::Kind; + switch (a.kind) { + case Kind::Gamertags: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_OPTIONS, + gameServices().getGameHostOption( + eGameHostOption_Gamertags)))); + break; + case Kind::BedrockFog: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, + gameServices().getGameHostOption(eGameHostOption_All)))); + break; + case Kind::Difficulty: + players->broadcastAll(std::shared_ptr( + new ServerSettingsChangedPacket( + ServerSettingsChangedPacket::HOST_DIFFICULTY, + Minecraft::GetInstance()->options->difficulty))); + break; + } +} + +void MinecraftServer::handleServerAction( + const minecraft::server::ExportSchematic& a) { +#if !defined(_CONTENT_PACKAGE) + gameServices().lockSaveNotification(); + if (!s_bServerHalted) { + File targetFileDir("Schematics"); + if (!targetFileDir.exists()) targetFileDir.mkdir(); + + char filename[128]; + snprintf(filename, 128, "%s%dx%dx%d.sch", a.name, + (a.endX - a.startX + 1), (a.endY - a.startY + 1), + (a.endZ - a.startZ + 1)); + + File dataFile = File(targetFileDir, std::string(filename)); + if (dataFile.exists()) dataFile._delete(); + FileOutputStream fos = FileOutputStream(dataFile); + DataOutputStream dos = DataOutputStream(&fos); + ConsoleSchematicFile::generateSchematicFile( + &dos, levels[0], a.startX, a.startY, a.startZ, a.endX, a.endY, + a.endZ, a.saveMobs, a.compressionType); + dos.close(); + } + gameServices().unlockSaveNotification(); +#else + (void)a; +#endif +} + +void MinecraftServer::handleServerAction( + const minecraft::server::SetCameraLocation& a) { +#if !defined(_CONTENT_PACKAGE) + Log::info("DEBUG: Player=%i\n", a.playerIndex); + Log::info( + "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking " + "at=(%f.2,%f.2)\n", + a.x, a.y, a.z, a.yRot, a.elev); + + if (players == nullptr || + a.playerIndex >= static_cast(players->players.size())) + return; + std::shared_ptr player = players->players.at(a.playerIndex); + player->debug_setPosition(a.x, a.y, a.z, a.yRot, a.elev); +#else + (void)a; +#endif +} diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index f7c9a746c..e88f0d5f3 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -7,6 +7,7 @@ #include #include "ConsoleInputSource.h" +#include "ServerAction.h" #include "minecraft/SharedConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" @@ -300,6 +301,25 @@ private: bool IsServerPaused() { return m_isServerPaused; } private: + // Drain the action queue and dispatch each one. Called from the + // server tick loop. The drain takes the mutex briefly to swap the + // queue out, then dispatches without holding the lock. + void drainServerActions(); + + void handleServerAction(const minecraft::server::SaveGame& a); + void handleServerAction(const minecraft::server::DropDebugItem& a); + void handleServerAction(const minecraft::server::SpawnDebugMob& a); + void handleServerAction(const minecraft::server::PauseServer& a); + void handleServerAction(const minecraft::server::ToggleRain& a); + void handleServerAction(const minecraft::server::ToggleThunder& a); + void handleServerAction( + const minecraft::server::BroadcastSettingChanged& a); + void handleServerAction(const minecraft::server::ExportSchematic& a); + void handleServerAction(const minecraft::server::SetCameraLocation& a); + + std::mutex m_actionQueueMutex; + std::vector m_actionQueue; + // 4J Added bool m_saveOnExit; bool m_suspending; @@ -314,6 +334,11 @@ public: void chunkPacketManagement_PreTick(); void chunkPacketManagement_PostTick(); + // Queue a typed action for the server to handle on its next tick. + // Safe to call from any thread; the queue is mutex-protected and + // drained from the server tick loop. + void queueServerAction(minecraft::server::ServerAction action); + void setSaveOnExit(bool save) { m_saveOnExit = save; s_bSaveOnExitAnswered = true; diff --git a/targets/minecraft/server/ServerAction.h b/targets/minecraft/server/ServerAction.h new file mode 100644 index 000000000..a1501a27a --- /dev/null +++ b/targets/minecraft/server/ServerAction.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include + +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" + +// Typed actions queued onto MinecraftServer from outside the server +// thread (UI, network, save manager). Each variant alternative is a +// plain data struct describing the requested operation; the server +// drains the queue in its tick loop and dispatches via std::visit. +// +// This replaces the old eXuiServerAction enum + per-pad polling + +// XuiActionPayload variant. The previous design forced the server to +// poll IGameServices every tick and pull a UI-shaped payload through a +// polymorphic base; now the server owns its own queue and the action +// types live alongside the consumer. + +namespace minecraft::server { + +struct SaveGame { + bool autoSave = false; +}; + +struct DropDebugItem { + int playerIndex = 0; + int itemId = 0; +}; + +struct SpawnDebugMob { + int playerIndex = 0; + int mobFactoryId = 0; +}; + +struct PauseServer { + bool paused = false; +}; + +struct ToggleRain {}; +struct ToggleThunder {}; + +struct BroadcastSettingChanged { + enum class Kind { + Gamertags, + BedrockFog, + Difficulty, + }; + Kind kind = Kind::Gamertags; +}; + +struct ExportSchematic { + char name[64] = {}; + int startX = 0; + int startY = 0; + int startZ = 0; + int endX = 0; + int endY = 0; + int endZ = 0; + bool saveMobs = false; + Compression::ECompressionTypes compressionType = + Compression::eCompressionType_None; +}; + +struct SetCameraLocation { + int playerIndex = 0; + double x = 0.0; + double y = 0.0; + double z = 0.0; + double yRot = 0.0; + double elev = 0.0; +}; + +using ServerAction = + std::variant; + +} // namespace minecraft::server From 5d86773134b76074a119ca278cb58a7f5ac4e21e Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:42:23 +1000 Subject: [PATCH 036/104] refactor: relocate IPlatformNetwork/Leaderboard/Game interfaces to platform/ --- targets/app/common/Game.h | 2 +- .../common/Leaderboards/LeaderboardManager.h | 2 +- .../app/common/Network/GameNetworkManager.h | 2 +- .../Network/PlatformNetworkManagerInterface.h | 139 ------------------ .../Network/PlatformNetworkManagerStub.h | 2 +- targets/platform/fs/meson.build | 13 +- .../common => platform/game}/IPlatformGame.h | 0 targets/platform/game/game.h | 11 ++ targets/platform/game/meson.build | 1 + .../platform/game/stub/StubPlatformGame.cpp | 10 ++ targets/platform/game/stub/StubPlatformGame.h | 42 ++++++ targets/platform/input/meson.build | 14 +- .../leaderboard}/IPlatformLeaderboard.h | 2 +- targets/platform/leaderboard/leaderboard.h | 13 ++ targets/platform/leaderboard/meson.build | 1 + .../leaderboard/stub/StubLeaderboard.cpp | 10 ++ .../leaderboard/stub/StubLeaderboard.h | 45 ++++++ targets/platform/meson.build | 47 +++++- .../network}/IPlatformNetwork.h | 2 +- targets/platform/network/meson.build | 1 + targets/platform/network/network.h | 13 ++ .../network/stub/StubPlatformNetwork.cpp | 10 ++ .../network/stub/StubPlatformNetwork.h | 129 ++++++++++++++++ targets/platform/profile/meson.build | 13 +- targets/platform/renderer/meson.build | 14 +- targets/platform/sound/meson.build | 16 +- targets/platform/storage/meson.build | 13 +- 27 files changed, 342 insertions(+), 225 deletions(-) delete mode 100644 targets/app/common/Network/PlatformNetworkManagerInterface.h rename targets/{app/common => platform/game}/IPlatformGame.h (100%) create mode 100644 targets/platform/game/game.h create mode 100644 targets/platform/game/meson.build create mode 100644 targets/platform/game/stub/StubPlatformGame.cpp create mode 100644 targets/platform/game/stub/StubPlatformGame.h rename targets/{app/common/Leaderboards => platform/leaderboard}/IPlatformLeaderboard.h (99%) create mode 100644 targets/platform/leaderboard/leaderboard.h create mode 100644 targets/platform/leaderboard/meson.build create mode 100644 targets/platform/leaderboard/stub/StubLeaderboard.cpp create mode 100644 targets/platform/leaderboard/stub/StubLeaderboard.h rename targets/{app/common/Network => platform/network}/IPlatformNetwork.h (99%) create mode 100644 targets/platform/network/meson.build create mode 100644 targets/platform/network/network.h create mode 100644 targets/platform/network/stub/StubPlatformNetwork.cpp create mode 100644 targets/platform/network/stub/StubPlatformNetwork.h diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 49e25afe2..b320fd0be 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -18,7 +18,7 @@ #include "app/common/DebugOptions.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameSettingsManager.h" -#include "app/common/IPlatformGame.h" +#include "platform/game/IPlatformGame.h" #include "app/common/LocalizationManager.h" #include "app/common/MenuController.h" #include "app/common/NetworkController.h" diff --git a/targets/app/common/Leaderboards/LeaderboardManager.h b/targets/app/common/Leaderboards/LeaderboardManager.h index 183b7234d..9980392c4 100644 --- a/targets/app/common/Leaderboards/LeaderboardManager.h +++ b/targets/app/common/Leaderboards/LeaderboardManager.h @@ -2,7 +2,7 @@ #include -#include "app/common/Leaderboards/IPlatformLeaderboard.h" +#include "platform/leaderboard/IPlatformLeaderboard.h" class LeaderboardManager : public IPlatformLeaderboard { public: diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 2af904c4b..5c1119e79 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -8,7 +8,7 @@ #include #endif #include "PlatformNetworkManagerStub.h" -#include "app/common/Network/IPlatformNetwork.h" +#include "platform/network/IPlatformNetwork.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerInterface.h b/targets/app/common/Network/PlatformNetworkManagerInterface.h deleted file mode 100644 index bde23aac2..000000000 --- a/targets/app/common/Network/PlatformNetworkManagerInterface.h +++ /dev/null @@ -1,139 +0,0 @@ -#pragma once -// using namespace std; -#include -#include -#if !defined(__linux__) -#include -#endif -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "minecraft/network/platform/SessionInfo.h" -#include "platform/C4JThread.h" -#include "platform/NetTypes.h" - -class ClientConnection; -class Minecraft; -class CGameNetworkManager; - -// This is the interface to be implemented by the platform-specific versions of -// the PlatformNetworkManagers. This API is used directly by GameNetworkManager -// so that it can remain as platform independent as possible. - -// This value should be incremented if the server version changes, or the game -// session data changes -#define MINECRAFT_NET_VERSION VER_NETWORK - -typedef struct _SearchForGamesData { - unsigned int sessionIDCount; - XSESSION_SEARCHRESULT_HEADER* searchBuffer; - XNQOS** ppQos; - SessionID* sessionIDList; - XOVERLAPPED* pOverlapped; -} SearchForGamesData; - -class IPlatformNetwork { - friend class CGameNetworkManager; - -public: - typedef enum { - JOIN_FAILED_SERVER_FULL, - JOIN_FAILED_INSUFFICIENT_PRIVILEGES, - JOIN_FAILED_NONSPECIFIC, - } eJoinFailedReason; - - virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, - int flagIndexSize) = 0; - virtual void Terminate() = 0; - virtual int GetJoiningReadyPercentage() = 0; - virtual int CorrectErrorIDS(int IDS) = 0; - - virtual void DoWork() = 0; - virtual int GetPlayerCount() = 0; - virtual int GetOnlinePlayerCount() = 0; - virtual int GetLocalPlayerMask(int playerIndex) = 0; - virtual bool AddLocalPlayerByUserIndex(int userIndex) = 0; - virtual bool RemoveLocalPlayerByUserIndex(int userIndex) = 0; - virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex) = 0; - virtual INetworkPlayer* GetPlayerByIndex(int playerIndex) = 0; - virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid) = 0; - virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId) = 0; - virtual bool ShouldMessageForFullSession() = 0; - - virtual INetworkPlayer* GetHostPlayer() = 0; - virtual bool IsHost() = 0; - virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, - const INVITE_INFO* pInviteInfo) = 0; - virtual bool LeaveGame(bool bMigrateHost) = 0; - - virtual bool IsInSession() = 0; - virtual bool IsInGameplay() = 0; - virtual bool IsReadyToPlayOrIdle() = 0; - virtual bool IsInStatsEnabledSession() = 0; - virtual bool SessionHasSpace(unsigned int spaceRequired = 1) = 0; - virtual void SendInviteGUI(int quadrant) = 0; - virtual bool IsAddingPlayer() = 0; - - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, - unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0) = 0; - virtual int JoinGame(FriendSessionInfo* searchResult, int dwLocalUsersMask, - int dwPrimaryUserIndex) = 0; - virtual void CancelJoinGame() {}; - virtual bool SetLocalGame(bool isLocal) = 0; - virtual bool IsLocalGame() = 0; - virtual void SetPrivateGame(bool isPrivate) = 0; - virtual bool IsPrivateGame() = 0; - virtual bool IsLeavingGame() = 0; - virtual void ResetLeavingGame() = 0; - - virtual void RegisterPlayerChangedCallback( - int iPad, std::function - callback) = 0; - virtual void UnRegisterPlayerChangedCallback(int iPad) = 0; - - virtual void HandleSignInChange() = 0; - - virtual bool _RunNetworkGame() = 0; - -private: - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom) = 0; - virtual void _HostGame( - int usersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0) = 0; - virtual bool _StartGame() = 0; - -public: - virtual void UpdateAndSetGameSessionData( - INetworkPlayer* pNetworkPlayerLeaving = nullptr) = 0; - -private: - virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) = 0; - -public: - virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index) = 0; - virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index) = 0; - - virtual std::string GatherStats() = 0; - virtual std::string GatherRTTStats() = 0; - -private: - virtual void SetSessionTexturePackParentId(int id) = 0; - virtual void SetSessionSubTexturePackId(int id) = 0; - virtual void Notify(int ID, uintptr_t Param) = 0; - -public: - virtual std::vector* GetSessionList(int iPad, - int localPlayers, - bool partyOnly) = 0; - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, - FriendSessionInfo* foundSession) = 0; - virtual void SetSessionsUpdatedCallback(std::function callback) = 0; - virtual void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback) = 0; - virtual void ForceFriendsSessionRefresh() = 0; - - virtual void FakeLocalPlayerJoined() { - }; // Temporary method whilst we don't have real networking to make this - // happen -}; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h index af9c3827b..f1ee2bd3c 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ b/targets/app/common/Network/PlatformNetworkManagerStub.h @@ -4,7 +4,7 @@ #include #include -#include "app/common/Network/IPlatformNetwork.h" +#include "platform/network/IPlatformNetwork.h" #include "minecraft/client/model/SkinBox.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/network/platform/SessionInfo.h" diff --git a/targets/platform/fs/meson.build b/targets/platform/fs/meson.build index bb91f51fb..52f1ce610 100644 --- a/targets/platform/fs/meson.build +++ b/targets/platform/fs/meson.build @@ -1,12 +1 @@ -lib_platform_fs_std = static_library( - 'platform_fs_std', - files('std/StdFilesystem.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -fs_dep = declare_dependency( - link_with: lib_platform_fs_std, - include_directories: [platform_inc], -) +platform_fs_sources = files('std/StdFilesystem.cpp') diff --git a/targets/app/common/IPlatformGame.h b/targets/platform/game/IPlatformGame.h similarity index 100% rename from targets/app/common/IPlatformGame.h rename to targets/platform/game/IPlatformGame.h diff --git a/targets/platform/game/game.h b/targets/platform/game/game.h new file mode 100644 index 000000000..0be9983d6 --- /dev/null +++ b/targets/platform/game/game.h @@ -0,0 +1,11 @@ +#pragma once + +#include "IPlatformGame.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h. +namespace platform_internal { +IPlatformGame& PlatformGame_get(); +} + +#define PlatformGame (::platform_internal::PlatformGame_get()) diff --git a/targets/platform/game/meson.build b/targets/platform/game/meson.build new file mode 100644 index 000000000..9b1af37f2 --- /dev/null +++ b/targets/platform/game/meson.build @@ -0,0 +1 @@ +platform_game_sources = files('stub/StubPlatformGame.cpp') diff --git a/targets/platform/game/stub/StubPlatformGame.cpp b/targets/platform/game/stub/StubPlatformGame.cpp new file mode 100644 index 000000000..608a71d62 --- /dev/null +++ b/targets/platform/game/stub/StubPlatformGame.cpp @@ -0,0 +1,10 @@ +#include "StubPlatformGame.h" + +#include "platform/game/game.h" + +namespace platform_internal { +IPlatformGame& PlatformGame_get() { + static StubPlatformGame instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/game/stub/StubPlatformGame.h b/targets/platform/game/stub/StubPlatformGame.h new file mode 100644 index 000000000..5aabbc682 --- /dev/null +++ b/targets/platform/game/stub/StubPlatformGame.h @@ -0,0 +1,42 @@ +#pragma once + +#include "platform/game/IPlatformGame.h" + +// True no-op platform game-services backend. Same role as +// LinuxGame's overrides today: every method is a no-op so the platform +// abstraction is satisfied without any host integration. The composition +// root can substitute a real backend (Xbox Live, Steam, GOG, etc.) at +// link time. + +class StubPlatformGame : public IPlatformGame { +public: + void SetRichPresenceContext(int /*iPad*/, int /*contextId*/) override {} + + void CaptureSaveThumbnail() override {} + void GetSaveThumbnail(std::uint8_t** thumbnailData, + unsigned int* thumbnailSize) override { + if (thumbnailData) *thumbnailData = nullptr; + if (thumbnailSize) *thumbnailSize = 0; + } + void ReleaseSaveThumbnail() override {} + void GetScreenshot(int /*iPad*/, std::uint8_t** screenshotData, + unsigned int* screenshotSize) override { + if (screenshotData) *screenshotData = nullptr; + if (screenshotSize) *screenshotSize = 0; + } + + void ReadBannedList(int /*iPad*/, eTMSAction /*action*/, + bool /*bCallback*/) override {} + + int LoadLocalTMSFile(char* /*wchTMSFile*/) override { return -1; } + int LoadLocalTMSFile(char* /*wchTMSFile*/, + eFileExtensionType /*eExt*/) override { + return -1; + } + void FreeLocalTMSFiles(eTMSFileType /*eType*/) override {} + int GetLocalTMSFileIndex(char* /*wchTMSFile*/, + bool /*bFilenameIncludesExtension*/, + eFileExtensionType /*eEXT*/) override { + return -1; + } +}; diff --git a/targets/platform/input/meson.build b/targets/platform/input/meson.build index 3ae17a68e..f5d38f748 100644 --- a/targets/platform/input/meson.build +++ b/targets/platform/input/meson.build @@ -1,13 +1 @@ -lib_platform_input_sdl2 = static_library( - 'platform_input_sdl2', - files('sdl2/SDL2Input.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_sdl2, _threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -input_dep = declare_dependency( - link_with: lib_platform_input_sdl2, - include_directories: [platform_inc], - dependencies: [_sdl2], -) +platform_input_sources = files('sdl2/SDL2Input.cpp') diff --git a/targets/app/common/Leaderboards/IPlatformLeaderboard.h b/targets/platform/leaderboard/IPlatformLeaderboard.h similarity index 99% rename from targets/app/common/Leaderboards/IPlatformLeaderboard.h rename to targets/platform/leaderboard/IPlatformLeaderboard.h index cc800f317..3d2137ae4 100644 --- a/targets/app/common/Leaderboards/IPlatformLeaderboard.h +++ b/targets/platform/leaderboard/IPlatformLeaderboard.h @@ -3,7 +3,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class LeaderboardReadListener; diff --git a/targets/platform/leaderboard/leaderboard.h b/targets/platform/leaderboard/leaderboard.h new file mode 100644 index 000000000..661b0e492 --- /dev/null +++ b/targets/platform/leaderboard/leaderboard.h @@ -0,0 +1,13 @@ +#pragma once + +#include "IPlatformLeaderboard.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h: avoids the static-init-order +// fiasco and lets call sites use the existing `PlatformLeaderboard.foo()` +// shape via the macro expansion. +namespace platform_internal { +IPlatformLeaderboard& PlatformLeaderboard_get(); +} + +#define PlatformLeaderboard (::platform_internal::PlatformLeaderboard_get()) diff --git a/targets/platform/leaderboard/meson.build b/targets/platform/leaderboard/meson.build new file mode 100644 index 000000000..8e520726b --- /dev/null +++ b/targets/platform/leaderboard/meson.build @@ -0,0 +1 @@ +platform_leaderboard_sources = files('stub/StubLeaderboard.cpp') diff --git a/targets/platform/leaderboard/stub/StubLeaderboard.cpp b/targets/platform/leaderboard/stub/StubLeaderboard.cpp new file mode 100644 index 000000000..03e7585d1 --- /dev/null +++ b/targets/platform/leaderboard/stub/StubLeaderboard.cpp @@ -0,0 +1,10 @@ +#include "StubLeaderboard.h" + +#include "platform/leaderboard/leaderboard.h" + +namespace platform_internal { +IPlatformLeaderboard& PlatformLeaderboard_get() { + static StubLeaderboard instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/leaderboard/stub/StubLeaderboard.h b/targets/platform/leaderboard/stub/StubLeaderboard.h new file mode 100644 index 000000000..f6784fd57 --- /dev/null +++ b/targets/platform/leaderboard/stub/StubLeaderboard.h @@ -0,0 +1,45 @@ +#pragma once + +#include "platform/leaderboard/IPlatformLeaderboard.h" + +// No-op leaderboard backend. Returns success for session lifecycle and +// `false` for every read/write so consumers can short-circuit cleanly. +// This is the platform default; a real backend (Steam, EOS, Xbox Live, +// custom HTTP) would replace this at link time. + +class StubLeaderboard : public IPlatformLeaderboard { +public: + void Tick() override {} + + [[nodiscard]] bool OpenSession() override { return true; } + void CloseSession() override {} + void DeleteSession() override {} + + [[nodiscard]] bool WriteStats(unsigned int /*viewCount*/, + ViewIn /*views*/) override { + return false; + } + + bool ReadStats_Friends(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + PlayerUID /*myUID*/, unsigned int /*startIndex*/, + unsigned int /*readCount*/) override { + return false; + } + bool ReadStats_MyScore(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + PlayerUID /*myUID*/, + unsigned int /*readCount*/) override { + return false; + } + bool ReadStats_TopRank(LeaderboardReadListener* /*callback*/, + int /*difficulty*/, EStatsType /*type*/, + unsigned int /*startIndex*/, + unsigned int /*readCount*/) override { + return false; + } + + void FlushStats() override {} + void CancelOperation() override {} + [[nodiscard]] bool isIdle() override { return true; } +}; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index f8ab4cd4c..2eec79af5 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -23,12 +23,53 @@ platform_dep = declare_dependency( include_directories: platform_inc, ) -# Per-subsystem backends. Each lives in its own subdir and produces its -# own library + dep so consumers can ask for the subsystem they need -# without dragging the others in. +# Per-subsystem source lists. Each subdir owns its own list of backend +# .cpp files via a `platform__sources` variable. The library +# build is centralised so we get one library per platform target rather +# than one per subsystem; subsystems vary together (an SDL2 platform +# wants SDL2 input + GL renderer + miniaudio together) and a per- +# subsystem split inflates link units without buying flexibility. subdir('input') subdir('profile') subdir('storage') subdir('fs') subdir('renderer') subdir('sound') +subdir('network') +subdir('leaderboard') +subdir('game') + +lib_platform_sdl2 = static_library('platform_sdl2', + platform_input_sources + + platform_profile_sources + + platform_storage_sources + + platform_fs_sources + + platform_renderer_sources + + platform_sound_sources + + platform_network_sources + + platform_leaderboard_sources + + platform_game_sources, + include_directories: [platform_inc, include_directories('..')], + dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep, + miniaudio_dep], + cpp_args: _defs + global_cpp_args + global_cpp_defs, +) + +# Single dep for the whole platform_sdl2 library. Aliased per-subsystem +# so consumer meson files can keep asking for `input_dep` etc. without +# caring that they all resolve to the same library object today. +platform_sdl2_dep = declare_dependency( + link_with: lib_platform_sdl2, + include_directories: [platform_inc], + dependencies: [_sdl2, _gl, _threads, glm_dep, miniaudio_dep], +) + +input_dep = platform_sdl2_dep +profile_dep = platform_sdl2_dep +storage_dep = platform_sdl2_dep +fs_dep = platform_sdl2_dep +render_dep = platform_sdl2_dep +sound_dep = platform_sdl2_dep +network_dep = platform_sdl2_dep +leaderboard_dep = platform_sdl2_dep +game_dep = platform_sdl2_dep diff --git a/targets/app/common/Network/IPlatformNetwork.h b/targets/platform/network/IPlatformNetwork.h similarity index 99% rename from targets/app/common/Network/IPlatformNetwork.h rename to targets/platform/network/IPlatformNetwork.h index b479863a6..cb0b3c659 100644 --- a/targets/app/common/Network/IPlatformNetwork.h +++ b/targets/platform/network/IPlatformNetwork.h @@ -5,8 +5,8 @@ #include #include -#include "PlatformTypes.h" #include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" #ifndef VER_NETWORK #define VER_NETWORK 560 diff --git a/targets/platform/network/meson.build b/targets/platform/network/meson.build new file mode 100644 index 000000000..a7ea6b5a0 --- /dev/null +++ b/targets/platform/network/meson.build @@ -0,0 +1 @@ +platform_network_sources = files('stub/StubPlatformNetwork.cpp') diff --git a/targets/platform/network/network.h b/targets/platform/network/network.h new file mode 100644 index 000000000..47f56fc30 --- /dev/null +++ b/targets/platform/network/network.h @@ -0,0 +1,13 @@ +#pragma once + +#include "IPlatformNetwork.h" + +// Function accessor backed by a function-local static (Meyers singleton). +// Same shape as platform/profile/profile.h: avoids the static-init-order +// fiasco. Call sites use the existing `PlatformNetwork.foo()` form via +// the macro. +namespace platform_internal { +IPlatformNetwork& PlatformNetwork_get(); +} + +#define PlatformNetwork (::platform_internal::PlatformNetwork_get()) diff --git a/targets/platform/network/stub/StubPlatformNetwork.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp new file mode 100644 index 000000000..1394ef82c --- /dev/null +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -0,0 +1,10 @@ +#include "StubPlatformNetwork.h" + +#include "platform/network/network.h" + +namespace platform_internal { +IPlatformNetwork& PlatformNetwork_get() { + static StubPlatformNetwork instance; + return instance; +} +} // namespace platform_internal diff --git a/targets/platform/network/stub/StubPlatformNetwork.h b/targets/platform/network/stub/StubPlatformNetwork.h new file mode 100644 index 000000000..086b8d37a --- /dev/null +++ b/targets/platform/network/stub/StubPlatformNetwork.h @@ -0,0 +1,129 @@ +#pragma once + +#include "platform/network/IPlatformNetwork.h" + +// True no-op platform network backend. Returns false / 0 / nullptr for +// every operation. The composition root can substitute a real backend +// (QNet, Steam, EOS, custom) at link time. Used as the platform default +// so consumers can call PlatformNetwork.* without nullptr checks. + +class StubPlatformNetwork : public IPlatformNetwork { +public: + bool Initialise(CGameNetworkManager* /*pGameNetworkManager*/, + int /*flagIndexSize*/) override { + return true; + } + void Terminate() override {} + void DoWork() override {} + [[nodiscard]] int GetJoiningReadyPercentage() override { return 100; } + [[nodiscard]] int CorrectErrorIDS(int IDS) override { return IDS; } + + [[nodiscard]] int GetPlayerCount() override { return 0; } + [[nodiscard]] int GetOnlinePlayerCount() override { return 0; } + [[nodiscard]] int GetLocalPlayerMask(int /*playerIndex*/) override { + return 0; + } + bool AddLocalPlayerByUserIndex(int /*userIndex*/) override { return false; } + bool RemoveLocalPlayerByUserIndex(int /*userIndex*/) override { + return false; + } + [[nodiscard]] INetworkPlayer* GetLocalPlayerByUserIndex( + int /*userIndex*/) override { + return nullptr; + } + [[nodiscard]] INetworkPlayer* GetPlayerByIndex( + int /*playerIndex*/) override { + return nullptr; + } + [[nodiscard]] INetworkPlayer* GetPlayerByXuid(PlayerUID /*xuid*/) override { + return nullptr; + } + [[nodiscard]] INetworkPlayer* GetPlayerBySmallId( + unsigned char /*smallId*/) override { + return nullptr; + } + [[nodiscard]] INetworkPlayer* GetHostPlayer() override { return nullptr; } + [[nodiscard]] bool ShouldMessageForFullSession() override { return false; } + + [[nodiscard]] bool IsHost() override { return true; } + bool JoinGameFromInviteInfo(int /*userIndex*/, int /*userMask*/, + const INVITE_INFO* /*pInviteInfo*/) override { + return false; + } + bool LeaveGame(bool /*bMigrateHost*/) override { return true; } + [[nodiscard]] bool IsInSession() override { return false; } + [[nodiscard]] bool IsInGameplay() override { return false; } + [[nodiscard]] bool IsReadyToPlayOrIdle() override { return true; } + [[nodiscard]] bool IsInStatsEnabledSession() override { return false; } + [[nodiscard]] bool SessionHasSpace( + unsigned int /*spaceRequired*/) override { + return true; + } + void SendInviteGUI(int /*quadrant*/) override {} + [[nodiscard]] bool IsAddingPlayer() override { return false; } + + void HostGame(int /*localUsersMask*/, bool /*bOnlineGame*/, + bool /*bIsPrivate*/, unsigned char /*publicSlots*/, + unsigned char /*privateSlots*/) override {} + int JoinGame(FriendSessionInfo* /*searchResult*/, int /*dwLocalUsersMask*/, + int /*dwPrimaryUserIndex*/) override { + return 0; + } + bool SetLocalGame(bool /*isLocal*/) override { return true; } + [[nodiscard]] bool IsLocalGame() override { return true; } + void SetPrivateGame(bool /*isPrivate*/) override {} + [[nodiscard]] bool IsPrivateGame() override { return false; } + [[nodiscard]] bool IsLeavingGame() override { return false; } + void ResetLeavingGame() override {} + + void RegisterPlayerChangedCallback( + int /*iPad*/, + std::function /*callback*/) override {} + void UnRegisterPlayerChangedCallback(int /*iPad*/) override {} + + void HandleSignInChange() override {} + + bool _RunNetworkGame() override { return true; } + bool _LeaveGame(bool /*bMigrateHost*/, bool /*bLeaveRoom*/) override { + return true; + } + void _HostGame(int /*usersMask*/, unsigned char /*publicSlots*/, + unsigned char /*privateSlots*/) override {} + bool _StartGame() override { return true; } + + void UpdateAndSetGameSessionData( + INetworkPlayer* /*pNetworkPlayerLeaving*/) override {} + bool RemoveLocalPlayer(INetworkPlayer* /*pNetworkPlayer*/) override { + return false; + } + + void SystemFlagSet(INetworkPlayer* /*pNetworkPlayer*/, + int /*index*/) override {} + [[nodiscard]] bool SystemFlagGet(INetworkPlayer* /*pNetworkPlayer*/, + int /*index*/) override { + return false; + } + + [[nodiscard]] std::string GatherStats() override { return {}; } + [[nodiscard]] std::string GatherRTTStats() override { return {}; } + + void SetSessionTexturePackParentId(int /*id*/) override {} + void SetSessionSubTexturePackId(int /*id*/) override {} + void Notify(int /*ID*/, uintptr_t /*Param*/) override {} + + [[nodiscard]] std::vector* GetSessionList( + int /*iPad*/, int /*localPlayers*/, bool /*partyOnly*/) override { + return nullptr; + } + [[nodiscard]] bool GetGameSessionInfo( + int /*iPad*/, SessionID /*sessionId*/, + FriendSessionInfo* /*foundSession*/) override { + return false; + } + void SetSessionsUpdatedCallback( + std::function /*callback*/) override {} + void GetFullFriendSessionInfo( + FriendSessionInfo* /*foundSession*/, + std::function /*callback*/) override {} + void ForceFriendsSessionRefresh() override {} +}; diff --git a/targets/platform/profile/meson.build b/targets/platform/profile/meson.build index 8990e76d4..06c9397d4 100644 --- a/targets/platform/profile/meson.build +++ b/targets/platform/profile/meson.build @@ -1,12 +1 @@ -lib_platform_profile_stub = static_library( - 'platform_profile_stub', - files('stub/StubProfile.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -profile_dep = declare_dependency( - link_with: lib_platform_profile_stub, - include_directories: [platform_inc], -) +platform_profile_sources = files('stub/StubProfile.cpp') diff --git a/targets/platform/renderer/meson.build b/targets/platform/renderer/meson.build index ee1bfa419..a000fc34c 100644 --- a/targets/platform/renderer/meson.build +++ b/targets/platform/renderer/meson.build @@ -1,13 +1 @@ -lib_platform_renderer_gl = static_library( - 'platform_renderer_gl', - files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep], - cpp_args: _defs + global_cpp_args + global_cpp_defs, -) - -render_dep = declare_dependency( - link_with: lib_platform_renderer_gl, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep], -) +platform_renderer_sources = files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp') diff --git a/targets/platform/sound/meson.build b/targets/platform/sound/meson.build index 79f6f4519..90a32a5f6 100644 --- a/targets/platform/sound/meson.build +++ b/targets/platform/sound/meson.build @@ -1,15 +1 @@ -_miniaudio_dep = dependency('miniaudio') - -lib_platform_sound_miniaudio = static_library( - 'platform_sound_miniaudio', - files('miniaudio/MiniaudioSound.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_threads, _miniaudio_dep], - cpp_args: global_cpp_args + global_cpp_defs, -) - -sound_dep = declare_dependency( - link_with: lib_platform_sound_miniaudio, - include_directories: [platform_inc], - dependencies: [_miniaudio_dep], -) +platform_sound_sources = files('miniaudio/MiniaudioSound.cpp') diff --git a/targets/platform/storage/meson.build b/targets/platform/storage/meson.build index a4b5d57ec..3dfd0201f 100644 --- a/targets/platform/storage/meson.build +++ b/targets/platform/storage/meson.build @@ -1,12 +1 @@ -lib_platform_storage_stub = static_library( - 'platform_storage_stub', - files('stub/StubStorage.cpp'), - include_directories: [platform_inc, include_directories('../..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -storage_dep = declare_dependency( - link_with: lib_platform_storage_stub, - include_directories: [platform_inc], -) +platform_storage_sources = files('stub/StubStorage.cpp') From fbfccdeac6d9b003eed68b6f50c2be94b3747442 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:49:31 +1000 Subject: [PATCH 037/104] chore: drop a few more dead app/ includes from minecraft --- targets/minecraft/client/gui/CreateWorldScreen.cpp | 1 - targets/minecraft/client/gui/achievement/StatsScreen.cpp | 1 - targets/minecraft/client/multiplayer/ClientConnection.cpp | 2 -- .../minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp | 1 - targets/minecraft/client/player/LocalPlayer.cpp | 1 - targets/minecraft/client/skins/DLCTexturePack.cpp | 4 ---- targets/minecraft/server/PlayerList.cpp | 1 - 7 files changed, 11 deletions(-) diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index 0b66a378e..f200034ac 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -18,7 +18,6 @@ // below. Static thread procs can't be virtual; this one consumer keeps the // concrete type include. #include "app/common/Network/GameNetworkManager.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" #include "minecraft/SharedConstants.h" diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index cca45430e..512450ca1 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,5 +1,4 @@ #include "StatsScreen.h" - #include "app/common/Audio/SoundEngine.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 7b47701f3..dee511bc8 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -20,9 +20,7 @@ #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 81a8256e3..36ee02001 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -6,7 +6,6 @@ #include "ClientConnection.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index cd27e3bf6..f24cf33af 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -34,7 +34,6 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/linux/Linux_UIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index bf187631a..24cdae7cd 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -5,11 +5,9 @@ #include #include #include - #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" -#include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCLocalisationFile.h" #include "app/common/DLC/DLCManager.h" @@ -35,8 +33,6 @@ #include "platform/storage/storage.h" #if defined(_WINDOWS64) -#include "app/windows/XML/ATGXmlParser.h" -#include "app/windows/XML/xmlFilesCallback.h" #endif namespace { diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 2cd52e4fb..1cfb4c557 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -13,7 +13,6 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/GameEnums.h" From 9c502ce8fc6d7260f6f0fd39254162f0f31aa7ad Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:28:57 +1000 Subject: [PATCH 038/104] refactor: route IPlatformGame and Leaderboard call sites through platform/ --- subprojects/simdutf.wrap | 2 +- targets/app/common/Game_XuiActions.cpp | 7 ++++--- targets/app/common/Network/GameNetworkManager.cpp | 7 ++++--- .../Scenes/Frontend Menu screens/UIScene_MainMenu.cpp | 3 ++- .../Containers/UIScene_AnvilMenu.cpp | 3 ++- .../Containers/UIScene_BeaconMenu.cpp | 3 ++- .../Containers/UIScene_BrewingStandMenu.cpp | 3 ++- .../Containers/UIScene_EnchantingMenu.cpp | 3 ++- .../Containers/UIScene_FurnaceMenu.cpp | 3 ++- .../Containers/UIScene_HorseInventoryMenu.cpp | 3 ++- .../Containers/UIScene_TradingMenu.cpp | 3 ++- .../In-Game Menu Screens/UIScene_CraftingMenu.cpp | 3 ++- targets/app/linux/LinuxGame.cpp | 3 ++- targets/app/windows/Windows64_App.cpp | 3 ++- targets/minecraft/stats/StatsCounter.cpp | 10 +++++----- 15 files changed, 36 insertions(+), 23 deletions(-) diff --git a/subprojects/simdutf.wrap b/subprojects/simdutf.wrap index 98153f2b7..47336fedf 100644 --- a/subprojects/simdutf.wrap +++ b/subprojects/simdutf.wrap @@ -1,7 +1,7 @@ [wrap-git] url = https://github.com/simdutf/simdutf.git depth = 1 -revision = v8.2.0 +revision = fd476229424b40ae71a58dd5a205795c3d76b5f1 patch_directory = simdutf [provide] diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 673e52980..0616a5d7b 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -1,4 +1,5 @@ #include "app/common/Audio/SoundEngine.h" +#include "platform/game/game.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" @@ -454,13 +455,13 @@ void Game::HandleXuiActions(void) { for (int j = 0; j < XUSER_MAX_COUNT; j++) { if (pMinecraft->localplayers[j]) { if (g_NetworkManager.IsLocalGame()) { - app.SetRichPresenceContext( + PlatformGame.SetRichPresenceContext( j, CONTEXT_GAME_STATE_BLANK); PlatformProfile.SetCurrentGameActivity( j, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); } else { - app.SetRichPresenceContext( + PlatformGame.SetRichPresenceContext( j, CONTEXT_GAME_STATE_BLANK); PlatformProfile.SetCurrentGameActivity( j, CONTEXT_PRESENCE_MULTIPLAYER, false); @@ -468,7 +469,7 @@ void Game::HandleXuiActions(void) { } } } else { - app.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); if (g_NetworkManager.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 99f39911d..22dd27316 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -1,4 +1,5 @@ #include "GameNetworkManager.h" +#include "platform/game/game.h" #include @@ -349,7 +350,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, createdConnections.push_back(connection); int primaryPad = PlatformProfile.GetPrimaryPad(); - app.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there { @@ -451,7 +452,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break; if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) { - app.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); if (IsLocalGame()) PlatformProfile.SetCurrentGameActivity( idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); @@ -1221,7 +1222,7 @@ void CGameNetworkManager::PlayerJoining(INetworkPlayer* pNetworkPlayer) { g_NetworkManager.GetLocalPlayerByUserIndex(iPad); if (pNetworkPlayer == nullptr) continue; - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BLANK); if (multiplayer) { if (localgame) PlatformProfile.SetCurrentGameActivity( 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 984bb95f3..7597058eb 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 @@ -1,5 +1,6 @@ #include "UIScene_MainMenu.h" +#include "platform/game/game.h" #include #include @@ -769,7 +770,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { // clear the remembered signed in users so their profiles get read again app.ClearSignInChangeUsersMask(); - app.ReleaseSaveThumbnail(); + PlatformGame.ReleaseSaveThumbnail(); if (PlatformProfile.IsGuest(iPad)) { unsigned int uiIDA[1]; 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 5bcbfa26d..0524a9715 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 @@ -1,5 +1,6 @@ #include "UIScene_AnvilMenu.h" +#include "platform/game/game.h" #include #include @@ -92,7 +93,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData, setIgnoreInput(false); - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_ANVIL); } std::string UIScene_AnvilMenu::getMoviePath() { diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index a3ea7c513..4dc84968d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -1,4 +1,5 @@ #include "UIScene_BeaconMenu.h" +#include "platform/game/game.h" #include @@ -61,7 +62,7 @@ UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void* _initData, m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4); - // app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON); + // PlatformGame.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON); delete initData; } 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 e210f2abc..c5e716adf 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 @@ -1,4 +1,5 @@ #include "UIScene_BrewingStandMenu.h" +#include "platform/game/game.h" #include @@ -61,7 +62,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void* _initData, if (initData) delete initData; - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_BREWING); } std::string UIScene_BrewingStandMenu::getMoviePath() { 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 1643bd549..3f36371d9 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 @@ -1,5 +1,6 @@ #include "UIScene_EnchantingMenu.h" +#include "platform/game/game.h" #include @@ -55,7 +56,7 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void* _initData, m_slotListIngredient.addSlots(EnchantmentMenu::INGREDIENT_SLOT, 1); - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_ENCHANTING); delete initData; } 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 205049a6a..424906cdc 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 @@ -1,5 +1,6 @@ #include "UIScene_FurnaceMenu.h" +#include "platform/game/game.h" #include @@ -53,7 +54,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void* _initData, m_slotListIngredient.addSlots(FurnaceMenu::INGREDIENT_SLOT, 1); m_slotListResult.addSlots(FurnaceMenu::RESULT_SLOT, 1); - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FORGING); delete initData; } diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index baf7dcd44..bedddb31b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -1,4 +1,5 @@ #include "UIScene_HorseInventoryMenu.h" +#include "platform/game/game.h" #include @@ -77,7 +78,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, setIgnoreInput(false); - // app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE); + // PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE); } std::string UIScene_HorseInventoryMenu::getMoviePath() { 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 d596257ea..6bf22ea8b 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 @@ -1,5 +1,6 @@ #include "UIScene_TradingMenu.h" +#include "platform/game/game.h" #include #include @@ -83,7 +84,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void* _initData, ui.OverrideSFX(m_iPad, ACTION_MENU_UP, true); ui.OverrideSFX(m_iPad, ACTION_MENU_DOWN, true); - app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING); + PlatformGame.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_TRADING); } std::string UIScene_TradingMenu::getMoviePath() { 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 00cc12cb6..a16e0ce03 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,5 +1,6 @@ #include "UIScene_CraftingMenu.h" +#include "platform/game/game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialEnum.h" @@ -118,7 +119,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void* _initData, #endif - app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING); + PlatformGame.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING); setGroupText(GetGroupNameText(m_pGroupA[m_iGroupIndex])); // Update the tutorial state diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 54fc0830b..978d9f9cc 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -1,4 +1,5 @@ #include "LinuxGame.h" +#include "platform/game/game.h" #include @@ -51,7 +52,7 @@ void LinuxGame::TemporaryCreateGameStart() { // From CScene_Main::RunPlayGame Minecraft* pMinecraft = Minecraft::GetInstance(); - app.ReleaseSaveThumbnail(); + PlatformGame.ReleaseSaveThumbnail(); PlatformProfile.SetLockedProfile(0); pMinecraft->user->name = "Windows"; app.ApplyGameSettingsChanged(0); diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index bf7a50f45..59198d4c5 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -1,5 +1,6 @@  #include "WindowsGame.h" +#include "platform/game/game.h" #include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/User.h" @@ -42,7 +43,7 @@ void WindowsGame::TemporaryCreateGameStart() { // From CScene_Main::RunPlayGame Minecraft* pMinecraft = Minecraft::GetInstance(); - app.ReleaseSaveThumbnail(); + PlatformGame.ReleaseSaveThumbnail(); PlatformProfile.SetLockedProfile(0); pMinecraft->user->name = "Windows"; app.ApplyGameSettingsChanged(0); diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index c8f496e84..6af5727f2 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -10,8 +10,8 @@ #include #include "app/common/App_structs.h" -#include "app/common/Leaderboards/LeaderboardManager.h" #include "app/linux/LinuxGame.h" +#include "platform/leaderboard/leaderboard.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" #include "minecraft/stats/GenericStats.h" @@ -248,9 +248,9 @@ void StatsCounter::save(int player, bool force) { } void StatsCounter::flushLeaderboards() { - if (LeaderboardManager::Instance()->OpenSession()) { + if (PlatformLeaderboard.OpenSession()) { writeStats(); - LeaderboardManager::Instance()->FlushStats(); + PlatformLeaderboard.FlushStats(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); @@ -264,9 +264,9 @@ void StatsCounter::flushLeaderboards() { } void StatsCounter::saveLeaderboards() { - if (LeaderboardManager::Instance()->OpenSession()) { + if (PlatformLeaderboard.OpenSession()) { writeStats(); - LeaderboardManager::Instance()->CloseSession(); + PlatformLeaderboard.CloseSession(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); From 08d8e341b941f0924d8163be1b2de99516252956 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:35:47 +1000 Subject: [PATCH 039/104] refactor: stop inheriting Game from IPlatformGame and delete the override stubs --- targets/app/common/AppGameServices.cpp | 11 +++++++---- targets/app/common/Game.h | 22 +--------------------- targets/app/linux/LinuxGame.cpp | 23 ----------------------- targets/app/linux/LinuxGame.h | 24 ------------------------ targets/app/windows/Windows64_App.cpp | 26 -------------------------- targets/app/windows/WindowsGame.h | 21 --------------------- 6 files changed, 8 insertions(+), 119 deletions(-) diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index 139d6af18..74ce03d03 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -2,6 +2,7 @@ #include "app/common/Game.h" #include "java/Class.h" // eINSTANCEOF +#include "platform/game/game.h" AppGameServices::AppGameServices(Game& game, IMenuService& menus) : game_(game), menus_(menus) {} @@ -262,19 +263,21 @@ bool AppGameServices::isXuidDeadmau5(PlayerUID xuid) { void AppGameServices::fatalLoadError() { game_.FatalLoadError(); } void AppGameServices::setRichPresenceContext(int iPad, int contextId) { - game_.SetRichPresenceContext(iPad, contextId); + PlatformGame.SetRichPresenceContext(iPad, contextId); } -void AppGameServices::captureSaveThumbnail() { game_.CaptureSaveThumbnail(); } +void AppGameServices::captureSaveThumbnail() { + PlatformGame.CaptureSaveThumbnail(); +} void AppGameServices::getSaveThumbnail(std::uint8_t** data, unsigned int* size) { - game_.GetSaveThumbnail(data, size); + PlatformGame.GetSaveThumbnail(data, size); } void AppGameServices::readBannedList(int iPad, eTMSAction action, bool bCallback) { - game_.ReadBannedList(iPad, action, bCallback); + PlatformGame.ReadBannedList(iPad, action, bCallback); } void AppGameServices::updatePlayerInfo(std::uint8_t networkSmallId, diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index b320fd0be..c31ea2c70 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -18,7 +18,6 @@ #include "app/common/DebugOptions.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameSettingsManager.h" -#include "platform/game/IPlatformGame.h" #include "app/common/LocalizationManager.h" #include "app/common/MenuController.h" #include "app/common/NetworkController.h" @@ -62,7 +61,7 @@ class Merchant; class CMinecraftAudio; -class Game : public IPlatformGame { +class Game { public: Game(); @@ -359,7 +358,6 @@ public: const int iPad) { return m_gameSettingsManager.setDefaultOptions(pSettings, iPad); } - void SetRichPresenceContext(int iPad, int contextId) override = 0; void SetGameSettings(int iPad, eGameSetting eVal, unsigned char ucVal) { m_gameSettingsManager.setGameSettings(iPad, eVal, ucVal); @@ -896,17 +894,6 @@ public: void ReadXuidsFileFromTMS(int iPad, eTMSAction action, bool bCallback = false); - // images for save thumbnail/social post - void CaptureSaveThumbnail() override = 0; - void GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) override = 0; - void ReleaseSaveThumbnail() override = 0; - void GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize) override = 0; - - void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false) override = 0; - // DLC data members moved to DLCController // Sign-in info moved to NetworkController @@ -1150,13 +1137,6 @@ public: return SkinManager::getSkinPathFromId(skinId); } - int LoadLocalTMSFile(char* wchTMSFile) override = 0; - int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) override = 0; - void FreeLocalTMSFiles(eTMSFileType eType) override = 0; - int GetLocalTMSFileIndex(char* wchTMSFile, bool bFilenameIncludesExtension, - eFileExtensionType eEXT) override = 0; - virtual bool GetTMSGlobalFileListRead() { return true; } virtual bool GetTMSDLCInfoRead() { return true; } virtual bool GetTMSXUIDsFileRead() { return true; } diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp index 978d9f9cc..7dd6381a5 100644 --- a/targets/app/linux/LinuxGame.cpp +++ b/targets/app/linux/LinuxGame.cpp @@ -24,8 +24,6 @@ LinuxGame app; LinuxGame::LinuxGame() : Game() {} -void LinuxGame::SetRichPresenceContext(int iPad, int contextId) {} - void LinuxGame::StoreLaunchData() {} void LinuxGame::ExitGame() { app.DebugPrintf("Linux_App LinuxGame::ExitGame AFTER START\n"); @@ -36,14 +34,6 @@ void LinuxGame::FatalLoadError() { assert(0); } -void LinuxGame::CaptureSaveThumbnail() {} -void LinuxGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} -void LinuxGame::ReleaseSaveThumbnail() {} - -void LinuxGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} - void LinuxGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// /// From CScene_Main::OnInit @@ -120,16 +110,3 @@ void LinuxGame::TemporaryCreateGameStart() { thread->run(); } -int LinuxGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { - return -1; -} - -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } - -int LinuxGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { - return -1; -} - -void LinuxGame::FreeLocalTMSFiles(eTMSFileType eType) {} diff --git a/targets/app/linux/LinuxGame.h b/targets/app/linux/LinuxGame.h index 528dfde4e..c2dab570d 100644 --- a/targets/app/linux/LinuxGame.h +++ b/targets/app/linux/LinuxGame.h @@ -1,8 +1,5 @@ #pragma once -#include - -#include "minecraft/GameEnums.h" #include "app/common/Game.h" class C4JStringTable; @@ -11,31 +8,10 @@ class LinuxGame : public Game { public: LinuxGame(); - void SetRichPresenceContext(int iPad, int contextId) override; - void StoreLaunchData() override; void ExitGame() override; void FatalLoadError() override; - void CaptureSaveThumbnail() override; - void GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) override; - void ReleaseSaveThumbnail() override; - void GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize) override; - - int LoadLocalTMSFile(char* wchTMSFile) override; - int LoadLocalTMSFile(char* wchTMSFile, - eFileExtensionType eExt) override; - - void FreeLocalTMSFiles(eTMSFileType eType) override; - int GetLocalTMSFileIndex( - char* wchTMSFile, bool bFilenameIncludesExtension, - eFileExtensionType eEXT = eFileExtensionType_PNG) override; - - void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false) override {} - C4JStringTable* GetStringTable() { return nullptr; } // original code diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp index 59198d4c5..5d7ac43bd 100644 --- a/targets/app/windows/Windows64_App.cpp +++ b/targets/app/windows/Windows64_App.cpp @@ -18,23 +18,10 @@ WindowsGame app; WindowsGame::WindowsGame() : Game() {} -void WindowsGame::SetRichPresenceContext(int iPad, int contextId) { - PlatformProfile.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, - contextId); -} - void WindowsGame::StoreLaunchData() {} void WindowsGame::ExitGame() {} void WindowsGame::FatalLoadError() {} -void WindowsGame::CaptureSaveThumbnail() {} -void WindowsGame::GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize) {} -void WindowsGame::ReleaseSaveThumbnail() {} - -void WindowsGame::GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize) {} - void WindowsGame::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// /// From CScene_Main::OnInit @@ -111,16 +98,3 @@ void WindowsGame::TemporaryCreateGameStart() { thread->run(); } -int WindowsGame::GetLocalTMSFileIndex(char* wchTMSFile, - bool bFilenameIncludesExtension, - eFileExtensionType eEXT) { - return -1; -} - -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile) { return -1; } - -int WindowsGame::LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt) { - return -1; -} - -void WindowsGame::FreeLocalTMSFiles(eTMSFileType eType) {} diff --git a/targets/app/windows/WindowsGame.h b/targets/app/windows/WindowsGame.h index d7a31afc6..8531137bc 100644 --- a/targets/app/windows/WindowsGame.h +++ b/targets/app/windows/WindowsGame.h @@ -4,31 +4,10 @@ class WindowsGame : public Game { public: WindowsGame(); - virtual void SetRichPresenceContext(int iPad, int contextId); - virtual void StoreLaunchData(); virtual void ExitGame(); virtual void FatalLoadError(); - virtual void CaptureSaveThumbnail(); - virtual void GetSaveThumbnail(std::uint8_t** thumbnailData, - unsigned int* thumbnailSize); - virtual void ReleaseSaveThumbnail(); - virtual void GetScreenshot(int iPad, std::uint8_t** screenshotData, - unsigned int* screenshotSize); - - virtual int LoadLocalTMSFile(char* wchTMSFile); - virtual int LoadLocalTMSFile(char* wchTMSFile, eFileExtensionType eExt); - - virtual void FreeLocalTMSFiles(eTMSFileType eType); - virtual int GetLocalTMSFileIndex( - char* wchTMSFile, bool bFilenameIncludesExtension, - eFileExtensionType eEXT = eFileExtensionType_PNG); - - // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, - bool bCallback = false) {} - C4JStringTable* GetStringTable() { return nullptr; } // original code From aa250ff560c77285f11265b5e32d58489281e913 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:19:50 +1000 Subject: [PATCH 040/104] refactor: inject IPlatformLeaderboard into Minecraft and StatsCounter via constructor --- targets/app/linux/Linux_Minecraft.cpp | 9 +++++++-- targets/minecraft/client/Minecraft.cpp | 21 +++++++++++++-------- targets/minecraft/client/Minecraft.h | 16 ++++++++++++---- targets/minecraft/stats/StatsCounter.cpp | 13 +++++++------ targets/minecraft/stats/StatsCounter.h | 8 +++++++- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index acacabad6..500d4312e 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -48,9 +48,9 @@ static void sigsegv_handler(int sig) { #include #include +#include "app/common/Leaderboards/LeaderboardManager.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/level/Level.h" -// #include "app/common/Leaderboards/LeaderboardManager.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" #include "platform/PlatformTypes.h" @@ -513,7 +513,12 @@ int main(int argc, const char* argv[]) { Level::enableLightingCache(); Tile::CreateNewThreadStorage(); - Minecraft::main(); + // Composition root: read the leaderboard backend from the existing + // LinuxLeaderboardManager singleton (still used by the legacy UI + // scenes) and pass it down via constructor injection. Once the UI + // side is also injected, the singleton can be deleted entirely and + // the backend constructed via std::make_unique here. + Minecraft::main(*LeaderboardManager::Instance()); Minecraft* pMinecraft = Minecraft::GetInstance(); app.InitGameSettings(); diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 93ea4d4fc..be198d829 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -157,7 +157,8 @@ ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); Minecraft::Minecraft(Component* mouseComponent, Canvas* parent, MinecraftApplet* minecraftApplet, int width, int height, - bool fullscreen) { + bool fullscreen, IPlatformLeaderboard& leaderboard_) + : leaderboard(leaderboard_) { // 4J - added this block of initialisers gameMode = nullptr; hasCrashed = false; @@ -324,7 +325,7 @@ void Minecraft::init() { EntityRenderDispatcher::instance->itemInHandRenderer = new ItemInHandRenderer(this, false); - for (int i = 0; i < 4; ++i) stats[i] = new StatsCounter(); + for (int i = 0; i < 4; ++i) stats[i] = new StatsCounter(leaderboard); /* 4J - TODO, 4J-JEV: Unnecessary. Achievements::openInventory->setDescFormatter(nullptr); @@ -4100,13 +4101,15 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) { gameRenderer->EnableUpdateThread(); } -void Minecraft::start(const std::string& name, const std::string& sid) { - startAndConnectTo(name, sid, ""); +void Minecraft::start(const std::string& name, const std::string& sid, + IPlatformLeaderboard& leaderboard) { + startAndConnectTo(name, sid, "", leaderboard); } void Minecraft::startAndConnectTo(const std::string& name, const std::string& sid, - const std::string& url) { + const std::string& url, + IPlatformLeaderboard& leaderboard) { bool fullScreen = false; std::string userName = name; @@ -4129,7 +4132,9 @@ void Minecraft::startAndConnectTo(const std::string& name, Minecraft* minecraft; // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); - minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen); + minecraft = + new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen, + leaderboard); /* - 4J - removed { @@ -4201,7 +4206,7 @@ bool useLomp = false; int g_iMainThreadId; -void Minecraft::main() { +void Minecraft::main(IPlatformLeaderboard& leaderboard) { std::string name; std::string sessionId; @@ -4241,7 +4246,7 @@ void Minecraft::main() { // On PS4, we call Minecraft::Start from another thread, as this has been // timed taking ~2.5 seconds and we need to do some basic rendering stuff so // that we don't break the TRCs on SubmitDone calls - Minecraft::start(name, sessionId); + Minecraft::start(name, sessionId, leaderboard); } bool Minecraft::renderNames() { diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 192239382..f728e66a0 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -32,6 +32,7 @@ class HumanoidModel; class HitResult; class Options; class SoundEngine; +class IPlatformLeaderboard; class MinecraftApplet; class MouseHandler; class TexturePackRepository; @@ -69,7 +70,7 @@ public: static const std::string VERSION_STRING; Minecraft(Component* mouseComponent, Canvas* parent, MinecraftApplet* minecraftApplet, int width, int height, - bool fullscreen); + bool fullscreen, IPlatformLeaderboard& leaderboard); void init(); // 4J - removed @@ -215,6 +216,11 @@ public: // 4J- this should really be in localplayer StatsCounter* stats[4]; + // Borrowed from the composition root - Minecraft does not own the + // backend. The reference is valid for the lifetime of the Minecraft + // singleton (the leaderboard outlives Minecraft). + IPlatformLeaderboard& leaderboard; + private: std::string connectToIp; int connectToPort; @@ -337,12 +343,14 @@ public: std::string gatherStats4(); void respawnPlayer(int iPad, int dimension, int newEntityId); - static void start(const std::string& name, const std::string& sid); + static void start(const std::string& name, const std::string& sid, + IPlatformLeaderboard& leaderboard); static void startAndConnectTo(const std::string& name, const std::string& sid, - const std::string& url); + const std::string& url, + IPlatformLeaderboard& leaderboard); ClientConnection* getConnection(int iPad); // 4J Stu added iPad param - static void main(); + static void main(IPlatformLeaderboard& leaderboard); static bool renderNames(); static bool useFancyGraphics(); static bool useAmbientOcclusion(); diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 6af5727f2..02ea62c82 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -11,7 +11,7 @@ #include "app/common/App_structs.h" #include "app/linux/LinuxGame.h" -#include "platform/leaderboard/leaderboard.h" +#include "platform/leaderboard/IPlatformLeaderboard.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" #include "minecraft/stats/GenericStats.h" @@ -29,7 +29,8 @@ Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, std::unordered_map StatsCounter::statBoards; -StatsCounter::StatsCounter() { +StatsCounter::StatsCounter(IPlatformLeaderboard& leaderboard) + : m_leaderboard(leaderboard) { requiresSave = false; saveCounter = 0; modifiedBoards = 0; @@ -248,9 +249,9 @@ void StatsCounter::save(int player, bool force) { } void StatsCounter::flushLeaderboards() { - if (PlatformLeaderboard.OpenSession()) { + if (m_leaderboard.OpenSession()) { writeStats(); - PlatformLeaderboard.FlushStats(); + m_leaderboard.FlushStats(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); @@ -264,9 +265,9 @@ void StatsCounter::flushLeaderboards() { } void StatsCounter::saveLeaderboards() { - if (PlatformLeaderboard.OpenSession()) { + if (m_leaderboard.OpenSession()) { writeStats(); - PlatformLeaderboard.CloseSession(); + m_leaderboard.CloseSession(); } else { Log::info( "Failed to open a session in order to write to leaderboard\n"); diff --git a/targets/minecraft/stats/StatsCounter.h b/targets/minecraft/stats/StatsCounter.h index c93d4e5fe..6f064e8a7 100644 --- a/targets/minecraft/stats/StatsCounter.h +++ b/targets/minecraft/stats/StatsCounter.h @@ -2,6 +2,7 @@ #include #include +class IPlatformLeaderboard; class Stat; class Achievement; class StatsSyncher; @@ -70,8 +71,13 @@ private: static std::unordered_map statBoards; int flushCounter; + // Borrowed from the composition root - StatsCounter does not own the + // backend. The reference is valid for the lifetime of the StatsCounter + // (the leaderboard outlives all StatsCounter instances). + IPlatformLeaderboard& m_leaderboard; + public: - StatsCounter(); + explicit StatsCounter(IPlatformLeaderboard& leaderboard); void award(Stat* stat, unsigned int difficulty, unsigned int count); bool hasTaken(Achievement* ach); bool canTake(Achievement* ach); From 84140ae6d4a178c602df34e0649aa7dc9239bc4b Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:35:53 +1000 Subject: [PATCH 041/104] refactor: move StringTable impl into minecraft/locale and inject locales --- .../app/common/DLC/DLCLocalisationFile.cpp | 5 ++- targets/app/common/DLC/DLCPack.cpp | 4 ++- .../app/common/GameRules/GameRuleManager.cpp | 4 ++- targets/app/common/LocalizationManager.cpp | 5 ++- .../IUIScene_StartGame.cpp | 4 ++- targets/app/common_sources.txt | 1 - .../locale}/StringTable.cpp | 35 ++++++++++--------- targets/minecraft/locale/StringTable.h | 7 ++-- targets/minecraft/sources.txt | 1 + 9 files changed, 40 insertions(+), 26 deletions(-) rename targets/{app/common/Localisation => minecraft/locale}/StringTable.cpp (80%) diff --git a/targets/app/common/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp index 2a66aaafd..343faad53 100644 --- a/targets/app/common/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -2,6 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" +#include "app/linux/LinuxGame.h" #include "minecraft/locale/StringTable.h" DLCLocalisationFile::DLCLocalisationFile(const std::string& path) @@ -11,5 +12,7 @@ DLCLocalisationFile::DLCLocalisationFile(const std::string& path) void DLCLocalisationFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { - m_strings = new StringTable(pbData, dataBytes); + std::vector locales; + app.getLocale(locales); + m_strings = new StringTable(pbData, dataBytes, locales); } diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index d0f78b64d..20bef9ed6 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -351,6 +351,8 @@ void DLCPack::UpdateLanguage() { DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile( DLCManager::e_DLCType_LocalisationData, "languages.loc"); StringTable* strTable = localisationFile->getStringTable(); - strTable->ReloadStringTable(); + std::vector locales; + app.getLocale(locales); + strTable->ReloadStringTable(locales); } } diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index af49ff1c6..39fb980e0 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -223,8 +223,10 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn, unsigned int bStringTableSize = dis2.readInt(); std::vector bStringTable(bStringTableSize); dis2.read(bStringTable); + std::vector locales; + app.getLocale(locales); StringTable* strings = - new StringTable(bStringTable.data(), bStringTable.size()); + new StringTable(bStringTable.data(), bStringTable.size(), locales); // Read RuleFile. std::vector bRuleFile(content.size() - bStringTable.size()); diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 1e78ed248..7048b8fc1 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -77,7 +77,10 @@ void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { std::string localisationFile = "languages.loc"; if (mediaArchive->hasFile(localisationFile)) { std::vector locFile = mediaArchive->getFile(localisationFile); - m_stringTable = new StringTable(locFile.data(), locFile.size()); + std::vector locales; + getLocale(locales); + m_stringTable = + new StringTable(locFile.data(), locFile.size(), locales); } else { m_stringTable = nullptr; assert(false); 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 b1d4ad79d..499e9ca4a 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 @@ -145,8 +145,10 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { app.GetFileFromTPD(eTPDFileType_Loc, pbData, dwBytes, &pbFileData, &dwFileBytes); if (dwFileBytes > 0 && pbFileData) { + std::vector locales; + app.getLocale(locales); StringTable* pStringTable = - new StringTable(pbFileData, dwFileBytes); + new StringTable(pbFileData, dwFileBytes, locales); m_texturePackTitle.SetText( pStringTable->getString("IDS_DISPLAY_NAME")); m_texturePackDescription.SetText( diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index c16c39958..cab1ba816 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -49,7 +49,6 @@ common/GameSettingsManager.cpp common/Game_XuiActions.cpp common/Leaderboards/LeaderboardInterface.cpp common/Leaderboards/LeaderboardManager.cpp -common/Localisation/StringTable.cpp common/LocalizationManager.cpp common/MenuController.cpp common/Network/GameNetworkManager.cpp diff --git a/targets/app/common/Localisation/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp similarity index 80% rename from targets/app/common/Localisation/StringTable.cpp rename to targets/minecraft/locale/StringTable.cpp index 90789035f..e19c49d63 100644 --- a/targets/app/common/Localisation/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -3,28 +3,32 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" +#include "minecraft/util/Log.h" StringTable::StringTable(void) {} // Load string table from a binary blob, filling out with the current -// localisation data only -StringTable::StringTable(std::uint8_t* pbData, unsigned int dataSize) { +// localisation data only. The caller passes the locale list it wants +// matched (typically obtained from the LocalizationManager) so that +// StringTable does not have to know about app-side singletons. +StringTable::StringTable(std::uint8_t* pbData, unsigned int dataSize, + const std::vector& locales) { src = std::vector(pbData, pbData + dataSize); - ProcessStringTableData(); + ProcessStringTableData(locales); } -void StringTable::ReloadStringTable() { +void StringTable::ReloadStringTable(const std::vector& locales) { m_stringsMap.clear(); m_stringsVec.clear(); - ProcessStringTableData(); + ProcessStringTableData(locales); } -void StringTable::ProcessStringTableData(void) { +void StringTable::ProcessStringTableData( + const std::vector& locales) { ByteArrayInputStream bais(src); DataInputStream dis(&bais); @@ -41,9 +45,6 @@ void StringTable::ProcessStringTableData(void) { langSize)); } - std::vector locales; - app.getLocale(locales); - bool foundLang = false; int64_t bytesToSkip = 0; int dataSize = 0; @@ -55,8 +56,8 @@ void StringTable::ProcessStringTableData(void) { for (auto it = langSizeMap.begin(); it != langSizeMap.end(); ++it) { if (it->first.compare(*it_locales) == 0) { - app.DebugPrintf("StringTable:: Found language '%s'.\n", - it_locales->c_str()); + Log::info("StringTable:: Found language '%s'.\n", + it_locales->c_str()); dataSize = it->second; foundLang = true; break; @@ -66,8 +67,8 @@ void StringTable::ProcessStringTableData(void) { } if (!foundLang) - app.DebugPrintf("StringTable:: Can't find language '%s'.\n", - it_locales->c_str()); + Log::info("StringTable:: Can't find language '%s'.\n", + it_locales->c_str()); } if (foundLang) { @@ -91,8 +92,8 @@ void StringTable::ProcessStringTableData(void) { std::string langId = dis2.readUTF(); int totalStrings = dis2.readInt(); - app.DebugPrintf("IsStatic=%d totalStrings = %d\n", isStatic ? 1 : 0, - totalStrings); + Log::info("IsStatic=%d totalStrings = %d\n", isStatic ? 1 : 0, + totalStrings); if (!isStatic) { for (int i = 0; i < totalStrings; ++i) { @@ -112,7 +113,7 @@ void StringTable::ProcessStringTableData(void) { // We can't delete this data in the dtor, so clear the reference bais2.reset(); } else { - app.DebugPrintf("Failed to get language\n"); + Log::info("Failed to get language\n"); #ifdef _DEBUG assert(0); #endif diff --git a/targets/minecraft/locale/StringTable.h b/targets/minecraft/locale/StringTable.h index 52b6ea04d..aef23eca1 100644 --- a/targets/minecraft/locale/StringTable.h +++ b/targets/minecraft/locale/StringTable.h @@ -54,9 +54,10 @@ public: // }; StringTable(void); - StringTable(std::uint8_t* pbData, unsigned int dataSize); + StringTable(std::uint8_t* pbData, unsigned int dataSize, + const std::vector& locales); ~StringTable(void); - void ReloadStringTable(); + void ReloadStringTable(const std::vector& locales); void getData(std::uint8_t** ppData, unsigned int* pSize); @@ -67,5 +68,5 @@ public: private: // std::string getLangId(uint32_t dwLanguage=0); - void ProcessStringTableData(void); + void ProcessStringTableData(const std::vector& locales); }; diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index aefd496ad..75324ed89 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -284,6 +284,7 @@ core/FacingEnum.cpp core/ItemDispenseBehaviors.cpp locale/I18n.cpp locale/Language.cpp +locale/StringTable.cpp network/Connection.cpp network/packet/AddEntityPacket.cpp network/packet/AddExperienceOrbPacket.cpp From 80019158da0fa1a10fda5be1f1ba6b274664c7fc Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:59:00 +1000 Subject: [PATCH 042/104] fix: harden Log::info, switch StringTable to span, consolidate getLocale --- .../app/common/DLC/DLCLocalisationFile.cpp | 5 ++--- targets/app/common/DLC/DLCPack.cpp | 4 +--- targets/app/common/Game.h | 5 +++++ .../app/common/GameRules/GameRuleManager.cpp | 5 +---- targets/app/common/LocalizationManager.cpp | 3 +-- .../IUIScene_StartGame.cpp | 7 +++---- targets/minecraft/locale/StringTable.cpp | 11 +++++----- targets/minecraft/locale/StringTable.h | 13 ++++++------ .../minecraft/server/level/ServerLevel.cpp | 2 +- targets/minecraft/util/Log.h | 11 ++++++++++ .../world/entity/projectile/Arrow.cpp | 2 +- targets/minecraft/world/level/Explosion.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 4 ++-- .../storage/ChunkStorageProfileDecorator.cpp | 4 ++-- .../chunk/storage/McRegionChunkStorage.cpp | 6 +++--- .../level/chunk/storage/OldChunkStorage.cpp | 6 +++--- .../level/storage/DirectoryLevelStorage.cpp | 20 ++++++++++++------- 17 files changed, 61 insertions(+), 49 deletions(-) diff --git a/targets/app/common/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp index 343faad53..5eb68ad59 100644 --- a/targets/app/common/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -12,7 +12,6 @@ DLCLocalisationFile::DLCLocalisationFile(const std::string& path) void DLCLocalisationFile::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { - std::vector locales; - app.getLocale(locales); - m_strings = new StringTable(pbData, dataBytes, locales); + m_strings = new StringTable( + std::span(pbData, dataBytes), app.getLocale()); } diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 20bef9ed6..56accae69 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -351,8 +351,6 @@ void DLCPack::UpdateLanguage() { DLCLocalisationFile* localisationFile = (DLCLocalisationFile*)getFile( DLCManager::e_DLCType_LocalisationData, "languages.loc"); StringTable* strTable = localisationFile->getStringTable(); - std::vector locales; - app.getLocale(locales); - strTable->ReloadStringTable(locales); + strTable->ReloadStringTable(app.getLocale()); } } diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index c31ea2c70..0a1cca1b7 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -1177,6 +1177,11 @@ public: void getLocale(std::vector& vecWstrLocales) { m_localizationManager.getLocale(vecWstrLocales); } + [[nodiscard]] std::vector getLocale() { + std::vector v; + m_localizationManager.getLocale(v); + return v; + } int get_eMCLang(char* pwchLocale) { return m_localizationManager.get_eMCLang(pwchLocale); } diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 39fb980e0..c86544f6a 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -223,10 +223,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions* lgo, uint8_t* dIn, unsigned int bStringTableSize = dis2.readInt(); std::vector bStringTable(bStringTableSize); dis2.read(bStringTable); - std::vector locales; - app.getLocale(locales); - StringTable* strings = - new StringTable(bStringTable.data(), bStringTable.size(), locales); + StringTable* strings = new StringTable(bStringTable, app.getLocale()); // Read RuleFile. std::vector bRuleFile(content.size() - bStringTable.size()); diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 7048b8fc1..9a2210b50 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -79,8 +79,7 @@ void LocalizationManager::loadStringTable(ArchiveFile* mediaArchive) { std::vector locFile = mediaArchive->getFile(localisationFile); std::vector locales; getLocale(locales); - m_stringTable = - new StringTable(locFile.data(), locFile.size(), locales); + m_stringTable = new StringTable(locFile, locales); } else { m_stringTable = nullptr; assert(false); 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 499e9ca4a..65463dfd2 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 @@ -145,10 +145,9 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { app.GetFileFromTPD(eTPDFileType_Loc, pbData, dwBytes, &pbFileData, &dwFileBytes); if (dwFileBytes > 0 && pbFileData) { - std::vector locales; - app.getLocale(locales); - StringTable* pStringTable = - new StringTable(pbFileData, dwFileBytes, locales); + StringTable* pStringTable = new StringTable( + std::span(pbFileData, dwFileBytes), + app.getLocale()); m_texturePackTitle.SetText( pStringTable->getString("IDS_DISPLAY_NAME")); m_texturePackDescription.SetText( diff --git a/targets/minecraft/locale/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp index e19c49d63..427e77ddf 100644 --- a/targets/minecraft/locale/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -13,14 +13,13 @@ StringTable::StringTable(void) {} // localisation data only. The caller passes the locale list it wants // matched (typically obtained from the LocalizationManager) so that // StringTable does not have to know about app-side singletons. -StringTable::StringTable(std::uint8_t* pbData, unsigned int dataSize, - const std::vector& locales) { - src = std::vector(pbData, pbData + dataSize); - +StringTable::StringTable(std::span data, + std::span locales) + : src(data.begin(), data.end()) { ProcessStringTableData(locales); } -void StringTable::ReloadStringTable(const std::vector& locales) { +void StringTable::ReloadStringTable(std::span locales) { m_stringsMap.clear(); m_stringsVec.clear(); @@ -28,7 +27,7 @@ void StringTable::ReloadStringTable(const std::vector& locales) { } void StringTable::ProcessStringTableData( - const std::vector& locales) { + std::span locales) { ByteArrayInputStream bais(src); DataInputStream dis(&bais); diff --git a/targets/minecraft/locale/StringTable.h b/targets/minecraft/locale/StringTable.h index aef23eca1..2090117c1 100644 --- a/targets/minecraft/locale/StringTable.h +++ b/targets/minecraft/locale/StringTable.h @@ -1,11 +1,12 @@ #pragma once #include +#include #include #include #include -#define LOCALE_COUNT 11 +inline constexpr int kLocaleCount = 11; class StringTable { private: @@ -54,19 +55,17 @@ public: // }; StringTable(void); - StringTable(std::uint8_t* pbData, unsigned int dataSize, - const std::vector& locales); + StringTable(std::span data, + std::span locales); ~StringTable(void); - void ReloadStringTable(const std::vector& locales); + void ReloadStringTable(std::span locales); void getData(std::uint8_t** ppData, unsigned int* pSize); const char* getString(const std::string& id); const char* getString(int id); - // static const char* m_wchLocaleCode[LOCALE_COUNT]; - private: // std::string getLangId(uint32_t dwLanguage=0); - void ProcessStringTableData(const std::vector& locales); + void ProcessStringTableData(std::span locales); }; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index ce522df1b..3f55b305f 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -729,7 +729,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, } } else { if (!toBeTicked.empty()) { - Log::info("To be ticked size: %d\n", toBeTicked.size()); + Log::info("To be ticked size: %zu\n", toBeTicked.size()); } for (auto it = toBeTicked.begin(); it != toBeTicked.end();) { TickNextTickData td = *it; diff --git a/targets/minecraft/util/Log.h b/targets/minecraft/util/Log.h index ee70d553b..b353b244d 100644 --- a/targets/minecraft/util/Log.h +++ b/targets/minecraft/util/Log.h @@ -5,11 +5,22 @@ namespace Log { +#if defined(_FINAL_BUILD) +// In shipping builds, info traces compile to nothing - matches the +// historical Game::DebugPrintf behaviour. The varargs path is +// completely elided so format strings and their arguments are not +// even constructed. +inline void info(const char* /*fmt*/, ...) {} +#else +#if defined(__GNUC__) || defined(__clang__) +[[gnu::format(printf, 1, 2)]] +#endif inline void info(const char* fmt, ...) { va_list args; va_start(args, fmt); std::vfprintf(stderr, fmt, args); va_end(args); } +#endif } // namespace Log diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index e8a27a1bc..cc40c8949 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -182,7 +182,7 @@ void Arrow::lerpMotion(double xd, double yd, double zd) { xRotO = xRot = (float)(atan2(yd, sd) * 180 / std::numbers::pi); xRotO = xRot; yRotO = yRot; - Log::info("%f %f : 0x%x\n", xRot, yRot, &yRot); + Log::info("%f %f : %p\n", xRot, yRot, static_cast(&yRot)); moveTo(x, y, z, yRot, xRot); life = 0; } diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index e942a9d4a..15f911881 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -206,7 +206,7 @@ void Explosion::finalizeExplosion( if (destroyBlocks) { // toBlowArray.addAll(toBlow); // TODO 4J Stu - Reverse iterator - Log::info("Finalizing explosion size %d\n", toBlow.size()); + Log::info("Finalizing explosion size %zu\n", toBlow.size()); static const int MAX_EXPLODE_PARTICLES = 50; // 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 1b984f1f9..9dd7dab78 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -3872,8 +3872,8 @@ void Level::setGameTime(int64_t time) { // time passing so ignore (moving dimensions does this) Log::info( "Level::setTime: Massive time difference, ignoring for time " - "passed stat (%lli)\n", - timeDiff); + "passed stat (%lld)\n", + static_cast(timeDiff)); timeDiff = 0; } diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index 782074473..b2292f58e 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -54,7 +54,7 @@ void ChunkStorageProfilerDecorator::tick() { 0.000001 * (double)timeSpentLoading / (double)loadCount, loadCount); #endif - Log::info(buf); + Log::info("%s", buf); #endif } if (saveCount > 0) { @@ -68,7 +68,7 @@ void ChunkStorageProfilerDecorator::tick() { 0.000001 * (double)timeSpentSaving / (double)loadCount, loadCount); #endif - Log::info(buf); + Log::info("%s", buf); #endif } counter = 0; diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index f7dd05eda..ebad12c81 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -144,7 +144,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); delete chunkData; return nullptr; } @@ -153,7 +153,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); delete chunkData; return nullptr; } @@ -165,7 +165,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { "Chunk file at %d, %d is in the wrong location; " "relocating. Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - Log::info(buf); + Log::info("%s", buf); delete levelChunk; delete chunkData; return nullptr; diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index eff498ad8..5ccd24a96 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -134,7 +134,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing level data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); return nullptr; } if (!tag->getCompound("Level")->contains("Blocks")) { @@ -142,7 +142,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { sprintf(buf, "Chunk file at %d, %d is missing block data, skipping\n", x, z); - Log::info(buf); + Log::info("%s", buf); return nullptr; } LevelChunk* levelChunk = @@ -153,7 +153,7 @@ LevelChunk* OldChunkStorage::load(Level* level, int x, int z) { "Chunk fileat %d, %d is in the wrong location; relocating. " "Expected %d, %d, got %d, %d\n", x, z, x, z, levelChunk->x, levelChunk->z); - Log::info(buf); + Log::info("%s", buf); tag->putInt("xPos", x); tag->putInt("zPos", z); levelChunk = diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index c3881941d..4f4631e1f 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -164,8 +164,9 @@ void DirectoryLevelStorage::PlayerMappings::writeMappings( DataOutputStream* dos) { dos->writeInt(m_mappings.size()); for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { - Log::info(" -- %lld (0x%016llx) = %d\n", it->first, it->first, - it->second); + Log::info(" -- %lld (0x%016llx) = %d\n", + static_cast(it->first), + static_cast(it->first), it->second); dos->writeLong(it->first); dos->writeInt(it->second); } @@ -177,7 +178,9 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream* dis) { int64_t index = dis->readLong(); int id = dis->readInt(); m_mappings[index] = id; - Log::info(" -- %lld (0x%016llx) = %d\n", index, index, id); + Log::info(" -- %lld (0x%016llx) = %d\n", + static_cast(index), + static_cast(index), id); } } #endif @@ -278,10 +281,12 @@ LevelData* DirectoryLevelStorage::prepareLevel() { for (unsigned int i = 0; i < count; ++i) { PlayerUID playerUid = dis.readPlayerUID(); #if defined(_WINDOWS64) || defined(__linux__) - Log::info(" -- %d\n", playerUid); + Log::info(" -- %llu\n", + static_cast(playerUid)); #else #if defined(__linux__) - Log::info(" -- %d\n", playerUid); + Log::info(" -- %llu\n", + static_cast(playerUid)); #else Log::info(" -- %s\n", playerUid.toWString().c_str()); #endif @@ -633,11 +638,12 @@ void DirectoryLevelStorage::saveMapIdLookup() { ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeInt(m_playerMappings.size()); - Log::info("Saving %d mappings\n", m_playerMappings.size()); + Log::info("Saving %zu mappings\n", m_playerMappings.size()); for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); ++it) { #if defined(_WINDOWS64) || defined(__linux__) - Log::info(" -- %d\n", it->first); + Log::info(" -- %llu\n", + static_cast(it->first)); #else #if defined(__linux__) Log::info(" -- %d\n", it->first); From 8b202ba5f132bc2aee4c39d52467f76af6fd88fb Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:11:41 +1000 Subject: [PATCH 043/104] refactor: extract ISkinAssetData so minecraft/ stops including DLCSkinFile.h --- targets/app/common/AppGameServices.cpp | 3 +- targets/app/common/AppGameServices.h | 3 +- targets/app/common/DLC/DLCSkinFile.h | 29 ++++++++++++------- targets/minecraft/IGameServices.h | 4 +-- .../client/multiplayer/ClientConnection.cpp | 12 ++++---- .../minecraft/client/skins/ISkinAssetData.h | 26 +++++++++++++++++ .../packet/TextureAndGeometryPacket.cpp | 11 +++---- .../network/packet/TextureAndGeometryPacket.h | 4 +-- .../server/network/PlayerConnection.cpp | 20 ++++++------- .../minecraft/world/entity/player/Player.cpp | 28 +++++++++--------- 10 files changed, 89 insertions(+), 51 deletions(-) create mode 100644 targets/minecraft/client/skins/ISkinAssetData.h diff --git a/targets/app/common/AppGameServices.cpp b/targets/app/common/AppGameServices.cpp index 74ce03d03..560fab883 100644 --- a/targets/app/common/AppGameServices.cpp +++ b/targets/app/common/AppGameServices.cpp @@ -1,5 +1,6 @@ #include "app/common/AppGameServices.h" +#include "app/common/DLC/DLCSkinFile.h" #include "app/common/Game.h" #include "java/Class.h" // eINSTANCEOF #include "platform/game/game.h" @@ -386,7 +387,7 @@ void AppGameServices::debugPrintf(const char* msg) { // -- DLC -- -DLCSkinFile* AppGameServices::getDLCSkinFile(const std::string& name) { +ISkinAssetData* AppGameServices::getSkinAssetData(const std::string& name) { return game_.m_dlcManager.getSkinFile(name); } bool AppGameServices::dlcNeedsCorruptCheck() { diff --git a/targets/app/common/AppGameServices.h b/targets/app/common/AppGameServices.h index 6e2e4d9bf..0cfb98a17 100644 --- a/targets/app/common/AppGameServices.h +++ b/targets/app/common/AppGameServices.h @@ -4,6 +4,7 @@ class Game; class IMenuService; +class ISkinAssetData; class AppGameServices : public IGameServices { public: @@ -150,7 +151,7 @@ public: void debugPrintf(const char* msg) override; // -- DLC -- - DLCSkinFile* getDLCSkinFile(const std::string& name) override; + ISkinAssetData* getSkinAssetData(const std::string& name) override; bool dlcNeedsCorruptCheck() override; unsigned int dlcCheckForCorrupt(bool showMessage) override; bool dlcReadDataFile(unsigned int& filesProcessed, const std::string& path, diff --git a/targets/app/common/DLC/DLCSkinFile.h b/targets/app/common/DLC/DLCSkinFile.h index fbcc7c2ef..81b3fdfde 100644 --- a/targets/app/common/DLC/DLCSkinFile.h +++ b/targets/app/common/DLC/DLCSkinFile.h @@ -8,8 +8,9 @@ #include "app/common/DLC/DLCManager.h" #include "minecraft/client/model/HumanoidModel.h" #include "minecraft/client/model/SkinBox.h" +#include "minecraft/client/skins/ISkinAssetData.h" -class DLCSkinFile : public DLCFile { +class DLCSkinFile : public DLCFile, public ISkinAssetData { private: std::string m_displayName; std::string m_themeName; @@ -21,15 +22,23 @@ private: public: DLCSkinFile(const std::string& path); - virtual void addData(std::uint8_t* pbData, std::uint32_t dataBytes); - virtual void addParameter(DLCManager::EDLCParameterType type, - const std::string& value); + void addData(std::uint8_t* pbData, std::uint32_t dataBytes) override; + void addParameter(DLCManager::EDLCParameterType type, + const std::string& value) override; + + std::string getParameterAsString( + DLCManager::EDLCParameterType type) override; + bool getParameterAsBool(DLCManager::EDLCParameterType type) override; + + // ISkinAssetData + [[nodiscard]] std::uint32_t getSkinID() override { + return DLCFile::getSkinID(); + } + [[nodiscard]] unsigned int getAnimOverrideBitmask() override { + return m_uiAnimOverrideBitmask; + } + [[nodiscard]] int getAdditionalBoxesCount() override; + [[nodiscard]] std::vector* getAdditionalBoxes() override; - virtual std::string getParameterAsString( - DLCManager::EDLCParameterType type); - virtual bool getParameterAsBool(DLCManager::EDLCParameterType type); - std::vector* getAdditionalBoxes(); - int getAdditionalBoxesCount(); - unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask; } bool isFree() { return m_bIsFree; } }; diff --git a/targets/minecraft/IGameServices.h b/targets/minecraft/IGameServices.h index a4453d2b5..54141a47b 100644 --- a/targets/minecraft/IGameServices.h +++ b/targets/minecraft/IGameServices.h @@ -11,7 +11,7 @@ class LevelChunk; class ModelPart; // Forward declarations -class DLCSkinFile; +class ISkinAssetData; class DLCPack; #include "minecraft/GameEnums.h" @@ -199,7 +199,7 @@ public: // -- DLC -- - [[nodiscard]] virtual DLCSkinFile* getDLCSkinFile( + [[nodiscard]] virtual ISkinAssetData* getSkinAssetData( const std::string& name) = 0; [[nodiscard]] virtual bool dlcNeedsCorruptCheck() = 0; virtual unsigned int dlcCheckForCorrupt(bool showMessage = true) = 0; diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index dee511bc8..b96a3a618 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -16,7 +16,7 @@ #include "app/common/ConsoleGameMode.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/DLC/DLCSkinFile.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/Tutorial/Tutorial.h" @@ -2313,16 +2313,16 @@ void ClientConnection::handleTextureAndGeometry( unsigned int dwBytes = 0; gameServices().getMemFileDetails(packet->textureName, &pbData, &dwBytes); - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(packet->textureName); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(packet->textureName); if (dwBytes != 0) { - if (pDLCSkinFile) { - if (pDLCSkinFile->getAdditionalBoxesCount() != 0) { + if (pSkinAsset) { + if (pSkinAsset->getAdditionalBoxesCount() != 0) { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, pbData, dwBytes, - pDLCSkinFile))); + pSkinAsset))); } else { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, diff --git a/targets/minecraft/client/skins/ISkinAssetData.h b/targets/minecraft/client/skins/ISkinAssetData.h new file mode 100644 index 000000000..2b5df49c7 --- /dev/null +++ b/targets/minecraft/client/skins/ISkinAssetData.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include + +#include "minecraft/client/model/SkinBox.h" + +// Domain-shaped view of a custom skin asset. +// +// minecraft/ consumers (Player, the client/server connection layers, +// the texture packet) need a handful of fields off a custom skin +// asset: the skin id, the additional body parts geometry, and an +// animation override mask. Historically those fields were read off +// app/common/DLC/DLCSkinFile, which dragged the entire DLC subsystem +// up into minecraft/ headers and broke the layering invariant. +// +// This interface is the domain abstraction. The DLC implementation in +// app/ inherits from it; minecraft/ only ever sees ISkinAssetData. +class ISkinAssetData { +public: + virtual ~ISkinAssetData() = default; + + [[nodiscard]] virtual std::uint32_t getSkinID() = 0; + [[nodiscard]] virtual unsigned int getAnimOverrideBitmask() = 0; + [[nodiscard]] virtual int getAdditionalBoxesCount() = 0; + [[nodiscard]] virtual std::vector* getAdditionalBoxes() = 0; +}; diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp index 9f845a138..2f03ec0f7 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.cpp @@ -4,10 +4,10 @@ #include #include "PacketListener.h" -#include "app/common/DLC/DLCSkinFile.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Minecraft_Macros.h" +#include "minecraft/client/skins/ISkinAssetData.h" TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = ""; @@ -51,7 +51,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( TextureAndGeometryPacket::TextureAndGeometryPacket( const std::string& textureName, std::uint8_t* pbData, - std::uint32_t dataBytes, DLCSkinFile* pDLCSkinFile) { + std::uint32_t dataBytes, ISkinAssetData* pSkinAssetData) { this->textureName = textureName; std::string skinValue = textureName.substr(7, textureName.size()); @@ -63,11 +63,12 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( this->pbData = pbData; this->dwTextureBytes = dataBytes; - this->uiAnimOverrideBitmask = pDLCSkinFile->getAnimOverrideBitmask(); - this->dwBoxC = pDLCSkinFile->getAdditionalBoxesCount(); + this->uiAnimOverrideBitmask = pSkinAssetData->getAnimOverrideBitmask(); + this->dwBoxC = pSkinAssetData->getAdditionalBoxesCount(); if (this->dwBoxC != 0) { this->BoxDataA = new SKIN_BOX[this->dwBoxC]; - std::vector* pSkinBoxes = pDLCSkinFile->getAdditionalBoxes(); + std::vector* pSkinBoxes = + pSkinAssetData->getAdditionalBoxes(); int iCount = 0; for (auto it = pSkinBoxes->begin(); it != pSkinBoxes->end(); ++it) { diff --git a/targets/minecraft/network/packet/TextureAndGeometryPacket.h b/targets/minecraft/network/packet/TextureAndGeometryPacket.h index 8b7548c9f..d8e49fd16 100644 --- a/targets/minecraft/network/packet/TextureAndGeometryPacket.h +++ b/targets/minecraft/network/packet/TextureAndGeometryPacket.h @@ -10,7 +10,7 @@ #include "minecraft/client/model/geom/Model.h" #include "minecraft/network/packet/Packet.h" -class DLCSkinFile; +class ISkinAssetData; class TextureAndGeometryPacket : public Packet, @@ -30,7 +30,7 @@ public: std::uint8_t* pbData, std::uint32_t dataBytes); TextureAndGeometryPacket(const std::string& textureName, std::uint8_t* pbData, std::uint32_t dataBytes, - DLCSkinFile* pDLCSkinFile); + ISkinAssetData* pSkinAssetData); TextureAndGeometryPacket(const std::string& textureName, std::uint8_t* pbData, std::uint32_t dataBytes, std::vector* pvSkinBoxes, diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 4c80c8c36..c91c881bc 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -9,7 +9,6 @@ #include #include "ServerConnection.h" -#include "app/common/DLC/DLCSkinFile.h" #include "app/common/Network/Socket.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -24,6 +23,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/model/SkinBox.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "minecraft/commands/CommandDispatcher.h" #include "minecraft/commands/CommandsEnum.h" #include "minecraft/network/Connection.h" @@ -850,16 +850,16 @@ void PlayerConnection::handleTextureAndGeometry( unsigned int dwTextureBytes = 0; gameServices().getMemFileDetails(packet->textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(packet->textureName); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(packet->textureName); if (dwTextureBytes != 0) { - if (pDLCSkinFile) { - if (pDLCSkinFile->getAdditionalBoxesCount() != 0) { + if (pSkinAsset) { + if (pSkinAsset->getAdditionalBoxesCount() != 0) { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, pbData, dwTextureBytes, - pDLCSkinFile))); + pSkinAsset))); } else { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, @@ -938,14 +938,14 @@ void PlayerConnection::handleTextureAndGeometryReceived( std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; gameServices().getMemFileDetails(textureName, &pbData, &dwTextureBytes); - DLCSkinFile* pDLCSkinFile = gameServices().getDLCSkinFile(textureName); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(textureName); if (dwTextureBytes != 0) { - if (pDLCSkinFile && - (pDLCSkinFile->getAdditionalBoxesCount() != 0)) { + if (pSkinAsset && (pSkinAsset->getAdditionalBoxesCount() != 0)) { send(std::shared_ptr( new TextureAndGeometryPacket( - textureName, pbData, dwTextureBytes, pDLCSkinFile))); + textureName, pbData, dwTextureBytes, pSkinAsset))); } else { // get the data from the app std::uint32_t dwSkinID = diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index ab6107849..d6acd2f98 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -22,7 +22,7 @@ #include "Inventory.h" #include "Player.h" #include "app/common/App_structs.h" -#include "app/common/DLC/DLCSkinFile.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -584,23 +584,23 @@ void Player::setCustomSkin(std::uint32_t skinId) { Log::info("Couldn't get model parts for skin %X\n",m_dwSkinId); // do we have it from the DLC pack? - DLCSkinFile *pDLCSkinFile = - gameServices().getDLCSkinFile(this->customTextureUrl); + ISkinAssetData *pSkinAsset = + gameServices().getSkinAssetData(this->customTextureUrl); - if(pDLCSkinFile!=nullptr) + if(pSkinAsset!=nullptr) { const int additionalBoxCount = - pDLCSkinFile->getAdditionalBoxesCount(); if(additionalBoxCount != 0) + pSkinAsset->getAdditionalBoxesCount(); if(additionalBoxCount != 0) { Log::info("Got model parts from DLCskin for skin %X\n",m_dwSkinId); - pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pDLCSkinFile->getAdditionalBoxes()); + pvModelParts=gameServices().setAdditionalSkinBoxesFromVec(m_dwSkinId,pSkinAsset->getAdditionalBoxes()); this->SetAdditionalModelParts(pvModelParts); } else { this->SetAdditionalModelParts(nullptr); } - gameServices().setAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); + gameServices().setAnimOverrideBitmask(pSkinAsset->getSkinID(),pSkinAsset->getAnimOverrideBitmask()); } else { @@ -2704,12 +2704,12 @@ std::vector* Player::GetAdditionalModelParts() { m_dwSkinId); // do we have it from the DLC pack? - DLCSkinFile* pDLCSkinFile = - gameServices().getDLCSkinFile(this->customTextureUrl); + ISkinAssetData* pSkinAsset = + gameServices().getSkinAssetData(this->customTextureUrl); - if (pDLCSkinFile != nullptr) { + if (pSkinAsset != nullptr) { const int additionalBoxCount = - pDLCSkinFile->getAdditionalBoxesCount(); + pSkinAsset->getAdditionalBoxesCount(); if (additionalBoxCount != 0) { Log::info( "m_bCheckedForModelParts Got model parts from DLCskin " @@ -2717,12 +2717,12 @@ std::vector* Player::GetAdditionalModelParts() { m_dwSkinId); m_ppAdditionalModelParts = gameServices().setAdditionalSkinBoxesFromVec( - m_dwSkinId, pDLCSkinFile->getAdditionalBoxes()); + m_dwSkinId, pSkinAsset->getAdditionalBoxes()); } gameServices().setAnimOverrideBitmask( - pDLCSkinFile->getSkinID(), - pDLCSkinFile->getAnimOverrideBitmask()); + pSkinAsset->getSkinID(), + pSkinAsset->getAnimOverrideBitmask()); m_bCheckedForModelParts = true; } From 4d9db3ed3b580aa514b448fc05f9ceb8ed3a2d03 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:22:07 +1000 Subject: [PATCH 044/104] refactor: hide DLC pack lookups behind TexturePack::needsPurchase and BufferedImage helper --- targets/minecraft/client/BufferedImage.cpp | 56 ++++++---------- targets/minecraft/client/BufferedImage.h | 11 ++-- targets/minecraft/client/Minecraft.cpp | 17 +---- .../client/multiplayer/ClientConnection.cpp | 10 +-- .../minecraft/client/skins/DLCTexturePack.cpp | 49 ++++++++++++-- .../minecraft/client/skins/DLCTexturePack.h | 64 ++++++++++--------- targets/minecraft/client/skins/TexturePack.h | 6 ++ .../minecraft/server/level/ServerLevel.cpp | 10 +-- 8 files changed, 117 insertions(+), 106 deletions(-) diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index dff8e52f9..59048b4ef 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -7,9 +7,6 @@ #include #include "PlatformTypes.h" -#include "app/common/DLC/DLCFile.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" #include "minecraft/IGameServices.h" #include "platform/fs/fs.h" #include "platform/renderer/renderer.h" @@ -121,43 +118,28 @@ BufferedImage::BufferedImage(const std::string& File, bool filenameHasExtension, } } } -BufferedImage::BufferedImage(DLCPack* dlcPack, const std::string& File, - bool filenameHasExtension) { - int32_t hr; - std::string filePath = File; - std::uint8_t* pbData = nullptr; - std::uint32_t dataBytes = 0; +BufferedImage::BufferedImage() { for (int l = 0; l < 10; l++) data[l] = nullptr; + width = 0; + height = 0; +} - for (int l = 0; l < 10; l++) { - std::string name; - std::string mipMapPath = - (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; - name = "res" + (filenameHasExtension - ? filePath - : filePath.substr(0, filePath.length() - 4) + - mipMapPath + ".png"); - - if (!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name)) { - if (l == 0) gameServices().fatalLoadError(); - return; - } - - DLCFile* dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); - pbData = dlcFile->getData(dataBytes); - if (pbData == nullptr || dataBytes == 0) { - if (l == 0) gameServices().fatalLoadError(); - return; - } - - D3DXIMAGE_INFO ImageInfo; - hr = PlatformRenderer.LoadTextureData(pbData, dataBytes, &ImageInfo, - &data[l]); - if (hr == 0 && l == 0) { - width = ImageInfo.Width; - height = ImageInfo.Height; - } +bool BufferedImage::loadMipmapPng(int level, std::uint8_t* bytes, + std::uint32_t numBytes) { + if (level < 0 || level >= 10 || bytes == nullptr || numBytes == 0) { + return false; } + D3DXIMAGE_INFO ImageInfo; + int32_t hr = PlatformRenderer.LoadTextureData(bytes, numBytes, &ImageInfo, + &data[level]); + if (hr != 0) { + return false; + } + if (level == 0) { + width = ImageInfo.Width; + height = ImageInfo.Height; + } + return true; } BufferedImage::BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes) { diff --git a/targets/minecraft/client/BufferedImage.h b/targets/minecraft/client/BufferedImage.h index a5d04d790..d06d1cd79 100644 --- a/targets/minecraft/client/BufferedImage.h +++ b/targets/minecraft/client/BufferedImage.h @@ -4,7 +4,6 @@ #include class Graphics; -class DLCPack; class BufferedImage { private: @@ -15,15 +14,19 @@ private: public: static const int TYPE_INT_ARGB = 0; static const int TYPE_INT_RGB = 1; + BufferedImage(); // empty image; fill with loadMipmapPng() BufferedImage(int width, int height, int type); BufferedImage(const std::string& File, bool filenameHasExtension = false, bool bTitleUpdateTexture = false, - const std::string& drive = ""); // 4J added - BufferedImage(DLCPack* dlcPack, const std::string& File, - bool filenameHasExtension = false); // 4J Added + const std::string& drive = ""); // 4J added BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes); // 4J added ~BufferedImage(); + // Decode `numBytes` of PNG-encoded texture data into mipmap slot + // `level`. The first call (level == 0) populates width/height. + // Returns true on success. + bool loadMipmapPng(int level, std::uint8_t* bytes, std::uint32_t numBytes); + int getWidth(); int getHeight(); void getRGB(int startX, int startY, int w, int h, std::vector& out, diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index be198d829..6b17606d8 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -104,7 +104,6 @@ #include "minecraft/client/gui/inventory/CreativeInventoryScreen.h" #endif #include "app/common/ConsoleGameMode.h" -#include "app/common/DLC/DLCPack.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/UIFontData.h" @@ -123,7 +122,7 @@ #include "minecraft/client/player/Input.h" #include "minecraft/client/renderer/texture/TextureManager.h" #include "minecraft/client/resources/Colours/ColourTable.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/world/entity/npc/Villager.h" #include "minecraft/world/item/alchemy/PotionMacros.h" #include "minecraft/world/level/chunk/SparseDataStorage.h" @@ -1097,18 +1096,8 @@ void Minecraft::run_middle() { TexturePack* tPack = Minecraft::GetInstance() ->skins->getSelected(); - DLCTexturePack* pDLCTexPack = - (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = - pDLCTexPack->getDLCInfoParentPack(); - - if (pDLCPack) { - if (!pDLCPack->hasPurchasedFile( - DLCManager::e_DLCType_Texture, - "")) { - bTrialTexturepack = true; - } + if (tPack->needsPurchase()) { + bTrialTexturepack = true; } } diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index b96a3a618..7a942b299 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -14,8 +14,6 @@ #include "ReceivingLevelScreen.h" #include "app/common/App_structs.h" #include "app/common/ConsoleGameMode.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" #include "minecraft/client/skins/ISkinAssetData.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" @@ -45,7 +43,7 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/player/RemotePlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" @@ -3456,11 +3454,7 @@ int ClientConnection::HostDisconnectReturned( // world if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = - pDLCTexPack->getDLCInfoParentPack(); // tPack->getDLCPack(); - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, "")) { + if (tPack->needsPurchase()) { // no upsell, we're about to quit MinecraftServer::getInstance()->setSaveOnExit(false); // flag a app action of exit game diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 24cdae7cd..36449770b 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -31,6 +31,7 @@ #include "platform/fs/fs.h" #include "platform/input/input.h" #include "platform/storage/storage.h" +#include "util/StringHelpers.h" #if defined(_WINDOWS64) #endif @@ -192,12 +193,41 @@ std::string DLCTexturePack::getAnimationString(const std::string& textureName, BufferedImage* DLCTexturePack::getImageResource( const std::string& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const std::string& drive /*=""*/) { - if (m_dlcDataPack) - return new BufferedImage(m_dlcDataPack, "/" + File, - filenameHasExtension); - else + if (!m_dlcDataPack) { return fallback->getImageResource(File, filenameHasExtension, bTitleUpdateTexture, drive); + } + auto* image = new BufferedImage(); + const std::string filePath = "/" + File; + for (int l = 0; l < 10; l++) { + std::string mipMapPath = + (l != 0) ? "MipMapLevel" + toWString(l + 1) : ""; + std::string name = + "res" + (filenameHasExtension + ? filePath + : filePath.substr(0, filePath.length() - 4) + + mipMapPath + ".png"); + + if (!m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_All, + name)) { + if (l == 0) gameServices().fatalLoadError(); + break; + } + + DLCFile* dlcFile = + m_dlcDataPack->getFile(DLCManager::e_DLCType_All, name); + std::uint32_t dataBytes = 0; + std::uint8_t* pbData = dlcFile->getData(dataBytes); + if (pbData == nullptr || dataBytes == 0) { + if (l == 0) gameServices().fatalLoadError(); + break; + } + + if (!image->loadMipmapPng(l, pbData, dataBytes)) { + break; + } + } + return image; } DLCPack* DLCTexturePack::getDLCPack() { return m_dlcDataPack; } @@ -471,3 +501,14 @@ DLCPack* DLCTexturePack::getDLCInfoParentPack() { XCONTENTDEVICEID DLCTexturePack::GetDLCDeviceID() { return m_dlcInfoPack->GetDLCDeviceID(); } + +bool DLCTexturePack::needsPurchase() { + if (m_dlcInfoPack == nullptr) { + return false; + } + DLCPack* parent = m_dlcInfoPack->GetParentPack(); + if (parent == nullptr) { + return false; + } + return !parent->hasPurchasedFile(DLCManager::e_DLCType_Texture, ""); +} diff --git a/targets/minecraft/client/skins/DLCTexturePack.h b/targets/minecraft/client/skins/DLCTexturePack.h index 4c2d860d9..ed9824aa6 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.h +++ b/targets/minecraft/client/skins/DLCTexturePack.h @@ -27,47 +27,47 @@ public: using AbstractTexturePack::getResource; DLCTexturePack(std::uint32_t id, DLCPack* pack, TexturePack* fallback); - ~DLCTexturePack(){}; + ~DLCTexturePack() override = default; - virtual std::string getResource(const std::string& name); - virtual DLCPack* getDLCPack(); - virtual std::string getDesc1() { + std::string getResource(const std::string& name) override; + DLCPack* getDLCPack() override; + std::string getDesc1() override { return m_stringTable->getString("IDS_TP_DESCRIPTION"); } - virtual std::string getName() { + std::string getName() override { return m_stringTable->getString("IDS_DISPLAY_NAME"); } - virtual std::string getWorldName() { + std::string getWorldName() override { return m_stringTable->getString("IDS_WORLD_NAME"); } // Added for sound banks with MashUp packs protected: //@Override - void loadIcon(); - void loadComparison(); - void loadName(); - void loadDescription(); + void loadIcon() override; + void loadComparison() override; + void loadName() override; + void loadDescription() override; InputStream* getResourceImplementation( - const std::string& name); // throws IOException + const std::string& name) override; // throws IOException public: //@Override - bool hasFile(const std::string& name); - bool isTerrainUpdateCompatible(); + bool hasFile(const std::string& name) override; + bool isTerrainUpdateCompatible() override; // 4J Added - virtual std::string getPath(bool bTitleUpdateTexture = false, - const char* pchBDPatchFilename = nullptr); - virtual std::string getAnimationString(const std::string& textureName, - const std::string& path); - virtual BufferedImage* getImageResource(const std::string& File, - bool filenameHasExtension = false, - bool bTitleUpdateTexture = false, - const std::string& drive = ""); - virtual void loadColourTable(); - virtual bool hasData() { return m_bHasLoadedData; } - virtual bool isLoadingData() { return m_bLoadingData; } + std::string getPath(bool bTitleUpdateTexture = false, + const char* pchBDPatchFilename = nullptr) override; + std::string getAnimationString(const std::string& textureName, + const std::string& path) override; + BufferedImage* getImageResource(const std::string& File, + bool filenameHasExtension = false, + bool bTitleUpdateTexture = false, + const std::string& drive = "") override; + void loadColourTable() override; + bool hasData() override { return m_bHasLoadedData; } + bool isLoadingData() override { return m_bLoadingData; } private: static std::string getRootPath(std::uint32_t packId, bool allowOverride, @@ -78,14 +78,16 @@ private: public: int onPackMounted(int iPad, std::uint32_t dwErr, std::uint32_t dwLicenceMask); - virtual void loadData(); - virtual void loadUI(); - virtual void unloadUI(); - virtual std::string getXuiRootPath(); - virtual ArchiveFile* getArchiveFile() { return m_archiveFile; } + void loadData() override; + void loadUI() override; + void unloadUI() override; + std::string getXuiRootPath() override; + ArchiveFile* getArchiveFile() override { return m_archiveFile; } - virtual unsigned int getDLCParentPackId(); + unsigned int getDLCParentPackId() override; virtual DLCPack* getDLCInfoParentPack(); - virtual unsigned char getDLCSubPackId(); + unsigned char getDLCSubPackId() override; XCONTENTDEVICEID GetDLCDeviceID(); + + [[nodiscard]] bool needsPurchase() override; }; diff --git a/targets/minecraft/client/skins/TexturePack.h b/targets/minecraft/client/skins/TexturePack.h index a959b0558..3881ee2ca 100644 --- a/targets/minecraft/client/skins/TexturePack.h +++ b/targets/minecraft/client/skins/TexturePack.h @@ -47,6 +47,12 @@ return TexturePack.class.getResourceAsStream(name); } virtual DLCPack* getDLCPack() { return nullptr; } + // True for trial skins / texture packs that the user has not yet + // purchased. The default (built-in) skin and any owned DLC pack + // returns false. Used by save and disconnect paths to refuse + // operations that would otherwise unlock paid content for free. + [[nodiscard]] virtual bool needsPurchase() { return false; } + // 4J Added virtual std::string getPath(bool bTitleUpdateTexture = false, const char* pchBDPatchFilename = nullptr); diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 3f55b305f..6a493ffa2 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -11,14 +11,12 @@ #include "ServerChunkCache.h" #include "ServerLevelListener.h" #include "ServerPlayer.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCPack.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" #include "minecraft/network/packet/EntityEventPacket.h" @@ -981,11 +979,7 @@ void ServerLevel::saveToDisc(ProgressListener* progressListener, // the case for going into the mash-up pack world with a trial version) if (!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack* tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)tPack; - - DLCPack* pDLCPack = pDLCTexPack->getDLCInfoParentPack(); - - if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, "")) { + if (tPack->needsPurchase()) { return; } } From 62186f8afb6f6ddef251b1b145395ff5376ac873 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:41:06 +1000 Subject: [PATCH 045/104] refactor: relocate ConsoleSoundEngine base into minecraft/sounds/ --- .../app/common/Audio/Consoles_SoundEngine.cpp | 24 ------- targets/app/common/Audio/SoundEngine.cpp | 39 +----------- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/Audio/SoundNames.cpp | 2 +- targets/app/common/Game.h | 2 +- targets/app/common/Game_XuiActions.cpp | 11 ++-- targets/app/common/UI/UIController.cpp | 8 ++- targets/app/common_sources.txt | 1 - targets/app/linux/Linux_UIController.cpp | 1 + targets/minecraft/client/Minecraft.h | 4 +- targets/minecraft/client/Options.cpp | 2 +- targets/minecraft/client/gui/Screen.cpp | 2 +- .../client/gui/achievement/StatsScreen.cpp | 2 +- .../multiplayer/MultiPlayerGameMode.cpp | 2 +- .../client/multiplayer/MultiPlayerLevel.cpp | 2 +- .../minecraft/client/player/LocalPlayer.cpp | 2 +- .../client/renderer/LevelRenderer.cpp | 2 +- .../minecraft/client/skins/DLCTexturePack.cpp | 13 ++-- .../minecraft/sounds/ConsoleSoundEngine.cpp | 62 +++++++++++++++++++ .../sounds/ConsoleSoundEngine.h} | 7 +++ targets/minecraft/sources.txt | 1 + 21 files changed, 104 insertions(+), 87 deletions(-) delete mode 100644 targets/app/common/Audio/Consoles_SoundEngine.cpp create mode 100644 targets/minecraft/sounds/ConsoleSoundEngine.cpp rename targets/{app/common/Audio/Consoles_SoundEngine.h => minecraft/sounds/ConsoleSoundEngine.h} (88%) diff --git a/targets/app/common/Audio/Consoles_SoundEngine.cpp b/targets/app/common/Audio/Consoles_SoundEngine.cpp deleted file mode 100644 index 57d54565b..000000000 --- a/targets/app/common/Audio/Consoles_SoundEngine.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "Consoles_SoundEngine.h" - -bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() { - return m_bIsPlayingStreamingCDMusic; -} -bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() { - return m_bIsPlayingStreamingGameMusic; -} -void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) { - m_bIsPlayingStreamingCDMusic = bVal; -} -void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) { - m_bIsPlayingStreamingGameMusic = bVal; -} -bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; } -bool ConsoleSoundEngine::GetIsPlayingNetherMusic() { - return m_bIsPlayingNetherMusic; -} -void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) { - m_bIsPlayingEndMusic = bVal; -} -void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) { - m_bIsPlayingNetherMusic = bVal; -} diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 76abaccbe..5883cb5ac 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -10,7 +10,7 @@ #include #include -#include "app/common/Audio/Consoles_SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" @@ -1938,40 +1938,3 @@ char* SoundEngine::ConvertSoundPathToName(const std::string& name, return nullptr; } -void ConsoleSoundEngine::tick() { - if (scheduledSounds.empty()) { - return; - } - - for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) { - SoundEngine::ScheduledSound* next = *it; - next->delay--; - - if (next->delay <= 0) { - play(next->iSound, next->x, next->y, next->z, next->volume, - next->pitch); - it = scheduledSounds.erase(it); - delete next; - } else { - ++it; - } - } -} - -void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z, - float volume, float pitch, int delayTicks) { - scheduledSounds.push_back(new SoundEngine::ScheduledSound( - iSound, x, y, z, volume, pitch, delayTicks)); -} - -ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y, - float z, float volume, - float pitch, int delay) { - this->iSound = iSound; - this->x = x; - this->y = y; - this->z = z; - this->volume = volume; - this->pitch = pitch; - this->delay = delay; -} diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index f4e604b39..99b5a707d 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -7,7 +7,7 @@ class Random; #include #include -#include "app/common/Audio/Consoles_SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/sounds/SoundTypes.h" #include "platform/PlatformTypes.h" diff --git a/targets/app/common/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp index dd44c7f52..8d390cb72 100644 --- a/targets/app/common/Audio/SoundNames.cpp +++ b/targets/app/common/Audio/SoundNames.cpp @@ -1,4 +1,4 @@ -#include "Consoles_SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "minecraft/sounds/SoundTypes.h" const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 0a1cca1b7..557a6d7a8 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -11,7 +11,7 @@ #include "app/common/App_structs.h" #include "app/common/ArchiveManager.h" -#include "app/common/Audio/Consoles_SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "app/common/BannedListManager.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLCController.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 0616a5d7b..dde40f3ce 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -993,10 +993,13 @@ void Game::HandleXuiActions(void) { // need to stop the streaming audio - by playing // streaming audio from the default texture pack now // reset the streaming sounds back to the normal ones - pMinecraft->soundEngine->SetStreamingSounds( - eStream_Overworld_Calm1, eStream_Overworld_piano3, - eStream_Nether1, eStream_Nether4, - eStream_end_dragon, eStream_end_end, eStream_CD_1); + static_cast(pMinecraft->soundEngine) + ->SetStreamingSounds(eStream_Overworld_Calm1, + eStream_Overworld_piano3, + eStream_Nether1, + eStream_Nether4, + eStream_end_dragon, + eStream_end_end, eStream_CD_1); pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1, 1); diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 8655de601..f4a1e559e 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -1354,9 +1354,11 @@ void UIController::NavigateToHomeMenu() { // need to stop the streaming audio - by playing streaming audio from // the default texture pack now reset the streaming sounds back to the // normal ones - pMinecraft->soundEngine->SetStreamingSounds( - eStream_Overworld_Calm1, eStream_Overworld_piano3, eStream_Nether1, - eStream_Nether4, eStream_end_dragon, eStream_end_end, eStream_CD_1); + static_cast(pMinecraft->soundEngine) + ->SetStreamingSounds(eStream_Overworld_Calm1, + eStream_Overworld_piano3, eStream_Nether1, + eStream_Nether4, eStream_end_dragon, + eStream_end_end, eStream_CD_1); pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1, 1); // if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index cab1ba816..b2f71748c 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -1,6 +1,5 @@ common/AppGameServices.cpp common/ArchiveManager.cpp -common/Audio/Consoles_SoundEngine.cpp common/Audio/SoundEngine.cpp common/Audio/SoundNames.cpp common/BannedListManager.cpp diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/linux/Linux_UIController.cpp index 642b672be..8d1871446 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/linux/Linux_UIController.cpp @@ -2,6 +2,7 @@ // GDraw GL backend for Linux #include "platform/renderer/renderer.h" +#include "renderer/gl/gl_compat.h" #include "Linux_UIController.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Iggy/gdraw/gdraw.h" diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index f728e66a0..0d4b83764 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -31,7 +31,7 @@ class BackgroundDownloader; class HumanoidModel; class HitResult; class Options; -class SoundEngine; +class ConsoleSoundEngine; class IPlatformLeaderboard; class MinecraftApplet; class MouseHandler; @@ -191,7 +191,7 @@ protected: MinecraftApplet* minecraftApplet; public: - SoundEngine* soundEngine; + ConsoleSoundEngine* soundEngine; MouseHandler* mouseHandler; public: diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index c0fd1f95a..e585fb3f2 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,7 +1,7 @@ #include "Options.h" #include "KeyMapping.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 86e51b9f1..1fb75ec16 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,7 +1,7 @@ #include "Screen.h" #include "Button.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index 512450ca1..2426fb71e 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,5 +1,5 @@ #include "StatsScreen.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 054300597..777df3e5c 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -4,7 +4,7 @@ #include "ClientConnection.h" #include "MultiPlayerLevel.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "java/Class.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index b5c9c5e38..3285549e6 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -12,7 +12,7 @@ #include "ClientConnection.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Console_Debug_enum.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index f24cf33af..506d38c0d 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -31,7 +31,7 @@ #include "PlatformTypes.h" #include "Pos.h" #include "app/common/App_structs.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 4d80b0502..c9b638797 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -15,7 +15,7 @@ #include "Chunk.h" #include "GameRenderer.h" #include "Tesselator.h" -#include "app/common/Audio/SoundEngine.h" +#include "minecraft/sounds/ConsoleSoundEngine.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 36449770b..9776bf8ec 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -409,11 +409,14 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, iEndC = dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End); - Minecraft::GetInstance()->soundEngine->SetStreamingSounds( - iOverworldStart, iOverworldStart + iOverworldC, - iNetherStart, iNetherStart + iNetherC, iEndStart, - iEndStart + iEndC, - iEndStart + iEndC); // push the CD start to after + static_cast( + Minecraft::GetInstance()->soundEngine) + ->SetStreamingSounds( + iOverworldStart, iOverworldStart + iOverworldC, + iNetherStart, iNetherStart + iNetherC, iEndStart, + iEndStart + iEndC, + iEndStart + + iEndC); // push the CD start to after } } texturePack->loadColourTable(); diff --git a/targets/minecraft/sounds/ConsoleSoundEngine.cpp b/targets/minecraft/sounds/ConsoleSoundEngine.cpp new file mode 100644 index 000000000..f8ffdd212 --- /dev/null +++ b/targets/minecraft/sounds/ConsoleSoundEngine.cpp @@ -0,0 +1,62 @@ +#include "minecraft/sounds/ConsoleSoundEngine.h" + +bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() { + return m_bIsPlayingStreamingCDMusic; +} +bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() { + return m_bIsPlayingStreamingGameMusic; +} +void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) { + m_bIsPlayingStreamingCDMusic = bVal; +} +void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) { + m_bIsPlayingStreamingGameMusic = bVal; +} +bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; } +bool ConsoleSoundEngine::GetIsPlayingNetherMusic() { + return m_bIsPlayingNetherMusic; +} +void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) { + m_bIsPlayingEndMusic = bVal; +} +void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) { + m_bIsPlayingNetherMusic = bVal; +} + +void ConsoleSoundEngine::tick() { + if (scheduledSounds.empty()) { + return; + } + + for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) { + ConsoleSoundEngine::ScheduledSound* next = *it; + next->delay--; + + if (next->delay <= 0) { + play(next->iSound, next->x, next->y, next->z, next->volume, + next->pitch); + it = scheduledSounds.erase(it); + delete next; + } else { + ++it; + } + } +} + +void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z, + float volume, float pitch, int delayTicks) { + scheduledSounds.push_back(new ConsoleSoundEngine::ScheduledSound( + iSound, x, y, z, volume, pitch, delayTicks)); +} + +ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y, + float z, float volume, + float pitch, int delay) { + this->iSound = iSound; + this->x = x; + this->y = y; + this->z = z; + this->volume = volume; + this->pitch = pitch; + this->delay = delay; +} diff --git a/targets/app/common/Audio/Consoles_SoundEngine.h b/targets/minecraft/sounds/ConsoleSoundEngine.h similarity index 88% rename from targets/app/common/Audio/Consoles_SoundEngine.h rename to targets/minecraft/sounds/ConsoleSoundEngine.h index 9616dcfc2..d78639fa1 100644 --- a/targets/app/common/Audio/Consoles_SoundEngine.h +++ b/targets/minecraft/sounds/ConsoleSoundEngine.h @@ -21,6 +21,11 @@ typedef struct { class Options; class Mob; +// Game-side sound engine interface. The concrete backend +// (app/common/Audio/SoundEngine) inherits from this and forwards into +// IPlatformSound. minecraft/ consumers see only the abstract base, so +// they don't have to drag the concrete backend (and its miniaudio +// pimpl) into their compilation units. class ConsoleSoundEngine { public: ConsoleSoundEngine() @@ -29,6 +34,8 @@ public: m_bIsPlayingEndMusic(false), m_bIsPlayingNetherMusic(false) {} + virtual ~ConsoleSoundEngine() = default; + virtual void tick(std::shared_ptr* players, float a) = 0; virtual void destroy() = 0; virtual void play(int iSound, float x, float y, float z, float volume, diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index 75324ed89..a4f4996a2 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -395,6 +395,7 @@ server/level/TrackedEntity.cpp server/network/PendingConnection.cpp server/network/PlayerConnection.cpp server/network/ServerConnection.cpp +sounds/ConsoleSoundEngine.cpp stats/Achievement.cpp stats/Achievements.cpp stats/CommonStats.cpp From e174fabcb649caad4ba805636cf56160d8c670e7 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:45:21 +1000 Subject: [PATCH 046/104] chore: drop stale app/common/App_structs.h includes from minecraft consumers --- targets/minecraft/client/gui/Gui.cpp | 1 - targets/minecraft/client/multiplayer/ClientConnection.cpp | 1 - targets/minecraft/client/player/LocalPlayer.cpp | 2 +- targets/minecraft/world/entity/player/Player.cpp | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index cf6315f69..14266d9ef 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -4,7 +4,6 @@ #include #include "Facing.h" -#include "app/common/App_structs.h" #include "app/linux/Linux_UIController.h" #include "java/Color.h" #include "java/JavaMath.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 7a942b299..ad8e28e47 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -12,7 +12,6 @@ #include "MultiPlayerLevel.h" #include "ReceivingLevelScreen.h" -#include "app/common/App_structs.h" #include "app/common/ConsoleGameMode.h" #include "minecraft/client/skins/ISkinAssetData.h" #include "app/common/Network/Socket.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 506d38c0d..3efa77260 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -30,8 +30,8 @@ // 4J Stu - Added for tutorial callbacks #include "PlatformTypes.h" #include "Pos.h" -#include "app/common/App_structs.h" #include "minecraft/sounds/ConsoleSoundEngine.h" +#include "platform/profile/ProfileConstants.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/linux/Linux_UIController.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index d6acd2f98..161401d15 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -21,7 +21,6 @@ #include "Inventory.h" #include "Player.h" -#include "app/common/App_structs.h" #include "minecraft/client/skins/ISkinAssetData.h" #include "java/JavaMath.h" #include "java/Random.h" From 0a5cf82d80c619485178cd8f2a3c0babe6129245 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:48:47 +1000 Subject: [PATCH 047/104] chore: drop unused extern LinuxGame app from FileHeader.cpp --- .../world/level/storage/ConsoleSaveFileIO/FileHeader.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 946f107c5..8d00295ad 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -10,13 +10,10 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/System.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "util/Definitions.h" -extern LinuxGame app; - FileHeader::FileHeader() { lastFile = nullptr; m_saveVersion = 0; From 9b729ed19e7c8483fc681ad626b3ed9da861311d Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:57:30 +1000 Subject: [PATCH 048/104] refactor: drop GameNetworkManager.h transitive include from Socket.h --- targets/app/common/Network/GameNetworkManager.h | 2 -- targets/app/common/Network/Socket.cpp | 1 - targets/app/common/Network/Socket.h | 7 ++++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 5c1119e79..c8de48bfd 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -22,8 +22,6 @@ class FriendSessionInfo; class INVITE_INFO; class INetworkPlayer; -const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; - // This class implements the game-side interface to the networking system. As // such, it is platform independent and may contain bits of game-side code where // appropriate. It shouldn't ever reference any platform specifics of the diff --git a/targets/app/common/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp index 68c3e3c7a..afae4a595 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -6,7 +6,6 @@ #include #include -// 4jcraft TODO #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/network/ServerConnection.h" diff --git a/targets/app/common/Network/Socket.h b/targets/app/common/Network/Socket.h index 25037db28..787e8c251 100644 --- a/targets/app/common/Network/Socket.h +++ b/targets/app/common/Network/Socket.h @@ -10,7 +10,6 @@ #include #include -#include "app/common/Network/GameNetworkManager.h" #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" @@ -21,6 +20,12 @@ class INetworkPlayer; #define SOCKET_CLIENT_END 0 #define SOCKET_SERVER_END 1 +// Flag bit for Socket::SocketOutputStream::writeWithFlags. Marks +// the message as needing positive acknowledgement before the caller +// can consider it delivered. Defined here so consumers don't have to +// drag in the entire CGameNetworkManager header just for this constant. +inline constexpr int NON_QNET_SENDDATA_ACK_REQUIRED = 1; + class SocketAddress; class ServerConnection; From a1b9329ad8bc53c62f155a603cb2c8e217cfff14 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:03:05 +1000 Subject: [PATCH 049/104] refactor: move GAME_RULE_SAVENAME to ConsoleGameRulesConstants.h --- targets/app/common/GameRules/GameRuleManager.h | 2 -- targets/minecraft/client/skins/DLCTexturePack.cpp | 1 - targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/world/level/ConsoleGameRulesConstants.h | 6 ++++++ .../storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp | 2 +- .../minecraft/world/level/storage/DirectoryLevelStorage.cpp | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/targets/app/common/GameRules/GameRuleManager.h b/targets/app/common/GameRules/GameRuleManager.h index 7f3020851..002c9eb94 100644 --- a/targets/app/common/GameRules/GameRuleManager.h +++ b/targets/app/common/GameRules/GameRuleManager.h @@ -27,8 +27,6 @@ class DLCGameRulesHeader; class File; class LevelRuleset; -#define GAME_RULE_SAVENAME "requiredGameRules.grf" - // 4J-JEV: #define LEVEL_GEN_ID int #define LEVEL_GEN_ID_NULL 0 diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 9776bf8ec..f5562b547 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -14,7 +14,6 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" -#include "app/common/GameRules/GameRuleManager.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index c286eee64..a70a3c402 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -14,7 +14,6 @@ #include "DispenserBootstrap.h" #include "PlayerList.h" #include "Settings.h" -#include "app/common/GameRules/GameRuleManager.h" #include "java/Class.h" #include "java/File.h" #include "java/InputOutputStream/DataOutputStream.h" @@ -25,6 +24,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Options.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/commands/Command.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/GameEventPacket.h" diff --git a/targets/minecraft/world/level/ConsoleGameRulesConstants.h b/targets/minecraft/world/level/ConsoleGameRulesConstants.h index 522b04d66..4cd70be62 100644 --- a/targets/minecraft/world/level/ConsoleGameRulesConstants.h +++ b/targets/minecraft/world/level/ConsoleGameRulesConstants.h @@ -2,6 +2,12 @@ #include "java/InputOutputStream/DataOutputStream.h" +// Filename for the per-save game rules blob written by GameRuleManager +// and consumed by the save / converter / level storage paths. Defined +// here in minecraft/ so save-path consumers don't need to drag in the +// full app-side GameRuleManager header just for this string. +inline constexpr const char* GAME_RULE_SAVENAME = "requiredGameRules.grf"; + class ConsoleGameRules { public: enum EGameRuleType { diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp index 75290bc2d..4eb4cb992 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileConverter.cpp @@ -8,11 +8,11 @@ #include #include -#include "app/common/GameRules/GameRuleManager.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/util/ProgressListener.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/chunk/storage/RegionFile.h" #include "minecraft/world/level/chunk/storage/RegionFileCache.h" diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 4f4631e1f..467cd851a 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -11,7 +11,6 @@ #include #include "LevelData.h" -#include "app/common/GameRules/GameRuleManager.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" @@ -23,6 +22,7 @@ #include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/level/dimension/HellDimension.h" From 6fd9148e179f0cc4be1a79675f79209025114afb Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:06:25 +1000 Subject: [PATCH 050/104] chore: drop redundant Socket.h includes from PlayerList and PlayerConnection --- targets/minecraft/server/PlayerList.cpp | 1 - targets/minecraft/server/network/PlayerConnection.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 1cfb4c557..2aef07452 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -11,7 +11,6 @@ #include "MinecraftServer.h" #include "Settings.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/Network/Socket.h" #include "app/common/Tutorial/Tutorial.h" #include "java/Class.h" #include "java/JavaMath.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index c91c881bc..62053dc4f 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -9,7 +9,6 @@ #include #include "ServerConnection.h" -#include "app/common/Network/Socket.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" From 557dd7430b6b30fb30489db99a082011bed3d3d9 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:20:30 +1000 Subject: [PATCH 051/104] refactor: extract ITutorial interface and move TutorialEnum to minecraft --- targets/app/common/App_structs.h | 2 +- targets/app/common/Game.h | 2 +- .../Constraints/ChangeStateConstraint.cpp | 2 +- .../Constraints/ChangeStateConstraint.h | 2 +- targets/app/common/Tutorial/FullTutorial.h | 2 +- .../app/common/Tutorial/Hints/AreaHint.cpp | 2 +- targets/app/common/Tutorial/Hints/AreaHint.h | 2 +- .../common/Tutorial/Hints/DiggerItemHint.h | 2 +- .../Tutorial/Hints/LookAtEntityHint.cpp | 2 +- .../common/Tutorial/Hints/LookAtEntityHint.h | 2 +- .../common/Tutorial/Hints/LookAtTileHint.cpp | 2 +- .../common/Tutorial/Hints/LookAtTileHint.h | 2 +- .../common/Tutorial/Hints/TakeItemHint.cpp | 2 +- .../app/common/Tutorial/Hints/TakeItemHint.h | 2 +- .../common/Tutorial/Hints/TutorialHint.cpp | 2 +- .../app/common/Tutorial/Hints/TutorialHint.h | 2 +- .../app/common/Tutorial/Tasks/AreaTask.cpp | 2 +- targets/app/common/Tutorial/Tasks/AreaTask.h | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.cpp | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.h | 2 +- .../Tutorial/Tasks/FullTutorialActiveTask.cpp | 2 +- .../Tutorial/Tasks/FullTutorialActiveTask.h | 2 +- .../common/Tutorial/Tasks/HorseChoiceTask.cpp | 2 +- .../common/Tutorial/Tasks/HorseChoiceTask.h | 2 +- .../Tutorial/Tasks/ProcedureCompoundTask.cpp | 2 +- .../Tutorial/Tasks/ProcedureCompoundTask.h | 2 +- .../app/common/Tutorial/Tasks/TutorialTask.h | 2 +- targets/app/common/Tutorial/Tutorial.h | 33 +++++++------ targets/app/common/Tutorial/TutorialMode.h | 23 +++++----- .../IUIScene_AbstractContainerMenu.cpp | 8 ++-- .../IUIScene_AbstractContainerMenu.h | 2 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 13 +++--- .../UI/All Platforms/IUIScene_CraftingMenu.h | 2 +- .../UI/All Platforms/IUIScene_TradingMenu.cpp | 4 +- .../UI/All Platforms/IUIScene_TradingMenu.h | 2 +- .../Components/UIComponent_TutorialPopup.cpp | 2 +- .../Containers/UIScene_AnvilMenu.cpp | 2 +- .../Containers/UIScene_BeaconMenu.cpp | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 2 +- .../Containers/UIScene_ContainerMenu.cpp | 2 +- .../Containers/UIScene_CreativeMenu.cpp | 2 +- .../Containers/UIScene_DispenserMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_FireworksMenu.cpp | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 2 +- .../Containers/UIScene_HopperMenu.cpp | 2 +- .../Containers/UIScene_HorseInventoryMenu.cpp | 2 +- .../Containers/UIScene_InventoryMenu.cpp | 2 +- .../Containers/UIScene_TradingMenu.cpp | 2 +- .../UIScene_CraftingMenu.cpp | 2 +- .../client/multiplayer/ClientConnection.cpp | 11 +++-- .../client/multiplayer/MultiPlayerGameMode.h | 4 +- .../minecraft/client/player/LocalPlayer.cpp | 20 ++++---- targets/minecraft/server/PlayerList.cpp | 2 +- targets/minecraft/server/level/GameMode.h | 4 +- targets/minecraft/world/tutorial/ITutorial.h | 46 +++++++++++++++++++ .../world/tutorial}/TutorialEnum.h | 0 57 files changed, 155 insertions(+), 103 deletions(-) create mode 100644 targets/minecraft/world/tutorial/ITutorial.h rename targets/{app/common/Tutorial => minecraft/world/tutorial}/TutorialEnum.h (100%) diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 92eebb5f2..ace259fcb 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,7 +2,7 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 557a6d7a8..928f9d496 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -24,7 +24,7 @@ #include "app/common/SaveManager.h" #include "app/common/SkinManager.h" #include "app/common/TerrainFeatureManager.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "minecraft/client/model/SkinBox.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 3ed3abaf9..b7e8aa211 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -4,7 +4,7 @@ #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index 1bcfdcf55..c6df3a7a6 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -3,7 +3,7 @@ #include #include "TutorialConstraint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/FullTutorial.h b/targets/app/common/Tutorial/FullTutorial.h index b8cad4486..17631176e 100644 --- a/targets/app/common/Tutorial/FullTutorial.h +++ b/targets/app/common/Tutorial/FullTutorial.h @@ -1,6 +1,6 @@ #pragma once #include "Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #define FULL_TUTORIAL_PROGRESS_2_X_2_Crafting 1 #define FULL_TUTORIAL_PROGRESS_3_X_3_Crafting 2 diff --git a/targets/app/common/Tutorial/Hints/AreaHint.cpp b/targets/app/common/Tutorial/Hints/AreaHint.cpp index 8f4501cdc..90531693a 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.cpp +++ b/targets/app/common/Tutorial/Hints/AreaHint.cpp @@ -4,7 +4,7 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/phys/AABB.h" diff --git a/targets/app/common/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h index 919bc3fb8..c94c6039f 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,7 +1,7 @@ #pragma once #include "TutorialHint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" class AABB; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.h b/targets/app/common/Tutorial/Hints/DiggerItemHint.h index 8f86cd6f9..58a239da4 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.h +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.h @@ -1,7 +1,7 @@ #pragma once #include "TutorialHint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class DiggerItem; class Level; diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp index 486259a5a..3e60b2806 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.cpp @@ -2,7 +2,7 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" LookAtEntityHint::LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h index a0d2936a2..863a61720 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -2,7 +2,7 @@ // using namespace std; #include "TutorialHint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" class ItemInstance; diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp index 2c07bbab6..96fd5abc9 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp @@ -4,7 +4,7 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/item/Item.h" LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h index cb9e826be..548ba652e 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -2,7 +2,7 @@ // using namespace std; #include "TutorialHint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp index 51d3356e1..65641d141 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp @@ -4,7 +4,7 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/item/ItemInstance.h" TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h index 81225bac8..d5e06f1ed 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -2,7 +2,7 @@ // using namespace std; #include "TutorialHint.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.cpp b/targets/app/common/Tutorial/Hints/TutorialHint.cpp index 1122ceb00..eb4b5435e 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.cpp +++ b/targets/app/common/Tutorial/Hints/TutorialHint.cpp @@ -1,7 +1,7 @@ #include "TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.h b/targets/app/common/Tutorial/Hints/TutorialHint.h index 0ef31b135..3efca9d42 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.h +++ b/targets/app/common/Tutorial/Hints/TutorialHint.h @@ -3,7 +3,7 @@ #include -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" class Entity; diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.cpp b/targets/app/common/Tutorial/Tasks/AreaTask.cpp index d3b5c7ebb..8cee93830 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.cpp +++ b/targets/app/common/Tutorial/Tasks/AreaTask.cpp @@ -5,7 +5,7 @@ #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" AreaTask::AreaTask(eTutorial_State state, Tutorial* tutorial, std::vector* inConstraints, diff --git a/targets/app/common/Tutorial/Tasks/AreaTask.h b/targets/app/common/Tutorial/Tasks/AreaTask.h index 6d69b0cc6..cbf1d6b0a 100644 --- a/targets/app/common/Tutorial/Tasks/AreaTask.h +++ b/targets/app/common/Tutorial/Tasks/AreaTask.h @@ -5,7 +5,7 @@ #include #include "TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; class TutorialConstraint; diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index 6d0ceba55..036b1be28 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -6,7 +6,7 @@ #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.h b/targets/app/common/Tutorial/Tasks/ChoiceTask.h index 8a9fa5dbe..7d5593768 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.h @@ -2,7 +2,7 @@ // using namespace std; #include "TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp index eba2e6900..01ef7dcab 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.cpp @@ -2,7 +2,7 @@ #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" FullTutorialActiveTask::FullTutorialActiveTask( Tutorial* tutorial, diff --git a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h index b5b631caa..a269825fa 100644 --- a/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h +++ b/targets/app/common/Tutorial/Tasks/FullTutorialActiveTask.h @@ -2,7 +2,7 @@ // using namespace std; #include "TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index a2c7738ff..775a35f23 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -3,7 +3,7 @@ #include #include "app/common/Tutorial/Tasks/ChoiceTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h index 67fd7c95a..1ae0e4607 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.h @@ -1,7 +1,7 @@ #pragma once #include "ChoiceTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp index 90a55014c..1220bf736 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.cpp @@ -4,7 +4,7 @@ #include #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" ProcedureCompoundTask::~ProcedureCompoundTask() { for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) { diff --git a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h index c48dc7e3e..c56fe2c15 100644 --- a/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h +++ b/targets/app/common/Tutorial/Tasks/ProcedureCompoundTask.h @@ -3,7 +3,7 @@ #include #include "TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; diff --git a/targets/app/common/Tutorial/Tasks/TutorialTask.h b/targets/app/common/Tutorial/Tasks/TutorialTask.h index 593edf3a6..61080d3df 100644 --- a/targets/app/common/Tutorial/Tasks/TutorialTask.h +++ b/targets/app/common/Tutorial/Tasks/TutorialTask.h @@ -4,7 +4,7 @@ #include // using namespace std; -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Level; class Tutorial; diff --git a/targets/app/common/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h index c272aa5aa..01fc95adb 100644 --- a/targets/app/common/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -9,12 +9,12 @@ #include #include -#include "TutorialEnum.h" #include "TutorialMessage.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/ITutorial.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "util/Timer.h" class Entity; @@ -39,7 +39,7 @@ class Level; class CXuiScene; class Player; -class Tutorial { +class Tutorial : public ITutorial { public: class PopupMessageDetails { public: @@ -144,7 +144,7 @@ public: int getPad() { return m_iPad; } - virtual bool isStateCompleted(eTutorial_State state); + bool isStateCompleted(eTutorial_State state) override; virtual void setStateCompleted(eTutorial_State state); bool isHintCompleted(eTutorial_Hint hint); void setHintCompleted(eTutorial_Hint hint); @@ -154,15 +154,18 @@ public: void setCompleted(int completableId); bool getCompleted(int completableId); - void changeTutorialState(eTutorial_State newState, - UIScene* scene = nullptr); + void changeTutorialState(eTutorial_State newState, UIScene* scene); + void changeTutorialState(eTutorial_State newState) override { + changeTutorialState(newState, nullptr); + } bool isSelectedItemState(); bool setMessage(PopupMessageDetails* message); bool setMessage(TutorialHint* hint, PopupMessageDetails* message); - bool setMessage(const std::string& message, int icon, int auxValue); + bool setMessage(const std::string& message, int icon, + int auxValue) override; - void showTutorialPopup(bool show); + void showTutorialPopup(bool show) override; void useItemOn(Level* level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly = false); @@ -176,18 +179,18 @@ public: void handleUIInput(int iAction); void createItemSelected(std::shared_ptr item, bool canMake); - void onCrafted(std::shared_ptr item); + void onCrafted(std::shared_ptr item) override; void onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, - unsigned int invItemCountThisAux); - void onSelectedItemChanged(std::shared_ptr item); - void onLookAt(int id, int iData = 0); - void onLookAtEntity(std::shared_ptr entity); - void onRideEntity(std::shared_ptr entity); + unsigned int invItemCountThisAux) override; + void onSelectedItemChanged(std::shared_ptr item) override; + void onLookAt(int id, int iData = 0) override; + void onLookAtEntity(std::shared_ptr entity) override; + void onRideEntity(std::shared_ptr entity) override; void onEffectChanged(MobEffect* effect, bool bRemoved = false); bool canMoveToPosition(double xo, double yo, double zo, double xt, - double yt, double zt); + double yt, double zt) override; bool isInputAllowed(int mapping); void AddGlobalConstraint(TutorialConstraint* c); diff --git a/targets/app/common/Tutorial/TutorialMode.h b/targets/app/common/Tutorial/TutorialMode.h index a16c8b217..4d3639d3c 100644 --- a/targets/app/common/Tutorial/TutorialMode.h +++ b/targets/app/common/Tutorial/TutorialMode.h @@ -20,18 +20,17 @@ public: TutorialMode(int iPad, Minecraft* minecraft, ClientConnection* connection); virtual ~TutorialMode(); - virtual void startDestroyBlock(int x, int y, int z, int face); - virtual bool destroyBlock(int x, int y, int z, int face); - virtual void tick(); - virtual bool useItemOn(std::shared_ptr player, Level* level, - std::shared_ptr item, int x, int y, - int z, int face, Vec3* hit, - bool bTestUseOnly = false, - bool* pbUsedItem = nullptr); - virtual void attack(std::shared_ptr player, - std::shared_ptr entity); + void startDestroyBlock(int x, int y, int z, int face) override; + bool destroyBlock(int x, int y, int z, int face) override; + void tick() override; + bool useItemOn(std::shared_ptr player, Level* level, + std::shared_ptr item, int x, int y, int z, + int face, Vec3* hit, bool bTestUseOnly = false, + bool* pbUsedItem = nullptr) override; + void attack(std::shared_ptr player, + std::shared_ptr entity) override; - virtual bool isInputAllowed(int mapping); + bool isInputAllowed(int mapping) override; - Tutorial* getTutorial() { return tutorial; } + Tutorial* getTutorial() override { return tutorial; } }; \ No newline at end of file diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index fc5da509f..d745984a9 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -234,8 +234,8 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() { void IUIScene_AbstractContainerMenu::onMouseTick() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { if (ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP)) { @@ -1096,8 +1096,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index d558bf5e5..f7742227f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -4,7 +4,7 @@ #include #include "UIStructs.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" class HtmlString; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 0539b5fb7..5a7a25296 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -153,8 +153,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && @@ -211,8 +211,9 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if (pMinecraft->localgameModes[iPad] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[iPad]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[iPad] + ->getTutorial()); if (tutorial != nullptr) { tutorial->onCrafted(pTempItemInst); } @@ -246,8 +247,8 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { // iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); if (pMinecraft->localgameModes[iPad] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[iPad]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[iPad]->getTutorial()); if (tutorial != nullptr) { tutorial->createItemSelected( pTempItemInst, diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index 570249054..0d1189b82 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -2,7 +2,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/crafting/Recipy.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index a21ddffd7..4b0b707b6 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -47,8 +47,8 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[getPad()] != nullptr) { - Tutorial* tutorial = - pMinecraft->localgameModes[getPad()]->getTutorial(); + Tutorial* tutorial = static_cast( + pMinecraft->localgameModes[getPad()]->getTutorial()); if (tutorial != nullptr) { tutorial->handleUIInput(iAction); if (ui.IsTutorialVisible(getPad()) && diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h index a326e5aa7..7e269a451 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h @@ -6,7 +6,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/Rarity.h" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index ea72371d1..f5629a62d 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.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 0524a9715..cd8c5ddcf 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 @@ -9,7 +9,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index 4dc84968d..fa27ae1d8 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -6,7 +6,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/Controls/UIControl_Label.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 c5e716adf..f60eb9a07 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 @@ -4,7 +4,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp index 84e5a798e..0ee196de4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index ca6a4f48c..528da0646 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp index a1beb76d7..7223240bd 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.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 3f36371d9..b9f80f605 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 @@ -7,7 +7,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp index 235401cf6..28d1eee2a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.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 424906cdc..1fd08f277 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 @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp index cd37450b0..294c5e91c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp @@ -5,7 +5,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index bedddb31b..9e9f9378f 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -6,7 +6,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index 58f9f6465..67ebaf6b7 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -8,7 +8,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.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 6bf22ea8b..44009e221 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 @@ -7,7 +7,7 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.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 a16e0ce03..1679c1108 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 @@ -3,7 +3,7 @@ #include "platform/game/game.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialEnum.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index ad8e28e47..7b615c418 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -16,8 +16,7 @@ #include "minecraft/client/skins/ISkinAssetData.h" #include "app/common/Network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialMode.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/linux/Linux_UIController.h" @@ -2525,9 +2524,11 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { // minecraft->addPendingLocalConnection(m_userIndex, this); if (minecraft->localgameModes[m_userIndex] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_userIndex]; - gameMode->getTutorial()->showTutorialPopup(false); + ITutorial* tutorial = + minecraft->localgameModes[m_userIndex]->getTutorial(); + if (tutorial != nullptr) { + tutorial->showTutorialPopup(false); + } } // 4J-JEV: Fix for Durango #156334 - Content: UI: Rich Presence 'In the diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h index bd08c3e5b..2eaceb854 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.h @@ -12,7 +12,7 @@ class Entity; class Level; class Minecraft; class Player; -class Tutorial; +class ITutorial; class MultiPlayerGameMode { private: @@ -91,5 +91,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial* getTutorial() { return nullptr; } + virtual ITutorial* getTutorial() { return nullptr; } }; \ No newline at end of file diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 3efa77260..2dbb3bc9a 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -32,8 +32,7 @@ #include "Pos.h" #include "minecraft/sounds/ConsoleSoundEngine.h" #include "platform/profile/ProfileConstants.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialMode.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "app/linux/Linux_UIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" @@ -1221,9 +1220,11 @@ bool LocalPlayer::hasPermission(EGameCommand command) { void LocalPlayer::onCrafted(std::shared_ptr item) { if (minecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_iPad]; - gameMode->getTutorial()->onCrafted(item); + ITutorial* tutorial = + minecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onCrafted(item); + } } } @@ -1646,10 +1647,11 @@ void LocalPlayer::handleCollectItem(std::shared_ptr item) { } } } - TutorialMode* gameMode = - (TutorialMode*)minecraft->localgameModes[m_iPad]; - gameMode->getTutorial()->onTake(item, itemCountAnyAux, - itemCountThisAux); + ITutorial* tutorial = + minecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onTake(item, itemCountAnyAux, itemCountThisAux); + } } if (ui.IsContainerMenuDisplayed(m_iPad)) { diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 2aef07452..d123c9262 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -11,7 +11,7 @@ #include "MinecraftServer.h" #include "Settings.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/Tutorial/Tutorial.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/server/level/GameMode.h b/targets/minecraft/server/level/GameMode.h index fe2a1ecde..e3186c3be 100644 --- a/targets/minecraft/server/level/GameMode.h +++ b/targets/minecraft/server/level/GameMode.h @@ -8,7 +8,7 @@ class Player; class ItemInstance; class Entity; -class Tutorial; +class ITutorial; class GameMode { protected: @@ -70,5 +70,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial* getTutorial() { return nullptr; } + virtual ITutorial* getTutorial() { return nullptr; } }; diff --git a/targets/minecraft/world/tutorial/ITutorial.h b/targets/minecraft/world/tutorial/ITutorial.h new file mode 100644 index 000000000..6c3c23d28 --- /dev/null +++ b/targets/minecraft/world/tutorial/ITutorial.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include + +#include "minecraft/world/tutorial/TutorialEnum.h" + +class Entity; +class ItemInstance; + +// Domain interface for the player tutorial. +// +// minecraft/ consumers (Player, GameMode, ClientConnection, the player +// list) need to forward gameplay events into the tutorial system but +// they should not depend on the heavyweight Tutorial implementation +// in app/common/Tutorial/. The concrete Tutorial in app/ inherits +// from this interface; minecraft/ only sees ITutorial*. +// +// Tutorial state and hint enums (eTutorial_State, eTutorial_Hint) +// remain in minecraft/world/tutorial/TutorialEnum.h, which is itself a +// content-only header that minecraft/ can safely include. +class ITutorial { +public: + virtual ~ITutorial() = default; + + [[nodiscard]] virtual bool isStateCompleted(eTutorial_State state) = 0; + virtual void changeTutorialState(eTutorial_State newState) = 0; + + virtual bool setMessage(const std::string& message, int icon, + int auxValue) = 0; + + virtual void showTutorialPopup(bool show) = 0; + + virtual void onCrafted(std::shared_ptr item) = 0; + virtual void onTake(std::shared_ptr item, + unsigned int invItemCountAnyAux, + unsigned int invItemCountThisAux) = 0; + virtual void onSelectedItemChanged(std::shared_ptr item) = 0; + virtual void onLookAt(int id, int iData = 0) = 0; + virtual void onLookAtEntity(std::shared_ptr entity) = 0; + virtual void onRideEntity(std::shared_ptr entity) = 0; + + [[nodiscard]] virtual bool canMoveToPosition(double xo, double yo, + double zo, double xt, + double yt, double zt) = 0; +}; diff --git a/targets/app/common/Tutorial/TutorialEnum.h b/targets/minecraft/world/tutorial/TutorialEnum.h similarity index 100% rename from targets/app/common/Tutorial/TutorialEnum.h rename to targets/minecraft/world/tutorial/TutorialEnum.h From 514c75bf0118e6ae5101c4d358d8a88b36ab4653 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:21:49 +1000 Subject: [PATCH 052/104] chore: drop redundant Socket.h include from Connection.cpp --- targets/minecraft/network/Connection.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 6912b88cc..c264bcf16 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -6,7 +6,6 @@ #include #include -#include "app/common/Network/Socket.h" #include "java/InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataInputStream.h" From 41d139ce32bf4f10f317896be68c81bda1f46f3f Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:27:26 +1000 Subject: [PATCH 053/104] refactor: replace Tutorial::staticCtor with ITutorial::staticInit in Minecraft.cpp --- targets/app/common/Tutorial/Tutorial.cpp | 2 ++ targets/minecraft/client/Minecraft.cpp | 4 ++-- targets/minecraft/world/tutorial/ITutorial.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 844085386..3f3d9a24a 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -72,6 +72,8 @@ bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails* other) { return textTheSame && titleTheSame && promptTheSame; } +void ITutorial::staticInit() { Tutorial::staticCtor(); } + void Tutorial::staticCtor() { // /* diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 6b17606d8..d46f463aa 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -17,7 +17,7 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Tutorial/Tutorial.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/linux/Linux_UIController.h" @@ -4207,7 +4207,7 @@ void Minecraft::main(IPlatformLeaderboard& leaderboard) { EntityRenderDispatcher::staticCtor(); TileEntityRenderDispatcher::staticCtor(); User::staticCtor(); - Tutorial::staticCtor(); + ITutorial::staticInit(); ColourTable::staticCtor(); gameServices().loadDefaultGameRules(); diff --git a/targets/minecraft/world/tutorial/ITutorial.h b/targets/minecraft/world/tutorial/ITutorial.h index 6c3c23d28..20a75b694 100644 --- a/targets/minecraft/world/tutorial/ITutorial.h +++ b/targets/minecraft/world/tutorial/ITutorial.h @@ -23,6 +23,11 @@ class ITutorial { public: virtual ~ITutorial() = default; + // One-time process-wide initialisation. The concrete tutorial + // implementation in app/common/Tutorial/Tutorial.cpp provides the + // body. Called once from Minecraft::staticCtor. + static void staticInit(); + [[nodiscard]] virtual bool isStateCompleted(eTutorial_State state) = 0; virtual void changeTutorialState(eTutorial_State newState) = 0; From 684b55c260e59cf3a232ae12dcc95f2c29ab5fcb Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:31:09 +1000 Subject: [PATCH 054/104] refactor: relocate Socket header into minecraft/network --- targets/app/common/Network/GameNetworkManager.cpp | 2 +- targets/app/common/Network/PlatformNetworkManagerStub.cpp | 2 +- targets/app/common/Network/Socket.cpp | 2 +- targets/app/windows/src/Windows64_Minecraft.cpp | 2 +- targets/minecraft/client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/network/Connection.h | 2 +- targets/{app/common/Network => minecraft/network}/Socket.h | 0 targets/minecraft/server/MinecraftServer.cpp | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename targets/{app/common/Network => minecraft/network}/Socket.h (100%) diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 22dd27316..67f816462 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -10,7 +10,7 @@ #include #include -#include "Socket.h" +#include "minecraft/network/Socket.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/PlatformNetworkManagerStub.h" diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp index f46e0853f..c27df2a8f 100644 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ b/targets/app/common/Network/PlatformNetworkManagerStub.cpp @@ -6,8 +6,8 @@ #include #include "NetworkPlayerQNet.h" -#include "Socket.h" #include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/Socket.h" #include "app/linux/LinuxGame.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "platform/C4JThread.h" diff --git a/targets/app/common/Network/Socket.cpp b/targets/app/common/Network/Socket.cpp index afae4a595..87d0672f2 100644 --- a/targets/app/common/Network/Socket.cpp +++ b/targets/app/common/Network/Socket.cpp @@ -1,4 +1,4 @@ -#include "Socket.h" +#include "minecraft/network/Socket.h" #include diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 7563ecbfc..4fdb59ee2 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -5,7 +5,7 @@ #include -#include "app/common/Network/Socket.h" +#include "minecraft/network/Socket.h" #include "minecraft/client/User.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/ConnectScreen.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 7b615c418..3e90154c2 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -14,7 +14,7 @@ #include "ReceivingLevelScreen.h" #include "app/common/ConsoleGameMode.h" #include "minecraft/client/skins/ISkinAssetData.h" -#include "app/common/Network/Socket.h" +#include "minecraft/network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" #include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIStructs.h" diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index 918039003..e6d60480d 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -7,7 +7,7 @@ #include #include -#include "app/common/Network/Socket.h" +#include "minecraft/network/Socket.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" diff --git a/targets/app/common/Network/Socket.h b/targets/minecraft/network/Socket.h similarity index 100% rename from targets/app/common/Network/Socket.h rename to targets/minecraft/network/Socket.h diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index a70a3c402..3805deda5 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -66,7 +66,7 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif #include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" -#include "app/common/Network/Socket.h" +#include "minecraft/network/Socket.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" From 650c81db3d3744050e0bffe33553726727761886 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:35:33 +1000 Subject: [PATCH 055/104] refactor: relocate ConsoleSchematicFile into minecraft/world/level/levelgen --- .../app/common/GameRules/GameRuleManager.cpp | 2 +- .../ApplySchematicRuleDefinition.cpp | 2 +- .../ApplySchematicRuleDefinition.h | 2 +- .../LevelGeneration/LevelGenerationOptions.cpp | 2 +- targets/app/common_sources.txt | 1 - targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/sources.txt | 1 + .../level/levelgen}/ConsoleSchematicFile.cpp | 18 +++++++++--------- .../level/levelgen}/ConsoleSchematicFile.h | 0 9 files changed, 15 insertions(+), 15 deletions(-) rename targets/{app/common/GameRules/LevelGeneration => minecraft/world/level/levelgen}/ConsoleSchematicFile.cpp (99%) rename targets/{app/common/GameRules/LevelGeneration => minecraft/world/level/levelgen}/ConsoleSchematicFile.h (100%) diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index c86544f6a..b80f37c19 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -12,7 +12,7 @@ #include "app/common/DLC/DLCLocalisationFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 3ace1743e..38d1afb6b 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -3,8 +3,8 @@ #include #include -#include "ConsoleSchematicFile.h" #include "app/linux/LinuxGame.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index b65aa9012..cc5073a35 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -4,8 +4,8 @@ #include #include -#include "ConsoleSchematicFile.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index d92c82e0f..8351c4328 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -13,7 +13,7 @@ #include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" #include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" #include "app/linux/LinuxGame.h" #include "java/File.h" diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index b2f71748c..3a499968a 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -24,7 +24,6 @@ common/GameRules/GameRuleManager.cpp common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp common/GameRules/LevelGeneration/BiomeOverride.cpp common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp -common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp common/GameRules/LevelGeneration/LevelGenerationOptions.cpp common/GameRules/LevelGeneration/LevelGenerators.cpp common/GameRules/LevelGeneration/StartFeature.cpp diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 3805deda5..fc80d358e 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -65,7 +65,7 @@ #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/network/Socket.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index a4f4996a2..bffb978e4 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -772,6 +772,7 @@ world/level/dimension/Dimension.cpp world/level/dimension/HellDimension.cpp world/level/dimension/TheEndDimension.cpp world/level/levelgen/CanyonFeature.cpp +world/level/levelgen/ConsoleSchematicFile.cpp world/level/levelgen/CustomLevelSource.cpp world/level/levelgen/DungeonFeature.cpp world/level/levelgen/FlatLevelSource.cpp diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp similarity index 99% rename from targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp rename to targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp index ccac746a8..a70a8e6f2 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp @@ -1,4 +1,4 @@ -#include "ConsoleSchematicFile.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include #include @@ -8,10 +8,10 @@ #include #include -#include "app/linux/LinuxGame.h" #include "java/Class.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityIO.h" #include "minecraft/world/entity/ItemFrame.h" @@ -38,7 +38,7 @@ ConsoleSchematicFile::ConsoleSchematicFile() { } ConsoleSchematicFile::~ConsoleSchematicFile() { - app.DebugPrintf("Deleting schematic file\n"); + Log::info("Deleting schematic file\n"); } void ConsoleSchematicFile::save(DataOutputStream* dos) { @@ -111,7 +111,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { m_data.resize(m_dataSize); break; default: - app.DebugPrintf( + Log::info( "Unrecognized compression type for Schematic file " "(%d)\n", (int)compressionType); @@ -138,7 +138,7 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { if (te == nullptr) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf( + Log::info( "ConsoleSchematicFile has read a nullptr tile " "entity\n"); assert(0); @@ -215,7 +215,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); #ifdef _DEBUG - app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, + Log::info("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, zStart, xEnd - 1, yEnd - 1, zEnd - 1); #endif @@ -290,7 +290,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, dataP += (rowBlockCount - rowBlocksIncluded) / 2; } } else { - app.DebugPrintf( + Log::info( "ERROR: Rotation of block and data not implemented!!\n"); } @@ -555,7 +555,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, e->absMoveTo(targetX, targetY, targetZ, e->yRot, e->xRot); } #ifdef _DEBUG - app.DebugPrintf("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), + Log::info("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), e->x, e->y, e->z); #endif e->setLevel(chunk->level); @@ -616,7 +616,7 @@ void ConsoleSchematicFile::generateSchematicFile( int ySize = yEnd - yStart + 1; int zSize = zEnd - zStart + 1; - app.DebugPrintf( + Log::info( "Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), " "%dx%dx%d\n", xStart, yStart, zStart, xEnd, yEnd, zEnd, xSize, ySize, zSize); diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.h similarity index 100% rename from targets/app/common/GameRules/LevelGeneration/ConsoleSchematicFile.h rename to targets/minecraft/world/level/levelgen/ConsoleSchematicFile.h From 7513c37f521a174643e582f79b80930a4f0bdcd1 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:38:11 +1000 Subject: [PATCH 056/104] refactor: extend ITutorial to cover MultiPlayerLocalPlayer event hooks --- targets/app/common/Tutorial/Tutorial.h | 4 +- .../multiplayer/MultiPlayerLocalPlayer.cpp | 55 ++++++++++--------- targets/minecraft/world/tutorial/ITutorial.h | 3 + 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/targets/app/common/Tutorial/Tutorial.h b/targets/app/common/Tutorial/Tutorial.h index 01fc95adb..5f790bfc4 100644 --- a/targets/app/common/Tutorial/Tutorial.h +++ b/targets/app/common/Tutorial/Tutorial.h @@ -171,7 +171,7 @@ public: int y, int z, bool bTestUseOnly = false); void useItemOn(std::shared_ptr item, bool bTestUseOnly = false); - void completeUsingItem(std::shared_ptr item); + void completeUsingItem(std::shared_ptr item) override; void startDestroyBlock(std::shared_ptr item, Tile* tile); void destroyBlock(Tile* tile); void attack(std::shared_ptr player, std::shared_ptr entity); @@ -187,7 +187,7 @@ public: void onLookAt(int id, int iData = 0) override; void onLookAtEntity(std::shared_ptr entity) override; void onRideEntity(std::shared_ptr entity) override; - void onEffectChanged(MobEffect* effect, bool bRemoved = false); + void onEffectChanged(MobEffect* effect, bool bRemoved = false) override; bool canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt) override; diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 36ee02001..8dd22a999 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -5,9 +5,8 @@ #include #include "ClientConnection.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/Tutorial/TutorialMode.h" #include "minecraft/IGameServices.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" @@ -234,10 +233,11 @@ void MultiplayerLocalPlayer::actuallyHurt(DamageSource* source, float dmg) { void MultiplayerLocalPlayer::completeUsingItem() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (useItem != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->completeUsingItem(useItem); + ITutorial* tutorial = + pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->completeUsingItem(useItem); + } } Player::completeUsingItem(); } @@ -245,10 +245,11 @@ void MultiplayerLocalPlayer::completeUsingItem() { void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + ITutorial* tutorial = + pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + } } Player::onEffectAdded(effect); } @@ -257,10 +258,11 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, bool doRefreshAttributes) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + ITutorial* tutorial = + pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); + } } Player::onEffectUpdated(effect, doRefreshAttributes); } @@ -268,10 +270,12 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - Tutorial* tutorial = gameMode->getTutorial(); - tutorial->onEffectChanged(MobEffect::effects[effect->getId()], true); + ITutorial* tutorial = + pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + tutorial->onEffectChanged(MobEffect::effects[effect->getId()], + true); + } } Player::onEffectRemoved(effect); } @@ -351,13 +355,14 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr e) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - TutorialMode* gameMode = - (TutorialMode*)pMinecraft->localgameModes[m_iPad]; - if (wasRiding && !isRiding) { - gameMode->getTutorial()->changeTutorialState( - e_Tutorial_State_Gameplay); - } else if (!wasRiding && isRiding) { - gameMode->getTutorial()->onRideEntity(e); + ITutorial* tutorial = + pMinecraft->localgameModes[m_iPad]->getTutorial(); + if (tutorial != nullptr) { + if (wasRiding && !isRiding) { + tutorial->changeTutorialState(e_Tutorial_State_Gameplay); + } else if (!wasRiding && isRiding) { + tutorial->onRideEntity(e); + } } } } diff --git a/targets/minecraft/world/tutorial/ITutorial.h b/targets/minecraft/world/tutorial/ITutorial.h index 20a75b694..ed3982fb2 100644 --- a/targets/minecraft/world/tutorial/ITutorial.h +++ b/targets/minecraft/world/tutorial/ITutorial.h @@ -7,6 +7,7 @@ class Entity; class ItemInstance; +class MobEffect; // Domain interface for the player tutorial. // @@ -44,6 +45,8 @@ public: virtual void onLookAt(int id, int iData = 0) = 0; virtual void onLookAtEntity(std::shared_ptr entity) = 0; virtual void onRideEntity(std::shared_ptr entity) = 0; + virtual void completeUsingItem(std::shared_ptr item) = 0; + virtual void onEffectChanged(MobEffect* effect, bool bRemoved = false) = 0; [[nodiscard]] virtual bool canMoveToPosition(double xo, double yo, double zo, double xt, From 9c1c1695a788f9bd174caf6e019c85231d234cc8 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:54:29 -0500 Subject: [PATCH 057/104] remove outdated docs, move socket implementation to minecraft/ --- targets/app/Network Implementation Notes.md | 48 ------------------- targets/app/ReadMe.txt | 27 ----------- targets/app/common_sources.txt | 1 - .../Network => minecraft/network}/Socket.cpp | 0 targets/minecraft/sources.txt | 1 + 5 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 targets/app/Network Implementation Notes.md delete mode 100644 targets/app/ReadMe.txt rename targets/{app/common/Network => minecraft/network}/Socket.cpp (100%) diff --git a/targets/app/Network Implementation Notes.md b/targets/app/Network Implementation Notes.md deleted file mode 100644 index 13280a8bb..000000000 --- a/targets/app/Network Implementation Notes.md +++ /dev/null @@ -1,48 +0,0 @@ -# Network Code Implementation Notes - -## Overview - -The networking classes are organized as follows: - -``` - Game \ - ^ | - | | - +-----------------------------+-----------------------------+ | - | | | - v v | -Game Network Manager <--------------------------------> Network Player Interface |- platform independent layers - ^ ^ | - | | | - v | | -Platform Network Manager Interface | | - ^ | / - | | - v v \ -Platform Network Manager Implementation(1) <------> Network Player Implementation (3) | - ^ ^ |_ platform specific layers - | | | - v v | -Platform specific network code(2) Platform specific player code (4) / -``` - -### Notes - -- In general the game should **only communicate with the `GameNetworkManager` and `NetworkPlayerInterface` APIs**, which provide a platform independent interface for networking functionality. The `GameNetworkManager` may in general have code which is aware of the game itself, but it *shouldn't have any platform-specific networking code*. It communicates with a platform specific implementation of a `PlatformNetworkManagerInterface` to achieve this. - -- The platform specific layers shouldn't contain any general game code, as this is much better placed in the platform independent layers to avoid duplicating effort. - -- Platform specific files for each platform for the numbered classes in the previous diagram are currently: - - -## Platform-Specific Files - -The platform-specific implementations for each numbered class in the diagram: - -| Class | Xbox 360 | Sony | Other | -|-------|---------------------------------|----------------------------|-----------------------| -| (1) | PlatformNetworkManagerXbox | PlatformNetworkManagerSony | PlatformNetworkManagerStub | -| (2) | Provided by QNET | SQRNetworkManager | Qnet stub* | -| (3) | NetworkPlayerXbox | NetworkPlayerSony | NetworkPlayerXbox | -| (4) | Provided by QNET | SQRNetworkPlayer | Qnet stub* | -\*Temporarily provided by `extra64.h` diff --git a/targets/app/ReadMe.txt b/targets/app/ReadMe.txt deleted file mode 100644 index f5f0faa17..000000000 --- a/targets/app/ReadMe.txt +++ /dev/null @@ -1,27 +0,0 @@ -======================================================================== - Xbox 360 APPLICATION : Minecraft.Client Project Overview -======================================================================== - -AppWizard has created this Minecraft.Client application for you. - -This file contains a summary of what you will find in each of the files that -make up your Minecraft.Client application. - -Minecraft.Client.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -Minecraft.Client.cpp - This is the main application source file. - - - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 3a499968a..b289335c3 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -53,7 +53,6 @@ common/Network/GameNetworkManager.cpp common/Network/NetworkPlayerQNet.cpp common/Network/PlatformNetworkManagerStub.cpp common/Network/QNetStubs.cpp -common/Network/Socket.cpp common/NetworkController.cpp common/SaveManager.cpp common/SkinManager.cpp diff --git a/targets/app/common/Network/Socket.cpp b/targets/minecraft/network/Socket.cpp similarity index 100% rename from targets/app/common/Network/Socket.cpp rename to targets/minecraft/network/Socket.cpp diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index bffb978e4..e5ee3dfa4 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -286,6 +286,7 @@ locale/I18n.cpp locale/Language.cpp locale/StringTable.cpp network/Connection.cpp +network/Socket.cpp network/packet/AddEntityPacket.cpp network/packet/AddExperienceOrbPacket.cpp network/packet/AddGlobalEntityPacket.cpp From d3a9de8b2aaf62f0e8ed404dcd0196ee1aa8d08d Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 10:05:35 -0500 Subject: [PATCH 058/104] start work on swapping PlatformNetworkManagerStub for PlatformNetwork --- targets/app/common/Network/GameNetworkManager.cpp | 4 ++-- targets/app/common/Network/GameNetworkManager.h | 3 --- targets/app/common_sources.txt | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 67f816462..e4cf90893 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -13,7 +13,6 @@ #include "minecraft/network/Socket.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/common/Network/PlatformNetworkManagerStub.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" @@ -54,6 +53,7 @@ #include "platform/storage/storage.h" #include "strings.h" #include "util/StringHelpers.h" +#include "platform/network/network.h" class FriendSessionInfo; class INVITE_INFO; @@ -86,7 +86,7 @@ void CGameNetworkManager::Initialise() { LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column - s_pPlatformNetworkManager = new IPlatformNetworkStub(); + s_pPlatformNetworkManager = &PlatformNetwork; s_pPlatformNetworkManager->Initialise(this, flagIndexSize); m_bNetworkThreadRunning = false; m_bInitialised = true; diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index c8de48bfd..5cde30a6b 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -7,7 +7,6 @@ #if !defined(__linux__) #include #endif -#include "PlatformNetworkManagerStub.h" #include "platform/network/IPlatformNetwork.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" @@ -29,8 +28,6 @@ class INetworkPlayer; // implementation of PlatformNetworkManager to provide this functionality. class CGameNetworkManager : public ::minecraft::network::INetworkService { - friend class IPlatformNetworkStub; - public: CGameNetworkManager(); // Misc high level flow diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index b289335c3..cda897f04 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -51,7 +51,6 @@ common/LocalizationManager.cpp common/MenuController.cpp common/Network/GameNetworkManager.cpp common/Network/NetworkPlayerQNet.cpp -common/Network/PlatformNetworkManagerStub.cpp common/Network/QNetStubs.cpp common/NetworkController.cpp common/SaveManager.cpp From a71b1036c7c59ee96b650360afbc2250f5b24d49 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:11:52 -0500 Subject: [PATCH 059/104] remove LeaderboardInterface, LeaderboardManager, LinuxLeaderboardManager, for StubLeaderboard --- .../Leaderboards/LeaderboardInterface.cpp | 100 ---- .../Leaderboards/LeaderboardInterface.h | 42 -- .../Leaderboards/LeaderboardManager.cpp | 106 ---- .../common/Leaderboards/LeaderboardManager.h | 56 -- .../Network/PlatformNetworkManagerStub.cpp | 565 ------------------ .../Network/PlatformNetworkManagerStub.h | 198 ------ .../UIScene_LeaderboardsMenu.cpp | 41 +- .../UIScene_LeaderboardsMenu.h | 6 +- targets/app/common_sources.txt | 2 - .../Leaderboards/LinuxLeaderboardManager.cpp | 7 - .../Leaderboards/LinuxLeaderboardManager.h | 52 -- targets/app/linux/Linux_Minecraft.cpp | 9 +- targets/app/linux_sources.txt | 1 - .../WindowsLeaderboardManager.cpp | 5 - .../Leaderboards/WindowsLeaderboardManager.h | 51 -- .../app/windows/src/Windows64_Minecraft.cpp | 2 +- targets/minecraft/client/Minecraft.h | 2 +- 17 files changed, 26 insertions(+), 1219 deletions(-) delete mode 100644 targets/app/common/Leaderboards/LeaderboardInterface.cpp delete mode 100644 targets/app/common/Leaderboards/LeaderboardInterface.h delete mode 100644 targets/app/common/Leaderboards/LeaderboardManager.cpp delete mode 100644 targets/app/common/Leaderboards/LeaderboardManager.h delete mode 100644 targets/app/common/Network/PlatformNetworkManagerStub.cpp delete mode 100644 targets/app/common/Network/PlatformNetworkManagerStub.h delete mode 100644 targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp delete mode 100644 targets/app/linux/Leaderboards/LinuxLeaderboardManager.h delete mode 100644 targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp delete mode 100644 targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.cpp b/targets/app/common/Leaderboards/LeaderboardInterface.cpp deleted file mode 100644 index 41cef18ae..000000000 --- a/targets/app/common/Leaderboards/LeaderboardInterface.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "LeaderboardInterface.h" - -#include - -#include "app/common/Leaderboards/LeaderboardManager.h" - -LeaderboardInterface::LeaderboardInterface(IPlatformLeaderboard* man) { - m_manager = man; - m_pending = false; - - m_filter = (IPlatformLeaderboard::EFilterMode)-1; - m_callback = nullptr; - m_difficulty = 0; - m_type = IPlatformLeaderboard::eStatsType_UNDEFINED; - m_startIndex = 0; - m_readCount = 0; - - (void)m_manager->OpenSession(); -} - -LeaderboardInterface::~LeaderboardInterface() { - m_manager->CancelOperation(); - m_manager->CloseSession(); -} - -void LeaderboardInterface::ReadStats_Friends( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int startIndex, unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_Friends; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_myUID = myUID; - m_startIndex = startIndex; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::ReadStats_MyScore( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, PlayerUID myUID, - unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_MyScore; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_myUID = myUID; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::ReadStats_TopRank( - LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, unsigned int startIndex, - unsigned int readCount) { - m_filter = IPlatformLeaderboard::eFM_TopRank; - m_pending = true; - - m_callback = callback; - m_difficulty = difficulty; - m_type = type; - m_startIndex = startIndex; - m_readCount = readCount; - - tick(); -} - -void LeaderboardInterface::CancelOperation() { - m_manager->CancelOperation(); - m_pending = false; -} - -void LeaderboardInterface::tick() { - if (m_pending) m_pending = !callManager(); -} - -bool LeaderboardInterface::callManager() { - switch (m_filter) { - case IPlatformLeaderboard::eFM_Friends: - return m_manager->ReadStats_Friends(m_callback, m_difficulty, - m_type, m_myUID, m_startIndex, - m_readCount); - case IPlatformLeaderboard::eFM_MyScore: - return m_manager->ReadStats_MyScore(m_callback, m_difficulty, - m_type, m_myUID, m_readCount); - case IPlatformLeaderboard::eFM_TopRank: - return m_manager->ReadStats_TopRank( - m_callback, m_difficulty, m_type, m_startIndex, m_readCount); - default: - assert(false); - return true; - } -} \ No newline at end of file diff --git a/targets/app/common/Leaderboards/LeaderboardInterface.h b/targets/app/common/Leaderboards/LeaderboardInterface.h deleted file mode 100644 index 4931ed643..000000000 --- a/targets/app/common/Leaderboards/LeaderboardInterface.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "LeaderboardManager.h" -#include "platform/PlatformTypes.h" - -// 4J-JEV: Simple interface for handling ReadStat failures. -class LeaderboardInterface { -private: - IPlatformLeaderboard* m_manager; - bool m_pending; - - // Arguments. - IPlatformLeaderboard::EFilterMode m_filter; - LeaderboardReadListener* m_callback; - int m_difficulty; - IPlatformLeaderboard::EStatsType m_type; - PlayerUID m_myUID; - unsigned int m_startIndex; - unsigned int m_readCount; - -public: - LeaderboardInterface(IPlatformLeaderboard* man); - ~LeaderboardInterface(); - - void ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, - PlayerUID myUID, unsigned int startIndex, - unsigned int readCount); - void ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, - PlayerUID myUID, unsigned int readCount); - void ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, - IPlatformLeaderboard::EStatsType type, - unsigned int startIndex, unsigned int readCount); - - void CancelOperation(); - - void tick(); - -private: - bool callManager(); -}; \ No newline at end of file diff --git a/targets/app/common/Leaderboards/LeaderboardManager.cpp b/targets/app/common/Leaderboards/LeaderboardManager.cpp deleted file mode 100644 index 49aa9825c..000000000 --- a/targets/app/common/Leaderboards/LeaderboardManager.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "LeaderboardManager.h" - -#include "app/linux/LinuxGame.h" -#include "util/StringHelpers.h" - -const std::string LeaderboardManager::filterNames[eNumFilterModes] = { - "Friends", "MyScore", "TopRank"}; - -void LeaderboardManager::DeleteInstance() { - delete m_instance; - m_instance = nullptr; -} - -LeaderboardManager::LeaderboardManager() { - zeroReadParameters(); - - m_myXUID = INVALID_XUID; -} - -void LeaderboardManager::zeroReadParameters() { - m_difficulty = -1; - m_statsType = eStatsType_UNDEFINED; - m_readListener = nullptr; - m_startIndex = 0; - m_readCount = 0; - m_eFilterMode = eFM_UNDEFINED; -} - -bool LeaderboardManager::ReadStats_Friends(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int startIndex, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_eFilterMode = eFM_Friends; - return true; -} - -bool LeaderboardManager::ReadStats_MyScore(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - PlayerUID myUID, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_readCount = readCount; - - m_eFilterMode = eFM_MyScore; - return true; -} - -bool LeaderboardManager::ReadStats_TopRank(LeaderboardReadListener* listener, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - zeroReadParameters(); - - m_readListener = listener; - m_difficulty = difficulty; - m_statsType = type; - - m_startIndex = startIndex; - m_readCount = readCount; - - m_eFilterMode = eFM_TopRank; - return true; -} - -void LeaderboardManager::printStats(ReadView& view) { - app.DebugPrintf( - "[LeaderboardManager] Printing stats:\n" - "\tnumQueries=%i\n", - view.m_numQueries); - - for (unsigned int i = 0; i < view.m_numQueries; i++) { - ReadScore score = view.m_queries[i]; - - app.DebugPrintf("\tname='%s'\n", score.m_name.c_str()); - app.DebugPrintf("\trank='%i'\n", score.m_rank); - - app.DebugPrintf("\tstatsData=["); - for (int j = 0; j < score.m_statsSize; j++) - app.DebugPrintf(" %i", score.m_statsData[j]); - app.DebugPrintf("]\n"); - } -} - -bool DebugReadListener::OnStatsReadComplete( - IPlatformLeaderboard::eStatsReturn success, int numResults, - IPlatformLeaderboard::ViewOut results) { - app.DebugPrintf("[DebugReadListener] OnStatsReadComplete, %s:\n", - (success ? "success" : "FAILED")); - LeaderboardManager::printStats(results); - - return true; -} - -DebugReadListener* DebugReadListener::m_instance = new DebugReadListener(); diff --git a/targets/app/common/Leaderboards/LeaderboardManager.h b/targets/app/common/Leaderboards/LeaderboardManager.h deleted file mode 100644 index 9980392c4..000000000 --- a/targets/app/common/Leaderboards/LeaderboardManager.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include - -#include "platform/leaderboard/IPlatformLeaderboard.h" - -class LeaderboardManager : public IPlatformLeaderboard { -public: - static const std::string filterNames[eNumFilterModes]; - - LeaderboardManager(); - virtual ~LeaderboardManager() {} - - // Singleton - static IPlatformLeaderboard* Instance() { return m_instance; } - static void DeleteInstance(); - - // IPlatformLeaderboard pure virtuals - subclasses must implement: - // Tick, OpenSession, CloseSession, DeleteSession, WriteStats, - // FlushStats, CancelOperation, isIdle - - // Base implementations for read operations - bool ReadStats_Friends(LeaderboardReadListener* callback, int difficulty, - EStatsType type, PlayerUID myUID, - unsigned int startIndex, - unsigned int readCount) override; - bool ReadStats_MyScore(LeaderboardReadListener* callback, int difficulty, - EStatsType type, PlayerUID myUID, - unsigned int readCount) override; - bool ReadStats_TopRank(LeaderboardReadListener* callback, int difficulty, - EStatsType type, unsigned int startIndex, - unsigned int readCount) override; - - static void printStats(ReadView& view); - -protected: - virtual void zeroReadParameters(); - - EFilterMode m_eFilterMode; - int m_difficulty; - EStatsType m_statsType; - LeaderboardReadListener* m_readListener; - PlayerUID m_myXUID; - unsigned int m_startIndex, m_readCount; - -private: - static LeaderboardManager* m_instance; -}; - -class DebugReadListener : public LeaderboardReadListener { -public: - bool OnStatsReadComplete(IPlatformLeaderboard::eStatsReturn ret, - int numResults, - IPlatformLeaderboard::ViewOut results) override; - static DebugReadListener* m_instance; -}; diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.cpp b/targets/app/common/Network/PlatformNetworkManagerStub.cpp deleted file mode 100644 index c27df2a8f..000000000 --- a/targets/app/common/Network/PlatformNetworkManagerStub.cpp +++ /dev/null @@ -1,565 +0,0 @@ -#include "PlatformNetworkManagerStub.h" - -#include -#include - -#include - -#include "NetworkPlayerQNet.h" -#include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/Socket.h" -#include "app/linux/LinuxGame.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/C4JThread.h" -#include "platform/NetTypes.h" - -IPlatformNetworkStub* g_pPlatformNetworkManager; - -void IPlatformNetworkStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { - const char* pszDescription; - - // 4J Stu - We create a fake socket for every where that we need an INBOUND - // queue of game data. Outbound is all handled by QNet so we don't need - // that. Therefore each client player has one, and the host has one for each - // client player. - bool createFakeSocket = false; - bool localPlayer = false; - - NetworkPlayerQNet* networkPlayer = - (NetworkPlayerQNet*)addNetworkPlayer(pQNetPlayer); - - if (pQNetPlayer->IsLocal()) { - localPlayer = true; - if (pQNetPlayer->IsHost()) { - pszDescription = "local host"; - // 4J Stu - No socket for the localhost as it uses a special - // loopback queue - - m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); - } else { - pszDescription = "local"; - - // We need an inbound queue on all local players to receive data - // from the host - createFakeSocket = true; - } - } else { - if (pQNetPlayer->IsHost()) { - pszDescription = "remote host"; - } else { - pszDescription = "remote"; - - // If we are the host, then create a fake socket for every remote - // player - if (m_pIQNet->IsHost()) { - createFakeSocket = true; - } - } - - if (m_pIQNet->IsHost() && !m_bHostChanged) { - // Do we already have a primary player for this system? - bool systemHasPrimaryPlayer = false; - for (auto it = m_machineQNetPrimaryPlayers.begin(); - it < m_machineQNetPrimaryPlayers.end(); ++it) { - IQNetPlayer* pQNetPrimaryPlayer = *it; - if (pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer)) { - systemHasPrimaryPlayer = true; - break; - } - } - if (!systemHasPrimaryPlayer) - m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); - } - } - g_NetworkManager.PlayerJoining(networkPlayer); - - if (createFakeSocket == true && !m_bHostChanged) { - g_NetworkManager.CreateSocket(networkPlayer, localPlayer); - } - - app.DebugPrintf("Player 0x%p \"%s\" joined; %s; voice %i; camera %i.\n", - pQNetPlayer, pQNetPlayer->GetGamertag(), pszDescription, - (int)pQNetPlayer->HasVoice(), - (int)pQNetPlayer->HasCamera()); - - if (m_pIQNet->IsHost()) { - // 4J-PB - only the host should do this - // g_NetworkManager.UpdateAndSetGameSessionData(); - SystemFlagAddPlayer(networkPlayer); - } - - for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (playerChangedCallback[idx]) - playerChangedCallback[idx](networkPlayer, false); - } - - if (m_pIQNet->GetState() == QNET_STATE_GAME_PLAY) { - int localPlayerCount = 0; - for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr) - ++localPlayerCount; - } - - float appTime = app.getAppTime(); - - // Only record stats for the primary player here - m_lastPlayerEventTimeStart = appTime; - } -} - -bool IPlatformNetworkStub::Initialise(CGameNetworkManager* pGameNetworkManager, - int flagIndexSize) { - m_pGameNetworkManager = pGameNetworkManager; - m_flagIndexSize = flagIndexSize; - g_pPlatformNetworkManager = this; - // 4jcraft added this, as it was never called - m_pIQNet = new IQNet(); - for (int i = 0; i < XUSER_MAX_COUNT; i++) { - playerChangedCallback[i] = nullptr; - } - - m_bLeavingGame = false; - m_bLeaveGameOnTick = false; - m_bHostChanged = false; - - m_bSearchResultsReady = false; - m_bSearchPending = false; - - m_bIsOfflineGame = false; - m_SessionsUpdatedCallback = nullptr; - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - - // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; - m_currentSearchResultsCount[i] = 0; - } - - // Success! - return true; -} - -void IPlatformNetworkStub::Terminate() { - // TODO: 4jcraft, no release of ressources -} - -int IPlatformNetworkStub::GetJoiningReadyPercentage() { return 100; } - -int IPlatformNetworkStub::CorrectErrorIDS(int IDS) { return IDS; } - -bool IPlatformNetworkStub::isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer) { - return true; -} - -// We call this twice a frame, either side of the render call so is a good place -// to "tick" things -void IPlatformNetworkStub::DoWork() {} - -int IPlatformNetworkStub::GetPlayerCount() { - return m_pIQNet->GetPlayerCount(); -} - -bool IPlatformNetworkStub::ShouldMessageForFullSession() { return false; } - -int IPlatformNetworkStub::GetOnlinePlayerCount() { return 1; } - -int IPlatformNetworkStub::GetLocalPlayerMask(int playerIndex) { - return 1 << playerIndex; -} - -bool IPlatformNetworkStub::AddLocalPlayerByUserIndex(int userIndex) { - NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); - return (m_pIQNet->AddLocalPlayerByUserIndex(userIndex) == 0); -} - -bool IPlatformNetworkStub::RemoveLocalPlayerByUserIndex(int userIndex) { - return true; -} - -bool IPlatformNetworkStub::IsInStatsEnabledSession() { return true; } - -bool IPlatformNetworkStub::SessionHasSpace(unsigned int spaceRequired /*= 1*/) { - return true; -} - -void IPlatformNetworkStub::SendInviteGUI(int quadrant) {} - -bool IPlatformNetworkStub::IsAddingPlayer() { return false; } - -bool IPlatformNetworkStub::LeaveGame(bool bMigrateHost) { - if (m_bLeavingGame) return true; - - m_bLeavingGame = true; - - // If we are the host wait for the game server to end - if (m_pIQNet->IsHost() && g_NetworkManager.ServerStoppedValid()) { - m_pIQNet->EndGame(); - g_NetworkManager.ServerStoppedWait(); - g_NetworkManager.ServerStoppedDestroy(); - } - return true; -} - -bool IPlatformNetworkStub::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) { - return true; -} - -void IPlatformNetworkStub::HostGame( - int localUsersMask, bool bOnlineGame, bool bIsPrivate, - unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, - unsigned char privateSlots /*= 0*/) { - // #ifdef 0 - // 4J Stu - We probably did this earlier as well, but just to be sure! - SetLocalGame(!bOnlineGame); - SetPrivateGame(bIsPrivate); - SystemFlagReset(); - - // Make sure that the Primary Pad is in by default - localUsersMask |= GetLocalPlayerMask(g_NetworkManager.GetPrimaryPad()); - - m_bLeavingGame = false; - - m_pIQNet->HostGame(); - - _HostGame(localUsersMask, publicSlots, privateSlots); - // #endif -} - -void IPlatformNetworkStub::_HostGame( - int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, - unsigned char privateSlots /*= 0*/) {} - -bool IPlatformNetworkStub::_StartGame() { return true; } - -int IPlatformNetworkStub::JoinGame(FriendSessionInfo* searchResult, - int localUsersMask, int primaryUserIndex) { - return CGameNetworkManager::JOINGAME_SUCCESS; -} - -bool IPlatformNetworkStub::SetLocalGame(bool isLocal) { - m_bIsOfflineGame = isLocal; - - return true; -} - -void IPlatformNetworkStub::SetPrivateGame(bool isPrivate) { - app.DebugPrintf("Setting as private game: %s\n", isPrivate ? "yes" : "no"); - m_bIsPrivateGame = isPrivate; -} - -void IPlatformNetworkStub::RegisterPlayerChangedCallback( - int iPad, - std::function callback) { - playerChangedCallback[iPad] = std::move(callback); -} - -void IPlatformNetworkStub::UnRegisterPlayerChangedCallback(int iPad) { - playerChangedCallback[iPad] = nullptr; -} - -void IPlatformNetworkStub::HandleSignInChange() { return; } - -bool IPlatformNetworkStub::_RunNetworkGame() { return true; } - -void IPlatformNetworkStub::UpdateAndSetGameSessionData( - INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) { - // uint32_t playerCount = m_pIQNet->GetPlayerCount(); - // - // if( this->m_bLeavingGame ) - // return; - // - // if( GetHostPlayer() == nullptr ) - // return; - // - // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) - // { - // if( i < playerCount ) - // { - // INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i); - // - // // We can call this from NotifyPlayerLeaving but at that - // point the player is still considered in the session - // if( pNetworkPlayer != pNetworkPlayerLeaving ) - // { - // m_hostGameSessionData.players[i] = - // ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID(); - // - // char *temp; - // temp = (char *)wstring_to_string( - // pNetworkPlayer->GetOnlineName() ); - // memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE); - // } - // else - // { - // m_hostGameSessionData.players[i] = nullptr; - // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); - // } - // } - // else - // { - // m_hostGameSessionData.players[i] = nullptr; - // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); - // } - // } - // - // m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox - // *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); - // m_hostGameSessionData.m_uiGameHostSettings = - // app.GetGameHostOption(eGameHostOption_All); -} - -int IPlatformNetworkStub::RemovePlayerOnSocketClosedThreadProc(void* lpParam) { - INetworkPlayer* pNetworkPlayer = (INetworkPlayer*)lpParam; - - Socket* socket = pNetworkPlayer->GetSocket(); - - if (socket != nullptr) { - // printf("Waiting for socket closed event\n"); - socket->m_socketClosedEvent->waitForSignal(C4JThread::kInfiniteTimeout); - - // printf("Socket closed event has fired\n"); - // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket(nullptr); - delete socket; - } - - return g_pPlatformNetworkManager->RemoveLocalPlayer(pNetworkPlayer); -} - -bool IPlatformNetworkStub::RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) { - return true; -} - -IPlatformNetworkStub::PlayerFlags::PlayerFlags(INetworkPlayer* pNetworkPlayer, - unsigned int count) { - // 4J Stu - Don't assert, just make it a multiple of 8! This count is - // calculated from a load of separate values, and makes tweaking - // world/render sizes a pain if we hit an assert here - count = (count + 8 - 1) & ~(8 - 1); - // assert( ( count % 8 ) == 0 ); - this->m_pNetworkPlayer = pNetworkPlayer; - this->flags = new unsigned char[count / 8]; - memset(this->flags, 0, count / 8); - this->count = count; -} -IPlatformNetworkStub::PlayerFlags::~PlayerFlags() { delete[] flags; } - -// Add a player to the per system flag storage - if we've already got a player -// from that system, copy its flags over -void IPlatformNetworkStub::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { - PlayerFlags* newPlayerFlags = - new PlayerFlags(pNetworkPlayer, m_flagIndexSize); - // If any of our existing players are on the same system, then copy over - // flags from that one - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { - memcpy(newPlayerFlags->flags, m_playerFlags[i]->flags, - m_playerFlags[i]->count / 8); - break; - } - } - m_playerFlags.push_back(newPlayerFlags); -} - -// Remove a player from the per system flag storage - just maintains the -// m_playerFlags vector without any gaps in it -void IPlatformNetworkStub::SystemFlagRemovePlayer( - INetworkPlayer* pNetworkPlayer) { - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { - delete m_playerFlags[i]; - m_playerFlags[i] = m_playerFlags.back(); - m_playerFlags.pop_back(); - return; - } - } -} - -void IPlatformNetworkStub::SystemFlagReset() { - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - delete m_playerFlags[i]; - } - m_playerFlags.clear(); -} - -// Set a per system flag - this is done by setting the flag on every player that -// shares that system -void IPlatformNetworkStub::SystemFlagSet(INetworkPlayer* pNetworkPlayer, - int index) { - if ((index < 0) || (index >= m_flagIndexSize)) return; - if (pNetworkPlayer == nullptr) return; - - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { - m_playerFlags[i]->flags[index / 8] |= (128 >> (index % 8)); - } - } -} - -// Get value of a per system flag - can be read from the flags of the passed in -// player as anything else sent to that system should also have been duplicated -// here -bool IPlatformNetworkStub::SystemFlagGet(INetworkPlayer* pNetworkPlayer, - int index) { - if ((index < 0) || (index >= m_flagIndexSize)) return false; - if (pNetworkPlayer == nullptr) { - return false; - } - - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { - return ((m_playerFlags[i]->flags[index / 8] & - (128 >> (index % 8))) != 0); - } - } - return false; -} - -std::string IPlatformNetworkStub::GatherStats() { return ""; } - -std::string IPlatformNetworkStub::GatherRTTStats() { - std::string stats("Rtt: "); - - char stat[32]; - - for (unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer* pQNetPlayer = - ((NetworkPlayerQNet*)GetPlayerByIndex(i))->GetQNetPlayer(); - - if (!pQNetPlayer->IsLocal()) { - memset(stat, 0, 32 * sizeof(char)); - snprintf(stat, 32, "%d: %d/", i, pQNetPlayer->GetCurrentRtt()); - stats.append(stat); - } - } - return stats; -} - -void IPlatformNetworkStub::TickSearch() {} - -void IPlatformNetworkStub::SearchForGames() {} - -int IPlatformNetworkStub::SearchForGamesThreadProc(void* lpParameter) { - return 0; -} - -void IPlatformNetworkStub::SetSearchResultsReady(int resultCount) { - m_bSearchResultsReady = true; - m_searchResultsCount[m_lastSearchPad] = resultCount; -} - -std::vector* IPlatformNetworkStub::GetSessionList( - int iPad, int localPlayers, bool partyOnly) { - std::vector* filteredList = - new std::vector(); - ; - return filteredList; -} - -bool IPlatformNetworkStub::GetGameSessionInfo( - int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) { - return false; -} - -void IPlatformNetworkStub::SetSessionsUpdatedCallback( - std::function callback) { - m_SessionsUpdatedCallback = std::move(callback); -} - -void IPlatformNetworkStub::GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback) { - callback(true); -} - -void IPlatformNetworkStub::ForceFriendsSessionRefresh() { - app.DebugPrintf("Resetting friends session search data\n"); - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; - } -} - -INetworkPlayer* IPlatformNetworkStub::addNetworkPlayer( - IQNetPlayer* pQNetPlayer) { - NetworkPlayerQNet* pNetworkPlayer = new NetworkPlayerQNet(pQNetPlayer); - pQNetPlayer->SetCustomDataValue((uintptr_t)pNetworkPlayer); - currentNetworkPlayers.push_back(pNetworkPlayer); - return pNetworkPlayer; -} - -void IPlatformNetworkStub::removeNetworkPlayer(IQNetPlayer* pQNetPlayer) { - INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - for (auto it = currentNetworkPlayers.begin(); - it != currentNetworkPlayers.end(); it++) { - if (*it == pNetworkPlayer) { - currentNetworkPlayers.erase(it); - return; - } - } -} - -INetworkPlayer* IPlatformNetworkStub::getNetworkPlayer( - IQNetPlayer* pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer*)(pQNetPlayer->GetCustomDataValue()) - : nullptr; -} - -INetworkPlayer* IPlatformNetworkStub::GetLocalPlayerByUserIndex(int userIndex) { - return getNetworkPlayer(m_pIQNet->GetLocalPlayerByUserIndex(userIndex)); -} - -INetworkPlayer* IPlatformNetworkStub::GetPlayerByIndex(int playerIndex) { - return getNetworkPlayer(m_pIQNet->GetPlayerByIndex(playerIndex)); -} - -INetworkPlayer* IPlatformNetworkStub::GetPlayerByXuid(PlayerUID xuid) { - return getNetworkPlayer(m_pIQNet->GetPlayerByXuid(xuid)); -} - -INetworkPlayer* IPlatformNetworkStub::GetPlayerBySmallId( - unsigned char smallId) { - return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId)); -} - -INetworkPlayer* IPlatformNetworkStub::GetHostPlayer() { - return getNetworkPlayer(m_pIQNet->GetHostPlayer()); -} - -bool IPlatformNetworkStub::IsHost() { - return m_pIQNet->IsHost() && !m_bHostChanged; -} - -bool IPlatformNetworkStub::JoinGameFromInviteInfo( - int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { - return (m_pIQNet->JoinGameFromInviteInfo(userIndex, userMask, - pInviteInfo) == 0); -} - -void IPlatformNetworkStub::SetSessionTexturePackParentId(int id) { - m_hostGameSessionData.texturePackParentId = id; -} - -void IPlatformNetworkStub::SetSessionSubTexturePackId(int id) { - m_hostGameSessionData.subTexturePackId = id; -} - -void IPlatformNetworkStub::Notify(int ID, uintptr_t Param) {} - -bool IPlatformNetworkStub::IsInSession() { - return m_pIQNet->GetState() != QNET_STATE_IDLE; -} - -bool IPlatformNetworkStub::IsInGameplay() { - return m_pIQNet->GetState() == QNET_STATE_GAME_PLAY; -} - -bool IPlatformNetworkStub::IsReadyToPlayOrIdle() { return true; } diff --git a/targets/app/common/Network/PlatformNetworkManagerStub.h b/targets/app/common/Network/PlatformNetworkManagerStub.h deleted file mode 100644 index f1ee2bd3c..000000000 --- a/targets/app/common/Network/PlatformNetworkManagerStub.h +++ /dev/null @@ -1,198 +0,0 @@ -#pragma once -#include -// using namespace std; -#include -#include - -#include "platform/network/IPlatformNetwork.h" -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "minecraft/network/platform/SessionInfo.h" -#include "platform/C4JThread.h" -#include "platform/NetTypes.h" -#include "platform/PlatformTypes.h" -#include "platform/XboxStubs.h" - -class C4JThread; -class CGameNetworkManager; -class INetworkPlayer; - -class IPlatformNetworkStub : public IPlatformNetwork { - friend class CGameNetworkManager; - -public: - virtual bool Initialise(CGameNetworkManager* pGameNetworkManager, - int flagIndexSize); - virtual void Terminate(); - virtual int GetJoiningReadyPercentage(); - virtual int CorrectErrorIDS(int IDS); - - virtual void DoWork(); - virtual int GetPlayerCount(); - virtual int GetOnlinePlayerCount(); - virtual int GetLocalPlayerMask(int playerIndex); - virtual bool AddLocalPlayerByUserIndex(int userIndex); - virtual bool RemoveLocalPlayerByUserIndex(int userIndex); - virtual INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); - virtual INetworkPlayer* GetPlayerByIndex(int playerIndex); - virtual INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); - virtual INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); - virtual bool ShouldMessageForFullSession(); - - virtual INetworkPlayer* GetHostPlayer(); - virtual bool IsHost(); - virtual bool JoinGameFromInviteInfo(int userIndex, int userMask, - const INVITE_INFO* pInviteInfo); - virtual bool LeaveGame(bool bMigrateHost); - - virtual bool IsInSession(); - virtual bool IsInGameplay(); - virtual bool IsReadyToPlayOrIdle(); - virtual bool IsInStatsEnabledSession(); - virtual bool SessionHasSpace(unsigned int spaceRequired = 1); - virtual void SendInviteGUI(int quadrant); - virtual bool IsAddingPlayer(); - - virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, - unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0); - virtual int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, - int primaryUserIndex); - virtual bool SetLocalGame(bool isLocal); - virtual bool IsLocalGame() { return m_bIsOfflineGame; } - virtual void SetPrivateGame(bool isPrivate); - virtual bool IsPrivateGame() { return m_bIsPrivateGame; } - virtual bool IsLeavingGame() { return m_bLeavingGame; } - virtual void ResetLeavingGame() { m_bLeavingGame = false; } - - virtual void RegisterPlayerChangedCallback( - int iPad, - std::function callback); - virtual void UnRegisterPlayerChangedCallback(int iPad); - - virtual void HandleSignInChange(); - - virtual bool _RunNetworkGame(); - -private: - bool isSystemPrimaryPlayer(IQNetPlayer* pQNetPlayer); - virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); - virtual void _HostGame( - int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, - unsigned char privateSlots = 0); - virtual bool _StartGame(); - - IQNet* m_pIQNet; // pointer to QNet interface - - void* m_notificationListener; - - std::vector - m_machineQNetPrimaryPlayers; // collection of players that we deem to - // be the main one for that system - - bool m_bLeavingGame; - bool m_bLeaveGameOnTick; - bool m_migrateHostOnLeave; - bool m_bHostChanged; - - bool m_bIsOfflineGame; - bool m_bIsPrivateGame; - int m_flagIndexSize; - - // This is only maintained by the host, and is not valid on client machines - GameSessionData m_hostGameSessionData; - CGameNetworkManager* m_pGameNetworkManager; - -public: - virtual void UpdateAndSetGameSessionData( - INetworkPlayer* pNetworkPlayerLeaving = nullptr); - -private: - std::function - playerChangedCallback[XUSER_MAX_COUNT]; - - static int RemovePlayerOnSocketClosedThreadProc(void* lpParam); - virtual bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); - - // Things for handling per-system flags - class PlayerFlags { - public: - INetworkPlayer* m_pNetworkPlayer; - unsigned char* flags; - unsigned int count; - PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); - ~PlayerFlags(); - }; - std::vector m_playerFlags; - void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); - void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); - void SystemFlagReset(); - -public: - virtual void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); - virtual bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); - - // For telemetry -private: - float m_lastPlayerEventTimeStart; - -public: - std::string GatherStats(); - std::string GatherRTTStats(); - -private: - std::vector friendsSessions[XUSER_MAX_COUNT]; - int m_searchResultsCount[XUSER_MAX_COUNT]; - int m_lastSearchStartTime[XUSER_MAX_COUNT]; - - // The results that will be filled in with the current search - XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pQoSResult[XUSER_MAX_COUNT]; - - // The results from the previous search, which are currently displayed in - // the game - XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT]; - int m_currentSearchResultsCount[XUSER_MAX_COUNT]; - - int m_lastSearchPad; - bool m_bSearchResultsReady; - bool m_bSearchPending; - std::function m_SessionsUpdatedCallback; - - C4JThread* m_SearchingThread; - - void TickSearch(); - void SearchForGames(); - static int SearchForGamesThreadProc(void* lpParameter); - - void SetSearchResultsReady(int resultCount = 0); - - std::vector currentNetworkPlayers; - INetworkPlayer* addNetworkPlayer(IQNetPlayer* pQNetPlayer); - void removeNetworkPlayer(IQNetPlayer* pQNetPlayer); - static INetworkPlayer* getNetworkPlayer(IQNetPlayer* pQNetPlayer); - - virtual void SetSessionTexturePackParentId(int id); - virtual void SetSessionSubTexturePackId(int id); - virtual void Notify(int ID, uintptr_t Param); - -public: - virtual std::vector* GetSessionList(int iPad, - int localPlayers, - bool partyOnly); - virtual bool GetGameSessionInfo(int iPad, SessionID sessionId, - FriendSessionInfo* foundSession); - virtual void SetSessionsUpdatedCallback(std::function callback); - virtual void GetFullFriendSessionInfo( - FriendSessionInfo* foundSession, - std::function callback); - virtual void ForceFriendsSessionRefresh(); - -private: - void NotifyPlayerJoined(IQNetPlayer* pQNetPlayer); - - void FakeLocalPlayerJoined() { - NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); - } -}; 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 6708700e1..d12888702 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,8 +8,7 @@ #include -#include "app/common/Leaderboards/LeaderboardInterface.h" -#include "app/common/Leaderboards/LeaderboardManager.h" +#include "platform/leaderboard/leaderboard.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UILayer.h" @@ -96,7 +95,7 @@ const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu:: UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, UILayer* parentLayer) - : UIScene(iPad, parentLayer), m_interface(LeaderboardManager::Instance()) { + : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene initialiseMovie(); @@ -159,7 +158,7 @@ std::string UIScene_LeaderboardsMenu::getMoviePath() { void UIScene_LeaderboardsMenu::tick() { UIScene::tick(); - m_interface.tick(); + PlatformLeaderboard.Tick(); } void UIScene_LeaderboardsMenu::handleReload() { @@ -208,7 +207,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -241,7 +240,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -272,7 +271,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -286,7 +285,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests if (pressed && m_bPopulatedOnce && - LeaderboardManager::Instance()->isIdle()) { + PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -348,7 +347,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { m_newEntryIndex = (unsigned int)startIndex; // m_newReadSize = std::min((int)READ_SIZE, // (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); - } + } // app.DebugPrintf("Requesting stats read %d - %d - %d\n", // m_currentLeaderboard, startIndex == -1 ? m_currentFilter : @@ -366,7 +365,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { switch (filtermode) { case IPlatformLeaderboard::eFM_TopRank: { - m_interface.ReadStats_TopRank( + PlatformLeaderboard.ReadStats_TopRank( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, m_newEntryIndex, m_newReadSize); @@ -375,7 +374,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { PlayerUID uid; PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); - m_interface.ReadStats_MyScore( + PlatformLeaderboard.ReadStats_MyScore( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, uid /*ignored on PS3*/, m_newReadSize); @@ -384,7 +383,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { PlayerUID uid; PlatformProfile.GetXUID(PlatformProfile.GetPrimaryPad(), &uid, true); - m_interface.ReadStats_Friends( + PlatformLeaderboard.ReadStats_Friends( this, m_currentDifficulty, (IPlatformLeaderboard::EStatsType)m_currentLeaderboard, uid /*ignored on PS3*/, m_newEntryIndex, m_newReadSize); @@ -406,7 +405,7 @@ bool UIScene_LeaderboardsMenu::OnStatsReadComplete( m_isProcessingStatsRead = true; - // bool noResults = LeaderboardManager::Instance()->GetStatsState() != + // bool noResults = PlatformLeaderboard.GetStatsState() != // XboxIPlatformLeaderboard::eStatsState_Ready; bool ret; @@ -416,7 +415,7 @@ bool UIScene_LeaderboardsMenu::OnStatsReadComplete( m_stats = results; ret = RetrieveStats(); - // else LeaderboardManager::Instance()->SetStatsRetrieved(false); + // else PlatformLeaderboard.SetStatsRetrieved(false); PopulateLeaderboard(retIn); @@ -484,7 +483,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { m_leaderboard.m_entries[entryIndex].m_bRequestedFriend = false; } - // LeaderboardManager::Instance()->SetStatsRetrieved(true); + // PlatformLeaderboard.SetStatsRetrieved(true); m_newEntryIndex = 0; m_newEntriesCount = NUM_ENTRIES; @@ -492,11 +491,11 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { return true; } - // assert( LeaderboardManager::Instance()->GetStats() != nullptr ); + // assert( PlatformLeaderboard.GetStats() != nullptr ); // PXUSER_STATS_READ_RESULTS stats = - // LeaderboardManager::Instance()->GetStats(); if( m_currentFilter == + // PlatformLeaderboard.GetStats(); if( m_currentFilter == // IPlatformLeaderboard::eFM_Friends ) - // LeaderboardManager::Instance()->SortFriendStats(); + // PlatformLeaderboard.SortFriendStats(); bool isDistanceLeaderboard = LEADERBOARD_DESCRIPTORS[m_currentLeaderboard][m_currentDifficulty] @@ -514,7 +513,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() { : m_numStats; if (m_leaderboard.m_totalEntryCount == 0 || m_newEntriesCount == 0) { - // LeaderboardManager::Instance()->SetStatsRetrieved(false); + // PlatformLeaderboard.SetStatsRetrieved(false); return false; } @@ -826,7 +825,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { if (m_leaderboard.m_totalEntryCount > 0 && (item + 1) < GetEntryStartIndex()) { - if (LeaderboardManager::Instance()->isIdle()) { + if (PlatformLeaderboard.isIdle()) { int readIndex = (GetEntryStartIndex() + 1) - READ_SIZE; if (readIndex <= 0) readIndex = 1; assert(readIndex >= 1 && @@ -836,7 +835,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { } else if (m_leaderboard.m_totalEntryCount > 0 && (item + 1) >= (GetEntryStartIndex() + m_leaderboard.m_entries.size())) { - if (LeaderboardManager::Instance()->isIdle()) { + if (PlatformLeaderboard.isIdle()) { int readIndex = (GetEntryStartIndex() + 1) + m_leaderboard.m_entries.size(); assert(readIndex >= 1 && 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 597c3efa4..5660dc573 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 @@ -3,8 +3,6 @@ #include #include -#include "app/common/Leaderboards/LeaderboardInterface.h" -#include "app/common/Leaderboards/LeaderboardManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" @@ -12,6 +10,8 @@ #include "app/linux/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #include "platform/storage/storage.h" +#include "platform/leaderboard/leaderboard.h" + #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif @@ -98,8 +98,6 @@ private: bool m_bPopulatedOnce; bool m_bReady; - LeaderboardInterface m_interface; - UIControl_LeaderboardList m_listEntries; UIControl_Label m_labelFilter, m_labelLeaderboard, m_labelEntries, m_labelInfo; diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index cda897f04..404baea0f 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -45,8 +45,6 @@ common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp common/GameRules/LevelRules/Rules/GameRule.cpp common/GameSettingsManager.cpp common/Game_XuiActions.cpp -common/Leaderboards/LeaderboardInterface.cpp -common/Leaderboards/LeaderboardManager.cpp common/LocalizationManager.cpp common/MenuController.cpp common/Network/GameNetworkManager.cpp diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp deleted file mode 100644 index dda0e9728..000000000 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "LinuxLeaderboardManager.h" - -#include "app/common/Leaderboards/LeaderboardManager.h" - -LeaderboardManager* LeaderboardManager::m_instance = - new LinuxLeaderboardManager(); // Singleton instance of the - // LeaderboardManager \ No newline at end of file diff --git a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h b/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h deleted file mode 100644 index cdca7a091..000000000 --- a/targets/app/linux/Leaderboards/LinuxLeaderboardManager.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "app/common/Leaderboards/LeaderboardManager.h" -#include "platform/PlatformTypes.h" - -class LinuxLeaderboardManager : public LeaderboardManager { -public: - virtual void Tick() {} - - // Open a session - virtual bool OpenSession() { return true; } - - // Close a session - virtual void CloseSession() {} - - // Delete a session - virtual void DeleteSession() {} - - // Write the given stats - // This is called synchronously and will not free any memory allocated for - // views when it is done - - virtual bool WriteStats(unsigned int viewCount, ViewIn views) { - return false; - } - - virtual bool ReadStats_Friends(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID) { - return false; - } - virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID, unsigned int readCount) { - return false; - } - virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - return false; - } - - // Perform a flush of the stats - virtual void FlushStats() {} - - // Cancel the current operation - virtual void CancelOperation() {} - - // Is the leaderboard manager idle. - virtual bool isIdle() { return true; } -}; diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 500d4312e..44029ade7 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -48,7 +48,7 @@ static void sigsegv_handler(int sig) { #include #include -#include "app/common/Leaderboards/LeaderboardManager.h" +#include "platform/leaderboard/leaderboard.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/level/Level.h" // #include "../Common/XUI/XUI_Scene_Container.h" @@ -71,11 +71,6 @@ static void sigsegv_handler(int sig) { #include "minecraft/world/level/tile/Tile.h" #include "strings.h" -// #include "../Orbis/Leaderboards/OrbisLeaderboardManager.h" - -// #include "../Orbis/Network/Orbis_NPToolkit.h" -// #include "../Orbis/Network/SonyVoiceChat_Orbis.h" - #define THEME_NAME "584111F70AAAAAAA" #define THEME_FILESIZE 2797568 @@ -518,7 +513,7 @@ int main(int argc, const char* argv[]) { // scenes) and pass it down via constructor injection. Once the UI // side is also injected, the singleton can be deleted entirely and // the backend constructed via std::make_unique here. - Minecraft::main(*LeaderboardManager::Instance()); + Minecraft::main(PlatformLeaderboard); Minecraft* pMinecraft = Minecraft::GetInstance(); app.InitGameSettings(); diff --git a/targets/app/linux_sources.txt b/targets/app/linux_sources.txt index 209dba15b..13d7459dc 100644 --- a/targets/app/linux_sources.txt +++ b/targets/app/linux_sources.txt @@ -1,5 +1,4 @@ linux/Iggy/gdraw/gdraw.c -linux/Leaderboards/LinuxLeaderboardManager.cpp linux/LinuxGame.cpp linux/Linux_Minecraft.cpp linux/Linux_UIController.cpp diff --git a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp deleted file mode 100644 index fed315b0e..000000000 --- a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "WindowsLeaderboardManager.h" - -LeaderboardManager* LeaderboardManager::m_instance = - new WindowsLeaderboardManager(); // Singleton instance of the - // LeaderboardManager \ No newline at end of file diff --git a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h b/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h deleted file mode 100644 index df81e27d6..000000000 --- a/targets/app/windows/src/Leaderboards/WindowsLeaderboardManager.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include "app/common/Leaderboards/LeaderboardManager.h" - -class WindowsLeaderboardManager : public LeaderboardManager { -public: - virtual void Tick() {} - - // Open a session - virtual bool OpenSession() { return true; } - - // Close a session - virtual void CloseSession() {} - - // Delete a session - virtual void DeleteSession() {} - - // Write the given stats - // This is called synchronously and will not free any memory allocated for - // views when it is done - - virtual bool WriteStats(unsigned int viewCount, ViewIn views) { - return false; - } - - virtual bool ReadStats_Friends(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID) { - return false; - } - virtual bool ReadStats_MyScore(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - PlayerUID myUID, unsigned int readCount) { - return false; - } - virtual bool ReadStats_TopRank(LeaderboardReadListener* callback, - int difficulty, EStatsType type, - unsigned int startIndex, - unsigned int readCount) { - return false; - } - - // Perform a flush of the stats - virtual void FlushStats() {} - - // Cancel the current operation - virtual void CancelOperation() {} - - // Is the leaderboard manager idle. - virtual bool isIdle() { return true; } -}; diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp index 4fdb59ee2..5abe340b9 100644 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ b/targets/app/windows/src/Windows64_Minecraft.cpp @@ -804,7 +804,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // g_NetworkManager.DoWork(); - // LeaderboardManager::Instance()->Tick(); + // PlatformLeaderboard.Tick(); // Render game graphics. if (app.GetGameStarted()) { pMinecraft->run_middle(); diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 0d4b83764..5c2c3d45b 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -12,6 +12,7 @@ #include "platform/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/stubs.h" +#include "platform/leaderboard/leaderboard.h" class Timer; class MultiPlayerLevel; @@ -32,7 +33,6 @@ class HumanoidModel; class HitResult; class Options; class ConsoleSoundEngine; -class IPlatformLeaderboard; class MinecraftApplet; class MouseHandler; class TexturePackRepository; From d87dd6ae729b10374213b1dc8fa3e70acffa10bb Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:18:14 -0500 Subject: [PATCH 060/104] remove QNet stubs --- .../app/common/Network/NetworkPlayerQNet.cpp | 113 ------------------ .../app/common/Network/NetworkPlayerQNet.h | 54 --------- targets/app/common/Network/QNetStubs.cpp | 55 --------- targets/app/common_sources.txt | 2 - 4 files changed, 224 deletions(-) delete mode 100644 targets/app/common/Network/NetworkPlayerQNet.cpp delete mode 100644 targets/app/common/Network/NetworkPlayerQNet.h delete mode 100644 targets/app/common/Network/QNetStubs.cpp diff --git a/targets/app/common/Network/NetworkPlayerQNet.cpp b/targets/app/common/Network/NetworkPlayerQNet.cpp deleted file mode 100644 index 4c77c4a57..000000000 --- a/targets/app/common/Network/NetworkPlayerQNet.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "NetworkPlayerQNet.h" - -#include - -#include "java/System.h" -#include "platform/NetTypes.h" - -NetworkPlayerQNet::NetworkPlayerQNet(IQNetPlayer* qnetPlayer) { - m_qnetPlayer = qnetPlayer; - m_pSocket = nullptr; -} - -unsigned char NetworkPlayerQNet::GetSmallId() { - return m_qnetPlayer->GetSmallId(); -} - -void NetworkPlayerQNet::SendData(INetworkPlayer* player, const void* pvData, - int dataSize, bool lowPriority, bool ack) { - uint32_t flags; - flags = QNET_SENDDATA_RELIABLE | QNET_SENDDATA_SEQUENTIAL; - if (lowPriority) - flags |= QNET_SENDDATA_LOW_PRIORITY | QNET_SENDDATA_SECONDARY; - m_qnetPlayer->SendData( - static_cast(player)->m_qnetPlayer, pvData, dataSize, - flags); -} - -int NetworkPlayerQNet::GetOutstandingAckCount() { return 0; } - -bool NetworkPlayerQNet::IsSameSystem(INetworkPlayer* player) { - return (m_qnetPlayer->IsSameSystem( - static_cast(player)->m_qnetPlayer) == true); -} - -int NetworkPlayerQNet::GetSendQueueSizeBytes(INetworkPlayer* player, - bool lowPriority) { - uint32_t flags = QNET_GETSENDQUEUESIZE_BYTES; - if (lowPriority) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize( - player ? static_cast(player)->m_qnetPlayer - : nullptr, - flags); -} - -int NetworkPlayerQNet::GetSendQueueSizeMessages(INetworkPlayer* player, - bool lowPriority) { - uint32_t flags = QNET_GETSENDQUEUESIZE_MESSAGES; - if (lowPriority) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize( - player ? static_cast(player)->m_qnetPlayer - : nullptr, - flags); -} - -int NetworkPlayerQNet::GetCurrentRtt() { return m_qnetPlayer->GetCurrentRtt(); } - -bool NetworkPlayerQNet::IsHost() { return (m_qnetPlayer->IsHost() == true); } - -bool NetworkPlayerQNet::IsGuest() { return (m_qnetPlayer->IsGuest() == true); } - -bool NetworkPlayerQNet::IsLocal() { return (m_qnetPlayer->IsLocal() == true); } - -int NetworkPlayerQNet::GetSessionIndex() { - return m_qnetPlayer->GetSessionIndex(); -} - -bool NetworkPlayerQNet::IsTalking() { - return (m_qnetPlayer->IsTalking() == true); -} - -bool NetworkPlayerQNet::IsMutedByLocalUser(int userIndex) { - return (m_qnetPlayer->IsMutedByLocalUser(userIndex) == true); -} - -bool NetworkPlayerQNet::HasVoice() { - return (m_qnetPlayer->HasVoice() == true); -} - -bool NetworkPlayerQNet::HasCamera() { - return (m_qnetPlayer->HasCamera() == true); -} - -int NetworkPlayerQNet::GetUserIndex() { return m_qnetPlayer->GetUserIndex(); } - -void NetworkPlayerQNet::SetSocket(Socket* pSocket) { m_pSocket = pSocket; } - -Socket* NetworkPlayerQNet::GetSocket() { return m_pSocket; } - -PlayerUID NetworkPlayerQNet::GetUID() { return m_qnetPlayer->GetXuid(); } - -const char* NetworkPlayerQNet::GetOnlineName() { - return m_qnetPlayer->GetGamertag(); -} - -std::string NetworkPlayerQNet::GetDisplayName() { - return m_qnetPlayer->GetGamertag(); -} - -IQNetPlayer* NetworkPlayerQNet::GetQNetPlayer() { return m_qnetPlayer; } - -void NetworkPlayerQNet::SentChunkPacket() { - m_lastChunkPacketTime = System::currentTimeMillis(); -} - -int NetworkPlayerQNet::GetTimeSinceLastChunkPacket_ms() { - // If we haven't ever sent a packet, return maximum - if (m_lastChunkPacketTime == 0) { - return INT_MAX; - } - - const int64_t currentTime = System::currentTimeMillis(); - return static_cast(currentTime - m_lastChunkPacketTime); -} \ No newline at end of file diff --git a/targets/app/common/Network/NetworkPlayerQNet.h b/targets/app/common/Network/NetworkPlayerQNet.h deleted file mode 100644 index 9df94b161..000000000 --- a/targets/app/common/Network/NetworkPlayerQNet.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include - -#include - -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "platform/PlatformTypes.h" - -class IQNetPlayer; -class Socket; - -// This is an implementation of the INetworkPlayer interface for the supported -// QNet-backed path. It -// effectively wraps the IQNetPlayer class in a non-platform-specific way. It is -// managed by PlatformNetworkManagerStub. - -class NetworkPlayerQNet : public INetworkPlayer { -public: - // Common player interface - NetworkPlayerQNet(IQNetPlayer* qnetPlayer); - virtual unsigned char GetSmallId(); - virtual void SendData(INetworkPlayer* player, const void* pvData, - int dataSize, bool lowPriority, bool ack); - virtual bool IsSameSystem(INetworkPlayer* player); - virtual int GetOutstandingAckCount(); - virtual int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); - virtual int GetSendQueueSizeMessages(INetworkPlayer* player, - bool lowPriority); - virtual int GetCurrentRtt(); - virtual bool IsHost(); - virtual bool IsGuest(); - virtual bool IsLocal(); - virtual int GetSessionIndex(); - virtual bool IsTalking(); - virtual bool IsMutedByLocalUser(int userIndex); - virtual bool HasVoice(); - virtual bool HasCamera(); - virtual int GetUserIndex(); - virtual void SetSocket(Socket* pSocket); - virtual Socket* GetSocket(); - virtual const char* GetOnlineName(); - virtual std::string GetDisplayName(); - virtual PlayerUID GetUID(); - virtual void SentChunkPacket(); - virtual int GetTimeSinceLastChunkPacket_ms(); - - IQNetPlayer* GetQNetPlayer(); - -private: - IQNetPlayer* m_qnetPlayer; - Socket* m_pSocket; - int64_t m_lastChunkPacketTime; -}; \ No newline at end of file diff --git a/targets/app/common/Network/QNetStubs.cpp b/targets/app/common/Network/QNetStubs.cpp deleted file mode 100644 index 6243e7eb1..000000000 --- a/targets/app/common/Network/QNetStubs.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "platform/NetTypes.h" -#include "platform/PlatformTypes.h" - -IQNetPlayer IQNet::m_player[4]; - -static bool s_gameRunning = false; - -uint8_t IQNetPlayer::GetSmallId() { return 0; } -void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData, - uint32_t dwDataSize, uint32_t dwFlags) {} -bool IQNetPlayer::IsSameSystem(IQNetPlayer* player) { return true; } -uint32_t IQNetPlayer::GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags) { - return 0; -} -uint32_t IQNetPlayer::GetCurrentRtt() { return 0; } -bool IQNetPlayer::IsHost() { return this == &IQNet::m_player[0]; } -bool IQNetPlayer::IsGuest() { return false; } -bool IQNetPlayer::IsLocal() { return true; } -PlayerUID IQNetPlayer::GetXuid() { return INVALID_XUID; } -const char* IQNetPlayer::GetGamertag() { - static const char* name = "stub"; - return name; -} -int IQNetPlayer::GetSessionIndex() { return 0; } -bool IQNetPlayer::IsTalking() { return false; } -bool IQNetPlayer::IsMutedByLocalUser(uint32_t dwUserIndex) { return false; } -bool IQNetPlayer::HasVoice() { return false; } -bool IQNetPlayer::HasCamera() { return false; } -int IQNetPlayer::GetUserIndex() { return this - &IQNet::m_player[0]; } -void IQNetPlayer::SetCustomDataValue(uintptr_t ulpCustomDataValue) { - m_customData = ulpCustomDataValue; -} -uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; } - -int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return 0; } -IQNetPlayer* IQNet::GetHostPlayer() { return &m_player[0]; } -IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(uint32_t dwUserIndex) { - return &m_player[dwUserIndex]; -} -IQNetPlayer* IQNet::GetPlayerByIndex(uint32_t dwPlayerIndex) { - return &m_player[0]; -} -IQNetPlayer* IQNet::GetPlayerBySmallId(uint8_t SmallId) { return &m_player[0]; } -IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { return &m_player[0]; } -uint32_t IQNet::GetPlayerCount() { return 1; } -QNET_STATE IQNet::GetState() { - return s_gameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; -} -bool IQNet::IsHost() { return true; } -int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, - const INVITE_INFO* pInviteInfo) { - return 0; -} -void IQNet::HostGame() { s_gameRunning = true; } -void IQNet::EndGame() { s_gameRunning = false; } diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 404baea0f..89d1ecc3b 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -48,8 +48,6 @@ common/Game_XuiActions.cpp common/LocalizationManager.cpp common/MenuController.cpp common/Network/GameNetworkManager.cpp -common/Network/NetworkPlayerQNet.cpp -common/Network/QNetStubs.cpp common/NetworkController.cpp common/SaveManager.cpp common/SkinManager.cpp From 8552634614b9fb8a95fe3e406bcec61a579125a4 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:27:33 -0500 Subject: [PATCH 061/104] move SoundEngine back to app --- .../sounds => app/common/Audio}/ConsoleSoundEngine.cpp | 2 +- .../sounds => app/common/Audio}/ConsoleSoundEngine.h | 2 +- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/Audio/SoundEngine.h | 4 ++-- targets/app/common/Audio/SoundNames.cpp | 4 ++-- targets/{minecraft/sounds => app/common/Audio}/SoundTypes.h | 0 targets/app/common/Game.h | 2 +- targets/app/common/UI/All Platforms/IUIController.h | 2 +- .../UI/All Platforms/IUIScene_AbstractContainerMenu.cpp | 2 +- targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp | 2 +- targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp | 2 +- targets/app/common/UI/Controls/UIControl_Slider.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp | 2 +- .../common/UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_LeaderboardsMenu.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_TrialExitUpsell.cpp | 2 +- .../common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp | 2 +- .../app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp | 2 +- .../common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp | 2 +- .../common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- .../In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.cpp | 2 +- targets/app/common/UI/UIController.h | 2 +- targets/app/common/UI/UIScene.cpp | 2 +- targets/app/common_sources.txt | 1 + targets/minecraft/client/Minecraft.cpp | 2 +- targets/minecraft/client/Options.cpp | 2 +- targets/minecraft/client/gui/Screen.cpp | 4 ++-- targets/minecraft/client/gui/achievement/StatsScreen.cpp | 4 ++-- targets/minecraft/client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp | 2 +- targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp | 2 +- targets/minecraft/client/particle/FireworksParticles.cpp | 2 +- targets/minecraft/client/player/LocalPlayer.cpp | 4 ++-- targets/minecraft/client/renderer/GameRenderer.cpp | 2 +- targets/minecraft/client/renderer/LevelRenderer.cpp | 4 ++-- targets/minecraft/sources.txt | 1 - targets/minecraft/world/entity/Entity.cpp | 2 +- targets/minecraft/world/entity/ExperienceOrb.cpp | 2 +- targets/minecraft/world/entity/LivingEntity.cpp | 2 +- targets/minecraft/world/entity/ambient/Bat.cpp | 2 +- targets/minecraft/world/entity/animal/Chicken.cpp | 2 +- targets/minecraft/world/entity/animal/Cow.cpp | 2 +- targets/minecraft/world/entity/animal/EntityHorse.cpp | 2 +- targets/minecraft/world/entity/animal/Ocelot.cpp | 2 +- targets/minecraft/world/entity/animal/Pig.cpp | 2 +- targets/minecraft/world/entity/animal/Sheep.cpp | 2 +- targets/minecraft/world/entity/animal/SnowMan.cpp | 2 +- targets/minecraft/world/entity/animal/VillagerGolem.cpp | 2 +- targets/minecraft/world/entity/animal/Wolf.cpp | 2 +- .../minecraft/world/entity/boss/enderdragon/EnderDragon.cpp | 2 +- targets/minecraft/world/entity/boss/wither/WitherBoss.cpp | 2 +- targets/minecraft/world/entity/global/LightningBolt.cpp | 2 +- targets/minecraft/world/entity/item/ItemEntity.cpp | 2 +- targets/minecraft/world/entity/item/MinecartTNT.cpp | 2 +- targets/minecraft/world/entity/monster/Blaze.cpp | 2 +- targets/minecraft/world/entity/monster/Creeper.cpp | 2 +- targets/minecraft/world/entity/monster/EnderMan.cpp | 2 +- targets/minecraft/world/entity/monster/Ghast.cpp | 2 +- targets/minecraft/world/entity/monster/LavaSlime.cpp | 2 +- targets/minecraft/world/entity/monster/PigZombie.cpp | 2 +- targets/minecraft/world/entity/monster/Silverfish.cpp | 2 +- targets/minecraft/world/entity/monster/Skeleton.cpp | 2 +- targets/minecraft/world/entity/monster/Slime.cpp | 2 +- targets/minecraft/world/entity/monster/Spider.cpp | 2 +- targets/minecraft/world/entity/monster/Witch.cpp | 2 +- targets/minecraft/world/entity/monster/Zombie.cpp | 2 +- targets/minecraft/world/entity/npc/Villager.cpp | 2 +- targets/minecraft/world/entity/player/Player.cpp | 2 +- targets/minecraft/world/entity/projectile/Arrow.cpp | 2 +- .../world/entity/projectile/FireworksRocketEntity.cpp | 2 +- targets/minecraft/world/entity/projectile/FishingHook.cpp | 2 +- targets/minecraft/world/item/BowItem.cpp | 2 +- targets/minecraft/world/item/BucketItem.cpp | 2 +- targets/minecraft/world/item/EggItem.cpp | 2 +- targets/minecraft/world/item/EnderEyeItem.cpp | 2 +- targets/minecraft/world/item/EnderpearlItem.cpp | 2 +- targets/minecraft/world/item/ExperienceItem.cpp | 2 +- targets/minecraft/world/item/FireChargeItem.cpp | 2 +- targets/minecraft/world/item/FishingRodItem.cpp | 2 +- targets/minecraft/world/item/FlintAndSteelItem.cpp | 2 +- targets/minecraft/world/item/FoodItem.cpp | 2 +- targets/minecraft/world/item/PotionItem.cpp | 2 +- targets/minecraft/world/item/SnowballItem.cpp | 2 +- .../minecraft/world/item/enchantment/ThornsEnchantment.cpp | 2 +- targets/minecraft/world/level/Explosion.cpp | 2 +- targets/minecraft/world/level/Level.cpp | 2 +- targets/minecraft/world/level/tile/BasePressurePlateTile.cpp | 2 +- targets/minecraft/world/level/tile/ButtonTile.cpp | 2 +- targets/minecraft/world/level/tile/ComparatorTile.cpp | 2 +- targets/minecraft/world/level/tile/FireTile.cpp | 2 +- targets/minecraft/world/level/tile/LeverTile.cpp | 2 +- targets/minecraft/world/level/tile/LiquidTile.cpp | 2 +- targets/minecraft/world/level/tile/NotGateTile.cpp | 2 +- targets/minecraft/world/level/tile/NoteBlockTile.cpp | 2 +- targets/minecraft/world/level/tile/PortalTile.cpp | 2 +- targets/minecraft/world/level/tile/Tile.cpp | 2 +- targets/minecraft/world/level/tile/Tile.h | 2 +- targets/minecraft/world/level/tile/TntTile.cpp | 2 +- targets/minecraft/world/level/tile/TripWireSourceTile.cpp | 2 +- targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp | 2 +- .../world/level/tile/entity/EnderChestTileEntity.cpp | 2 +- targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp | 2 +- 117 files changed, 121 insertions(+), 121 deletions(-) rename targets/{minecraft/sounds => app/common/Audio}/ConsoleSoundEngine.cpp (97%) rename targets/{minecraft/sounds => app/common/Audio}/ConsoleSoundEngine.h (98%) rename targets/{minecraft/sounds => app/common/Audio}/SoundTypes.h (100%) diff --git a/targets/minecraft/sounds/ConsoleSoundEngine.cpp b/targets/app/common/Audio/ConsoleSoundEngine.cpp similarity index 97% rename from targets/minecraft/sounds/ConsoleSoundEngine.cpp rename to targets/app/common/Audio/ConsoleSoundEngine.cpp index f8ffdd212..289f46810 100644 --- a/targets/minecraft/sounds/ConsoleSoundEngine.cpp +++ b/targets/app/common/Audio/ConsoleSoundEngine.cpp @@ -1,4 +1,4 @@ -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() { return m_bIsPlayingStreamingCDMusic; diff --git a/targets/minecraft/sounds/ConsoleSoundEngine.h b/targets/app/common/Audio/ConsoleSoundEngine.h similarity index 98% rename from targets/minecraft/sounds/ConsoleSoundEngine.h rename to targets/app/common/Audio/ConsoleSoundEngine.h index d78639fa1..10ef82eca 100644 --- a/targets/minecraft/sounds/ConsoleSoundEngine.h +++ b/targets/app/common/Audio/ConsoleSoundEngine.h @@ -4,7 +4,7 @@ #include #include -#include "minecraft/sounds/SoundTypes.h" +#include "SoundTypes.h" class File; diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 5883cb5ac..c2f46cea5 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -10,7 +10,7 @@ #include #include -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/LinuxGame.h" #include "java/Random.h" diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index 99b5a707d..66403ea07 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -7,9 +7,9 @@ class Random; #include #include -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" // Forward-declare the miniaudio backing state. The full struct lives in diff --git a/targets/app/common/Audio/SoundNames.cpp b/targets/app/common/Audio/SoundNames.cpp index 8d390cb72..09fb95607 100644 --- a/targets/app/common/Audio/SoundNames.cpp +++ b/targets/app/common/Audio/SoundNames.cpp @@ -1,5 +1,5 @@ -#include "minecraft/sounds/ConsoleSoundEngine.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { "mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT diff --git a/targets/minecraft/sounds/SoundTypes.h b/targets/app/common/Audio/SoundTypes.h similarity index 100% rename from targets/minecraft/sounds/SoundTypes.h rename to targets/app/common/Audio/SoundTypes.h diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 928f9d496..1e84b9fbc 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -11,7 +11,7 @@ #include "app/common/App_structs.h" #include "app/common/ArchiveManager.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "app/common/BannedListManager.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLCController.h" diff --git a/targets/app/common/UI/All Platforms/IUIController.h b/targets/app/common/UI/All Platforms/IUIController.h index 20a7c9fc6..d41c2c753 100644 --- a/targets/app/common/UI/All Platforms/IUIController.h +++ b/targets/app/common/UI/All Platforms/IUIController.h @@ -2,7 +2,7 @@ #include "UIEnums.h" #include "UIStructs.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/storage/storage.h" // 4J Stu - An interface class that defines all the public functions that we use diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index d745984a9..532c29414 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -17,7 +17,7 @@ #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 5a7a25296..9e83cb9cc 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -16,7 +16,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index 02e81b9b6..0a31ac168 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -13,7 +13,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index 863dbc049..799a0fde6 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -10,7 +10,7 @@ #endif #include "app/linux/Iggy/include/rrCore.h" #include "app/linux/Linux_UIController.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "util/StringHelpers.h" UIControl_Slider::UIControl_Slider() { 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 0dfc0d3a1..bf0111fd4 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 @@ -28,7 +28,7 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "platform/NetTypes.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 a2580ec13..fc81ac180 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 @@ -11,7 +11,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.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 929f44e16..0152096ce 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 @@ -16,7 +16,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "minecraft/network/platform/SessionInfo.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.h" #include "platform/PlatformTypes.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 bdc50c4da..4e0fed476 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 @@ -16,7 +16,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.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 d12888702..ee23ecbff 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 @@ -16,7 +16,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.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 bd6c17f84..ddfcc5174 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 @@ -26,7 +26,7 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" #include "platform/NetTypes.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 9edcad607..4e89e4cda 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 @@ -23,7 +23,7 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/platform/SessionInfo.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" #include "platform/NetTypes.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 7597058eb..547bdb0a4 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 @@ -29,7 +29,7 @@ #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.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 7c24a8329..c54819aa4 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 @@ -11,7 +11,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "strings.h" UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void* initData, 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 89efb30e6..0d3487727 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 @@ -8,7 +8,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/ProfileConstants.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 df684fab8..faad5c611 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 @@ -5,7 +5,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.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 4101422c5..51ba1cbae 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -14,7 +14,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "platform/input/input.h" #include "strings.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 6d6db0610..c2759fdde 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -7,7 +7,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.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 d5f59efc8..7d5532895 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -11,7 +11,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "strings.h" #include "util/StringHelpers.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 2d4552d2f..2bdca1cf2 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -9,7 +9,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "strings.h" // strings for buttons in the list 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 20a7c58f2..25310afc1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -6,7 +6,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "strings.h" // strings for buttons in the list 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 370ac6e81..e610b9dbc 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -7,7 +7,7 @@ #include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.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 d310b4356..8168a478f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -14,7 +14,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "strings.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 c95234fd8..7df0b5562 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -18,7 +18,7 @@ #include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/SkinBox.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/ProfileConstants.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index 528da0646..10653db19 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -21,7 +21,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" #include "platform/XboxStubs.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 0da94aab4..2fd951e2a 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 @@ -18,7 +18,7 @@ #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "strings.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 59f633013..3d2b50e5c 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 @@ -23,7 +23,7 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.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 1da16ab73..6817c4665 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 @@ -14,7 +14,7 @@ #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/SignUpdatePacket.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "platform/input/input.h" #include "strings.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 cd03823cd..deacafb36 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 @@ -17,7 +17,7 @@ #include "minecraft/network/packet/GameCommandPacket.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/commands/TeleportCommand.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "strings.h" UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index d8906c7da..7a76de829 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -27,7 +27,7 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/linux/Iggy/include/rrCore.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 11d23735d..763dcf4bf 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -24,7 +24,7 @@ #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/item/ItemInstance.h" #include "util/StringHelpers.h" diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 89d1ecc3b..03640563a 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -2,6 +2,7 @@ common/AppGameServices.cpp common/ArchiveManager.cpp common/Audio/SoundEngine.cpp common/Audio/SoundNames.cpp +common/Audio/ConsoleSoundEngine.cpp common/BannedListManager.cpp common/ConsoleGameMode.cpp common/DLC/DLCAudioFile.cpp diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index d46f463aa..803f983e1 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -54,7 +54,7 @@ #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/util/Log.h" diff --git a/targets/minecraft/client/Options.cpp b/targets/minecraft/client/Options.cpp index e585fb3f2..2efeb1b09 100644 --- a/targets/minecraft/client/Options.cpp +++ b/targets/minecraft/client/Options.cpp @@ -1,7 +1,7 @@ #include "Options.h" #include "KeyMapping.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 1fb75ec16..4ef01b073 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -1,7 +1,7 @@ #include "Screen.h" #include "Button.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" @@ -12,7 +12,7 @@ #include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index 2426fb71e..7ab9ca3f6 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,5 +1,5 @@ #include "StatsScreen.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" @@ -8,7 +8,7 @@ #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/ItemStat.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 3e90154c2..956924086 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -114,7 +114,7 @@ #include "minecraft/network/packet/XZPacket.h" #include "minecraft/network/platform/NetworkPlayerInterface.h" #include "minecraft/server/MinecraftServer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/world/SimpleContainer.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 777df3e5c..1c87bad35 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -4,7 +4,7 @@ #include "ClientConnection.h" #include "MultiPlayerLevel.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/Class.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 3285549e6..14ea4f553 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -12,7 +12,7 @@ #include "ClientConnection.h" #include "MultiPlayerChunkCache.h" #include "MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Console_Debug_enum.h" diff --git a/targets/minecraft/client/particle/FireworksParticles.cpp b/targets/minecraft/client/particle/FireworksParticles.cpp index e0194f81a..ab8d756d0 100644 --- a/targets/minecraft/client/particle/FireworksParticles.cpp +++ b/targets/minecraft/client/particle/FireworksParticles.cpp @@ -12,7 +12,7 @@ #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/item/FireworksItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 2dbb3bc9a..0ce1edcfa 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 "PlatformTypes.h" #include "Pos.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "platform/profile/ProfileConstants.h" #include "minecraft/world/tutorial/ITutorial.h" #include "app/linux/Linux_UIController.h" @@ -54,7 +54,7 @@ #include "minecraft/commands/CommandsEnum.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/CommonStats.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index a8d97bc13..faea5c8b6 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -47,7 +47,7 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index c9b638797..7f84ec8d0 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -15,7 +15,7 @@ #include "Chunk.h" #include "GameRenderer.h" #include "Tesselator.h" -#include "minecraft/sounds/ConsoleSoundEngine.h" +#include "app/common/Audio/ConsoleSoundEngine.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -73,7 +73,7 @@ #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" diff --git a/targets/minecraft/sources.txt b/targets/minecraft/sources.txt index e5ee3dfa4..e55538beb 100644 --- a/targets/minecraft/sources.txt +++ b/targets/minecraft/sources.txt @@ -396,7 +396,6 @@ server/level/TrackedEntity.cpp server/network/PendingConnection.cpp server/network/PlayerConnection.cpp server/network/ServerConnection.cpp -sounds/ConsoleSoundEngine.cpp stats/Achievement.cpp stats/Achievements.cpp stats/CommonStats.cpp diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index f17dc2ec4..670e7459d 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -27,7 +27,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/ExperienceOrb.cpp b/targets/minecraft/world/entity/ExperienceOrb.cpp index 73de05d64..02b6ca100 100644 --- a/targets/minecraft/world/entity/ExperienceOrb.cpp +++ b/targets/minecraft/world/entity/ExperienceOrb.cpp @@ -8,7 +8,7 @@ #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 6e924f52c..7547d7883 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -23,7 +23,7 @@ #include "minecraft/network/packet/TakeItemEntityPacket.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerLevel.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/entity/ambient/Bat.cpp b/targets/minecraft/world/entity/ambient/Bat.cpp index 55b66af55..9c88f578f 100644 --- a/targets/minecraft/world/entity/ambient/Bat.cpp +++ b/targets/minecraft/world/entity/ambient/Bat.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/Pos.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" diff --git a/targets/minecraft/world/entity/animal/Chicken.cpp b/targets/minecraft/world/entity/animal/Chicken.cpp index fe69ff10e..8e40b8fdb 100644 --- a/targets/minecraft/world/entity/animal/Chicken.cpp +++ b/targets/minecraft/world/entity/animal/Chicken.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" #include "minecraft/world/entity/ai/goal/FloatGoal.h" diff --git a/targets/minecraft/world/entity/animal/Cow.cpp b/targets/minecraft/world/entity/animal/Cow.cpp index a12908a9a..681f75c6a 100644 --- a/targets/minecraft/world/entity/animal/Cow.cpp +++ b/targets/minecraft/world/entity/animal/Cow.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index 25a164de7..2c7545b65 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index 61fdd4298..c7e42f54b 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -10,7 +10,7 @@ #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/animal/Pig.cpp b/targets/minecraft/world/entity/animal/Pig.cpp index 475152b3a..609b6750b 100644 --- a/targets/minecraft/world/entity/animal/Pig.cpp +++ b/targets/minecraft/world/entity/animal/Pig.cpp @@ -6,7 +6,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/SyncedEntityData.h" diff --git a/targets/minecraft/world/entity/animal/Sheep.cpp b/targets/minecraft/world/entity/animal/Sheep.cpp index f33e8e167..e55db0f65 100644 --- a/targets/minecraft/world/entity/animal/Sheep.cpp +++ b/targets/minecraft/world/entity/animal/Sheep.cpp @@ -7,7 +7,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/AgeableMob.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/animal/SnowMan.cpp b/targets/minecraft/world/entity/animal/SnowMan.cpp index 6753eebb6..08ffbdb68 100644 --- a/targets/minecraft/world/entity/animal/SnowMan.cpp +++ b/targets/minecraft/world/entity/animal/SnowMan.cpp @@ -4,7 +4,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/entity/animal/VillagerGolem.cpp b/targets/minecraft/world/entity/animal/VillagerGolem.cpp index 51f18ca7c..622264846 100644 --- a/targets/minecraft/world/entity/animal/VillagerGolem.cpp +++ b/targets/minecraft/world/entity/animal/VillagerGolem.cpp @@ -5,7 +5,7 @@ #include "java/Random.h" #include "minecraft/Pos.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/animal/Wolf.cpp b/targets/minecraft/world/entity/animal/Wolf.cpp index 293adc7ad..4f032a715 100644 --- a/targets/minecraft/world/entity/animal/Wolf.cpp +++ b/targets/minecraft/world/entity/animal/Wolf.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index 9c29013d4..89c060c67 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp index 864d58001..142249f77 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp @@ -10,7 +10,7 @@ #include "SharedConstants.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/global/LightningBolt.cpp b/targets/minecraft/world/entity/global/LightningBolt.cpp index c8df38246..46f2d7285 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.cpp +++ b/targets/minecraft/world/entity/global/LightningBolt.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/GlobalEntity.h" diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 6efb5e5a2..3101b474a 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -9,7 +9,7 @@ #include "SharedConstants.h" #include "java/JavaMath.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/entity/item/MinecartTNT.cpp b/targets/minecraft/world/entity/item/MinecartTNT.cpp index 1620f18b4..a2fb4839e 100644 --- a/targets/minecraft/world/entity/item/MinecartTNT.cpp +++ b/targets/minecraft/world/entity/item/MinecartTNT.cpp @@ -7,7 +7,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/entity/monster/Blaze.cpp b/targets/minecraft/world/entity/monster/Blaze.cpp index 29a11762d..acfcf9adc 100644 --- a/targets/minecraft/world/entity/monster/Blaze.cpp +++ b/targets/minecraft/world/entity/monster/Blaze.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Mob.h" diff --git a/targets/minecraft/world/entity/monster/Creeper.cpp b/targets/minecraft/world/entity/monster/Creeper.cpp index 0e379afd2..51658fbbc 100644 --- a/targets/minecraft/world/entity/monster/Creeper.cpp +++ b/targets/minecraft/world/entity/monster/Creeper.cpp @@ -6,7 +6,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index e7f56423f..63ca47f99 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -10,7 +10,7 @@ #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Ghast.cpp b/targets/minecraft/world/entity/monster/Ghast.cpp index 08480e32e..bf2ed2292 100644 --- a/targets/minecraft/world/entity/monster/Ghast.cpp +++ b/targets/minecraft/world/entity/monster/Ghast.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/network/packet/ChatPacket.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/LavaSlime.cpp b/targets/minecraft/world/entity/monster/LavaSlime.cpp index 5ec06fe10..ccd58d6a2 100644 --- a/targets/minecraft/world/entity/monster/LavaSlime.cpp +++ b/targets/minecraft/world/entity/monster/LavaSlime.cpp @@ -5,7 +5,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/monster/SharedMonsterAttributes.h" diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 69ab1e76a..0423eb059 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -5,7 +5,7 @@ #include "java/Random.h" #include "minecraft/IGameServices.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index b0d4fe7d8..4d4f99306 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -5,7 +5,7 @@ #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/IGameServices.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Skeleton.cpp b/targets/minecraft/world/entity/monster/Skeleton.cpp index 2d7d21662..c9bec989d 100644 --- a/targets/minecraft/world/entity/monster/Skeleton.cpp +++ b/targets/minecraft/world/entity/monster/Skeleton.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Slime.cpp b/targets/minecraft/world/entity/monster/Slime.cpp index 00d42fd09..79ddcc2e4 100644 --- a/targets/minecraft/world/entity/monster/Slime.cpp +++ b/targets/minecraft/world/entity/monster/Slime.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index c2652b171..64a8167c0 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/IGameServices.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" diff --git a/targets/minecraft/world/entity/monster/Witch.cpp b/targets/minecraft/world/entity/monster/Witch.cpp index fa3366d77..1f0cc9798 100644 --- a/targets/minecraft/world/entity/monster/Witch.cpp +++ b/targets/minecraft/world/entity/monster/Witch.cpp @@ -6,7 +6,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/monster/Zombie.cpp b/targets/minecraft/world/entity/monster/Zombie.cpp index a12b3ee7b..1176a2c14 100644 --- a/targets/minecraft/world/entity/monster/Zombie.cpp +++ b/targets/minecraft/world/entity/monster/Zombie.cpp @@ -9,7 +9,7 @@ #include "SharedConstants.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 783e82118..515828054 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 161401d15..18e353701 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -32,7 +32,7 @@ #include "minecraft/client/model/HumanoidModel.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index cc40c8949..681d1c345 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -13,7 +13,7 @@ #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp index 052f698ed..e3425b1ad 100644 --- a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp +++ b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp @@ -8,7 +8,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/projectile/FishingHook.cpp b/targets/minecraft/world/entity/projectile/FishingHook.cpp index 4e01c1570..15557631f 100644 --- a/targets/minecraft/world/entity/projectile/FishingHook.cpp +++ b/targets/minecraft/world/entity/projectile/FishingHook.cpp @@ -9,7 +9,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/item/BowItem.cpp b/targets/minecraft/world/item/BowItem.cpp index 77dc67bba..ed816e6f0 100644 --- a/targets/minecraft/world/item/BowItem.cpp +++ b/targets/minecraft/world/item/BowItem.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index 90806fb8c..6b0a50735 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -10,7 +10,7 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/item/EggItem.cpp b/targets/minecraft/world/item/EggItem.cpp index 01e664d77..a2f4709b2 100644 --- a/targets/minecraft/world/item/EggItem.cpp +++ b/targets/minecraft/world/item/EggItem.cpp @@ -4,7 +4,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEgg.h" diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index b0335f1c1..2152a8d8a 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -5,7 +5,7 @@ #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/EnderpearlItem.cpp b/targets/minecraft/world/item/EnderpearlItem.cpp index 851b958c7..36a71a464 100644 --- a/targets/minecraft/world/item/EnderpearlItem.cpp +++ b/targets/minecraft/world/item/EnderpearlItem.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEnderpearl.h" diff --git a/targets/minecraft/world/item/ExperienceItem.cpp b/targets/minecraft/world/item/ExperienceItem.cpp index 207faa5fb..012abb104 100644 --- a/targets/minecraft/world/item/ExperienceItem.cpp +++ b/targets/minecraft/world/item/ExperienceItem.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownExpBottle.h" diff --git a/targets/minecraft/world/item/FireChargeItem.cpp b/targets/minecraft/world/item/FireChargeItem.cpp index 5d97f8e12..6c7f92463 100644 --- a/targets/minecraft/world/item/FireChargeItem.cpp +++ b/targets/minecraft/world/item/FireChargeItem.cpp @@ -4,7 +4,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/FishingRodItem.cpp b/targets/minecraft/world/item/FishingRodItem.cpp index 247377291..17198e4ee 100644 --- a/targets/minecraft/world/item/FishingRodItem.cpp +++ b/targets/minecraft/world/item/FishingRodItem.cpp @@ -4,7 +4,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" diff --git a/targets/minecraft/world/item/FlintAndSteelItem.cpp b/targets/minecraft/world/item/FlintAndSteelItem.cpp index 16d49a8ec..765ab961e 100644 --- a/targets/minecraft/world/item/FlintAndSteelItem.cpp +++ b/targets/minecraft/world/item/FlintAndSteelItem.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/FoodItem.cpp b/targets/minecraft/world/item/FoodItem.cpp index b1a0f0e77..68c9fca60 100644 --- a/targets/minecraft/world/item/FoodItem.cpp +++ b/targets/minecraft/world/item/FoodItem.cpp @@ -2,7 +2,7 @@ #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodConstants.h" diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index 276efda45..887160520 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -6,7 +6,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/item/SnowballItem.cpp b/targets/minecraft/world/item/SnowballItem.cpp index 91498a9b2..d0a35e990 100644 --- a/targets/minecraft/world/item/SnowballItem.cpp +++ b/targets/minecraft/world/item/SnowballItem.cpp @@ -3,7 +3,7 @@ #include #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Snowball.h" diff --git a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp index 5122ec57b..3a1d78b91 100644 --- a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp +++ b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp @@ -1,7 +1,7 @@ #include "ThornsEnchantment.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index 15f911881..e6aeaa8af 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -9,7 +9,7 @@ #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index 9dd7dab78..c1a109294 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -27,7 +27,7 @@ #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp index b0770e9db..05dcb4829 100644 --- a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp @@ -4,7 +4,7 @@ #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/ButtonTile.cpp b/targets/minecraft/world/level/tile/ButtonTile.cpp index c1b3204b0..03ac07cd1 100644 --- a/targets/minecraft/world/level/tile/ButtonTile.cpp +++ b/targets/minecraft/world/level/tile/ButtonTile.cpp @@ -5,7 +5,7 @@ #include #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/projectile/Arrow.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/ComparatorTile.cpp b/targets/minecraft/world/level/tile/ComparatorTile.cpp index 8a520eabe..db1ca0d29 100644 --- a/targets/minecraft/world/level/tile/ComparatorTile.cpp +++ b/targets/minecraft/world/level/tile/ComparatorTile.cpp @@ -4,7 +4,7 @@ #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index c12bf63b0..2f8baddd6 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -10,7 +10,7 @@ #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/LeverTile.cpp b/targets/minecraft/world/level/tile/LeverTile.cpp index bd79e322b..22c4d5b07 100644 --- a/targets/minecraft/world/level/tile/LeverTile.cpp +++ b/targets/minecraft/world/level/tile/LeverTile.cpp @@ -3,7 +3,7 @@ #include #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/LiquidTile.cpp b/targets/minecraft/world/level/tile/LiquidTile.cpp index 9aa0fdb55..1c5907f6c 100644 --- a/targets/minecraft/world/level/tile/LiquidTile.cpp +++ b/targets/minecraft/world/level/tile/LiquidTile.cpp @@ -10,7 +10,7 @@ #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index 45481e685..db819d4d5 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -2,7 +2,7 @@ #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index a77f8fd60..fffbd8816 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -4,7 +4,7 @@ #include #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/PortalTile.cpp b/targets/minecraft/world/level/tile/PortalTile.cpp index b02b12139..9e0812784 100644 --- a/targets/minecraft/world/level/tile/PortalTile.cpp +++ b/targets/minecraft/world/level/tile/PortalTile.cpp @@ -6,7 +6,7 @@ #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/SpawnEggItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 6e80029c5..25e0dfded 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -7,7 +7,7 @@ #include "Facing.h" #include "java/Class.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stats.h" #include "minecraft/util/Log.h" diff --git a/targets/minecraft/world/level/tile/Tile.h b/targets/minecraft/world/level/tile/Tile.h index ebd3b42d7..188181309 100644 --- a/targets/minecraft/world/level/tile/Tile.h +++ b/targets/minecraft/world/level/tile/Tile.h @@ -5,7 +5,7 @@ #include #include -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/material/Material.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 5e0992e57..148656845 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -7,7 +7,7 @@ #include "minecraft/Facing.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp index fc910c128..b7fb1f9f5 100644 --- a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp +++ b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp @@ -3,7 +3,7 @@ #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index a54db394b..9993aecdd 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -10,7 +10,7 @@ #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/CompoundContainer.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp index 819f34f0c..b8b6a9703 100644 --- a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp @@ -1,7 +1,7 @@ #include "EnderChestTileEntity.h" #include "java/Random.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/ChestTile.h" diff --git a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp index 336585def..1280d81bd 100644 --- a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp +++ b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp @@ -7,7 +7,7 @@ #include "minecraft/Facing.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" -#include "minecraft/sounds/SoundTypes.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/LivingEntity.h" From b20b8cb31110ea4e2d72ce1b9252309a1ce17c4b Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:07:16 -0500 Subject: [PATCH 062/104] properly implement network interface stub --- targets/app/common/Game.cpp | 2 +- targets/app/common/Game_XuiActions.cpp | 2 +- .../app/common/Network/GameNetworkManager.cpp | 4 +- .../app/common/Network/GameNetworkManager.h | 11 +- .../Constraints/ChangeStateConstraint.cpp | 2 +- .../UIScene_JoinMenu.cpp | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 2 +- .../UIScene_InGameHostOptionsMenu.cpp | 2 +- .../UIScene_InGameInfoMenu.cpp | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../UIScene_TeleportMenu.cpp | 2 +- targets/minecraft/client/Minecraft.cpp | 2 +- .../client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/network/Connection.cpp | 2 +- targets/minecraft/network/Socket.cpp | 2 +- targets/minecraft/network/Socket.h | 2 +- .../network/packet/PlayerInfoPacket.cpp | 2 +- targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/server/PlayerList.cpp | 2 +- .../minecraft/server/level/EntityTracker.cpp | 2 +- .../minecraft/server/level/PlayerChunkMap.cpp | 2 +- .../minecraft/server/level/ServerLevel.cpp | 2 +- .../minecraft/server/level/ServerPlayer.cpp | 2 +- .../minecraft/server/level/TrackedEntity.cpp | 2 +- .../server/network/PendingConnection.cpp | 2 +- .../server/network/PlayerConnection.cpp | 2 +- targets/platform/NetTypes.h | 61 --- .../network/INetworkPlayer.h} | 0 .../network}/SessionInfo.h | 0 targets/platform/network/meson.build | 2 +- targets/platform/network/network.h | 2 + .../network/stub/StubNetworkPlayer.cpp | 53 ++ .../platform/network/stub/StubNetworkPlayer.h | 52 ++ .../network/stub/StubPlatformNetwork.cpp | 516 ++++++++++++++++++ .../network/stub/StubPlatformNetwork.h | 269 +++++---- 35 files changed, 816 insertions(+), 202 deletions(-) rename targets/{minecraft/network/platform/NetworkPlayerInterface.h => platform/network/INetworkPlayer.h} (100%) rename targets/{minecraft/network/platform => platform/network}/SessionInfo.h (100%) create mode 100644 targets/platform/network/stub/StubNetworkPlayer.cpp create mode 100644 targets/platform/network/stub/StubNetworkPlayer.h diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 7bd8be6ef..b2f1c5a0a 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -32,7 +32,7 @@ #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index dde40f3ce..042cc5bdc 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -26,7 +26,7 @@ #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index e4cf90893..4a971e2a9 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -32,7 +32,7 @@ #include "minecraft/network/Connection.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerAction.h" @@ -381,7 +381,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, Socket* socket = pNetworkPlayer->GetSocket(); app.DebugPrintf( "Closing socket due to player %d not being signed in any " - "more\n"); + "more\n", idx); if (!socket->close(false)) socket->close(true); continue; diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 5cde30a6b..941e1e7b8 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -7,13 +7,12 @@ #if !defined(__linux__) #include #endif -#include "platform/network/IPlatformNetwork.h" #include "minecraft/network/INetworkService.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" -#include "minecraft/network/platform/SessionInfo.h" #include "platform/C4JThread.h" #include "platform/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/IPlatformNetwork.h" +#include "platform/network/network.h" class ClientConnection; class Minecraft; @@ -158,7 +157,10 @@ public: static int messageQueuePos; // Methods called from PlatformNetworkManager -private: + // 4jcraft: made these public, we can't friend class StubPlatformNetwork + // here like before because that would be naming an opaque platform backend + // class, plus this API is shit so i dont care +public: void StateChange_AnyToHosting(); void StateChange_AnyToJoining(); void StateChange_JoiningToIdle(IPlatformNetwork::eJoinFailedReason reason); @@ -187,7 +189,6 @@ private: bool m_bInitialised; private: - float m_lastPlayerEventTimeStart; // For telemetry static IPlatformNetwork* s_pPlatformNetworkManager; bool m_bNetworkThreadRunning; int GetJoiningReadyPercentage(); diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index b7e8aa211..58c08a47d 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -9,7 +9,7 @@ #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/PlayerInfoPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelSettings.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 0152096ce..ea463c8e7 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 @@ -15,7 +15,7 @@ #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "minecraft/network/platform/SessionInfo.h" +#include "platform/network/network.h" #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.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 4e89e4cda..049b74d94 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 @@ -21,7 +21,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "minecraft/network/platform/SessionInfo.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.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 e1f56c6e6..f4fabe66a 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 @@ -15,7 +15,7 @@ #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/world/entity/player/Player.h" #include "strings.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 2fd951e2a..7022e00e1 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 @@ -17,7 +17,7 @@ #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.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 5e6dac856..e8eed0628 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 @@ -18,7 +18,7 @@ #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/packet/PlayerInfoPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/world/entity/player/Player.h" #include "strings.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 deacafb36..303d60426 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 @@ -15,7 +15,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/network/packet/GameCommandPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/commands/TeleportCommand.h" #include "app/common/Audio/SoundTypes.h" #include "strings.h" diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 803f983e1..2ab42b8fa 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -53,7 +53,7 @@ #include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index 956924086..c03b834fe 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -112,7 +112,7 @@ #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/XZPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index c264bcf16..583c9402f 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -16,7 +16,7 @@ #include "minecraft/network/packet/KeepAlivePacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/PacketListener.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "platform/ShutdownManager.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/network/Socket.cpp b/targets/minecraft/network/Socket.cpp index 87d0672f2..58f1e5b76 100644 --- a/targets/minecraft/network/Socket.cpp +++ b/targets/minecraft/network/Socket.cpp @@ -7,7 +7,7 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/network/ServerConnection.h" #include "platform/NetTypes.h" #include "platform/ShutdownManager.h" diff --git a/targets/minecraft/network/Socket.h b/targets/minecraft/network/Socket.h index 787e8c251..380e6b4e1 100644 --- a/targets/minecraft/network/Socket.h +++ b/targets/minecraft/network/Socket.h @@ -12,7 +12,7 @@ #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "platform/C4JThread.h" class INetworkPlayer; diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index 9a90c1c8c..f86955a7e 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,7 +1,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" #ifndef __linux__ diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index fc80d358e..dce5f4509 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -31,7 +31,7 @@ #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/network/packet/SetTimePacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/level/DerivedServerLevel.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerChunkCache.h" diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index d123c9262..5846bb049 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -36,7 +36,7 @@ #include "minecraft/network/packet/TexturePacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/XZPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/PlayerChunkMap.h" #include "minecraft/server/level/ServerChunkCache.h" diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index 6a3f3e1bd..e5a186478 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -11,7 +11,7 @@ #include "ServerPlayer.h" #include "TrackedEntity.h" #include "java/Class.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index e5f96814e..58513f308 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -19,7 +19,7 @@ #include "minecraft/network/packet/ChunkVisibilityPacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/TileUpdatePacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 6a493ffa2..e041d390e 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -24,7 +24,7 @@ #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/LevelParticlesPacket.h" #include "minecraft/network/packet/TileEventPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerScoreboard.h" diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index da588f35a..290930124 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -45,7 +45,7 @@ #include "minecraft/network/packet/SetHealthPacket.h" #include "minecraft/network/packet/TileEditorOpenPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index 47bfb3a04..254c7e8e1 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -29,7 +29,7 @@ #include "minecraft/network/packet/TeleportEntityPacket.h" #include "minecraft/network/packet/UpdateAttributesPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 7c1c257c3..d01771dd2 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -16,7 +16,7 @@ #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/LoginPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index 62053dc4f..aa9d1132f 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -61,7 +61,7 @@ #include "minecraft/network/packet/TileUpdatePacket.h" #include "minecraft/network/packet/TradeItemPacket.h" #include "minecraft/network/packet/UseItemPacket.h" -#include "minecraft/network/platform/NetworkPlayerInterface.h" +#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" diff --git a/targets/platform/NetTypes.h b/targets/platform/NetTypes.h index 8c31bcaa7..3397058cd 100644 --- a/targets/platform/NetTypes.h +++ b/targets/platform/NetTypes.h @@ -60,67 +60,6 @@ public: } }; -class IQNetPlayer { -public: - uint8_t GetSmallId(); - void SendData(IQNetPlayer* player, const void* pvData, uint32_t dwDataSize, - uint32_t dwFlags); - bool IsSameSystem(IQNetPlayer* player); - uint32_t GetSendQueueSize(IQNetPlayer* player, uint32_t dwFlags); - uint32_t GetCurrentRtt(); - bool IsHost(); - bool IsGuest(); - bool IsLocal(); - PlayerUID GetXuid(); - const char* GetGamertag(); - int GetSessionIndex(); - bool IsTalking(); - bool IsMutedByLocalUser(uint32_t dwUserIndex); - bool HasVoice(); - bool HasCamera(); - int GetUserIndex(); - void SetCustomDataValue(uintptr_t ulpCustomDataValue); - uintptr_t GetCustomDataValue(); - -private: - uintptr_t m_customData; -}; - -enum QNET_STATE { - QNET_STATE_IDLE, - QNET_STATE_SESSION_HOSTING, - QNET_STATE_SESSION_JOINING, - QNET_STATE_GAME_LOBBY, - QNET_STATE_SESSION_REGISTERING, - QNET_STATE_SESSION_STARTING, - QNET_STATE_GAME_PLAY, - QNET_STATE_SESSION_ENDING, - QNET_STATE_SESSION_LEAVING, - QNET_STATE_SESSION_DELETING -}; - -class IQNet { -public: - int32_t AddLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetHostPlayer(); - IQNetPlayer* GetLocalPlayerByUserIndex(uint32_t dwUserIndex); - IQNetPlayer* GetPlayerByIndex(uint32_t dwPlayerIndex); - IQNetPlayer* GetPlayerBySmallId(uint8_t SmallId); - IQNetPlayer* GetPlayerByXuid(PlayerUID xuid); - uint32_t GetPlayerCount(); - QNET_STATE GetState(); - bool IsHost(); - int32_t JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, - const INVITE_INFO* pInviteInfo); - void HostGame(); - void EndGame(); - - static IQNetPlayer m_player[4]; -}; - -class IQNetCallbacks {}; -class IQNetGameSearch {}; - struct XNQOSINFO { uint8_t bFlags; uint8_t bReserved; diff --git a/targets/minecraft/network/platform/NetworkPlayerInterface.h b/targets/platform/network/INetworkPlayer.h similarity index 100% rename from targets/minecraft/network/platform/NetworkPlayerInterface.h rename to targets/platform/network/INetworkPlayer.h diff --git a/targets/minecraft/network/platform/SessionInfo.h b/targets/platform/network/SessionInfo.h similarity index 100% rename from targets/minecraft/network/platform/SessionInfo.h rename to targets/platform/network/SessionInfo.h diff --git a/targets/platform/network/meson.build b/targets/platform/network/meson.build index a7ea6b5a0..dab092568 100644 --- a/targets/platform/network/meson.build +++ b/targets/platform/network/meson.build @@ -1 +1 @@ -platform_network_sources = files('stub/StubPlatformNetwork.cpp') +platform_network_sources = files('stub/StubPlatformNetwork.cpp', 'stub/StubNetworkPlayer.cpp') diff --git a/targets/platform/network/network.h b/targets/platform/network/network.h index 47f56fc30..9cd2be5a0 100644 --- a/targets/platform/network/network.h +++ b/targets/platform/network/network.h @@ -1,6 +1,8 @@ #pragma once #include "IPlatformNetwork.h" +#include "INetworkPlayer.h" +#include "SessionInfo.h" // Function accessor backed by a function-local static (Meyers singleton). // Same shape as platform/profile/profile.h: avoids the static-init-order diff --git a/targets/platform/network/stub/StubNetworkPlayer.cpp b/targets/platform/network/stub/StubNetworkPlayer.cpp new file mode 100644 index 000000000..987768ae8 --- /dev/null +++ b/targets/platform/network/stub/StubNetworkPlayer.cpp @@ -0,0 +1,53 @@ +#include "StubNetworkPlayer.h" + +#include "StubPlatformNetwork.h" +#include "java/System.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" + +StubNetworkPlayer::StubNetworkPlayer() { m_pSocket = nullptr; } + +uint8_t StubNetworkPlayer::GetSmallId() { return 0; } +void StubNetworkPlayer::SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority, bool ack) {} +bool StubNetworkPlayer::IsSameSystem(INetworkPlayer* player) { return true; } +int StubNetworkPlayer::GetOutstandingAckCount() { return 0; } +int StubNetworkPlayer::GetSendQueueSizeBytes(INetworkPlayer* player, + bool lowPriority) { + return 0; +} +int StubNetworkPlayer::GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority) { + return 0; +} +int StubNetworkPlayer::GetCurrentRtt() { return 0; } +bool StubNetworkPlayer::IsHost() { + return this == &StubPlatformNetwork::m_players[0]; +} +bool StubNetworkPlayer::IsGuest() { return false; } +bool StubNetworkPlayer::IsLocal() { return true; } +int StubNetworkPlayer::GetSessionIndex() { return 0; } +bool StubNetworkPlayer::IsTalking() { return false; } +bool StubNetworkPlayer::IsMutedByLocalUser(int dwUserIndex) { return false; } +bool StubNetworkPlayer::HasVoice() { return false; } +bool StubNetworkPlayer::HasCamera() { return false; } +void StubNetworkPlayer::SetSocket(Socket* pSocket) { m_pSocket = pSocket; } +Socket* StubNetworkPlayer::GetSocket() { return m_pSocket; } +PlayerUID StubNetworkPlayer::GetUID() { return INVALID_XUID; } +const char* StubNetworkPlayer::GetOnlineName() { return "stub"; } +std::string StubNetworkPlayer::GetDisplayName() { return "stub"; } +int StubNetworkPlayer::GetUserIndex() { + return this - &StubPlatformNetwork::m_players[0]; +} +void StubNetworkPlayer::SentChunkPacket() { + m_lastChunkPacketTime = System::currentTimeMillis(); +} +int StubNetworkPlayer::GetTimeSinceLastChunkPacket_ms() { + // If we haven't ever sent a packet, return maximum + if (m_lastChunkPacketTime == 0) { + return INT_MAX; + } + + const int64_t currentTime = System::currentTimeMillis(); + return static_cast(currentTime - m_lastChunkPacketTime); +} diff --git a/targets/platform/network/stub/StubNetworkPlayer.h b/targets/platform/network/stub/StubNetworkPlayer.h new file mode 100644 index 000000000..f317ab6d8 --- /dev/null +++ b/targets/platform/network/stub/StubNetworkPlayer.h @@ -0,0 +1,52 @@ +#pragma once + +#include + +#include + +#include "platform/network/network.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" + +class Socket; + +// This is an implementation of the INetworkPlayer interface for the supported +// QNet-backed path. It +// effectively wraps the StubNetworkPlayer class in a non-platform-specific way. It is +// managed by PlatformNetworkManagerStub. + +class StubNetworkPlayer : public INetworkPlayer { +public: + StubNetworkPlayer(); + + // Common player interface + unsigned char GetSmallId(); + void SendData(INetworkPlayer* player, const void* pvData, + int dataSize, bool lowPriority, bool ack); + bool IsSameSystem(INetworkPlayer* player); + int GetOutstandingAckCount(); + int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); + int GetSendQueueSizeMessages(INetworkPlayer* player, + bool lowPriority); + int GetCurrentRtt(); + bool IsHost(); + bool IsGuest(); + bool IsLocal(); + int GetSessionIndex(); + bool IsTalking(); + bool IsMutedByLocalUser(int userIndex); + bool HasVoice(); + bool HasCamera(); + int GetUserIndex(); + void SetSocket(Socket* pSocket); + Socket* GetSocket(); + const char* GetOnlineName(); + std::string GetDisplayName(); + PlayerUID GetUID(); + void SentChunkPacket(); + int GetTimeSinceLastChunkPacket_ms(); + +private: + int64_t m_lastChunkPacketTime; + Socket* m_pSocket; +}; \ No newline at end of file diff --git a/targets/platform/network/stub/StubPlatformNetwork.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp index 1394ef82c..6ed39ac96 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.cpp +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -1,5 +1,15 @@ #include "StubPlatformNetwork.h" +#include +#include + +#include + +#include "StubNetworkPlayer.h" +#include "app/common/Network/GameNetworkManager.h" +#include "minecraft/network/Socket.h" +#include "platform/C4JThread.h" +#include "platform/NetTypes.h" #include "platform/network/network.h" namespace platform_internal { @@ -8,3 +18,509 @@ IPlatformNetwork& PlatformNetwork_get() { return instance; } } // namespace platform_internal + +static bool s_gameRunning = false; +StubNetworkPlayer StubPlatformNetwork::m_players[4]; + +void StubPlatformNetwork::NotifyPlayerJoined(INetworkPlayer* pQNetPlayer) { + const char* pszDescription; + + // 4J Stu - We create a fake socket for every where that we need an INBOUND + // queue of game data. Outbound is all handled by QNet so we don't need + // that. Therefore each client player has one, and the host has one for each + // client player. + bool createFakeSocket = false; + bool localPlayer = false; + + INetworkPlayer* networkPlayer = + (INetworkPlayer*)addNetworkPlayer(pQNetPlayer); + + if (pQNetPlayer->IsLocal()) { + localPlayer = true; + if (pQNetPlayer->IsHost()) { + pszDescription = "local host"; + // 4J Stu - No socket for the localhost as it uses a special + // loopback queue + + m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); + } else { + pszDescription = "local"; + + // We need an inbound queue on all local players to receive data + // from the host + createFakeSocket = true; + } + } else { + if (pQNetPlayer->IsHost()) { + pszDescription = "remote host"; + } else { + pszDescription = "remote"; + + // If we are the host, then create a fake socket for every remote + // player + if (IsHost()) { + createFakeSocket = true; + } + } + + if (IsHost() && !m_bHostChanged) { + // Do we already have a primary player for this system? + bool systemHasPrimaryPlayer = false; + for (auto it = m_machineQNetPrimaryPlayers.begin(); + it < m_machineQNetPrimaryPlayers.end(); ++it) { + INetworkPlayer* pQNetPrimaryPlayer = *it; + if (pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer)) { + systemHasPrimaryPlayer = true; + break; + } + } + if (!systemHasPrimaryPlayer) + m_machineQNetPrimaryPlayers.push_back(pQNetPlayer); + } + } + g_NetworkManager.PlayerJoining(networkPlayer); + + if (createFakeSocket == true && !m_bHostChanged) { + g_NetworkManager.CreateSocket(networkPlayer, localPlayer); + } + + fprintf(stderr, "Player 0x%p \"%s\" joined; %s; voice %i; camera %i.\n", + pQNetPlayer, pQNetPlayer->GetOnlineName(), pszDescription, + (int)pQNetPlayer->HasVoice(), (int)pQNetPlayer->HasCamera()); + + if (IsHost()) { + // 4J-PB - only the host should do this + // g_NetworkManager.UpdateAndSetGameSessionData(); + SystemFlagAddPlayer(networkPlayer); + } + + for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (playerChangedCallback[idx]) + playerChangedCallback[idx](networkPlayer, false); + } + + if (s_gameRunning) { + int localPlayerCount = 0; + for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { + if (GetLocalPlayerByUserIndex(idx) != nullptr) ++localPlayerCount; + } + } +} + +bool StubPlatformNetwork::Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize) { + m_pGameNetworkManager = pGameNetworkManager; + m_flagIndexSize = flagIndexSize; + + for (int i = 0; i < XUSER_MAX_COUNT; i++) { + playerChangedCallback[i] = nullptr; + } + + m_bLeavingGame = false; + m_bLeaveGameOnTick = false; + m_bHostChanged = false; + + m_bSearchResultsReady = false; + m_bSearchPending = false; + + m_bIsOfflineGame = false; + m_SessionsUpdatedCallback = nullptr; + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + m_searchResultsCount[i] = 0; + m_lastSearchStartTime[i] = 0; + + // The results that will be filled in with the current search + m_pSearchResults[i] = nullptr; + m_pQoSResult[i] = nullptr; + m_pCurrentSearchResults[i] = nullptr; + m_pCurrentQoSResult[i] = nullptr; + m_currentSearchResultsCount[i] = 0; + } + + // Success! + return true; +} + +void StubPlatformNetwork::Terminate() { + // TODO: 4jcraft, no release of ressources +} + +int StubPlatformNetwork::GetJoiningReadyPercentage() { return 100; } + +int StubPlatformNetwork::CorrectErrorIDS(int IDS) { return IDS; } + +bool StubPlatformNetwork::isSystemPrimaryPlayer(INetworkPlayer* pQNetPlayer) { + return true; +} + +// We call this twice a frame, either side of the render call so is a good place +// to "tick" things +void StubPlatformNetwork::DoWork() {} + +int StubPlatformNetwork::GetPlayerCount() { return 1; } + +bool StubPlatformNetwork::ShouldMessageForFullSession() { return false; } + +int StubPlatformNetwork::GetOnlinePlayerCount() { return 1; } + +int StubPlatformNetwork::GetLocalPlayerMask(int playerIndex) { + return 1 << playerIndex; +} + +bool StubPlatformNetwork::AddLocalPlayerByUserIndex(int userIndex) { + NotifyPlayerJoined(GetLocalPlayerByUserIndex(userIndex)); + return true; +} + +bool StubPlatformNetwork::RemoveLocalPlayerByUserIndex(int userIndex) { + return true; +} + +bool StubPlatformNetwork::IsInStatsEnabledSession() { return true; } + +bool StubPlatformNetwork::SessionHasSpace(unsigned int spaceRequired /*= 1*/) { + return true; +} + +void StubPlatformNetwork::SendInviteGUI(int quadrant) {} + +bool StubPlatformNetwork::IsAddingPlayer() { return false; } + +bool StubPlatformNetwork::LeaveGame(bool bMigrateHost) { + if (m_bLeavingGame) return true; + + m_bLeavingGame = true; + + // If we are the host wait for the game server to end + if (IsHost() && g_NetworkManager.ServerStoppedValid()) { + s_gameRunning = false; + g_NetworkManager.ServerStoppedWait(); + g_NetworkManager.ServerStoppedDestroy(); + } + return true; +} + +bool StubPlatformNetwork::_LeaveGame(bool bMigrateHost, bool bLeaveRoom) { + return true; +} + +void StubPlatformNetwork::HostGame( + int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) { + // #ifdef 0 + // 4J Stu - We probably did this earlier as well, but just to be sure! + SetLocalGame(!bOnlineGame); + SetPrivateGame(bIsPrivate); + SystemFlagReset(); + + // Make sure that the Primary Pad is in by default + localUsersMask |= GetLocalPlayerMask(g_NetworkManager.GetPrimaryPad()); + + m_bLeavingGame = false; + s_gameRunning = true; + + _HostGame(localUsersMask, publicSlots, privateSlots); + // #endif +} + +void StubPlatformNetwork::_HostGame( + int usersMask, unsigned char publicSlots /*= MINECRAFT_NET_MAX_PLAYERS*/, + unsigned char privateSlots /*= 0*/) {} + +bool StubPlatformNetwork::_StartGame() { return true; } + +int StubPlatformNetwork::JoinGame(FriendSessionInfo* searchResult, + int localUsersMask, int primaryUserIndex) { + return CGameNetworkManager::JOINGAME_SUCCESS; +} + +bool StubPlatformNetwork::SetLocalGame(bool isLocal) { + m_bIsOfflineGame = isLocal; + + return true; +} + +void StubPlatformNetwork::SetPrivateGame(bool isPrivate) { + fprintf(stderr, "Setting as private game: %s\n", isPrivate ? "yes" : "no"); + m_bIsPrivateGame = isPrivate; +} + +void StubPlatformNetwork::RegisterPlayerChangedCallback( + int iPad, + std::function callback) { + playerChangedCallback[iPad] = std::move(callback); +} + +void StubPlatformNetwork::UnRegisterPlayerChangedCallback(int iPad) { + playerChangedCallback[iPad] = nullptr; +} + +void StubPlatformNetwork::HandleSignInChange() { return; } + +bool StubPlatformNetwork::_RunNetworkGame() { return true; } + +void StubPlatformNetwork::UpdateAndSetGameSessionData( + INetworkPlayer* pNetworkPlayerLeaving /*= nullptr*/) { + // uint32_t playerCount = m_player->GetPlayerCount(); + // + // if( this->m_bLeavingGame ) + // return; + // + // if( GetHostPlayer() == nullptr ) + // return; + // + // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) + // { + // if( i < playerCount ) + // { + // INetworkPlayer *pNetworkPlayer = GetPlayerByIndex(i); + // + // // We can call this from NotifyPlayerLeaving but at that + // point the player is still considered in the session + // if( pNetworkPlayer != pNetworkPlayerLeaving ) + // { + // m_hostGameSessionData.players[i] = + // ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID(); + // + // char *temp; + // temp = (char *)wstring_to_string( + // pNetworkPlayer->GetOnlineName() ); + // memcpy(m_hostGameSessionData.szPlayers[i],temp,XUSER_NAME_SIZE); + // } + // else + // { + // m_hostGameSessionData.players[i] = nullptr; + // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); + // } + // } + // else + // { + // m_hostGameSessionData.players[i] = nullptr; + // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); + // } + // } + // + // m_hostGameSessionData.hostPlayerUID = ((NetworkPlayerXbox + // *)GetHostPlayer())->GetQNetPlayer()->GetXuid(); + // m_hostGameSessionData.m_uiGameHostSettings = + // app.GetGameHostOption(eGameHostOption_All); +} + +bool StubPlatformNetwork::RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer) { + return true; +} + +StubPlatformNetwork::PlayerFlags::PlayerFlags(INetworkPlayer* pNetworkPlayer, + unsigned int count) { + // 4J Stu - Don't assert, just make it a multiple of 8! This count is + // calculated from a load of separate values, and makes tweaking + // world/render sizes a pain if we hit an assert here + count = (count + 8 - 1) & ~(8 - 1); + // assert( ( count % 8 ) == 0 ); + this->m_pNetworkPlayer = pNetworkPlayer; + this->flags = new unsigned char[count / 8]; + memset(this->flags, 0, count / 8); + this->count = count; +} +StubPlatformNetwork::PlayerFlags::~PlayerFlags() { delete[] flags; } + +// Add a player to the per system flag storage - if we've already got a player +// from that system, copy its flags over +void StubPlatformNetwork::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { + PlayerFlags* newPlayerFlags = + new PlayerFlags(pNetworkPlayer, m_flagIndexSize); + // If any of our existing players are on the same system, then copy over + // flags from that one + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + memcpy(newPlayerFlags->flags, m_playerFlags[i]->flags, + m_playerFlags[i]->count / 8); + break; + } + } + m_playerFlags.push_back(newPlayerFlags); +} + +// Remove a player from the per system flag storage - just maintains the +// m_playerFlags vector without any gaps in it +void StubPlatformNetwork::SystemFlagRemovePlayer( + INetworkPlayer* pNetworkPlayer) { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + delete m_playerFlags[i]; + m_playerFlags[i] = m_playerFlags.back(); + m_playerFlags.pop_back(); + return; + } + } +} + +void StubPlatformNetwork::SystemFlagReset() { + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + delete m_playerFlags[i]; + } + m_playerFlags.clear(); +} + +// Set a per system flag - this is done by setting the flag on every player that +// shares that system +void StubPlatformNetwork::SystemFlagSet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return; + if (pNetworkPlayer == nullptr) return; + + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (pNetworkPlayer->IsSameSystem(m_playerFlags[i]->m_pNetworkPlayer)) { + m_playerFlags[i]->flags[index / 8] |= (128 >> (index % 8)); + } + } +} + +// Get value of a per system flag - can be read from the flags of the passed in +// player as anything else sent to that system should also have been duplicated +// here +bool StubPlatformNetwork::SystemFlagGet(INetworkPlayer* pNetworkPlayer, + int index) { + if ((index < 0) || (index >= m_flagIndexSize)) return false; + if (pNetworkPlayer == nullptr) { + return false; + } + + for (unsigned int i = 0; i < m_playerFlags.size(); i++) { + if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { + return ((m_playerFlags[i]->flags[index / 8] & + (128 >> (index % 8))) != 0); + } + } + return false; +} + +std::string StubPlatformNetwork::GatherStats() { return ""; } + +std::string StubPlatformNetwork::GatherRTTStats() { + std::string stats("Rtt: "); + + char stat[32]; + + for (unsigned int i = 0; i < GetPlayerCount(); ++i) { + INetworkPlayer* pQNetPlayer = GetPlayerByIndex(i); + + if (!pQNetPlayer->IsLocal()) { + memset(stat, 0, 32 * sizeof(char)); + snprintf(stat, 32, "%d: %d/", i, pQNetPlayer->GetCurrentRtt()); + stats.append(stat); + } + } + return stats; +} + +void StubPlatformNetwork::TickSearch() {} + +void StubPlatformNetwork::SearchForGames() {} + +void StubPlatformNetwork::SetSearchResultsReady(int resultCount) { + m_bSearchResultsReady = true; + m_searchResultsCount[m_lastSearchPad] = resultCount; +} + +std::vector* StubPlatformNetwork::GetSessionList( + int iPad, int localPlayers, bool partyOnly) { + std::vector* filteredList = + new std::vector(); + ; + return filteredList; +} + +bool StubPlatformNetwork::GetGameSessionInfo( + int iPad, SessionID sessionId, FriendSessionInfo* foundSessionInfo) { + return false; +} + +void StubPlatformNetwork::SetSessionsUpdatedCallback( + std::function callback) { + m_SessionsUpdatedCallback = std::move(callback); +} + +void StubPlatformNetwork::GetFullFriendSessionInfo( + FriendSessionInfo* foundSession, + std::function callback) { + callback(true); +} + +void StubPlatformNetwork::ForceFriendsSessionRefresh() { + fprintf(stderr, "Resetting friends session search data\n"); + + for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { + m_searchResultsCount[i] = 0; + m_lastSearchStartTime[i] = 0; + delete m_pSearchResults[i]; + m_pSearchResults[i] = nullptr; + } +} + +INetworkPlayer* StubPlatformNetwork::addNetworkPlayer( + INetworkPlayer* pQNetPlayer) { + StubNetworkPlayer* pNetworkPlayer = new StubNetworkPlayer(); + currentNetworkPlayers.push_back(pNetworkPlayer); + return pNetworkPlayer; +} + +void StubPlatformNetwork::removeNetworkPlayer(INetworkPlayer* pQNetPlayer) { + INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); + for (auto it = currentNetworkPlayers.begin(); + it != currentNetworkPlayers.end(); it++) { + if (*it == pNetworkPlayer) { + currentNetworkPlayers.erase(it); + return; + } + } +} + +INetworkPlayer* StubPlatformNetwork::getNetworkPlayer( + INetworkPlayer* pQNetPlayer) { + return pQNetPlayer; +} + +INetworkPlayer* StubPlatformNetwork::GetLocalPlayerByUserIndex(int userIndex) { + if (userIndex != 0) return nullptr; // 4jcraft: hack + return getNetworkPlayer(&m_players[userIndex]); +} + +INetworkPlayer* StubPlatformNetwork::GetPlayerByIndex(int playerIndex) { + return getNetworkPlayer(&m_players[0]); +} + +INetworkPlayer* StubPlatformNetwork::GetPlayerByXuid(PlayerUID xuid) { + return getNetworkPlayer(&m_players[0]); +} + +INetworkPlayer* StubPlatformNetwork::GetPlayerBySmallId(unsigned char smallId) { + return getNetworkPlayer(&m_players[0]); +} + +INetworkPlayer* StubPlatformNetwork::GetHostPlayer() { + return getNetworkPlayer(&m_players[0]); +} + +bool StubPlatformNetwork::IsHost() { return !m_bHostChanged; } + +bool StubPlatformNetwork::JoinGameFromInviteInfo( + int userIndex, int userMask, const INVITE_INFO* pInviteInfo) { + return 0; +} + +void StubPlatformNetwork::SetSessionTexturePackParentId(int id) { + m_hostGameSessionData.texturePackParentId = id; +} + +void StubPlatformNetwork::SetSessionSubTexturePackId(int id) { + m_hostGameSessionData.subTexturePackId = id; +} + +void StubPlatformNetwork::Notify(int ID, uintptr_t Param) {} + +bool StubPlatformNetwork::IsInSession() { return s_gameRunning; } +bool StubPlatformNetwork::IsInGameplay() { return s_gameRunning; } +bool StubPlatformNetwork::IsReadyToPlayOrIdle() { return true; } \ No newline at end of file diff --git a/targets/platform/network/stub/StubPlatformNetwork.h b/targets/platform/network/stub/StubPlatformNetwork.h index 086b8d37a..1c801335b 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.h +++ b/targets/platform/network/stub/StubPlatformNetwork.h @@ -1,129 +1,180 @@ #pragma once +#include +// using namespace std; +#include +#include +#include "StubNetworkPlayer.h" +#include "minecraft/client/model/SkinBox.h" +#include "platform/NetTypes.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" #include "platform/network/IPlatformNetwork.h" +#include "platform/network/network.h" -// True no-op platform network backend. Returns false / 0 / nullptr for -// every operation. The composition root can substitute a real backend -// (QNet, Steam, EOS, custom) at link time. Used as the platform default -// so consumers can call PlatformNetwork.* without nullptr checks. +class CGameNetworkManager; +class INetworkPlayer; class StubPlatformNetwork : public IPlatformNetwork { public: - bool Initialise(CGameNetworkManager* /*pGameNetworkManager*/, - int /*flagIndexSize*/) override { - return true; - } - void Terminate() override {} - void DoWork() override {} - [[nodiscard]] int GetJoiningReadyPercentage() override { return 100; } - [[nodiscard]] int CorrectErrorIDS(int IDS) override { return IDS; } + static StubNetworkPlayer m_players[4]; - [[nodiscard]] int GetPlayerCount() override { return 0; } - [[nodiscard]] int GetOnlinePlayerCount() override { return 0; } - [[nodiscard]] int GetLocalPlayerMask(int /*playerIndex*/) override { - return 0; - } - bool AddLocalPlayerByUserIndex(int /*userIndex*/) override { return false; } - bool RemoveLocalPlayerByUserIndex(int /*userIndex*/) override { - return false; - } - [[nodiscard]] INetworkPlayer* GetLocalPlayerByUserIndex( - int /*userIndex*/) override { - return nullptr; - } - [[nodiscard]] INetworkPlayer* GetPlayerByIndex( - int /*playerIndex*/) override { - return nullptr; - } - [[nodiscard]] INetworkPlayer* GetPlayerByXuid(PlayerUID /*xuid*/) override { - return nullptr; - } - [[nodiscard]] INetworkPlayer* GetPlayerBySmallId( - unsigned char /*smallId*/) override { - return nullptr; - } - [[nodiscard]] INetworkPlayer* GetHostPlayer() override { return nullptr; } - [[nodiscard]] bool ShouldMessageForFullSession() override { return false; } + bool Initialise(CGameNetworkManager* pGameNetworkManager, + int flagIndexSize); + void Terminate(); + int GetJoiningReadyPercentage(); + int CorrectErrorIDS(int IDS); - [[nodiscard]] bool IsHost() override { return true; } - bool JoinGameFromInviteInfo(int /*userIndex*/, int /*userMask*/, - const INVITE_INFO* /*pInviteInfo*/) override { - return false; - } - bool LeaveGame(bool /*bMigrateHost*/) override { return true; } - [[nodiscard]] bool IsInSession() override { return false; } - [[nodiscard]] bool IsInGameplay() override { return false; } - [[nodiscard]] bool IsReadyToPlayOrIdle() override { return true; } - [[nodiscard]] bool IsInStatsEnabledSession() override { return false; } - [[nodiscard]] bool SessionHasSpace( - unsigned int /*spaceRequired*/) override { - return true; - } - void SendInviteGUI(int /*quadrant*/) override {} - [[nodiscard]] bool IsAddingPlayer() override { return false; } + void DoWork(); + int GetPlayerCount(); + int GetOnlinePlayerCount(); + int GetLocalPlayerMask(int playerIndex); + bool AddLocalPlayerByUserIndex(int userIndex); + bool RemoveLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetLocalPlayerByUserIndex(int userIndex); + INetworkPlayer* GetPlayerByIndex(int playerIndex); + INetworkPlayer* GetPlayerByXuid(PlayerUID xuid); + INetworkPlayer* GetPlayerBySmallId(unsigned char smallId); + bool ShouldMessageForFullSession(); - void HostGame(int /*localUsersMask*/, bool /*bOnlineGame*/, - bool /*bIsPrivate*/, unsigned char /*publicSlots*/, - unsigned char /*privateSlots*/) override {} - int JoinGame(FriendSessionInfo* /*searchResult*/, int /*dwLocalUsersMask*/, - int /*dwPrimaryUserIndex*/) override { - return 0; - } - bool SetLocalGame(bool /*isLocal*/) override { return true; } - [[nodiscard]] bool IsLocalGame() override { return true; } - void SetPrivateGame(bool /*isPrivate*/) override {} - [[nodiscard]] bool IsPrivateGame() override { return false; } - [[nodiscard]] bool IsLeavingGame() override { return false; } - void ResetLeavingGame() override {} + INetworkPlayer* GetHostPlayer(); + bool IsHost(); + bool JoinGameFromInviteInfo(int userIndex, int userMask, + const INVITE_INFO* pInviteInfo); + bool LeaveGame(bool bMigrateHost); + + bool IsInSession(); + bool IsInGameplay(); + bool IsReadyToPlayOrIdle(); + bool IsInStatsEnabledSession(); + bool SessionHasSpace(unsigned int spaceRequired = 1); + void SendInviteGUI(int quadrant); + bool IsAddingPlayer(); + + void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + int JoinGame(FriendSessionInfo* searchResult, int localUsersMask, + int primaryUserIndex); + bool SetLocalGame(bool isLocal); + bool IsLocalGame() { return m_bIsOfflineGame; } + void SetPrivateGame(bool isPrivate); + bool IsPrivateGame() { return m_bIsPrivateGame; } + bool IsLeavingGame() { return m_bLeavingGame; } + void ResetLeavingGame() { m_bLeavingGame = false; } void RegisterPlayerChangedCallback( - int /*iPad*/, - std::function /*callback*/) override {} - void UnRegisterPlayerChangedCallback(int /*iPad*/) override {} + int iPad, + std::function callback); + void UnRegisterPlayerChangedCallback(int iPad); - void HandleSignInChange() override {} + void HandleSignInChange(); - bool _RunNetworkGame() override { return true; } - bool _LeaveGame(bool /*bMigrateHost*/, bool /*bLeaveRoom*/) override { - return true; - } - void _HostGame(int /*usersMask*/, unsigned char /*publicSlots*/, - unsigned char /*privateSlots*/) override {} - bool _StartGame() override { return true; } + bool _RunNetworkGame(); +private: + bool isSystemPrimaryPlayer(INetworkPlayer* pQNetPlayer); + bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); + void _HostGame(int dwUsersMask, + unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, + unsigned char privateSlots = 0); + bool _StartGame(); + + void* m_notificationListener; + + std::vector + m_machineQNetPrimaryPlayers; // collection of players that we deem to + // be the main one for that system + + bool m_bLeavingGame; + bool m_bLeaveGameOnTick; + bool m_migrateHostOnLeave; + bool m_bHostChanged; + + bool m_bIsOfflineGame; + bool m_bIsPrivateGame; + int m_flagIndexSize; + + // This is only maintained by the host, and is not valid on client machines + GameSessionData m_hostGameSessionData; + CGameNetworkManager* m_pGameNetworkManager; + +public: void UpdateAndSetGameSessionData( - INetworkPlayer* /*pNetworkPlayerLeaving*/) override {} - bool RemoveLocalPlayer(INetworkPlayer* /*pNetworkPlayer*/) override { - return false; - } + INetworkPlayer* pNetworkPlayerLeaving = nullptr); - void SystemFlagSet(INetworkPlayer* /*pNetworkPlayer*/, - int /*index*/) override {} - [[nodiscard]] bool SystemFlagGet(INetworkPlayer* /*pNetworkPlayer*/, - int /*index*/) override { - return false; - } +private: + std::function + playerChangedCallback[XUSER_MAX_COUNT]; - [[nodiscard]] std::string GatherStats() override { return {}; } - [[nodiscard]] std::string GatherRTTStats() override { return {}; } + bool RemoveLocalPlayer(INetworkPlayer* pNetworkPlayer); - void SetSessionTexturePackParentId(int /*id*/) override {} - void SetSessionSubTexturePackId(int /*id*/) override {} - void Notify(int /*ID*/, uintptr_t /*Param*/) override {} + // Things for handling per-system flags + class PlayerFlags { + public: + INetworkPlayer* m_pNetworkPlayer; + unsigned char* flags; + unsigned int count; + PlayerFlags(INetworkPlayer* pNetworkPlayer, unsigned int count); + ~PlayerFlags(); + }; + std::vector m_playerFlags; + void SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagRemovePlayer(INetworkPlayer* pNetworkPlayer); + void SystemFlagReset(); - [[nodiscard]] std::vector* GetSessionList( - int /*iPad*/, int /*localPlayers*/, bool /*partyOnly*/) override { - return nullptr; - } - [[nodiscard]] bool GetGameSessionInfo( - int /*iPad*/, SessionID /*sessionId*/, - FriendSessionInfo* /*foundSession*/) override { - return false; - } - void SetSessionsUpdatedCallback( - std::function /*callback*/) override {} - void GetFullFriendSessionInfo( - FriendSessionInfo* /*foundSession*/, - std::function /*callback*/) override {} - void ForceFriendsSessionRefresh() override {} -}; +public: + void SystemFlagSet(INetworkPlayer* pNetworkPlayer, int index); + bool SystemFlagGet(INetworkPlayer* pNetworkPlayer, int index); + +public: + std::string GatherStats(); + std::string GatherRTTStats(); + +private: + std::vector friendsSessions[XUSER_MAX_COUNT]; + int m_searchResultsCount[XUSER_MAX_COUNT]; + int m_lastSearchStartTime[XUSER_MAX_COUNT]; + + // The results that will be filled in with the current search + XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT]; + XNQOS* m_pQoSResult[XUSER_MAX_COUNT]; + + // The results from the previous search, which are currently displayed in + // the game + XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT]; + XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT]; + int m_currentSearchResultsCount[XUSER_MAX_COUNT]; + + int m_lastSearchPad; + bool m_bSearchResultsReady; + bool m_bSearchPending; + std::function m_SessionsUpdatedCallback; + + void TickSearch(); + void SearchForGames(); + + void SetSearchResultsReady(int resultCount = 0); + + std::vector currentNetworkPlayers; + INetworkPlayer* addNetworkPlayer(INetworkPlayer* pQNetPlayer); + void removeNetworkPlayer(INetworkPlayer* pQNetPlayer); + static INetworkPlayer* getNetworkPlayer(INetworkPlayer* pQNetPlayer); + + void SetSessionTexturePackParentId(int id); + void SetSessionSubTexturePackId(int id); + void Notify(int ID, uintptr_t Param); + +public: + std::vector* GetSessionList(int iPad, int localPlayers, + bool partyOnly); + bool GetGameSessionInfo(int iPad, SessionID sessionId, + FriendSessionInfo* foundSession); + void SetSessionsUpdatedCallback(std::function callback); + void GetFullFriendSessionInfo(FriendSessionInfo* foundSession, + std::function callback); + void ForceFriendsSessionRefresh(); + +private: + void NotifyPlayerJoined(INetworkPlayer* pQNetPlayer); +}; \ No newline at end of file From bc494aa97902e20cfbe0d0852d9f0a1d44444eb0 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:18:11 -0500 Subject: [PATCH 063/104] clean up NetTypes and move to platform/network --- targets/app/common/App_structs.h | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/Game.h | 2 +- .../app/common/Network/GameNetworkManager.h | 2 +- targets/app/common/NetworkController.h | 2 +- .../UIScene_CreateWorldMenu.cpp | 2 +- .../UIScene_LoadMenu.cpp | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 2 +- .../UIScene_MainMenu.cpp | 2 +- .../Help & Options/UIScene_LanguageSelector.h | 2 +- .../UIScene_TeleportMenu.h | 2 +- .../client/gui/CreateWorldScreen.cpp | 2 +- .../minecraft/client/renderer/LevelRenderer.h | 2 +- .../client/renderer/entity/PlayerRenderer.h | 2 +- targets/minecraft/network/Socket.cpp | 2 +- targets/minecraft/server/PlayerList.cpp | 2 +- .../server/network/PendingConnection.cpp | 2 +- .../level/chunk/CompressedTileStorage.cpp | 2 +- .../world/level/chunk/SparseDataStorage.cpp | 2 +- .../world/level/chunk/SparseLightStorage.cpp | 2 +- targets/platform/network/IPlatformNetwork.h | 2 +- targets/platform/{ => network}/NetTypes.h | 14 ------ targets/platform/network/SessionInfo.h | 2 +- .../network/stub/StubNetworkPlayer.cpp | 2 +- .../platform/network/stub/StubNetworkPlayer.h | 15 +++---- .../network/stub/StubPlatformNetwork.cpp | 45 ++----------------- .../network/stub/StubPlatformNetwork.h | 15 +------ 27 files changed, 34 insertions(+), 101 deletions(-) rename targets/platform/{ => network}/NetTypes.h (75%) diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index ace259fcb..2888d32a9 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -7,7 +7,7 @@ #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" #include "platform/profile/ProfileConstants.h" #include "platform/storage/storage.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index b2f1c5a0a..a7414eea4 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -41,7 +41,7 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 1e84b9fbc..575d1f28f 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -32,7 +32,7 @@ #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" // JoinFromInviteData moved to NetworkController.h diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 941e1e7b8..02a7a30af 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -9,7 +9,7 @@ #endif #include "minecraft/network/INetworkService.h" #include "platform/C4JThread.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/network/IPlatformNetwork.h" #include "platform/network/network.h" diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 6557f4b0b..29ebaa0e0 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -4,7 +4,7 @@ #include "app/common/App_structs.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" #include "platform/storage/storage.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 bf0111fd4..a1cfe1723 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 @@ -31,7 +31,7 @@ #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.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 ddfcc5174..2e5a1563f 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 @@ -29,7 +29,7 @@ #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.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 049b74d94..b2dbc5f2a 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 @@ -26,7 +26,7 @@ #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "strings.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 547bdb0a4..8e8a10dfb 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 @@ -30,7 +30,7 @@ #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" #include "app/common/Audio/SoundTypes.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index 1dae880f3..d6e8946d4 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -8,7 +8,7 @@ #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" #include "platform/profile/ProfileConstants.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h index a0b2dbb57..a49e80444 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" class INetworkPlayer; class UILayer; diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index f200034ac..f4f76b0af 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -28,7 +28,7 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/stubs.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index fa319735a..a2939c342 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -7,7 +7,7 @@ #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" #include "platform/C4JThread.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "util/Definitions.h" class ClipChunk; diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.h b/targets/minecraft/client/renderer/entity/PlayerRenderer.h index e2440f8cf..821834b08 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.h +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.h @@ -6,7 +6,7 @@ #include "minecraft/client/model/SkinBox.h" #include "minecraft/client/renderer/entity/LivingEntityRenderer.h" #include "minecraft/world/entity/player/Player.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" class HumanoidModel; class LivingEntity; diff --git a/targets/minecraft/network/Socket.cpp b/targets/minecraft/network/Socket.cpp index 58f1e5b76..ad3f7c932 100644 --- a/targets/minecraft/network/Socket.cpp +++ b/targets/minecraft/network/Socket.cpp @@ -9,7 +9,7 @@ #include "app/common/Network/GameNetworkManager.h" #include "platform/network/network.h" #include "minecraft/server/network/ServerConnection.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 5846bb049..4dacfd31a 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -70,7 +70,7 @@ #include "minecraft/world/level/storage/LevelStorage.h" #include "minecraft/world/level/storage/PlayerIO.h" #include "nbt/CompoundTag.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index d01771dd2..830985e49 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -21,7 +21,7 @@ #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/util/Log.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/storage/storage.h" diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 1d0a72562..32f9081c2 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -11,7 +11,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "util/Definitions.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index 14cc70b8a..ffc746a48 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -9,7 +9,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 3f9c8773d..6c521253d 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -9,7 +9,7 @@ #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" // Note: See header for an overview of this class diff --git a/targets/platform/network/IPlatformNetwork.h b/targets/platform/network/IPlatformNetwork.h index cb0b3c659..345b8b335 100644 --- a/targets/platform/network/IPlatformNetwork.h +++ b/targets/platform/network/IPlatformNetwork.h @@ -5,7 +5,7 @@ #include #include -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #ifndef VER_NETWORK diff --git a/targets/platform/NetTypes.h b/targets/platform/network/NetTypes.h similarity index 75% rename from targets/platform/NetTypes.h rename to targets/platform/network/NetTypes.h index 3397058cd..839cbe5be 100644 --- a/targets/platform/NetTypes.h +++ b/targets/platform/network/NetTypes.h @@ -17,20 +17,6 @@ using SessionID = uint64_t; using GameSessionUID = PlayerUID; class INVITE_INFO; -inline constexpr int QNET_SENDDATA_LOW_PRIORITY = 0; -inline constexpr int QNET_SENDDATA_SECONDARY = 0; -inline constexpr int QNET_SENDDATA_RELIABLE = 0; -inline constexpr int QNET_SENDDATA_SEQUENTIAL = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_SECONDARY_TYPE = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_MESSAGES = 0; -inline constexpr int QNET_GETSENDQUEUESIZE_BYTES = 0; - -#define QNET_E_SESSION_FULL 0 -#define QNET_USER_MASK_USER0 1 -#define QNET_USER_MASK_USER1 2 -#define QNET_USER_MASK_USER2 4 -#define QNET_USER_MASK_USER3 8 - struct XRNM_SEND_BUFFER { uint32_t dwDataSize; uint8_t* pbyData; diff --git a/targets/platform/network/SessionInfo.h b/targets/platform/network/SessionInfo.h index 51c02e051..898aac270 100644 --- a/targets/platform/network/SessionInfo.h +++ b/targets/platform/network/SessionInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" // A struct that we store in the QoS data when we are hosting the session. Max // size 1020 bytes. diff --git a/targets/platform/network/stub/StubNetworkPlayer.cpp b/targets/platform/network/stub/StubNetworkPlayer.cpp index 987768ae8..e1a54a621 100644 --- a/targets/platform/network/stub/StubNetworkPlayer.cpp +++ b/targets/platform/network/stub/StubNetworkPlayer.cpp @@ -2,7 +2,7 @@ #include "StubPlatformNetwork.h" #include "java/System.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" StubNetworkPlayer::StubNetworkPlayer() { m_pSocket = nullptr; } diff --git a/targets/platform/network/stub/StubNetworkPlayer.h b/targets/platform/network/stub/StubNetworkPlayer.h index f317ab6d8..9a26dbf9b 100644 --- a/targets/platform/network/stub/StubNetworkPlayer.h +++ b/targets/platform/network/stub/StubNetworkPlayer.h @@ -4,16 +4,16 @@ #include -#include "platform/network/network.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" class Socket; // This is an implementation of the INetworkPlayer interface for the supported // QNet-backed path. It -// effectively wraps the StubNetworkPlayer class in a non-platform-specific way. It is -// managed by PlatformNetworkManagerStub. +// effectively wraps the StubNetworkPlayer class in a non-platform-specific way. +// It is managed by PlatformNetworkManagerStub. class StubNetworkPlayer : public INetworkPlayer { public: @@ -21,13 +21,12 @@ public: // Common player interface unsigned char GetSmallId(); - void SendData(INetworkPlayer* player, const void* pvData, - int dataSize, bool lowPriority, bool ack); + void SendData(INetworkPlayer* player, const void* pvData, int dataSize, + bool lowPriority, bool ack); bool IsSameSystem(INetworkPlayer* player); int GetOutstandingAckCount(); int GetSendQueueSizeBytes(INetworkPlayer* player, bool lowPriority); - int GetSendQueueSizeMessages(INetworkPlayer* player, - bool lowPriority); + int GetSendQueueSizeMessages(INetworkPlayer* player, bool lowPriority); int GetCurrentRtt(); bool IsHost(); bool IsGuest(); diff --git a/targets/platform/network/stub/StubPlatformNetwork.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp index 6ed39ac96..0a1032c62 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.cpp +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -9,7 +9,7 @@ #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/Socket.h" #include "platform/C4JThread.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/network/network.h" namespace platform_internal { @@ -120,24 +120,9 @@ bool StubPlatformNetwork::Initialise(CGameNetworkManager* pGameNetworkManager, m_bLeaveGameOnTick = false; m_bHostChanged = false; - m_bSearchResultsReady = false; - m_bSearchPending = false; - m_bIsOfflineGame = false; m_SessionsUpdatedCallback = nullptr; - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - - // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; - m_currentSearchResultsCount[i] = 0; - } - // Success! return true; } @@ -343,20 +328,6 @@ void StubPlatformNetwork::SystemFlagAddPlayer(INetworkPlayer* pNetworkPlayer) { m_playerFlags.push_back(newPlayerFlags); } -// Remove a player from the per system flag storage - just maintains the -// m_playerFlags vector without any gaps in it -void StubPlatformNetwork::SystemFlagRemovePlayer( - INetworkPlayer* pNetworkPlayer) { - for (unsigned int i = 0; i < m_playerFlags.size(); i++) { - if (m_playerFlags[i]->m_pNetworkPlayer == pNetworkPlayer) { - delete m_playerFlags[i]; - m_playerFlags[i] = m_playerFlags.back(); - m_playerFlags.pop_back(); - return; - } - } -} - void StubPlatformNetwork::SystemFlagReset() { for (unsigned int i = 0; i < m_playerFlags.size(); i++) { delete m_playerFlags[i]; @@ -420,10 +391,7 @@ void StubPlatformNetwork::TickSearch() {} void StubPlatformNetwork::SearchForGames() {} -void StubPlatformNetwork::SetSearchResultsReady(int resultCount) { - m_bSearchResultsReady = true; - m_searchResultsCount[m_lastSearchPad] = resultCount; -} +void StubPlatformNetwork::SetSearchResultsReady(int resultCount) {} std::vector* StubPlatformNetwork::GetSessionList( int iPad, int localPlayers, bool partyOnly) { @@ -451,13 +419,6 @@ void StubPlatformNetwork::GetFullFriendSessionInfo( void StubPlatformNetwork::ForceFriendsSessionRefresh() { fprintf(stderr, "Resetting friends session search data\n"); - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - m_searchResultsCount[i] = 0; - m_lastSearchStartTime[i] = 0; - delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; - } } INetworkPlayer* StubPlatformNetwork::addNetworkPlayer( @@ -484,7 +445,7 @@ INetworkPlayer* StubPlatformNetwork::getNetworkPlayer( } INetworkPlayer* StubPlatformNetwork::GetLocalPlayerByUserIndex(int userIndex) { - if (userIndex != 0) return nullptr; // 4jcraft: hack + if (userIndex != 0) return nullptr; // 4jcraft: hack return getNetworkPlayer(&m_players[userIndex]); } diff --git a/targets/platform/network/stub/StubPlatformNetwork.h b/targets/platform/network/stub/StubPlatformNetwork.h index 1c801335b..142000bf0 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.h +++ b/targets/platform/network/stub/StubPlatformNetwork.h @@ -6,7 +6,7 @@ #include "StubNetworkPlayer.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/NetTypes.h" +#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" #include "platform/network/IPlatformNetwork.h" @@ -136,19 +136,6 @@ private: int m_searchResultsCount[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT]; - // The results that will be filled in with the current search - XSESSION_SEARCHRESULT_HEADER* m_pSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pQoSResult[XUSER_MAX_COUNT]; - - // The results from the previous search, which are currently displayed in - // the game - XSESSION_SEARCHRESULT_HEADER* m_pCurrentSearchResults[XUSER_MAX_COUNT]; - XNQOS* m_pCurrentQoSResult[XUSER_MAX_COUNT]; - int m_currentSearchResultsCount[XUSER_MAX_COUNT]; - - int m_lastSearchPad; - bool m_bSearchResultsReady; - bool m_bSearchPending; std::function m_SessionsUpdatedCallback; void TickSearch(); From 19f73c27547ffd9627e7aa633c08e586fb21ebca Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:32:22 -0500 Subject: [PATCH 064/104] remove LinuxGame for just Game --- targets/app/common/ArchiveManager.cpp | 2 +- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/DLC/DLCAudioFile.cpp | 2 +- targets/app/common/DLC/DLCCapeFile.cpp | 2 +- targets/app/common/DLC/DLCColourTableFile.cpp | 2 +- targets/app/common/DLC/DLCGameRulesHeader.cpp | 2 +- .../app/common/DLC/DLCLocalisationFile.cpp | 2 +- targets/app/common/DLC/DLCManager.cpp | 2 +- targets/app/common/DLC/DLCPack.cpp | 2 +- targets/app/common/DLC/DLCSkinFile.cpp | 2 +- targets/app/common/DLC/DLCUIDataFile.cpp | 2 +- targets/app/common/DLCController.cpp | 2 +- targets/app/common/Game.cpp | 17 ++- targets/app/common/Game.h | 4 +- .../app/common/GameRules/GameRuleManager.cpp | 2 +- .../ApplySchematicRuleDefinition.cpp | 2 +- .../LevelGeneration/BiomeOverride.cpp | 2 +- .../ConsoleGenerateStructure.cpp | 2 +- .../LevelGenerationOptions.cpp | 2 +- .../LevelGeneration/StartFeature.cpp | 2 +- .../XboxStructureActionGenerateBox.cpp | 2 +- .../XboxStructureActionPlaceBlock.cpp | 2 +- .../XboxStructureActionPlaceContainer.cpp | 2 +- .../AddEnchantmentRuleDefinition.cpp | 2 +- .../CollectItemRuleDefinition.cpp | 2 +- .../CompleteAllRuleDefinition.cpp | 2 +- .../RuleDefinitions/GameRuleDefinition.cpp | 2 +- .../NamedAreaRuleDefinition.cpp | 2 +- .../UpdatePlayerRuleDefinition.cpp | 2 +- .../RuleDefinitions/UseTileRuleDefinition.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 2 +- targets/app/common/Game_XuiActions.cpp | 2 +- targets/app/common/LocalizationManager.cpp | 2 +- targets/app/common/MenuController.cpp | 2 +- .../app/common/Network/GameNetworkManager.cpp | 2 +- targets/app/common/NetworkController.cpp | 2 +- targets/app/common/SaveManager.cpp | 2 +- targets/app/common/SkinManager.cpp | 2 +- targets/app/common/Tutorial/FullTutorial.cpp | 2 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 2 +- .../app/common/Tutorial/TutorialMessage.cpp | 2 +- .../common/UI/All Platforms/ArchiveFile.cpp | 2 +- .../IUIScene_AbstractContainerMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_AnvilMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_BeaconMenu.cpp | 2 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../All Platforms/IUIScene_CreativeMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_HUD.cpp | 2 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_TradingMenu.cpp | 2 +- .../UIComponent_PressStartToPlay.cpp | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 2 +- .../Components/UIComponent_TutorialPopup.cpp | 2 +- .../app/common/UI/Components/UIScene_HUD.cpp | 2 +- targets/app/common/UI/Controls/UIControl.cpp | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 2 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 2 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 2 +- .../IUIScene_StartGame.cpp | 2 +- .../UIScene_CreateWorldMenu.cpp | 2 +- .../UIScene_DLCMainMenu.cpp | 2 +- .../UIScene_DLCOffersMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 2 +- .../UIScene_JoinMenu.cpp | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 2 +- .../UIScene_LeaderboardsMenu.cpp | 2 +- .../UIScene_LoadMenu.cpp | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 2 +- .../UIScene_MainMenu.cpp | 2 +- .../UIScene_NewUpdateMessage.cpp | 2 +- .../UIScene_SaveMessage.cpp | 2 +- .../UIScene_TrialExitUpsell.cpp | 2 +- .../Help & Options/UIScene_ControlsMenu.cpp | 2 +- .../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 | 2 +- .../Containers/UIScene_BeaconMenu.cpp | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 2 +- .../Containers/UIScene_ContainerMenu.cpp | 2 +- .../Containers/UIScene_CreativeMenu.cpp | 2 +- .../Containers/UIScene_DispenserMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_FireworksMenu.cpp | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 2 +- .../Containers/UIScene_HopperMenu.cpp | 2 +- .../Containers/UIScene_HorseInventoryMenu.cpp | 2 +- .../Containers/UIScene_InventoryMenu.cpp | 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 | 2 +- .../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 | 2 +- targets/app/common/UI/UIController.cpp | 2 +- targets/app/common/UI/UIFontData.cpp | 2 +- targets/app/common/UI/UIGroup.cpp | 2 +- targets/app/common/UI/UILayer.cpp | 2 +- targets/app/common/UI/UIScene.cpp | 2 +- targets/app/common/UI/UIString.cpp | 2 +- targets/app/common/UI/UITTFFont.cpp | 2 +- targets/app/linux/LinuxGame.cpp | 112 ------------------ targets/app/linux/LinuxGame.h | 22 ---- targets/app/linux/Linux_Minecraft.cpp | 2 +- targets/app/linux/Linux_UIController.cpp | 2 +- targets/app/linux_sources.txt | 1 - targets/minecraft/stats/StatsCounter.cpp | 2 +- 131 files changed, 140 insertions(+), 268 deletions(-) delete mode 100644 targets/app/linux/LinuxGame.cpp delete mode 100644 targets/app/linux/LinuxGame.h diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 51dd2b9d3..5d023a570 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -4,7 +4,7 @@ #include #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index c2f46cea5..7a63e2171 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -12,7 +12,7 @@ #include "app/common/Audio/ConsoleSoundEngine.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index a74834c17..a9626f7d2 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -7,7 +7,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/XboxStubs.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" diff --git a/targets/app/common/DLC/DLCCapeFile.cpp b/targets/app/common/DLC/DLCCapeFile.cpp index bde677ee6..42559a1c8 100644 --- a/targets/app/common/DLC/DLCCapeFile.cpp +++ b/targets/app/common/DLC/DLCCapeFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" DLCCapeFile::DLCCapeFile(const std::string& path) : DLCFile(DLCManager::e_DLCType_Cape, path) {} diff --git a/targets/app/common/DLC/DLCColourTableFile.cpp b/targets/app/common/DLC/DLCColourTableFile.cpp index 8cf7ed6b3..aaca55a6e 100644 --- a/targets/app/common/DLC/DLCColourTableFile.cpp +++ b/targets/app/common/DLC/DLCColourTableFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/TexturePack.h" diff --git a/targets/app/common/DLC/DLCGameRulesHeader.cpp b/targets/app/common/DLC/DLCGameRulesHeader.cpp index e86ec21f7..16beb8b57 100644 --- a/targets/app/common/DLC/DLCGameRulesHeader.cpp +++ b/targets/app/common/DLC/DLCGameRulesHeader.cpp @@ -5,7 +5,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCGameRules.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" class StringTable; diff --git a/targets/app/common/DLC/DLCLocalisationFile.cpp b/targets/app/common/DLC/DLCLocalisationFile.cpp index 5eb68ad59..d6ef40067 100644 --- a/targets/app/common/DLC/DLCLocalisationFile.cpp +++ b/targets/app/common/DLC/DLCLocalisationFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/locale/StringTable.h" DLCLocalisationFile::DLCLocalisationFile(const std::string& path) diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index f729b54e6..365c701b0 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -16,7 +16,7 @@ #include "DLCFile.h" #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" diff --git a/targets/app/common/DLC/DLCPack.cpp b/targets/app/common/DLC/DLCPack.cpp index 56accae69..d7e0f1714 100644 --- a/targets/app/common/DLC/DLCPack.cpp +++ b/targets/app/common/DLC/DLCPack.cpp @@ -17,7 +17,7 @@ #include "app/common/DLC/DLCFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/locale/StringTable.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/DLC/DLCSkinFile.cpp b/targets/app/common/DLC/DLCSkinFile.cpp index 2f13329c6..4ac69aee0 100644 --- a/targets/app/common/DLC/DLCSkinFile.cpp +++ b/targets/app/common/DLC/DLCSkinFile.cpp @@ -5,7 +5,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/model/SkinBox.h" #include "platform/XboxStubs.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/DLC/DLCUIDataFile.cpp b/targets/app/common/DLC/DLCUIDataFile.cpp index b799b548c..73c147893 100644 --- a/targets/app/common/DLC/DLCUIDataFile.cpp +++ b/targets/app/common/DLC/DLCUIDataFile.cpp @@ -2,7 +2,7 @@ #include "DLCManager.h" #include "app/common/DLC/DLCFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" DLCUIDataFile::DLCUIDataFile(const std::string& path) : DLCFile(DLCManager::e_DLCType_UIData, path) { diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index bdbb1a044..5b74a5a06 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -7,7 +7,7 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/Game.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index a7414eea4..091ec8cc8 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -9,7 +9,6 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/linux/LinuxGame.h" #include "app/linux/Linux_UIController.h" #include "java/Class.h" #include "java/File.h" @@ -32,7 +31,6 @@ #include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/Container.h" @@ -41,9 +39,10 @@ #include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/level/tile/entity/HopperTileEntity.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" @@ -353,7 +352,10 @@ bool Game::isXuidDeadmau5(PlayerUID xuid) { void Game::StoreLaunchData() {} -void Game::ExitGame() {} +void Game::ExitGame() { + DebugPrintf("[Game] ExitGame AFTER START\n"); + PlatformRenderer.Close(); +} // Invites @@ -366,7 +368,10 @@ void Game::ExitGame() {} // We have to assume that we've not been able to load the text for the game. // ////////////////////////////////////////////////////////////////////////// -void Game::FatalLoadError() {} +void Game::FatalLoadError() { + DebugPrintf("FatalLoadError - asserting 0 and dying...\n"); + assert(0); +} // Game Host options @@ -631,3 +636,5 @@ std::string Game::getRootPath(std::uint32_t packId, bool allowOverride, return path + "\\"; } } + +Game app; diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 575d1f28f..c8e08930d 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -5,6 +5,7 @@ #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "platform/renderer/renderer.h" #include "util/Timer.h" // using namespace std; @@ -1209,5 +1210,4 @@ public: #endif }; -// singleton -// extern CMinecraftApp app; \ No newline at end of file +extern Game app; \ No newline at end of file diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index b80f37c19..a8c66c0d6 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -16,7 +16,7 @@ #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 38d1afb6b..8200ddb49 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" diff --git a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp index 5886fb321..3eca5ed55 100644 --- a/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp +++ b/targets/app/common/GameRules/LevelGeneration/BiomeOverride.cpp @@ -1,6 +1,6 @@ #include "BiomeOverride.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 2ceeb4e76..714c77637 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -9,7 +9,7 @@ #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Direction.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index 8351c4328..b2e2479f3 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -15,7 +15,7 @@ #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" #include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp index 76299849d..5a3c0f634 100644 --- a/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StartFeature.cpp @@ -1,6 +1,6 @@ #include "StartFeature.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index 5cf0fdeda..e3254aab9 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,7 +1,7 @@ #include "XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index 34299492b..b0690c711 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,7 +1,7 @@ #include "XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 68d512003..494fb30a7 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -6,7 +6,7 @@ #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/world/Container.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp index 4d089fc17..55187a29e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/AddEnchantmentRuleDefinition.cpp @@ -3,7 +3,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/item/EnchantedBookItem.h" #include "minecraft/world/item/Item.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp index 3fe6282c6..9bfaf0834 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CollectItemRuleDefinition.cpp @@ -1,6 +1,6 @@ #include "CollectItemRuleDefinition.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index c8431003b..9b48fc742 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -5,7 +5,7 @@ #include #include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" #include "minecraft/world/level/GameRules/GameRule.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index ea42d5261..9149bc99e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -10,7 +10,7 @@ #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp index 456bc4e48..768a7c3b8 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/NamedAreaRuleDefinition.cpp @@ -2,7 +2,7 @@ #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index b29b7911d..b95f6600e 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -5,7 +5,7 @@ #include #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Pos.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp index b29ab5797..4c5afe076 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UseTileRuleDefinition.cpp @@ -1,6 +1,6 @@ #include "UseTileRuleDefinition.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 9220fb7d2..cc9794a14 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -5,7 +5,7 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 042cc5bdc..a342f9415 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 9a2210b50..037b134d5 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -8,7 +8,7 @@ #include "app/common/App_structs.h" #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index d5e0f541a..5742082e3 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 4a971e2a9..690cc343c 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -16,7 +16,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index 3d37c560a..a7a4bfa94 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -7,7 +7,7 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index ae1fa00de..3b10dbe4a 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -4,7 +4,7 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/SkinManager.cpp b/targets/app/common/SkinManager.cpp index 4cc7a743c..ca6be829f 100644 --- a/targets/app/common/SkinManager.cpp +++ b/targets/app/common/SkinManager.cpp @@ -10,7 +10,7 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/geom/Model.h" diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index ca1f78ba3..c5213a11c 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -23,7 +23,7 @@ #include "app/common/Tutorial/Tasks/UseTileTask.h" #include "app/common/Tutorial/Tasks/XuiCraftingTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/alchemy/PotionMacros.h" diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index d58244009..7add2ad70 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -8,7 +8,7 @@ #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 3f3d9a24a..787dd344c 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -20,7 +20,7 @@ #include "app/common/Tutorial/Tasks/RideEntityTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/Class.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/Tutorial/TutorialMessage.cpp b/targets/app/common/Tutorial/TutorialMessage.cpp index 2f3e0f10a..f8eab5d63 100644 --- a/targets/app/common/Tutorial/TutorialMessage.cpp +++ b/targets/app/common/Tutorial/TutorialMessage.cpp @@ -1,6 +1,6 @@ #include "TutorialMessage.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" TutorialMessage::TutorialMessage( int messageId, bool limitRepeats /*= false*/, diff --git a/targets/app/common/UI/All Platforms/ArchiveFile.cpp b/targets/app/common/UI/All Platforms/ArchiveFile.cpp index e5a07e58a..4959be986 100644 --- a/targets/app/common/UI/All Platforms/ArchiveFile.cpp +++ b/targets/app/common/UI/All Platforms/ArchiveFile.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/FileInputStream.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index 532c29414..a66987e73 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -10,7 +10,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp index 6a4d6d9c2..effa9750f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp @@ -4,7 +4,7 @@ #include #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp index ab5330c4b..b470964d3 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp @@ -7,7 +7,7 @@ #include "minecraft/GameEnums.h" #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 9e83cb9cc..2e30a139e 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -9,7 +9,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.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 0a31ac168..a9805c187 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -7,7 +7,7 @@ #include #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index dc64e747a..6dd14c5a8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -6,7 +6,7 @@ #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index bd3f67303..a504c5288 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -14,7 +14,7 @@ #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index 4b0b707b6..4cbf4ebf8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -6,7 +6,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp index 4eb7ec5c2..45750ec78 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp @@ -2,7 +2,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "strings.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 1e9eb4716..999d19833 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -12,7 +12,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index f5629a62d..fc69867cd 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 4d6fb58c7..90e923c20 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" diff --git a/targets/app/common/UI/Controls/UIControl.cpp b/targets/app/common/UI/Controls/UIControl.cpp index 691216a3e..dc3467158 100644 --- a/targets/app/common/UI/Controls/UIControl.cpp +++ b/targets/app/common/UI/Controls/UIControl.cpp @@ -6,7 +6,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/JavaMath.h" UIControl::UIControl() { diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index 473029c07..10d5f67f3 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -15,7 +15,7 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Font.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 54b27ca61..8dba0e7db 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -13,7 +13,7 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "java/Class.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index ead8d9ff0..6eef7e5e7 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/server/MinecraftServer.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 34485f76d..e615fb20a 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -6,7 +6,7 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/input/InputConstants.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index dcf252c21..fc1d3bde6 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -18,7 +18,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/commands/common/EnchantItemCommand.h" #include "minecraft/commands/common/GiveItemCommand.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index cc301bee4..556db92b3 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" 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 65463dfd2..94946557b 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.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/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_CreateWorldMenu.cpp index a1cfe1723..8e4b98cf7 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 @@ -17,7 +17,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.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 4cf330511..f7c1ad835 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 @@ -5,7 +5,7 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "strings.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 e09f759df..0dd349d80 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 @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.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 fc81ac180..a49b71c0e 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 @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.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 ea463c8e7..5c52cbf43 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.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 4e0fed476..b6fa51cc4 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.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 ee23ecbff..b9abd7e14 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 @@ -13,7 +13,7 @@ #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.h" #include "app/common/Audio/SoundTypes.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 2e5a1563f..c7437c20c 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 @@ -15,7 +15,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.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 b2dbc5f2a..f67c7e15d 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 @@ -12,7 +12,7 @@ #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.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 8e8a10dfb..d576e4a74 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 @@ -15,7 +15,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.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 c54819aa4..753e3d19c 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 @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.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 0d3487727..0a0baae81 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 @@ -5,7 +5,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.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 faad5c611..ec4d3efb6 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 "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.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 51ba1cbae..f64d02436 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/BuildVer.h" #include "minecraft/GameEnums.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 d889687f3..08c780d9c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "strings.h" #include "util/StringHelpers.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 c2759fdde..afa5c4b08 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -4,7 +4,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.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 7d5532895..91b10ee0a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundTypes.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 2bdca1cf2..cad506495 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.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 25310afc1..86edef6ff 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -3,7 +3,7 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.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 9cd949d15..3c8640584 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -3,7 +3,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "strings.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 39804afc9..bee06ed79 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 33bc48fa2..9531e7de8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -5,7 +5,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 ede1945ad..612624c13 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 e610b9dbc..252388d10 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -4,7 +4,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.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 8168a478f..f3feb408e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 8e5bb788a..143264327 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 7df0b5562..17291e9a0 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -13,7 +13,7 @@ #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.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 53bc88642..e8e8f40d0 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 @@ -12,7 +12,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.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 cd8c5ddcf..b313afc82 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 @@ -15,7 +15,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index fa27ae1d8..328b196da 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -12,7 +12,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.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 f60eb9a07..a85be489c 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/BrewingStandMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp index 0ee196de4..f57e6b61c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index 10653db19..18ca33f99 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -17,7 +17,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp index 7223240bd..09346d5df 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.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 b9f80f605..49b281684 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 @@ -14,7 +14,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp index 28d1eee2a..1cce87774 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/world/inventory/FireworksMenu.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 1fd08f277..1ae2b33af 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp index 294c5e91c..5221755d6 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index 9e9f9378f..1b5617952 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -17,7 +17,7 @@ #ifndef _ENABLEIGGY #include "app/linux/Stubs/iggy_stubs.h" #endif -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index 67ebaf6b7..7632984c3 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -13,7 +13,7 @@ #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.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 44009e221..660cbfa89 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 @@ -13,7 +13,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.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 1679c1108..1e812d402 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 @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.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 4efb6e88b..35ee1b970 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 @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 448650f9c..d0a6a0f6f 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 "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/Random.h" #include "minecraft/GameEnums.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 f4fabe66a..8bcf0003b 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 @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 7022e00e1..e70348c78 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 @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.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 e8eed0628..b24b04a03 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 @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 3d2b50e5c..74fbd8308 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 @@ -14,7 +14,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.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 6817c4665..859212a35 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 @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.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 303d60426..761874e0a 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 @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index 76e61d5bf..bbecfb9b1 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 1183838ac..123e3b2b9 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index 5959ed9e2..ae36113cb 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -5,7 +5,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/GameTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 855e05dd3..124da3915 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index d7d002d32..7540fb51d 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index f4a1e559e..96b40f41d 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -34,7 +34,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "UIFontData.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" #include "minecraft/client/BufferedImage.h" diff --git a/targets/app/common/UI/UIFontData.cpp b/targets/app/common/UI/UIFontData.cpp index 5f4e53c9d..1d36d18dc 100644 --- a/targets/app/common/UI/UIFontData.cpp +++ b/targets/app/common/UI/UIFontData.cpp @@ -4,7 +4,7 @@ #include -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" ///////////////////////////////////////////////////// // --- -- --- THIS FILE IS IN UNICODE --- -- --- // diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index 58ad0bc69..2b8e35d65 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index a348916ba..7033e9aef 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -76,7 +76,7 @@ #include "app/common/UI/UIGroup.h" #include "app/common/UI/UIScene.h" #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index 763dcf4bf..a551b2b81 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -18,7 +18,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "java/System.h" #include "minecraft/client/Lighting.h" diff --git a/targets/app/common/UI/UIString.cpp b/targets/app/common/UI/UIString.cpp index 235e67a60..e08539d33 100644 --- a/targets/app/common/UI/UIString.cpp +++ b/targets/app/common/UI/UIString.cpp @@ -1,6 +1,6 @@ #include "UIString.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/XboxStubs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index 2d09b2ad3..f4d29db88 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -7,7 +7,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/fs/fs.h" #include "util/StringHelpers.h" diff --git a/targets/app/linux/LinuxGame.cpp b/targets/app/linux/LinuxGame.cpp deleted file mode 100644 index 7dd6381a5..000000000 --- a/targets/app/linux/LinuxGame.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "LinuxGame.h" -#include "platform/game/game.h" - -#include - -#include - -#include "app/common/Game.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/UI/All Platforms/UIStructs.h" -#include "minecraft/GameEnums.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/User.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/world/level/LevelSettings.h" -#include "platform/C4JThread.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" - -LinuxGame app; - -#define CONTEXT_GAME_STATE 0 - -LinuxGame::LinuxGame() : Game() {} - -void LinuxGame::StoreLaunchData() {} -void LinuxGame::ExitGame() { - app.DebugPrintf("Linux_App LinuxGame::ExitGame AFTER START\n"); - PlatformRenderer.Close(); -} -void LinuxGame::FatalLoadError() { - app.DebugPrintf("LinuxGame::FatalLoadError - asserting 0 and dying...\n"); - assert(0); -} - -void LinuxGame::TemporaryCreateGameStart() { - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_Main::OnInit - - app.setLevelGenerationOptions(nullptr); - - // From CScene_Main::RunPlayGame - Minecraft* pMinecraft = Minecraft::GetInstance(); - PlatformGame.ReleaseSaveThumbnail(); - PlatformProfile.SetLockedProfile(0); - pMinecraft->user->name = "Windows"; - app.ApplyGameSettingsChanged(0); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameJoinLoad::OnInit - MinecraftServer::resetFlags(); - - // From CScene_MultiGameJoinLoad::OnNotifyPressEx - app.SetTutorialMode(false); - app.SetCorruptSaveDeleted(false); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameCreate::CreateGame - - app.ClearTerrainFeaturePosition(); - std::string wWorldName = "TestWorld"; - - PlatformStorage.ResetSaveData(); - PlatformStorage.SetSaveTitle(wWorldName.c_str()); - - bool isFlat = false; - int64_t seedValue = - 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); - // // 4J - was (new Random())->nextLong() - now trying to actually - // find a seed to suit our requirements - - NetworkGameInitData* param = new NetworkGameInitData(); - param->seed = seedValue; - param->saveData = nullptr; - - app.SetGameHostOption(eGameHostOption_Difficulty, 0); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends, 0); - app.SetGameHostOption(eGameHostOption_Gamertags, 1); - app.SetGameHostOption(eGameHostOption_BedrockFog, 1); - - app.SetGameHostOption( - eGameHostOption_GameType, - GameType::CREATIVE->getId()); // LevelSettings::GAMETYPE_SURVIVAL - app.SetGameHostOption(eGameHostOption_LevelType, 0); - app.SetGameHostOption(eGameHostOption_Structures, 1); - app.SetGameHostOption(eGameHostOption_BonusChest, 0); - - app.SetGameHostOption(eGameHostOption_PvP, 1); - app.SetGameHostOption(eGameHostOption_TrustPlayers, 1); - app.SetGameHostOption(eGameHostOption_FireSpreads, 1); - app.SetGameHostOption(eGameHostOption_TNT, 1); - app.SetGameHostOption(eGameHostOption_HostCanFly, 1); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1); - - param->settings = app.GetGameHostOption(eGameHostOption_All); - - g_NetworkManager.FakeLocalPlayerJoined(); - - LoadingInputParams* loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = param; - - // Reset the autosave time - app.SetAutosaveTimerTime(); - - C4JThread* thread = new C4JThread(loadingParams->func, - loadingParams->lpParam, "RunNetworkGame"); - thread->run(); -} - diff --git a/targets/app/linux/LinuxGame.h b/targets/app/linux/LinuxGame.h deleted file mode 100644 index c2dab570d..000000000 --- a/targets/app/linux/LinuxGame.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "app/common/Game.h" - -class C4JStringTable; - -class LinuxGame : public Game { -public: - LinuxGame(); - - void StoreLaunchData() override; - void ExitGame() override; - void FatalLoadError() override; - - C4JStringTable* GetStringTable() { return nullptr; } - - // original code - virtual void TemporaryCreateGameStart(); -}; - -extern LinuxGame app; - diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 44029ade7..1c5b93e94 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -61,7 +61,7 @@ static void sigsegv_handler(int sig) { #include "platform/profile/ProfileConstants.h" #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/linux/Linux_UIController.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/linux/Linux_UIController.cpp index 8d1871446..da18ce062 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/linux/Linux_UIController.cpp @@ -11,7 +11,7 @@ #include "app/linux/Stubs/iggy_stubs.h" #endif #include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "app/windows/Iggy/include/gdraw.h" ConsoleUIController ui; diff --git a/targets/app/linux_sources.txt b/targets/app/linux_sources.txt index 13d7459dc..2db425e4b 100644 --- a/targets/app/linux_sources.txt +++ b/targets/app/linux_sources.txt @@ -1,4 +1,3 @@ linux/Iggy/gdraw/gdraw.c -linux/LinuxGame.cpp linux/Linux_Minecraft.cpp linux/Linux_UIController.cpp diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 02ea62c82..17fcd442e 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -10,7 +10,7 @@ #include #include "app/common/App_structs.h" -#include "app/linux/LinuxGame.h" +#include "app/common/Game.h" #include "platform/leaderboard/IPlatformLeaderboard.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" From 224fd9dacc0492ce7ebd5298e0a74439cd69e428 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:42:17 -0500 Subject: [PATCH 065/104] remove remaining Linux implementations for common ones --- targets/app/common/Audio/SoundEngine.cpp | 2 +- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/DLC/DLCManager.cpp | 2 +- targets/app/common/DLCController.cpp | 2 +- targets/app/common/Game.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 2 +- targets/app/common/Game_XuiActions.cpp | 2 +- targets/app/{linux => common}/Iggy/gdraw/gdraw.c | 2 +- targets/app/{linux => common}/Iggy/gdraw/gdraw.h | 2 +- targets/app/{linux/Stubs => common/Iggy}/iggy_stubs.h | 2 +- targets/app/{linux => common}/Iggy/include/gdraw.h | 0 targets/app/{linux => common}/Iggy/include/iggy.h | 0 targets/app/{linux => common}/Iggy/include/rrCore.h | 0 targets/app/common/MenuController.cpp | 2 +- targets/app/common/Network/GameNetworkManager.cpp | 2 +- targets/app/common/NetworkController.cpp | 2 +- targets/app/common/Tutorial/Tasks/ChoiceTask.cpp | 2 +- targets/app/common/Tutorial/Tasks/InfoTask.cpp | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 2 +- .../All Platforms/IUIScene_AbstractContainerMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_CraftingMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_CreativeMenu.cpp | 2 +- targets/app/common/UI/All Platforms/IUIScene_HUD.cpp | 2 +- .../app/common/UI/All Platforms/IUIScene_PauseMenu.cpp | 2 +- .../common/UI/All Platforms/IUIScene_TradingMenu.cpp | 2 +- targets/app/common/UI/Components/UIComponent_Chat.cpp | 8 ++++---- targets/app/common/UI/Components/UIComponent_Chat.h | 2 +- .../Components/UIComponent_DebugUIMarketingGuide.cpp | 6 +++--- .../UI/Components/UIComponent_DebugUIMarketingGuide.h | 4 ++-- .../UI/Components/UIComponent_MenuBackground.cpp | 8 ++++---- .../common/UI/Components/UIComponent_MenuBackground.h | 2 +- .../app/common/UI/Components/UIComponent_Panorama.cpp | 8 ++++---- .../app/common/UI/Components/UIComponent_Panorama.h | 6 +++--- .../UI/Components/UIComponent_PressStartToPlay.cpp | 2 +- .../UI/Components/UIComponent_PressStartToPlay.h | 4 ++-- .../app/common/UI/Components/UIComponent_Tooltips.cpp | 8 ++++---- .../app/common/UI/Components/UIComponent_Tooltips.h | 6 +++--- .../common/UI/Components/UIComponent_TutorialPopup.cpp | 2 +- .../common/UI/Components/UIComponent_TutorialPopup.h | 6 +++--- targets/app/common/UI/Components/UIScene_HUD.cpp | 2 +- targets/app/common/UI/Components/UIScene_HUD.h | 6 +++--- .../UI/ConsoleUIController.cpp} | 10 +++++----- .../UI/ConsoleUIController.h} | 4 ++-- targets/app/common/UI/Controls/UIControl.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl.h | 6 +++--- targets/app/common/UI/Controls/UIControl_Base.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_Base.h | 4 ++-- .../UI/Controls/UIControl_BeaconEffectButton.cpp | 4 ++-- .../common/UI/Controls/UIControl_BeaconEffectButton.h | 4 ++-- .../app/common/UI/Controls/UIControl_BitmapIcon.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_BitmapIcon.h | 4 ++-- targets/app/common/UI/Controls/UIControl_Button.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_Button.h | 4 ++-- .../app/common/UI/Controls/UIControl_ButtonList.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_ButtonList.h | 4 ++-- targets/app/common/UI/Controls/UIControl_CheckBox.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_CheckBox.h | 4 ++-- targets/app/common/UI/Controls/UIControl_Cursor.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_Cursor.h | 4 ++-- targets/app/common/UI/Controls/UIControl_DLCList.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_DLCList.h | 4 ++-- .../app/common/UI/Controls/UIControl_DynamicLabel.cpp | 6 +++--- .../app/common/UI/Controls/UIControl_DynamicLabel.h | 6 +++--- .../common/UI/Controls/UIControl_EnchantmentBook.cpp | 4 ++-- .../app/common/UI/Controls/UIControl_EnchantmentBook.h | 4 ++-- .../common/UI/Controls/UIControl_EnchantmentButton.cpp | 4 ++-- .../common/UI/Controls/UIControl_EnchantmentButton.h | 4 ++-- targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_HTMLLabel.h | 6 +++--- targets/app/common/UI/Controls/UIControl_Label.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_Label.h | 4 ++-- .../common/UI/Controls/UIControl_LeaderboardList.cpp | 4 ++-- .../app/common/UI/Controls/UIControl_LeaderboardList.h | 4 ++-- .../common/UI/Controls/UIControl_MinecraftHorse.cpp | 4 ++-- .../app/common/UI/Controls/UIControl_MinecraftHorse.h | 4 ++-- .../common/UI/Controls/UIControl_MinecraftPlayer.cpp | 4 ++-- .../app/common/UI/Controls/UIControl_MinecraftPlayer.h | 4 ++-- .../app/common/UI/Controls/UIControl_PlayerList.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_PlayerList.h | 4 ++-- .../common/UI/Controls/UIControl_PlayerSkinPreview.cpp | 4 ++-- .../common/UI/Controls/UIControl_PlayerSkinPreview.h | 4 ++-- targets/app/common/UI/Controls/UIControl_Progress.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_Progress.h | 4 ++-- targets/app/common/UI/Controls/UIControl_SaveList.cpp | 6 +++--- targets/app/common/UI/Controls/UIControl_SaveList.h | 4 ++-- targets/app/common/UI/Controls/UIControl_Slider.cpp | 8 ++++---- targets/app/common/UI/Controls/UIControl_Slider.h | 6 +++--- targets/app/common/UI/Controls/UIControl_SlotList.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_SlotList.h | 4 ++-- .../common/UI/Controls/UIControl_SpaceIndicatorBar.cpp | 4 ++-- .../common/UI/Controls/UIControl_SpaceIndicatorBar.h | 4 ++-- targets/app/common/UI/Controls/UIControl_TextInput.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_TextInput.h | 4 ++-- .../common/UI/Controls/UIControl_TexturePackList.cpp | 6 +++--- .../app/common/UI/Controls/UIControl_TexturePackList.h | 6 +++--- targets/app/common/UI/Controls/UIControl_Touch.cpp | 4 ++-- targets/app/common/UI/Controls/UIControl_Touch.h | 4 ++-- .../UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp | 4 ++-- .../UI/Scenes/Debug/UIScene_DebugCreateSchematic.h | 2 +- .../common/UI/Scenes/Debug/UIScene_DebugOptions.cpp | 4 ++-- .../common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 8 ++++---- .../app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h | 6 +++--- .../common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp | 4 ++-- .../common/UI/Scenes/Debug/UIScene_DebugSetCamera.h | 2 +- .../Frontend Menu screens/IUIScene_StartGame.cpp | 2 +- .../Scenes/Frontend Menu screens/IUIScene_StartGame.h | 2 +- .../Frontend Menu screens/UIScene_CreateWorldMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_CreateWorldMenu.h | 2 +- .../Frontend Menu screens/UIScene_DLCMainMenu.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_DLCMainMenu.h | 2 +- .../Frontend Menu screens/UIScene_DLCOffersMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_DLCOffersMenu.h | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_EULA.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_EULA.h | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_Intro.cpp | 4 ++-- .../UI/Scenes/Frontend Menu screens/UIScene_Intro.h | 4 ++-- .../Scenes/Frontend Menu screens/UIScene_JoinMenu.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_JoinMenu.h | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 2 +- .../UIScene_LaunchMoreOptionsMenu.h | 6 +++--- .../Frontend Menu screens/UIScene_LeaderboardsMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_LeaderboardsMenu.h | 6 +++--- .../Scenes/Frontend Menu screens/UIScene_LoadMenu.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_LoadMenu.h | 2 +- .../Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp | 2 +- .../Frontend Menu screens/UIScene_LoadOrJoinMenu.h | 2 +- .../Scenes/Frontend Menu screens/UIScene_MainMenu.cpp | 2 +- .../UI/Scenes/Frontend Menu screens/UIScene_MainMenu.h | 6 +++--- .../Frontend Menu screens/UIScene_NewUpdateMessage.cpp | 2 +- .../Frontend Menu screens/UIScene_NewUpdateMessage.h | 2 +- .../Frontend Menu screens/UIScene_SaveMessage.cpp | 2 +- .../Scenes/Frontend Menu screens/UIScene_SaveMessage.h | 6 +++--- .../Frontend Menu screens/UIScene_TrialExitUpsell.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_ControlsMenu.h | 6 +++--- .../UI/Scenes/Help & Options/UIScene_Credits.cpp | 2 +- .../common/UI/Scenes/Help & Options/UIScene_Credits.h | 6 +++--- .../Help & Options/UIScene_HelpAndOptionsMenu.cpp | 2 +- .../Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h | 2 +- .../UI/Scenes/Help & Options/UIScene_HowToPlay.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_HowToPlay.h | 4 ++-- .../UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h | 2 +- .../Scenes/Help & Options/UIScene_LanguageSelector.cpp | 2 +- .../Scenes/Help & Options/UIScene_LanguageSelector.h | 2 +- .../UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_ReinstallMenu.h | 2 +- .../Help & Options/UIScene_SettingsAudioMenu.cpp | 2 +- .../Scenes/Help & Options/UIScene_SettingsAudioMenu.h | 2 +- .../Help & Options/UIScene_SettingsControlMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsControlMenu.h | 2 +- .../Help & Options/UIScene_SettingsGraphicsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsGraphicsMenu.h | 2 +- .../UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_SettingsMenu.h | 2 +- .../Help & Options/UIScene_SettingsOptionsMenu.cpp | 2 +- .../Help & Options/UIScene_SettingsOptionsMenu.h | 2 +- .../Scenes/Help & Options/UIScene_SettingsUIMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h | 2 +- .../Scenes/Help & Options/UIScene_SkinSelectMenu.cpp | 2 +- .../UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h | 6 +++--- .../Containers/UIScene_AbstractContainerMenu.cpp | 2 +- .../Containers/UIScene_AbstractContainerMenu.h | 6 +++--- .../Containers/UIScene_AnvilMenu.h | 4 ++-- .../Containers/UIScene_BeaconMenu.h | 4 ++-- .../Containers/UIScene_CreativeMenu.cpp | 8 ++++---- .../Containers/UIScene_CreativeMenu.h | 4 ++-- .../Containers/UIScene_EnchantingMenu.cpp | 2 +- .../Containers/UIScene_EnchantingMenu.h | 2 +- .../Containers/UIScene_FireworksMenu.h | 4 ++-- .../Containers/UIScene_HorseInventoryMenu.cpp | 6 +++--- .../Containers/UIScene_HorseInventoryMenu.h | 4 ++-- .../Containers/UIScene_InventoryMenu.cpp | 2 +- .../Containers/UIScene_InventoryMenu.h | 4 ++-- .../Containers/UIScene_TradingMenu.cpp | 2 +- .../Containers/UIScene_TradingMenu.h | 4 ++-- .../In-Game Menu Screens/UIScene_CraftingMenu.cpp | 2 +- .../Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h | 4 ++-- .../Scenes/In-Game Menu Screens/UIScene_DeathMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h | 6 +++--- .../UIScene_InGameHostOptionsMenu.cpp | 2 +- .../UIScene_InGameHostOptionsMenu.h | 2 +- .../In-Game Menu Screens/UIScene_InGameInfoMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_InGameInfoMenu.h | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 2 +- .../UIScene_InGamePlayerOptionsMenu.h | 6 +++--- .../Scenes/In-Game Menu Screens/UIScene_PauseMenu.cpp | 2 +- .../UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h | 2 +- .../In-Game Menu Screens/UIScene_SignEntryMenu.cpp | 2 +- .../In-Game Menu Screens/UIScene_SignEntryMenu.h | 2 +- .../In-Game Menu Screens/UIScene_TeleportMenu.cpp | 2 +- .../Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h | 2 +- .../common/UI/Scenes/UIScene_ConnectingProgress.cpp | 2 +- .../app/common/UI/Scenes/UIScene_ConnectingProgress.h | 2 +- .../common/UI/Scenes/UIScene_FullscreenProgress.cpp | 2 +- .../app/common/UI/Scenes/UIScene_FullscreenProgress.h | 2 +- targets/app/common/UI/Scenes/UIScene_Keyboard.cpp | 2 +- targets/app/common/UI/Scenes/UIScene_Keyboard.h | 6 +++--- targets/app/common/UI/Scenes/UIScene_MessageBox.cpp | 2 +- targets/app/common/UI/Scenes/UIScene_MessageBox.h | 6 +++--- .../app/common/UI/Scenes/UIScene_QuadrantSignin.cpp | 2 +- targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h | 4 ++-- targets/app/common/UI/UIBitmapFont.cpp | 6 +++--- targets/app/common/UI/UIBitmapFont.h | 6 +++--- targets/app/common/UI/UIController.cpp | 6 +++--- targets/app/common/UI/UIController.h | 6 +++--- targets/app/common/UI/UIGroup.cpp | 4 ++-- targets/app/common/UI/UIGroup.h | 2 +- targets/app/common/UI/UILayer.cpp | 4 ++-- targets/app/common/UI/UILayer.h | 2 +- targets/app/common/UI/UIScene.cpp | 8 ++++---- targets/app/common/UI/UIScene.h | 6 +++--- targets/app/common/UI/UITTFFont.cpp | 6 +++--- targets/app/common/UI/UITTFFont.h | 2 +- targets/app/common_sources.txt | 2 ++ targets/app/linux/Linux_Minecraft.cpp | 2 +- targets/app/linux_sources.txt | 2 -- targets/minecraft/client/Minecraft.cpp | 2 +- targets/minecraft/client/gui/CreateWorldScreen.cpp | 2 +- targets/minecraft/client/gui/Gui.cpp | 2 +- .../minecraft/client/multiplayer/ClientConnection.cpp | 2 +- targets/minecraft/client/player/LocalPlayer.cpp | 2 +- targets/minecraft/client/skins/AbstractTexturePack.cpp | 2 +- targets/minecraft/client/skins/DLCTexturePack.cpp | 2 +- .../minecraft/client/skins/TexturePackRepository.cpp | 2 +- 227 files changed, 390 insertions(+), 390 deletions(-) rename targets/app/{linux => common}/Iggy/gdraw/gdraw.c (99%) rename targets/app/{linux => common}/Iggy/gdraw/gdraw.h (97%) rename targets/app/{linux/Stubs => common/Iggy}/iggy_stubs.h (99%) rename targets/app/{linux => common}/Iggy/include/gdraw.h (100%) rename targets/app/{linux => common}/Iggy/include/iggy.h (100%) rename targets/app/{linux => common}/Iggy/include/rrCore.h (100%) rename targets/app/{linux/Linux_UIController.cpp => common/UI/ConsoleUIController.cpp} (95%) rename targets/app/{linux/Linux_UIController.h => common/UI/ConsoleUIController.h} (92%) diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 7a63e2171..c782ae6de 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -11,7 +11,7 @@ #include #include "app/common/Audio/ConsoleSoundEngine.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index 66403ea07..f00833434 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -8,7 +8,7 @@ class Random; #include #include "app/common/Audio/ConsoleSoundEngine.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index 365c701b0..efedd845c 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -17,7 +17,7 @@ #include "DLCPack.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "platform/fs/fs.h" diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 5b74a5a06..5205beae1 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -8,7 +8,7 @@ #include "app/common/DLC/DLCSkinFile.h" #include "app/common/Game.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 091ec8cc8..c04daa4aa 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "java/File.h" #include "java/Random.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index cc9794a14..1b7c87741 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -6,7 +6,7 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index a342f9415..34c5a8c9b 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/linux/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c similarity index 99% rename from targets/app/linux/Iggy/gdraw/gdraw.c rename to targets/app/common/Iggy/gdraw/gdraw.c index 8b9f716ea..eeb97c02a 100644 --- a/targets/app/linux/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -10,7 +10,7 @@ #include #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "SDL_video.h" #ifndef _ENABLEIGGY diff --git a/targets/app/linux/Iggy/gdraw/gdraw.h b/targets/app/common/Iggy/gdraw/gdraw.h similarity index 97% rename from targets/app/linux/Iggy/gdraw/gdraw.h rename to targets/app/common/Iggy/gdraw/gdraw.h index e8ab9566d..3f99cf6ec 100644 --- a/targets/app/linux/Iggy/gdraw/gdraw.h +++ b/targets/app/common/Iggy/gdraw/gdraw.h @@ -1,7 +1,7 @@ #ifndef __LINUX_IGGY_GDRAW_H__ #define __LINUX_IGGY_GDRAW_H__ -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/windows/Iggy/include/gdraw.h" #include "app/windows/Iggy/include/iggy.h" diff --git a/targets/app/linux/Stubs/iggy_stubs.h b/targets/app/common/Iggy/iggy_stubs.h similarity index 99% rename from targets/app/linux/Stubs/iggy_stubs.h rename to targets/app/common/Iggy/iggy_stubs.h index 16ac44909..5df1121e1 100644 --- a/targets/app/linux/Stubs/iggy_stubs.h +++ b/targets/app/common/Iggy/iggy_stubs.h @@ -6,7 +6,7 @@ #include #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #define STUBBED \ {} diff --git a/targets/app/linux/Iggy/include/gdraw.h b/targets/app/common/Iggy/include/gdraw.h similarity index 100% rename from targets/app/linux/Iggy/include/gdraw.h rename to targets/app/common/Iggy/include/gdraw.h diff --git a/targets/app/linux/Iggy/include/iggy.h b/targets/app/common/Iggy/include/iggy.h similarity index 100% rename from targets/app/linux/Iggy/include/iggy.h rename to targets/app/common/Iggy/include/iggy.h diff --git a/targets/app/linux/Iggy/include/rrCore.h b/targets/app/common/Iggy/include/rrCore.h similarity index 100% rename from targets/app/linux/Iggy/include/rrCore.h rename to targets/app/common/Iggy/include/rrCore.h diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 5742082e3..865d138c8 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -10,7 +10,7 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 690cc343c..2206784c6 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -17,7 +17,7 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index a7a4bfa94..d4b4618f0 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -8,7 +8,7 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index 036b1be28..0c178167a 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -7,7 +7,7 @@ #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" #include "minecraft/world/tutorial/TutorialEnum.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/app/common/Tutorial/Tasks/InfoTask.cpp b/targets/app/common/Tutorial/Tasks/InfoTask.cpp index 588ac0686..a3ef7f19e 100644 --- a/targets/app/common/Tutorial/Tasks/InfoTask.cpp +++ b/targets/app/common/Tutorial/Tasks/InfoTask.cpp @@ -8,7 +8,7 @@ #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 787dd344c..957520108 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -21,7 +21,7 @@ #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index a66987e73..3bfbb9ba9 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -11,7 +11,7 @@ #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 2e30a139e..99afc9955 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -10,7 +10,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index a9805c187..66a5348e4 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index 6dd14c5a8..f8b3d944d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -7,7 +7,7 @@ #include "platform/renderer/renderer.h" #include "minecraft/GameEnums.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index a504c5288..015a83b6b 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -15,7 +15,7 @@ #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index 4cbf4ebf8..f01c72940 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -7,7 +7,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index daed9d34d..2dbc61780 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -6,13 +6,13 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index e99098640..68333ce51 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp index 21d50ba9e..a3c966828 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp @@ -1,11 +1,11 @@ #include "UIComponent_DebugUIMarketingGuide.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h index cf45d8a71..88681a955 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h @@ -5,9 +5,9 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index badb6e95b..8f8e1a866 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -2,13 +2,13 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" UIComponent_MenuBackground::UIComponent_MenuBackground(int iPad, void* initData, UILayer* parentLayer) diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index 1a9f8a985..02beeb6b6 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -4,7 +4,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index 06c93c0d5..c22ec72c8 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -6,13 +6,13 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/world/level/dimension/Dimension.h" diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index 976f6c462..fcf16038c 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -4,12 +4,12 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp index 45750ec78..ba45d5cac 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp @@ -3,7 +3,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index 364cc3845..020c887ef 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -6,10 +6,10 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 999d19833..1ebda0182 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -4,16 +4,16 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "util/StringHelpers.h" UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData, diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index 1c0b0dd8b..33cb096dc 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -5,14 +5,14 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/input/InputConstants.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index fc69867cd..15d352d61 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -10,7 +10,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index 36d2d2aca..70362f144 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -8,12 +8,12 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class ItemInstance; class Tutorial; diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index 90e923c20..e1f77974c 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index adca8d77a..464a6c0af 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -7,12 +7,12 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/linux/Linux_UIController.cpp b/targets/app/common/UI/ConsoleUIController.cpp similarity index 95% rename from targets/app/linux/Linux_UIController.cpp rename to targets/app/common/UI/ConsoleUIController.cpp index da18ce062..030342608 100644 --- a/targets/app/linux/Linux_UIController.cpp +++ b/targets/app/common/UI/ConsoleUIController.cpp @@ -3,14 +3,14 @@ // GDraw GL backend for Linux #include "platform/renderer/renderer.h" #include "renderer/gl/gl_compat.h" -#include "Linux_UIController.h" +#include "ConsoleUIController.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/Iggy/gdraw/gdraw.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/gdraw/gdraw.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "app/windows/Iggy/include/gdraw.h" diff --git a/targets/app/linux/Linux_UIController.h b/targets/app/common/UI/ConsoleUIController.h similarity index 92% rename from targets/app/linux/Linux_UIController.h rename to targets/app/common/UI/ConsoleUIController.h index ca59ed540..624a2c501 100644 --- a/targets/app/linux/Linux_UIController.h +++ b/targets/app/common/UI/ConsoleUIController.h @@ -2,8 +2,8 @@ #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/UIController.h" -#include "app/linux/Iggy/include/iggy.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/iggy.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/profile/profile.h" class ConsoleUIController : public UIController { diff --git a/targets/app/common/UI/Controls/UIControl.cpp b/targets/app/common/UI/Controls/UIControl.cpp index dc3467158..66e38ee68 100644 --- a/targets/app/common/UI/Controls/UIControl.cpp +++ b/targets/app/common/UI/Controls/UIControl.cpp @@ -1,11 +1,11 @@ #include "UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "java/JavaMath.h" diff --git a/targets/app/common/UI/Controls/UIControl.h b/targets/app/common/UI/Controls/UIControl.h index 0c1c73133..0b019c198 100644 --- a/targets/app/common/UI/Controls/UIControl.h +++ b/targets/app/common/UI/Controls/UIControl.h @@ -2,11 +2,11 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIScene; diff --git a/targets/app/common/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp index 2bea9da0b..8efd3d9a5 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -6,11 +6,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_Base::UIControl_Base() { diff --git a/targets/app/common/UI/Controls/UIControl_Base.h b/targets/app/common/UI/Controls/UIControl_Base.h index 3c64dc5bb..0f4c75e54 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.h +++ b/targets/app/common/UI/Controls/UIControl_Base.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif // This class maps to the FJ_Base class in actionscript diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp index 0d05bee90..c950d6e59 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp @@ -2,9 +2,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_BeaconEffectButton::UIControl_BeaconEffectButton() { diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h index bdc889568..ddaf7166a 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp index 0142039b1..df0bf0200 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp @@ -2,9 +2,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h index 452ce45ee..f114dc331 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_Button.cpp b/targets/app/common/UI/Controls/UIControl_Button.cpp index 1419a1bda..9ff0647c3 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.cpp +++ b/targets/app/common/UI/Controls/UIControl_Button.cpp @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Button.h b/targets/app/common/UI/Controls/UIControl_Button.h index 2f5abee9c..f20bdd6eb 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.h +++ b/targets/app/common/UI/Controls/UIControl_Button.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp index 54e6bb157..94cf3950b 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp @@ -4,11 +4,11 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_ButtonList::UIControl_ButtonList() { diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.h b/targets/app/common/UI/Controls/UIControl_ButtonList.h index e1f164916..f46ea438b 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.h +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.h @@ -7,9 +7,9 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp index 2b5956013..c3d382d1e 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp @@ -4,11 +4,11 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_CheckBox::UIControl_CheckBox() {} diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.h b/targets/app/common/UI/Controls/UIControl_CheckBox.h index da891a56b..f349efb40 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.h +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.cpp b/targets/app/common/UI/Controls/UIControl_Cursor.cpp index 3a5c44f4b..c0a9bc31a 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.cpp +++ b/targets/app/common/UI/Controls/UIControl_Cursor.cpp @@ -2,9 +2,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_Cursor::UIControl_Cursor() {} diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.h b/targets/app/common/UI/Controls/UIControl_Cursor.h index 8488628d0..52397d65d 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.h +++ b/targets/app/common/UI/Controls/UIControl_Cursor.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.cpp b/targets/app/common/UI/Controls/UIControl_DLCList.cpp index a1d7b083e..3bc119b9e 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.cpp +++ b/targets/app/common/UI/Controls/UIControl_DLCList.cpp @@ -3,11 +3,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_DLCList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.h b/targets/app/common/UI/Controls/UIControl_DLCList.h index 9b2ebf1bc..8a63aa730 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.h +++ b/targets/app/common/UI/Controls/UIControl_DLCList.h @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index 27eee671d..93250ad5a 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -3,11 +3,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_DynamicLabel::UIControl_DynamicLabel() {} diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h index ab45fb6b3..622ef07e2 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -5,12 +5,12 @@ #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_DynamicLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index d4a30af59..6e30bc79c 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -4,10 +4,10 @@ #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" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "java/Class.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h index 31e0ff88d..1820d27dd 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" #include "java/Random.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index 10d5f67f3..ec1ceaf30 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -9,11 +9,11 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "app/common/Game.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h index 26363f586..2bfd154b3 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Button.h" #include "java/Random.h" diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp index 57f25b015..9b37206ed 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp @@ -3,11 +3,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" UIControl_HTMLLabel::UIControl_HTMLLabel() {} diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 0fad90b1c..7f82d9902 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -6,12 +6,12 @@ #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_HTMLLabel : public UIControl_Label { private: diff --git a/targets/app/common/UI/Controls/UIControl_Label.cpp b/targets/app/common/UI/Controls/UIControl_Label.cpp index 128eb7a99..d05165c4d 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.cpp +++ b/targets/app/common/UI/Controls/UIControl_Label.cpp @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Label.h b/targets/app/common/UI/Controls/UIControl_Label.h index ff2e86f00..a91daeb63 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.h +++ b/targets/app/common/UI/Controls/UIControl_Label.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index fbd71e762..be5a218c6 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -3,9 +3,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h index 9129443f7..0843c9ef8 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index ac1faa19f..8b6c42a35 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -5,10 +5,10 @@ #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" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h index 31e824f60..e353401e8 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h @@ -1,9 +1,9 @@ #pragma once #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index 29d4bee4a..d60571d4b 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -5,10 +5,10 @@ #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" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h index 89d94f366..3bb87792a 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h @@ -1,9 +1,9 @@ #pragma once #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp index 4151d193e..49094c335 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp @@ -3,11 +3,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_PlayerList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.h b/targets/app/common/UI/Controls/UIControl_PlayerList.h index a9941b8c8..277a298cf 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.h @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 8dba0e7db..7d5ab5f02 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -7,11 +7,11 @@ #include #include "app/common/UI/Controls/UIControl.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "app/common/Game.h" #include "java/Class.h" diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h index 76f2a683b..e32732b85 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h @@ -6,9 +6,9 @@ #include #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl.h" #include "minecraft/client/renderer/Textures.h" diff --git a/targets/app/common/UI/Controls/UIControl_Progress.cpp b/targets/app/common/UI/Controls/UIControl_Progress.cpp index e8d5cb48a..466922f69 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.cpp +++ b/targets/app/common/UI/Controls/UIControl_Progress.cpp @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Progress.h b/targets/app/common/UI/Controls/UIControl_Progress.h index d1a1c4348..d4d715585 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.h +++ b/targets/app/common/UI/Controls/UIControl_Progress.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.cpp b/targets/app/common/UI/Controls/UIControl_SaveList.cpp index e583f60db..f92ad5467 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SaveList.cpp @@ -3,11 +3,11 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" bool UIControl_SaveList::setupControl(UIScene* scene, IggyValuePath* parent, diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.h b/targets/app/common/UI/Controls/UIControl_SaveList.h index 1ceca021a..fef3b7fca 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.h +++ b/targets/app/common/UI/Controls/UIControl_SaveList.h @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_ButtonList.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index 799a0fde6..b5272faff 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -4,12 +4,12 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/Audio/SoundTypes.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h index 823e55290..830028174 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -7,12 +7,12 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_Slider : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.cpp b/targets/app/common/UI/Controls/UIControl_SlotList.cpp index 9e46bd740..dcedc81e6 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SlotList.cpp @@ -3,9 +3,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_SlotList::UIControl_SlotList() { m_lastHighlighted = -1; } diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.h b/targets/app/common/UI/Controls/UIControl_SlotList.h index 6a77d7608..85f9cccba 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.h +++ b/targets/app/common/UI/Controls/UIControl_SlotList.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp index 3ea91d2e4..7361929d5 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h index c7323f452..4604e411e 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h @@ -11,9 +11,9 @@ #include "app/common/UI/Controls/UIControl_SpaceIndicatorBar.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.cpp b/targets/app/common/UI/Controls/UIControl_TextInput.cpp index 98156e1fd..94c093a10 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.cpp +++ b/targets/app/common/UI/Controls/UIControl_TextInput.cpp @@ -4,9 +4,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.h b/targets/app/common/UI/Controls/UIControl_TextInput.h index 5a272ebbc..81cce8103 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.h +++ b/targets/app/common/UI/Controls/UIControl_TextInput.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp index a91292bee..5fa272f0d 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp @@ -4,11 +4,11 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "util/StringHelpers.h" UIControl_TexturePackList::UIControl_TexturePackList() {} diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h index 8972fd657..564ffa6fd 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -5,12 +5,12 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UIControl_TexturePackList : public UIControl_Base { private: diff --git a/targets/app/common/UI/Controls/UIControl_Touch.cpp b/targets/app/common/UI/Controls/UIControl_Touch.cpp index 09da5f198..05993b64f 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.cpp +++ b/targets/app/common/UI/Controls/UIControl_Touch.cpp @@ -2,9 +2,9 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif UIControl_Touch::UIControl_Touch() {} diff --git a/targets/app/common/UI/Controls/UIControl_Touch.h b/targets/app/common/UI/Controls/UIControl_Touch.h index 74329f663..7002d3832 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.h +++ b/targets/app/common/UI/Controls/UIControl_Touch.h @@ -5,9 +5,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Touch.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIControl_Base.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index 6eef7e5e7..a20f7146f 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -8,9 +8,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h index cf96543d1..827070346 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "minecraft/server/ServerAction.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index e615fb20a..48fe9c309 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,10 +1,10 @@ #include "UIScene_DebugOptions.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/Console_Debug_enum.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "app/common/Game.h" #include "platform/input/InputConstants.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index fc1d3bde6..5866dfb34 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -11,15 +11,15 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/profile/profile.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/commands/common/EnchantItemCommand.h" #include "minecraft/commands/common/GiveItemCommand.h" #include "minecraft/commands/common/TimeCommand.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h index c331ce0b9..b5c71b8d8 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h @@ -10,11 +10,11 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Class.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index 556db92b3..d8c0e299c 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -10,9 +10,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" #include "platform/input/input.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h index aaf5ffd84..9c43f482c 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 94946557b..cbe183937 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 @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" 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 8fbf9ff13..67e4c1729 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 @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 8e4b98cf7..7da5d9084 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 @@ -18,7 +18,7 @@ #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" 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 efd4827b6..f48be57a3 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 @@ -16,7 +16,7 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class DLCPack; 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 f7c1ad835..135c020f9 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 @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "strings.h" 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 ee8f07798..e21e4713a 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 @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 0dd349d80..5857d64fe 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 @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #include "strings.h" 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 cd8e03fc6..e03f4eaa2 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 @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 a49b71c0e..296d44c1a 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 @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h index 84172be8b..c544dcd38 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 66c74e7e3..81fdff7c3 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 @@ -2,8 +2,8 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/ConsoleUIController.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h index 473342785..417b939d2 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h @@ -4,9 +4,9 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; 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 5c52cbf43..e78e29497 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 @@ -12,7 +12,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "platform/network/network.h" 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 9f65aceba..348534ad7 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 @@ -7,7 +7,7 @@ #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class FriendSessionInfo; 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 b6fa51cc4..e983ff248 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 @@ -12,7 +12,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h index 228865ead..ed9c2d703 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h @@ -11,11 +11,11 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 b9abd7e14..e4177b3a0 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 @@ -14,7 +14,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "app/common/Audio/SoundTypes.h" #include "minecraft/world/item/Item.h" 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 5660dc573..c3534bb47 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 @@ -7,15 +7,15 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #include "platform/storage/storage.h" #include "platform/leaderboard/leaderboard.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 c7437c20c..590695afc 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 @@ -16,7 +16,7 @@ #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" 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 cb50cb64b..1ccabe697 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 @@ -14,7 +14,7 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class DLCPack; 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 f67c7e15d..9b419a500 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 @@ -13,7 +13,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" #include "minecraft/GameEnums.h" 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 41618e4aa..3c89fa2e4 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.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 d576e4a74..0283787eb 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 @@ -16,7 +16,7 @@ #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" 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 990f35ae8..687e70d31 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 @@ -9,12 +9,12 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Random.h" class Random; 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 753e3d19c..805722248 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 @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h index 741e00729..f7490622f 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 0a0baae81..aba3cb3e9 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 @@ -6,7 +6,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h index 1e9752efc..a62ab5c40 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h @@ -6,11 +6,11 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 ec4d3efb6..6d6d771e1 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 @@ -3,7 +3,7 @@ #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameTypes.h" #include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.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 f64d02436..9765e1ea5 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/BuildVer.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h index 01a5ccd68..8a2f3f97c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h @@ -8,11 +8,11 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 08c780d9c..b8a4602df 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h index 4920654df..3ba6f6151 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h @@ -5,11 +5,11 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 afa5c4b08..897f778b4 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -5,7 +5,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h index ea34f974b..769d0dd88 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 91b10ee0a..05b239820 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "app/common/Audio/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h index f068baf2e..a04b6c215 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h @@ -6,9 +6,9 @@ #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; 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 cad506495..ac71449da 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h index a49e14d5e..e47fa6825 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 86edef6ff..d34d56dac 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -4,7 +4,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index d6e8946d4..e7913966a 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" #include "platform/network/NetTypes.h" #include "platform/XboxStubs.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 3c8640584..258808d44 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -4,7 +4,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h index 764686419..7ccb555cd 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 bee06ed79..15fb016e8 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h index 35b3cc41f..b3a5fcaf1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 9531e7de8..6a51d1e9c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h index 325fbdd9a..06752c112 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 612624c13..8a8ae7b89 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h index 967ce1aea..205dccd66 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 252388d10..48488c295 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -5,7 +5,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" 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 bd5e1eae5..87faa8070 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -5,7 +5,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 f3feb408e..98cf633f9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -11,7 +11,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "app/common/Audio/SoundTypes.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h index 5046ba223..71e67acb6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 143264327..ac43c3c69 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h index ac245c6cf..26a8a9c19 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 17291e9a0..2f241c1fa 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -14,7 +14,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/SkinBox.h" 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 6da39709a..f186e6286 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -9,12 +9,12 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/world/entity/player/SkinTypes.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 e8e8f40d0..06f2f0e32 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 @@ -13,7 +13,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" 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 5e5187797..1791c2a82 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 @@ -8,12 +8,12 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class AbstractContainerMenu; class UILayer; 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 48f0425e6..d373e7c36 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 @@ -11,10 +11,10 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/input/input.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" #include "minecraft/world/inventory/MerchantMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h index 173a4f0cb..d0f1f53a1 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h @@ -10,9 +10,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index 18ca33f99..26aaa6096 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -12,13 +12,13 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "app/common/Audio/SoundTypes.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h index d96c3ba37..001372706 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h @@ -9,9 +9,9 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.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 49b281684..2f94b1942 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 @@ -15,7 +15,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index 34c28fe3b..ad96ee171 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -12,7 +12,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h index b457fb614..b9f4aeba9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h @@ -9,9 +9,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index 1b5617952..095bee858 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -13,12 +13,12 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h index 04a880fdc..c54f491fc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h @@ -10,9 +10,9 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index 7632984c3..4e5c4e3fc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -14,7 +14,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h index b5c7548c1..d2d0c012c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h @@ -9,9 +9,9 @@ #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIScene_AbstractContainerMenu.h" #include "minecraft/world/effect/MobEffect.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 660cbfa89..2a55d0f5a 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 @@ -14,7 +14,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h index 736c01d1f..172b6c31d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h @@ -9,9 +9,9 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class InventoryMenu; 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 1e812d402..a941f5264 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h index 134f67da8..0f0f2fea9 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h @@ -10,9 +10,9 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class AbstractContainerMenu; 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 35ee1b970..a06577e42 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h index e1d9bce0c..957c007e8 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 d0a6a0f6f..5973ec0c5 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 @@ -9,7 +9,7 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h index 9d5f13c9d..b3e84ac73 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h @@ -5,11 +5,11 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 8bcf0003b..8810fe807 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 @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h index 193153e68..56cf2932b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h @@ -6,7 +6,7 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 e70348c78..1f593e443 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 @@ -10,7 +10,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" 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 aa3dce319..881c31800 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 @@ -10,7 +10,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class INetworkPlayer; 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 b24b04a03..0ac04f288 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 @@ -11,7 +11,7 @@ #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" 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 1ce577898..eca332c3a 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 @@ -9,12 +9,12 @@ #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class INetworkPlayer; class UILayer; 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 74fbd8308..2c8c5332c 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 @@ -15,7 +15,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" 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 7ec51ef6c..67a5235dc 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 @@ -6,7 +6,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 859212a35..78c10f4f8 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 @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h index 6a7c356a4..7c970c6e6 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class SignTileEntity; class UILayer; 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 761874e0a..7001ea596 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 @@ -10,7 +10,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h index a49e80444..6fd744c92 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/network/NetTypes.h" class INetworkPlayer; diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index bbecfb9b1..68f002824 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -9,7 +9,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h index 7ede9166d..77142221c 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h @@ -8,7 +8,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 123e3b2b9..5b267ba42 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -12,7 +12,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h index ad2e219c7..7fd8730cf 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h @@ -9,7 +9,7 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class C4JThread; class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index ae36113cb..e81b0e72e 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -6,7 +6,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameTypes.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.h b/targets/app/common/UI/Scenes/UIScene_Keyboard.h index 83eb9b4d6..3c1cd0e57 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.h +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.h @@ -7,11 +7,11 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 124da3915..6d232223f 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -7,7 +7,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index aaf07e0bd..7f086b4b0 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -6,12 +6,12 @@ #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index 7540fb51d..a3515f42a 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -8,7 +8,7 @@ #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h index 88f52f472..dc7a4c684 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h @@ -9,9 +9,9 @@ #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif class UILayer; diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index c6fe24590..2ba16f8d4 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -1,11 +1,11 @@ #include "UIBitmapFont.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIFontData.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "minecraft/client/BufferedImage.h" ///////////////////////////// diff --git a/targets/app/common/UI/UIBitmapFont.h b/targets/app/common/UI/UIBitmapFont.h index 48d8ed9ce..2d0baf83b 100644 --- a/targets/app/common/UI/UIBitmapFont.h +++ b/targets/app/common/UI/UIBitmapFont.h @@ -2,11 +2,11 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" struct SFontData; class CFontData; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 96b40f41d..2b6551edc 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -26,16 +26,16 @@ #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/common/UI/UITTFFont.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #include "UIFontData.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/client/BufferedImage.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 7a76de829..ade585821 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -12,9 +12,9 @@ #ifdef __linux__ -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif #elif defined(_WINDOWS64) @@ -26,7 +26,7 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index 2b8e35d65..9a9b62e7a 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -4,9 +4,9 @@ #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h index 162369f53..0cbec519c 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -3,7 +3,7 @@ #include "UILayer.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" class UIComponent_Tooltips; diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index 7033e9aef..29d82b0ee 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -75,9 +75,9 @@ #include "app/common/UI/Scenes/UIScene_Timer.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UIScene.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "platform/renderer/renderer.h" UILayer::UILayer(UIGroup* parent) { diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index 8e6d7fe5b..c5c06cb6e 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -7,7 +7,7 @@ #include #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" // using namespace std; diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index a551b2b81..f4434a368 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -11,15 +11,15 @@ #include "app/common/UI/UIController.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UILayer.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index a597b5735..72dad25a9 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -16,12 +16,12 @@ #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class ItemRenderer; class UILayer; diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index f4d29db88..aeffffb07 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -2,11 +2,11 @@ #include -#include "app/linux/Iggy/include/iggy.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY -#include "app/linux/Stubs/iggy_stubs.h" +#include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "platform/fs/fs.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/UITTFFont.h b/targets/app/common/UI/UITTFFont.h index 736ed9ba6..b5df051b6 100644 --- a/targets/app/common/UI/UITTFFont.h +++ b/targets/app/common/UI/UITTFFont.h @@ -3,7 +3,7 @@ #include #include -#include "app/linux/Iggy/include/rrCore.h" +#include "app/common/Iggy/include/rrCore.h" class UITTFFont { private: diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 03640563a..14600167c 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -86,6 +86,8 @@ common/Tutorial/Tasks/XuiCraftingTask.cpp common/Tutorial/Tutorial.cpp common/Tutorial/TutorialMessage.cpp common/Tutorial/TutorialMode.cpp +common/Iggy/gdraw/gdraw.c +common/UI/ConsoleUIController.cpp common/UI/All Platforms/ArchiveFile.cpp common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp common/UI/All Platforms/IUIScene_AnvilMenu.cpp diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/Linux_Minecraft.cpp index 1c5b93e94..b51a2c55f 100644 --- a/targets/app/linux/Linux_Minecraft.cpp +++ b/targets/app/linux/Linux_Minecraft.cpp @@ -62,7 +62,7 @@ static void sigsegv_handler(int sig) { #include "app/common/Audio/SoundEngine.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Game.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" diff --git a/targets/app/linux_sources.txt b/targets/app/linux_sources.txt index 2db425e4b..5028fdf92 100644 --- a/targets/app/linux_sources.txt +++ b/targets/app/linux_sources.txt @@ -1,3 +1 @@ -linux/Iggy/gdraw/gdraw.c linux/Linux_Minecraft.cpp -linux/Linux_UIController.cpp diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 2ab42b8fa..025965413 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -20,7 +20,7 @@ #include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/GameEnums.h" diff --git a/targets/minecraft/client/gui/CreateWorldScreen.cpp b/targets/minecraft/client/gui/CreateWorldScreen.cpp index f4f76b0af..341baec9c 100644 --- a/targets/minecraft/client/gui/CreateWorldScreen.cpp +++ b/targets/minecraft/client/gui/CreateWorldScreen.cpp @@ -19,7 +19,7 @@ // concrete type include. #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/Options.h" diff --git a/targets/minecraft/client/gui/Gui.cpp b/targets/minecraft/client/gui/Gui.cpp index 14266d9ef..e9d83a348 100644 --- a/targets/minecraft/client/gui/Gui.cpp +++ b/targets/minecraft/client/gui/Gui.cpp @@ -4,7 +4,7 @@ #include #include "Facing.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Color.h" #include "java/JavaMath.h" #include "java/Random.h" diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index c03b834fe..ea16096e3 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -19,7 +19,7 @@ #include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 0ce1edcfa..63173838c 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -33,7 +33,7 @@ #include "app/common/Audio/ConsoleSoundEngine.h" #include "platform/profile/ProfileConstants.h" #include "minecraft/world/tutorial/ITutorial.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Gui.h" diff --git a/targets/minecraft/client/skins/AbstractTexturePack.cpp b/targets/minecraft/client/skins/AbstractTexturePack.cpp index cf5e77f24..af529e6e5 100644 --- a/targets/minecraft/client/skins/AbstractTexturePack.cpp +++ b/targets/minecraft/client/skins/AbstractTexturePack.cpp @@ -5,7 +5,7 @@ #include #include -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/FileInputStream.h" diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index f5562b547..da9b38edd 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -15,7 +15,7 @@ #include "app/common/DLC/DLCTextureFile.h" #include "app/common/DLC/DLCUIDataFile.h" #include "app/common/UI/All Platforms/ArchiveFile.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" diff --git a/targets/minecraft/client/skins/TexturePackRepository.cpp b/targets/minecraft/client/skins/TexturePackRepository.cpp index bfb56647e..c04c55476 100644 --- a/targets/minecraft/client/skins/TexturePackRepository.cpp +++ b/targets/minecraft/client/skins/TexturePackRepository.cpp @@ -9,7 +9,7 @@ #include "DefaultTexturePack.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "app/linux/Linux_UIController.h" +#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" From fbac609df227f63e223638f5c84588312d141f72 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:45:51 -0500 Subject: [PATCH 066/104] rename Linux_Minecraft.cpp to main.cpp --- targets/app/linux/{Linux_Minecraft.cpp => main.cpp} | 0 targets/app/linux_sources.txt | 1 - targets/app/meson.build | 4 ++-- 3 files changed, 2 insertions(+), 3 deletions(-) rename targets/app/linux/{Linux_Minecraft.cpp => main.cpp} (100%) delete mode 100644 targets/app/linux_sources.txt diff --git a/targets/app/linux/Linux_Minecraft.cpp b/targets/app/linux/main.cpp similarity index 100% rename from targets/app/linux/Linux_Minecraft.cpp rename to targets/app/linux/main.cpp diff --git a/targets/app/linux_sources.txt b/targets/app/linux_sources.txt deleted file mode 100644 index 5028fdf92..000000000 --- a/targets/app/linux_sources.txt +++ /dev/null @@ -1 +0,0 @@ -linux/Linux_Minecraft.cpp diff --git a/targets/app/meson.build b/targets/app/meson.build index e4be7a135..717a1678e 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -1,11 +1,11 @@ -# Source lists live in common_sources.txt / linux_sources.txt and are +# Source lists live in common_sources.txt and are # regenerated by scripts/list_sources.py whenever files are added or # removed. fs = import('fs') platform_sources = files(fs.read('common_sources.txt').strip().split('\n')) if host_machine.system() == 'linux' - platform_sources += files(fs.read('linux_sources.txt').strip().split('\n')) + platform_sources += files('linux/main.cpp') endif client_dependencies = [] From 5d28fc9fd560caa379697b029216b54b8b87930e Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:45:58 -0500 Subject: [PATCH 067/104] remove unused StringHelpers --- targets/util/StringHelpers.cpp | 18 ------------------ targets/util/StringHelpers.h | 2 -- 2 files changed, 20 deletions(-) diff --git a/targets/util/StringHelpers.cpp b/targets/util/StringHelpers.cpp index e1cc331ca..7d5023d5d 100644 --- a/targets/util/StringHelpers.cpp +++ b/targets/util/StringHelpers.cpp @@ -156,24 +156,6 @@ std::u16string string_to_u16string(const std::string& converting) { return result; } -std::string wstringtofilename(const std::wstring& name) { - std::string result; - result.reserve(name.size()); - for (wchar_t c : name) { -#if defined(__linux__) - if (c == L'\\') c = L'/'; -#else - if (c == L'/') c = L'\\'; -#endif - result += static_cast(c); - } - return result; -} - -std::wstring filenametowstring(const char* name) { - return convStringToWstring(name); -} - std::vector& stringSplit(const std::string& s, char delim, std::vector& elems) { std::stringstream ss(s); diff --git a/targets/util/StringHelpers.h b/targets/util/StringHelpers.h index d672c630b..99484685c 100644 --- a/targets/util/StringHelpers.h +++ b/targets/util/StringHelpers.h @@ -37,8 +37,6 @@ std::wstring u16string_to_wstring(const std::u16string& converting); std::u16string wstring_to_u16string(const std::wstring& converting); std::u16string string_to_u16string(const std::string& converting); std::u8string wstring_to_u8string(const std::wstring& converting); -std::string wstringtofilename(const std::wstring& name); -std::wstring filenametowstring(const char* name); std::vector& stringSplit(const std::string& s, char delim, std::vector& elems); From 9e74005af7f9c2bd13d06c833d9c3ea9eace75c5 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:47:00 -0500 Subject: [PATCH 068/104] switch back to MediaWindows64 for media assets --- targets/app/common/ArchiveManager.cpp | 10 +--------- targets/resources/meson.build | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/targets/app/common/ArchiveManager.cpp b/targets/app/common/ArchiveManager.cpp index 5d023a570..ce028bb31 100644 --- a/targets/app/common/ArchiveManager.cpp +++ b/targets/app/common/ArchiveManager.cpp @@ -3,8 +3,8 @@ #include #include -#include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/Game.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" @@ -18,14 +18,9 @@ ArchiveManager::ArchiveManager() void ArchiveManager::loadMediaArchive() { std::string mediapath = ""; -#if _WINDOWS64 mediapath = "Common\\Media\\MediaWindows64.arc"; -#elif __linux__ - mediapath = "app/common/Media/MediaLinux.arc"; -#endif if (!mediapath.empty()) { -#if defined(__linux__) std::string exeDirW = PlatformFilesystem.getBasePath().string(); std::string candidate = exeDirW + File::pathSeparator + mediapath; if (File(candidate).exists()) { @@ -33,9 +28,6 @@ void ArchiveManager::loadMediaArchive() { } else { m_mediaArchive = new ArchiveFile(File(mediapath)); } -#else - m_mediaArchive = new ArchiveFile(File(mediapath)); -#endif } } diff --git a/targets/resources/meson.build b/targets/resources/meson.build index 23af3e495..847217fd7 100644 --- a/targets/resources/meson.build +++ b/targets/resources/meson.build @@ -478,7 +478,7 @@ archive_sources_psvita = [ ] media_archive = custom_target('Minecraft.Media_Archive', - output : 'MediaLinux.arc', + output : 'MediaWindows64.arc', input : archive_sources + archive_sources_movies1080 + archive_sources_movies720 + archive_sources_linux, command : [ python, meson.project_source_root() / 'scripts/pack_arc.py', From c4bbf6cf1f79d8ca3003246dc4b45c48f7b458dd Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:57:31 -0500 Subject: [PATCH 069/104] remove a bunch of linux ifdefs --- .../minecraft/server/level/TrackedEntity.cpp | 3 --- .../storage/ChunkStorageProfileDecorator.cpp | 12 ------------ .../world/level/levelgen/CustomLevelSource.cpp | 2 -- .../level/newbiome/layer/BiomeOverrideLayer.cpp | 2 -- .../level/storage/DirectoryLevelStorage.cpp | 17 ----------------- targets/minecraft/world/level/tile/Tile.cpp | 2 +- 6 files changed, 1 insertion(+), 37 deletions(-) diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index 254c7e8e1..f50c34428 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -59,9 +59,6 @@ class AttributeInstance; class MobEffectInstance; -#ifndef __linux__ -#include -#endif // __linux__ TrackedEntity::TrackedEntity(std::shared_ptr e, int range, int updateInterval, bool trackDelta) { diff --git a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp index b2292f58e..2e4230967 100644 --- a/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp +++ b/targets/minecraft/world/level/chunk/storage/ChunkStorageProfileDecorator.cpp @@ -45,29 +45,17 @@ void ChunkStorageProfilerDecorator::tick() { if (counter > 500) { if (loadCount > 0) { #if !defined(_CONTENT_PACKAGE) -#if defined(__linux__) sprintf(buf, "Average load time: %f (%lld)", 0.000001 * (double)timeSpentLoading / (double)loadCount, (long long)loadCount); -#else - sprintf(buf, "Average load time: %f (%I64d)", - 0.000001 * (double)timeSpentLoading / (double)loadCount, - loadCount); -#endif Log::info("%s", buf); #endif } if (saveCount > 0) { #if !defined(_CONTENT_PACKAGE) -#if defined(__linux__) sprintf(buf, "Average save time: %f (%lld)", 0.000001 * (double)timeSpentSaving / (double)loadCount, (long long)loadCount); -#else - sprintf(buf, "Average save time: %f (%I64d)", - 0.000001 * (double)timeSpentSaving / (double)loadCount, - loadCount); -#endif Log::info("%s", buf); #endif } diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index 71f528ed3..dc881bc4c 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -10,8 +10,6 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "platform/fs/fs.h" -#if defined(__linux__) -#endif #include "java/Random.h" #include "minecraft/world/entity/MobCategory.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index f11c6a6d7..c1788941f 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -6,8 +6,6 @@ #include "minecraft/util/Log.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "platform/fs/fs.h" -#if defined(__linux__) -#endif #include "minecraft/world/level/biome/Biome.h" BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { diff --git a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 467cd851a..99f93312c 100644 --- a/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/targets/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -280,17 +280,8 @@ LevelData* DirectoryLevelStorage::prepareLevel() { Log::info("Loading %d mappings\n", count); for (unsigned int i = 0; i < count; ++i) { PlayerUID playerUid = dis.readPlayerUID(); -#if defined(_WINDOWS64) || defined(__linux__) Log::info(" -- %llu\n", static_cast(playerUid)); -#else -#if defined(__linux__) - Log::info(" -- %llu\n", - static_cast(playerUid)); -#else - Log::info(" -- %s\n", playerUid.toWString().c_str()); -#endif -#endif m_playerMappings[playerUid].readMappings(&dis); } dis.readFully(m_usedMappings); @@ -641,16 +632,8 @@ void DirectoryLevelStorage::saveMapIdLookup() { Log::info("Saving %zu mappings\n", m_playerMappings.size()); for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); ++it) { -#if defined(_WINDOWS64) || defined(__linux__) Log::info(" -- %llu\n", static_cast(it->first)); -#else -#if defined(__linux__) - Log::info(" -- %d\n", it->first); -#else - Log::info(" -- %s\n", it->first.toWString().c_str()); -#endif -#endif dos.writePlayerUID(it->first); it->second.writeMappings(&dos); } diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 25e0dfded..81f514233 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -2737,7 +2737,7 @@ int Tile::SoundType::getPlaceSound() const { return iPlaceSound; } 4J: These are necessary on the PS3. (and 4 and Vita). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int Tile::stone_Id; const int Tile::grass_Id; const int Tile::dirt_Id; From d862d05616d94577e292ad83cab644ac2c73d236 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:59:19 -0500 Subject: [PATCH 070/104] refactor: restore `OldChunkStorage` file names using custom base36 conversion --- .../level/chunk/storage/OldChunkStorage.cpp | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 5ccd24a96..87a467c7c 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -72,6 +72,30 @@ OldChunkStorage::OldChunkStorage(File dir, bool create) { this->create = create; } +// https://cplusplus.com/forum/general/144043/ +void to_base36(int value, char* buf) { + static const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + char tmp[64]; + int i = 0; + unsigned int uval = + (value < 0) ? -(unsigned int)value : (unsigned int)value; + + if (uval == 0) { + buf[0] = '0'; + buf[1] = '\0'; + return; + } + + while (uval > 0) { + tmp[i++] = digits[uval % 36]; + uval /= 36; + } + if (value < 0) tmp[i++] = '-'; + + for (int j = 0; j < i; ++j) buf[j] = tmp[i - 1 - j]; + buf[i] = '\0'; +} + File OldChunkStorage::getFile(int x, int z) { char name[MAX_PATH_SIZE]; char path1[MAX_PATH_SIZE]; @@ -79,15 +103,13 @@ File OldChunkStorage::getFile(int x, int z) { char xRadix36[64]; char zRadix36[64]; -#if defined(__linux__) - assert(0); // need a gcc verison of _itow ? -#else - _itow(x, xRadix36, 36); - _itow(z, zRadix36, 36); + + to_base36(x, xRadix36); + to_base36(z, zRadix36); snprintf(name, MAX_PATH_SIZE, "c.%s.%s.dat", xRadix36, zRadix36); - _itow(x & 63, path1, 36); - _itow(z & 63, path2, 36); -#endif + to_base36(x & 63, path1); + to_base36(z & 63, path2); + // sprintf(file,"%s\\%s",dir,path1); File file(dir, std::string(path1)); if (!file.exists()) { From e7dca2570a5c15dd6d258c66d6bff39514711a6a Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:03:16 -0500 Subject: [PATCH 071/104] fix: remove platform ifdefs in DLCController --- targets/app/common/DLCController.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 5205beae1..1948ce660 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -7,7 +7,6 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" #include "app/common/Game.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" @@ -186,9 +185,7 @@ int DLCController::dlcMountedCallback(int iPad, std::uint32_t dwErr, void DLCController::handleDLC(DLCPack* pack) { unsigned int dwFilesProcessed = 0; -#if defined(_WINDOWS64) || defined(__linux__) std::vector dlcFilenames; -#endif PlatformStorage.GetMountedDLCFileList("DLCDrive", dlcFilenames); for (int i = 0; i < dlcFilenames.size(); i++) { app.m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], @@ -227,7 +224,6 @@ SCreditTextItemDef* DLCController::getDLCCredits(int iIndex) { return vDLCCredits.at(iIndex); } -#if defined(_WINDOWS64) int32_t DLCController::registerDLCData(char* pType, char* pBannerName, int iGender, uint64_t ullOfferID_Full, uint64_t ullOfferID_Trial, @@ -245,10 +241,10 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName, pDLCData->iConfig = iConfig; if (pBannerName != "") { - wcsncpy_s(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); + strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); } if (pDataFile[0] != 0) { - wcsncpy_s(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); + strncpy(pDLCData->wchDataFile, pDataFile, MAX_BANNERNAME_SIZE); } if (pType != nullptr) { @@ -275,19 +271,6 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName, return hr; } -#elif defined(__linux__) -int32_t DLCController::registerDLCData(char* pType, char* pBannerName, - int iGender, uint64_t ullOfferID_Full, - uint64_t ullOfferID_Trial, - char* pFirstSkin, - unsigned int uiSortIndex, int iConfig, - char* pDataFile) { - fprintf(stderr, - "warning: DLCController::registerDLCData unimplemented for " - "platform `__linux__`\n"); - return 0; -} -#endif bool DLCController::getDLCFullOfferIDForSkinID(const std::string& FirstSkin, uint64_t* pullVal) { From cf94e7d16269d2ec135f5912ba4f6aaec95069b6 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:06:13 -0500 Subject: [PATCH 072/104] remove linux-specific networking paths --- targets/java/src/File.cpp | 14 ++++------ targets/minecraft/network/Connection.cpp | 28 +++++++++---------- targets/minecraft/network/Socket.h | 4 --- .../network/packet/PlayerInfoPacket.cpp | 3 -- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 6a05e3caf..70b3caf80 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -61,7 +61,6 @@ File::File(const std::string& pathname) { if (fixedPath.find("GAME:/") == 0) fixedPath = fixedPath.substr(6); m_abstractPathName = fixedPath; -#if defined(__linux__) std::string request = std::filesystem::path(m_abstractPathName).string(); while (!request.empty() && request[0] == '/') request.erase(0, 1); if (request.find("res/") == 0) request.erase(0, 4); @@ -91,14 +90,13 @@ File::File(const std::string& pathname) { return; } } -#endif +// #ifdef _WINDOWS64 +// std::string path = std::filesystem::path(m_abstractPathName).string(); +// std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); +// if (finalPath.size() == 0) finalPath = path; +// m_abstractPathName = finalPath; +// #endif -#ifdef _WINDOWS64 - std::string path = std::filesystem::path(m_abstractPathName).string(); - std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); - if (finalPath.size() == 0) finalPath = path; - m_abstractPathName = finalPath; -#endif /* std::vector path = stringSplit( pathname, pathSeparator ); diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 583c9402f..932253177 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -200,10 +200,10 @@ bool Connection::writeTick() { } Packet::writePacket(packet, bufferedDos); -#if defined(__linux__) - bufferedDos->flush(); // Ensure buffered data reaches socket before any - // other writes -#endif +// #if defined(__linux__) +// bufferedDos->flush(); // Ensure buffered data reaches socket before any +// // other writes +// #endif #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging @@ -252,15 +252,15 @@ bool Connection::writeTick() { // write it to QNet as a single packet with priority flags Otherwise // just buffer the packet with other outgoing packets as the java game // did -#if defined(__linux__) - // Linux fix: For local connections, always use bufferedDos to avoid - // byte interleaving between the BufferedOutputStream buffer and direct - // sos writes. The shouldDelay/writeWithFlags path writes directly to - // sos, which can inject bytes BEFORE unflushed bufferedDos data. - Packet::writePacket(packet, bufferedDos); - bufferedDos->flush(); // Ensure data reaches socket immediately for - // delayed packets -#else +// #if defined(__linux__) +// // Linux fix: For local connections, always use bufferedDos to avoid +// // byte interleaving between the BufferedOutputStream buffer and direct +// // sos writes. The shouldDelay/writeWithFlags path writes directly to +// // sos, which can inject bytes BEFORE unflushed bufferedDos data. +// Packet::writePacket(packet, bufferedDos); +// bufferedDos->flush(); // Ensure data reaches socket immediately for +// // delayed packets +// #else if (packet->shouldDelay) { Packet::writePacket(packet, byteArrayDos); @@ -276,7 +276,7 @@ bool Connection::writeTick() { Packet::writePacket(packet, bufferedDos); } -#endif +// #endif #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging diff --git a/targets/minecraft/network/Socket.h b/targets/minecraft/network/Socket.h index 380e6b4e1..f0cb5b491 100644 --- a/targets/minecraft/network/Socket.h +++ b/targets/minecraft/network/Socket.h @@ -3,10 +3,6 @@ #include #include #include -#ifndef __linux__ -#include -#include -#endif #include #include diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index f86955a7e..eaa94323e 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -4,9 +4,6 @@ #include "platform/network/network.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#ifndef __linux__ -#include -#endif // __linux__ #include "PlayerInfoPacket.h" PlayerInfoPacket::PlayerInfoPacket() { From d181ed62f6a28fcd600f73c581c1d165265b960e Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:07:54 -0500 Subject: [PATCH 073/104] refactor: remove disconnect packet hack --- .../client/multiplayer/ClientConnection.cpp | 15 +-------------- targets/minecraft/client/renderer/LevelRenderer.h | 3 --- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index ea16096e3..e28f0cee7 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -1318,20 +1318,7 @@ void ClientConnection::handleTileUpdate( void ClientConnection::handleDisconnect( std::shared_ptr packet) { -#if defined(__linux__) - // Linux fix: On local host connections, ignore DisconnectPacket. The - // singleplayer internal server should never disconnect itself. If we see - // this, it's likely stream desync reading garbage data as a - // DisconnectPacket. - if (connection && connection->getSocket() && - connection->getSocket()->isLocal()) { - fprintf(stderr, - "[CONN] Ignoring DisconnectPacket on local connection " - "(reason=%d)\n", - packet->reason); - return; - } -#endif + connection->close(DisconnectPacket::eDisconnect_Kicked); done = true; diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index a2939c342..aa5baa062 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -17,9 +17,6 @@ class ItemInstance; class LivingEntity; class Player; class ResourceLocation; -#if !defined(__linux__) -#include -#endif #include #include From 8f04e231bd2f2875308e8f2f8c2a1159bc83f78b Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:23:53 -0500 Subject: [PATCH 074/104] remove most other linux ifdefs --- targets/app/common/Game.cpp | 6 --- .../app/common/Network/GameNetworkManager.h | 3 -- .../UIComponent_DebugUIMarketingGuide.cpp | 3 -- .../common/UI/Controls/UIControl_Touch.cpp | 5 +-- .../Frontend Menu screens/UIScene_Intro.cpp | 2 - .../Scenes/Help & Options/UIScene_Credits.h | 2 - targets/app/common/UI/UIController.cpp | 23 ++++------ targets/app/common/UI/UIController.h | 7 ---- targets/app/common_sources.txt | 1 - targets/minecraft/client/gui/Minimap.cpp | 8 ++-- .../client/renderer/GameRenderer.cpp | 42 +++++++++---------- .../client/renderer/ItemInHandRenderer.cpp | 7 ++-- .../minecraft/client/renderer/Tesselator.cpp | 6 +-- .../network/packet/RemoveEntitiesPacket.cpp | 2 +- targets/minecraft/world/item/Item.cpp | 2 +- 15 files changed, 43 insertions(+), 76 deletions(-) diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index c04daa4aa..e0a5d5d98 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -521,12 +521,6 @@ int32_t Game::RegisterConfigValues(char* pType, int iValue) { return hr; } -#if defined(_WINDOWS64) -#elif defined(__linux__) -#else - -#endif - // DLC // AUTOSAVE diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 02a7a30af..240a55a15 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -4,9 +4,6 @@ #include #include #include -#if !defined(__linux__) -#include -#endif #include "minecraft/network/INetworkService.h" #include "platform/C4JThread.h" #include "platform/network/NetTypes.h" diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp index a3c966828..d57d95314 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp @@ -19,9 +19,6 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide( IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; value[0].number = (F64)0; // WIN64 -#if defined(_WINDOWS64) || defined(__linux__) - value[0].number = (F64)0; -#endif IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetPlatform, 1, value); diff --git a/targets/app/common/UI/Controls/UIControl_Touch.cpp b/targets/app/common/UI/Controls/UIControl_Touch.cpp index 05993b64f..27ac76b77 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.cpp +++ b/targets/app/common/UI/Controls/UIControl_Touch.cpp @@ -1,8 +1,9 @@ #include "UIControl_Touch.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/ConsoleUIController.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif @@ -20,7 +21,6 @@ bool UIControl_Touch::setupControl(UIScene* scene, IggyValuePath* parent, void UIControl_Touch::init(int iId) { m_id = iId; -#if !defined(__linux__) switch (m_parentScene->GetParentLayer()->m_iLayer) { case eUILayer_Error: case eUILayer_Fullscreen: @@ -29,7 +29,6 @@ void UIControl_Touch::init(int iId) { ui.TouchBoxAdd(this, m_parentScene); break; } -#endif } void UIControl_Touch::ReInit() { 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 81fdff7c3..1f3fbff69 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 @@ -25,9 +25,7 @@ UIScene_Intro::UIScene_Intro(int iPad, void* initData, UILayer* parentLayer) bool bChina = false; // 4J Stu - These map to values in the Actionscript -#if defined(_WINDOWS64) || defined(__linux__) int platformIdx = 0; -#endif IggyDataValue result; IggyDataValue value[3]; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h index 3ba6f6151..c70a3724e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h @@ -21,10 +21,8 @@ class UILayer; #define DYNAMODE_FONT_CREDITS_COUNT 2 #define PS3_DOLBY_CREDIT 4 -#if defined(_WINDOWS64) || defined(__linux__) #define MAX_CREDIT_STRINGS \ (XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT) -#endif class UIScene_Credits : public UIScene { private: diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 2b6551edc..0e8f16a1e 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -213,7 +213,7 @@ UIController::UIController() { // 4J Stu - This is a bit of a hack until we change the Minecraft // initialisation to store the proper screen size for other platforms -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 m_fScreenWidth = 1920.0f; m_fScreenHeight = 1080.0f; m_bScreenWidthSetup = true; @@ -498,7 +498,7 @@ void UIController::tick() { void UIController::loadSkins() { std::string platformSkinPath = ""; -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 if (m_fScreenHeight == 1080.0f) { platformSkinPath = "skinHDWin.swf"; } else { @@ -514,7 +514,7 @@ void UIController::loadSkins() { loadSkin(platformSkinPath, "platformskin.swf"); } -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 #if defined(_WINDOWS64) // 4J Stu - Load the 720/480 skins so that we have something to fallback on @@ -616,7 +616,7 @@ void UIController::ReloadSkin() { m_iggyLibraries[i] = IGGY_INVALID_LIBRARY; } -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 // 4J Stu - Don't load on a thread on windows. I haven't investigated this // in detail, so a quick fix reloadSkinThreadProc(this); @@ -668,7 +668,7 @@ int UIController::reloadSkinThreadProc(void* lpParam) { // 4J Stu - Don't do this on windows, as we never navigated forwards to // start with -#if !(defined(_WINDOWS64) || defined(__linux__)) +#if 0 controller->NavigateBack(0, false, eUIScene_COUNT, eUILayer_Tooltips); #endif } @@ -969,13 +969,8 @@ void UIController::setupCustomDrawGameState() { m_customRenderingClearRect.top = LONG_MAX; m_customRenderingClearRect.bottom = LONG_MIN; -#if defined(_WINDOWS64) - PlatformRenderer.StartFrame(); - gdraw_D3D11_setViewport_4J(); -#elif defined(__linux__) PlatformRenderer.StartFrame(); -#endif PlatformRenderer.Set_matrixDirty(); // 4J Stu - We don't need to clear this here as iggy hasn't written anything @@ -1059,11 +1054,7 @@ void UIController::setupCustomDrawGameStateAndMatrices( } void UIController::endCustomDrawGameState() { -#if defined(__linux__) PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT); -#else - PlatformRenderer.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); -#endif // glClear(GL_DEPTH_BUFFER_BIT); glDepthMask(false); glDisable(GL_ALPHA_TEST); @@ -2257,7 +2248,7 @@ UIController::RequestContentRestrictedMessageBox( } if (message == -1) { -#if defined(_WINDOWS64) || defined(__linux__) +#if 1 // IDS_CONTENT_RESTRICTION doesn't exist on XB1 message = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE; #else @@ -2283,7 +2274,7 @@ void UIController::setFontCachingCalculationBuffer(int length) { draw call is not large enough, Iggy will crash or otherwise behave incorrectly. */ -#if defined(_WIN64) || defined(__linux__) +#if INTPTR_MAX == INT64_MAX static const int CHAR_SIZE = 24; #else static const int CHAR_SIZE = 16; diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index ade585821..3843b63e8 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -10,17 +10,10 @@ #include "util/Timer.h" -#ifdef __linux__ - #include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif - -#elif defined(_WINDOWS64) -#include "app/windows/Iggy/include/iggy.h" -#endif - #include "UIGroup.h" #include "app/common/UI/All Platforms/IUIController.h" #include "app/common/UI/All Platforms/UIEnums.h" diff --git a/targets/app/common_sources.txt b/targets/app/common_sources.txt index 14600167c..3af0cf590 100644 --- a/targets/app/common_sources.txt +++ b/targets/app/common_sources.txt @@ -143,7 +143,6 @@ common/UI/Controls/UIControl_SlotList.cpp common/UI/Controls/UIControl_SpaceIndicatorBar.cpp common/UI/Controls/UIControl_TextInput.cpp common/UI/Controls/UIControl_TexturePackList.cpp -common/UI/Controls/UIControl_Touch.cpp common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp common/UI/Scenes/Debug/UIScene_DebugOptions.cpp common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index ca4374ca5..b34f818fa 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -71,11 +71,11 @@ void Minimap::reloadColours() { int b = ((color) & 0xff) * br / 255; // 4J - changed byte order to save having to reorder later -#if defined(_WIN64) || __linux__ +// #if defined(_WIN64) || __linux__ LUT[i] = 255 << 24 | b << 16 | g << 8 | r; -#else - LUT[i] = r << 24 | g << 16 | b << 8 | 255; -#endif +// #else +// LUT[i] = r << 24 | g << 16 | b << 8 | 255; +// #endif // pixels[i] = (255) << 24 | r << 16 | g << 8 | b; } diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index faea5c8b6..1d50d5887 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -802,25 +802,25 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J - change brought forward from 1.8.2 void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO FRAME_PROFILE_SCOPE(Lightmap); -#if defined(__linux__) + + // 4jcraft if (SharedConstants::TEXTURE_LIGHTING) { PlatformRenderer.TextureBindVertex(-1); } -#else - // 4jcraft: manually handle this in order to ensure that the light layer is - // turned off correctly - if (SharedConstants::TEXTURE_LIGHTING) { - glClientActiveTexture(GL_TEXTURE1); - glActiveTexture(GL_TEXTURE1); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glDisable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, 0); - glClientActiveTexture(GL_TEXTURE0); - glActiveTexture(GL_TEXTURE0); - } -#endif + + // // 4jcraft: manually handle this in order to ensure that the light layer is + // // turned off correctly + // if (SharedConstants::TEXTURE_LIGHTING) { + // glClientActiveTexture(GL_TEXTURE1); + // glActiveTexture(GL_TEXTURE1); + // glMatrixMode(GL_TEXTURE); + // glLoadIdentity(); + // glMatrixMode(GL_MODELVIEW); + // glDisable(GL_TEXTURE_2D); + // glBindTexture(GL_TEXTURE_2D, 0); + // glClientActiveTexture(GL_TEXTURE0); + // glActiveTexture(GL_TEXTURE0); + // } } // 4J - change brought forward from 1.8.2 @@ -828,7 +828,7 @@ void GameRenderer::turnOnLightLayer( double alpha, bool scaleLight) { // 4jcraft: added scaleLight for entity lighting FRAME_PROFILE_SCOPE(Lightmap); -#if defined(__linux__) +#if 1 if (!SharedConstants::TEXTURE_LIGHTING) return; const int textureId = getLightTexture(mc->player->GetXboxPad(), mc->level); @@ -988,11 +988,11 @@ void GameRenderer::updateLightTexture(float a) { int g = (int)(_g * 255); int b = (int)(_b * 255); -#if defined(_WIN64) || __linux__ +// #if defined(_WIN64) || __linux__ lightPixels[j][i] = alpha << 24 | b << 16 | g << 8 | r; -#else - lightPixels[j][i] = r << 24 | g << 16 | b << 8 | alpha; -#endif +// #else +// lightPixels[j][i] = r << 24 | g << 16 | b << 8 | alpha; +// #endif } mc->textures->replaceTextureDirect(lightPixels[j], 16, 16, diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 3bdeecbc1..139b65d61 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -460,14 +460,15 @@ void ItemInHandRenderer::render(float a) { std::floor(player->z), 0); int u = col % 65536; int v = col / 65536; -#if defined(__linux__) + + // 4jcraft static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - Log::info("[linux-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, + Log::info("[4jcraft-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, u, v); } -#endif + glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); glColor4f(1, 1, 1, 1); } diff --git a/targets/minecraft/client/renderer/Tesselator.cpp b/targets/minecraft/client/renderer/Tesselator.cpp index 0d1e7bff0..f851e13b0 100644 --- a/targets/minecraft/client/renderer/Tesselator.cpp +++ b/targets/minecraft/client/renderer/Tesselator.cpp @@ -412,7 +412,7 @@ typedef unsigned short hfloat; extern hfloat convertFloatToHFloat(float f); extern float convertHFloatToFloat(hfloat hf); -#if defined(__linux__) +#if 1 namespace { void packLinuxLightmapCoords(int tex2, std::int16_t& u, std::int16_t& v) { u = static_cast(tex2 & 0xffff); @@ -469,7 +469,7 @@ void Tesselator::vertex(float x, float y, float z) { pShortData[5] = (((int)(v * 8192.0f)) & 0xffff); std::int16_t u2 = static_cast(_tex2 & 0xffff); std::int16_t v2 = static_cast((_tex2 >> 16) & 0xffff); -#if defined(__linux__) +#if 1 packLinuxLightmapCoords(_tex2, u2, v2); logLinuxPackedLightmapCoords("compact", _tex2, u2, v2); #endif @@ -524,7 +524,7 @@ void Tesselator::vertex(float x, float y, float z) { } if (hasTexture2) { // 4jcraft: we will be lighting the blocks right in here -#if defined(__linux__) +#if 1 std::int16_t tex2U; std::int16_t tex2V; packLinuxLightmapCoords(_tex2, tex2U, tex2V); diff --git a/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp b/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp index 54a648628..50a4c2a07 100644 --- a/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp +++ b/targets/minecraft/network/packet/RemoveEntitiesPacket.cpp @@ -38,6 +38,6 @@ int RemoveEntitiesPacket::getEstimatedSize() { return 1 + (ids.size() * 4); } 4J: These are necesary on the PS3. (and 4). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int RemoveEntitiesPacket::MAX_PER_PACKET; #endif diff --git a/targets/minecraft/world/item/Item.cpp b/targets/minecraft/world/item/Item.cpp index 74e7200ce..e7575f12d 100644 --- a/targets/minecraft/world/item/Item.cpp +++ b/targets/minecraft/world/item/Item.cpp @@ -1712,7 +1712,7 @@ attrAttrModMap* Item::getDefaultAttributeModifiers() { 4J: These are necesary on the PS3. (and 4 and Vita). */ -#if (0 || 0 || 0 || defined __linux__) +#if 1 const int Item::shovel_iron_Id; const int Item::pickAxe_iron_Id; const int Item::hatchet_iron_Id; From daf56bc296ed61dfd305151e9936e3a0251a2b8e Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:30:51 -0500 Subject: [PATCH 075/104] nuke old Miles SoundEngine, more ifdef removal --- targets/app/common/Audio/SoundEngine.cpp | 1057 ----------------- targets/app/common/Audio/SoundEngine.h | 2 - .../app/common/GameRules/GameRuleManager.cpp | 4 +- targets/minecraft/client/Minecraft.cpp | 4 +- targets/platform/stubs.h | 142 +-- 5 files changed, 7 insertions(+), 1202 deletions(-) diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index c782ae6de..7b769ffad 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -24,7 +24,6 @@ #include "platform/PlatformTypes.h" #include "platform/fs/fs.h" -#if defined(__linux__) #define STB_VORBIS_HEADER_ONLY #include "stb_vorbis.c" @@ -55,10 +54,6 @@ int strcasecmp(const char* a, const char* b) { #undef R #undef TRUE #undef FALSE -#endif -#if defined(_WINDOWS64) -#include "app/windows/WindowsGame.h" -#endif // ASSETS const char* SoundEngine::m_szStreamFileA[eStream_Max] = {"calm1", @@ -101,21 +96,13 @@ const char* SoundEngine::m_szStreamFileA[eStream_Max] = {"calm1", "strad", "ward", "where_are_we_now"}; -#if defined(__linux__) char SoundEngine::m_szSoundPath[] = {"app/common/Sound/"}; char SoundEngine::m_szMusicPath[] = {"app/common/"}; char SoundEngine::m_szRedistName[] = {"redist64"}; -#endif -#if defined(_WINDOWS64) -char SoundEngine::m_szSoundPath[] = {"Durango\\Sound\\"}; -char SoundEngine::m_szMusicPath[] = {"music\\"}; -char SoundEngine::m_szRedistName[] = {"redist64"}; -#endif // END ASSETS // Linux specific functions -#if defined(__linux__) // PIMPL'd state for the miniaudio backend. Defined here so SoundEngine.h // stays free of miniaudio.h. @@ -805,1050 +792,6 @@ void SoundEngine::tick(std::shared_ptr* players, float a) { m_validListenerCount = listenerCount; updateMiniAudio(); } -// Classic sound module -#else -void SoundEngine::init(Options* pOptions) { - app.DebugPrintf("---SoundEngine::init\n"); -#if defined(__DISABLE_MILES__) - return; -#endif - - char* redistpath; - -#if defined(_WINDOWS64) - redistpath = AIL_set_redist_directory(m_szRedistName); -#endif - - app.DebugPrintf("---SoundEngine::init - AIL_startup\n"); - S32 ret = AIL_startup(); - - int iNumberOfChannels = initAudioHardware(8); - - // Create a driver to render our audio - 44khz, 16 bit, - m_hDriver = AIL_open_digital_driver(44100, 16, MSS_MC_USE_SYSTEM_CONFIG, 0); - if (m_hDriver == 0) { - app.DebugPrintf("Couldn't open digital sound driver. (%s)\n", - AIL_last_error()); - AIL_shutdown(); - return; - } - app.DebugPrintf("---SoundEngine::init - driver opened\n"); - - AIL_set_event_error_callback(ErrorCallback); - - AIL_set_3D_rolloff_factor(m_hDriver, 1.0); - - // Create an event system tied to that driver - let Miles choose memory - // defaults. - // if (AIL_startup_event_system(m_hDriver, 0, 0, 0) == 0) - // 4J-PB - Durango complains that the default memory (64k)isn't enough - // Error: MilesEvent: Out of event system memory (pool passed to event - // system startup exhausted). AP - increased command buffer from the default - // 5K to 20K for Vita - - if (AIL_startup_event_system(m_hDriver, 1024 * 20, 0, 1024 * 128) == 0) { - app.DebugPrintf("Couldn't init event system (%s).\n", AIL_last_error()); - AIL_close_digital_driver(m_hDriver); - AIL_shutdown(); - app.DebugPrintf( - "---SoundEngine::init - AIL_startup_event_system failed\n"); - return; - } - char szBankName[255]; - strcpy((char*)szBankName, m_szSoundPath); - - strcat((char*)szBankName, "Minecraft.msscmp"); - - m_hBank = AIL_add_soundbank(szBankName, 0); - - if (m_hBank == nullptr) { - char* Error = AIL_last_error(); - app.DebugPrintf("Couldn't open soundbank: %s (%s)\n", szBankName, - Error); - AIL_close_digital_driver(m_hDriver); - AIL_shutdown(); - return; - } - - // #ifdef _DEBUG - HMSSENUM token = MSS_FIRST; - char const* Events[1] = {0}; - S32 EventCount = 0; - while (AIL_enumerate_events(m_hBank, &token, 0, &Events[0])) { - app.DebugPrintf(4, "%d - %s\n", EventCount, Events[0]); - - EventCount++; - } - // #endif - - U64 u64Result; - u64Result = AIL_enqueue_event_by_name("Minecraft/CacheSounds"); - - m_MasterMusicVolume = 1.0f; - m_MasterEffectsVolume = 1.0f; - - // AIL_set_variable_float(0,"UserEffectVol",1); - - m_bSystemMusicPlaying = false; - - m_openStreamThread = nullptr; -} - -// AP - moved to a separate function so it can be called from the mixer callback -// on Vita -void SoundEngine::updateMiles() { - if (m_validListenerCount == 1) { - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - // set the listener as the first player we find - if (m_ListenerA[i].bValid) { - AIL_set_listener_3D_position( - m_hDriver, m_ListenerA[i].vPosition.x, - m_ListenerA[i].vPosition.y, - -m_ListenerA[i] - .vPosition.z); // Flipped sign of z as Miles is - // expecting left handed coord system - AIL_set_listener_3D_orientation( - m_hDriver, -m_ListenerA[i].vOrientFront.x, - m_ListenerA[i].vOrientFront.y, - m_ListenerA[i].vOrientFront.z, 0, 1, - 0); // Flipped sign of z as Miles is expecting left handed - // coord system - break; - } - } - } else { - // 4J-PB - special case for splitscreen - // the shortest distance between any listener and a sound will be used - // to play a sound a set distance away down the z axis. The listener - // position will be set to 0,0,0, and the orientation will be facing - // down the z axis - - AIL_set_listener_3D_position(m_hDriver, 0, 0, 0); - AIL_set_listener_3D_orientation(m_hDriver, 0, 0, 1, 0, 1, 0); - } - - AIL_begin_event_queue_processing(); - - // Iterate over the sounds - S32 StartedCount = 0, CompletedCount = 0, TotalCount = 0; - HMSSENUM token = MSS_FIRST; - MILESEVENTSOUNDINFO SoundInfo; - int Playing = 0; - while (AIL_enumerate_sound_instances(0, &token, 0, 0, 0, &SoundInfo)) { - AUDIO_INFO* game_data = (AUDIO_INFO*)(SoundInfo.UserBuffer); - - if (SoundInfo.Status == MILESEVENT_SOUND_STATUS_PLAYING) { - Playing += 1; - } - - if (SoundInfo.Status != MILESEVENT_SOUND_STATUS_COMPLETE) { - // apply the master volume - // watch for the 'special' volume levels - bool isThunder = false; - if (game_data->volume == 10000.0f) { - isThunder = true; - } - if (game_data->volume > 1) { - game_data->volume = 1; - } - AIL_set_sample_volume_levels( - SoundInfo.Sample, game_data->volume * m_MasterEffectsVolume, - game_data->volume * m_MasterEffectsVolume); - - float distanceScaler = 16.0f; - switch (SoundInfo.Status) { - case MILESEVENT_SOUND_STATUS_PENDING: - // 4J-PB - causes the falloff to be calculated on the PPU - // instead of the SPU, and seems to resolve our distorted - // sound issue - AIL_register_falloff_function_callback( - SoundInfo.Sample, &custom_falloff_function); - - if (game_data->bIs3D) { - AIL_set_sample_is_3D(SoundInfo.Sample, 1); - - int iSound = game_data->iSound - eSFX_MAX; - switch (iSound) { - // Is this the Dragon? - case eSoundType_MOB_ENDERDRAGON_GROWL: - case eSoundType_MOB_ENDERDRAGON_MOVE: - case eSoundType_MOB_ENDERDRAGON_END: - case eSoundType_MOB_ENDERDRAGON_HIT: - distanceScaler = 100.0f; - break; - case eSoundType_FIREWORKS_BLAST: - case eSoundType_FIREWORKS_BLAST_FAR: - case eSoundType_FIREWORKS_LARGE_BLAST: - case eSoundType_FIREWORKS_LARGE_BLAST_FAR: - distanceScaler = 100.0f; - break; - case eSoundType_MOB_GHAST_MOAN: - case eSoundType_MOB_GHAST_SCREAM: - case eSoundType_MOB_GHAST_DEATH: - case eSoundType_MOB_GHAST_CHARGE: - case eSoundType_MOB_GHAST_FIREBALL: - distanceScaler = 30.0f; - break; - } - - // Set a special distance scaler for thunder, which we - // respond to by having no attenutation - if (isThunder) { - distanceScaler = 10000.0f; - } - } else { - AIL_set_sample_is_3D(SoundInfo.Sample, 0); - } - - AIL_set_sample_3D_distances(SoundInfo.Sample, - distanceScaler, 1, 0); - // set the pitch - if (!game_data->bUseSoundsPitchVal) { - AIL_set_sample_playback_rate_factor(SoundInfo.Sample, - game_data->pitch); - } - - if (game_data->bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to - // the nearest listener - use Manhattan Distance as - // the decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - game_data->x); - y = fabs(m_ListenerA[i].vPosition.y - - game_data->y); - z = fabs(m_ListenerA[i].vPosition.z - - game_data->z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so - // floats rather than casts to doubles should be - // fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(SoundInfo.Sample, 0, 0, - fDist); - - // app.DebugPrintf("Playing sound %d %f from nearest - // listener - // [%d]\n",SoundInfo.EventID,fDist,iClosestListener); - } else { - AIL_set_sample_3D_position( - SoundInfo.Sample, game_data->x, game_data->y, - -game_data->z); // Flipped sign of z as Miles - // is expecting left handed - // coord system - } - } - break; - - default: - if (game_data->bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to - // the nearest listener - use Manhattan Distance as - // the decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - game_data->x); - y = fabs(m_ListenerA[i].vPosition.y - - game_data->y); - z = fabs(m_ListenerA[i].vPosition.z - - game_data->z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - // our distances in the world aren't very big, so - // floats rather than casts to doubles should be - // fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(SoundInfo.Sample, 0, 0, - fDist); - - // app.DebugPrintf("Playing sound %d %f from nearest - // listener - // [%d]\n",SoundInfo.EventID,fDist,iClosestListener); - } else { - AIL_set_sample_3D_position( - SoundInfo.Sample, game_data->x, game_data->y, - -game_data->z); // Flipped sign of z as Miles - // is expecting left handed - // coord system - } - } - break; - } - } - } - AIL_complete_event_queue_processing(); -} - -// #define DISTORTION_TEST -#if defined(DISTORTION_TEST) -static float fVal = 0.0f; -#endif -///////////////////////////////////////////// -// -// tick -// -///////////////////////////////////////////// - -void SoundEngine::tick(std::shared_ptr* players, float a) { -#if defined(__DISABLE_MILES__) - return; -#endif - - // update the listener positions - int listenerCount = 0; -#if defined(DISTORTION_TEST) - float fX, fY, fZ; -#endif - if (players) { - bool bListenerPostionSet = false; - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (players[i] != nullptr) { - m_ListenerA[i].bValid = true; - F32 x, y, z; - x = players[i]->xo + (players[i]->x - players[i]->xo) * a; - y = players[i]->yo + (players[i]->y - players[i]->yo) * a; - z = players[i]->zo + (players[i]->z - players[i]->zo) * a; - - float yRot = players[i]->yRotO + - (players[i]->yRot - players[i]->yRotO) * a; - float yCos = - (float)cos(-yRot * Mth::DEG_TO_RAD - std::numbers::pi); - float ySin = - (float)sin(-yRot * Mth::DEG_TO_RAD - std::numbers::pi); - - // store the listener positions for splitscreen - m_ListenerA[i].vPosition.x = x; - m_ListenerA[i].vPosition.y = y; - m_ListenerA[i].vPosition.z = z; - - m_ListenerA[i].vOrientFront.x = ySin; - m_ListenerA[i].vOrientFront.y = 0; - m_ListenerA[i].vOrientFront.z = yCos; - - listenerCount++; - } else { - m_ListenerA[i].bValid = false; - } - } - } - - // If there were no valid players set, make up a default listener - if (listenerCount == 0) { - m_ListenerA[0].vPosition.x = 0; - m_ListenerA[0].vPosition.y = 0; - m_ListenerA[0].vPosition.z = 0; - m_ListenerA[0].vOrientFront.x = 0; - m_ListenerA[0].vOrientFront.y = 0; - m_ListenerA[0].vOrientFront.z = 1.0f; - listenerCount++; - } - m_validListenerCount = listenerCount; - - updateMiles(); -} -SoundEngine::SoundEngine() { - random = new Random(); - m_hStream = 0; - m_StreamState = eMusicStreamState_Idle; - m_iMusicDelay = 0; - m_validListenerCount = 0; - - m_bHeardTrackA = nullptr; - - // Start the streaming music playing some music from the overworld - SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3, - eStream_Nether1, eStream_Nether4, eStream_end_dragon, - eStream_end_end, eStream_CD_1); - - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - - m_StreamingAudioInfo.bIs3D = false; - m_StreamingAudioInfo.x = 0; - m_StreamingAudioInfo.y = 0; - m_StreamingAudioInfo.z = 0; - m_StreamingAudioInfo.volume = 1; - m_StreamingAudioInfo.pitch = 1; - - memset(CurrentSoundsPlaying, 0, sizeof(int) * (eSoundType_MAX + eSFX_MAX)); - memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT); -} - -void SoundEngine::destroy() {} -#if defined(_DEBUG) -void SoundEngine::GetSoundName(char* szSoundName, int iSound) { - strcpy((char*)szSoundName, "Minecraft/"); - std::string name = wchSoundNames[iSound]; - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); -} -#endif -///////////////////////////////////////////// -// -// play -// -///////////////////////////////////////////// -void SoundEngine::play(int iSound, float x, float y, float z, float volume, - float pitch) { - U8 szSoundName[256]; - - if (iSound == -1) { - app.DebugPrintf(6, "PlaySound with sound of -1 !!!!!!!!!!!!!!!\n"); - return; - } - - // AP removed old counting system. Now relying on Miles' Play Count Limit - /* // if we are already playing loads of this sounds ignore this one - if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) - { - // std::string name = wchSoundNames[iSound]; - // char *SoundName = (char *)ConvertSoundPathToName(name); - // app.DebugPrintf("Too many %s sounds playing!\n",SoundName); - return; - }*/ - - // if (iSound != eSoundType_MOB_IRONGOLEM_WALK) return; - - // build the name - strcpy((char*)szSoundName, "Minecraft/"); - -#if defined(DISTORTION_TEST) - std::string name = wchSoundNames[eSoundType_MOB_ENDERDRAGON_GROWL]; -#else - std::string name = wchSoundNames[iSound]; -#endif - - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); - - // app.DebugPrintf(6,"PlaySound - %d - %s - %s (%f %f %f, vol %f, pitch - //%f)\n",iSound, SoundName, szSoundName,x,y,z,volume,pitch); - - AUDIO_INFO AudioInfo; - AudioInfo.x = x; - AudioInfo.y = y; - AudioInfo.z = z; - AudioInfo.volume = volume; - AudioInfo.pitch = pitch; - AudioInfo.bIs3D = true; - AudioInfo.bUseSoundsPitchVal = false; - AudioInfo.iSound = iSound + eSFX_MAX; -#if defined(_DEBUG) - strncpy(AudioInfo.chName, (char*)szSoundName, 64); -#endif - - S32 token = AIL_enqueue_event_start(); - AIL_enqueue_event_buffer(&token, &AudioInfo, sizeof(AUDIO_INFO), 0); - AIL_enqueue_event_end_named(token, (char*)szSoundName); -} - -///////////////////////////////////////////// -// -// playUI -// -///////////////////////////////////////////// -void SoundEngine::playUI(int iSound, float volume, float pitch) { - U8 szSoundName[256]; - std::string name; - // we have some game sounds played as UI sounds... - // Not the best way to do this, but it seems to only be the portal sounds - - if (iSound >= eSFX_MAX) { - // AP removed old counting system. Now relying on Miles' Play Count - // Limit - /* // if we are already playing loads of this sounds ignore - this one - if(CurrentSoundsPlaying[iSound+eSFX_MAX]>MAX_SAME_SOUNDS_PLAYING) - return;*/ - - // build the name - strcpy((char*)szSoundName, "Minecraft/"); - name = wchSoundNames[iSound]; - } else { - // AP removed old counting system. Now relying on Miles' Play Count - // Limit - /* // if we are already playing loads of this sounds ignore - this one if(CurrentSoundsPlaying[iSound]>MAX_SAME_SOUNDS_PLAYING) - return;*/ - - // build the name - strcpy((char*)szSoundName, "Minecraft/UI/"); - name = wchUISoundNames[iSound]; - } - - char* SoundName = (char*)ConvertSoundPathToName(name); - strcat((char*)szSoundName, SoundName); - // app.DebugPrintf("UI: Playing %s, volume %f, pitch - //%f\n",SoundName,volume,pitch); - - // app.DebugPrintf("PlaySound - %d - %s\n",iSound, SoundName); - - AUDIO_INFO AudioInfo; - memset(&AudioInfo, 0, sizeof(AUDIO_INFO)); - AudioInfo.volume = volume; // will be multiplied by the master volume - AudioInfo.pitch = pitch; - AudioInfo.bUseSoundsPitchVal = true; - if (iSound >= eSFX_MAX) { - AudioInfo.iSound = iSound + eSFX_MAX; - } else { - AudioInfo.iSound = iSound; - } -#if defined(_DEBUG) - strncpy(AudioInfo.chName, (char*)szSoundName, 64); -#endif - - // 4J-PB - not going to stop UI events happening based on the number of - // currently playing sounds - S32 token = AIL_enqueue_event_start(); - AIL_enqueue_event_buffer(&token, &AudioInfo, sizeof(AUDIO_INFO), 0); - AIL_enqueue_event_end_named(token, (char*)szSoundName); -} -///////////////////////////////////////////// -// -// playStreaming -// -///////////////////////////////////////////// -void SoundEngine::playStreaming(const std::string& name, float x, float y, - float z, float volume, float pitch, - bool bMusicDelay) { - // This function doesn't actually play a streaming sound, just sets states - // and an id for the music tick to play it Level audio will be played when a - // play with an empty name comes in CD audio will be played when a named - // stream comes in - - m_StreamingAudioInfo.x = x; - m_StreamingAudioInfo.y = y; - m_StreamingAudioInfo.z = z; - m_StreamingAudioInfo.volume = volume; - m_StreamingAudioInfo.pitch = pitch; - - if (m_StreamState == eMusicStreamState_Playing) { - m_StreamState = eMusicStreamState_Stop; - } else if (m_StreamState == eMusicStreamState_Opening) { - m_StreamState = eMusicStreamState_OpeningCancel; - } - - if (name.empty()) { - // music, or stop CD - m_StreamingAudioInfo.bIs3D = false; - - // we need a music id - // random delay of up to 3 minutes for music - m_iMusicDelay = random->nextInt( - 20 * 60 * 3); // random->nextInt(20 * 60 * 10) + 20 * 60 * 10; - -#if defined(_DEBUG) - m_iMusicDelay = 0; -#endif - Minecraft* pMinecraft = Minecraft::GetInstance(); - - bool playerInEnd = false; - bool playerInNether = false; - - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - if (playerInEnd) { - m_musicID = getMusicID(LevelData::DIMENSION_END); - } else if (playerInNether) { - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - } else { - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - } - } else { - // jukebox - m_StreamingAudioInfo.bIs3D = true; - m_musicID = getMusicID(name); - m_iMusicDelay = 0; - } -} -int SoundEngine::OpenStreamThreadProc(void* lpParameter) { -#if defined(__DISABLE_MILES__) - return 0; -#endif - SoundEngine* soundEngine = (SoundEngine*)lpParameter; - soundEngine->m_hStream = - AIL_open_stream(soundEngine->m_hDriver, soundEngine->m_szStreamName, 0); - return 0; -} -///////////////////////////////////////////// -// -// playMusicTick -// -///////////////////////////////////////////// -void SoundEngine::playMusicTick() { - // AP - vita will update the music during the mixer callback - playMusicUpdate(); -} - -// AP - moved to a separate function so it can be called from the mixer callback -// on Vita -void SoundEngine::playMusicUpdate() { - // return; - static bool firstCall = true; - static float fMusicVol = 0.0f; - if (firstCall) { - fMusicVol = getMasterMusicVolume(); - firstCall = false; - } - - switch (m_StreamState) { - case eMusicStreamState_Idle: - - // start a stream playing - if (m_iMusicDelay > 0) { - m_iMusicDelay--; - return; - } - - if (m_musicID != -1) { - // start playing it - - strcpy((char*)m_szStreamName, m_szMusicPath); - // are we using a mash-up pack? - // if(pMinecraft && !pMinecraft->skins->isUsingDefaultSkin() && - // pMinecraft->skins->getSelected()->hasAudio()) - if (Minecraft::GetInstance() - ->skins->getSelected() - ->hasAudio()) { - // It's a mash-up - need to use the DLC path for the music - TexturePack* pTexPack = - Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack* pDLCTexPack = (DLCTexturePack*)pTexPack; - DLCPack* pack = pDLCTexPack->getDLCInfoParentPack(); - DLCAudioFile* dlcAudioFile = (DLCAudioFile*)pack->getFile( - DLCManager::e_DLCType_Audio, 0); - - app.DebugPrintf("Mashup pack \n"); - - // build the name - - // if the music ID is beyond the end of the texture pack - // music files, then it's a CD - if (m_musicID < m_iStream_CD_1) { - SetIsPlayingStreamingGameMusic(true); - SetIsPlayingStreamingCDMusic(false); - m_MusicType = eMusicType_Game; - m_StreamingAudioInfo.bIs3D = false; - - std::string& wstrSoundName = - dlcAudioFile->GetSoundName(m_musicID); - char szName[255]; - strncpy(szName, wstrSoundName.c_str(), 255); - - std::string strFile = - "TPACK:\\Data\\" + string(szName) + ".binka"; - std::string mountedPath = - PlatformStorage.GetMountedPath(strFile); - strcpy(m_szStreamName, mountedPath.c_str()); - } else { - SetIsPlayingStreamingGameMusic(false); - SetIsPlayingStreamingCDMusic(true); - m_MusicType = eMusicType_CD; - m_StreamingAudioInfo.bIs3D = true; - - // Need to adjust to index into the cds in the game's - // m_szStreamFileA - strcat((char*)m_szStreamName, "cds/"); - strcat((char*)m_szStreamName, - m_szStreamFileA[m_musicID - m_iStream_CD_1 + - eStream_CD_1]); - strcat((char*)m_szStreamName, ".binka"); - } - } else { - // 4J-PB - if this is a PS3 disc patch, we have to check if - // the music file is in the patch data - if (m_musicID < m_iStream_CD_1) { - SetIsPlayingStreamingGameMusic(true); - SetIsPlayingStreamingCDMusic(false); - m_MusicType = eMusicType_Game; - m_StreamingAudioInfo.bIs3D = false; - // build the name - strcat((char*)m_szStreamName, "music/"); - } else { - SetIsPlayingStreamingGameMusic(false); - SetIsPlayingStreamingCDMusic(true); - m_MusicType = eMusicType_CD; - m_StreamingAudioInfo.bIs3D = true; - // build the name - strcat((char*)m_szStreamName, "cds/"); - } - strcat((char*)m_szStreamName, m_szStreamFileA[m_musicID]); - strcat((char*)m_szStreamName, ".binka"); - } - - // std::string name = - // m_szStreamFileA[m_musicID];char*SoundName=(char - // *)ConvertSoundPathToName(name);strcat((char - // *)szStreamName,SoundName); - - app.DebugPrintf("Starting streaming - %s\n", m_szStreamName); - - // Don't actually open in this thread, as it can block for - // ~300ms. - m_openStreamThread = new C4JThread(OpenStreamThreadProc, this, - "OpenStreamThreadProc"); - m_openStreamThread->run(); - m_StreamState = eMusicStreamState_Opening; - } - break; - - case eMusicStreamState_Opening: - // If the open stream thread is complete, then we are ready to - // proceed to actually playing - if (!m_openStreamThread->isRunning()) { - delete m_openStreamThread; - m_openStreamThread = nullptr; - - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - - // 4J-PB - causes the falloff to be calculated on the PPU - // instead of the SPU, and seems to resolve our distorted sound - // issue - AIL_register_falloff_function_callback( - hSample, &custom_falloff_function); - - if (m_StreamingAudioInfo.bIs3D) { - AIL_set_sample_3D_distances( - hSample, 64.0f, 1, - 0); // Larger distance scaler for music discs - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - // need to calculate the distance from the sound to the - // nearest listener - use Manhattan Distance as the - // decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - m_StreamingAudioInfo.x); - y = fabs(m_ListenerA[i].vPosition.y - - m_StreamingAudioInfo.y); - z = fabs(m_ListenerA[i].vPosition.z - - m_StreamingAudioInfo.z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so floats - // rather than casts to doubles should be fine - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(hSample, 0, 0, fDist); - } else { - AIL_set_sample_3D_position( - hSample, m_StreamingAudioInfo.x, - m_StreamingAudioInfo.y, - -m_StreamingAudioInfo - .z); // Flipped sign of z as Miles is - // expecting left handed coord system - } - } else { - // clear the 3d flag on the stream after a jukebox finishes - // and streaming music starts - AIL_set_sample_is_3D(hSample, 0); - } - // set the pitch - app.DebugPrintf("Sample rate:%d\n", - AIL_sample_playback_rate(hSample)); - AIL_set_sample_playback_rate_factor(hSample, - m_StreamingAudioInfo.pitch); - // set the volume - AIL_set_sample_volume_levels( - hSample, - m_StreamingAudioInfo.volume * getMasterMusicVolume(), - m_StreamingAudioInfo.volume * getMasterMusicVolume()); - - AIL_start_stream(m_hStream); - - m_StreamState = eMusicStreamState_Playing; - } - break; - case eMusicStreamState_OpeningCancel: - if (!m_openStreamThread->isRunning()) { - delete m_openStreamThread; - m_openStreamThread = nullptr; - m_StreamState = eMusicStreamState_Stop; - } - break; - case eMusicStreamState_Stop: - // should gradually take the volume down in steps - AIL_pause_stream(m_hStream, 1); - AIL_close_stream(m_hStream); - m_hStream = 0; - SetIsPlayingStreamingCDMusic(false); - SetIsPlayingStreamingGameMusic(false); - m_StreamState = eMusicStreamState_Idle; - break; - case eMusicStreamState_Stopping: - break; - case eMusicStreamState_Play: - break; - case eMusicStreamState_Playing: - if (GetIsPlayingStreamingGameMusic()) { - // if(m_MusicInfo.pCue!=nullptr) - { - bool playerInEnd = false; - bool playerInNether = false; - Minecraft* pMinecraft = Minecraft::GetInstance(); - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - - if (playerInEnd && !GetIsPlayingEndMusic()) { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingEndMusic(true); - SetIsPlayingNetherMusic(false); - } else if (!playerInEnd && GetIsPlayingEndMusic()) { - if (playerInNether) { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingEndMusic(false); - SetIsPlayingNetherMusic(true); - } else { - m_StreamState = eMusicStreamState_Stop; - - // Set the end track - m_musicID = - getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingEndMusic(false); - SetIsPlayingNetherMusic(false); - } - } else if (playerInNether && !GetIsPlayingNetherMusic()) { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingNetherMusic(true); - SetIsPlayingEndMusic(false); - } else if (!playerInNether && GetIsPlayingNetherMusic()) { - if (playerInEnd) { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(true); - } else { - m_StreamState = eMusicStreamState_Stop; - // set the Nether track - m_musicID = - getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(false); - } - } - - // volume change required? - if (fMusicVol != getMasterMusicVolume()) { - fMusicVol = getMasterMusicVolume(); - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - // AIL_set_sample_3D_position( hSample, - // m_StreamingAudioInfo.x, m_StreamingAudioInfo.y, - // m_StreamingAudioInfo.z ); - AIL_set_sample_volume_levels(hSample, fMusicVol, - fMusicVol); - } - } - } else { - // Music disc playing - if it's a 3D stream, then set the - // position - we don't have any streaming audio in the world - // that moves, so this isn't required unless we have more than - // one listener, and are setting the listening position to the - // origin and setting a fake position for the sound down the z - // axis - if (m_StreamingAudioInfo.bIs3D) { - if (m_validListenerCount > 1) { - float fClosest = 10000.0f; - int iClosestListener = 0; - float fClosestX = 0.0f, fClosestY = 0.0f, - fClosestZ = 0.0f, fDist; - - // need to calculate the distance from the sound to the - // nearest listener - use Manhattan Distance as the - // decision - for (int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (m_ListenerA[i].bValid) { - float x, y, z; - - x = fabs(m_ListenerA[i].vPosition.x - - m_StreamingAudioInfo.x); - y = fabs(m_ListenerA[i].vPosition.y - - m_StreamingAudioInfo.y); - z = fabs(m_ListenerA[i].vPosition.z - - m_StreamingAudioInfo.z); - fDist = x + y + z; - - if (fDist < fClosest) { - fClosest = fDist; - fClosestX = x; - fClosestY = y; - fClosestZ = z; - iClosestListener = i; - } - } - } - - // our distances in the world aren't very big, so floats - // rather than casts to doubles should be fine - HSAMPLE hSample = AIL_stream_sample_handle(m_hStream); - fDist = sqrtf((fClosestX * fClosestX) + - (fClosestY * fClosestY) + - (fClosestZ * fClosestZ)); - AIL_set_sample_3D_position(hSample, 0, 0, fDist); - } - } - } - - break; - - case eMusicStreamState_Completed: { - // random delay of up to 3 minutes for music - m_iMusicDelay = random->nextInt( - 20 * 60 * 3); // random->nextInt(20 * 60 * 10) + 20 * 60 * 10; - // Check if we have a local player in The Nether or in The End, and - // play that music if they are - Minecraft* pMinecraft = Minecraft::GetInstance(); - bool playerInEnd = false; - bool playerInNether = false; - - for (unsigned int i = 0; i < MAX_LOCAL_PLAYERS; i++) { - if (pMinecraft->localplayers[i] != nullptr) { - if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_END) { - playerInEnd = true; - } else if (pMinecraft->localplayers[i]->dimension == - LevelData::DIMENSION_NETHER) { - playerInNether = true; - } - } - } - if (playerInEnd) { - m_musicID = getMusicID(LevelData::DIMENSION_END); - SetIsPlayingEndMusic(true); - SetIsPlayingNetherMusic(false); - } else if (playerInNether) { - m_musicID = getMusicID(LevelData::DIMENSION_NETHER); - SetIsPlayingNetherMusic(true); - SetIsPlayingEndMusic(false); - } else { - m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD); - SetIsPlayingNetherMusic(false); - SetIsPlayingEndMusic(false); - } - - m_StreamState = eMusicStreamState_Idle; - } break; - } - - // check the status of the stream - this is for when a track completes - // rather than is stopped by the user action - - if (m_hStream != 0) { - if (AIL_stream_status(m_hStream) == SMP_DONE) // SMP_DONE - { - AIL_close_stream(m_hStream); - m_hStream = 0; - SetIsPlayingStreamingCDMusic(false); - SetIsPlayingStreamingGameMusic(false); - - m_StreamState = eMusicStreamState_Completed; - } - } -} -F32 AILCALLBACK custom_falloff_function(HSAMPLE S, F32 distance, - F32 rolloff_factor, F32 min_dist, - F32 max_dist) { - F32 result; - - // This is now emulating the linear fall-off function that we used on the - // Xbox 360. The parameter which is passed as "max_dist" is the only one - // actually used, and is generally used as CurveDistanceScaler is used on - // XACT on the Xbox. A special value of 10000.0f is passed for thunder, - // which has no attenuation - - if (max_dist == 10000.0f) { - return 1.0f; - } - - result = 1.0f - (distance / max_dist); - if (result < 0.0f) result = 0.0f; - if (result > 1.0f) result = 1.0f; - - return result; -} -#endif // Universal, these functions shouldn't need platform specific // implementations diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index f00833434..8642b6ad4 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -142,9 +142,7 @@ private: float getMasterMusicVolume(); // platform specific functions int initAudioHardware(int iMinSpeakers) { return iMinSpeakers; } -#if defined(__linux__) void updateMiniAudio(); -#endif int GetRandomishTrack(int iStart, int iEnd); diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index a8c66c0d6..0faab72ad 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -640,7 +640,7 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) { } void GameRuleManager::loadDefaultGameRules() { -#if !defined(__linux__) +#if 0 #if defined(_WINDOWS64) File packedTutorialFile("Windows64Media\\Tutorial\\Tutorial.pck"); if (!packedTutorialFile.exists()) @@ -656,6 +656,8 @@ void GameRuleManager::loadDefaultGameRules() { app.GetString(IDS_TUTORIALSAVENAME)); } #else + // 4jcraft: brought over from TU18 so the tutorial world loads from assets + // TODO clean this up std::string fpTutorial = "Tutorial.pck"; if (app.getArchiveFileSize(fpTutorial) >= 0) { DLCPack* pack = new DLCPack("", 0xffffffff); diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 025965413..f4890ddb3 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -471,9 +471,7 @@ File Minecraft::getWorkingDirectory(const std::string& applicationName) { // 4jcraft: ported to C++ std::string userHome = getenv("HOME"); File* workingDirectory; -#if defined(__linux__) - workingDirectory = new File(userHome, '.' + applicationName + '/'); -#elif defined(_WINDOWS64) +#if defined(_WINDOWS64) std::string applicationData = getenv("APPDATA"); if (!applicationData.empty()) { workingDirectory = diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 5ef9a019f..8d4fd8721 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -1,11 +1,11 @@ #pragma once -#include - -#ifdef __linux__ #include #include +#include + +#include "java/File.h" #include "renderer/gl/gl_compat.h" #undef GL_SMOOTH @@ -42,125 +42,6 @@ void glEndQueryARB(int); void glGetQueryObjectuARB(int, int, IntBuffer*); void glReadPixels(int, int, int, int, int, int, ByteBuffer*); -#else - -const int GL_BYTE = 0; -const int GL_FLOAT = 0; -const int GL_UNSIGNED_BYTE = 0; - -const int GL_COLOR_ARRAY = 0; -const int GL_VERTEX_ARRAY = 0; -const int GL_NORMAL_ARRAY = 0; -const int GL_TEXTURE_COORD_ARRAY = 0; - -const int GL_COMPILE = 0x1300; - -const int GL_NORMALIZE = 0; - -const int GL_RESCALE_NORMAL = 0; - -const int GL_SMOOTH = 0; -const int GL_FLAT = 0; - -const int GL_RGBA = 0; -const int GL_BGRA = 1; -const int GL_BGR = 0; - -const int GL_SAMPLES_PASSED_ARB = 0; -const int GL_QUERY_RESULT_AVAILABLE_ARB = 0; -const int GL_QUERY_RESULT_ARB = 0; - -const int GL_POLYGON_OFFSET_FILL = 0; - -const int GL_FRONT = 0; -const int GL_BACK = 1; -const int GL_FRONT_AND_BACK = 2; - -const int GL_COLOR_MATERIAL = 0; - -const int GL_AMBIENT_AND_DIFFUSE = 0; - -const int GL_TEXTURE1 = 0; -const int GL_TEXTURE0 = 1; - -void glFlush(); -void glTexGeni(int, int, int); -void glTexGen(int, int, FloatBuffer*); -void glReadPixels(int, int, int, int, int, int, ByteBuffer*); -void glClearDepth(double); -void glCullFace(int); -void glDeleteLists(int, int); -void glGenTextures(IntBuffer*); -int glGenTextures(); -int glGenLists(int); -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 glEnableClientState(int); -void glDisableClientState(int); -void glColorPointer(int, bool, int, ByteBuffer*); -void glColorPointer(int, int, int, int); -void glVertexPointer(int, int, int, int); -void glVertexPointer(int, int, FloatBuffer*); -void glDrawArrays(int, int, int); -void glTranslatef(float, float, float); -void glRotatef(float, float, float, float); -void glNewList(int, int); -void glEndList(int vertexCount = 0); -void glCallList(int); -void glPopMatrix(); -void glPushMatrix(); -void glColor3f(float, float, float); -void glScalef(float, float, float); -void glMultMatrixf(float*); -void glColor4f(float, float, float, float); -void glDisable(int); -void glEnable(int); -void glBlendFunc(int, int); -void glDepthMask(bool); -void glNormal3f(float, float, float); -void glDepthFunc(int); -void glMatrixMode(int); -void glLoadIdentity(); -void glBindTexture(int, int); -void glTexParameteri(int, int, int); -void glTexImage2D(int, int, int, int, int, int, int, int, ByteBuffer*); -void glDeleteTextures(IntBuffer*); -void glDeleteTextures(int); -void glCallLists(IntBuffer*); -void glGenQueriesARB(IntBuffer*); -void glColorMask(bool, bool, bool, bool); -void glBeginQueryARB(int, int); -void glEndQueryARB(int); -void glGetQueryObjectuARB(int, int, IntBuffer*); -void glShadeModel(int); -void glPolygonOffset(float, float); -void glLineWidth(float); -void glScaled(double, double, double); -void gluPerspective(float, float, float, float); -void glClear(int); -void glViewport(int, int, int, int); -void glAlphaFunc(int, float); -void glOrtho(float, float, float, float, float, float); -void glClearColor(float, float, float, float); -void glFogi(int, int); -void glFogf(int, float); -void glFog(int, FloatBuffer*); -void glColorMaterial(int, int); -void glMultiTexCoord2f(int, float, float); - -void glClientActiveTexture(int); -void glActiveTexture(int); - -#endif - -#ifdef __linux__ -#include "java/File.h" - class GL11 { public: static const int GL_SMOOTH = 0x1D01; @@ -179,23 +60,6 @@ public: static void glBufferDataARB(int, ByteBuffer*, int) {} static void glGenBuffersARB(IntBuffer*) {} }; -#else -class GL11 { -public: - static const int GL_SMOOTH = 0; - static const int GL_FLAT = 0; - static void glShadeModel(int) {}; -}; - -class ARBVertexBufferObject { -public: - static const int GL_ARRAY_BUFFER_ARB = 0; - static const int GL_STREAM_DRAW_ARB = 0; - static void glBindBufferARB(int, int) {} - static void glBufferDataARB(int, ByteBuffer*, int) {} - static void glGenBuffersARB(IntBuffer*) {} -}; -#endif class Level; class Player; From 8c6effdabfdea2b776309a46d8d67f960b79a88b Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:36:49 -0500 Subject: [PATCH 076/104] remove Windows64 app --- meson.build | 4 - .../Iggy/gdraw/gdraw_d3d10_shaders.inl | 4689 ----------------- .../app/windows/Iggy/gdraw/gdraw_d3d11.cpp | 158 - targets/app/windows/Iggy/gdraw/gdraw_d3d11.h | 162 - .../windows/Iggy/gdraw/gdraw_d3d1x_shared.inl | 2722 ---------- .../windows/Iggy/gdraw/gdraw_gl_shaders.inl | 1536 ------ .../windows/Iggy/gdraw/gdraw_gl_shared.inl | 2695 ---------- .../app/windows/Iggy/gdraw/gdraw_shared.inl | 2693 ---------- targets/app/windows/Iggy/include/gdraw.h | 841 --- targets/app/windows/Iggy/include/iggy.h | 1639 ------ .../app/windows/Iggy/include/iggyexpruntime.h | 55 - .../app/windows/Iggy/include/iggyperfmon.h | 106 - targets/app/windows/Iggy/include/rrCore.h | 2437 --------- targets/app/windows/Windows64_App.cpp | 100 - .../app/windows/Windows64_UIController.cpp | 179 - targets/app/windows/Windows64_UIController.h | 36 - targets/app/windows/WindowsGame.h | 17 - targets/app/windows/XML/ATGXmlParser.cpp | 821 --- targets/app/windows/XML/ATGXmlParser.h | 159 - targets/app/windows/XML/xmlFilesCallback.h | 303 -- .../app/windows/src/Windows64_Minecraft.cpp | 849 --- targets/minecraft/client/gui/Minimap.cpp | 8 +- .../client/renderer/GameRenderer.cpp | 6 +- targets/minecraft/network/Connection.cpp | 15 - 24 files changed, 7 insertions(+), 22223 deletions(-) delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_d3d11.h delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl delete mode 100644 targets/app/windows/Iggy/gdraw/gdraw_shared.inl delete mode 100644 targets/app/windows/Iggy/include/gdraw.h delete mode 100644 targets/app/windows/Iggy/include/iggy.h delete mode 100644 targets/app/windows/Iggy/include/iggyexpruntime.h delete mode 100644 targets/app/windows/Iggy/include/iggyperfmon.h delete mode 100644 targets/app/windows/Iggy/include/rrCore.h delete mode 100644 targets/app/windows/Windows64_App.cpp delete mode 100644 targets/app/windows/Windows64_UIController.cpp delete mode 100644 targets/app/windows/Windows64_UIController.h delete mode 100644 targets/app/windows/WindowsGame.h delete mode 100644 targets/app/windows/XML/ATGXmlParser.cpp delete mode 100644 targets/app/windows/XML/ATGXmlParser.h delete mode 100644 targets/app/windows/XML/xmlFilesCallback.h delete mode 100644 targets/app/windows/src/Windows64_Minecraft.cpp diff --git a/meson.build b/meson.build index 8d2821b1b..5fd5574fd 100644 --- a/meson.build +++ b/meson.build @@ -38,10 +38,6 @@ if get_option('buildtype') in ['debug', 'debugoptimized'] ] endif -if host_machine.system() == 'linux' - global_cpp_defs += ['-Dlinux', '-D__linux', '-D__linux__'] -endif - if get_option('renderer') == 'gles' global_cpp_defs += ['-DGLES'] gl_dep = dependency('glesv2', required: true) diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl b/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl deleted file mode 100644 index 722b96972..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ /dev/null @@ -1,4689 +0,0 @@ -// This file was automatically generated by shadergen. Do not edit by hand! - -static DWORD pshader_basic_0[239] = { - 0x43425844, 0x424a7ef2, 0x6c708f66, 0xff55849a, 0xbcc512aa, 0x00000001, - 0x000003bc, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000340, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000104, 0x00000040, - 0x00000041, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x09000038, - 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, 0x00208246, - 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, 0x0020803a, - 0x00000000, 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000007, 0x00000002, 0x00000000, 0x00000002, 0x00000003, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_1[261] = { - 0x43425844, 0x90372132, 0x718f790d, 0x41ee8636, 0x62f4522d, 0x00000001, - 0x00000414, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000398, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000015c, 0x00000040, - 0x00000057, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x09000038, - 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, 0x00208246, - 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, 0x0020803a, - 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, - 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_2[249] = { - 0x43425844, 0xf18db76f, 0x60007209, 0xb95de8b5, 0x04b32ff3, 0x00000001, - 0x000003e4, 0x00000005, 0x00000034, 0x000001a8, 0x00000200, 0x00000234, - 0x00000368, 0x46454452, 0x0000016c, 0x00000001, 0x0000008c, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000139, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000007, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x00635350, 0x00000088, 0x00000004, 0x000000a4, 0x00000040, - 0x00000000, 0x00000000, 0x00000104, 0x00000000, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x00000120, 0x00000010, 0x00000010, 0x00000002, - 0x00000110, 0x00000000, 0x0000012a, 0x00000020, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x00000130, 0x00000030, 0x00000010, 0x00000000, - 0x00000110, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, - 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, - 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000c0f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000012c, 0x00000040, - 0x0000004b, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005a, - 0x00106000, 0x00000007, 0x04001858, 0x00107000, 0x00000007, 0x00005555, - 0x03001062, 0x001010c2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000001, 0x0700000e, 0x00100012, 0x00000000, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000000, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0b000032, - 0x00100012, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010003a, - 0x00000000, 0x0020803a, 0x00000000, 0x00000001, 0x09000000, 0x001000e2, - 0x00000000, 0x00208906, 0x00000000, 0x00000000, 0x00208906, 0x00000000, - 0x00000001, 0x07000038, 0x00102072, 0x00000000, 0x00100006, 0x00000000, - 0x00100796, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010000a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000008, 0x00000001, - 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_3[298] = { - 0x43425844, 0x8666f1ab, 0x6789c83a, 0x84ddee9b, 0x99672a63, 0x00000001, - 0x000004a8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000042c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, - 0x00000040, 0x00000069, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, - 0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_4[320] = { - 0x43425844, 0xc29dc729, 0xa89895e0, 0x45d2e5a7, 0x85a6e3df, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000484, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001fc, - 0x00000040, 0x0000007f, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_5[337] = { - 0x43425844, 0xf38a8aa1, 0x76e83e07, 0xe035a58b, 0x8d62e8be, 0x00000001, - 0x00000544, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004c8, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000240, - 0x00000040, 0x00000090, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, 0x3f800000, - 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00100072, - 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, 0x07000039, - 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, 0x00000000, - 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, 0x0010003a, - 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000010, 0x00000002, 0x00000000, 0x00000002, - 0x0000000a, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_basic_6[298] = { - 0x43425844, 0xf4bd11d7, 0x2d1585d4, 0xa2bece1a, 0x528591b0, 0x00000001, - 0x000004a8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000042c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, - 0x00000040, 0x00000069, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, - 0x00000002, 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_7[320] = { - 0x43425844, 0xf035ea5f, 0x7228ce0c, 0x7acda6b1, 0x84f793b7, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000484, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001fc, - 0x00000040, 0x0000007f, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_8[308] = { - 0x43425844, 0x8de8fdf8, 0x79362b3c, 0xd3e53d96, 0x9a753d05, 0x00000001, - 0x000004d0, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000454, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001cc, - 0x00000040, 0x00000073, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020803a, - 0x00000000, 0x00000000, 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000001, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0a000032, - 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0010003a, 0x00000001, - 0x0020803a, 0x00000000, 0x00000001, 0x09000000, 0x001000e2, 0x00000000, - 0x00208906, 0x00000000, 0x00000000, 0x00208906, 0x00000000, 0x00000001, - 0x07000038, 0x00102072, 0x00000000, 0x00100006, 0x00000000, 0x00100796, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, - 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_9[310] = { - 0x43425844, 0xf476d124, 0xc7f0f06d, 0x96327107, 0x57955bd0, 0x00000001, - 0x000004d8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000045c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001d4, - 0x00000040, 0x00000075, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000d, - 0x00000002, 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_10[332] = { - 0x43425844, 0x08449793, 0x6e27fb50, 0xe33f149a, 0x0f517c0c, 0x00000001, - 0x00000530, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004b4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000022c, - 0x00000040, 0x0000008b, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, 0x00208246, - 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_11[349] = { - 0x43425844, 0x10a3f918, 0xf7959328, 0x525b10eb, 0x0f678477, 0x00000001, - 0x00000574, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004f8, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000270, - 0x00000040, 0x0000009c, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x0700000f, 0x00100012, 0x00000000, - 0x00100046, 0x00000000, 0x00100046, 0x00000000, 0x0500004b, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, 0x3f800000, - 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00100072, - 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, 0x07000039, - 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, 0x00000000, - 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, 0x0010003a, - 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000012, 0x00000002, 0x00000000, 0x00000002, - 0x0000000c, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_basic_12[365] = { - 0x43425844, 0x50cde65f, 0xba0450c9, 0xc66a01ba, 0xf364c937, 0x00000001, - 0x000005b4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000538, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002b0, - 0x00000040, 0x000000ac, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, - 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, - 0x00000001, 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_13[387] = { - 0x43425844, 0x80d41dbd, 0x58a18bbb, 0x9707037c, 0x21268324, 0x00000001, - 0x0000060c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000590, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000308, - 0x00000040, 0x000000c2, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, - 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, - 0x00000001, 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, - 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, - 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, - 0x00106000, 0x00000007, 0x07000038, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100e46, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000016, 0x00000002, - 0x00000000, 0x00000002, 0x0000000b, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_14[404] = { - 0x43425844, 0xb2a25f21, 0x5a5542ec, 0xc550e23f, 0x5a891887, 0x00000001, - 0x00000650, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000005d4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000034c, - 0x00000040, 0x000000d3, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010101a, 0x00000001, 0x0a000032, 0x00100012, 0x00000000, - 0x0010100a, 0x00000001, 0x0010000a, 0x00000000, 0x0020800a, 0x00000000, - 0x00000002, 0x07000038, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, - 0x0010001a, 0x00000000, 0x09000032, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x0010000a, 0x00000000, 0x0010001a, 0x00000000, 0x08000038, - 0x00100042, 0x00000000, 0x0010000a, 0x00000000, 0x0020801a, 0x00000000, - 0x00000002, 0x07000038, 0x00100042, 0x00000000, 0x0010002a, 0x00000000, - 0x0010002a, 0x00000000, 0x0a000032, 0x00100022, 0x00000000, 0x0010001a, - 0x00000000, 0x0020802a, 0x00000000, 0x00000002, 0x0010002a, 0x00000000, - 0x0500004b, 0x00100022, 0x00000000, 0x0010001a, 0x00000000, 0x0b000032, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x0020801a, - 0x00000000, 0x00000002, 0x0010001a, 0x00000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100006, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a00000e, 0x00100012, 0x00000001, 0x00004002, 0x3f800000, - 0x3f800000, 0x3f800000, 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, - 0x00100072, 0x00000001, 0x00100246, 0x00000000, 0x00100006, 0x00000001, - 0x07000039, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, - 0x00000000, 0x09000037, 0x00100072, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x00100246, 0x00000000, 0x08000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, - 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, - 0x00000001, 0x05000036, 0x00100022, 0x00000001, 0x0010103a, 0x00000001, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000007, 0x00106000, 0x00000007, 0x07000038, 0x00100082, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000001, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, - 0x07000038, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000018, 0x00000002, 0x00000000, - 0x00000002, 0x0000000e, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_15[322] = { - 0x43425844, 0xe9ac3a59, 0xb10c74ae, 0x7d8ea66b, 0x7f38f805, 0x00000001, - 0x00000508, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000048c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000204, - 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x09000032, 0x00100012, 0x00000002, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x00004001, 0xbf000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x05000036, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x07000031, 0x00100012, - 0x00000000, 0x0010000a, 0x00000002, 0x00004001, 0x00000000, 0x0304000d, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000f, - 0x00000003, 0x00000000, 0x00000002, 0x00000007, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_16[339] = { - 0x43425844, 0x254d5609, 0xfb3546e9, 0x05f36a1e, 0x58e4fd27, 0x00000001, - 0x0000054c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004d0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000248, - 0x00000040, 0x00000092, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000038, 0x00100072, 0x00000001, 0x00208ff6, 0x00000000, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x06000036, 0x00100082, 0x00000001, - 0x0020803a, 0x00000000, 0x00000000, 0x07000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0700000e, 0x00100012, - 0x00000001, 0x0010102a, 0x00000001, 0x0010103a, 0x00000001, 0x05000036, - 0x00100022, 0x00000001, 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000007, 0x00106000, - 0x00000007, 0x09000032, 0x00100012, 0x00000002, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x00004001, 0xbf000000, 0x07000038, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, 0x07000031, - 0x00100012, 0x00000001, 0x0010000a, 0x00000002, 0x00004001, 0x00000000, - 0x0304000d, 0x0010000a, 0x00000001, 0x0a000032, 0x00100072, 0x00000000, - 0x00208246, 0x00000000, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000000, 0x07000033, 0x00102072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_basic_17[325] = { - 0x43425844, 0x9b76f721, 0x305d6ada, 0x87db10d5, 0x6ff15183, 0x00000001, - 0x00000514, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000498, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000007, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000007, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000210, - 0x00000040, 0x00000084, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000007, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000007, 0x00005555, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x0a00000e, 0x00100012, - 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, - 0x0010103a, 0x00000001, 0x07000038, 0x00100032, 0x00000000, 0x00100006, - 0x00000000, 0x00101046, 0x00000001, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020803a, - 0x00000000, 0x00000000, 0x0700000e, 0x00100012, 0x00000001, 0x0010102a, - 0x00000001, 0x0010103a, 0x00000001, 0x05000036, 0x00100022, 0x00000001, - 0x0010103a, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000007, 0x00106000, 0x00000007, 0x0a000032, - 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0010003a, 0x00000001, - 0x0020803a, 0x00000000, 0x00000001, 0x07000000, 0x00100022, 0x00000000, - 0x0010000a, 0x00000000, 0x00004001, 0xbf000000, 0x07000031, 0x00100022, - 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0x00000000, 0x0304000d, - 0x0010001a, 0x00000000, 0x09000000, 0x001000e2, 0x00000000, 0x00208906, - 0x00000000, 0x00000000, 0x00208906, 0x00000000, 0x00000001, 0x07000038, - 0x00102072, 0x00000000, 0x00100006, 0x00000000, 0x00100796, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000002, 0x00000000, 0x00000002, - 0x00000008, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { - { - pshader_basic_0, - 956, - }, - { - pshader_basic_1, - 1044, - }, - { - pshader_basic_2, - 996, - }, - { - pshader_basic_3, - 1192, - }, - { - pshader_basic_4, - 1280, - }, - { - pshader_basic_5, - 1348, - }, - { - pshader_basic_6, - 1192, - }, - { - pshader_basic_7, - 1280, - }, - { - pshader_basic_8, - 1232, - }, - { - pshader_basic_9, - 1240, - }, - { - pshader_basic_10, - 1328, - }, - { - pshader_basic_11, - 1396, - }, - { - pshader_basic_12, - 1460, - }, - { - pshader_basic_13, - 1548, - }, - { - pshader_basic_14, - 1616, - }, - { - pshader_basic_15, - 1288, - }, - { - pshader_basic_16, - 1356, - }, - { - pshader_basic_17, - 1300, - }, -}; - -static DWORD pshader_exceptional_blend_1[335] = { - 0x43425844, 0x0b4014f2, 0x2a24373f, 0xb6c4e09c, 0xd8c938b5, 0x00000001, - 0x0000053c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004c0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000238, - 0x00000040, 0x0000008e, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000e2, 0x00000001, 0x00100906, 0x00000000, - 0x00100906, 0x00000002, 0x09000032, 0x00100072, 0x00000001, 0x00100006, - 0x00000001, 0x00100246, 0x00000002, 0x00100796, 0x00000001, 0x08000000, - 0x00100082, 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, - 0x3f800000, 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, - 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, - 0x00102082, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, - 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000e, 0x00000003, 0x00000000, 0x00000002, 0x00000006, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_2[361] = { - 0x43425844, 0xf906958b, 0x06acfe4b, 0x355048f1, 0x63cfff9c, 0x00000001, - 0x000005a4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000528, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002a0, - 0x00000040, 0x000000a8, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x08000000, 0x00100072, 0x00000003, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x0a000032, 0x00100072, - 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, 0x00000001, - 0x00100ff6, 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x09000032, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000001, 0x00100246, 0x00000002, 0x00100246, - 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, 0x00000041, - 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, 0x00000001, - 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, 0x00000002, - 0x00000008, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_exceptional_blend_3[356] = { - 0x43425844, 0xfa19bb88, 0xda5ce80c, 0x160c8b13, 0xebac0845, 0x00000001, - 0x00000590, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000514, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000028c, - 0x00000040, 0x000000a3, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000f2, 0x00000003, 0x00100736, 0x00000000, - 0x00100dc6, 0x00000002, 0x07000034, 0x00100032, 0x00000003, 0x001005d6, - 0x00000003, 0x00100086, 0x00000003, 0x07000038, 0x00100062, 0x00000001, - 0x00100ef6, 0x00000000, 0x00100ba6, 0x00000002, 0x07000034, 0x00100042, - 0x00000003, 0x0010002a, 0x00000001, 0x0010001a, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_4[356] = { - 0x43425844, 0x51f459c3, 0x15565fe2, 0x4f2b3854, 0x901f8bb9, 0x00000001, - 0x00000590, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000514, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000028c, - 0x00000040, 0x000000a3, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x001000f2, 0x00000003, 0x00100736, 0x00000000, - 0x00100dc6, 0x00000002, 0x07000033, 0x00100032, 0x00000003, 0x001005d6, - 0x00000003, 0x00100086, 0x00000003, 0x07000038, 0x00100062, 0x00000001, - 0x00100ef6, 0x00000000, 0x00100ba6, 0x00000002, 0x07000033, 0x00100042, - 0x00000003, 0x0010002a, 0x00000001, 0x0010001a, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000011, 0x00000004, 0x00000000, - 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_5[294] = { - 0x43425844, 0x78df9480, 0x22fce9ea, 0x892ac708, 0xebd122be, 0x00000001, - 0x00000498, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000041c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000194, - 0x00000040, 0x00000065, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x0b000032, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000000, 0x00000003, 0x00208ae6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000000, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100e46, 0x00000001, - 0x0a000033, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00004002, - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x0100003e, 0x54415453, - 0x00000074, 0x00000009, 0x00000002, 0x00000000, 0x00000002, 0x00000004, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_6[309] = { - 0x43425844, 0x72cc2469, 0xfeb8ff3a, 0xc3c15aed, 0x5d2bdd8a, 0x00000001, - 0x000004d4, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x00000458, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001d0, - 0x00000040, 0x00000074, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x0b000032, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000000, 0x00000003, 0x00208ae6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, - 0x00100072, 0x00000000, 0x80100246, 0x00000041, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x07000033, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x00004001, 0x3f800000, 0x0a000034, 0x00102072, 0x00000000, - 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, - 0x00000000, 0x00000002, 0x00000006, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_7[374] = { - 0x43425844, 0xeeebdd02, 0x607b5e55, 0x9b2d4bb0, 0x0c029c3e, 0x00000001, - 0x000005d8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000055c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000002d4, - 0x00000040, 0x000000b5, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000004, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100062, 0x00000001, 0x00100106, 0x00000000, - 0x00100ff6, 0x00000002, 0x0a000032, 0x00100062, 0x00000001, 0x00100ff6, - 0x00000000, 0x00100106, 0x00000002, 0x80100656, 0x00000041, 0x00000001, - 0x06000036, 0x00100032, 0x00000003, 0x80100596, 0x00000081, 0x00000001, - 0x07000038, 0x00100022, 0x00000001, 0x0010002a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00100022, 0x00000001, 0x0010003a, 0x00000000, - 0x0010002a, 0x00000002, 0x8010001a, 0x00000041, 0x00000001, 0x06000036, - 0x00100042, 0x00000003, 0x8010001a, 0x00000081, 0x00000001, 0x09000032, - 0x00100072, 0x00000001, 0x00100006, 0x00000001, 0x00100246, 0x00000002, - 0x00100246, 0x00000003, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, - 0x00000041, 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, - 0x00000001, 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000013, 0x00000004, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_8[343] = { - 0x43425844, 0x4c133b76, 0xe54d7a26, 0xec03c69d, 0xd69182c1, 0x00000001, - 0x0000055c, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000004e0, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000258, - 0x00000040, 0x00000096, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000000, - 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x08000000, 0x00100072, 0x00000002, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x09000032, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000002, 0x00100246, - 0x00000001, 0x08000000, 0x00100082, 0x00000001, 0x8010003a, 0x00000041, - 0x00000002, 0x00004001, 0x3f800000, 0x09000032, 0x00102072, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000000, 0x00100246, 0x00000001, - 0x07000000, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0010003a, - 0x00000002, 0x0a000032, 0x00102082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x0010003a, 0x00000002, 0x0010000a, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000003, 0x00000000, 0x00000002, - 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_exceptional_blend_9[430] = { - 0x43425844, 0x0e53b9bf, 0xa40806de, 0xc8710d16, 0xff1f73e9, 0x00000001, - 0x000006b8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000063c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003b4, - 0x00000040, 0x000000ed, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000005, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100082, 0x00000001, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000002, 0x08000000, 0x00100072, 0x00000003, 0x80100246, - 0x00000041, 0x00000002, 0x00100ff6, 0x00000002, 0x07000000, 0x00100072, - 0x00000003, 0x00100246, 0x00000003, 0x00100246, 0x00000003, 0x0a000032, - 0x00100072, 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, - 0x00000001, 0x00100ff6, 0x00000001, 0x0700000f, 0x00100082, 0x00000001, - 0x00100006, 0x00000002, 0x00100006, 0x00000000, 0x07000038, 0x00100012, - 0x00000003, 0x0010003a, 0x00000002, 0x00004001, 0x3f000000, 0x07000031, - 0x00100072, 0x00000003, 0x00100246, 0x00000002, 0x00100006, 0x00000003, - 0x09000037, 0x00100012, 0x00000004, 0x0010000a, 0x00000003, 0x0010003a, - 0x00000001, 0x0010000a, 0x00000001, 0x0700000f, 0x00100012, 0x00000001, - 0x00100556, 0x00000002, 0x00100556, 0x00000000, 0x09000037, 0x00100022, - 0x00000004, 0x0010001a, 0x00000003, 0x0010000a, 0x00000001, 0x0010001a, - 0x00000001, 0x0700000f, 0x00100012, 0x00000001, 0x00100aa6, 0x00000002, - 0x00100aa6, 0x00000000, 0x09000037, 0x00100042, 0x00000004, 0x0010002a, - 0x00000003, 0x0010000a, 0x00000001, 0x0010002a, 0x00000001, 0x08000000, - 0x00100012, 0x00000001, 0x8010003a, 0x00000041, 0x00000000, 0x00004001, - 0x3f800000, 0x09000032, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x00100246, 0x00000004, 0x08000000, 0x00100082, - 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, 0x3f800000, - 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000002, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001a, - 0x00000005, 0x00000000, 0x00000002, 0x0000000e, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_10[430] = { - 0x43425844, 0x5b763bc7, 0xa04a2226, 0x01dce3d1, 0xed9b4a05, 0x00000001, - 0x000006b8, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x0000063c, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003b4, - 0x00000040, 0x000000ed, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000005, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, - 0x00208246, 0x00000000, 0x00000000, 0x08000038, 0x001000f2, 0x00000001, - 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x0a002032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208ff6, 0x00000000, - 0x00000000, 0x00100e46, 0x00000001, 0x08000000, 0x00100072, 0x00000001, - 0x80100246, 0x00000041, 0x00000000, 0x00100ff6, 0x00000000, 0x0b000032, - 0x00100032, 0x00000002, 0x00101046, 0x00000001, 0x00208046, 0x00000000, - 0x00000003, 0x00208ae6, 0x00000000, 0x00000003, 0x09000045, 0x001000f2, - 0x00000002, 0x00100046, 0x00000002, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x08000000, 0x00100072, 0x00000003, 0x80100246, 0x00000041, - 0x00000002, 0x00100ff6, 0x00000002, 0x07000000, 0x00100072, 0x00000003, - 0x00100246, 0x00000003, 0x00100246, 0x00000003, 0x07000038, 0x00100082, - 0x00000001, 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, - 0x00100072, 0x00000001, 0x80100246, 0x00000041, 0x00000003, 0x00100246, - 0x00000001, 0x00100ff6, 0x00000001, 0x07000038, 0x00100082, 0x00000001, - 0x0010003a, 0x00000000, 0x00004001, 0x3f000000, 0x07000031, 0x00100072, - 0x00000003, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, 0x0700000f, - 0x00100082, 0x00000001, 0x00100006, 0x00000002, 0x00100006, 0x00000000, - 0x09000037, 0x00100012, 0x00000004, 0x0010000a, 0x00000003, 0x0010003a, - 0x00000001, 0x0010000a, 0x00000001, 0x0700000f, 0x00100012, 0x00000001, - 0x00100556, 0x00000002, 0x00100556, 0x00000000, 0x09000037, 0x00100022, - 0x00000004, 0x0010001a, 0x00000003, 0x0010000a, 0x00000001, 0x0010001a, - 0x00000001, 0x0700000f, 0x00100012, 0x00000001, 0x00100aa6, 0x00000002, - 0x00100aa6, 0x00000000, 0x09000037, 0x00100042, 0x00000004, 0x0010002a, - 0x00000003, 0x0010000a, 0x00000001, 0x0010002a, 0x00000001, 0x08000000, - 0x00100012, 0x00000001, 0x8010003a, 0x00000041, 0x00000000, 0x00004001, - 0x3f800000, 0x09000032, 0x00100072, 0x00000001, 0x00100006, 0x00000001, - 0x00100246, 0x00000002, 0x00100246, 0x00000004, 0x08000000, 0x00100082, - 0x00000001, 0x8010003a, 0x00000041, 0x00000002, 0x00004001, 0x3f800000, - 0x09000032, 0x00102072, 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, - 0x00000000, 0x00100246, 0x00000001, 0x07000000, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0010003a, 0x00000002, 0x0a000032, 0x00102082, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000002, - 0x0010000a, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001a, - 0x00000005, 0x00000000, 0x00000002, 0x0000000e, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_11[284] = { - 0x43425844, 0xb5fd5f87, 0x5eef857b, 0xa3d0d13a, 0xf65c919c, 0x00000001, - 0x00000470, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000003f4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000016c, - 0x00000040, 0x0000005b, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0020803a, 0x00000000, 0x00000001, 0x0a002032, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010000a, - 0x00000000, 0x08000000, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x0b000032, 0x00100062, 0x00000000, - 0x00101106, 0x00000001, 0x00208106, 0x00000000, 0x00000003, 0x00208ba6, - 0x00000000, 0x00000003, 0x09000045, 0x001000f2, 0x00000001, 0x00100596, - 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, - 0x001020f2, 0x00000000, 0x00100006, 0x00000000, 0x00100e46, 0x00000001, - 0x0100003e, 0x54415453, 0x00000074, 0x00000008, 0x00000002, 0x00000000, - 0x00000002, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_exceptional_blend_12[276] = { - 0x43425844, 0x8aa79ff3, 0xa0220437, 0x6186c7a6, 0x358ad839, 0x00000001, - 0x00000450, 0x00000005, 0x00000034, 0x000001f4, 0x0000024c, 0x00000280, - 0x000003d4, 0x46454452, 0x000001b8, 0x00000001, 0x000000d8, 0x00000005, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000185, 0x000000bc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000c3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ca, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000cf, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x65740031, - 0x74003078, 0x00317865, 0x00635350, 0x000000d4, 0x00000004, 0x000000f0, - 0x00000040, 0x00000000, 0x00000000, 0x00000150, 0x00000000, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x0000016c, 0x00000010, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x00000176, 0x00000020, 0x00000010, - 0x00000000, 0x0000015c, 0x00000000, 0x0000017c, 0x00000030, 0x00000010, - 0x00000002, 0x0000015c, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, - 0x00030001, 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, - 0x6f660064, 0x006c6163, 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, - 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, - 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000014c, - 0x00000040, 0x00000053, 0x04000059, 0x00208e46, 0x00000000, 0x00000004, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, - 0x0020803a, 0x00000000, 0x00000001, 0x0a002032, 0x00100012, 0x00000000, - 0x0010003a, 0x00000000, 0x0020803a, 0x00000000, 0x00000000, 0x0010000a, - 0x00000000, 0x0b000032, 0x00100062, 0x00000000, 0x00101106, 0x00000001, - 0x00208106, 0x00000000, 0x00000003, 0x00208ba6, 0x00000000, 0x00000003, - 0x09000045, 0x001000f2, 0x00000001, 0x00100596, 0x00000000, 0x00107e46, - 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, - 0x00100006, 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, - 0x00000074, 0x00000007, 0x00000002, 0x00000000, 0x00000002, 0x00000002, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { - NULL, - 0, - }, - { - pshader_exceptional_blend_1, - 1340, - }, - { - pshader_exceptional_blend_2, - 1444, - }, - { - pshader_exceptional_blend_3, - 1424, - }, - { - pshader_exceptional_blend_4, - 1424, - }, - { - pshader_exceptional_blend_5, - 1176, - }, - { - pshader_exceptional_blend_6, - 1236, - }, - { - pshader_exceptional_blend_7, - 1496, - }, - { - pshader_exceptional_blend_8, - 1372, - }, - { - pshader_exceptional_blend_9, - 1720, - }, - { - pshader_exceptional_blend_10, - 1720, - }, - { - pshader_exceptional_blend_11, - 1136, - }, - { - pshader_exceptional_blend_12, - 1104, - }, -}; - -static DWORD pshader_filter_0[379] = { - 0x43425844, 0x24aad9c6, 0x43cc8801, 0x5ba2dc0b, 0xffe933e2, 0x00000001, - 0x000005ec, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000570, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000020c, 0x00000040, 0x00000083, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x08000034, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x08000000, 0x00100012, 0x00000002, 0x8010003a, 0x00000041, 0x00000001, - 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100006, 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000d, 0x00000003, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_1[377] = { - 0x43425844, 0x1e4f7d74, 0xaaf944d6, 0xb5f0a484, 0xc246b059, 0x00000001, - 0x000005e4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000568, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000204, 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000000, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000000, 0x00100656, 0x00000000, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100596, 0x00000000, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100022, - 0x00000000, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000001, 0x00000002, 0x07000038, 0x001020f2, 0x00000000, 0x00100006, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_2[411] = { - 0x43425844, 0x434da1c1, 0xc6277d6b, 0xf3644d3f, 0x33d647fa, 0x00000001, - 0x0000066c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005f0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000240, 0x00000040, 0x00000090, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000002, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x00100e46, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_3[409] = { - 0x43425844, 0x965f1059, 0xcdafe63f, 0x73c062f4, 0xcd63b2ea, 0x00000001, - 0x00000664, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005e8, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000238, 0x00000040, 0x0000008e, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000e, 0x00000002, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_4[402] = { - 0x43425844, 0x4c377bd9, 0xfb4c5258, 0xe793fa9d, 0xf685a588, 0x00000001, - 0x00000648, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x000005cc, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000268, 0x00000040, 0x0000009a, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x00004001, 0x3f800000, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x08000038, - 0x001000e2, 0x00000000, 0x00100006, 0x00000000, 0x00208906, 0x00000001, - 0x00000002, 0x0b000032, 0x00100012, 0x00000000, 0x8020803a, 0x00000041, - 0x00000001, 0x00000002, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, - 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000001, 0x07000038, 0x00100072, 0x00000001, 0x00100006, 0x00000000, - 0x00100246, 0x00000001, 0x09000032, 0x00102072, 0x00000000, 0x00100796, - 0x00000000, 0x00100ff6, 0x00000001, 0x00100246, 0x00000001, 0x05000036, - 0x00102082, 0x00000000, 0x0010003a, 0x00000001, 0x0100003e, 0x54415453, - 0x00000074, 0x00000010, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_5[377] = { - 0x43425844, 0x9ff592ef, 0xe7109a8c, 0xc01f276d, 0x73f691c7, 0x00000001, - 0x000005e4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000568, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x00000204, 0x00000040, 0x00000081, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x00004001, 0x3f800000, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100062, 0x00000000, 0x00101106, 0x00000001, 0x00208106, 0x00000001, - 0x00000001, 0x08000033, 0x00100062, 0x00000000, 0x00100656, 0x00000000, - 0x00208ba6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100596, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x08000038, 0x001000f2, 0x00000001, 0x00100ff6, 0x00000001, 0x00208e46, - 0x00000001, 0x00000002, 0x07000038, 0x001020f2, 0x00000000, 0x00100006, - 0x00000000, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x0000000a, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_6[423] = { - 0x43425844, 0x5360f80d, 0x54f4e830, 0xa8cabb2e, 0x51c8fc74, 0x00000001, - 0x0000069c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000620, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000270, 0x00000040, 0x0000009c, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000000, 0x00100082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000001, 0x09000032, - 0x00102072, 0x00000000, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, - 0x00000000, 0x00000002, 0x00000009, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_7[401] = { - 0x43425844, 0x0439e6c7, 0xa22f2670, 0x44e3f549, 0xd957dde0, 0x00000001, - 0x00000644, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005c8, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000218, 0x00000040, 0x00000086, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000d, 0x00000002, 0x00000000, 0x00000002, 0x00000008, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_8[246] = { - 0x43425844, 0xd318033e, 0x780e8795, 0xb2e4d27b, 0x11bd4a8f, 0x00000001, - 0x000003d8, 0x00000005, 0x00000034, 0x000001c0, 0x00000218, 0x0000024c, - 0x0000035c, 0x46454452, 0x00000184, 0x00000001, 0x00000090, 0x00000003, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000153, 0x0000007c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x00000083, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x00000088, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x74003178, - 0x00317865, 0x61726170, 0xababab00, 0x00000088, 0x00000005, 0x000000a8, - 0x00000050, 0x00000000, 0x00000000, 0x00000120, 0x00000000, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x00000138, 0x00000010, 0x00000010, - 0x00000002, 0x00000128, 0x00000000, 0x0000013f, 0x00000020, 0x00000010, - 0x00000002, 0x00000128, 0x00000000, 0x00000145, 0x00000030, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x0000014c, 0x00000040, 0x00000010, - 0x00000000, 0x00000128, 0x00000000, 0x6d616c63, 0xab003070, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6d616c63, 0x63003170, 0x726f6c6f, - 0x6c6f6300, 0x0032726f, 0x6f5f6374, 0x4d006666, 0x6f726369, 0x74666f73, - 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, - 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000108, 0x00000040, - 0x00000042, 0x04000059, 0x00208e46, 0x00000001, 0x00000003, 0x0300005a, - 0x00106000, 0x00000001, 0x04001858, 0x00107000, 0x00000001, 0x00005555, - 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, - 0x02000068, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000001, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000001, 0x00106000, 0x00000001, 0x09000000, 0x00100012, 0x00000001, - 0x8020803a, 0x00000041, 0x00000001, 0x00000002, 0x00004001, 0x3f800000, - 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000001, 0x00208e46, 0x00000001, 0x00000002, 0x0100003e, 0x54415453, - 0x00000074, 0x00000006, 0x00000002, 0x00000000, 0x00000002, 0x00000003, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_9[177] = { - 0x43425844, 0x6be5959a, 0xfbf9f786, 0x3ad2a2c2, 0xed03ea11, 0x00000001, - 0x000002c4, 0x00000005, 0x00000034, 0x00000174, 0x000001cc, 0x00000200, - 0x00000248, 0x46454452, 0x00000138, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000107, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000005, 0x0000005c, 0x00000050, - 0x00000000, 0x00000000, 0x000000d4, 0x00000000, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x000000ec, 0x00000010, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x000000f3, 0x00000020, 0x00000010, 0x00000002, - 0x000000dc, 0x00000000, 0x000000f9, 0x00000030, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x00000100, 0x00000040, 0x00000010, 0x00000000, - 0x000000dc, 0x00000000, 0x6d616c63, 0xab003070, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6d616c63, 0x63003170, 0x726f6c6f, 0x6c6f6300, - 0x0032726f, 0x6f5f6374, 0x4d006666, 0x6f726369, 0x74666f73, 0x29522820, - 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, - 0x392e3932, 0x332e3235, 0x00313131, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, 0x00000010, - 0x04000059, 0x00208e46, 0x00000001, 0x00000003, 0x03000065, 0x001020f2, - 0x00000000, 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000001, - 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_10[411] = { - 0x43425844, 0x06c32e7c, 0xd1fa07e2, 0x2d208e5f, 0x5002e2cc, 0x00000001, - 0x0000066c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000005f0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000240, 0x00000040, 0x00000090, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000038, 0x00100012, 0x00000000, 0x0010003a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x07000033, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001000f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000001, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000001, 0x00100656, 0x00000001, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000002, 0x00100596, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000002, 0x00100006, 0x00000001, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000003, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_11[343] = { - 0x43425844, 0xba36eafb, 0x7eb5939c, 0xf32591ec, 0x30eeb32a, 0x00000001, - 0x0000055c, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x000004e0, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740032, 0x74003078, 0x00327865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000017c, 0x00000040, 0x0000005f, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000002, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000002, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000001, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000038, 0x00100012, 0x00000000, 0x0010003a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x07000033, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f800000, 0x05000036, 0x00100022, 0x00000000, - 0x00004001, 0x3f000000, 0x09000045, 0x001020f2, 0x00000000, 0x00100046, - 0x00000000, 0x00107e46, 0x00000002, 0x00106000, 0x00000002, 0x0100003e, - 0x54415453, 0x00000074, 0x00000009, 0x00000001, 0x00000000, 0x00000002, - 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_16[435] = { - 0x43425844, 0x6063564a, 0xa8def096, 0xcca0d8e9, 0xfad099ba, 0x00000001, - 0x000006cc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000650, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002ec, 0x00000040, 0x000000bb, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000002, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000002, 0x00100e46, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000014, 0x00000003, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_17[433] = { - 0x43425844, 0x9d251e4d, 0x6df18823, 0x51817ea5, 0xa8eeefd8, 0x00000001, - 0x000006c4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000648, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002e4, 0x00000040, 0x000000b9, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, - 0x00000041, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100006, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x00000014, 0x00000002, 0x00000000, 0x00000002, - 0x0000000d, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_18[455] = { - 0x43425844, 0x01fc38b9, 0x9e8809ca, 0x9767109e, 0x3100f672, 0x00000001, - 0x0000071c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006a0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002f0, 0x00000040, 0x000000bc, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100012, - 0x00000002, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000003, 0x00000000, 0x00000002, 0x0000000b, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_19[453] = { - 0x43425844, 0x93b178e0, 0xac5fae3d, 0x5854ccdb, 0x646aa2b1, 0x00000001, - 0x00000714, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000698, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002e8, 0x00000040, 0x000000ba, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x08000000, 0x00100012, - 0x00000001, 0x8010003a, 0x00000041, 0x00000001, 0x00004001, 0x3f800000, - 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, 0x00100006, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000013, 0x00000002, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_20[447] = { - 0x43425844, 0x9a125209, 0xf5c56096, 0xd7eccf22, 0x9fa5961c, 0x00000001, - 0x000006fc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000680, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000031c, 0x00000040, 0x000000c7, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000000, 0x00100082, 0x00000000, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x00100072, - 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, 0x00000001, 0x09000032, - 0x00102072, 0x00000000, 0x00100246, 0x00000000, 0x00100ff6, 0x00000001, - 0x00100246, 0x00000001, 0x05000036, 0x00102082, 0x00000000, 0x0010003a, - 0x00000001, 0x0100003e, 0x54415453, 0x00000074, 0x00000016, 0x00000002, - 0x00000000, 0x00000002, 0x0000000d, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_21[425] = { - 0x43425844, 0x893ebdf3, 0x678513c8, 0xea77bccb, 0x915f5370, 0x00000001, - 0x000006a4, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000628, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002c4, 0x00000040, 0x000000b1, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000001, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000001, - 0x00106000, 0x00000001, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000002, 0x00000000, 0x00000002, 0x0000000c, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_22[467] = { - 0x43425844, 0x2b2ebefd, 0x99c6691a, 0xf5589278, 0x00bf4796, 0x00000001, - 0x0000074c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006d0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x00000320, 0x00000040, 0x000000c8, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000000, 0x00100082, 0x00000000, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x07000038, 0x00100072, 0x00000001, 0x00100ff6, 0x00000000, 0x00100246, - 0x00000001, 0x09000032, 0x00102072, 0x00000000, 0x00100246, 0x00000000, - 0x00100ff6, 0x00000001, 0x00100246, 0x00000001, 0x05000036, 0x00102082, - 0x00000000, 0x0010003a, 0x00000001, 0x0100003e, 0x54415453, 0x00000074, - 0x00000015, 0x00000002, 0x00000000, 0x00000002, 0x0000000c, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_23[445] = { - 0x43425844, 0xc733b29b, 0xcc301191, 0xb70dd0eb, 0xb530bacb, 0x00000001, - 0x000006f4, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x00000678, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002c8, 0x00000040, 0x000000b2, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000034, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000001, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x07000038, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00100ff6, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x00000012, 0x00000002, 0x00000000, 0x00000002, - 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_24[435] = { - 0x43425844, 0x19fff495, 0xbd100eb6, 0x9012a014, 0xcb173d4f, 0x00000001, - 0x000006cc, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000650, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740031, 0x74003078, 0x00317865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x000002ec, 0x00000040, 0x000000bb, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000003, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x05002036, 0x00100022, 0x00000000, 0x0010000a, - 0x00000000, 0x06002036, 0x00100012, 0x00000000, 0x8010000a, 0x00000041, - 0x00000000, 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, - 0x00208e46, 0x00000001, 0x00000003, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100006, 0x00000000, 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, - 0x00000001, 0x08000000, 0x00100012, 0x00000001, 0x8010003a, 0x00000041, - 0x00000000, 0x00004001, 0x3f800000, 0x08000034, 0x00100062, 0x00000001, - 0x00101106, 0x00000001, 0x00208106, 0x00000001, 0x00000001, 0x08000033, - 0x00100062, 0x00000001, 0x00100656, 0x00000001, 0x00208ba6, 0x00000001, - 0x00000001, 0x09000045, 0x001000f2, 0x00000002, 0x00100596, 0x00000001, - 0x00107e46, 0x00000001, 0x00106000, 0x00000001, 0x09000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000002, 0x00100006, 0x00000001, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000014, 0x00000003, - 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_25[367] = { - 0x43425844, 0x23e9ff30, 0xa49b9308, 0xc4b02a07, 0xfe240ca9, 0x00000001, - 0x000005bc, 0x00000005, 0x00000034, 0x00000284, 0x000002dc, 0x00000310, - 0x00000540, 0x46454452, 0x00000248, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000216, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000005, 0x0000017c, 0x00000050, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001f4, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001fb, 0x00000010, 0x00000010, 0x00000000, - 0x00000150, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x0000020f, 0x00000040, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, 0x6f630031, - 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, 0x4e475349, - 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, - 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000228, - 0x00000040, 0x0000008a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, - 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, - 0x00000002, 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000000, 0x00100032, - 0x00000000, 0x00101046, 0x00000001, 0x80208046, 0x00000041, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000000, 0x00100012, 0x00000000, 0x8010003a, - 0x00000041, 0x00000000, 0x0010003a, 0x00000001, 0x08000038, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, 0x00000001, 0x00000004, - 0x05002036, 0x00100022, 0x00000000, 0x0010000a, 0x00000000, 0x06002036, - 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x08000038, - 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, 0x00000001, - 0x00000003, 0x0a000032, 0x001020f2, 0x00000000, 0x00100006, 0x00000000, - 0x00208e46, 0x00000001, 0x00000002, 0x00100e46, 0x00000001, 0x0100003e, - 0x54415453, 0x00000074, 0x0000000f, 0x00000002, 0x00000000, 0x00000002, - 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_filter_26[455] = { - 0x43425844, 0x77befa0f, 0xa8c6f51f, 0x871b10c5, 0x56e7a09b, 0x00000001, - 0x0000071c, 0x00000005, 0x00000034, 0x0000031c, 0x00000374, 0x000003a8, - 0x000006a0, 0x46454452, 0x000002e0, 0x00000002, 0x0000014c, 0x00000008, - 0x0000001c, 0xffff0400, 0x00008100, 0x000002ae, 0x0000011c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000123, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x0000012a, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000131, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, - 0x00000136, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, - 0x00000001, 0x0000000d, 0x0000013b, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x00000140, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00000144, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x00000001, 0x65745f73, 0x73003078, 0x7865745f, 0x5f730031, - 0x32786574, 0x78657400, 0x65740030, 0x74003178, 0x00327865, 0x00635350, - 0x61726170, 0xababab00, 0x00000140, 0x00000004, 0x0000017c, 0x00000040, - 0x00000000, 0x00000000, 0x00000144, 0x00000005, 0x00000214, 0x00000050, - 0x00000000, 0x00000000, 0x000001dc, 0x00000000, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x000001f8, 0x00000010, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000202, 0x00000020, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x00000208, 0x00000030, 0x00000010, 0x00000000, - 0x000001e8, 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, - 0x006c6163, 0x63736572, 0x31656c61, 0xababab00, 0x0000028c, 0x00000000, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x00000293, 0x00000010, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x0000029a, 0x00000020, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a0, 0x00000030, - 0x00000010, 0x00000000, 0x000001e8, 0x00000000, 0x000002a7, 0x00000040, - 0x00000010, 0x00000002, 0x000001e8, 0x00000000, 0x6d616c63, 0x63003070, - 0x706d616c, 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, - 0x694d0066, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, - 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, - 0xab003131, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, - 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, - 0x52444853, 0x000002f0, 0x00000040, 0x000000bc, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, - 0x0300005a, 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000001, - 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000000, - 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, - 0x00107000, 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000003, 0x08000000, - 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000004, 0x08000034, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000000, 0x00100032, 0x00000000, 0x00101046, - 0x00000001, 0x80208046, 0x00000041, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x08000000, 0x00100012, 0x00000000, 0x8010003a, 0x00000041, 0x00000000, - 0x0010003a, 0x00000001, 0x08000038, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0020802a, 0x00000001, 0x00000004, 0x09002032, 0x00100012, - 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x3f000000, 0x00004001, - 0x3f000000, 0x05000036, 0x00100022, 0x00000000, 0x00004001, 0x3f000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000002, 0x00106000, 0x00000002, 0x08000000, 0x00100012, 0x00000001, - 0x8010003a, 0x00000041, 0x00000000, 0x00004001, 0x3f800000, 0x08000034, - 0x00100062, 0x00000001, 0x00101106, 0x00000001, 0x00208106, 0x00000001, - 0x00000001, 0x08000033, 0x00100062, 0x00000001, 0x00100656, 0x00000001, - 0x00208ba6, 0x00000001, 0x00000001, 0x09000045, 0x001000f2, 0x00000002, - 0x00100596, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000001, - 0x09000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000002, 0x00100006, - 0x00000001, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x00000013, 0x00000003, 0x00000000, 0x00000002, 0x0000000b, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_filter_27[387] = { - 0x43425844, 0xf3f7a1fb, 0xbd22ef0c, 0x3d9cc820, 0xe4ffde46, 0x00000001, - 0x0000060c, 0x00000005, 0x00000034, 0x000002d0, 0x00000328, 0x0000035c, - 0x00000590, 0x46454452, 0x00000294, 0x00000002, 0x00000100, 0x00000006, - 0x0000001c, 0xffff0400, 0x00008100, 0x00000262, 0x000000dc, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000e3, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000001, 0x00000001, 0x000000ea, 0x00000002, 0x00000005, 0x00000004, - 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x000000ef, 0x00000002, - 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, - 0x000000f4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000001, 0x000000f8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x65745f73, 0x73003078, - 0x7865745f, 0x65740032, 0x74003078, 0x00327865, 0x00635350, 0x61726170, - 0xababab00, 0x000000f4, 0x00000004, 0x00000130, 0x00000040, 0x00000000, - 0x00000000, 0x000000f8, 0x00000005, 0x000001c8, 0x00000050, 0x00000000, - 0x00000000, 0x00000190, 0x00000000, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001ac, 0x00000010, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001b6, 0x00000020, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x000001bc, 0x00000030, 0x00000010, 0x00000000, 0x0000019c, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0xababab00, 0x00000240, 0x00000000, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x00000247, 0x00000010, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000024e, 0x00000020, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x00000254, 0x00000030, 0x00000010, - 0x00000000, 0x0000019c, 0x00000000, 0x0000025b, 0x00000040, 0x00000010, - 0x00000002, 0x0000019c, 0x00000000, 0x6d616c63, 0x63003070, 0x706d616c, - 0x6f630031, 0x00726f6c, 0x6f6c6f63, 0x74003272, 0x666f5f63, 0x694d0066, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131, - 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, - 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, - 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, - 0x0000022c, 0x00000040, 0x0000008b, 0x04000059, 0x00208e46, 0x00000000, - 0x00000001, 0x04000059, 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, - 0x00106000, 0x00000000, 0x0300005a, 0x00106000, 0x00000002, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000002, - 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x02000068, 0x00000002, 0x08000000, 0x00100032, 0x00000000, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000004, 0x08000034, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000000, 0x00100046, 0x00000000, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000000, - 0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x09000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x80208046, - 0x00000041, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000000, - 0x00100046, 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000000, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000000, 0x00100012, - 0x00000000, 0x8010003a, 0x00000041, 0x00000000, 0x0010003a, 0x00000001, - 0x08000038, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x0020802a, - 0x00000001, 0x00000004, 0x09002032, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x00004001, 0x3f000000, 0x00004001, 0x3f000000, 0x05000036, - 0x00100022, 0x00000000, 0x00004001, 0x3f000000, 0x09000045, 0x001020f2, - 0x00000000, 0x00100046, 0x00000000, 0x00107e46, 0x00000002, 0x00106000, - 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000e, 0x00000002, - 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { - pshader_filter_0, - 1516, - }, - { - pshader_filter_1, - 1508, - }, - { - pshader_filter_2, - 1644, - }, - { - pshader_filter_3, - 1636, - }, - { - pshader_filter_4, - 1608, - }, - { - pshader_filter_5, - 1508, - }, - { - pshader_filter_6, - 1692, - }, - { - pshader_filter_7, - 1604, - }, - { - pshader_filter_8, - 984, - }, - { - pshader_filter_9, - 708, - }, - { - pshader_filter_10, - 1644, - }, - { - pshader_filter_11, - 1372, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - pshader_filter_16, - 1740, - }, - { - pshader_filter_17, - 1732, - }, - { - pshader_filter_18, - 1820, - }, - { - pshader_filter_19, - 1812, - }, - { - pshader_filter_20, - 1788, - }, - { - pshader_filter_21, - 1700, - }, - { - pshader_filter_22, - 1868, - }, - { - pshader_filter_23, - 1780, - }, - { - pshader_filter_24, - 1740, - }, - { - pshader_filter_25, - 1468, - }, - { - pshader_filter_26, - 1820, - }, - { - pshader_filter_27, - 1548, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - NULL, - 0, - }, -}; - -static DWORD pshader_blur_2[320] = { - 0x43425844, 0x67a35e3a, 0x560d90ec, 0x256f19fd, 0x4a310ce8, 0x00000001, - 0x00000500, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000484, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000001b8, 0x00000040, - 0x0000006e, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000003, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000002, 0x00000007, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_3[363] = { - 0x43425844, 0xceb6aa80, 0x47281357, 0x6546706b, 0x9a86cc96, 0x00000001, - 0x000005ac, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000530, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000264, 0x00000040, - 0x00000099, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000004, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000010, 0x00000002, - 0x00000000, 0x00000002, 0x0000000a, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_4[406] = { - 0x43425844, 0x28bb4db6, 0x76164852, 0x9c2d5fab, 0x2f864c24, 0x00000001, - 0x00000658, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x000005dc, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000310, 0x00000040, - 0x000000c4, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000005, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000015, - 0x00000002, 0x00000000, 0x00000002, 0x0000000d, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_5[449] = { - 0x43425844, 0x750da756, 0x7d011ff8, 0xac8d5660, 0x8246b36e, 0x00000001, - 0x00000704, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000688, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000003bc, 0x00000040, - 0x000000ef, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000006, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000001a, 0x00000002, 0x00000000, 0x00000002, 0x00000010, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000005, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_6[492] = { - 0x43425844, 0xaa04fad9, 0xf1b31202, 0xbebf01fc, 0xc2f4f30e, 0x00000001, - 0x000007b0, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000734, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000468, 0x00000040, - 0x0000011a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000007, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x0100003e, 0x54415453, - 0x00000074, 0x0000001f, 0x00000002, 0x00000000, 0x00000002, 0x00000013, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_7[535] = { - 0x43425844, 0xd887ebb4, 0xc4924177, 0xe04802c2, 0xf91cc99d, 0x00000001, - 0x0000085c, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x000007e0, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000514, 0x00000040, - 0x00000145, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000008, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x0100003e, - 0x54415453, 0x00000074, 0x00000024, 0x00000002, 0x00000000, 0x00000002, - 0x00000016, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, -}; - -static DWORD pshader_blur_8[578] = { - 0x43425844, 0x27ab5347, 0x36a0e6bc, 0xb93d307d, 0xb1f00bc0, 0x00000001, - 0x00000908, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x0000088c, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x000005c0, 0x00000040, - 0x00000170, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x00000009, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000008, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000008, 0x00100e46, 0x00000000, - 0x0100003e, 0x54415453, 0x00000074, 0x00000029, 0x00000002, 0x00000000, - 0x00000002, 0x00000019, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static DWORD pshader_blur_9[621] = { - 0x43425844, 0xab49c198, 0x28ead186, 0xcdcc1184, 0x605159a1, 0x00000001, - 0x000009b4, 0x00000005, 0x00000034, 0x00000238, 0x00000290, 0x000002c4, - 0x00000938, 0x46454452, 0x000001fc, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001c8, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000002, 0x0000017c, 0x000000a0, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x000001ac, 0x00000000, 0x00000010, 0x00000002, - 0x00000150, 0x00000000, 0x000001b3, 0x00000010, 0x00000090, 0x00000002, - 0x000001b8, 0x00000000, 0x6d616c63, 0x74007670, 0xab007061, 0x00030001, - 0x00040001, 0x00000009, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, - 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, - 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, - 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, - 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x0000066c, 0x00000040, - 0x0000019b, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, - 0x00208e46, 0x00000001, 0x0000000a, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, - 0x08000000, 0x00100032, 0x00000000, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000002, 0x08000034, 0x00100032, 0x00000000, 0x00100046, - 0x00000000, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000000, 0x00100046, 0x00000000, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000000, 0x00100046, 0x00000000, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000000, 0x00208aa6, 0x00000001, 0x00000002, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000001, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000001, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000003, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000003, 0x00100e46, - 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, - 0x00208046, 0x00000001, 0x00000004, 0x08000034, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, - 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000004, - 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, 0x00101046, - 0x00000001, 0x00208046, 0x00000001, 0x00000005, 0x08000034, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, 0x00000000, - 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, - 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00100046, - 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x0a000032, - 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, - 0x00000005, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, 0x00000001, - 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000006, 0x08000034, - 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, 0x00000001, - 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, - 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, 0x00208aa6, - 0x00000001, 0x00000006, 0x00100e46, 0x00000000, 0x08000000, 0x00100032, - 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, 0x00000007, - 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, 0x00208046, - 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, 0x00000001, - 0x00208aa6, 0x00000001, 0x00000007, 0x00100e46, 0x00000000, 0x08000000, - 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, 0x00000001, - 0x00000008, 0x08000034, 0x00100032, 0x00000001, 0x00100046, 0x00000001, - 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, 0x00000001, - 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, 0x09000045, - 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x0a000032, 0x001000f2, 0x00000000, 0x00100e46, - 0x00000001, 0x00208aa6, 0x00000001, 0x00000008, 0x00100e46, 0x00000000, - 0x08000000, 0x00100032, 0x00000001, 0x00101046, 0x00000001, 0x00208046, - 0x00000001, 0x00000009, 0x08000034, 0x00100032, 0x00000001, 0x00100046, - 0x00000001, 0x00208046, 0x00000001, 0x00000000, 0x08000033, 0x00100032, - 0x00000001, 0x00100046, 0x00000001, 0x00208ae6, 0x00000001, 0x00000000, - 0x09000045, 0x001000f2, 0x00000001, 0x00100046, 0x00000001, 0x00107e46, - 0x00000000, 0x00106000, 0x00000000, 0x0a000032, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00208aa6, 0x00000001, 0x00000009, 0x00100e46, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000002e, 0x00000002, - 0x00000000, 0x00000002, 0x0000001c, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { - NULL, - 0, - }, - { - NULL, - 0, - }, - { - pshader_blur_2, - 1280, - }, - { - pshader_blur_3, - 1452, - }, - { - pshader_blur_4, - 1624, - }, - { - pshader_blur_5, - 1796, - }, - { - pshader_blur_6, - 1968, - }, - { - pshader_blur_7, - 2140, - }, - { - pshader_blur_8, - 2312, - }, - { - pshader_blur_9, - 2484, - }, -}; - -static DWORD pshader_color_matrix_0[308] = { - 0x43425844, 0x5b914181, 0xde722329, 0xe875a0ba, 0xa156b551, 0x00000001, - 0x000004d0, 0x00000005, 0x00000034, 0x0000021c, 0x00000274, 0x000002a8, - 0x00000454, 0x46454452, 0x000001e0, 0x00000002, 0x000000b4, 0x00000004, - 0x0000001c, 0xffff0400, 0x00008100, 0x000001ac, 0x0000009c, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x000000a3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, - 0x00000001, 0x0000000d, 0x000000a8, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000ac, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, - 0x65745f73, 0x74003078, 0x00307865, 0x00635350, 0x61726170, 0xababab00, - 0x000000a8, 0x00000004, 0x000000e4, 0x00000040, 0x00000000, 0x00000000, - 0x000000ac, 0x00000001, 0x0000017c, 0x00000050, 0x00000000, 0x00000000, - 0x00000144, 0x00000000, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000160, 0x00000010, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x0000016a, 0x00000020, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x00000170, 0x00000030, 0x00000010, 0x00000000, 0x00000150, 0x00000000, - 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, 0x00000000, - 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, 0x63736572, - 0x31656c61, 0xababab00, 0x00000194, 0x00000000, 0x00000050, 0x00000002, - 0x0000019c, 0x00000000, 0x61746164, 0xababab00, 0x00030001, 0x00040001, - 0x00000005, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, - 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e39322e, - 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x000001a4, 0x00000040, 0x00000069, - 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x04000059, 0x00208e46, - 0x00000001, 0x00000005, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, - 0x00107000, 0x00000000, 0x00005555, 0x03001062, 0x00101032, 0x00000001, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, - 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x08000011, 0x00100012, 0x00000001, 0x00208e46, - 0x00000001, 0x00000000, 0x00100e46, 0x00000000, 0x0a000032, 0x00100012, - 0x00000001, 0x0020800a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010000a, 0x00000001, 0x08000011, 0x00100082, 0x00000001, 0x00208e46, - 0x00000001, 0x00000001, 0x00100e46, 0x00000000, 0x0a000032, 0x00100022, - 0x00000001, 0x0020801a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010003a, 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00208e46, - 0x00000001, 0x00000002, 0x00100e46, 0x00000000, 0x0a000032, 0x00100042, - 0x00000001, 0x0020802a, 0x00000001, 0x00000004, 0x0010003a, 0x00000000, - 0x0010000a, 0x00000000, 0x08000038, 0x00102082, 0x00000000, 0x0010003a, - 0x00000000, 0x0020803a, 0x00000001, 0x00000003, 0x08000038, 0x00102072, - 0x00000000, 0x00100246, 0x00000001, 0x00208ff6, 0x00000001, 0x00000003, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, - 0x00000002, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_color_matrix_arr[1] = { - { - pshader_color_matrix_0, - 1232, - }, -}; - -static DWORD pshader_manual_clear_0[171] = { - 0x43425844, 0xeb343b5a, 0xfec80b96, 0xf65a4d5b, 0xb96aacbe, 0x00000001, - 0x000002ac, 0x00000005, 0x00000034, 0x0000015c, 0x000001b4, 0x000001e8, - 0x00000230, 0x46454452, 0x00000120, 0x00000001, 0x00000040, 0x00000001, - 0x0000001c, 0xffff0400, 0x00008100, 0x000000ed, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x00635350, 0x0000003c, 0x00000004, 0x00000058, 0x00000040, 0x00000000, - 0x00000000, 0x000000b8, 0x00000000, 0x00000010, 0x00000002, 0x000000c4, - 0x00000000, 0x000000d4, 0x00000010, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x000000de, 0x00000020, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x000000e4, 0x00000030, 0x00000010, 0x00000000, 0x000000c4, - 0x00000000, 0x6f6c6f63, 0x756d5f72, 0xabab006c, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6f6c6f63, 0x64615f72, 0x6f660064, 0x006c6163, - 0x63736572, 0x31656c61, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, - 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, - 0x3235392e, 0x3131332e, 0xabab0031, 0x4e475349, 0x00000050, 0x00000002, - 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, - 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, - 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, 0x00000010, - 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, - 0x00000000, 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations pshader_manual_clear_arr[1] = { - { - pshader_manual_clear_0, - 684, - }, -}; - -static DWORD vshader_vsd3d10_0[305] = { - 0x43425844, 0xbcb06f4b, 0x808953d6, 0x687571c0, 0x1b5b041c, 0x00000001, - 0x000004c4, 0x00000005, 0x00000034, 0x000001cc, 0x00000200, 0x00000258, - 0x00000448, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0xababab00, 0x4e47534f, 0x00000050, 0x00000002, 0x00000008, - 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, - 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, - 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, 0xababab00, - 0x52444853, 0x000001e8, 0x00010040, 0x0000007a, 0x04000059, 0x00208e46, - 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, - 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, - 0x02000068, 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00101e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000001, 0x08000038, 0x00100072, - 0x00000000, 0x00100006, 0x00000000, 0x00208246, 0x00000000, 0x00000006, - 0x08000011, 0x00100082, 0x00000000, 0x00101e46, 0x00000000, 0x00208e46, - 0x00000000, 0x00000000, 0x0a000032, 0x00100072, 0x00000000, 0x00100ff6, - 0x00000000, 0x00208246, 0x00000000, 0x00000005, 0x00100246, 0x00000000, - 0x08000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00208246, - 0x00000000, 0x00000007, 0x0a00000e, 0x00100042, 0x00000000, 0x00004002, - 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x0010002a, 0x00000000, - 0x07000038, 0x00102032, 0x00000000, 0x00100aa6, 0x00000000, 0x00100046, - 0x00000000, 0x06000036, 0x00102042, 0x00000000, 0x0020802a, 0x00000000, - 0x00000000, 0x05000036, 0x00102082, 0x00000000, 0x00004001, 0x3f800000, - 0x08000011, 0x00100012, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x00101e46, 0x00000000, 0x08000011, 0x00100022, 0x00000000, 0x00208e46, - 0x00000000, 0x00000004, 0x00101e46, 0x00000000, 0x07000038, 0x00102032, - 0x00000001, 0x00100aa6, 0x00000000, 0x00100046, 0x00000000, 0x05000036, - 0x00102082, 0x00000001, 0x0010002a, 0x00000000, 0x05000036, 0x00102042, - 0x00000001, 0x00004001, 0x3f800000, 0x0100003e, 0x54415453, 0x00000074, - 0x0000000f, 0x00000001, 0x00000000, 0x00000003, 0x00000009, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD vshader_vsd3d10_1[417] = { - 0x43425844, 0x79f68211, 0x83ecd840, 0x5fea9f88, 0xed27bac2, 0x00000001, - 0x00000684, 0x00000005, 0x00000034, 0x000001cc, 0x00000220, 0x00000278, - 0x00000608, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, - 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x0000070f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0xabab0044, 0x4e47534f, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x52444853, 0x00000388, 0x00010040, 0x000000e2, - 0x04000059, 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, - 0x00000000, 0x0300005f, 0x00101072, 0x00000001, 0x04000067, 0x001020f2, - 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x02000068, - 0x00000003, 0x0500002b, 0x00100072, 0x00000000, 0x00101496, 0x00000001, - 0x0a000038, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, - 0x3c800000, 0x3c800000, 0x3d000000, 0x00000000, 0x0800000f, 0x00100012, - 0x00000001, 0x00100046, 0x00000000, 0x00208046, 0x00000000, 0x00000002, - 0x0800000f, 0x00100022, 0x00000001, 0x00100046, 0x00000000, 0x00208ae6, - 0x00000000, 0x00000002, 0x0800000f, 0x00100012, 0x00000002, 0x00100046, - 0x00000001, 0x00208046, 0x00000000, 0x00000000, 0x0800000f, 0x00100022, - 0x00000002, 0x00100046, 0x00000001, 0x00208046, 0x00000000, 0x00000001, - 0x0700000f, 0x00100082, 0x00000000, 0x00100046, 0x00000002, 0x00100046, - 0x00000002, 0x0500004b, 0x00100082, 0x00000000, 0x0010003a, 0x00000000, - 0x0a000039, 0x00100012, 0x00000001, 0x00004002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x0010003a, 0x00000000, 0x09000037, 0x00100082, - 0x00000000, 0x0010000a, 0x00000001, 0x0010003a, 0x00000000, 0x00004001, - 0x3f800000, 0x0700000f, 0x00100012, 0x00000000, 0x00100046, 0x00000000, - 0x00100046, 0x00000000, 0x0500004b, 0x00100012, 0x00000000, 0x0010000a, - 0x00000000, 0x0700000e, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, - 0x0010003a, 0x00000000, 0x08000011, 0x00100012, 0x00000001, 0x00101e46, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x08000011, 0x00100022, - 0x00000001, 0x00101e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000001, - 0x09000032, 0x00100032, 0x00000000, 0x00100046, 0x00000002, 0x00100006, - 0x00000000, 0x00100046, 0x00000001, 0x08000038, 0x00100072, 0x00000001, - 0x00100556, 0x00000000, 0x00208246, 0x00000000, 0x00000006, 0x0a000032, - 0x001000b2, 0x00000000, 0x00100006, 0x00000000, 0x00208846, 0x00000000, - 0x00000005, 0x00100846, 0x00000001, 0x08000000, 0x001000b2, 0x00000000, - 0x00100c46, 0x00000000, 0x00208846, 0x00000000, 0x00000007, 0x0a00000e, - 0x00100082, 0x00000000, 0x00004002, 0x3f800000, 0x3f800000, 0x3f800000, - 0x3f800000, 0x0010003a, 0x00000000, 0x07000038, 0x00102032, 0x00000000, - 0x00100ff6, 0x00000000, 0x00100046, 0x00000000, 0x06000036, 0x00102042, - 0x00000000, 0x0020802a, 0x00000000, 0x00000000, 0x05000036, 0x00102082, - 0x00000000, 0x00004001, 0x3f800000, 0x08000011, 0x00100012, 0x00000000, - 0x00208e46, 0x00000000, 0x00000003, 0x00101e46, 0x00000000, 0x08000011, - 0x00100022, 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00101e46, - 0x00000000, 0x07000038, 0x00102072, 0x00000001, 0x00100ff6, 0x00000000, - 0x00100246, 0x00000000, 0x05000036, 0x00102082, 0x00000001, 0x0010003a, - 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x0000001c, 0x00000003, - 0x00000000, 0x00000004, 0x00000013, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, -}; - -static DWORD vshader_vsd3d10_2[300] = { - 0x43425844, 0x50edc469, 0x3be0d512, 0xffa16ac1, 0x10a3602c, 0x00000001, - 0x000004b0, 0x00000005, 0x00000034, 0x000001cc, 0x00000220, 0x00000278, - 0x00000434, 0x46454452, 0x00000190, 0x00000001, 0x00000044, 0x00000001, - 0x0000001c, 0xfffe0400, 0x00008100, 0x0000015f, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, - 0x61726170, 0xababab00, 0x0000003c, 0x00000008, 0x0000005c, 0x00000080, - 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000134, 0x00000010, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000013b, 0x00000020, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000141, 0x00000030, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x0000014a, 0x00000040, 0x00000010, 0x00000000, - 0x00000124, 0x00000000, 0x00000153, 0x00000050, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x00000157, 0x00000060, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x0000015b, 0x00000070, 0x00000010, 0x00000002, - 0x00000124, 0x00000000, 0x6c726f77, 0xab003064, 0x00030001, 0x00040001, - 0x00000000, 0x00000000, 0x6c726f77, 0x78003164, 0x66666f5f, 0x78657400, - 0x5f6e6567, 0x65740073, 0x6e656778, 0x7800745f, 0x79006433, 0x77006433, - 0x4d006433, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, - 0x00313131, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000030f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0xabab0044, 0x4e47534f, 0x00000050, - 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, - 0x00000001, 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, - 0x44524f4f, 0xababab00, 0x52444853, 0x000001b4, 0x00010040, 0x0000006d, - 0x04000059, 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x001010f2, - 0x00000000, 0x0300005f, 0x00101032, 0x00000001, 0x04000067, 0x001020f2, - 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x02000068, - 0x00000001, 0x08000011, 0x00100012, 0x00000000, 0x00101e46, 0x00000000, - 0x00208e46, 0x00000000, 0x00000001, 0x08000038, 0x00100072, 0x00000000, - 0x00100006, 0x00000000, 0x00208246, 0x00000000, 0x00000006, 0x08000011, - 0x00100082, 0x00000000, 0x00101e46, 0x00000000, 0x00208e46, 0x00000000, - 0x00000000, 0x0a000032, 0x00100072, 0x00000000, 0x00100ff6, 0x00000000, - 0x00208246, 0x00000000, 0x00000005, 0x00100246, 0x00000000, 0x08000000, - 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00208246, 0x00000000, - 0x00000007, 0x0a00000e, 0x00100042, 0x00000000, 0x00004002, 0x3f800000, - 0x3f800000, 0x3f800000, 0x3f800000, 0x0010002a, 0x00000000, 0x07000038, - 0x00102032, 0x00000000, 0x00100aa6, 0x00000000, 0x00100046, 0x00000000, - 0x06000036, 0x00102042, 0x00000000, 0x0020802a, 0x00000000, 0x00000000, - 0x05000036, 0x00102082, 0x00000000, 0x00004001, 0x3f800000, 0x07000038, - 0x00102032, 0x00000001, 0x00100aa6, 0x00000000, 0x00101046, 0x00000001, - 0x05000036, 0x00102082, 0x00000001, 0x0010002a, 0x00000000, 0x05000036, - 0x00102042, 0x00000001, 0x00004001, 0x3f800000, 0x0100003e, 0x54415453, - 0x00000074, 0x0000000d, 0x00000001, 0x00000000, 0x00000004, 0x00000007, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static ProgramWithCachedVariableLocations vshader_vsd3d10_arr[3] = { - { - vshader_vsd3d10_0, - 1220, - }, - { - vshader_vsd3d10_1, - 1668, - }, - { - vshader_vsd3d10_2, - 1200, - }, -}; diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp deleted file mode 100644 index d70bb5d3d..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include "minecraft/stdafx.h" // 4J - -// gdraw_d3d11.cpp - author: Fabian Giesen - copyright 2011 RAD Game Tools -// -// This implements the Iggy graphics driver layer for D3D 11. - -// GDraw consists of several components that interact fairly loosely with each -// other; e.g. the resource management, drawing and filtering parts are all -// fairly independent of each other. If you want to modify some aspect of GDraw -// - say the texture allocation logic - your best bet is usually to just look -// for one of the related entry points, e.g. MakeTextureBegin, and take it from -// there. There's a bunch of code in this file, but none of it is really -// complicated. -// -// The one bit you might want to change that's not that localized is to -// integrate GDraw with an existing state caching system. The following bits all -// modify D3D state in some way: -// - The rendering helpers (set_viewport_raw, set_projection_raw, -// set_*_renderstate) -// - RenderTile*/TextureDrawBuffer* may change the active rendertarget and -// depth/stencil surface, -// as do D3D1X_(NoMoreGDrawThisFrame) and set_render_target -// - set_texture -// - set_renderstate and set_renderstate_full. These are the main places where -// render state changes occur; -// you should probably start here. -// - DrawIndexedTriangles sets the active vertex/index buffers and vertex -// declaration -// - Most of the functions in the "filter effects" section modify D3D state, -// mostly -// pixel shader constants and textures - -#define GDRAW_ASSERTS - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -// We temporarily disable this warning for the shared interface portions -#pragma warning(push) -#pragma warning( \ - disable : 4201) // nonstandard extension used : nameless struct/union - -#include -#include -#include -#include - -#include "../include/gdraw.h" -#include "../include/iggy.h" -#include "gdraw_d3d11.h" - -#pragma warning(pop) - -// Some macros to allow as much sharing between D3D10 and D3D11 code as -// possible. -#define D3D1X_(id) D3D11_##id -#define ID3D1X(id) ID3D11##id -#define gdraw_D3D1X_(id) gdraw_D3D11_##id -#define GDRAW_D3D1X_(id) GDRAW_D3D11_##id - -typedef ID3D11Device ID3D1XDevice; -typedef ID3D11DeviceContext ID3D1XContext; -typedef F32 ViewCoord; -typedef gdraw_d3d11_resourcetype gdraw_resourcetype; - -static void report_d3d_error(HRESULT hr, char* call, char* context); - -static void* map_buffer(ID3D1XContext* ctx, ID3D11Buffer* buf, bool discard) { - D3D11_MAPPED_SUBRESOURCE msr; - HRESULT hr = ctx->Map( - buf, 0, - discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, - &msr); - if (FAILED(hr)) { - report_d3d_error(hr, "Map", "of buffer"); - return NULL; - } else - return msr.pData; -} - -static void unmap_buffer(ID3D1XContext* ctx, ID3D11Buffer* buf) { - ctx->Unmap(buf, 0); -} - -static RADINLINE void set_pixel_shader(ID3D11DeviceContext* ctx, - ID3D11PixelShader* shader) { - ctx->PSSetShader(shader, NULL, 0); -} - -static RADINLINE void set_vertex_shader(ID3D11DeviceContext* ctx, - ID3D11VertexShader* shader) { - ctx->VSSetShader(shader, NULL, 0); -} - -static ID3D11BlendState* create_blend_state(ID3D11Device* dev, BOOL blend, - D3D11_BLEND src, D3D11_BLEND dst) { - D3D11_BLEND_DESC desc = {}; - desc.RenderTarget[0].BlendEnable = blend; - desc.RenderTarget[0].SrcBlend = src; - desc.RenderTarget[0].DestBlend = dst; - desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - desc.RenderTarget[0].SrcBlendAlpha = - (src == D3D11_BLEND_DEST_COLOR) ? D3D11_BLEND_DEST_ALPHA : src; - desc.RenderTarget[0].DestBlendAlpha = dst; - desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - - ID3D11BlendState* res; - HRESULT hr = dev->CreateBlendState(&desc, &res); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBlendState", ""); - res = NULL; - } - - return res; -} - -#define GDRAW_SHADER_FILE "gdraw_d3d10_shaders.inl" -#include "gdraw_d3d1x_shared.inl" - -static void create_pixel_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src) { - *p = *src; - if (p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, - NULL, &p->pshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = NULL; - return; - } - } -} - -static void create_vertex_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src) { - *p = *src; - if (p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, - NULL, &p->vshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = NULL; - return; - } - } -} - -GDrawFunctions* gdraw_D3D11_CreateContext(ID3D11Device* dev, - ID3D11DeviceContext* ctx, S32 w, - S32 h) { - return create_context(dev, ctx, w, h); -} - -// 4J added - interface so we can set the viewport back to the one that Iggy -// last set up -void gdraw_D3D11_setViewport_4J() { set_viewport(); } diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h b/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h deleted file mode 100644 index 0c5b12493..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d11.h +++ /dev/null @@ -1,162 +0,0 @@ -#pragma once // 4J - -// gdraw_d3d11.h - author: Fabian Giesen - copyright 2011 RAD Game Tools -// -// Interface for creating a D3D11 GDraw driver. - -#define IDOC -// idoc(parent,GDraw_d3d11) - -typedef enum gdraw_d3d11_resourcetype { - GDRAW_D3D11_RESOURCE_rendertarget, - GDRAW_D3D11_RESOURCE_texture, - GDRAW_D3D11_RESOURCE_vertexbuffer, - GDRAW_D3D11_RESOURCE_dynbuffer, // Streaming buffer for dynamic - // vertex/index data (handle count ignored) - - GDRAW_D3D11_RESOURCE__count, -} gdraw_d3d11_resourcetype; - -IDOC extern int gdraw_D3D11_SetResourceLimits(gdraw_d3d11_resourcetype type, - S32 num_handles, S32 num_bytes); -/* This sets how large the memory pool for a given resource types is, and how - many handles GDraw should allocate for it. GDraw keeps track of allocations - in each pool, and will free old resources in a LRU manner to make space if - one of the limits is about to be exceeded. - - Returns 1 if value successfully changed, 0 on error. - You need to call IggyPlayerFlushAll on all active Iggys before you do this to - make them flush their resources since changing the resource limits - invalidates all handles. You also need to call IggyFlushInstalledFonts if you - have any installed fonts. -*/ - -IDOC extern GDrawFunctions* gdraw_D3D11_CreateContext(ID3D11Device* dev, - ID3D11DeviceContext* ctx, - S32 w, S32 h); -/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D - device, the device context to use for rendering, and the width/height of - render target textures. - - The width/height is used solely for sizing internal rendertargets. They will - be allocated to the larger of this size and the size of any rendered tiles - (with padding). In other words, you can pass in (0,0) and the rendertargets - will be allocated to the right size. However, if you draw multiple Iggy files - or tiles of different sizes, they might first be allocated too small; it's - best to pass in the correct size initially to avoid unnecessary - allocation/deallocation of too-small rendertargets. - - There can only be one D3D GDraw context active at any one time. - - If initialization fails for some reason (the main reason would be an out of - memory condition), NULL is returned. Otherwise, you can pass the return value - to IggySetGDraw. */ - -IDOC extern void gdraw_D3D11_DestroyContext(void); -/* Destroys the current GDraw context, if any. */ - -IDOC extern void gdraw_D3D11_SetErrorHandler( - void(__cdecl* error_handler)(HRESULT hr)); -/* Sets the GDraw D3D error handler. - - This will get called with the respective D3D error code if GDraw encounters - an error that it can't handle by itself (e.g. running out of state objects). - */ - -IDOC extern void gdraw_D3D11_SetRendertargetSize(S32 w, S32 h); -/* Changes the current render target size (and recreates all rendertargets if - necessary). This allows you to shrink the rendertargets if the new needed - size is smaller than it was previously. As with $gdraw_D3D11_CreateContext, - the width and height specified here are only minimums; GDraw will reallocate - larger rendertargets as needed. */ - -IDOC extern void gdraw_D3D11_SetTileOrigin( - ID3D11RenderTargetView* main_rt, ID3D11DepthStencilView* main_ds, - ID3D11ShaderResourceView* non_msaa_rt, S32 x, S32 y); -/* This sets the main rendertarget and matching depth/stencil buffer that GDraw - should render to and the x/y position of the output location of the top-left - of the current tile (allowing you to finely-position content, or to do tiled - rendering). - - If your rendertarget uses multisampling, you also need to specify a shader - resource view for a non-MSAA rendertarget texture (identically sized to - main_rt) in non_msaa_rt. This is only used if the Flash content includes - non-standard blend modes which have to use a special blend shader, so you can - leave it NULL if you forbid such content. - - You need to call this before Iggy calls any rendering functions. */ - -IDOC extern void gdraw_D3D11_NoMoreGDrawThisFrame(void); -/* Tells GDraw that no more rendering operations will occur this frame. This - triggers some end-of-frame processing; most importantly, GDraw uses this call - as a marker to detect thrashing (and react accordingly), so please do not - forget to call this every frame! (As long as Iggy does any rendering, that - is) */ - -IDOC extern void gdraw_D3D11_PreReset(void); -/* Call this before D3D device Reset(); it will free all default pool resources - allocated by GDraw. */ - -IDOC extern void gdraw_D3D11_PostReset(void); -/* Call after D3D device Reset(). */ - -IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw_4J( - IggyCustomDrawCallbackRegion* Region, F32 mat[16]); -IDOC extern void RADLINK gdraw_D3D11_CalculateCustomDraw_4J( - IggyCustomDrawCallbackRegion* Region, F32 mat[16]); -IDOC extern void RADLINK gdraw_D3D11_BeginCustomDraw( - IggyCustomDrawCallbackRegion* Region, F32 mat[4][4]); -/* Call at the beginning of Iggy custom draw callback to clear any odd render - states GDraw has set on the D3D device, and to get the current 2D - object-to-world transformation. */ - -IDOC extern void RADLINK -gdraw_D3D11_EndCustomDraw(IggyCustomDrawCallbackRegion* Region); -/* Call at the end of Iggy custom draw callback so GDraw can restore its render - * states. */ - -IDOC extern void RADLINK gdraw_D3D11_GetResourceUsageStats( - gdraw_d3d11_resourcetype type, S32* handles_used, S32* bytes_used); -/* D3D only: Get resource usage stats for last frame. - This can be used to get an estimate of how much graphics memory got used by - GDraw during the last frame. - - For the dynbuffer, this always returns 0 in handles_used and the *size of the - largest single allocation* in bytes_used. It needs to be sized so that this - allocation fits; make it smaller and it won't work, but if you make it much - larger (say more than 2x as big), it's just a waste of memory. That said, we - still recommend to make it no smaller than 64k, and the default is 256k. - - Caveat: This counts the number of bytes that GDraw knows about. 3D hardware - usually has its own management overhead, alignment requirements, allocation - granularity and so on. In short, this is not an accurate estimate of how much - memory is actually used by the GPU - it is a lower bound, though, and makes - for a useful ballpark estimate. */ - -IDOC extern GDrawTexture* gdraw_D3D11_WrappedTextureCreate( - ID3D11ShaderResourceView* tex_view); -/* Create a wrapped texture from a shader resource view. - A wrapped texture can be used to let Iggy draw using the contents of a - texture you create and manage on your own. For example, you might render to - 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. */ - -IDOC extern void gdraw_D3D11_WrappedTextureChange( - GDrawTexture* tex, ID3D11ShaderResourceView* tex_view); -/* Switch an existing GDrawTexture * that represents a wrapped texture to use - a new underlying D3D view. For example, you might internally double-buffer - a dynamically updated texture. As above, GDraw will leave this texture alone - and not touch any reference counts. */ - -IDOC extern void gdraw_D3D11_WrappedTextureDestroy(GDrawTexture* tex); -/* Destroys the GDraw wrapper for a wrapped texture object. This will free up - a GDraw texture handle but not release the associated D3D texture; that is - up to you. */ - -GDrawTexture* RADLINK gdraw_D3D11_MakeTextureFromResource( - U8* resource_file, S32 length, IggyFileTextureRaw* texture); -void RADLINK gdraw_D3D11_DestroyTextureFromResource(GDrawTexture* tex); - -// 4J added -extern void RADLINK gdraw_D3D11_setViewport_4J(); \ No newline at end of file diff --git a/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl b/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl deleted file mode 100644 index 9f3cba01f..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ /dev/null @@ -1,2722 +0,0 @@ -// gdraw_d3d1x_shared.inl - author: Fabian Giesen - copyright 2012 RAD Game -// Tools -// -// This file implements the part of the Iggy graphics driver layer shared -// between D3D10 and 11 (which is most of it). It heavily depends on a bunch of -// typedefs, #defines and utility functions that need to be set up correctly for -// the D3D version being targeted. This is a bit ugly, but much easier to -// maintain than the original solution, where we just kept two almost identical -// versions of this code. - -// That native handle type holds resource handles and a coarse description. -typedef union { - // handle that is a texture - struct { - ID3D1X(Texture2D) * d3d; - ID3D1X(ShaderResourceView) * d3d_view; - ID3D1X(RenderTargetView) * d3d_rtview; - U32 w, h; - } tex; - - // handle that is a vertex buffer - struct { - ID3D1X(Buffer) * verts; - ID3D1X(Buffer) * inds; - } vbuf; -} GDrawNativeHandle; - -#define GDRAW_NO_STREAMING_MIPGEN // This renderer doesn't use GDraw-internal - // mipmap generation -#include "gdraw_shared.inl" - -// max rendertarget stack depth. this depends on the extent to which you -// use filters and non-standard blend modes, and how nested they are. -#define MAX_RENDER_STACK_DEPTH \ - 8 // Iggy is hardcoded to a limit of 16... probably 1-3 is realistic -#define AATEX_SAMPLER 7 // sampler that aa_tex gets set in -#define STENCIL_STATE_CACHE_SIZE \ - 32 // number of distinct stencil states we cache DepthStencilStates for -#define QUAD_IB_COUNT 2048 // quad index buffer has indices for this many quads - -#define ASSERT_COUNT(a, b) ((a) == (b) ? (b) : -1) - -static GDrawFunctions gdraw_funcs; - -// render target state -typedef struct { - GDrawHandle* color_buffer; - S32 base_x, base_y, width, height; - U32 flags; - rrbool cached; -} GDrawFramebufferState; - -struct ProgramWithCachedVariableLocations { - DWORD* bytecode; - union { - DWORD size; - ID3D1X(PixelShader) * pshader; - ID3D1X(VertexShader) * vshader; - }; -}; - -struct DynBuffer { - ID3D1X(Buffer) * buffer; - U32 size; // size of buffer - U32 write_pos; // start of most recently allocated chunk - U32 alloc_pos; // end of most recently allocated chunk (=start of next - // allocation) -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// GDraw data structure -// -// -// This is the primary rendering abstraction, which hides all -// the platform-specific rendering behavior from Iggy. It is -// full of platform-specific graphics state, and also general -// graphics state so that it doesn't have to callback into Iggy -// to get at that graphics state. - -typedef struct { - ID3D1XDevice* d3d_device; - ID3D1XContext* d3d_context; - - // fragment shaders - ProgramWithCachedVariableLocations fprog[GDRAW_TEXTURE__count][3]; - ProgramWithCachedVariableLocations - exceptional_blend[GDRAW_BLENDSPECIAL__count]; - ProgramWithCachedVariableLocations filter_prog[2][16]; - ProgramWithCachedVariableLocations blur_prog[MAX_TAPS + 1]; - ProgramWithCachedVariableLocations colormatrix; - ProgramWithCachedVariableLocations clear_ps; - - // vertex input layouts - ID3D1X(InputLayout) * inlayout[GDRAW_vformat__count]; - - // vertex shaders - ProgramWithCachedVariableLocations vert[GDRAW_vformat__count]; // [format] - - // render targets - GDrawHandleCache rendertargets; - GDrawHandle - rendertarget_handles[MAX_RENDER_STACK_DEPTH]; // not -1, because we use - // +1 to initialize - - gswf_recti rt_valid[MAX_RENDER_STACK_DEPTH + - 1]; // valid rect for texture clamping - - // size of framebuffer-sized texture used for implementing blend modes - S32 frametex_width, frametex_height; - - // viewport setting (in pixels) for current frame - S32 vx, vy; - S32 fw, fh; // full width/height of virtual display - S32 tw, th; // actual width/height of current tile - S32 tpw, tph; // width/height of padded version of tile - - S32 tx0, ty0; - S32 tx0p, ty0p; - rrbool in_blur; - struct { - S32 x, y, w, h; - } cview; // current viewport - - F32 projection[4]; // scalex,scaley,transx,transy - F32 projmat[3][4]; - F32 xform_3d[3][4]; - rrbool use_3d; - - ID3D1X(RenderTargetView) * main_framebuffer; - ID3D1X(DepthStencilView) * depth_buffer[2]; // 0=main, 1=rendertarget - ID3D1X(ShaderResourceView) * main_resolve_target; - rrbool main_msaa; // does main framebuffer have MSAA enabled? - - ID3D1X(Texture2D) * rt_depth_buffer; - ID3D1X(Texture2D) * aa_tex; - ID3D1X(ShaderResourceView) * aa_tex_view; - ID3D1X(Buffer) * quad_ib; // canned quad indices - - // scale factor converting worldspace to viewspace <0,0>.. - F32 world_to_pixel[2]; - - // state objects - ID3D1X(RasterizerState) * raster_state[2]; // [msaa] - ID3D1X(SamplerState) * - sampler_state[2][GDRAW_WRAP__count]; // [nearest][wrap] - ID3D1X(BlendState) * blend_state[GDRAW_BLEND__count]; - ID3D1X(BlendState) * blend_no_color_write; - ID3D1X(DepthStencilState) * depth_state[2][2]; // [set_id][test_id] - - // stencil state cache - // SOA so the keys are tightly packed in a few cache lines! - U32 stencil_cache_key[STENCIL_STATE_CACHE_SIZE]; - ID3D1X(DepthStencilState) * stencil_cache[STENCIL_STATE_CACHE_SIZE]; - U32 stencil_cache_lru[STENCIL_STATE_CACHE_SIZE]; - U32 stencil_cache_now; - - // constant buffers - ID3D1X(Buffer) * cb_vertex; - ID3D1X(Buffer) * cb_ps_common; - ID3D1X(Buffer) * cb_filter; - ID3D1X(Buffer) * cb_colormatrix; - ID3D1X(Buffer) * cb_blur; - - // streaming buffers for dynamic vertex/index data - DynBuffer dyn_vb; - DynBuffer dyn_ib; - - U32 dyn_maxalloc, last_dyn_maxalloc; - S32 max_quad_vert_count; - - // cached state - U32 scissor_state; // ~0 if unknown, otherwise 0 or 1 - S32 blend_mode; // -1 if unknown, otherwise GDRAW_BLEND_* - - // render-state stack described above for 'temporary' rendering - GDrawFramebufferState frame[MAX_RENDER_STACK_DEPTH]; - GDrawFramebufferState* cur; - - // texture and vertex buffer pools - GDrawHandleCache* texturecache; - GDrawHandleCache* vbufcache; - - // stat tracking - rrbool frame_done; - U64 frame_counter; - - // error handler - void(__cdecl* error_handler)(HRESULT hr); -} GDraw; - -static GDraw* gdraw; - -static const F32 four_zeros[4] = {0}; // used in several places - -//////////////////////////////////////////////////////////////////////// -// -// General resource management for both textures and vertex buffers -// - -template -static void safe_release(T*& p) { - if (p) { - p->Release(); - p = NULL; - } -} - -static void report_d3d_error(HRESULT hr, char* call, char* context) { - if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, - context); - else - IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, - context, hr); -} - -static void unbind_resources(void) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // unset active textures and vertex/index buffers, - // to make sure there are no dangling refs - static ID3D1X(ShaderResourceView) * no_views[3] = {0}; - ID3D1X(Buffer)* no_vb = NULL; - UINT no_offs = 0; - - d3d->PSSetShaderResources(0, 3, no_views); - d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); -} - -static void api_free_resource(GDrawHandle* r) { - unbind_resources(); - if (r->state != GDRAW_HANDLE_STATE_user_owned) { - if (!r->cache->is_vertex) { - safe_release(r->handle.tex.d3d_view); - safe_release(r->handle.tex.d3d_rtview); - safe_release(r->handle.tex.d3d); - } else { - safe_release(r->handle.vbuf.verts); - safe_release(r->handle.vbuf.inds); - } - } -} - -static void RADLINK gdraw_UnlockHandles(GDrawStats* /*stats*/) { - gdraw_HandleCacheUnlockAll(gdraw->texturecache); - gdraw_HandleCacheUnlockAll(gdraw->vbufcache); -} - -//////////////////////////////////////////////////////////////////////// -// -// Dynamic buffer -// - -static void* start_write_dyn(DynBuffer* buf, U32 size) { - U8* ptr = NULL; - - if (size > buf->size) { - IggyGDrawSendWarning(NULL, - "GDraw dynamic vertex buffer usage of %d bytes in " - "one call larger than buffer size %d", - size, buf->size); - return NULL; - } - - // update statistics - gdraw->dyn_maxalloc = RR_MAX(gdraw->dyn_maxalloc, size); - - // invariant: current alloc_pos is in [0,size] - assert(buf->alloc_pos <= buf->size); - - // wrap around when less than "size" bytes left in buffer - buf->write_pos = ((buf->size - buf->alloc_pos) < size) ? 0 : buf->alloc_pos; - - // discard buffer whenever the current write position is 0; - // done this way so that if a DISCARD Map() were to fail, we would - // just keep retrying the next time around. - ptr = (U8*)map_buffer(gdraw->d3d_context, buf->buffer, buf->write_pos == 0); - if (ptr) { - ptr += buf->write_pos; // we return pointer to write position in buffer - buf->alloc_pos = buf->write_pos + size; // bump alloc position - assert(buf->alloc_pos <= buf->size); // invariant again - } - // if map_buffer fails, it will have sent a warning - - return ptr; -} - -static U32 end_write_dyn(DynBuffer* buf) { - unmap_buffer(gdraw->d3d_context, buf->buffer); - return buf->write_pos; -} - -//////////////////////////////////////////////////////////////////////// -// -// Stencil state cache -// - -static void stencil_state_cache_clear() { - S32 i; - - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - gdraw->stencil_cache_key[i] = 0; - safe_release(gdraw->stencil_cache[i]); - gdraw->stencil_cache_lru[i] = 0; - } - - gdraw->stencil_cache_now = 0; -} - -static ID3D1X(DepthStencilState) * - stencil_state_cache_lookup(rrbool set_id, rrbool test_id, U8 read_mask, - U8 write_mask) { - D3D1X_(DEPTH_STENCIL_DESC) desc; - S32 i, best = 0; - U32 key = (set_id << 1) | test_id | (read_mask << 8) | (write_mask << 16); - U32 now, age, highest_age; - HRESULT hr; - - // for LRU - now = ++gdraw->stencil_cache_now; - - // do we have this in the cache? - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - if (gdraw->stencil_cache_key[i] == key) { - gdraw->stencil_cache_lru[i] = now; - return gdraw->stencil_cache[i]; - } - } - - // not in the cache, find the best slot to replace it with (LRU) - highest_age = 0; - for (i = 0; i < STENCIL_STATE_CACHE_SIZE; ++i) { - if (!gdraw->stencil_cache[i]) { // unused slot! - best = i; - break; - } - - age = now - gdraw->stencil_cache_lru[i]; - if (age > highest_age) { - highest_age = age; - best = i; - } - } - - // release old depth/stencil state at that position and create new one - safe_release(gdraw->stencil_cache[best]); - - gdraw->depth_state[set_id][test_id]->GetDesc(&desc); // reference state - desc.StencilEnable = TRUE; - desc.StencilReadMask = read_mask; - desc.StencilWriteMask = write_mask; - desc.FrontFace.StencilFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.FrontFace.StencilDepthFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.FrontFace.StencilPassOp = D3D1X_(STENCIL_OP_REPLACE); - desc.FrontFace.StencilFunc = D3D1X_(COMPARISON_EQUAL); - desc.BackFace.StencilFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.BackFace.StencilDepthFailOp = D3D1X_(STENCIL_OP_KEEP); - desc.BackFace.StencilPassOp = D3D1X_(STENCIL_OP_REPLACE); - desc.BackFace.StencilFunc = D3D1X_(COMPARISON_EQUAL); - - hr = gdraw->d3d_device->CreateDepthStencilState( - &desc, &gdraw->stencil_cache[best]); - if (FAILED(hr)) report_d3d_error(hr, "CreateDepthStencilState", ""); - - gdraw->stencil_cache_key[best] = key; - gdraw->stencil_cache_lru[best] = now; - return gdraw->stencil_cache[best]; -} - -//////////////////////////////////////////////////////////////////////// -// -// Texture creation/updating/deletion -// - -extern GDrawTexture* gdraw_D3D1X_(WrappedTextureCreate)( - ID3D1X(ShaderResourceView) * tex_view) { - GDrawStats stats = {0}; - GDrawHandle* p = gdraw_res_alloc_begin( - gdraw->texturecache, 0, - &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = NULL; - p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = NULL; - p->handle.tex.w = 1; - p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); - return (GDrawTexture*)p; -} - -extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture* tex, - ID3D1X(ShaderResourceView) * - tex_view) { - GDrawHandle* p = (GDrawHandle*)tex; - p->handle.tex.d3d = NULL; - p->handle.tex.d3d_view = tex_view; -} - -extern void gdraw_D3D1X_(WrappedTextureDestroy)(GDrawTexture* tex) { - GDrawStats stats = {0}; - gdraw_res_free((GDrawHandle*)tex, &stats); -} - -static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture* tex, void* old_id, - void* new_id) { - GDrawHandle* p = (GDrawHandle*)tex; - // if this is still the handle it's thought to be, change the owner; - // if the owner *doesn't* match, then they're changing a stale handle, so - // ignore - if (p->owner == old_id) p->owner = new_id; -} - -static rrbool RADLINK gdraw_MakeTextureBegin( - void* owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, - GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { - GDrawHandle* t = NULL; - DXGI_FORMAT dxgi_fmt; - S32 bpp, size = 0, nmips = 0; - - if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning( - NULL, - "GDraw texture size too large (%d x %d), dimension limit is 16384", - width, height); - return false; - } - - if (format == GDRAW_TEXTURE_FORMAT_rgba32) { - dxgi_fmt = DXGI_FORMAT_R8G8B8A8_UNORM; - bpp = 4; - } else { - dxgi_fmt = DXGI_FORMAT_R8_UNORM; - bpp = 1; - } - - // compute estimated size of texture in video memory - do { - size += RR_MAX(width >> nmips, 1) * RR_MAX(height >> nmips, 1) * bpp; - ++nmips; - } while ((flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) && - ((width >> nmips) || (height >> nmips))); - - // try to allocate memory for the client to write to - p->texture_data = (U8*)IggyGDrawMalloc(size); - if (!p->texture_data) { - IggyGDrawSendWarning(NULL, - "GDraw out of memory to store texture data to " - "pass to D3D for %d x %d texture", - width, height); - return false; - } - - // allocate a handle and make room in the cache for this much data - t = gdraw_res_alloc_begin(gdraw->texturecache, size, stats); - if (!t) { - IggyGDrawFree(p->texture_data); - return false; - } - - t->handle.tex.w = width; - t->handle.tex.h = height; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; - - p->texture_type = GDRAW_TEXTURE_TYPE_rgba; - p->p0 = t; - p->p1 = owner; - p->i0 = width; - p->i1 = height; - p->i2 = flags; - p->i3 = dxgi_fmt; - p->i4 = size; - p->i5 = nmips; - p->i6 = bpp; - - p->stride_in_bytes = width * bpp; - p->num_rows = height; - - return true; -} - -static rrbool RADLINK -gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo* /*p*/) { - return false; -} - -static GDrawTexture* RADLINK -gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { - GDrawHandle* t = (GDrawHandle*)p->p0; - D3D1X_(SUBRESOURCE_DATA) mipdata[24]; - S32 i, w, h, nmips, bpp; - HRESULT hr = 0; - char* failed_call; - U8* ptr; - - // generate mip maps and set up descriptors for them - assert(p->i5 <= 24); - ptr = p->texture_data; - w = p->i0; - h = p->i1; - nmips = p->i5; - bpp = p->i6; - - for (i = 0; i < nmips; ++i) { - mipdata[i].pSysMem = ptr; - mipdata[i].SysMemPitch = RR_MAX(w >> i, 1) * bpp; - mipdata[i].SysMemSlicePitch = 0; - ptr += mipdata[i].SysMemPitch * RR_MAX(h >> i, 1); - - // create mip data by downsampling - if (i) - gdraw_Downsample((U8*)mipdata[i].pSysMem, mipdata[i].SysMemPitch, - w >> i, h >> i, (U8*)mipdata[i - 1].pSysMem, - mipdata[i - 1].SysMemPitch, bpp); - } - - // actually create texture - D3D1X_(TEXTURE2D_DESC) - desc = {w, - h, - nmips, - 1, - (DXGI_FORMAT)p->i3, - {1, 0}, - (p->i2 & GDRAW_MAKETEXTURE_FLAGS_updatable) - ? D3D1X_(USAGE_DEFAULT) - : D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - - failed_call = "CreateTexture2D"; - hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &t->handle.tex.d3d); - if (FAILED(hr)) goto done; - - // and create a corresponding shader resource view - failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, - &t->handle.tex.d3d_view); - -done: - if (!FAILED(hr)) { - gdraw_HandleCacheAllocateEnd( - t, p->i4, p->p1, - (p->i2 & GDRAW_MAKETEXTURE_FLAGS_never_flush) - ? GDRAW_HANDLE_STATE_pinned - : GDRAW_HANDLE_STATE_locked); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += p->i4; - } else { - safe_release(t->handle.tex.d3d); - safe_release(t->handle.tex.d3d_view); - - gdraw_HandleCacheAllocateFail(t); - t = NULL; - report_d3d_error(hr, failed_call, " while creating texture"); - } - - IggyGDrawFree(p->texture_data); - return (GDrawTexture*)t; -} - -static rrbool RADLINK gdraw_UpdateTextureBegin(GDrawTexture* t, void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); -} - -static void RADLINK gdraw_UpdateTextureRect(GDrawTexture* t, - void* /*unique_id*/, S32 x, S32 y, - S32 stride, S32 w, S32 h, - U8* samples, - gdraw_texture_format /*format*/) { - GDrawHandle* s = (GDrawHandle*)t; - D3D1X_(BOX) box = {x, y, 0, x + w, y + h, 1}; - - gdraw->d3d_context->UpdateSubresource(s->handle.tex.d3d, 0, &box, samples, - stride, 0); -} - -static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture* t, void* /*unique_id*/, - GDrawStats* /*stats*/) { - gdraw_HandleCacheUnlock((GDrawHandle*)t); -} - -static void RADLINK gdraw_FreeTexture(GDrawTexture* tt, void* unique_id, - GDrawStats* stats) { - GDrawHandle* t = (GDrawHandle*)tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { - if (t->cache == &gdraw->rendertargets) { - gdraw_HandleCacheUnlock(t); - // cache it by simply not freeing it - return; - } - - gdraw_res_free(t, stats); - } -} - -static rrbool RADLINK gdraw_TryToLockTexture(GDrawTexture* t, void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); -} - -static void RADLINK gdraw_DescribeTexture(GDrawTexture* tex, - GDraw_Texture_Description* desc) { - GDrawHandle* p = (GDrawHandle*)tex; - desc->width = p->handle.tex.w; - desc->height = p->handle.tex.h; - desc->size_in_bytes = p->bytes; -} - -static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8* rgba) { - HRESULT hr; - - safe_release(gdraw->aa_tex_view); - safe_release(gdraw->aa_tex); - - D3D1X_(TEXTURE2D_DESC) - desc = {width, - 1, - 1, - 1, - DXGI_FORMAT_R8G8B8A8_UNORM, - {1, 0}, - D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - D3D1X_(SUBRESOURCE_DATA) data = {rgba, width * 4, 0}; - - hr = gdraw->d3d_device->CreateTexture2D(&desc, &data, &gdraw->aa_tex); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateTexture2D", ""); - return; - } - - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, - &gdraw->aa_tex_view); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateShaderResourceView", - " while creating texture"); - safe_release(gdraw->aa_tex); - return; - } -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex buffer creation/deletion -// - -static rrbool RADLINK gdraw_MakeVertexBufferBegin( - void* unique_id, gdraw_vformat /*vformat*/, S32 vbuf_size, S32 ibuf_size, - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* stats) { - // prepare staging buffers for the app to put data into - p->vertex_data = (U8*)IggyGDrawMalloc(vbuf_size); - p->index_data = (U8*)IggyGDrawMalloc(ibuf_size); - if (p->vertex_data && p->index_data) { - GDrawHandle* vb = gdraw_res_alloc_begin(gdraw->vbufcache, - vbuf_size + ibuf_size, stats); - if (vb) { - vb->handle.vbuf.verts = NULL; - vb->handle.vbuf.inds = NULL; - - p->vertex_data_length = vbuf_size; - p->index_data_length = ibuf_size; - p->p0 = vb; - p->p1 = unique_id; - return true; - } - } - - if (p->vertex_data) IggyGDrawFree(p->vertex_data); - if (p->index_data) IggyGDrawFree(p->index_data); - - return false; -} - -static rrbool RADLINK -gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_ProcessingInfo* /*p*/) { - assert(0); - return false; -} - -static GDrawVertexBuffer* RADLINK gdraw_MakeVertexBufferEnd( - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* /*stats*/) { - GDrawHandle* vb = (GDrawHandle*)p->p0; - - HRESULT hr; - D3D1X_(BUFFER_DESC) - vbdesc = {p->vertex_data_length, D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_VERTEX_BUFFER), 0, 0}; - D3D1X_(SUBRESOURCE_DATA) vbdata = {p->vertex_data, 0, 0}; - - D3D1X_(BUFFER_DESC) - ibdesc = {p->index_data_length, D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_INDEX_BUFFER), 0, 0}; - D3D1X_(SUBRESOURCE_DATA) ibdata = {p->index_data, 0, 0}; - - hr = gdraw->d3d_device->CreateBuffer(&vbdesc, &vbdata, - &vb->handle.vbuf.verts); - if (!FAILED(hr)) - hr = gdraw->d3d_device->CreateBuffer(&ibdesc, &ibdata, - &vb->handle.vbuf.inds); - - if (FAILED(hr)) { - safe_release(vb->handle.vbuf.verts); - safe_release(vb->handle.vbuf.inds); - - gdraw_HandleCacheAllocateFail(vb); - vb = NULL; - - report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); - } else { - gdraw_HandleCacheAllocateEnd( - vb, p->vertex_data_length + p->index_data_length, p->p1, - GDRAW_HANDLE_STATE_locked); - } - - IggyGDrawFree(p->vertex_data); - IggyGDrawFree(p->index_data); - - return (GDrawVertexBuffer*)vb; -} - -static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, - GDrawStats* /*stats*/) { - return gdraw_HandleCacheLock((GDrawHandle*)vb, unique_id); -} - -static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, GDrawStats* stats) { - GDrawHandle* h = (GDrawHandle*)vb; - assert(h != NULL); // @GDRAW_ASSERT - if (h->owner == unique_id) gdraw_res_free(h, stats); -} - -static void RADLINK gdraw_DescribeVertexBuffer( - GDrawVertexBuffer* vbuf, GDraw_VertexBuffer_Description* desc) { - GDrawHandle* p = (GDrawHandle*)vbuf; - desc->size_in_bytes = p->bytes; -} - -//////////////////////////////////////////////////////////////////////// -// -// Create/free (or cache) render targets -// - -static GDrawHandle* get_color_rendertarget(GDrawStats* stats) { - char* failed_call; - - // try to recycle LRU rendertarget - GDrawHandle* t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); - if (t) { - gdraw_HandleCacheLock(t, (void*)1); - return t; - } - - // ran out of RTs, allocate a new one - S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; - if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning( - NULL, - "GDraw rendertarget allocation failed: hit size limit of %d bytes", - gdraw->rendertargets.total_bytes); - return NULL; - } - - t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); - if (!t) { - IggyGDrawSendWarning( - NULL, "GDraw rendertarget allocation failed: hit handle limit"); - return t; - } - - D3D1X_(TEXTURE2D_DESC) - desc = {gdraw->frametex_width, - gdraw->frametex_height, - 1, - 1, - DXGI_FORMAT_R8G8B8A8_UNORM, - {1, 0}, - D3D1X_(USAGE_DEFAULT), - D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), - 0, - 0}; - - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; - - HRESULT hr = - gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); - failed_call = "CreateTexture2D"; - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView( - t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); - failed_call = "CreateTexture2D"; - } - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView( - t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); - failed_call = "CreateRenderTargetView"; - } - - if (FAILED(hr)) { - safe_release(t->handle.tex.d3d); - safe_release(t->handle.tex.d3d_view); - safe_release(t->handle.tex.d3d_rtview); - gdraw_HandleCacheAllocateFail(t); - - report_d3d_error(hr, failed_call, " creating rendertarget"); - - return NULL; - } - - gdraw_HandleCacheAllocateEnd(t, size, (void*)1, GDRAW_HANDLE_STATE_locked); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += size; - - return t; -} - -static ID3D1X(DepthStencilView) * - get_rendertarget_depthbuffer(GDrawStats* stats) { - if (!gdraw->depth_buffer[1]) { - char* failed_call; - assert(!gdraw->rt_depth_buffer); - - D3D1X_(TEXTURE2D_DESC) - desc = {gdraw->frametex_width, - gdraw->frametex_height, - 1, - 1, - DXGI_FORMAT_D24_UNORM_S8_UINT, - {1, 0}, - D3D1X_(USAGE_DEFAULT), - D3D1X_(BIND_DEPTH_STENCIL), - 0, - 0}; - - HRESULT hr = gdraw->d3d_device->CreateTexture2D( - &desc, NULL, &gdraw->rt_depth_buffer); - failed_call = "CreateTexture2D"; - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView( - gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); - failed_call = "CreateDepthStencilView while creating rendertarget"; - } - - if (FAILED(hr)) { - report_d3d_error(hr, failed_call, ""); - safe_release(gdraw->rt_depth_buffer); - safe_release(gdraw->depth_buffer[1]); - } else { - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += - gdraw->frametex_width * gdraw->frametex_height * 4; - - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], - D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), 1.0f, 0); - } - } - - return gdraw->depth_buffer[1]; -} - -static void flush_rendertargets(GDrawStats* stats) { - gdraw_res_flush(&gdraw->rendertargets, stats); - - safe_release(gdraw->depth_buffer[1]); - safe_release(gdraw->rt_depth_buffer); -} - -//////////////////////////////////////////////////////////////////////// -// -// Constant buffer layouts -// - -struct VertexVars { - F32 world[2][4]; - F32 x_off[4]; - F32 texgen_s[4]; - F32 texgen_t[4]; - F32 x3d[4]; - F32 y3d[4]; - F32 w3d[4]; -}; - -struct PixelCommonVars { - F32 color_mul[4]; - F32 color_add[4]; - F32 focal[4]; - F32 rescale1[4]; -}; - -struct PixelParaFilter { - F32 clamp0[4], clamp1[4]; - F32 color[4], color2[4]; - F32 tc_off[4]; -}; - -struct PixelParaBlur { - F32 clamp[4]; - F32 tap[9][4]; -}; - -struct PixelParaColorMatrix { - F32 data[5][4]; -}; - -//////////////////////////////////////////////////////////////////////// -// -// Rendering helpers -// - -static void disable_scissor(int force) { - if (force || gdraw->scissor_state) { - // disable scissor by setting whole viewport as scissor rect - S32 x = gdraw->cview.x; - S32 y = gdraw->cview.y; - D3D1X_(RECT) r = {x, y, x + gdraw->cview.w, y + gdraw->cview.h}; - - gdraw->d3d_context->RSSetScissorRects(1, &r); - gdraw->scissor_state = 0; - } -} - -static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h) { - D3D1X_(VIEWPORT) - vp = {(ViewCoord)x, (ViewCoord)y, (ViewCoord)w, (ViewCoord)h, 0.0f, 1.0f}; - gdraw->d3d_context->RSSetViewports(1, &vp); - gdraw->cview.x = x; - gdraw->cview.y = y; - gdraw->cview.w = w; - gdraw->cview.h = h; - - disable_scissor(1); -} - -static void set_projection_base(void) { - // x3d = < viewproj.x, 0, 0, 0 > - // y3d = < 0, viewproj.y, 0, 0 > - // w3d = < viewproj.z, viewproj.w, 1.0, 1.0 > - - memset(gdraw->projmat[0], 0, sizeof(gdraw->projmat)); - gdraw->projmat[0][0] = gdraw->projection[0]; - gdraw->projmat[1][1] = gdraw->projection[1]; - gdraw->projmat[2][0] = gdraw->projection[2]; - gdraw->projmat[2][1] = gdraw->projection[3]; - - gdraw->projmat[2][2] = 1.0; - gdraw->projmat[2][3] = 1.0; -} - -static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1) { - gdraw->projection[0] = 2.0f / (x1 - x0); - gdraw->projection[1] = 2.0f / (y1 - y0); - gdraw->projection[2] = (x1 + x0) / (F32)(x0 - x1); - gdraw->projection[3] = (y1 + y0) / (F32)(y0 - y1); - - set_projection_base(); -} - -static void set_viewport(void) { - if (gdraw->in_blur) { - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - return; - } - - if (gdraw->cur == gdraw->frame) // if the rendering stack is empty - // render a tile-sized region to the user-request tile location - set_viewport_raw(gdraw->vx, gdraw->vy, gdraw->tw, gdraw->th); - else if (gdraw->cur->cached) - set_viewport_raw(0, 0, gdraw->cur->width, gdraw->cur->height); - else - // if on the render stack, draw a padded-tile-sized region at the origin - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); -} - -static void set_projection(void) { - if (gdraw->in_blur) return; - if (gdraw->cur == gdraw->frame) // if the render stack is empty - set_projection_raw(gdraw->tx0, gdraw->tx0 + gdraw->tw, - gdraw->ty0 + gdraw->th, gdraw->ty0); - else if (gdraw->cur->cached) - set_projection_raw( - gdraw->cur->base_x, gdraw->cur->base_x + gdraw->cur->width, - gdraw->cur->base_y, gdraw->cur->base_y + gdraw->cur->height); - else - set_projection_raw(gdraw->tx0p, gdraw->tx0p + gdraw->tpw, - gdraw->ty0p + gdraw->tph, gdraw->ty0p); -} - -static void clear_renderstate(void) { gdraw->d3d_context->ClearState(); } - -static void set_common_renderstate() { - ID3D1XContext* d3d = gdraw->d3d_context; - S32 i; - - clear_renderstate(); - - // all the render states we never change while drawing - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLELIST)); - - d3d->PSSetShaderResources(7, 1, &gdraw->aa_tex_view); - d3d->PSSetSamplers(7, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // set a well-defined default sampler for all PS textures we use - for (i = 0; i < 3; ++i) - d3d->PSSetSamplers(i, 1, &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // reset our state caching - gdraw->scissor_state = ~0u; - gdraw->blend_mode = -1; -} - -static void manual_clear(gswf_recti* r, GDrawStats* stats); -static void set_render_target(GDrawStats* stats); - -//////////////////////////////////////////////////////////////////////// -// -// Begin/end rendering of a tile and per-frame processing -// - -void gdraw_D3D1X_(SetRendertargetSize)(S32 w, S32 h) { - if (gdraw && (w != gdraw->frametex_width || h != gdraw->frametex_height)) { - GDrawStats stats = {0}; - gdraw->frametex_width = w; - gdraw->frametex_height = h; - flush_rendertargets(&stats); - } -} - -void gdraw_D3D1X_(SetTileOrigin)(ID3D1X(RenderTargetView) * main_rt, - ID3D1X(DepthStencilView) * main_ds, - ID3D1X(ShaderResourceView) * non_msaa_rt, - S32 x, S32 y) { - D3D1X_(RENDER_TARGET_VIEW_DESC) desc; - - if (gdraw->frame_done) { - ++gdraw->frame_counter; - gdraw->frame_done = false; - } - - main_rt->GetDesc(&desc); - - gdraw->main_framebuffer = main_rt; - gdraw->main_resolve_target = non_msaa_rt; - gdraw->main_msaa = - (desc.ViewDimension == D3D1X_(RTV_DIMENSION_TEXTURE2DMS)); - gdraw->depth_buffer[0] = main_ds; - - gdraw->vx = x; - gdraw->vy = y; -} - -static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, - F32 scaley) { - memset(gdraw->frame, 0, sizeof(gdraw->frame)); - gdraw->cur = gdraw->frame; - gdraw->fw = w; - gdraw->fh = h; - gdraw->tw = w; - gdraw->th = h; - gdraw->world_to_pixel[0] = scalex; - gdraw->world_to_pixel[1] = scaley; - set_viewport(); -} - -// must include anything necessary for texture creation/update -static void RADLINK gdraw_RenderingBegin(void) {} -static void RADLINK gdraw_RenderingEnd(void) {} - -static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, - S32 pad, GDrawStats* stats) { - if (x0 == 0 && y0 == 0 && x1 == gdraw->fw && y1 == gdraw->fh) pad = 0; - - gdraw->tx0 = x0; - gdraw->ty0 = y0; - gdraw->tw = x1 - x0; - gdraw->th = y1 - y0; - - // padded region - gdraw->tx0p = RR_MAX(x0 - pad, 0); - gdraw->ty0p = RR_MAX(y0 - pad, 0); - gdraw->tpw = RR_MIN(x1 + pad, gdraw->fw) - gdraw->tx0p; - gdraw->tph = RR_MIN(y1 + pad, gdraw->fh) - gdraw->ty0p; - - // make sure our rendertargets are large enough to contain the tile - if (gdraw->tpw > gdraw->frametex_width || - gdraw->tph > gdraw->frametex_height) { - gdraw->frametex_width = RR_MAX(gdraw->tpw, gdraw->frametex_width); - gdraw->frametex_height = RR_MAX(gdraw->tph, gdraw->frametex_height); - - flush_rendertargets(stats); - } - assert(gdraw->tpw <= gdraw->frametex_width && - gdraw->tph <= gdraw->frametex_height); - - // set up rendertargets we'll use - set_common_renderstate(); - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[0], D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), - 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], D3D1X_(CLEAR_DEPTH) | D3D1X_(CLEAR_STENCIL), - 1.0f, 0); - - set_projection(); - set_viewport(); - set_render_target(stats); -} - -static void RADLINK gdraw_RenderTileEnd(GDrawStats* /*stats*/) {} - -void gdraw_D3D1X_(NoMoreGDrawThisFrame)(void) { - clear_renderstate(); - gdraw->frame_done = true; - - gdraw->last_dyn_maxalloc = gdraw->dyn_maxalloc; - gdraw->dyn_maxalloc = 0; - - // reset dynamic buffer alloc position so they get DISCARDed - // next time around. - gdraw->dyn_vb.alloc_pos = 0; - gdraw->dyn_ib.alloc_pos = 0; - - GDrawFence now = {gdraw->frame_counter}; - gdraw_HandleCacheTick(gdraw->texturecache, now); - gdraw_HandleCacheTick(gdraw->vbufcache, now); -} - -#define MAX_DEPTH_VALUE (1 << 13) - -static void RADLINK gdraw_GetInfo(GDrawInfo* d) { - d->num_stencil_bits = 8; - d->max_id = MAX_DEPTH_VALUE - 2; - // for floating point depth, just use mantissa, e.g. 16-20 bits - d->buffer_format = GDRAW_BFORMAT_vbib; - d->shared_depth_stencil = 1; - d->always_mipmap = 1; -#ifndef GDRAW_D3D11_LEVEL9 - d->max_texture_size = 8192; - d->conditional_nonpow2 = 0; -#else - d->max_texture_size = 2048; - d->conditional_nonpow2 = 1; -#endif -} - -//////////////////////////////////////////////////////////////////////// -// -// Enable/disable rendertargets in stack fashion -// - -static ID3D1X(RenderTargetView) * get_active_render_target() { - if (gdraw->cur->color_buffer) { - unbind_resources(); // to make sure this RT isn't accidentally set as a - // texture (avoid D3D warnings) - return gdraw->cur->color_buffer->handle.tex.d3d_rtview; - } else - return gdraw->main_framebuffer; -} - -static void set_render_target(GDrawStats* stats) { - ID3D1X(RenderTargetView)* target = get_active_render_target(); - if (target == gdraw->main_framebuffer) { - gdraw->d3d_context->OMSetRenderTargets(1, &target, - gdraw->depth_buffer[0]); - gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); - } else { - ID3D1X(DepthStencilView)* depth = NULL; - if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) - depth = get_rendertarget_depthbuffer(stats); - - gdraw->d3d_context->OMSetRenderTargets(1, &target, depth); - gdraw->d3d_context->RSSetState(gdraw->raster_state[0]); - } - - stats->nonzero_flags |= GDRAW_STATS_rendtarg; - stats->rendertarget_changes += 1; -} - -static rrbool RADLINK gdraw_TextureDrawBufferBegin( - gswf_recti* region, gdraw_texture_format /*format*/, U32 flags, void* owner, - GDrawStats* stats) { - GDrawFramebufferState* n = gdraw->cur + 1; - GDrawHandle* t = NULL; - if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); - return false; - } - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - assert(0); - IggyGDrawSendWarning( - NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); - return false; - } - - if (owner) { - // nyi - } else { - t = get_color_rendertarget(stats); - if (!t) return false; - } - - n->flags = flags; - n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT - - ++gdraw->cur; - gdraw->cur->cached = owner != NULL; - if (owner) { - gdraw->cur->base_x = region->x0; - gdraw->cur->base_y = region->y0; - gdraw->cur->width = region->x1 - region->x0; - gdraw->cur->height = region->y1 - region->y0; - } - - set_render_target(stats); - assert(gdraw->frametex_width >= gdraw->tw && - gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT - - S32 k = (S32)(t - gdraw->rendertargets.handle); - - if (region) { - gswf_recti r; - S32 ox, oy, pad = 2; // 2 pixels of border on all sides - // 1 pixel turns out to be not quite enough with the interpolator - // precision we get. - - if (gdraw->in_blur) - ox = oy = 0; - else - ox = gdraw->tx0p, oy = gdraw->ty0p; - - // clamp region to tile - S32 xt0 = RR_MAX(region->x0 - ox, 0); - S32 yt0 = RR_MAX(region->y0 - oy, 0); - S32 xt1 = RR_MIN(region->x1 - ox, gdraw->tpw); - S32 yt1 = RR_MIN(region->y1 - oy, gdraw->tph); - - // but the padding needs to clamp to render target bounds - r.x0 = RR_MAX(xt0 - pad, 0); - r.y0 = RR_MAX(yt0 - pad, 0); - r.x1 = RR_MIN(xt1 + pad, gdraw->frametex_width); - r.y1 = RR_MIN(yt1 + pad, gdraw->frametex_height); - - if (r.x1 <= r.x0 || - r.y1 <= r.y0) { // region doesn't intersect with current tile - --gdraw->cur; - gdraw_FreeTexture((GDrawTexture*)t, 0, stats); - // note: don't send a warning since this will happen during regular - // tiled rendering - return false; - } - - manual_clear(&r, stats); - - gdraw->rt_valid[k].x0 = xt0; - gdraw->rt_valid[k].y0 = yt0; - gdraw->rt_valid[k].x1 = xt1; - gdraw->rt_valid[k].y1 = yt1; - } else { - gdraw->d3d_context->ClearRenderTargetView( - gdraw->cur->color_buffer->handle.tex.d3d_rtview, four_zeros); - gdraw->rt_valid[k].x0 = 0; - gdraw->rt_valid[k].y0 = 0; - gdraw->rt_valid[k].x1 = gdraw->frametex_width; - gdraw->rt_valid[k].y1 = gdraw->frametex_height; - } - - if (!gdraw->in_blur) { - set_viewport(); - set_projection(); - } else { - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); - } - - return true; -} - -static GDrawTexture* RADLINK gdraw_TextureDrawBufferEnd(GDrawStats* stats) { - GDrawFramebufferState* n = gdraw->cur; - GDrawFramebufferState* m = --gdraw->cur; - if (gdraw->tw == 0 || gdraw->th == 0) return 0; - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) - return 0; // already returned a warning in Begin - - assert(m >= gdraw->frame); // bug in Iggy -- unbalanced - - if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT - } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT - - // switch back to old render target - set_render_target(stats); - - // if we're at the root, set the viewport back - set_viewport(); - set_projection(); - - return (GDrawTexture*)n->color_buffer; -} - -//////////////////////////////////////////////////////////////////////// -// -// Clear stencil/depth buffers -// -// Open question whether we'd be better off finding bounding boxes -// and only clearing those; it depends exactly how fast clearing works. -// - -static void RADLINK gdraw_ClearStencilBits(U32 /*bits*/) { - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[0], - D3D1X_(CLEAR_STENCIL), 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView( - gdraw->depth_buffer[1], D3D1X_(CLEAR_STENCIL), 1.0f, 0); -} - -// this only happens rarely (hopefully never) if we use the depth buffer, -// so we can just clear the whole thing -static void RADLINK gdraw_ClearID(void) { - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[0], - D3D1X_(CLEAR_DEPTH), 1.0f, 0); - if (gdraw->depth_buffer[1]) - gdraw->d3d_context->ClearDepthStencilView(gdraw->depth_buffer[1], - D3D1X_(CLEAR_DEPTH), 1.0f, 0); -} - -//////////////////////////////////////////////////////////////////////// -// -// Set all the render state from GDrawRenderState -// -// This also is responsible for getting the framebuffer into a texture -// if the read-modify-write blend operation can't be expressed with -// the native blend operators. (E.g. "screen") -// - -// convert an ID request to a value suitable for the depth buffer, -// assuming the depth buffer has been mappped to 0..1 -static F32 depth_from_id(S32 id) { - return 1.0f - ((F32)id + 1.0f) / MAX_DEPTH_VALUE; -} - -static void set_texture(S32 texunit, GDrawTexture* tex, rrbool nearest, - S32 wrap) { - ID3D1XContext* d3d = gdraw->d3d_context; - - if (tex == NULL) { - ID3D1X(ShaderResourceView)* notex = NULL; - d3d->PSSetShaderResources(texunit, 1, ¬ex); - } else { - GDrawHandle* h = (GDrawHandle*)tex; - d3d->PSSetShaderResources(texunit, 1, &h->handle.tex.d3d_view); - d3d->PSSetSamplers(texunit, 1, &gdraw->sampler_state[nearest][wrap]); - } -} - -static void RADLINK gdraw_Set3DTransform(F32* mat) { - if (mat == NULL) - gdraw->use_3d = 0; - else { - gdraw->use_3d = 1; - memcpy(gdraw->xform_3d, mat, sizeof(gdraw->xform_3d)); - } -} - -static int set_renderstate_full(S32 vertex_format, GDrawRenderState* r, - GDrawStats* /* stats */, const F32* rescale1) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // set vertex shader - set_vertex_shader(d3d, gdraw->vert[vertex_format].vshader); - - // set vertex shader constants - if (VertexVars* vvars = (VertexVars*)map_buffer(gdraw->d3d_context, - gdraw->cb_vertex, true)) { - F32 depth = depth_from_id(r->id); - if (!r->use_world_space) - gdraw_ObjectSpace(vvars->world[0], r->o2w, depth, 0.0f); - else - gdraw_WorldSpace(vvars->world[0], gdraw->world_to_pixel, depth, - 0.0f); - - memcpy(&vvars->x_off, r->edge_matrix, 4 * sizeof(F32)); - - if (r->texgen0_enabled) { - memcpy(&vvars->texgen_s, r->s0_texgen, 4 * sizeof(F32)); - memcpy(&vvars->texgen_t, r->t0_texgen, 4 * sizeof(F32)); - } - - if (gdraw->use_3d) - memcpy(vvars->x3d, gdraw->xform_3d, 12 * sizeof(F32)); - else - memcpy(vvars->x3d, gdraw->projmat, 12 * sizeof(F32)); - - unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex); - - d3d->VSSetConstantBuffers(0, 1, &gdraw->cb_vertex); - } - - // set the blend mode - int blend_mode = r->blend_mode; - if (blend_mode != gdraw->blend_mode) { - gdraw->blend_mode = blend_mode; - d3d->OMSetBlendState(gdraw->blend_state[blend_mode], four_zeros, ~0u); - } - - // set the fragment program - if (blend_mode != GDRAW_BLEND_special) { - int which = r->tex0_mode; - assert(which >= 0 && - which < sizeof(gdraw->fprog) / sizeof(*gdraw->fprog)); - - int additive = 0; - if (r->cxf_add) { - additive = 1; - if (r->cxf_add[3]) additive = 2; - } - - ID3D1X(PixelShader)* program = gdraw->fprog[which][additive].pshader; - if (r->stencil_set) { - // in stencil set mode, prefer not doing any shading at all - // but if alpha test is on, we need to make an exception - -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems - if (which != GDRAW_TEXTURE_alpha_test) - program = NULL; - else -#endif - { - gdraw->blend_mode = -1; - d3d->OMSetBlendState(gdraw->blend_no_color_write, four_zeros, - ~0u); - } - } - - set_pixel_shader(d3d, program); - } else - set_pixel_shader(d3d, - gdraw->exceptional_blend[r->special_blend].pshader); - - set_texture(0, r->tex[0], r->nearest0, r->wrap0); - - // pixel shader constants - if (PixelCommonVars* pvars = (PixelCommonVars*)map_buffer( - gdraw->d3d_context, gdraw->cb_ps_common, true)) { - memcpy(pvars->color_mul, r->color, 4 * sizeof(float)); - - if (r->cxf_add) { - pvars->color_add[0] = r->cxf_add[0] / 255.0f; - pvars->color_add[1] = r->cxf_add[1] / 255.0f; - pvars->color_add[2] = r->cxf_add[2] / 255.0f; - pvars->color_add[3] = r->cxf_add[3] / 255.0f; - } else - pvars->color_add[0] = pvars->color_add[1] = pvars->color_add[2] = - pvars->color_add[3] = 0.0f; - - if (r->tex0_mode == GDRAW_TEXTURE_focal_gradient) - memcpy(pvars->focal, r->focal_point, 4 * sizeof(float)); - if (r->blend_mode == GDRAW_BLEND_special) - memcpy(pvars->rescale1, rescale1, 4 * sizeof(float)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common); - d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common); - } - - // Set pixel operation states - if (r->scissor) { - D3D1X_(RECT) s; - gdraw->scissor_state = 1; - if (gdraw->cur == gdraw->frame) { - s.left = r->scissor_rect.x0 + gdraw->vx - gdraw->tx0; - s.top = r->scissor_rect.y0 + gdraw->vy - gdraw->ty0; - s.right = r->scissor_rect.x1 + gdraw->vx - gdraw->tx0; - s.bottom = r->scissor_rect.y1 + gdraw->vy - gdraw->ty0; - } else { - s.left = r->scissor_rect.x0 - gdraw->tx0p; - s.top = r->scissor_rect.y0 - gdraw->ty0p; - s.right = r->scissor_rect.x1 - gdraw->tx0p; - s.bottom = r->scissor_rect.y1 - gdraw->ty0p; - } - d3d->RSSetScissorRects(1, &s); - } else if (r->scissor != gdraw->scissor_state) - disable_scissor(0); - - if (r->stencil_set | r->stencil_test) - d3d->OMSetDepthStencilState( - stencil_state_cache_lookup(r->set_id, r->test_id, r->stencil_test, - r->stencil_set), - 255); - else - d3d->OMSetDepthStencilState(gdraw->depth_state[r->set_id][r->test_id], - 0); - - return 1; -} - -static RADINLINE int set_renderstate(S32 vertex_format, GDrawRenderState* r, - GDrawStats* stats) { - static const F32 unit_rescale[4] = {1.0f, 1.0f, 0.0f, 0.0f}; - if (r->identical_state) { - // fast path: only need to change vertex shader, other state is the same - set_vertex_shader(gdraw->d3d_context, - gdraw->vert[vertex_format].vshader); - return 1; - } else - return set_renderstate_full(vertex_format, r, stats, unit_rescale); -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex formats -// - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2aa[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R16G16B16A16_SINT, 0, 8, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static D3D1X_(INPUT_ELEMENT_DESC) vformat_v2tc2[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, - D3D1X_(INPUT_PER_VERTEX_DATA), 0}, -}; - -static struct gdraw_vertex_format_desc { - D3D1X_(INPUT_ELEMENT_DESC) * desc; - U32 nelem; -} vformats[ASSERT_COUNT(GDRAW_vformat__basic_count, 3)] = { - vformat_v2, 1, // GDRAW_vformat_v2 - vformat_v2aa, 2, // GDRAW_vformat_v2aa - vformat_v2tc2, 2, // GDRAW_vforamt_v2tc2 -}; - -static int vertsize[GDRAW_vformat__basic_count] = { - 8, // GDRAW_vformat_v2 - 16, // GDRAW_vformat_v2aa - 16, // GDRAW_vformat_v2tc2 -}; - -//////////////////////////////////////////////////////////////////////// -// -// Draw triangles with a given renderstate -// - -static void tag_resources(void* r1, void* r2 = NULL, void* r3 = NULL, - void* r4 = NULL) { - U64 now = gdraw->frame_counter; - if (r1) ((GDrawHandle*)r1)->fence.value = now; - if (r2) ((GDrawHandle*)r2)->fence.value = now; - if (r3) ((GDrawHandle*)r3)->fence.value = now; - if (r4) ((GDrawHandle*)r4)->fence.value = now; -} - -static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState* r, - GDrawPrimitive* p, - GDrawVertexBuffer* buf, - GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - GDrawHandle* vb = (GDrawHandle*)buf; - int vfmt = p->vertex_format; - assert(vfmt >= 0 && vfmt < GDRAW_vformat__count); - - if (!set_renderstate(vfmt, r, stats)) return; - - UINT stride = vertsize[vfmt]; - d3d->IASetInputLayout(gdraw->inlayout[vfmt]); - - if (vb) { - UINT offs = (UINT)(UINTa)p->vertices; - - d3d->IASetVertexBuffers(0, 1, &vb->handle.vbuf.verts, &stride, &offs); - d3d->IASetIndexBuffer(vb->handle.vbuf.inds, DXGI_FORMAT_R16_UINT, - (UINT)(UINTa)p->indices); - d3d->DrawIndexed(p->num_indices, 0, 0); - } else if (p->indices) { - U32 vbytes = p->num_vertices * stride; - U32 ibytes = p->num_indices * 2; - - if (void* vbptr = start_write_dyn(&gdraw->dyn_vb, vbytes)) { - memcpy(vbptr, p->vertices, vbytes); - UINT vboffs = end_write_dyn(&gdraw->dyn_vb); - - if (void* ibptr = start_write_dyn(&gdraw->dyn_ib, ibytes)) { - memcpy(ibptr, p->indices, ibytes); - UINT iboffs = end_write_dyn(&gdraw->dyn_ib); - - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, &stride, - &vboffs); - d3d->IASetIndexBuffer(gdraw->dyn_ib.buffer, - DXGI_FORMAT_R16_UINT, iboffs); - d3d->DrawIndexed(p->num_indices, 0, 0); - } - } - } else { // dynamic quads - assert(p->num_vertices % 4 == 0); - d3d->IASetIndexBuffer(gdraw->quad_ib, DXGI_FORMAT_R16_UINT, 0); - - if (gdraw->max_quad_vert_count) { - S32 pos = 0; - while (pos < p->num_vertices) { - S32 vert_count = - RR_MIN(p->num_vertices - pos, gdraw->max_quad_vert_count); - UINT chunk_bytes = vert_count * stride; - - if (void* vbptr = - start_write_dyn(&gdraw->dyn_vb, chunk_bytes)) { - memcpy(vbptr, (U8*)p->vertices + pos * stride, chunk_bytes); - UINT offs = end_write_dyn(&gdraw->dyn_vb); - - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, - &stride, &offs); - d3d->DrawIndexed((vert_count >> 2) * 6, 0, 0); - } - pos += vert_count; - } - } - } - - tag_resources(vb, r->tex[0], r->tex[1]); - - stats->nonzero_flags |= GDRAW_STATS_batches; - stats->num_batches += 1; - stats->drawn_indices += p->num_indices; - stats->drawn_vertices += p->num_vertices; -} - -/////////////////////////////////////////////////////////////////////// -// -// Flash 8 filter effects -// - -static void* start_ps_constants(ID3D1X(Buffer) * buffer) { - return map_buffer(gdraw->d3d_context, buffer, true); -} - -static void end_ps_constants(ID3D1X(Buffer) * buffer) { - unmap_buffer(gdraw->d3d_context, buffer); - gdraw->d3d_context->PSSetConstantBuffers(1, 1, &buffer); -} - -static void set_pixel_constant(F32* constant, F32 x, F32 y, F32 z, F32 w) { - constant[0] = x; - constant[1] = y; - constant[2] = z; - constant[3] = w; -} - -// caller sets up texture coordinates -static void do_screen_quad(gswf_recti* s, const F32* tc, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - F32 px0 = (F32)s->x0, py0 = (F32)s->y0, px1 = (F32)s->x1, py1 = (F32)s->y1; - - // generate vertex data - gswf_vertex_xyst* vert = (gswf_vertex_xyst*)start_write_dyn( - &gdraw->dyn_vb, 4 * sizeof(gswf_vertex_xyst)); - if (!vert) return; - - vert[0].x = px0; - vert[0].y = py0; - vert[0].s = tc[0]; - vert[0].t = tc[1]; - vert[1].x = px1; - vert[1].y = py0; - vert[1].s = tc[2]; - vert[1].t = tc[1]; - vert[2].x = px0; - vert[2].y = py1; - vert[2].s = tc[0]; - vert[2].t = tc[3]; - vert[3].x = px1; - vert[3].y = py1; - vert[3].s = tc[2]; - vert[3].t = tc[3]; - UINT offs = end_write_dyn(&gdraw->dyn_vb); - UINT stride = sizeof(gswf_vertex_xyst); - - if (VertexVars* vvars = (VertexVars*)map_buffer(gdraw->d3d_context, - gdraw->cb_vertex, true)) { - gdraw_PixelSpace(vvars->world[0]); - memcpy(vvars->x3d, gdraw->projmat, 12 * sizeof(F32)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_vertex); - d3d->VSSetConstantBuffers(0, 1, &gdraw->cb_vertex); - - set_vertex_shader(d3d, gdraw->vert[GDRAW_vformat_v2tc2].vshader); - - d3d->IASetInputLayout(gdraw->inlayout[GDRAW_vformat_v2tc2]); - d3d->IASetVertexBuffers(0, 1, &gdraw->dyn_vb.buffer, &stride, &offs); - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLESTRIP)); - d3d->Draw(4, 0); - d3d->IASetPrimitiveTopology(D3D1X_(PRIMITIVE_TOPOLOGY_TRIANGLELIST)); - - stats->nonzero_flags |= GDRAW_STATS_batches; - stats->num_batches += 1; - stats->drawn_indices += 6; - stats->drawn_vertices += 4; - } -} - -static void manual_clear(gswf_recti* r, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - - // go to known render state - d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); - d3d->OMSetDepthStencilState(gdraw->depth_state[0][0], 0); - gdraw->blend_mode = GDRAW_BLEND_none; - - set_viewport_raw(0, 0, gdraw->frametex_width, gdraw->frametex_height); - set_projection_raw(0, gdraw->frametex_width, gdraw->frametex_height, 0); - set_pixel_shader(d3d, gdraw->clear_ps.pshader); - - if (PixelCommonVars* pvars = (PixelCommonVars*)map_buffer( - gdraw->d3d_context, gdraw->cb_ps_common, true)) { - memset(pvars, 0, sizeof(*pvars)); - unmap_buffer(gdraw->d3d_context, gdraw->cb_ps_common); - d3d->PSSetConstantBuffers(0, 1, &gdraw->cb_ps_common); - - do_screen_quad(r, four_zeros, stats); - } -} - -static void gdraw_DriverBlurPass(GDrawRenderState* r, int taps, float* data, - gswf_recti* s, float* tc, float /*height_max*/, - float* clamp, GDrawStats* gstats) { - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - - set_pixel_shader(gdraw->d3d_context, gdraw->blur_prog[taps].pshader); - PixelParaBlur* para = (PixelParaBlur*)start_ps_constants(gdraw->cb_blur); - memcpy(para->clamp, clamp, 4 * sizeof(float)); - memcpy(para->tap, data, taps * 4 * sizeof(float)); - end_ps_constants(gdraw->cb_blur); - - do_screen_quad(s, tc, gstats); - tag_resources(r->tex[0]); -} - -static void gdraw_Colormatrix(GDrawRenderState* r, gswf_recti* s, float* tc, - GDrawStats* stats) { - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - 0, stats)) - return; - - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - set_pixel_shader(gdraw->d3d_context, gdraw->colormatrix.pshader); - - PixelParaColorMatrix* para = - (PixelParaColorMatrix*)start_ps_constants(gdraw->cb_colormatrix); - memcpy(para->data, r->shader_data, 5 * 4 * sizeof(float)); - end_ps_constants(gdraw->cb_colormatrix); - - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); -} - -static gswf_recti* get_valid_rect(GDrawTexture* tex) { - GDrawHandle* h = (GDrawHandle*)tex; - S32 n = (S32)(h - gdraw->rendertargets.handle); - assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH + 1); - return &gdraw->rt_valid[n]; -} - -static void set_clamp_constant(F32* constant, GDrawTexture* tex) { - gswf_recti* s = get_valid_rect(tex); - // when we make the valid data, we make sure there is an extra empty pixel - // at the border - set_pixel_constant(constant, (s->x0 - 0.5f) / gdraw->frametex_width, - (s->y0 - 0.5f) / gdraw->frametex_height, - (s->x1 + 0.5f) / gdraw->frametex_width, - (s->y1 + 0.5f) / gdraw->frametex_height); -} - -static void gdraw_Filter(GDrawRenderState* r, gswf_recti* s, float* tc, - int isbevel, GDrawStats* stats) { - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - NULL, stats)) - return; - - set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); - set_texture(1, r->tex[1], false, GDRAW_WRAP_clamp); - set_texture(2, r->tex[2], false, GDRAW_WRAP_clamp); - set_pixel_shader(gdraw->d3d_context, - gdraw->filter_prog[isbevel][r->filter_mode].pshader); - - PixelParaFilter* para = - (PixelParaFilter*)start_ps_constants(gdraw->cb_filter); - set_clamp_constant(para->clamp0, r->tex[0]); - set_clamp_constant(para->clamp1, r->tex[1]); - set_pixel_constant(para->color, r->shader_data[0], r->shader_data[1], - r->shader_data[2], r->shader_data[3]); - set_pixel_constant(para->color2, r->shader_data[8], r->shader_data[9], - r->shader_data[10], r->shader_data[11]); - set_pixel_constant( - para->tc_off, -r->shader_data[4] / (F32)gdraw->frametex_width, - -r->shader_data[5] / (F32)gdraw->frametex_height, r->shader_data[6], 0); - end_ps_constants(gdraw->cb_filter); - - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0], r->tex[1], r->tex[2]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); -} - -static void RADLINK gdraw_FilterQuad(GDrawRenderState* r, S32 x0, S32 y0, - S32 x1, S32 y1, GDrawStats* stats) { - ID3D1XContext* d3d = gdraw->d3d_context; - F32 tc[4]; - gswf_recti s; - - // clip to tile boundaries - s.x0 = RR_MAX(x0, gdraw->tx0p); - s.y0 = RR_MAX(y0, gdraw->ty0p); - s.x1 = RR_MIN(x1, gdraw->tx0p + gdraw->tpw); - s.y1 = RR_MIN(y1, gdraw->ty0p + gdraw->tph); - if (s.x1 < s.x0 || s.y1 < s.y0) return; - - tc[0] = (s.x0 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[1] = (s.y0 - gdraw->ty0p) / (F32)gdraw->frametex_height; - tc[2] = (s.x1 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[3] = (s.y1 - gdraw->ty0p) / (F32)gdraw->frametex_height; - - // clear to known render state - d3d->OMSetBlendState(gdraw->blend_state[GDRAW_BLEND_none], four_zeros, ~0u); - d3d->OMSetDepthStencilState(gdraw->depth_state[0][0], 0); - disable_scissor(0); - gdraw->blend_mode = GDRAW_BLEND_none; - - if (r->blend_mode == GDRAW_BLEND_filter) { - switch (r->filter) { - case GDRAW_FILTER_blur: { - GDrawBlurInfo b; - gswf_recti bounds = *get_valid_rect(r->tex[0]); - gdraw_ShiftRect(&s, &s, -gdraw->tx0p, - -gdraw->ty0p); // blur uses physical - // rendertarget coordinates - - b.BlurPass = gdraw_DriverBlurPass; - b.w = gdraw->tpw; - b.h = gdraw->tph; - b.frametex_width = gdraw->frametex_width; - b.frametex_height = gdraw->frametex_height; - - // blur needs to draw with multiple passes, so set up special - // state - gdraw->in_blur = true; - - // do the blur - gdraw_Blur(&gdraw_funcs, &b, r, &s, &bounds, stats); - - // restore the normal state - gdraw->in_blur = false; - set_viewport(); - set_projection(); - break; - } - - case GDRAW_FILTER_colormatrix: - gdraw_Colormatrix(r, &s, tc, stats); - break; - - case GDRAW_FILTER_dropshadow: - gdraw_Filter(r, &s, tc, 0, stats); - break; - - case GDRAW_FILTER_bevel: - gdraw_Filter(r, &s, tc, 1, stats); - break; - - default: - assert(0); - } - } else { - GDrawHandle* blend_tex = NULL; - - // for crazy blend modes, we need to read back from the framebuffer - // and do the blending in the pixel shader. we do this with copies - // rather than trying to render-to-texture-all-along, because we want - // to be able to render over the user's existing framebuffer, which - // might not be a texture. note that this isn't optimal when MSAA is on! - F32 rescale1[4] = {1.0f, 1.0f, 0.0f, 0.0f}; - if (r->blend_mode == GDRAW_BLEND_special) { - ID3D1XContext* d3d = gdraw->d3d_context; - ID3D1X(Resource) * cur_rt_rsrc; - get_active_render_target()->GetResource(&cur_rt_rsrc); - - if (gdraw->cur == gdraw->frame && gdraw->main_msaa) { - // source surface is main framebuffer and it uses MSAA. just - // resolve it first. - D3D1X_(SHADER_RESOURCE_VIEW_DESC) desc; - D3D1X_(TEXTURE2D_DESC) texdesc; - ID3D1X(Texture2D) * resolve_tex; - - gdraw->main_resolve_target->GetDesc(&desc); - gdraw->main_resolve_target->GetResource( - (ID3D1X(Resource)**)&resolve_tex); - resolve_tex->GetDesc(&texdesc); - d3d->ResolveSubresource(resolve_tex, 0, cur_rt_rsrc, 0, - desc.Format); - resolve_tex->Release(); - - stats->nonzero_flags |= GDRAW_STATS_blits; - stats->num_blits += 1; - stats->num_blit_pixels += texdesc.Width * texdesc.Height; - - d3d->PSSetShaderResources(1, 1, &gdraw->main_resolve_target); - d3d->PSSetSamplers(1, 1, - &gdraw->sampler_state[0][GDRAW_WRAP_clamp]); - - // calculate texture coordinate remapping - rescale1[0] = gdraw->frametex_width / (F32)texdesc.Width; - rescale1[1] = gdraw->frametex_height / (F32)texdesc.Height; - rescale1[2] = - (gdraw->vx - gdraw->tx0 + gdraw->tx0p) / (F32)texdesc.Width; - rescale1[3] = (gdraw->vy - gdraw->ty0 + gdraw->ty0p) / - (F32)texdesc.Height; - } else { - D3D1X_(BOX) box = {0, 0, 0, 0, 0, 1}; - S32 dx = 0, dy = 0; - blend_tex = get_color_rendertarget(stats); - - if (gdraw->cur != gdraw->frame) - box.right = gdraw->tpw, box.bottom = gdraw->tph; - else { - box.left = gdraw->vx, box.top = gdraw->vy, - box.right = gdraw->vx + gdraw->tw, - box.bottom = gdraw->vy + gdraw->th; - dx = gdraw->tx0 - gdraw->tx0p; - dy = gdraw->ty0 - gdraw->ty0p; - } - - d3d->CopySubresourceRegion(blend_tex->handle.tex.d3d, 0, dx, dy, - 0, cur_rt_rsrc, 0, &box); - - stats->nonzero_flags |= GDRAW_STATS_blits; - stats->num_blits += 1; - stats->num_blit_pixels += - (box.right - box.left) * (box.bottom - box.top); - - set_texture(1, (GDrawTexture*)blend_tex, false, - GDRAW_WRAP_clamp); - } - - cur_rt_rsrc->Release(); - } - - if (!set_renderstate_full(GDRAW_vformat_v2tc2, r, stats, rescale1)) - return; - - do_screen_quad(&s, tc, stats); - tag_resources(r->tex[0], r->tex[1]); - if (blend_tex) gdraw_FreeTexture((GDrawTexture*)blend_tex, 0, stats); - } -} - -/////////////////////////////////////////////////////////////////////// -// -// Shaders and state -// - -#include GDRAW_SHADER_FILE - -static void destroy_shader(ProgramWithCachedVariableLocations* p) { - if (p->pshader) { - p->pshader->Release(); - p->pshader = NULL; - } -} - -static ID3D1X(Buffer) * create_dynamic_buffer(U32 size, U32 bind) { - D3D1X_(BUFFER_DESC) - desc = {size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0}; - ID3D1X(Buffer)* buf = NULL; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = NULL; - } - return buf; -} - -static void init_dyn_buffer(DynBuffer* buf, U32 size, U32 bind) { - buf->buffer = create_dynamic_buffer(size, bind); - buf->size = size; - buf->write_pos = 0; - buf->alloc_pos = 0; -} - -// These two functions are implemented by the D3D10- respectively D3D11-specific -// part. -static void create_pixel_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src); -static void create_vertex_shader(ProgramWithCachedVariableLocations* p, - ProgramWithCachedVariableLocations* src); - -static void create_all_shaders_and_state(void) { - ID3D1X(Device)* d3d = gdraw->d3d_device; - HRESULT hr; - S32 i, j; - - for (i = 0; i < GDRAW_TEXTURE__count * 3; ++i) - create_pixel_shader(&gdraw->fprog[0][i], pshader_basic_arr + i); - for (i = 0; i < GDRAW_BLENDSPECIAL__count; ++i) - create_pixel_shader(&gdraw->exceptional_blend[i], - pshader_exceptional_blend_arr + i); - for (i = 0; i < 32; ++i) - create_pixel_shader(&gdraw->filter_prog[0][i], pshader_filter_arr + i); - for (i = 0; i < MAX_TAPS + 1; ++i) - create_pixel_shader(&gdraw->blur_prog[i], pshader_blur_arr + i); - create_pixel_shader(&gdraw->colormatrix, pshader_color_matrix_arr); - create_pixel_shader(&gdraw->clear_ps, pshader_manual_clear_arr); - - for (i = 0; i < GDRAW_vformat__basic_count; i++) { - ProgramWithCachedVariableLocations* vsh = vshader_vsd3d10_arr + i; - - create_vertex_shader(&gdraw->vert[i], vsh); - HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, - vsh->bytecode, vsh->size, - &gdraw->inlayout[i]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = NULL; - } - } - - // create rasterizer state setups - for (i = 0; i < 2; ++i) { - D3D1X_(RASTERIZER_DESC) - raster_desc = {D3D1X_(FILL_SOLID), - D3D1X_(CULL_NONE), - FALSE, - 0, - 0.0f, - 0.0f, - TRUE, - TRUE, - FALSE, - FALSE}; - raster_desc.MultisampleEnable = i; - hr = d3d->CreateRasterizerState(&raster_desc, &gdraw->raster_state[i]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateRasterizerState", ""); - return; - } - } - - // create sampler state setups - static const D3D1X_(TEXTURE_ADDRESS_MODE) - addrmode[ASSERT_COUNT(GDRAW_WRAP__count, 4)] = { - D3D1X_(TEXTURE_ADDRESS_CLAMP), // GDRAW_WRAP_clamp - D3D1X_(TEXTURE_ADDRESS_WRAP), // GDRAW_WRAP_repeat - D3D1X_(TEXTURE_ADDRESS_MIRROR), // GDRAW_WRAP_mirror - D3D1X_(TEXTURE_ADDRESS_CLAMP), // GDRAW_WRAP_clamp_to_border - // (unused for this renderer) - }; - - for (i = 0; i < 2; ++i) { - for (j = 0; j < GDRAW_WRAP__count; ++j) { - D3D1X_(SAMPLER_DESC) sampler_desc; - memset(&sampler_desc, 0, sizeof(sampler_desc)); - sampler_desc.Filter = i ? D3D1X_(FILTER_MIN_LINEAR_MAG_MIP_POINT) - : D3D1X_(FILTER_MIN_MAG_MIP_LINEAR); - sampler_desc.AddressU = addrmode[j]; - sampler_desc.AddressV = addrmode[j]; - sampler_desc.AddressW = D3D1X_(TEXTURE_ADDRESS_CLAMP); - sampler_desc.MaxAnisotropy = 1; - sampler_desc.MaxLOD = D3D1X_(FLOAT32_MAX); - hr = d3d->CreateSamplerState(&sampler_desc, - &gdraw->sampler_state[i][j]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateSamplerState", ""); - return; - } - } - } - - // create blend stage setups - static struct blendspec { - BOOL blend; - D3D1X_(BLEND) src; - D3D1X_(BLEND) dst; - } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_none - TRUE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_INV_SRC_ALPHA), // GDRAW_BLEND_alpha - TRUE, - D3D1X_(BLEND_DEST_COLOR), - D3D1X_(BLEND_INV_SRC_ALPHA), // GDRAW_BLEND_multiply - TRUE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ONE), // GDRAW_BLEND_add - - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_filter - FALSE, - D3D1X_(BLEND_ONE), - D3D1X_(BLEND_ZERO), // GDRAW_BLEND_special - }; - - for (i = 0; i < GDRAW_BLEND__count; ++i) { - gdraw->blend_state[i] = create_blend_state( - d3d, blends[i].blend, blends[i].src, blends[i].dst); - if (!gdraw->blend_state[i]) return; - } - - D3D1X_(BLEND_DESC) blend_desc; - memset(&blend_desc, 0, sizeof(blend_desc)); - hr = d3d->CreateBlendState(&blend_desc, &gdraw->blend_no_color_write); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBlendState", ""); - return; - } - - // create depth/stencil setups - for (i = 0; i < 2; ++i) { - for (j = 0; j < 2; ++j) { - D3D1X_(DEPTH_STENCIL_DESC) depth_desc; - memset(&depth_desc, 0, sizeof(depth_desc)); - - depth_desc.DepthEnable = (i || j); - depth_desc.DepthWriteMask = i ? D3D1X_(DEPTH_WRITE_MASK_ALL) - : D3D1X_(DEPTH_WRITE_MASK_ZERO); - depth_desc.DepthFunc = - j ? D3D1X_(COMPARISON_LESS) : D3D1X_(COMPARISON_ALWAYS); - depth_desc.StencilEnable = FALSE; - - hr = d3d->CreateDepthStencilState(&depth_desc, - &gdraw->depth_state[i][j]); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateDepthStencilState", ""); - return; - } - } - } - - // constant buffers - gdraw->cb_vertex = - create_dynamic_buffer(sizeof(VertexVars), D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_ps_common = create_dynamic_buffer(sizeof(PixelCommonVars), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_filter = create_dynamic_buffer(sizeof(PixelParaFilter), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_colormatrix = create_dynamic_buffer(sizeof(PixelParaColorMatrix), - D3D1X_(BIND_CONSTANT_BUFFER)); - gdraw->cb_blur = create_dynamic_buffer(sizeof(PixelParaBlur), - D3D1X_(BIND_CONSTANT_BUFFER)); - - // quad index buffer - assert(QUAD_IB_COUNT * 4 < - 65535); // can't use more; we have 16-bit index buffers and 0xffff = - // primitive cut index - U16* inds = (U16*)IggyGDrawMalloc(QUAD_IB_COUNT * 6 * sizeof(U16)); - if (inds) { - D3D1X_(BUFFER_DESC) bufdesc = {}; - D3D1X_(SUBRESOURCE_DATA) data = {inds, 0, 0}; - - bufdesc.ByteWidth = QUAD_IB_COUNT * 6 * sizeof(U16); - bufdesc.Usage = D3D1X_(USAGE_IMMUTABLE); - bufdesc.BindFlags = D3D1X_(BIND_INDEX_BUFFER); - - for (U16 i = 0; i < QUAD_IB_COUNT; i++) { - inds[i * 6 + 0] = i * 4 + 0; - inds[i * 6 + 1] = i * 4 + 1; - inds[i * 6 + 2] = i * 4 + 2; - inds[i * 6 + 3] = i * 4 + 0; - inds[i * 6 + 4] = i * 4 + 2; - inds[i * 6 + 5] = i * 4 + 3; - } - - hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = NULL; - } - IggyGDrawFree(inds); - } else - gdraw->quad_ib = NULL; -} - -static void destroy_all_shaders_and_state() { - S32 i; - - for (i = 0; i < GDRAW_TEXTURE__count * 3; ++i) - destroy_shader(&gdraw->fprog[0][i]); - for (i = 0; i < GDRAW_BLENDSPECIAL__count; ++i) - destroy_shader(&gdraw->exceptional_blend[i]); - for (i = 0; i < 32; ++i) destroy_shader(&gdraw->filter_prog[0][i]); - for (i = 0; i < MAX_TAPS + 1; ++i) destroy_shader(&gdraw->blur_prog[i]); - destroy_shader(&gdraw->colormatrix); - destroy_shader(&gdraw->clear_ps); - - for (i = 0; i < GDRAW_vformat__basic_count; i++) { - safe_release(gdraw->inlayout[i]); - destroy_shader(&gdraw->vert[i]); - } - - for (i = 0; i < 2; ++i) safe_release(gdraw->raster_state[i]); - for (i = 0; i < GDRAW_WRAP__count * 2; ++i) - safe_release(gdraw->sampler_state[0][i]); - for (i = 0; i < GDRAW_BLEND__count; ++i) - safe_release(gdraw->blend_state[i]); - for (i = 0; i < 2 * 2; ++i) safe_release(gdraw->depth_state[0][i]); - - safe_release(gdraw->blend_no_color_write); - - safe_release(gdraw->cb_vertex); - safe_release(gdraw->cb_ps_common); - safe_release(gdraw->cb_filter); - safe_release(gdraw->cb_colormatrix); - safe_release(gdraw->cb_blur); - - safe_release(gdraw->quad_ib); -} - -//////////////////////////////////////////////////////////////////////// -// -// Create and tear-down the state -// - -typedef struct { - S32 num_handles; - S32 num_bytes; -} GDrawResourceLimit; - -// These are the defaults limits used by GDraw unless the user specifies -// something else. -static GDrawResourceLimit gdraw_limits[GDRAW_D3D1X_(RESOURCE__count)] = { - MAX_RENDER_STACK_DEPTH + 1, - 16 * 1024 * 1024, // RESOURCE_rendertarget - 500, - 16 * 1024 * 1024, // RESOURCE_texture - 1000, - 2 * 1024 * 1024, // RESOURCE_vertexbuffer - 0, - 256 * 1024, // RESOURCE_dynbuffer -}; - -static GDrawHandleCache* make_handle_cache(gdraw_resourcetype type) { - S32 num_handles = gdraw_limits[type].num_handles; - S32 num_bytes = gdraw_limits[type].num_bytes; - GDrawHandleCache* cache = (GDrawHandleCache*)IggyGDrawMalloc( - sizeof(GDrawHandleCache) + (num_handles - 1) * sizeof(GDrawHandle)); - if (cache) { - gdraw_HandleCacheInit(cache, num_handles, num_bytes); - cache->is_vertex = (type == GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - } - - return cache; -} - -static void free_gdraw() { - if (!gdraw) return; - if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); - if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); - IggyGDrawFree(gdraw); - gdraw = NULL; -} - -static bool alloc_dynbuffer(U32 size) { - // specified input size is vertex buffer size. determine sensible size for - // the corresponding index buffer. iggy always uses 16-bit indices and has - // three primary types of geometry it sends: - // - // 1. filled polygons. these are triangulated simple polygons and thus have - // roughly as many triangles as they have vertices. they use either 8- or - // 16-byte vertex formats; this makes a worst case of 6 bytes of indices - // for every 8 bytes of vertex data. - // 2. strokes and edge antialiasing. they use a 16-byte vertex format and - // worst-case write a "double quadstrip" which has 4 triangles for every - // 3 vertices, which means 24 bytes of index data for every 48 bytes - // of vertex data. - // 3. textured quads. they use a 16-byte vertex format, have exactly 2 - // triangles for every 4 vertices, and use either a static index buffer - // (quad_ib) or a single triangle strip, so for our purposes they need no - // space to store indices at all. - // - // 1) argues for allocating index buffers at 3/4 the size of the - // corresponding vertex buffer, while 2) and 3) need 1/2 the size of the - // vertex buffer or less. 2) and 3) are the most common types of vertex - // data, while 1) is used only for morphed shapes and in certain cases when - // the RESOURCE_vertexbuffer pool is full. we just play it safe anyway and - // make sure we size the IB large enough to cover the worst case for 1). - // this is conservative, but it probably doesn't matter much. - U32 ibsize = (size * 3) / 4; - - init_dyn_buffer(&gdraw->dyn_vb, size, D3D1X_(BIND_VERTEX_BUFFER)); - init_dyn_buffer(&gdraw->dyn_ib, ibsize, D3D1X_(BIND_INDEX_BUFFER)); - - gdraw->max_quad_vert_count = - RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); - gdraw->max_quad_vert_count &= ~3; // must be multiple of four - - return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; -} - -int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, - S32 num_bytes) { - GDrawStats stats = {0}; - - if (type == GDRAW_D3D1X_(RESOURCE_rendertarget)) // RT count is small and - // space is preallocated - num_handles = MAX_RENDER_STACK_DEPTH + 1; - - assert(type >= GDRAW_D3D1X_(RESOURCE_rendertarget) && - type < GDRAW_D3D1X_(RESOURCE__count)); - assert(num_handles >= 0); - assert(num_bytes >= 0); - - // nothing to do if the values are unchanged - if (gdraw_limits[type].num_handles == num_handles && - gdraw_limits[type].num_bytes == num_bytes) - return 1; - - gdraw_limits[type].num_handles = num_handles; - gdraw_limits[type].num_bytes = num_bytes; - - // if no gdraw context created, there's nothing to worry about - if (!gdraw) return 1; - - // resize the appropriate pool - switch (type) { - case GDRAW_D3D1X_(RESOURCE_rendertarget): - flush_rendertargets(&stats); - gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, - num_bytes); - return 1; - - case GDRAW_D3D1X_(RESOURCE_texture): - if (gdraw->texturecache) { - gdraw_res_flush(gdraw->texturecache, &stats); - IggyGDrawFree(gdraw->texturecache); - } - gdraw->texturecache = - make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != NULL; - - case GDRAW_D3D1X_(RESOURCE_vertexbuffer): - if (gdraw->vbufcache) { - gdraw_res_flush(gdraw->vbufcache, &stats); - IggyGDrawFree(gdraw->vbufcache); - } - gdraw->vbufcache = - make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; - - case GDRAW_D3D1X_(RESOURCE_dynbuffer): - unbind_resources(); - safe_release(gdraw->dyn_vb.buffer); - safe_release(gdraw->dyn_ib.buffer); - return alloc_dynbuffer(num_bytes); - - default: - return 0; - } -} - -static GDrawFunctions* create_context(ID3D1XDevice* dev, ID3D1XContext* ctx, - S32 w, S32 h) { - gdraw = (GDraw*)IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; - - memset(gdraw, 0, sizeof(*gdraw)); - - gdraw->frametex_width = w; - gdraw->frametex_height = h; - gdraw->d3d_device = dev; - gdraw->d3d_context = ctx; - - gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - gdraw_HandleCacheInit( - &gdraw->rendertargets, - gdraw_limits[GDRAW_D3D1X_(RESOURCE_rendertarget)].num_handles, - gdraw_limits[GDRAW_D3D1X_(RESOURCE_rendertarget)].num_bytes); - - if (!gdraw->texturecache || !gdraw->vbufcache || - !alloc_dynbuffer( - gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { - free_gdraw(); - return NULL; - } - - create_all_shaders_and_state(); - - gdraw_funcs.SetViewSizeAndWorldScale = gdraw_SetViewSizeAndWorldScale; - gdraw_funcs.GetInfo = gdraw_GetInfo; - - gdraw_funcs.DescribeTexture = gdraw_DescribeTexture; - gdraw_funcs.DescribeVertexBuffer = gdraw_DescribeVertexBuffer; - - gdraw_funcs.RenderingBegin = gdraw_RenderingBegin; - gdraw_funcs.RenderingEnd = gdraw_RenderingEnd; - gdraw_funcs.RenderTileBegin = gdraw_RenderTileBegin; - gdraw_funcs.RenderTileEnd = gdraw_RenderTileEnd; - - gdraw_funcs.TextureDrawBufferBegin = gdraw_TextureDrawBufferBegin; - gdraw_funcs.TextureDrawBufferEnd = gdraw_TextureDrawBufferEnd; - - gdraw_funcs.DrawIndexedTriangles = gdraw_DrawIndexedTriangles; - gdraw_funcs.FilterQuad = gdraw_FilterQuad; - - gdraw_funcs.SetAntialiasTexture = gdraw_SetAntialiasTexture; - - gdraw_funcs.ClearStencilBits = gdraw_ClearStencilBits; - gdraw_funcs.ClearID = gdraw_ClearID; - - gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; - gdraw_funcs.MakeTextureMore = gdraw_MakeTextureMore; - gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; - - gdraw_funcs.UpdateTextureBegin = gdraw_UpdateTextureBegin; - gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; - gdraw_funcs.UpdateTextureEnd = gdraw_UpdateTextureEnd; - - gdraw_funcs.FreeTexture = gdraw_FreeTexture; - gdraw_funcs.TryToLockTexture = gdraw_TryToLockTexture; - - gdraw_funcs.MakeTextureFromResource = - (gdraw_make_texture_from_resource*)gdraw_D3D1X_( - MakeTextureFromResource); - gdraw_funcs.FreeTextureFromResource = - gdraw_D3D1X_(DestroyTextureFromResource); - - gdraw_funcs.MakeVertexBufferBegin = gdraw_MakeVertexBufferBegin; - gdraw_funcs.MakeVertexBufferMore = gdraw_MakeVertexBufferMore; - gdraw_funcs.MakeVertexBufferEnd = gdraw_MakeVertexBufferEnd; - gdraw_funcs.TryToLockVertexBuffer = gdraw_TryLockVertexBuffer; - gdraw_funcs.FreeVertexBuffer = gdraw_FreeVertexBuffer; - - gdraw_funcs.UnlockHandles = gdraw_UnlockHandles; - gdraw_funcs.SetTextureUniqueID = gdraw_SetTextureUniqueID; - - gdraw_funcs.Set3DTransform = gdraw_Set3DTransform; - - return &gdraw_funcs; -} - -void gdraw_D3D1X_(DestroyContext)(void) { - if (gdraw && gdraw->d3d_device) { - GDrawStats stats = {0}; - clear_renderstate(); - stencil_state_cache_clear(); - destroy_all_shaders_and_state(); - safe_release(gdraw->aa_tex); - safe_release(gdraw->aa_tex_view); - safe_release(gdraw->dyn_vb.buffer); - safe_release(gdraw->dyn_ib.buffer); - - flush_rendertargets(&stats); - if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); - if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - - gdraw->d3d_device = NULL; - } - - free_gdraw(); -} - -void gdraw_D3D1X_(SetErrorHandler)(void(__cdecl* error_handler)(HRESULT hr)) { - if (gdraw) gdraw->error_handler = error_handler; -} - -void gdraw_D3D1X_(PreReset)(void) { - if (!gdraw) return; - - GDrawStats stats = {0}; - flush_rendertargets(&stats); - - // we may end up resizing the frame buffer - gdraw->frametex_width = 0; - gdraw->frametex_height = 0; -} - -void gdraw_D3D1X_(PostReset)(void) { - // maybe re-create rendertargets right now? -} - -void RADLINK gdraw_D3D1X_(BeginCustomDraw)(IggyCustomDrawCallbackRegion* region, - F32 mat[4][4]) { - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(mat[0], region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK gdraw_D3D1X_(BeginCustomDraw_4J)( - IggyCustomDrawCallbackRegion* region, F32 mat[16]) { - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(mat, region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK gdraw_D3D1X_(CalculateCustomDraw_4J)( - IggyCustomDrawCallbackRegion* region, F32 mat[16]) { - gdraw_GetObjectSpaceMatrix(mat, region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK -gdraw_D3D1X_(EndCustomDraw)(IggyCustomDrawCallbackRegion* /*region*/) { - GDrawStats stats = {}; - set_common_renderstate(); - set_viewport(); - set_render_target(&stats); -} - -void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, - S32* handles_used, - S32* bytes_used) { - GDrawHandleCache* cache; - - switch (type) { - case GDRAW_D3D1X_(RESOURCE_rendertarget): - cache = &gdraw->rendertargets; - break; - case GDRAW_D3D1X_(RESOURCE_texture): - cache = gdraw->texturecache; - break; - case GDRAW_D3D1X_(RESOURCE_vertexbuffer): - cache = gdraw->vbufcache; - break; - case GDRAW_D3D1X_(RESOURCE_dynbuffer): - *handles_used = 0; - *bytes_used = gdraw->last_dyn_maxalloc; - return; - default: - cache = NULL; - break; - } - - *handles_used = *bytes_used = 0; - - if (cache) { - S32 i; - U64 frame = gdraw->frame_counter; - - for (i = 0; i < cache->max_handles; ++i) - if (cache->handle[i].bytes && cache->handle[i].owner && - cache->handle[i].fence.value == frame) { - *handles_used += 1; - *bytes_used += cache->handle[i].bytes; - } - } -} - -static S32 num_pixels(S32 w, S32 h, S32 mipmaps) { - S32 k, pixels = 0; - for (k = 0; k < mipmaps; ++k) { - pixels += w * h * 2; - w = (w >> 1); - w += !w; - h = (h >> 1); - h += !h; - } - return pixels; -} - -GDrawTexture* RADLINK gdraw_D3D1X_(MakeTextureFromResource)( - U8* resource_file, S32 /*len*/, IggyFileTextureRaw* texture) { - char* failed_call = ""; - U8* free_data = 0; - GDrawTexture* t = 0; - S32 width, height, mipmaps, size, blk; - ID3D1X(Texture2D)* tex = 0; - ID3D1X(ShaderResourceView)* view = 0; - - DXGI_FORMAT d3dfmt; - D3D1X_(SUBRESOURCE_DATA) mipdata[24] = {0}; - S32 k; - - HRESULT hr = 0; - - width = texture->w; - height = texture->h; - mipmaps = texture->mipmaps; - blk = 1; - - D3D1X_(TEXTURE2D_DESC) - desc = {width, - height, - mipmaps, - 1, - DXGI_FORMAT_UNKNOWN, - {1, 0}, - D3D1X_(USAGE_IMMUTABLE), - D3D1X_(BIND_SHADER_RESOURCE), - 0, - 0}; - - switch (texture->format) { - case IFT_FORMAT_rgba_8888: - size = 4; - d3dfmt = DXGI_FORMAT_R8G8B8A8_UNORM; - break; - case IFT_FORMAT_DXT1: - size = 8; - d3dfmt = DXGI_FORMAT_BC1_UNORM; - blk = 4; - break; - case IFT_FORMAT_DXT3: - size = 16; - d3dfmt = DXGI_FORMAT_BC2_UNORM; - blk = 4; - break; - case IFT_FORMAT_DXT5: - size = 16; - d3dfmt = DXGI_FORMAT_BC3_UNORM; - blk = 4; - break; - default: { - IggyGDrawSendWarning(NULL, - "GDraw .iggytex raw texture format %d not " - "supported by hardware", - texture->format); - goto done; - } - } - - desc.Format = d3dfmt; - - U8* data = resource_file + texture->file_offset; - - if (texture->format == IFT_FORMAT_i_8 || - texture->format == IFT_FORMAT_i_4) { - // convert from intensity to luma+alpha - S32 i; - S32 total_size = 2 * num_pixels(width, height, mipmaps); - - free_data = (U8*)IggyGDrawMalloc(total_size); - if (!free_data) { - IggyGDrawSendWarning(NULL, - "GDraw out of memory to store texture data to " - "pass to D3D for %d x %d texture", - width, height); - goto done; - } - - U8* cur = free_data; - - for (k = 0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - for (i = 0; i < w * h; ++i) { - cur[0] = cur[1] = *data++; - cur += 2; - } - } - data = free_data; - } - - for (k = 0; k < mipmaps; ++k) { - S32 w = RR_MAX(width >> k, 1); - S32 h = RR_MAX(height >> k, 1); - S32 blkw = (w + blk - 1) / blk; - S32 blkh = (h + blk - 1) / blk; - - mipdata[k].pSysMem = data; - mipdata[k].SysMemPitch = blkw * size; - data += blkw * blkh * size; - } - - failed_call = "CreateTexture2D"; - hr = gdraw->d3d_device->CreateTexture2D(&desc, mipdata, &tex); - if (FAILED(hr)) goto done; - - failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); - if (FAILED(hr)) goto done; - - t = gdraw_D3D1X_(WrappedTextureCreate)(view); - -done: - if (FAILED(hr)) { - report_d3d_error(hr, failed_call, ""); - } - - if (free_data) IggyGDrawFree(free_data); - - if (!t) { - if (view) view->Release(); - if (tex) tex->Release(); - } else { - ((GDrawHandle*)t)->handle.tex.d3d = tex; - } - return t; -} - -void RADLINK gdraw_D3D1X_(DestroyTextureFromResource)(GDrawTexture* tex) { - GDrawHandle* h = (GDrawHandle*)tex; - safe_release(h->handle.tex.d3d_view); - safe_release(h->handle.tex.d3d); - gdraw_D3D1X_(WrappedTextureDestroy)(tex); -} diff --git a/targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl b/targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl deleted file mode 100644 index e252efbb3..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_gl_shaders.inl +++ /dev/null @@ -1,1536 +0,0 @@ -// This file was automatically generated by shadergen. Do not edit by hand! - -static char pshader_basic_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_basic_frag1[] = ""; -static char pshader_basic_frag2[] = - "COMMON_PSCONSTANTS;\n" - "\n" - "#ifdef TEX0\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "#endif\n" - "\n" - "#ifndef READ_ALPHA_TEX\n" - "#define READ_ALPHA_TEX(x) ((x).a)\n" - "#endif\n" - "\n" - "#ifndef AATEX_USE_SAMPLER1\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 7);\n" - "#else\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" - "#endif\n" - "\n" - "MAIN((ARGS))\n" - "{\n" - " LOWP VEC4 z;\n" - " MEDIUMP VEC4 t;\n" - " \n" - " z = color_mul;\n" - " \n" - " #ifndef ADDITIVE_ALPHA\n" - " z.rgb *= z.a; // premultiply; could do outside\n" - " #endif\n" - " \n" - " #ifdef TEX0\n" - " MEDIUMP VEC2 c,tc0;\n" - " tc0 = TC0;\n" - "\n" - " #ifdef EXPLICIT_PROJECTION\n" - " float one_over_w = 1.0 / TC1.y;\n" - " tc0.x *= one_over_w;\n" - " tc0.y *= one_over_w;\n" - " #endif\n" - " \n" - " #ifdef TEX0_RADIAL\n" - " tc0.x = sqrt(dot(tc0.xy,tc0.xy));\n" - " tc0.y = tc0.x; // necessary on some OpenGL devices\n" - " #else\n" - " #ifdef TEX0_FOCAL\n" - " c.x = tc0.x + focal.x;\n" - " c.y = tc0.y;\n" - " t.x = c.x * focal.y;\n" - " t.y = (c.x*c.x + c.y*c.y) * focal.z;\n" - " tc0.x = sqrt(t.y + t.x*t.x) - t.x;\n" - " tc0.y = tc0.x;\n" - " #endif\n" - " #endif\n" - "\n" - " #ifdef TEX0_ALPHA\n" - " t.a = READ_ALPHA_TEX(TEX2D(tex0, tc0));\n" - " #ifdef ADDITIVE_ALPHA\n" - " z.a *= t.a;\n" - " #else\n" - " z *= t.a;\n" - " #endif\n" - " #else\n" - " t = TEX2D(tex0, tc0);\n" - " #ifdef ADDITIVE_ALPHA\n" - " if (t.a != 0.0) t.rgb = t.rgb * (1.0/t.a); // unpremultiply\n" - " #endif\n" - " z *= t;\n" - " #endif\n" - " #endif\n" - "\n" - " MEDIUMP VEC2 tc1;\n" - " tc1.xy = TC1.xy;\n" - "\n" - " #ifdef EXPLICIT_PROJECTION\n" - " tc1.x /= TC1.y;\n" - " #endif\n" - "\n" - " // antialiasing blend curve\n" - " t = TEX2D(tex1, tc1.xy);\n" - " #ifdef ADDITIVE_ALPHA\n" - " z.a *= t.a;\n" - " #else\n" - " z *= t;\n" - " #endif\n" - "\n" - " #ifdef ADDITIVE_ALPHA\n" - " z += color_add;\n" - " z.rgb *= z.a; // premultiply\n" - " #else\n" - " #ifdef ADDITIVE\n" - " z.rgb += color_add.rgb * z.a; // scale addend to match premultiply\n" - " z.rgb = min(z.rgb, z.a);\n" - " #endif\n" - " #endif\n" - " \n" - " #ifdef TEX0_ALPHA_TEST\n" - " SHADER_ALPHATEST(z.a);\n" - " #endif\n" - "\n" - " OUTPUT(z);\n" - "}\n"; -static char pshader_basic_frag3[] = "#define ADDITIVE\n"; -static char pshader_basic_frag4[] = "#define ADDITIVE_ALPHA\n"; -static char pshader_basic_frag5[] = "#define TEX0\n"; -static char pshader_basic_frag6[] = - "#define TEX0\n" - "#define TEX0_ALPHA\n"; -static char pshader_basic_frag7[] = - "#define TEX0\n" - "#define TEX0_RADIAL\n"; -static char pshader_basic_frag8[] = - "#define TEX0\n" - "#define TEX0_FOCAL\n"; -static char pshader_basic_frag9[] = - "#define TEX0\n" - "#define TEX0_ALPHA\n" - "#define TEX0_ALPHA_TEST\n"; - -#define NUMFRAGMENTS_pshader_basic 4 -static char* pshader_basic_arr[18][NUMFRAGMENTS_pshader_basic] = { - { - pshader_basic_frag0, - pshader_basic_frag1, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag1, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag1, - pshader_basic_frag4, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag5, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag5, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag5, - pshader_basic_frag4, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag6, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag6, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag6, - pshader_basic_frag4, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag7, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag7, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag7, - pshader_basic_frag4, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag8, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag8, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag8, - pshader_basic_frag4, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag9, - pshader_basic_frag1, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag9, - pshader_basic_frag3, - pshader_basic_frag2, - }, - { - pshader_basic_frag0, - pshader_basic_frag9, - pshader_basic_frag4, - pshader_basic_frag2, - }, -}; - -static char** pshader_basic(int tex0, int additive) { - return pshader_basic_arr[0 + tex0 * 3 + additive * 1]; -} - -static char* pshader_basic_vars[] = {"tex0", "tex1", "color_mul", - "color_add", "focal", NULL}; - -static char pshader_general2_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_general2_frag1[] = - "COMMON_PCONSTANTS2\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "MAIN((ARGS2))\n" - "{\n" - " // get t, the basic texture color\n" - "\n" - " LOWP VEC4 t;\n" - " \n" - " t = TEX2D(tex0, tex_coord.xy);\n" - "\n" - " // now color-transform t\n" - " //\n" - " // to determine optimal format for vertex shader to output the color, " - "let's\n" - " // start by doing the math assuming the texture is premultiplied, but " - "not\n" - " // the color transform:\n" - " //\n" - " // out.r = (tex.r * color_mul.r * color_mul.a) + (color_add.r * " - "tex.a * color_mul.a)\n" - " // out.a = tex.a * color_mul.a * color_add.a // color_add.a is " - "blend mode emulation\n" - " //\n" - " // now, we can see in the above we can premultiply both mul and add by " - "color_mul.a\n" - " //\n" - " // out.r = (tex.r * color_mulp.r) + (color_addp.r * tex.a)\n" - " // out.a = tex.a * color_mulp.a // can premultiply color_add.a " - "here as well\n" - "\n" - " \n" - " LOWP VEC4 c;\n" - " c.rgb = t.rgb * color_mul.rgb + t.a * color_add.rgb;\n" - " c.a = t.a * color_mul.a;\n" - "\n" - " // apply clip rect\n" - " //\n" - " // naive math, using panel-space coordinates\n" - " //\n" - " // panel_offset = abs(pos-center) - half_width\n" - " //\n" - " // Above function is negative where not clipped, positive\n" - " // where clipped. Now, we want to capture a one-pixel boundary,\n" - " // so we need to go to pixel coordinates:\n" - " //\n" - " // panel_offset *= pixels_per_panel_unit;\n" - " // // note this doesn't account for non-uniform scale of panel\n" - " //\n" - " // And now, with an offset in pixels, we want to compute an AA " - "mask:\n" - " //\n" - " // saturate(1-panel_offset)\n" - " //\n" - " // Note that we can just multiply pixels_per_panel_unit into\n" - " // each of the terms in panel offset, and we're left with:\n" - " //\n" - " // saturate(1 - (abs() - k))\n" - " //\n" - " // which becomes:\n" - " //\n" - " // saturate(k+1 - abs())\n" - " //\n" - " // and the +1 is folded into k.\n" - "\n" - " LOWP VEC2 cliprect_alpha = saturate(clip_rect.zw - abs(tex_coord.zw - " - "clip_rect.xy));\n" - "\n" - " float edge_alpha = cliprect_alpha.x * cliprect_alpha.y;\n" - " // could be min, but multiply represents coverage better in theory; " - "@TODO check visually\n" - "\n" - " // multiply it into c's alpha, but c's already premultiplied so " - "multiply it all\n" - " c *= edge_alpha;\n" - "\n" - " OUTPUT(c);\n" - "}\n"; - -#define NUMFRAGMENTS_pshader_general2 2 -static char* pshader_general2_arr[1][NUMFRAGMENTS_pshader_general2] = { - { - pshader_general2_frag0, - pshader_general2_frag1, - }, -}; - -static char** pshader_general2(void) { return pshader_general2_arr[0]; } - -static char* pshader_general2_vars[] = {"tex0", NULL}; - -static char pshader_exceptional_blend_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_exceptional_blend_frag1[] = - "#define BLENDPROG return s*d;\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag2[] = - "#define TEX0\n" - "\n" - "MEDIUMP float compute(MEDIUMP float s, MEDIUMP float sa, MEDIUMP float d, " - "MEDIUMP float da)\n" - "{\n" - " BLENDPROG\n" - "}\n" - "\n" - "MEDIUMP float compute_a(MEDIUMP float sa, MEDIUMP float da)\n" - "{\n" - " ALPHAFUNC\n" - "}\n" - "\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" - "COMMON_PSCONSTANTS;\n" - "\n" - "MAIN((ARGS))\n" - "{\n" - " MEDIUMP VEC4 srcc,dstc;\n" - " MEDIUMP VEC3 mixed;\n" - " MEDIUMP VEC2 tc;\n" - " srcc = TEX2D(tex0, TC0.xy);\n" - " srcc = srcc*VEC4(color_mul.rgb, 1.0)*color_mul.a + color_add*srcc.a;\n" - " srcc = clamp(srcc,VEC4(0.0,0.0,0.0,0.0),VEC4(1.0,1.0,1.0,1.0));\n" - " tc = TC0.xy;\n" - " #ifndef EXCEPTIONAL_BLEND_LOAD\n" - " #ifndef EXCEPTIONAL_BLEND_RESCALE\n" - " dstc = TEX2D(tex1, tc).rgba;\n" - " #else\n" - " dstc = TEX2D(tex1, tc*rescale1.xy + rescale1.zw).rgba;\n" - " #endif\n" - " #else\n" - " dstc = EXCEPTIONAL_BLEND_LOAD(tex1, tc);\n" - " #endif\n" - " mixed.r = compute(srcc.r,srcc.a, dstc.r,dstc.a);\n" - " mixed.g = compute(srcc.g,srcc.a, dstc.g,dstc.a);\n" - " mixed.b = compute(srcc.b,srcc.a, dstc.b,dstc.a);\n" - " MEDIUMP VEC4 res;\n" - " #ifdef DIRECT\n" - " res.rgb = mixed;\n" - " #else\n" - " res.rgb = mixed + (1.0-srcc.a)*dstc.rgb + (1.0-dstc.a)*srcc.rgb;\n" - " #endif\n" - " res.a = compute_a(srcc.a,dstc.a);\n" - " OUTPUT(res);\n" - "}\n"; -static char pshader_exceptional_blend_frag3[] = - "#define BLENDPROG return sa*da - (da-d)*(sa-s);\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag4[] = - "#define BLENDPROG return max(sa*d,s*da);\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag5[] = - "#define BLENDPROG return min(sa*d,s*da);\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag6[] = - "#define DIRECT\n" - "#define BLENDPROG return min(d+s,1.0);\n" - "#define ALPHAFUNC return min(sa+da,1.0);\n"; -static char pshader_exceptional_blend_frag7[] = - "#define DIRECT\n" - "#define BLENDPROG return max(d-s,0.0);\n" - "#define ALPHAFUNC return min(sa+da,1.0);\n"; -static char pshader_exceptional_blend_frag8[] = - "#define BLENDPROG return abs(sa*d-s*da);\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag9[] = - "#define BLENDPROG return sa*(da-d);\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag10[] = - "#define BLENDPROG return d < da/2.0 ? (2.0*s*d) : (sa*da - " - "2.0*(da-d)*(sa-s));\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag11[] = - "#define BLENDPROG return s < sa/2.0 ? (2.0*s*d) : (sa*da - " - "2.0*(da-d)*(sa-s));\n" - "#define ALPHAFUNC return sa+da-sa*da;\n"; -static char pshader_exceptional_blend_frag12[] = - "#define DIRECT\n" - "#define BLENDPROG return d*(1.0-sa);\n" - "#define ALPHAFUNC return (1.0-sa)*da;\n"; -static char pshader_exceptional_blend_frag13[] = - "#define DIRECT\n" - "#define BLENDPROG return d*sa;\n" - "#define ALPHAFUNC return sa*da;\n"; - -#define NUMFRAGMENTS_pshader_exceptional_blend 3 -static char* - pshader_exceptional_blend_arr[13][NUMFRAGMENTS_pshader_exceptional_blend] = - { - { - NULL, - NULL, - NULL, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag1, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag3, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag4, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag5, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag6, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag7, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag8, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag9, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag10, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag11, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag12, - pshader_exceptional_blend_frag2, - }, - { - pshader_exceptional_blend_frag0, - pshader_exceptional_blend_frag13, - pshader_exceptional_blend_frag2, - }, -}; - -static char** pshader_exceptional_blend(int blend_mode) { - return pshader_exceptional_blend_arr[0 + blend_mode * 1]; -} - -static char* pshader_exceptional_blend_vars[] = {"tex0", "tex1", "color_mul", - "color_add", NULL}; - -static char pshader_filter_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_filter_frag1[] = ""; -static char pshader_filter_frag2[] = - "#define TEX0\n" - "\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex2, 2);\n" - "\n" - "COMMON_PSCONSTANTS;\n" - "\n" - "BEGIN_CONSTANTS \n" - " DECLARE_CONST_EXTRA(HIGHP VEC4, clamp0, 4);\n" - " DECLARE_CONST_EXTRA(HIGHP VEC4, clamp1, 5);\n" - " #define CLAMP(a,b) clamp(a.xy, b.xy, b.zw)\n" - "\n" - " DECLARE_CONST_EXTRA(LOWP VEC4, color, 6);\n" - " DECLARE_CONST_EXTRA(LOWP VEC4, color2, 7);\n" - " DECLARE_CONST_EXTRA(MEDIUMP VEC4, tc_off, 8);\n" - "END_CONSTANTS\n" - " \n" - "MAIN((ARGS))\n" - "{\n" - " LOWP VEC4 source;\n" - " source = TEX2D(tex1, CLAMP(TC0.xy,clamp1));\n" - " MEDIUMP float shadow_a = TEX2D(tex0, CLAMP(TC0.xy + " - "tc_off.xy,clamp0)).a;\n" - " \n" - " #ifdef BEVEL\n" - " MEDIUMP float shadow_b = TEX2D(tex0, CLAMP(TC0.xy - " - "tc_off.xy,clamp0)).a;\n" - " shadow_a = (shadow_b - shadow_a) * tc_off.z;\n" - " #ifdef GRADIENT\n" - " shadow_a = clamp(shadow_a*0.5 + 0.5, 0.0, 1.0);\n" - " #else\n" - " shadow_b = clamp(-shadow_a, 0.0, 1.0);\n" - " shadow_a = clamp(shadow_a, 0.0, 1.0);\n" - " #endif\n" - " #else\n" - " #ifdef INNER\n" - " #ifndef GRADIENT\n" - " shadow_a = 1.0-shadow_a;\n" - " #endif // !GRADIENT\n" - " #endif // INNER\n" - " shadow_a = min(shadow_a*tc_off.z,1.0);\n" - " #endif // BEVEL\n" - " \n" - " #ifdef GRADIENT\n" - " MEDIUMP VEC2 gtc = VEC2(shadow_a, 0.5);\n" - " MEDIUMP VEC4 ecolor = TEX2D(tex2, gtc);\n" - " shadow_a = 1.0;\n" - " #else\n" - " #ifdef BEVEL\n" - " MEDIUMP VEC4 ecolor = shadow_b*color + shadow_a*color2;\n" - " shadow_a = 1.0;\n" - " #else\n" - " MEDIUMP VEC4 ecolor = color;\n" - " #endif\n" - " #endif\n" - " \n" - " #ifdef ONTOP\n" - " #ifdef KNOCKOUT\n" - " OUTPUT(ecolor);\n" - " #else\n" - " OUTPUT(ecolor + source * (1.0-ecolor.a));\n" - " #endif\n" - " #else\n" - " \n" - " #ifdef KNOCKOUT\n" - " #ifdef INNER\n" - " // KNOCKOUT & INNER\n" - " OUTPUT(ecolor * source.a * shadow_a);\n" - " #else\n" - " // KNOCKOUT & !INNER\n" - " OUTPUT(ecolor * (1.0-source.a) * shadow_a);\n" - " #endif\n" - " #else // !KNOCKOUT\n" - " \n" - " #ifdef INNER\n" - " // !KNOCKOUT & INNER\n" - " /* this is particularly subtle; effectively computes\n" - " invert shadow\n" - " unpremultiply source\n" - " shadow*color over source.rgb (treat as opaque)\n" - " multiply through by source alpha (i.e. make premultiplied again)\n" - " but expressed without *actually* unpremultiplying\n" - " */\n" - " LOWP VEC4 shadow = ecolor * shadow_a;\n" - " LOWP VEC4 res;\n" - " res.rgb = shadow.rgb*source.a + source.rgb*(1.0-shadow.a);\n" - " res.a = source.a;\n" - " OUTPUT(res);\n" - " #else\n" - " // !KNOCKOUT & !INNER\n" - " LOWP VEC4 shadow = ecolor * shadow_a;\n" - " OUTPUT(shadow * (1.0-source.a) + source);\n" - " #endif // INNER\n" - "\n" - " #endif // KNOCKOUT\n" - " #endif // ONTOP\n" - "}\n"; -static char pshader_filter_frag3[] = "#define KNOCKOUT\n"; -static char pshader_filter_frag4[] = "#define GRADIENT\n"; -static char pshader_filter_frag5[] = "#define INNER\n"; -static char pshader_filter_frag6[] = "#define ONTOP\n"; -static char pshader_filter_frag7[] = "#define BEVEL\n"; - -#define NUMFRAGMENTS_pshader_filter 7 -static char* pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag1, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag1, - pshader_filter_frag5, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag1, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag1, - pshader_filter_frag2, - }, - { - pshader_filter_frag0, - pshader_filter_frag7, - pshader_filter_frag6, - pshader_filter_frag1, - pshader_filter_frag4, - pshader_filter_frag3, - pshader_filter_frag2, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - -static char** pshader_filter(int bevel, int ontop, int inner, int gradient, - int knockout) { - return pshader_filter_arr[0 + bevel * 16 + ontop * 8 + inner * 4 + - gradient * 2 + knockout * 1]; -} - -static char* pshader_filter_vars[] = {"tex0", "tex1", "color", - "tc_off", "tex2", "clamp0", - "clamp1", "color2", NULL}; - -static char pshader_blur_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_blur_frag1[] = "#define TAPS TAP(0); TAP(1);\n"; -static char pshader_blur_frag2[] = - "#define TEX0\n" - "\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "COMMON_PSCONSTANTS;\n" - "\n" - "BEGIN_CONSTANTS\n" - " DECLARE_CONST_EXTRA(HIGHP VEC4, clampv, 4);\n" - " #define CLAMP(t) clamp(t, clampv.xy, clampv.zw)\n" - " \n" - " DECLARE_CONST_EXTRA(MEDIUMP VEC4, tap[9], 5);\n" - "END_CONSTANTS\n" - "\n" - "MAIN((ARGS))\n" - "{\n" - " MEDIUMP VEC4 s = VEC4(0,0,0,0);\n" - " \n" - " #define TAP(i) s += TEX2D(tex0, CLAMP(TC0.xy + tap[i].xy)) * " - "tap[i].z\n" - " TAPS\n" - " \n" - " OUTPUT(s);\n" - "}\n"; -static char pshader_blur_frag3[] = "#define TAPS TAP(0); TAP(1); TAP(2);\n"; -static char pshader_blur_frag4[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3);\n"; -static char pshader_blur_frag5[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4);\n"; -static char pshader_blur_frag6[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5);\n"; -static char pshader_blur_frag7[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6);\n"; -static char pshader_blur_frag8[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6); " - "TAP(7);\n"; -static char pshader_blur_frag9[] = - "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6); " - "TAP(7); TAP(8);\n"; - -#define NUMFRAGMENTS_pshader_blur 3 -static char* pshader_blur_arr[10][NUMFRAGMENTS_pshader_blur] = { - { - NULL, - NULL, - NULL, - }, - { - NULL, - NULL, - NULL, - }, - { - pshader_blur_frag0, - pshader_blur_frag1, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag3, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag4, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag5, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag6, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag7, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag8, - pshader_blur_frag2, - }, - { - pshader_blur_frag0, - pshader_blur_frag9, - pshader_blur_frag2, - }, -}; - -static char** pshader_blur(int numtaps) { - return pshader_blur_arr[0 + numtaps * 1]; -} - -static char* pshader_blur_vars[] = {"tex0", "tap", "clampv", NULL}; - -static char pshader_color_matrix_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_color_matrix_frag1[] = - "#define TEX0\n" - "\n" - "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" - "COMMON_PSCONSTANTS;\n" - "\n" - "BEGIN_CONSTANTS\n" - " DECLARE_CONST_EXTRA(MEDIUMP VEC4, data[5], 4);\n" - "END_CONSTANTS\n" - "\n" - "MAIN((ARGS))\n" - "{\n" - " MEDIUMP VEC4 t,color;\n" - " t = TEX2D(tex0, TC0.xy);\n" - " \n" - "#ifndef COLORMATRIX_HAS_ALPHA_EFFECTS\n" - " // version of colormatrix assuming no additive alpha in matrix,\n" - " // which is all CS3 seems to be able to output\n" - " color.r = dot(data[0], t) + data[4].r*t.a;\n" - " color.g = dot(data[1], t) + data[4].g*t.a;\n" - " color.b = dot(data[2], t) + data[4].b*t.a;\n" - " color.a = data[3].a * t.a;\n" - " color.rgb = color.rgb * data[3].a;\n" - "#else\n" - " // version of colormatrix that matches spec \n" - " if (t.a == 0.0)\n" - " t.rgb = VEC3(0.0);\n" - " else\n" - " t.rgb /= t.a;\n" - " color.r = dot(data[0], t) + data[4].r;\n" - " color.g = dot(data[1], t) + data[4].g;\n" - " color.b = dot(data[2], t) + data[4].b;\n" - " color.a = dot(data[3], t) + data[4].a;\n" - " color.rgb = color.rgb * color.a;\n" - "#endif\n" - " OUTPUT(color);\n" - "}\n"; - -#define NUMFRAGMENTS_pshader_color_matrix 2 -static char* pshader_color_matrix_arr[1][NUMFRAGMENTS_pshader_color_matrix] = { - { - pshader_color_matrix_frag0, - pshader_color_matrix_frag1, - }, -}; - -static char** pshader_color_matrix(void) { return pshader_color_matrix_arr[0]; } - -static char* pshader_color_matrix_vars[] = {"tex0", "data", NULL}; - -static char pshader_manual_clear_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char pshader_manual_clear_frag1[] = - "COMMON_PSCONSTANTS;\n" - "\n" - "MAIN((ARGS))\n" - "{\n" - " OUTPUT(color_mul);\n" - "}\n"; - -#define NUMFRAGMENTS_pshader_manual_clear 2 -static char* pshader_manual_clear_arr[1][NUMFRAGMENTS_pshader_manual_clear] = { - { - pshader_manual_clear_frag0, - pshader_manual_clear_frag1, - }, -}; - -static char** pshader_manual_clear(void) { return pshader_manual_clear_arr[0]; } - -static char* pshader_manual_clear_vars[] = {"color_mul", NULL}; - -static char vshader_vsgl_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char vshader_vsgl_frag1[] = "#define FORMAT_V2\n"; -static char vshader_vsgl_frag2[] = - " uniform vec4 world0;\n" - " uniform vec4 world1;\n" - " uniform vec4 x_off;\n" - " uniform vec4 texgen_s;\n" - " uniform vec4 texgen_t;\n" - "#ifdef FLASH_10\n" - " uniform vec4 x3d;\n" - " uniform vec4 y3d;\n" - " uniform vec4 w3d;\n" - "#else\n" - " uniform vec4 viewproj;\n" - "#endif\n" - "\n" - " attribute vec4 position;\n" - " attribute vec4 in_attr;\n" - "\n" - " varying vec4 tex_coord;\n" - " \n" - " void main() {\n" - " // world transform\n" - " HIGHP vec4 wpos = vec4(dot(world0, position), dot(world1, " - "position), world0.z, 1.0);\n" - " \n" - " // texture coordinates\n" - " tex_coord = vec4(dot(texgen_s, position), dot(texgen_t, " - "position), 1.0, 0.0);\n" - " #ifdef FORMAT_V2TC2\n" - " tex_coord.xy = in_attr.xy;\n" - " #endif\n" - " \n" - " // antialias processing\n" - " #ifdef FORMAT_V2C4\n" - " HIGHP vec4 q,p;\n" - " HIGHP float len,newlen;\n" - " q.xy = in_attr.yz / 64.0;\n" - " len = length(q.xy);\n" - " p.x = q.x*x_off.x + q.y*x_off.y;\n" - " p.y = q.x*x_off.z + q.y*x_off.w;\n" - " p.z = 0.0; p.w = 0.0;\n" - " p.xy = vec2(dot(world0, p), dot(world1, p));\n" - " newlen = length(p.xy);\n" - " p *= (newlen!=0.0) ? len / newlen : 0.0;\n" - " wpos.xy += p.xy;\n" - " tex_coord.z = in_attr.x / 32.0;\n" - " #endif\n" - " \n" - " // view/projection transform\n" - " gl_Position = vec4(wpos.xy * viewproj.xy + viewproj.zw, " - "wpos.zw);\n" - "\n" - " #ifdef FLASH_10\n" - " gl_Position = wpos.x * x3d + wpos.y * y3d + w3d; // z is " - "ignored!\n" - " gl_Position.w = gl_Position.z;\n" - " gl_Position.z = wpos.z * gl_Position.w;\n" - " #endif\n" - " } \n"; -static char vshader_vsgl_frag3[] = "#define FORMAT_V2C4\n"; -static char vshader_vsgl_frag4[] = "#define FORMAT_V2TC2\n"; - -#define NUMFRAGMENTS_vshader_vsgl 3 -static char* vshader_vsgl_arr[3][NUMFRAGMENTS_vshader_vsgl] = { - { - vshader_vsgl_frag0, - vshader_vsgl_frag1, - vshader_vsgl_frag2, - }, - { - vshader_vsgl_frag0, - vshader_vsgl_frag3, - vshader_vsgl_frag2, - }, - { - vshader_vsgl_frag0, - vshader_vsgl_frag4, - vshader_vsgl_frag2, - }, -}; - -static char** vshader_vsgl(int vformat) { - return vshader_vsgl_arr[0 + vformat * 1]; -} - -static char* vshader_vsgl_vars[] = {"world0", "world1", "x_off", "texgen_s", - "texgen_t", "viewproj", NULL}; - -static char vshader_vsglihud_frag0[] = - "#version 110 // only need 100, but 110 works around a driver " - "issue\n" - "#define MAIN(x) void main()\n" - "#define ARGS\n" - "#define ARGS2\n" - "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" - "#define DECLARE_CONST(type, name, reg) uniform type name\n" - "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" - "#define SAMPLER sampler2D\n" - "#define TEX2D texture2D\n" - "#define VEC4 vec4\n" - "#define VEC3 vec3\n" - "#define VEC2 vec2\n" - "#define LOWP\n" - "#define MEDIUMP\n" - "#define HIGHP\n" - "#define TC0 tex_coord.xy\n" - "#define TC1 tex_coord.zw\n" - "#define OUTPUT(x) gl_FragColor = x\n" - "\n" - "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" - "\n" - "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " - "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " - "VEC4 tex_coord\n" - "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " - "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" - "#define BEGIN_CONSTANTS\n" - "#define END_CONSTANTS\n" - "\n" - "#define saturate(x) clamp(x,0.0,1.0)\n"; -static char vshader_vsglihud_frag1[] = - "uniform vec4 worldview[2];\n" - "uniform vec4 material[96];\n" - "uniform float textmode;\n" - "\n" - "#define pixels_per_panel_unit 1.0\n" - "\n" - "attribute vec2 position;\n" - "attribute vec2 texcoord;\n" - "attribute vec4 material_index; \n" - "\n" - "varying vec4 tex_coord;\n" - "varying vec4 color_mul;\n" - "varying vec4 color_add;\n" - "varying vec4 clip_rect;\n" - "\n" - "void main() {\n" - " // view/projection transform\n" - " gl_Position = vec4(worldview[0].w + dot(worldview[0].xy, position),\n" - " worldview[1].w + dot(worldview[1].xy, position),\n" - " 0.0,\n" - " 1.0);\n" - "\n" - " LOWP VEC4 c1_mul,c1_add,c2_mul,c2_add, c_mul,c_add;\n" - " HIGHP VEC4 clip;\n" - "\n" - " // convert 8-bit material_info loaded as float back to integers\n" - " LOWP VEC3 mat = floor(255.0*material_index.xyz + 0.5);\n" - "\n" - " // @TODO: flatten these into a single array\n" - " c1_mul = material[int(mat.r )];\n" - " c1_add = material[int(mat.r+1.0)];\n" - " c2_mul = material[int(mat.g )];\n" - " c2_add = material[int(mat.g+1.0)];\n" - " clip = material[int(mat.b )];\n" - "\n" - " // if textmode is 0, suppress c2_add.rgba\n" - "\n" - " // combine hierarchical and local colors\n" - " color_add.rgb = c1_mul.rgb * (c2_add.rgb * textmode) + c1_add.rgb;\n" - " color_mul = c1_mul * c2_mul;\n" - " color_mul.a *= material_index.w;\n" - "\n" - " // compute premultiplied alpha\n" - " color_mul.rgb *= color_mul.a;\n" - " color_add.rgb *= color_mul.a;\n" - "\n" - " // pass additive blending flag stored in c1_add.a and c2_add.a to " - "pixel shader\n" - " color_add.a = clamp(c1_add.a + c2_add.a * textmode,0.0,1.0);\n" - "\n" - " // except actually we'll premultiply that into color_mul.a\n" - " color_mul.a *= (1.0-color_add.a);\n" - "\n" - " // compute premultiplied cliprect\n" - " // for now cliprect comes in as x0,y0,x1,y1, not center/offset\n" - " \n" - " // coordinates come in already rotated into panel space, which is " - "also where cliprect is defined\n" - " HIGHP VEC2 center = (clip.xy + clip.zw) / 2.0;\n" - " HIGHP VEC2 offset = (clip.zw - clip.xy) / 2.0;\n" - "\n" - " // use of pixels_per_panel_unit here ignores effect of non-uniform " - "scaling\n" - " clip_rect.xy = center * pixels_per_panel_unit;\n" - " clip_rect.zw = offset * pixels_per_panel_unit + 1.0; // offset is " - "location where alpha goes to 0, so it's 1 pixel out\n" - "\n" - " tex_coord.zw = position * pixels_per_panel_unit;\n" - " tex_coord.xy = texcoord;\n" - "} \n"; - -#define NUMFRAGMENTS_vshader_vsglihud 2 -static char* vshader_vsglihud_arr[1][NUMFRAGMENTS_vshader_vsglihud] = { - { - vshader_vsglihud_frag0, - vshader_vsglihud_frag1, - }, -}; - -static char** vshader_vsglihud(void) { return vshader_vsglihud_arr[0]; } - -static char* vshader_vsglihud_vars[] = {"worldview", "material", "textmode", - NULL}; diff --git a/targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl b/targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl deleted file mode 100644 index 9b5be4efc..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_gl_shared.inl +++ /dev/null @@ -1,2695 +0,0 @@ -// gdraw_gl_shared.inl - copyright 2012 RAD Game Tools -// -// This file implements the part of the Iggy graphics driver layer shared -// between GL and GL ES 2 (which is most of it). It heavily depends on a bunch -// of typedefs, #defines and some utility functions that need to be set up -// correctly for the GL version being targeted. It also targets a kind of -// pseudo-GL 2.0; the platform implementation has to set up some #defines and -// perform extra initialization work if we go through extensions instead. This -// is all a bit ugly, but much easier to maintain than the original solution, -// where we just kept two almost identical versions of this code. - -///////////////////////////////////////////////////////////// -// -// common code shared by all GDraw implemetations -// - -// The native handle type holds resource handles and a coarse description. -typedef union { - // handle that is a texture - struct { - GLuint gl; - GLuint gl_renderbuf; - U32 w : 24; - U32 nonpow2 : 8; - U32 h : 24; - U32 reserved : 8; - } tex; - - // handle that is a vertex buffer - struct { - GLuint base; - GLuint indices; - } vbuf; -} GDrawNativeHandle; - -#include "gdraw_shared.inl" - -// max rendertarget stack depth. this depends on the extent to which you -// use filters and non-standard blend modes, and how nested they are. -#define MAX_RENDER_STACK_DEPTH \ - 8 // Iggy is hardcoded to a limit of 16... probably 1-3 is realistic -#define AATEX_SAMPLER 3 // sampler that aa_tex gets set in -#define QUAD_IB_COUNT 4096 // quad index buffer has indices for this many quads - -#define ASSERT_COUNT(a, b) ((a) == (b) ? (b) : -1) - -/////////////////////////////////////////////////////////////////////////////// -// -// debugging/validation -// - -static RADINLINE void break_on_err(GLint e) { -#ifdef _DEBUG - if (e) { - RR_BREAK(); - } -#endif -} - -#ifndef GDRAW_PLATFORM_REPORT_GL_SITE -#define GDRAW_PLATFORM_REPORT_GL_SITE(site) ((void)0) -#endif - -static void report_err(GLint e) { - break_on_err(e); - IggyGDrawSendWarning(NULL, "OpenGL glGetError error"); -} - -static void compilation_err(const char* msg) { - error_msg_platform_specific(msg); - report_err(GL_INVALID_VALUE); -} - -static void eat_gl_err(void) { while (glGetError() != GL_NO_ERROR); } - -static void opengl_check_site(const char* site); - -static void opengl_check(void) { opengl_check_site(NULL); } - -static void opengl_check_site(const char* site) { -#ifdef _DEBUG - GLint e = glGetError(); - if (e != GL_NO_ERROR) { - GDRAW_PLATFORM_REPORT_GL_SITE(site); - report_err(e); - eat_gl_err(); - } -#else - (void)site; -#endif -} - -#ifndef OPENGL_CHECK_SITE -#define OPENGL_CHECK_SITE(site) opengl_check_site(site) -#endif - -static U32 is_pow2(S32 n) { return ((U32)n & (U32)(n - 1)) == 0; } - -/////////////////////////////////////////////////////////////////////////////// -// -// GDraw -// -// This data structure stores all the data for the GDraw, just to keep -// it a bit cleaner instead of storing in globals, even though GDraw is -// a singleton. - -// fragment and vertex program - -// The mac doesn't use extensions for the functions dealing with programs, and -// the non-extension versions take GLuint instead of GLhandle. The mac defines -// GDrawGLProgram to GLuint before including gdraw_gl_shared.inl to account for -// this. -#ifndef GDrawGLProgram -#define GDrawGLProgram GLhandle -#endif - -typedef struct ProgramWithCachedVariableLocations { - GDrawGLProgram program; - GLint vars[2][MAX_VARS]; -} ProgramWithCachedVariableLocations; - -// render-stack state -typedef struct { - GDrawHandle* color_buffer; - GDrawHandle* stencil_depth; - S32 base_x, base_y, width, height; - rrbool cached; -} GDrawFramebufferState; - -// texture format description -typedef struct { - U8 iggyfmt; // IFT_FORMAT_* - U8 blkx, blky; // compressed block size in pixels (for compressed formats) - U8 blkbytes; // block bytes - GLenum intfmt; // GL internal format - GLenum fmt; // GL_TEXTURE_COMPRESSED for compressed formats! - GLenum type; -} TextureFormatDesc; - -static GDrawFunctions gdraw_funcs; - -/////////////////////////////////////////////////////////////////////////////// -// -// GDraw data structure -// -// -// This is the primary rendering abstraction, which hides all -// the platform-specific rendering behavior from /G/. It is -// full of platform-specific graphics state, and also general -// graphics state so that it doesn't have to callback into /G/ -// to get at that graphics state. - -static struct { - S32 multisampling; // number of samples if multisampling (always 0 if no - // GDRAW_MULTISAMPLING) - - S32 vx, vy; // viewport width/height in pixels - S32 fw, fh; // full width/height of bound rendertarget - S32 tw, th; // actual width/height of current tile - S32 tpw, tph; // width/height of padded version of tile - - // tile origin location (without and with padding) - rrbool tile_enabled; - S32 tx0, ty0; - S32 tx0p, ty0p; - - // if we're in the middle of rendering a blur, certain viewport-related - // functions have to behave differently, so they check this flag - rrbool in_blur; - - F32 projection[4]; // scalex, scaley, transx, transy - - // conversion from worldspace to viewspace <0,0>.. -- no translation or - // rotation - F32 world_to_pixel[2]; - - // 3d transformation - F32 xform_3d[3][4]; - rrbool use_3d; - - // render-state stack for 'temporary' rendering - GDrawFramebufferState frame[MAX_RENDER_STACK_DEPTH]; - GDrawFramebufferState* cur; - - // texture and vertex buffer pools - GDrawHandleCache* texturecache; - GDrawHandleCache* vbufcache; - - // GL_EXT_separate_shader_objects isn't sufficiently standard, - // so we have to bind every vertex shader to every fragment shader - - // raw vertex shaders - GLuint vert[GDRAW_vformat__count]; - - // fragment shaders with vertex shaders - ProgramWithCachedVariableLocations - fprog[GDRAW_TEXTURE__count][3][3]; // [tex0mode][additive][vformat] - ProgramWithCachedVariableLocations ihud[2]; - - // fragment shaders with fixed-function - ProgramWithCachedVariableLocations - exceptional_blend[GDRAW_BLENDSPECIAL__count]; - ProgramWithCachedVariableLocations filter_prog[2][16]; - ProgramWithCachedVariableLocations blur_prog[MAX_TAPS + 1]; - ProgramWithCachedVariableLocations colormatrix; - ProgramWithCachedVariableLocations manual_clear; - - // render targets - - // these two lines must be adjacent because of how rendertargets works - GDrawHandleCache rendertargets; - GDrawHandle - rendertarget_handles[MAX_RENDER_STACK_DEPTH]; // not -1, because we use - // +1 to initialize - - gswf_recti rt_valid[MAX_RENDER_STACK_DEPTH + 1]; - GDrawHandle stencil_depth; - - // size of our render targets - S32 frametex_width, frametex_height; - - // framebuffer object used for render-to-texture - GLuint framebuffer_stack_object; - - // framebuffer object used to copy from MSAA renderbuffer to texture - GLuint framebuffer_copy_to_texture; - - // framebuffer object used for main screen (set to non-0 to do render to - // texture) - GLuint main_framebuffer; - - // antialias texture - GLuint aa_tex; - - // canned quad indices - GLuint quad_ib; - - // texture formats - const TextureFormatDesc* tex_formats; - - // caps - U32 has_conditional_non_power_of_two - : 1; // non-power-of-2 supported, but only CLAMP_TO_EDGE and can't have - // mipmaps - U32 has_packed_depth_stencil : 1; - U32 has_depth24 : 1; - U32 has_mapbuffer : 1; - U32 has_texture_max_level : 1; - - // fake fence tracking for thrashing detection - U64 frame_counter; -}* gdraw; - -//////////////////////////////////////////////////////////////////////// -// -// General resource management for both textures and vertex buffers -// - -// make a texture with reasonable default state -static void make_texture(GLuint tex) { - glBindTexture(GL_TEXTURE_2D, tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -} - -static void make_rendertarget(GDrawHandle* t, GLuint tex, GLenum int_type, - GLenum ext_type, GLenum data_type, S32 w, S32 h, - S32 size) { - glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, - NULL); - make_texture(tex); - glBindTexture(GL_TEXTURE_2D, 0); -} - -static void api_free_resource(GDrawHandle* r) { - if (r->state == GDRAW_HANDLE_STATE_user_owned) return; - - if (!r->cache->is_vertex) { - glDeleteTextures(1, &r->handle.tex.gl); - if (r->handle.tex.gl_renderbuf && - r->handle.tex.gl_renderbuf != r->handle.tex.gl) - glDeleteRenderbuffers(1, &r->handle.tex.gl_renderbuf); - } else { - glDeleteBuffers(1, &r->handle.vbuf.base); - glDeleteBuffers(1, &r->handle.vbuf.indices); - } - opengl_check(); -} - -static void RADLINK gdraw_UnlockHandles(GDrawStats* gstats) { - // since we're not using fences for this implementation, move all textures - // off the active list if you're using fences, this is when the fence needs - // to actually occur - gdraw_HandleCacheUnlockAll(gdraw->texturecache); - gdraw_HandleCacheUnlockAll(gdraw->vbufcache); -} - -//////////////////////////////////////////////////////////////////////// -// -// Texture creation/updating -// - -extern GDrawTexture* gdraw_GLx_(WrappedTextureCreate)(S32 gl_texture_handle, - S32 width, S32 height, - rrbool has_mipmaps) { - GDrawStats stats = {0}; - GDrawHandle* p = gdraw_res_alloc_begin( - gdraw->texturecache, 0, - &stats); // it may need to free one item to give us a handle - GLint old; - - glGetIntegerv(GL_TEXTURE_BINDING_2D, &old); - glBindTexture(GL_TEXTURE_2D, gl_texture_handle); - if (has_mipmaps) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glBindTexture(GL_TEXTURE_2D, old); - - p->bytes = 0; - p->handle.tex.gl = gl_texture_handle; - p->handle.tex.w = width; - p->handle.tex.h = height; - p->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); - return (GDrawTexture*)p; -} - -extern void gdraw_GLx_(WrappedTextureChange)(GDrawTexture* tex, - S32 new_gl_texture_handle, - S32 new_width, S32 new_height, - rrbool has_mipmaps) { - GDrawHandle* p = (GDrawHandle*)tex; - GLint old; - - glGetIntegerv(GL_TEXTURE_BINDING_2D, &old); - glBindTexture(GL_TEXTURE_2D, new_gl_texture_handle); - if (has_mipmaps) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glBindTexture(GL_TEXTURE_2D, old); - - p->handle.tex.gl = new_gl_texture_handle; - p->handle.tex.w = new_width; - p->handle.tex.h = new_height; - p->handle.tex.nonpow2 = !(is_pow2(new_width) && is_pow2(new_height)); -} - -extern void gdraw_GLx_(WrappedTextureDestroy)(GDrawTexture* tex) { - GDrawStats stats = {0}; - gdraw_res_free((GDrawHandle*)tex, &stats); -} - -static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture* tex, void* old_id, - void* new_id) { - GDrawHandle* p = (GDrawHandle*)tex; - // if this is still the handle it's thought to be, change the owner; - // if the owner *doesn't* match, then they're changing a stale handle, so - // ignore - if (p->owner == old_id) p->owner = new_id; -} - -static rrbool RADLINK gdraw_MakeTextureBegin( - void* owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, - GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* gstats) { - S32 size = 0, asize, stride; - GDrawHandle* t = NULL; - opengl_check(); - - stride = width; - if (format == GDRAW_TEXTURE_FORMAT_rgba32) stride *= 4; - size = stride * height; - - asize = size; - if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) asize = asize * 4 / 3; - - t = gdraw_res_alloc_begin(gdraw->texturecache, asize, gstats); - if (!t) return IGGY_RESULT_Error_GDraw; - - glGenTextures(1, &t->handle.tex.gl); - - p->texture_data = IggyGDrawMalloc(size); - if (!p->texture_data) { - gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw malloc for texture data failed"); - return false; - } - - t->handle.tex.w = width; - t->handle.tex.h = height; - t->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); - - p->num_rows = height; - p->p0 = t; - p->p1 = owner; - p->stride_in_bytes = stride; - p->texture_type = GDRAW_TEXTURE_TYPE_rgba; - p->i0 = format; - p->i1 = flags; - p->i2 = width; - p->i3 = height; - p->i4 = asize; - opengl_check(); - return true; -} - -static GDrawTexture* RADLINK -gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { - gdraw_texture_format format = (gdraw_texture_format)p->i0; - S32 flags = p->i1; - rrbool mipmap = (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) != 0; - S32 width = p->i2, height = p->i3; - GLuint z, e; - GDrawHandle* t = (GDrawHandle*)p->p0; - - z = t->handle.tex.gl; - assert(z != 0); - - make_texture(z); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (format == GDRAW_TEXTURE_FORMAT_font) - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, - GL_UNSIGNED_BYTE, p->texture_data); - else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, - GL_UNSIGNED_BYTE, p->texture_data); - e = glGetError(); - break_on_err(e); - - if (mipmap) glGenerateMipmap(GL_TEXTURE_2D); - if (!e) e = glGetError(); - - if (e != 0) { - gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw OpenGL error creating texture"); - eat_gl_err(); - return NULL; - } else { - gdraw_HandleCacheAllocateEnd( - t, p->i4, p->p1, - (flags & GDRAW_MAKETEXTURE_FLAGS_never_flush) - ? GDRAW_HANDLE_STATE_pinned - : GDRAW_HANDLE_STATE_locked); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += p->i4; - } - - // default wrap mode is clamp to edge - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if (mipmap) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - IggyGDrawFree(p->texture_data); - - opengl_check(); - return (GDrawTexture*)t; -} - -static rrbool RADLINK gdraw_UpdateTextureBegin(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats) { - RR_UNUSED_VARIABLE(stats); - return gdraw_HandleCacheLock((GDrawHandle*)tex, unique_id); -} - -static void RADLINK gdraw_UpdateTextureRect(GDrawTexture* tex, void* unique_id, - S32 x, S32 y, S32 stride, S32 w, - S32 h, U8* data, - gdraw_texture_format format) { - glBindTexture(GL_TEXTURE_2D, ((GDrawHandle*)tex)->handle.tex.gl); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - // @TODO: use 'stride' - glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, - (format == GDRAW_TEXTURE_FORMAT_font) ? GL_ALPHA : GL_RGBA, - GL_UNSIGNED_BYTE, data); - opengl_check(); -} - -static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture* tex, void* unique_id, - GDrawStats* stats) { - gdraw_HandleCacheUnlock((GDrawHandle*)tex); -} - -static void RADLINK gdraw_FreeTexture(GDrawTexture* tt, void* unique_id, - GDrawStats* gstats) { - GDrawHandle* t = (GDrawHandle*)tt; - assert(t != NULL); - if (t->owner == unique_id || unique_id == NULL) { - if (t->cache == &gdraw->rendertargets) { - gdraw_HandleCacheUnlock(t); - // cache it by simply not freeing it - return; - } - - gdraw_res_free(t, gstats); - } -} - -static rrbool RADLINK gdraw_TryToLockTexture(GDrawTexture* t, void* unique_id, - GDrawStats* gstats) { - RR_UNUSED_VARIABLE(gstats); - return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); -} - -static void RADLINK gdraw_DescribeTexture(GDrawTexture* tex, - GDraw_Texture_Description* desc) { - GDrawHandle* p = (GDrawHandle*)tex; - desc->width = p->handle.tex.w; - desc->height = p->handle.tex.h; - desc->size_in_bytes = p->bytes; -} - -static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8* rgba) { - if (!gdraw->aa_tex) glGenTextures(1, &gdraw->aa_tex); - - make_texture(gdraw->aa_tex); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, 1, 0, GL_RGBA, - GL_UNSIGNED_BYTE, rgba); - opengl_check(); -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex buffer creation/deletion -// - -static rrbool RADLINK gdraw_MakeVertexBufferBegin( - void* unique_id, gdraw_vformat vformat, S32 vbuf_size, S32 ibuf_size, - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* gstats) { - GLuint e; - GDrawHandle* vb; - opengl_check(); - vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, gstats); - if (!vb) { - IggyGDrawSendWarning(NULL, "GDraw out of vertex buffer memory"); - return false; - } - - e = glGetError(); - vb->handle.vbuf.base = 0; - vb->handle.vbuf.indices = 0; - glGenBuffers(1, &vb->handle.vbuf.base); - glGenBuffers(1, &vb->handle.vbuf.indices); - glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); - glBufferData(GL_ARRAY_BUFFER, vbuf_size, NULL, GL_STATIC_DRAW); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, NULL, GL_STATIC_DRAW); - if (!e) e = glGetError(); - if (e != GL_NO_ERROR) { - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - glDeleteBuffers(1, &vb->handle.vbuf.base); - glDeleteBuffers(1, &vb->handle.vbuf.indices); - gdraw_HandleCacheAllocateFail(vb); - eat_gl_err(); - IggyGDrawSendWarning(NULL, - "GDraw OpenGL vertex buffer creation failed"); - return false; - } - - p->i0 = vbuf_size; - p->i1 = ibuf_size; - p->p0 = vb; - p->p1 = unique_id; - - if (!gdraw->has_mapbuffer) { - p->vertex_data = IggyGDrawMalloc(vbuf_size); - p->vertex_data_length = vbuf_size; - p->index_data = IggyGDrawMalloc(ibuf_size); - p->index_data_length = ibuf_size; - - // check for out of memory conditions - if (!p->vertex_data || !p->index_data) { - if (p->vertex_data) IggyGDrawFree(p->vertex_data); - if (p->index_data) IggyGDrawFree(p->index_data); - IggyGDrawSendWarning( - NULL, "GDraw malloc for vertex buffer temporary memory failed"); - return false; - } - } else { - p->vertex_data = (U8*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); - p->vertex_data_length = vbuf_size; - - p->index_data = - (U8*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); - p->index_data_length = ibuf_size; - } - - opengl_check(); - return true; -} - -static rrbool RADLINK -gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_ProcessingInfo* p) { - assert(0); - return false; -} - -static GDrawVertexBuffer* RADLINK gdraw_MakeVertexBufferEnd( - GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* stats) { - GDrawHandle* vb = (GDrawHandle*)p->p0; - rrbool ok = true; - GLuint e; - - if (!gdraw->has_mapbuffer) { - glBufferData(GL_ARRAY_BUFFER, p->i0, p->vertex_data, GL_STATIC_DRAW); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, p->i1, p->index_data, - GL_STATIC_DRAW); - IggyGDrawFree(p->vertex_data); - IggyGDrawFree(p->index_data); - } else { - if (!glUnmapBuffer(GL_ARRAY_BUFFER)) ok = false; - if (!glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER)) ok = false; - } - - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - - e = glGetError(); - if (!ok || e != GL_NO_ERROR) { - glDeleteBuffers(1, &vb->handle.vbuf.base); - glDeleteBuffers(1, &vb->handle.vbuf.indices); - gdraw_HandleCacheAllocateFail(vb); - eat_gl_err(); - return NULL; - } else - gdraw_HandleCacheAllocateEnd(vb, p->i0 + p->i1, p->p1, - GDRAW_HANDLE_STATE_locked); - - opengl_check(); - return (GDrawVertexBuffer*)vb; -} - -static rrbool RADLINK gdraw_TryToLockVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, - GDrawStats* stats) { - RR_UNUSED_VARIABLE(stats); - return gdraw_HandleCacheLock((GDrawHandle*)vb, unique_id); -} - -static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer* vb, - void* unique_id, GDrawStats* stats) { - GDrawHandle* h = (GDrawHandle*)vb; - assert(h != NULL); - if (h->owner == unique_id) gdraw_res_free(h, stats); -} - -static void RADLINK gdraw_DescribeVertexBuffer( - GDrawVertexBuffer* vbuf, GDraw_VertexBuffer_Description* desc) { - GDrawHandle* p = (GDrawHandle*)vbuf; - desc->size_in_bytes = p->bytes; -} - -//////////////////////////////////////////////////////////////////////// -// -// Create/free (or cache) render targets -// - -#ifdef __linux__ -typedef struct { - S32 free_count; - S32 live_count; - S32 locked_count; - S32 dead_count; - S32 pinned_count; - S32 user_owned_count; - S32 alloc_count; -} GDrawHandleStateCounts; - -enum { - GDRAW_RT_DIAG_color_memory = 1 << 0, - GDRAW_RT_DIAG_color_handles = 1 << 1, - GDRAW_RT_DIAG_cache_bitmap = 1 << 2, - GDRAW_RT_DIAG_stack_depth = 1 << 3, - GDRAW_RT_DIAG_empty_request = 1 << 4, -}; - -static U32 gdraw_rt_diag_emitted = 0; - -static void gdraw_CountHandleStates(GDrawHandleCache* cache, - GDrawHandleStateCounts* counts) { - S32 i; - counts->free_count = 0; - counts->live_count = 0; - counts->locked_count = 0; - counts->dead_count = 0; - counts->pinned_count = 0; - counts->user_owned_count = 0; - counts->alloc_count = 0; - - if (!cache) return; - - for (i = 0; i < cache->max_handles; ++i) { - switch (cache->handle[i].state) { - case GDRAW_HANDLE_STATE_free: - ++counts->free_count; - break; - case GDRAW_HANDLE_STATE_live: - ++counts->live_count; - break; - case GDRAW_HANDLE_STATE_locked: - ++counts->locked_count; - break; - case GDRAW_HANDLE_STATE_dead: - ++counts->dead_count; - break; - case GDRAW_HANDLE_STATE_pinned: - ++counts->pinned_count; - break; - case GDRAW_HANDLE_STATE_user_owned: - ++counts->user_owned_count; - break; - case GDRAW_HANDLE_STATE_alloc: - ++counts->alloc_count; - break; - default: - break; - } - } -} - -static void gdraw_ReportHandleCacheDiag(char const* label, - GDrawHandleCache* cache, U32 once_bit, - S32 req_w, S32 req_h) { - GDrawHandleStateCounts counts; - - if (gdraw_rt_diag_emitted & once_bit) return; - gdraw_rt_diag_emitted |= once_bit; - - gdraw_CountHandleStates(cache, &counts); - IggyGDrawSendWarning( - NULL, - "GDraw[%s] diag: frame=%dx%d tile=%dx%d padded=%dx%d req=%dx%d " - "depth=%d bytes_free=%d total_bytes=%d handles free=%d live=%d " - "locked=%d dead=%d pinned=%d user=%d alloc=%d", - label, gdraw->frametex_width, gdraw->frametex_height, gdraw->tw, - gdraw->th, gdraw->tpw, gdraw->tph, req_w, req_h, - (int)(gdraw->cur - gdraw->frame), cache ? cache->bytes_free : 0, - cache ? cache->total_bytes : 0, counts.free_count, counts.live_count, - counts.locked_count, counts.dead_count, counts.pinned_count, - counts.user_owned_count, counts.alloc_count); -} -#else -#define gdraw_ReportHandleCacheDiag(label, cache, once_bit, req_w, req_h) \ - ((void)0) -#endif - -static GDrawHandle* get_rendertarget_texture(int width, int height, void* owner, - GDrawStats* gstats) { - S32 size; - GDrawHandle* t; - opengl_check(); - t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); - if (t) { - gdraw_HandleCacheLock(t, (void*)(UINTa)1); - return t; - } - - size = gdraw->frametex_width * gdraw->frametex_height * 4; - t = gdraw_res_alloc_begin(gdraw->texturecache, size, gstats); - if (!t) return t; - - glGenTextures(1, &t->handle.tex.gl); - make_rendertarget(t, t->handle.tex.gl, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, - width, height, 4); - t->handle.tex.w = gdraw->frametex_width; - t->handle.tex.h = gdraw->frametex_height; - t->handle.tex.nonpow2 = - 1; // assume all rendertargets are non-pow2 for consistency - gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; - gstats->alloc_tex += 1; - gstats->alloc_tex_bytes += size; - opengl_check(); - gdraw_HandleCacheAllocateEnd(t, size, owner, GDRAW_HANDLE_STATE_locked); - - return t; -} - -static GDrawHandle* get_color_rendertarget(GDrawStats* gstats) { - S32 size; - GDrawHandle* t; - opengl_check(); - t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); - if (t) { - gdraw_HandleCacheLock(t, (void*)(UINTa)1); - return t; - } - - // ran out of RTs, allocate a new one - size = gdraw->frametex_width * gdraw->frametex_height * 4; - if (gdraw->rendertargets.bytes_free < size) { - gdraw_ReportHandleCacheDiag("rt-color-memory", &gdraw->rendertargets, - GDRAW_RT_DIAG_color_memory, gdraw->tpw, - gdraw->tph); - IggyGDrawSendWarning( - NULL, "GDraw[rt-color] exceeded available rendertarget memory"); - return NULL; - } - - t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); - if (!t) { - gdraw_ReportHandleCacheDiag("rt-color-handles", &gdraw->rendertargets, - GDRAW_RT_DIAG_color_handles, gdraw->tpw, - gdraw->tph); - IggyGDrawSendWarning( - NULL, "GDraw[rt-color] exceeded available rendertarget handles"); - return t; - } - - glGenTextures(1, &t->handle.tex.gl); - make_rendertarget(t, t->handle.tex.gl, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, - gdraw->frametex_width, gdraw->frametex_height, 4); - t->handle.tex.w = gdraw->frametex_width; - t->handle.tex.h = gdraw->frametex_height; - t->handle.tex.nonpow2 = - 1; // assume all rendertargets are non-pow2 for consistency - -#ifdef GDRAW_MULTISAMPLING - if (gdraw->multisampling) { - glGenRenderbuffers(1, &t->handle.tex.gl_renderbuf); - glBindRenderbuffer(GL_RENDERBUFFER, t->handle.tex.gl_renderbuf); - glRenderbufferStorageMultisample(GL_RENDERBUFFER, gdraw->multisampling, - GL_RGBA, gdraw->frametex_width, - gdraw->frametex_height); - glBindRenderbuffer(GL_RENDERBUFFER, 0); - } -#endif - opengl_check(); - - gdraw_HandleCacheAllocateEnd(t, size, (void*)(UINTa)1, - GDRAW_HANDLE_STATE_locked); - gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; - gstats->alloc_tex += gdraw->multisampling ? 2 : 1; - gstats->alloc_tex_bytes += (1 + gdraw->multisampling) * size; - - return t; -} - -static GDrawHandle* get_depthstencil_renderbuffer(GDrawStats* gstats) { - if (!gdraw->stencil_depth.handle.tex.gl) { - gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; - gstats->alloc_tex += 1; - -#ifdef GDRAW_MULTISAMPLING - if (gdraw->multisampling) { - glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); - glBindRenderbuffer(GL_RENDERBUFFER, - gdraw->stencil_depth.handle.tex.gl); - glRenderbufferStorageMultisample( - GL_RENDERBUFFER, gdraw->multisampling, GL_DEPTH24_STENCIL8, - gdraw->frametex_width, gdraw->frametex_height); - - gstats->alloc_tex_bytes += gdraw->multisampling * 4 * - gdraw->frametex_width * - gdraw->frametex_height; - } else { -#endif - if (gdraw->has_packed_depth_stencil) { - glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); - glBindRenderbuffer(GL_RENDERBUFFER, - gdraw->stencil_depth.handle.tex.gl); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, - gdraw->frametex_width, - gdraw->frametex_height); - - gdraw->stencil_depth.handle.tex.gl_renderbuf = - gdraw->stencil_depth.handle.tex.gl; - } else { - // this path is mainly for the iOS simulator - glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); - glBindRenderbuffer(GL_RENDERBUFFER, - gdraw->stencil_depth.handle.tex.gl); - glRenderbufferStorage(GL_RENDERBUFFER, - gdraw->has_depth24 ? GL_DEPTH_COMPONENT24 - : GL_DEPTH_COMPONENT16, - gdraw->frametex_width, - gdraw->frametex_height); - - glGenRenderbuffers( - 1, &gdraw->stencil_depth.handle.tex.gl_renderbuf); - glBindRenderbuffer( - GL_RENDERBUFFER, - gdraw->stencil_depth.handle.tex.gl_renderbuf); - glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, - gdraw->frametex_width, - gdraw->frametex_height); - } - - gstats->alloc_tex_bytes += - 4 * gdraw->frametex_width * gdraw->frametex_height; -#ifdef GDRAW_MULTISAMPLING - } -#endif - - glBindRenderbuffer(GL_RENDERBUFFER, 0); - opengl_check(); - } - return &gdraw->stencil_depth; -} - -static void flush_rendertargets(GDrawStats* stats) { - gdraw_res_flush(&gdraw->rendertargets, stats); - - if (gdraw->stencil_depth.handle.tex.gl_renderbuf && - gdraw->stencil_depth.handle.tex.gl_renderbuf != - gdraw->stencil_depth.handle.tex.gl) { - glDeleteRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl_renderbuf); - gdraw->stencil_depth.handle.tex.gl_renderbuf = 0; - } - - if (gdraw->stencil_depth.handle.tex.gl) { - glDeleteRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); - gdraw->stencil_depth.handle.tex.gl = 0; - } - opengl_check(); -} - -//////////////////////////////////////////////////////////////////////// -// -// Begin rendering for a frame -// - -static void lazy_shader(ProgramWithCachedVariableLocations* ptr); - -static RADINLINE void use_lazy_shader(ProgramWithCachedVariableLocations* prg) { - if (!prg->program) - lazy_shader(prg); // already does a glUseProgram! - else - glUseProgram(prg->program); -} - -static void set_viewport(void) { - if (gdraw->in_blur) { - glViewport(0, 0, gdraw->tpw, gdraw->tph); - } else if (gdraw->cur == gdraw->frame) { - glViewport(gdraw->vx, gdraw->vy, gdraw->tw, gdraw->th); - } else if (gdraw->cur->cached) { - glViewport(0, 0, gdraw->cur->width, gdraw->cur->height); - } else { - glViewport(0, 0, gdraw->tpw, gdraw->tph); - // we need to translate from naive pixel space to align a tile - } - opengl_check(); -} - -static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1) { - gdraw->projection[0] = 2.0f / (x1 - x0); - gdraw->projection[1] = 2.0f / (y1 - y0); - gdraw->projection[2] = (x1 + x0) / (F32)(x0 - x1); - gdraw->projection[3] = (y1 + y0) / (F32)(y0 - y1); -} - -static void set_projection(void) { - if (gdraw->in_blur) - set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); - else if (gdraw->cur == gdraw->frame) - set_projection_raw(gdraw->tx0, gdraw->tx0 + gdraw->tw, - gdraw->ty0 + gdraw->th, gdraw->ty0); - else if (gdraw->cur->cached) - set_projection_raw( - gdraw->cur->base_x, gdraw->cur->base_x + gdraw->cur->width, - gdraw->cur->base_y, gdraw->cur->base_y + gdraw->cur->height); - else - set_projection_raw(gdraw->tx0p, gdraw->tx0p + gdraw->tpw, - gdraw->ty0p + gdraw->tph, gdraw->ty0p); -} - -static void clear_renderstate(void) { - clear_renderstate_platform_specific(); - - // deactivate aa_tex - glActiveTexture(GL_TEXTURE0 + AATEX_SAMPLER); - glBindTexture(GL_TEXTURE_2D, 0); - - glColorMask(1, 1, 1, 1); - glDepthMask(GL_TRUE); - - glDisable(GL_CULL_FACE); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glDisable(GL_SCISSOR_TEST); - glActiveTexture(GL_TEXTURE0); - - glUseProgram(0); - opengl_check(); -} - -static void set_common_renderstate(void) { - clear_renderstate(); - - // activate aa_tex - glActiveTexture(GL_TEXTURE0 + AATEX_SAMPLER); - glBindTexture(GL_TEXTURE_2D, gdraw->aa_tex); - glActiveTexture(GL_TEXTURE0); -} - -void gdraw_GLx_(SetTileOrigin)(S32 x, S32 y, U32 framebuffer) { - gdraw->vx = x; - gdraw->vy = y; - gdraw->main_framebuffer = framebuffer; -} - -static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, - F32 scaley) { - memset(gdraw->frame, 0, sizeof(gdraw->frame)); - gdraw->cur = gdraw->frame; - gdraw->fw = w; - gdraw->fh = h; - gdraw->world_to_pixel[0] = scalex; - gdraw->world_to_pixel[1] = scaley; -} - -static void RADLINK gdraw_Set3DTransform(F32* mat) { - if (mat == NULL) - gdraw->use_3d = 0; - else { - gdraw->use_3d = 1; - memcpy(gdraw->xform_3d, mat, sizeof(gdraw->xform_3d)); - } -} - -// must include anything necessary for texture creation/update -static void RADLINK gdraw_RenderingBegin(void) {} -static void RADLINK gdraw_RenderingEnd(void) {} - -static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, - S32 pad, GDrawStats* gstats) { - opengl_check(); - - if (x0 == 0 && y0 == 0 && x1 == gdraw->fw && y1 == gdraw->fh) { - pad = 0; - gdraw->tile_enabled = false; - } else { - gdraw->tile_enabled = true; - } - - gdraw->tx0 = x0; - gdraw->ty0 = y0; - gdraw->tw = x1 - x0; - gdraw->th = y1 - y0; - gdraw->tpw = gdraw->tw + pad * 2; - gdraw->tph = gdraw->th + pad * 2; - // origin of padded region - gdraw->tx0p = x0 - pad; - gdraw->ty0p = y0 - pad; - - if (gdraw->tpw > gdraw->frametex_width || - gdraw->tph > gdraw->frametex_height) { - gdraw->frametex_width = RR_MAX(gdraw->tpw, gdraw->frametex_width); - gdraw->frametex_height = RR_MAX(gdraw->tph, gdraw->frametex_height); - - flush_rendertargets(gstats); - } - - set_viewport(); - set_projection(); - set_common_renderstate(); - - glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); - opengl_check(); -} - -static void RADLINK gdraw_RenderTileEnd(GDrawStats* stats) { - clear_renderstate(); -} - -#define MAX_DEPTH_VALUE (1 << 13) - -static void RADLINK gdraw_GetInfo(GDrawInfo* d) { - GLint maxtex; - - opengl_check(); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtex); - - d->num_stencil_bits = 8; - d->max_id = MAX_DEPTH_VALUE - 2; - // for floating point depth, just use mantissa, e.g. 16-20 bits - d->max_texture_size = maxtex; - d->buffer_format = GDRAW_BFORMAT_vbib; - d->shared_depth_stencil = 0; - d->always_mipmap = 0; - d->conditional_nonpow2 = gdraw->has_conditional_non_power_of_two; - opengl_check(); -} - -//////////////////////////////////////////////////////////////////////// -// -// Enable/disable rendertargets in stack fashion -// - -static void clear_with_rect(gswf_recti* region, rrbool clear_depth, - GDrawStats* stats); - -static void set_render_target_state(void) { - GLint h; -#ifdef GDRAW_MULTISAMPLING - if (gdraw->multisampling) { - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &h); - h = gdraw->cur->color_buffer - ? gdraw->cur->color_buffer->handle.tex.gl_renderbuf - : 0; - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, h); - h = gdraw->cur->stencil_depth ? gdraw->cur->stencil_depth->handle.tex.gl - : 0; - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, h); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_RENDERBUFFER, h); - } else { -#endif - h = gdraw->cur->color_buffer ? gdraw->cur->color_buffer->handle.tex.gl - : 0; - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, h, 0); - if (gdraw->cur->stencil_depth) { - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, - gdraw->cur->stencil_depth->handle.tex.gl); - glFramebufferRenderbuffer( - GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, - gdraw->cur->stencil_depth->handle.tex.gl_renderbuf); - } else { - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_RENDERBUFFER, 0); - } -#ifdef GDRAW_MULTISAMPLING - } -#endif - opengl_check(); -} - -static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti* region, - gdraw_texture_format format, - U32 flags, void* owner, - GDrawStats* gstats) { - GDrawFramebufferState* n = gdraw->cur + 1; - GDrawHandle* t; - int k; - if (gdraw->tw == 0 || gdraw->th == 0) { - gdraw_ReportHandleCacheDiag( - "rt-empty", &gdraw->rendertargets, GDRAW_RT_DIAG_empty_request, - region->x1 - region->x0, region->y1 - region->y0); - IggyGDrawSendWarning( - NULL, "GDraw[rt-stack] got a request for an empty rendertarget"); - return false; - } - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - gdraw_ReportHandleCacheDiag( - "rt-stack-depth", &gdraw->rendertargets, GDRAW_RT_DIAG_stack_depth, - region->x1 - region->x0, region->y1 - region->y0); - IggyGDrawSendWarning(NULL, - "GDraw[rt-stack] rendertarget nesting exceeded " - "MAX_RENDER_STACK_DEPTH"); - return false; - } - - if (owner) { - t = get_rendertarget_texture(region->x1 - region->x0, - region->y1 - region->y0, owner, gstats); - if (!t) { - gdraw_ReportHandleCacheDiag("rt-cacheAsBitmap", gdraw->texturecache, - GDRAW_RT_DIAG_cache_bitmap, - region->x1 - region->x0, - region->y1 - region->y0); - IggyGDrawSendWarning( - NULL, "GDraw[rt-cacheAsBitmap] ran out of rendertargets"); - return false; - } - } else { - t = get_color_rendertarget(gstats); - if (!t) { - IggyGDrawSendWarning(NULL, - "GDraw[rt-color] ran out of rendertargets"); - return false; - } - } - n->color_buffer = t; - assert(n->color_buffer != NULL); - - if (n == gdraw->frame + 1) - n->stencil_depth = get_depthstencil_renderbuffer(gstats); - else - n->stencil_depth = (n - 1)->stencil_depth; - ++gdraw->cur; - - gdraw->cur->cached = owner != NULL; - if (owner) { - gdraw->cur->base_x = region->x0; - gdraw->cur->base_y = region->y0; - gdraw->cur->width = region->x1 - region->x0; - gdraw->cur->height = region->y1 - region->y0; - } - - gstats->nonzero_flags |= GDRAW_STATS_rendtarg; - - glBindFramebuffer(GL_FRAMEBUFFER, gdraw->framebuffer_stack_object); - set_render_target_state(); - - assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); - - // viewport for clear (make sure scissor is inside viewport just in case) - glViewport(0, 0, gdraw->frametex_width, gdraw->frametex_height); - - k = (int)(n->color_buffer - gdraw->rendertargets.handle); - if (region) { - S32 ox, oy; - - // in a perfect world, we'd only need 1 pixel of border on all sides for - // bilinear filtering, which would mean pad = 1. however, texture - // interpolator precision is not that high even on PC parts, and if we - // only use 1 pixel of padding we will often get some un-filled pixels - // "creeping in" from the sides. pad = 2 is fine on recent PC parts, but - // not old PC parts or even fairly new mobile parts, so we play it safe - // and use 3 pixels which so far gives good results everywhere. - S32 pad = 3; - - // region.x0,y0 are the top left of the rectangle in display space - // x,y are the *bottom* left of the rectangle in window space - S32 h = gdraw->tph; - S32 xt0, yt0, xt1, yt1; - S32 x0, y0, x1, y1; - - if (gdraw->in_blur || !gdraw->tile_enabled) - ox = oy = 0; - else - ox = gdraw->tx0, oy = gdraw->ty0; - - // clamp region to tile (in gdraw coords) - xt0 = RR_MAX(region->x0 - ox, 0); - yt0 = RR_MAX(region->y0 - oy, 0); - xt1 = RR_MIN(region->x1 - ox, gdraw->tpw); - yt1 = RR_MIN(region->y1 - oy, gdraw->tph); - - // but the padding gets clamped to framebuffer coords! also transfer to - // window space here. - x0 = RR_MAX(xt0 - pad, 0); - y0 = RR_MAX(h - yt1 - pad, 0); - x1 = RR_MIN(xt1 + pad, gdraw->frametex_width); - y1 = RR_MIN(h - yt0 + pad, gdraw->frametex_height); - - if (x1 <= x0 || - y1 <= y0) { // region doesn't intersect with current tile - --gdraw->cur; - - // remove color and stencil buffers - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, 0, 0); - - // switch render target back - if (gdraw->cur == gdraw->frame) - glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); - else - set_render_target_state(); - - set_viewport(); - set_projection(); - opengl_check(); - - // free our render target - gdraw_FreeTexture((GDrawTexture*)n->color_buffer, 0, gstats); - - // note: don't send a warning since this will happen during regular - // tiled rendering - return false; - } - - glEnable(GL_SCISSOR_TEST); - glScissor(x0, y0, x1 - x0, y1 - y0); - gdraw->rt_valid[k].x0 = xt0; - gdraw->rt_valid[k].y0 = yt0; - gdraw->rt_valid[k].x1 = xt1; - gdraw->rt_valid[k].y1 = yt1; - gstats->cleared_pixels += (x1 - x0) * (y1 - y0); - } else { - glDisable(GL_SCISSOR_TEST); - gdraw->rt_valid[k].x0 = 0; - gdraw->rt_valid[k].y0 = 0; - gdraw->rt_valid[k].x1 = gdraw->frametex_width; - gdraw->rt_valid[k].y1 = gdraw->frametex_height; - gstats->cleared_pixels += - gdraw->frametex_width * gdraw->frametex_height; - } - - gstats->nonzero_flags |= GDRAW_STATS_clears; - gstats->num_clears += 1; - -#ifdef GDRAW_FEWER_CLEARS - if (region) { - clear_with_rect(region, n == gdraw->frame + 1, gstats); - } else -#endif // GDRAW_FEWER_CLEARS - { - glClearColor(0, 0, 0, 0); // must clear destination alpha - glClearStencil(0); - glClearDepth(1); - glStencilMask(255); - glDepthMask(GL_TRUE); - glColorMask(1, 1, 1, 1); - glDisable(GL_STENCIL_TEST); - if (n == gdraw->frame + 1) - glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT); - else - glClear(GL_COLOR_BUFFER_BIT); - } - - set_viewport(); - set_projection(); - - opengl_check(); - - return true; -} - -static GDrawTexture* RADLINK gdraw_TextureDrawBufferEnd(GDrawStats* gstats) { - GDrawFramebufferState* n = gdraw->cur; - GDrawFramebufferState* m = --gdraw->cur; - if (gdraw->fw == 0 || gdraw->fh == 0) return 0; - - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) - return 0; // already returned a warning in Start...() - - assert(m >= gdraw->frame); // bug in Iggy -- unbalanced - - if (m != gdraw->frame) assert(m->color_buffer != NULL); - assert(n->color_buffer != NULL); - - // remove color and stencil buffers - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, 0); - -#ifdef GDRAW_MULTISAMPLING - if (gdraw->multisampling) { - // blit from multisample to texture - if (n->color_buffer->handle.tex.gl_renderbuf) { - GLuint res; - glBindFramebuffer(GL_READ_FRAMEBUFFER, - gdraw->framebuffer_copy_to_texture); - glFramebufferRenderbuffer( - GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer( - GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, - n->color_buffer->handle.tex.gl_renderbuf); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - n->color_buffer->handle.tex.gl, 0); - res = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); - glBlitFramebuffer(0, 0, gdraw->tpw, gdraw->tph, 0, 0, gdraw->tpw, - gdraw->tph, GL_COLOR_BUFFER_BIT, GL_NEAREST); - gstats->nonzero_flags |= GDRAW_STATS_blits; - gstats->num_blits += 1; - gstats->num_blit_pixels += (gdraw->tpw * gdraw->tph); - - glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - } - } -#endif - - gstats->nonzero_flags |= GDRAW_STATS_rendtarg; - gstats->rendertarget_changes += 1; - - // set the new state - if (m == gdraw->frame) // back to initial framebuffer - glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); - else - set_render_target_state(); - - // reset the viewport if we've reached the root scope - set_viewport(); - set_projection(); - - opengl_check(); - - return (GDrawTexture*)n->color_buffer; -} - -//////////////////////////////////////////////////////////////////////// -// -// Clear stencil/depth buffers -// -// Open question whether we'd be better off finding bounding boxes -// and only clearing those; it depends exactly how fast clearing works. -// - -static void RADLINK gdraw_ClearStencilBits(U32 bits) { - glDisable(GL_SCISSOR_TEST); - glStencilMask(bits); - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - opengl_check(); -} - -// this only happens rarely (hopefully never) if we use the depth buffer, -// so we can just clear the whole thing -static void RADLINK gdraw_ClearID(void) { - glDisable(GL_SCISSOR_TEST); - glClearDepth(1); - glDepthMask(GL_TRUE); - glClear(GL_DEPTH_BUFFER_BIT); - opengl_check(); -} - -//////////////////////////////////////////////////////////////////////// -// -// Set all the render state from GDrawRenderState -// -// This also is responsible for getting the framebuffer into a texture -// if the read-modify-write blend operation can't be expressed with -// the native blend operators. (E.g. "screen") -// - -enum { - VVAR_world0 = 0, - VVAR_world1 = 1, - VVAR_xoff = 2, - VVAR_texgen_s = 3, - VVAR_texgen_t = 4, - VVAR_viewproj = 5, - VVAR_x3d = 5, - VVAR_y3d = 6, - VVAR_z3d = 7, -}; - -// convert an ID request to a value suitable for the depth buffer, -// in homogeneous clip space with w=1 (depth from -1..1) -static float depth_from_id(S32 id) { - return 1.0f - 2.0f * (id + 1) / (F32)MAX_DEPTH_VALUE; -} - -static void set_texture(U32 texunit, GDrawTexture* tex) { - glActiveTexture(GL_TEXTURE0 + texunit); - if (tex == NULL) - glBindTexture(GL_TEXTURE_2D, 0); - else - glBindTexture(GL_TEXTURE_2D, ((GDrawHandle*)tex)->handle.tex.gl); -} - -static void set_world_projection(const int* vvars, const F32 world[2 * 4]) { - assert(vvars[VVAR_world0] >= 0 && vvars[VVAR_world1] >= 0 && - vvars[VVAR_viewproj] >= 0); - glUniform4fv(vvars[VVAR_world0], 1, world + 0); - glUniform4fv(vvars[VVAR_world1], 1, world + 4); - glUniform4fv(vvars[VVAR_viewproj], 1, gdraw->projection); -} - -static void set_3d_projection(const int* vvars, const F32 world[2 * 4], - const F32 xform[3][4]) { - assert(vvars[VVAR_world0] >= 0 && vvars[VVAR_world1] >= 0); - glUniform4fv(vvars[VVAR_world0], 1, world + 0); - glUniform4fv(vvars[VVAR_world1], 1, world + 4); - - assert(vvars[VVAR_x3d] >= 0 && vvars[VVAR_y3d] >= 0 && - vvars[VVAR_z3d] >= 0); - glUniform4fv(vvars[VVAR_x3d], 1, xform[0]); - glUniform4fv(vvars[VVAR_y3d], 1, xform[1]); - glUniform4fv(vvars[VVAR_z3d], 1, xform[2]); -} - -static int set_render_state(GDrawRenderState* r, S32 vformat, - const int** ovvars, GDrawPrimitive* p, - GDrawStats* gstats) { - static struct gdraw_gl_blendspec { - GLboolean enable; - GLenum src; - GLenum dst; - } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { - {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_none - {GL_TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, // GDRAW_BLEND_alpha - {GL_TRUE, GL_DST_COLOR, - GL_ONE_MINUS_SRC_ALPHA}, // GDRAW_BLEND_multiply - {GL_TRUE, GL_ONE, GL_ONE}, // GDRAW_BLEND_add - - {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_filter - {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_special - }; - - F32 world[2 * 4]; - ProgramWithCachedVariableLocations* prg; - int *fvars, *vvars; - int blend_mode; - - opengl_check(); - assert((vformat >= 0 && vformat < GDRAW_vformat__basic_count) || - vformat == GDRAW_vformat_ihud1); - - if (vformat == GDRAW_vformat_ihud1) { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, - GL_ONE_MINUS_SRC_ALPHA); // premultiplied alpha blend mode - prg = &gdraw->ihud[0]; - } else { - // apply the major blend mode - blend_mode = r->blend_mode; - assert(blend_mode >= 0 && - blend_mode < sizeof(blends) / sizeof(*blends)); - if (blends[blend_mode].enable) { - glEnable(GL_BLEND); - glBlendFunc(blends[blend_mode].src, blends[blend_mode].dst); - } else - glDisable(GL_BLEND); - - // set the fragment program if it wasn't set above - if (r->blend_mode != GDRAW_BLEND_special) { - // make sure data has been initialized - int which = r->tex0_mode, additive = 0; - - if (r->cxf_add) { - additive = 1; - if (r->cxf_add[3]) additive = 2; - } - - prg = &gdraw->fprog[which][additive][vformat]; - } else - prg = &gdraw->exceptional_blend[r->special_blend]; - } - - use_lazy_shader(prg); - OPENGL_CHECK_SITE("set_render_state:use_lazy_shader"); - fvars = prg->vars[0]; - vvars = prg->vars[1]; - - if (vformat == GDRAW_vformat_ihud1) { - F32 wv[2][4] = {1.0f / 960, 0, 0, -1.0, 0, -1.0f / 540, 0, +1.0}; - glUniform4fv(vvars[VAR_ihudv_worldview], 2, wv[0]); - OPENGL_CHECK_SITE("set_render_state:ihud_worldview"); - glUniform4fv(vvars[VAR_ihudv_material], p->uniform_count, p->uniforms); - OPENGL_CHECK_SITE("set_render_state:ihud_material"); - glUniform1f(vvars[VAR_ihudv_textmode], p->drawprim_mode ? 0.0f : 1.0f); - OPENGL_CHECK_SITE("set_render_state:ihud_textmode"); - } else { - // set vertex shader constants - if (!r->use_world_space) - gdraw_ObjectSpace(world, r->o2w, depth_from_id(r->id), 0.0f); - else - gdraw_WorldSpace(world, gdraw->world_to_pixel, depth_from_id(r->id), - 0.0f); - -#ifdef FLASH_10 - set_3d_projection(vvars, world, gdraw->xform_3d); -#else - set_world_projection(vvars, world); -#endif - - if (vvars[VVAR_xoff] >= 0) - glUniform4fv(vvars[VVAR_xoff], 1, r->edge_matrix); - - if (r->texgen0_enabled) { - assert(vvars[VVAR_texgen_s] >= 0 && vvars[VVAR_texgen_t] >= 0); - glUniform4fv(vvars[VVAR_texgen_s], 1, r->s0_texgen); - glUniform4fv(vvars[VVAR_texgen_t], 1, r->t0_texgen); - } - } - - // texture stuff - set_texture(0, r->tex[0]); - OPENGL_CHECK_SITE("set_render_state:set_texture0"); - - if (r->tex[0] && gdraw->has_conditional_non_power_of_two && - ((GDrawHandle*)r->tex[0])->handle.tex.nonpow2) { - // only wrap mode allowed in conditional nonpow2 is clamp; this should - // have been set when the texture was created, but to be on the safe - // side... - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } else - switch (r->wrap0) { - case GDRAW_WRAP_repeat: - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - break; - case GDRAW_WRAP_clamp: - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); - break; - case GDRAW_WRAP_mirror: - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_MIRRORED_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_MIRRORED_REPEAT); - break; - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - r->nearest0 ? GL_NEAREST : GL_LINEAR); - - // fragment shader constants - - if (fvars[VAR_cmul] >= 0) - glUniform4f(fvars[VAR_cmul], r->color[0], r->color[1], r->color[2], - r->color[3]); - if (fvars[VAR_cadd] >= 0) { - if (r->cxf_add) - glUniform4f(fvars[VAR_cadd], r->cxf_add[0] / 255.0f, - r->cxf_add[1] / 255.0f, r->cxf_add[2] / 255.0f, - r->cxf_add[3] / 255.0f); - else - glUniform4f(fvars[VAR_cadd], 0, 0, 0, 0); - } - if (fvars[VAR_focal] >= 0) - glUniform4fv(fvars[VAR_focal], 1, r->focal_point); - - glActiveTexture(GL_TEXTURE0); - - // Set pixel operation states - - if (r->scissor) { - S32 x0, y0, x1, y1; - // scissor.x0,y0 are the top left of the rectangle in display space - // x,y are the *bottom* left of the rectangle in window space - x0 = r->scissor_rect.x0; - y0 = r->scissor_rect.y1; - x1 = r->scissor_rect.x1; - y1 = r->scissor_rect.y0; - // convert into tile-relative coordinates - if (gdraw->tile_enabled) { - x0 -= gdraw->tx0; - y0 -= gdraw->ty0; - x1 -= gdraw->tx0; - y1 -= gdraw->ty0; - } - // convert bottom-most edge to bottom-relative - y0 = (gdraw->th) - y0; - y1 = (gdraw->th) - y1; - if (gdraw->cur == gdraw->frame) { - // move into viewport space - x0 += gdraw->vx; - y0 += gdraw->vy; - x1 += gdraw->vx; - y1 += gdraw->vy; - } - glScissor(x0, y0, x1 - x0, y1 - y0); - glEnable(GL_SCISSOR_TEST); - } else - glDisable(GL_SCISSOR_TEST); - - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - glStencilMask(r->stencil_set); - glStencilFunc(GL_EQUAL, 255, r->stencil_test); - if (r->stencil_set | r->stencil_test) - glEnable(GL_STENCIL_TEST); - else - glDisable(GL_STENCIL_TEST); - - if (r->stencil_set) - glColorMask(0, 0, 0, 0); - else - glColorMask(1, 1, 1, 1); - - if (r->test_id) { - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LESS); - } else { - glDisable(GL_DEPTH_TEST); - glDepthFunc(GL_LESS); - } - - if (r->set_id) - glDepthMask(GL_TRUE); - else - glDepthMask(GL_FALSE); - - OPENGL_CHECK_SITE("set_render_state:final"); - if (ovvars) *ovvars = vvars; - - return 1; -} - -//////////////////////////////////////////////////////////////////////// -// -// Vertex formats -// - -static void set_vertex_format(S32 format, F32* vertices) { - const void* vertex_offset_0 = (const void*)(size_t)vertices; - const void* vertex_offset_8 = - (const void*)((size_t)vertices + (2 * sizeof(F32))); - const void* vertex_offset_16 = - (const void*)((size_t)vertices + (4 * sizeof(F32))); - - switch (format) { - case GDRAW_vformat_v2: - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertex_offset_0); - glEnableVertexAttribArray(0); - break; - - case GDRAW_vformat_v2aa: - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 16, - vertex_offset_0); - glVertexAttribPointer(1, 4, GL_SHORT, GL_FALSE, 16, - vertex_offset_8); - glEnableVertexAttribArray(0); - glEnableVertexAttribArray(1); - break; - - case GDRAW_vformat_v2tc2: - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 16, - vertex_offset_0); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 16, - vertex_offset_8); - glEnableVertexAttribArray(0); - glEnableVertexAttribArray(1); - break; - - case GDRAW_vformat_ihud1: - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 20, - vertex_offset_0); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 20, - vertex_offset_8); - glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, 20, - vertex_offset_16); - glEnableVertexAttribArray(0); - glEnableVertexAttribArray(1); - glEnableVertexAttribArray(2); - break; - - default: - assert(0); - } -} - -static void reset_vertex_format(S32 format) { - // we don't use attrib #1 for all formats, but doesn't seem worthwhile to - // check - format = format; - glDisableVertexAttribArray(0); - glDisableVertexAttribArray(1); - glDisableVertexAttribArray(2); -} - -//////////////////////////////////////////////////////////////////////// -// -// Draw triangles with a given renderstate -// - -static void tag_resources(void* r1, void* r2, void* r3) { - U64 now = gdraw->frame_counter; - if (r1) ((GDrawHandle*)r1)->fence.value = now; - if (r2) ((GDrawHandle*)r2)->fence.value = now; - if (r3) ((GDrawHandle*)r3)->fence.value = now; -} - -static int vformat_stride[] = {2, 4, 4, 5}; - -static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState* r, - GDrawPrimitive* p, - GDrawVertexBuffer* buf, - GDrawStats* gstats) { - GDrawHandle* vb = (GDrawHandle*)buf; - if (vb) { - glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); - } else { - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - } - - if (!set_render_state(r, p->vertex_format, NULL, p, gstats)) return; - gstats->nonzero_flags |= GDRAW_STATS_batches; - gstats->num_batches += 1; - gstats->drawn_indices += p->num_indices; - gstats->drawn_vertices += p->num_vertices; - - if (vb || p->indices) { // regular path - set_vertex_format(p->vertex_format, p->vertices); - glDrawElements(GL_TRIANGLES, p->num_indices, GL_UNSIGNED_SHORT, - p->indices); - } else { // dynamic quads - S32 pos = 0; - U32 stride = - vformat_stride[p->vertex_format]; // in units of sizeof(F32) - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gdraw->quad_ib); - assert(p->num_vertices % 4 == 0); - - while (pos < p->num_vertices) { - S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); - set_vertex_format(p->vertex_format, p->vertices + pos * stride); - glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, - GL_UNSIGNED_SHORT, NULL); - pos += vert_count; - } - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - } - reset_vertex_format(p->vertex_format); - - if (vb) { - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - } - - OPENGL_CHECK_SITE("gdraw_DrawIndexedTriangles:final"); - tag_resources(vb, r->tex[0], r->tex[1]); -} - -/////////////////////////////////////////////////////////////////////// -// -// Flash 8 filter effects -// - -// caller sets up texture coordinates -static void do_screen_quad(gswf_recti* s, F32* tc, const int* vvars, - GDrawStats* gstats, F32 depth) { - F32 px0 = (F32)s->x0, py0 = (F32)s->y0, px1 = (F32)s->x1, py1 = (F32)s->y1; - F32 s0 = tc[0], t0 = tc[1], s1 = tc[2], t1 = tc[3]; - F32 vert[4][4]; - F32 world[2 * 4]; - - OPENGL_CHECK_SITE("do_screen_quad:begin"); - - vert[0][0] = px0; - vert[0][1] = py0; - vert[0][2] = s0; - vert[0][3] = t0; - vert[1][0] = px1; - vert[1][1] = py0; - vert[1][2] = s1; - vert[1][3] = t0; - vert[2][0] = px1; - vert[2][1] = py1; - vert[2][2] = s1; - vert[2][3] = t1; - vert[3][0] = px0; - vert[3][1] = py1; - vert[3][2] = s0; - vert[3][3] = t1; - - OPENGL_CHECK_SITE("do_screen_quad:after_vertices"); - gdraw_PixelSpace(world); - world[2] = depth; - set_world_projection(vvars, world); - OPENGL_CHECK_SITE("do_screen_quad:after_projection"); - - set_vertex_format(GDRAW_vformat_v2tc2, vert[0]); - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - OPENGL_CHECK_SITE("do_screen_quad:before_draw"); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - reset_vertex_format(GDRAW_vformat_v2tc2); - OPENGL_CHECK_SITE("do_screen_quad:after_draw"); - - gstats->nonzero_flags |= GDRAW_STATS_batches; - gstats->num_batches += 1; - gstats->drawn_vertices += 4; - gstats->drawn_indices += 6; - - OPENGL_CHECK_SITE("do_screen_quad:final"); -} - -#ifdef GDRAW_FEWER_CLEARS -static void clear_with_rect(gswf_recti* region, rrbool clear_depth, - GDrawStats* gstats) { - F32 tc[4] = {0, 0, 0, 0}; - - use_lazy_shader(&gdraw->manual_clear); - glUniform4f(gdraw->manual_clear.vars[0][0], 0.0, 0, 0, 0); - - glDisable(GL_BLEND); - - if (clear_depth) { - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_ALWAYS); - glDepthMask(GL_TRUE); - - glEnable(GL_STENCIL_TEST); - glStencilMask(255); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glStencilFunc(GL_ALWAYS, 0, 255); - } else { - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - } - - glColorMask(1, 1, 1, 1); - glColor4f(0, 0, 0, 0); - - { - // coordinate system doesn't match, so just draw whole screen, rely on - // scissor to clip it properly - gswf_recti foo = {-10000, -10000, 10000, 10000}; - do_screen_quad(&foo, tc, gdraw->manual_clear.vars[1], gstats, 1.0f); - } -} -#endif - -static void gdraw_DriverBlurPass(GDrawRenderState* r, int taps, F32* data, - gswf_recti* s, F32* tc, F32 height_max, - F32* clamp, GDrawStats* gstats) { - ProgramWithCachedVariableLocations* prg = &gdraw->blur_prog[taps]; - F32 clampv[4]; - - // fix OpenGL t values for rendertargets are from bottom, not top - tc[1] = height_max - tc[1]; - tc[3] = height_max - tc[3]; - - clampv[0] = clamp[0]; - clampv[1] = height_max - clamp[3]; - clampv[2] = clamp[2]; - clampv[3] = height_max - clamp[1]; - - use_lazy_shader(prg); - set_texture(0, r->tex[0]); - - glColorMask(1, 1, 1, 1); - glDisable(GL_BLEND); - glDisable(GL_SCISSOR_TEST); - - assert(prg->vars[0][VAR_blur_tap] >= 0); - glUniform4fv(prg->vars[0][VAR_blur_tap], taps, data); - glUniform4fv(prg->vars[0][VAR_blur_clampv], 1, clampv); - - do_screen_quad(s, tc, prg->vars[1], gstats, 0); - tag_resources(r->tex[0], 0, 0); -} - -static void gdraw_Colormatrix(GDrawRenderState* r, gswf_recti* s, float* tc, - GDrawStats* gstats) { - ProgramWithCachedVariableLocations* prg = &gdraw->colormatrix; - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - NULL, gstats)) - return; - use_lazy_shader(prg); - set_texture(0, r->tex[0]); - glUniform4fv(prg->vars[0][VAR_colormatrix_data], 5, r->shader_data); - do_screen_quad(s, tc, gdraw->colormatrix.vars[1], gstats, 0); - tag_resources(r->tex[0], 0, 0); - r->tex[0] = gdraw_TextureDrawBufferEnd(gstats); -} - -static gswf_recti* get_valid_rect(GDrawTexture* tex) { - GDrawHandle* h = (GDrawHandle*)tex; - S32 n = (S32)(h - gdraw->rendertargets.handle); - assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH + 1); - return &gdraw->rt_valid[n]; -} - -static void set_clamp_constant(GLint constant, GDrawTexture* tex) { - gswf_recti* s = get_valid_rect(tex); - // when we make the valid data, we make sure there is an extra empty pixel - // at the border we also have to convert from GDraw coords to GL coords - // here. - glUniform4f(constant, (s->x0 - 0.5f) / gdraw->frametex_width, - (gdraw->tph - s->y1 - 0.5f) / gdraw->frametex_height, - (s->x1 + 0.5f) / gdraw->frametex_width, - (gdraw->tph - s->y0 + 0.5f) / gdraw->frametex_height); -} - -static void gdraw_Filter(GDrawRenderState* r, gswf_recti* s, float* tc, - int isbevel, GDrawStats* gstats) { - ProgramWithCachedVariableLocations* prg = - &gdraw->filter_prog[isbevel][r->filter_mode]; - if (!gdraw_TextureDrawBufferBegin( - s, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - NULL, gstats)) - return; - use_lazy_shader(prg); - set_texture(0, r->tex[0]); - set_texture(1, r->tex[1]); - set_texture(2, r->tex[2]); - glUniform4fv(prg->vars[0][VAR_filter_color], 1, &r->shader_data[0]); - glUniform4f(prg->vars[0][VAR_filter_tc_off], - -r->shader_data[4] / (F32)gdraw->frametex_width, - r->shader_data[5] / (F32)gdraw->frametex_height, - r->shader_data[6], 0); - if (prg->vars[0][VAR_filter_color2] >= 0) - glUniform4fv(prg->vars[0][VAR_filter_color2], 1, &r->shader_data[8]); - set_clamp_constant(prg->vars[0][VAR_filter_clamp0], r->tex[0]); - set_clamp_constant(prg->vars[0][VAR_filter_clamp1], r->tex[1]); - do_screen_quad(s, tc, prg->vars[1], gstats, 0); - tag_resources(r->tex[0], 0, 0); - r->tex[0] = gdraw_TextureDrawBufferEnd(gstats); -} - -static void RADLINK gdraw_FilterQuad(GDrawRenderState* r, S32 x0, S32 y0, - S32 x1, S32 y1, GDrawStats* gstats) { - F32 tc[4]; - gswf_recti s; - - // clip to tile boundaries - s.x0 = RR_MAX(x0, gdraw->tx0p); - s.y0 = RR_MAX(y0, gdraw->ty0p); - s.x1 = RR_MIN(x1, gdraw->tx0p + gdraw->tpw); - s.y1 = RR_MIN(y1, gdraw->ty0p + gdraw->tph); - if (s.x1 <= s.x0 || s.y1 <= s.y0) return; - - // if it's a rendertarget, it's inverted from our design because OpenGL is - // bottom-left 0,0 and we have to compensate for scaling - tc[0] = (s.x0 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[1] = (gdraw->tph - (s.y0 + gdraw->ty0p)) / (F32)gdraw->frametex_height; - tc[2] = (s.x1 - gdraw->tx0p) / (F32)gdraw->frametex_width; - tc[3] = (gdraw->tph - (s.y1 - gdraw->ty0p)) / (F32)gdraw->frametex_height; - - glUseProgram(0); - set_texture(0, 0); - set_texture(1, 0); - set_texture(2, 0); - - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilMask(255); - glDisable(GL_STENCIL_TEST); - glColorMask(1, 1, 1, 1); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - OPENGL_CHECK_SITE("gdraw_FilterQuad:pre_filter"); - - if (r->blend_mode == GDRAW_BLEND_filter) { - switch (r->filter) { - case GDRAW_FILTER_blur: { - GDrawBlurInfo b; - gswf_recti bounds = *get_valid_rect(r->tex[0]); - gdraw_ShiftRect(&s, &s, -gdraw->tx0p, - -gdraw->ty0p); // blur uses physical - // rendertarget coordinates - - b.BlurPass = gdraw_DriverBlurPass; - b.w = gdraw->tpw; - b.h = gdraw->tph; - b.frametex_width = gdraw->frametex_width; - b.frametex_height = gdraw->frametex_height; - - // blur passes must override the viewport/ortho projection - - gdraw->in_blur = true; // prevent viewport/projection munging - // in start/end texture - set_viewport(); - set_projection(); - gdraw_Blur(&gdraw_funcs, &b, r, &s, &bounds, gstats); - - gdraw->in_blur = false; - - set_viewport(); - set_projection(); - break; - } - - case GDRAW_FILTER_colormatrix: - gdraw_Colormatrix(r, &s, tc, gstats); - break; - - case GDRAW_FILTER_dropshadow: - gdraw_Filter(r, &s, tc, 0, gstats); - break; - - case GDRAW_FILTER_bevel: - gdraw_Filter(r, &s, tc, 1, gstats); - break; - - default: - assert(0); - } - } else { - GDrawTexture* blend_tex = NULL; - const int* vvars; - - // for crazy blend modes, we need to read back from the framebuffer - // and do the blending in the pixel shader. we do this with - // CopyTexSubImage, rather than trying to render-to-texture-all-along, - // because that's a pain. - // @TODO: propogate the rectangle down and only copy what we need, like - // in 360 - - if (r->blend_mode == GDRAW_BLEND_special) { - blend_tex = (GDrawTexture*)get_color_rendertarget(gstats); - glBindTexture(GL_TEXTURE_2D, - ((GDrawHandle*)blend_tex)->handle.tex.gl); - if (gdraw->cur != gdraw->frame) - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, gdraw->tpw, - gdraw->tph); - else - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, gdraw->tx0 - gdraw->tx0p, - gdraw->ty0 - gdraw->ty0p, gdraw->vx, - gdraw->vy, gdraw->tw, gdraw->th); - - set_texture(1, blend_tex); - } - - if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, NULL, gstats)) - return; - do_screen_quad(&s, tc, vvars, gstats, 0); - tag_resources(r->tex[0], r->tex[1], 0); - if (blend_tex) gdraw_FreeTexture(blend_tex, 0, gstats); - } -} - -void gdraw_GLx_(NoMoreGDrawThisFrame)(void) { - clear_renderstate(); - ++gdraw->frame_counter; -} - -void gdraw_GLx_(BeginCustomDraw)(IggyCustomDrawCallbackRegion* region, - F32* matrix) { - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(matrix, region->o2w, gdraw->projection, - depth_from_id(0), 1); -} - -void gdraw_GLx_(EndCustomDraw)(IggyCustomDrawCallbackRegion* region) { - set_common_renderstate(); -} - -/////////////////////////////////////////////////////////////////////// -// -// Vertex and Fragment program initialization -// - -#include GDRAW_SHADERS - -static void make_vars(GDrawGLProgram prog, S32 vars[2][8], char** varn) { - if (prog) { - char** varn2 = (varn == pshader_general2_vars ? vshader_vsglihud_vars - : vshader_vsgl_vars); - S32 k; - for (k = 0; varn[k]; ++k) - if (varn[k][0]) - vars[0][k] = glGetUniformLocation(prog, varn[k]); - else - vars[0][k] = -1; - - for (k = 0; varn2[k]; ++k) - if (varn2[k][0]) - vars[1][k] = glGetUniformLocation(prog, varn2[k]); - else - vars[1][k] = -1; - - if (vars[0][0] >= 0) assert(vars[0][0] != vars[0][1]); - } -} - -static void make_fragment_program(ProgramWithCachedVariableLocations* p, - int num_strings, char** strings, - char** varn) { - S32 i; - GLint res; - GDrawGLProgram shad; - opengl_check(); - for (i = 0; i < MAX_VARS; ++i) { - p->vars[0][i] = -1; - p->vars[1][i] = -1; - } - - shad = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(shad, num_strings, (const GLchar**)strings, NULL); - glCompileShader(shad); - glGetShaderiv(shad, GL_COMPILE_STATUS, &res); - if (!res) { - char errors[512]; - glGetShaderInfoLog(shad, sizeof(errors) - 2, &res, errors); - compilation_err(errors); - p->program = 0; - } else { - S32 vert = GDRAW_vformat_v2tc2; - ProgramWithCachedVariableLocations* basic_fprog_begin = - &gdraw->fprog[0][0][0]; - ProgramWithCachedVariableLocations* basic_fprog_end = - basic_fprog_begin + - (sizeof(gdraw->fprog) / sizeof(gdraw->fprog[0][0][0])); - if (p >= basic_fprog_begin && p < basic_fprog_end) { - // for basic rendering shaders, we have three versions corresponding - // to the three vertex formats we support. - S32 n = (S32)(p - basic_fprog_begin); - vert = n % 3; - } - - if (p == &gdraw->ihud[0]) vert = GDRAW_vformat_ihud1; - - opengl_check(); - p->program = glCreateProgram(); - glAttachShader(p->program, shad); - glAttachShader(p->program, gdraw->vert[vert]); - opengl_check(); - - if (vert == GDRAW_vformat_ihud1) { - glBindAttribLocation(p->program, 0, "position"); - glBindAttribLocation(p->program, 1, "texcoord"); - glBindAttribLocation(p->program, 2, "material_index"); - } else { - glBindAttribLocation(p->program, 0, "position"); - glBindAttribLocation(p->program, 1, "in_attr"); - } - - glLinkProgram(p->program); - glGetProgramiv(p->program, GL_LINK_STATUS, &res); - if (!res) { - char errors[512]; - glGetProgramiv(p->program, GL_INFO_LOG_LENGTH, &res); - glGetProgramInfoLog(p->program, sizeof(errors) - 2, &res, errors); - compilation_err(errors); - glDeleteShader(shad); - glDeleteProgram(p->program); - p->program = 0; - } else - make_vars(p->program, p->vars, varn); - } - opengl_check(); - glUseProgram(p->program); // now activate the program - opengl_check(); -} - -static void make_vertex_program(GLuint* vprog, int num_strings, - char** strings) { - GLint res; - GDrawGLProgram shad; - opengl_check(); - - if (strings[0]) { - shad = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(shad, num_strings, (const GLchar**)strings, NULL); - glCompileShader(shad); - glGetShaderiv(shad, GL_COMPILE_STATUS, &res); - if (!res) { - char errors[512]; - glGetShaderInfoLog(shad, sizeof(errors) - 2, &res, errors); - compilation_err(errors); - glDeleteShader(shad); - shad = 0; - } - opengl_check(); - *vprog = shad; - } else { - *vprog = 0; - } -} - -static void bind_sampler(ProgramWithCachedVariableLocations* prog, int varidx, - int sampleridx) { - int var = prog->vars[0][varidx]; - if (var >= 0) glUniform1i(var, sampleridx); -} - -static void make_vertex_programs(void) { - int type; - for (type = 0; type < GDRAW_vformat__basic_count; type++) - make_vertex_program(&gdraw->vert[type], NUMFRAGMENTS_vshader_vsgl, - vshader_vsgl(type)); - type = GDRAW_vformat_ihud1; - make_vertex_program(&gdraw->vert[type], NUMFRAGMENTS_vshader_vsglihud, - vshader_vsglihud()); -} - -static void lazy_shader(ProgramWithCachedVariableLocations* ptr) { - ProgramWithCachedVariableLocations* basic_fprog_begin = - &gdraw->fprog[0][0][0]; - ProgramWithCachedVariableLocations* basic_fprog_end = - basic_fprog_begin + - (sizeof(gdraw->fprog) / sizeof(gdraw->fprog[0][0][0])); - - if (ptr >= basic_fprog_begin && ptr < basic_fprog_end) { - S32 n = (S32)(ptr - basic_fprog_begin); - n /= 3; - - make_fragment_program(ptr, NUMFRAGMENTS_pshader_basic, - pshader_basic_arr[n], pshader_basic_vars); - bind_sampler(ptr, VAR_tex0, 0); - bind_sampler(ptr, VAR_tex1, AATEX_SAMPLER); - return; - } - - if (ptr >= &gdraw->exceptional_blend[0] && - ptr < &gdraw->exceptional_blend[GDRAW_BLENDSPECIAL__count]) { - S32 n = (S32)(ptr - gdraw->exceptional_blend); - make_fragment_program(ptr, NUMFRAGMENTS_pshader_exceptional_blend, - pshader_exceptional_blend_arr[n], - pshader_exceptional_blend_vars); - bind_sampler(ptr, VAR_tex0, 0); - bind_sampler(ptr, VAR_tex1, 1); - return; - } - - if (ptr >= &gdraw->filter_prog[0][0] && ptr <= &gdraw->filter_prog[1][15]) { - S32 n = (S32)(ptr - gdraw->filter_prog[0]); - make_fragment_program(ptr, NUMFRAGMENTS_pshader_filter, - pshader_filter_arr[n], pshader_filter_vars); - bind_sampler(ptr, VAR_filter_tex0, 0); - bind_sampler(ptr, VAR_filter_tex1, 1); - bind_sampler(ptr, VAR_filter_tex2, 2); - return; - } - - if (ptr >= &gdraw->blur_prog[0] && ptr <= &gdraw->blur_prog[MAX_TAPS]) { - S32 n = (S32)(ptr - gdraw->blur_prog); - make_fragment_program(ptr, NUMFRAGMENTS_pshader_blur, - pshader_blur_arr[n], pshader_blur_vars); - bind_sampler(ptr, VAR_blur_tex0, 0); - return; - } - - if (ptr == &gdraw->colormatrix) { - make_fragment_program(ptr, NUMFRAGMENTS_pshader_color_matrix, - pshader_color_matrix_arr[0], - pshader_color_matrix_vars); - bind_sampler(ptr, VAR_colormatrix_tex0, 0); - return; - } - - if (ptr == &gdraw->manual_clear) { - make_fragment_program(ptr, NUMFRAGMENTS_pshader_manual_clear, - pshader_manual_clear_arr[0], - pshader_manual_clear_vars); - return; - } - - if (ptr == &gdraw->ihud[0]) { - make_fragment_program(ptr, NUMFRAGMENTS_pshader_general2, - pshader_general2_arr[0], pshader_general2_vars); - bind_sampler(ptr, VAR_tex0, 0); - return; - } - - RR_BREAK(); -} - -static rrbool make_quad_indices(void) { - int size = QUAD_IB_COUNT * 6 * sizeof(GLushort); - GLushort* inds = IggyGDrawMalloc(size); - int i, e; - - if (!inds) return 0; - - // make quad inds - for (i = 0; i < QUAD_IB_COUNT; i++) { - inds[i * 6 + 0] = (GLushort)(i * 4 + 0); - inds[i * 6 + 1] = (GLushort)(i * 4 + 1); - inds[i * 6 + 2] = (GLushort)(i * 4 + 2); - inds[i * 6 + 3] = (GLushort)(i * 4 + 0); - inds[i * 6 + 4] = (GLushort)(i * 4 + 2); - inds[i * 6 + 5] = (GLushort)(i * 4 + 3); - } - - glGenBuffers(1, &gdraw->quad_ib); - glBindBuffer(GL_ARRAY_BUFFER, gdraw->quad_ib); - glBufferData(GL_ARRAY_BUFFER, size, inds, GL_STATIC_DRAW); - IggyGDrawFree(inds); - e = glGetError(); - if (e != GL_NO_ERROR) { - eat_gl_err(); - return 0; - } - - return 1; -} - -//////////////////////////////////////////////////////////////////////// -// -// Create and tear-down the state -// - -typedef struct { - S32 num_handles; - S32 num_bytes; -} GDrawResourceLimit; - -// These are the defaults limits used by GDraw unless the user specifies -// something else. -static GDrawResourceLimit gdraw_limits[GDRAW_GLx_(RESOURCE__count)] = { - MAX_RENDER_STACK_DEPTH + 1, - 16 * 1024 * 1024, // GDRAW_GLx_RESOURCE_rendertarget - 500, - 20 * 1024 * 1024, // GDRAW_GLx_RESOURCE_texture - 1000, - 2 * 1024 * 1024, // GDRAW_GLx_RESOURCE_vertexbuffer -}; - -static GDrawHandleCache* make_handle_cache(gdraw_resourcetype type) { - S32 num_handles = gdraw_limits[type].num_handles; - S32 num_bytes = gdraw_limits[type].num_bytes; - GDrawHandleCache* cache = (GDrawHandleCache*)IggyGDrawMalloc( - sizeof(GDrawHandleCache) + (num_handles - 1) * sizeof(GDrawHandle)); - if (cache) { - gdraw_HandleCacheInit(cache, num_handles, num_bytes); - cache->is_vertex = (type == GDRAW_GLx_(RESOURCE_vertexbuffer)); - } - - return cache; -} - -static void free_gdraw() { - if (!gdraw) return; - if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); - if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); - IggyGDrawFree(gdraw); - gdraw = NULL; -} - -int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, - S32 num_bytes) { - GDrawStats stats = {0}; - - if (type == GDRAW_GLx_(RESOURCE_rendertarget)) // RT count is small and - // space is preallocated - num_handles = MAX_RENDER_STACK_DEPTH + 1; - - assert(type >= GDRAW_GLx_(RESOURCE_rendertarget) && - type < GDRAW_GLx_(RESOURCE__count)); - assert(num_handles >= 0); - assert(num_bytes >= 0); - - // nothing to do if the values are unchanged - if (gdraw_limits[type].num_handles == num_handles && - gdraw_limits[type].num_bytes == num_bytes) - return 1; - - gdraw_limits[type].num_handles = num_handles; - gdraw_limits[type].num_bytes = num_bytes; - - // if no gdraw context created, there's nothing to worry about - if (!gdraw) return 1; - - // resize the appropriate pool - switch (type) { - case GDRAW_GLx_(RESOURCE_rendertarget): - flush_rendertargets(&stats); - gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, - num_bytes); - return 1; - - case GDRAW_GLx_(RESOURCE_texture): - if (gdraw->texturecache) { - gdraw_res_flush(gdraw->texturecache, &stats); - IggyGDrawFree(gdraw->texturecache); - } - gdraw->texturecache = - make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); - return gdraw->texturecache != NULL; - - case GDRAW_GLx_(RESOURCE_vertexbuffer): - if (gdraw->vbufcache) { - gdraw_res_flush(gdraw->vbufcache, &stats); - IggyGDrawFree(gdraw->vbufcache); - } - gdraw->vbufcache = - make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; - - default: - return 0; - } -} - -GDrawTexture* RADLINK gdraw_GLx_(MakeTextureFromResource)( - U8* resource_file, S32 len, IggyFileTextureRaw* texture) { - int i, offset, mips; - const TextureFormatDesc* fmt; - GDrawTexture* tex; - GLuint gl_texture_handle; - - // look up the texture format - fmt = gdraw->tex_formats; - while (fmt->iggyfmt != texture->format && fmt->blkbytes) fmt++; - if (!fmt->blkbytes) // end of list - i.e. format not supported - return NULL; - - // prepare texture - glGenTextures(1, &gl_texture_handle); - if (gl_texture_handle == 0) return NULL; - - opengl_check(); - make_texture(gl_texture_handle); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - offset = texture->file_offset; - mips = RR_MAX(texture->mipmaps, 1); - - // disable mipmaps if non-pow-2 is unsupported - if (gdraw->has_conditional_non_power_of_two) - if (!is_pow2(texture->w) || !is_pow2(texture->h)) mips = 1; - - // disable mipmaps if chain is incomplete and GL_TEXTURE_MAX_LEVEL is - // unsupported - if (!gdraw->has_texture_max_level && mips > 1) { - int lastmip = mips - 1; - if ((texture->w >> lastmip) > 1 || (texture->h >> lastmip) > 1) - mips = 1; - } - - for (i = 0; i < mips; i++) { - U8* data = resource_file + offset; - int w = RR_MAX(texture->w >> i, 1); - int h = RR_MAX(texture->h >> i, 1); - int j; - - if (texture->format == IFT_FORMAT_rgba_4444_LE) { - for (j = 0; j < w * h; ++j) { - unsigned short x = *(unsigned short*)(data + j * 2); - x = ((x >> 12) & 0xf) | ((x << 4) & 0xfff0); - *(unsigned short*)(data + j * 2) = x; - } - } - if (texture->format == IFT_FORMAT_rgba_5551_LE) { - for (j = 0; j < w * h; ++j) { - unsigned short x = *(unsigned short*)(data + j * 2); - x = (x >> 15) | (x << 1); - *(unsigned short*)(data + j * 2) = x; - } - } - - if (fmt->fmt != 0) { - glTexImage2D(GL_TEXTURE_2D, i, fmt->intfmt, w, h, 0, fmt->fmt, - fmt->type, data); - offset += w * h * fmt->blkbytes; - } else { - int size = ((w + fmt->blkx - 1) / fmt->blkx) * - ((h + fmt->blky - 1) / fmt->blky) * fmt->blkbytes; - glCompressedTexImage2D(GL_TEXTURE_2D, i, fmt->intfmt, w, h, 0, size, - data); - offset += size; - } - - opengl_check(); - } - - if (gdraw->has_texture_max_level) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mips - 1); - - tex = gdraw_GLx_(WrappedTextureCreate)(gl_texture_handle, texture->w, - texture->h, mips > 1); - if (tex == NULL) glDeleteTextures(1, &gl_texture_handle); - opengl_check(); - return tex; -} - -void RADLINK gdraw_GLx_(DestroyTextureFromResource)(GDrawTexture* tex) { - if (tex) gdraw_GLx_(WrappedTextureDestroy)(tex); -} - -static rrbool hasext(const char* exts, const char* which) { - const char* where; - size_t len; - -#ifdef GDRAW_USE_glGetStringi - if (exts == NULL) { - GLint i, num_exts; - glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts); - for (i = 0; i < num_exts; ++i) - if (0 == strcmp(which, (char const*)glGetStringi(GL_EXTENSIONS, i))) - return 1; - return 0; - } -#endif - - where = exts; - len = strlen(which); - - for (;;) { - where = strstr(where, which); - if (where == NULL) return false; - - if ((where == exts || *(where - 1) == ' ') // starts with terminator - && (where[len] == ' ' || where[len] == 0)) // ends with terminator - return true; - where += len; - } -} - -static GDrawFunctions* create_context(S32 w, S32 h) { - gdraw = IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; - - memset(gdraw, 0, sizeof(*gdraw)); - - gdraw->texturecache = make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); - gdraw->vbufcache = make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); - gdraw_HandleCacheInit( - &gdraw->rendertargets, - gdraw_limits[GDRAW_GLx_(RESOURCE_rendertarget)].num_handles, - gdraw_limits[GDRAW_GLx_(RESOURCE_rendertarget)].num_bytes); - - if (!gdraw->texturecache || !gdraw->vbufcache || !make_quad_indices()) { - free_gdraw(); - return NULL; - } - - opengl_check(); - - gdraw->frametex_width = w; - gdraw->frametex_height = h; - gdraw->frame->cached = false; - - // if the globals have already been initialized, this has no effect; - // otherwise it initializes them with no global texture storage and the - // default global rendertarget storage - - glGenFramebuffers(1, &gdraw->framebuffer_stack_object); - glGenFramebuffers(1, &gdraw->framebuffer_copy_to_texture); - opengl_check(); - - make_vertex_programs(); - // fragment shaders are created lazily - - gdraw_funcs.SetViewSizeAndWorldScale = gdraw_SetViewSizeAndWorldScale; - gdraw_funcs.RenderingBegin = gdraw_RenderingBegin; - gdraw_funcs.RenderingEnd = gdraw_RenderingEnd; - gdraw_funcs.RenderTileBegin = gdraw_RenderTileBegin; - gdraw_funcs.RenderTileEnd = gdraw_RenderTileEnd; - gdraw_funcs.GetInfo = gdraw_GetInfo; - gdraw_funcs.DescribeTexture = gdraw_DescribeTexture; - gdraw_funcs.DescribeVertexBuffer = gdraw_DescribeVertexBuffer; - - gdraw_funcs.TextureDrawBufferBegin = gdraw_TextureDrawBufferBegin; - gdraw_funcs.TextureDrawBufferEnd = gdraw_TextureDrawBufferEnd; - - gdraw_funcs.DrawIndexedTriangles = gdraw_DrawIndexedTriangles; - gdraw_funcs.FilterQuad = gdraw_FilterQuad; - - gdraw_funcs.SetAntialiasTexture = gdraw_SetAntialiasTexture; - - gdraw_funcs.ClearStencilBits = gdraw_ClearStencilBits; - gdraw_funcs.ClearID = gdraw_ClearID; - - gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; - gdraw_funcs.MakeTextureMore = NULL; - gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; - - gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; - gdraw_funcs.UpdateTextureBegin = gdraw_UpdateTextureBegin; - gdraw_funcs.UpdateTextureEnd = gdraw_UpdateTextureEnd; - gdraw_funcs.FreeTexture = gdraw_FreeTexture; - gdraw_funcs.TryToLockTexture = gdraw_TryToLockTexture; - - gdraw_funcs.MakeVertexBufferBegin = gdraw_MakeVertexBufferBegin; - gdraw_funcs.MakeVertexBufferMore = gdraw_MakeVertexBufferMore; - gdraw_funcs.MakeVertexBufferEnd = gdraw_MakeVertexBufferEnd; - gdraw_funcs.TryToLockVertexBuffer = gdraw_TryToLockVertexBuffer; - gdraw_funcs.FreeVertexBuffer = gdraw_FreeVertexBuffer; - - gdraw_funcs.UnlockHandles = gdraw_UnlockHandles; - gdraw_funcs.SetTextureUniqueID = gdraw_SetTextureUniqueID; - - gdraw_funcs.MakeTextureFromResource = - (gdraw_make_texture_from_resource*)gdraw_GLx_(MakeTextureFromResource); - gdraw_funcs.FreeTextureFromResource = - gdraw_GLx_(DestroyTextureFromResource); - - gdraw_funcs.Set3DTransform = gdraw_Set3DTransform; - - return &gdraw_funcs; -} - -void gdraw_GLx_(DestroyContext)(void) { - if (gdraw) { - GDrawStats stats = {0}; - if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); - if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - flush_rendertargets(&stats); - - if (gdraw->aa_tex) glDeleteTextures(1, &gdraw->aa_tex); - - if (gdraw->quad_ib) glDeleteBuffers(1, &gdraw->quad_ib); - } - - opengl_check(); - free_gdraw(); -} diff --git a/targets/app/windows/Iggy/gdraw/gdraw_shared.inl b/targets/app/windows/Iggy/gdraw/gdraw_shared.inl deleted file mode 100644 index 6fa38f455..000000000 --- a/targets/app/windows/Iggy/gdraw/gdraw_shared.inl +++ /dev/null @@ -1,2693 +0,0 @@ -// gdraw_shared.inl - author: Sean Barrett - copyright 2010 RAD Game Tools -// -// This file implements some common code that can be shared across -// all the sample implementations of GDraw. - -#if defined(IGGY_DISABLE_GDRAW_ASSERT) -#define assert(x) -#else -#include -#endif - -#include - -#if !defined(GDRAW_MAYBE_UNUSED) -#define GDRAW_MAYBE_UNUSED -#endif - -/////////////////////////////////////////////////////////////// -// -// GDrawHandleCache manages resource "handles" used by Iggy -// (i.e. these handles wrap the platform resource handles, -// and this file provides those wrappers and facilities for -// LRU tracking them). Moreover, for console platforms, we -// actually implement our own managed resource pools. -// -// This is the main state machine when GDRAW_MANAGE_MEM is defined: -// (which covers all console platforms) -// -// +------+ +--------+ | -// | Live |<------->| Locked | | -// +------+ +--------+ | -// / \ ^ | -// / \ \ | -// v v \ | -// +------+ +------+ +------+ | | -// | Dead |--->| Free |<---| User | | | -// +------+ +------+ +------+ | | -// ^ ^ ^ ^ | | -// \ / \ | | | -// \ / v | | | -// +--------+ +-------+ / | -// | Pinned |<--------| Alloc |/ | -// +--------+ +-------+ | -// -// "Free" handles are not in use and available for allocation. -// "Alloc" handles have been assigned by GDraw, but do not yet -// have a system resource backing them. Resources stay in -// this state until we know that for sure that we're going -// to be able to successfully complete creation, at which -// point the resource transitions to one of the regular states. -// "Live" handles correspond to resources that may be used -// for rendering. They are kept in LRU order. Old resources -// may be evicted to make space. -// "Locked" handles cover resources that are going to be used -// in the next draw command. Once a resource is marked locked, -// it may not be evicted until it's back to "Live". -// "Dead" handles describe resources that have been freed on the -// CPU side, but are still in use by the GPU. Their memory may -// only be reclaimed once the GPU is done with them, at which -// point they are moved to the "Free" list. Items on the "Dead" -// list appear ordered by the last time they were used by the -// GPU - "most stale" first. -// "Pinned" resources can be used in any draw call without getting -// locked first. They can never be LRU-freed, but their memory -// is still managed by GDraw. Currently this is only used for -// the Iggy font cache. -// "User" (user-owned) resources are exactly that. They act much like -// pinned resources, but their memory isn't managed by GDraw. -// When a user-owned resource is freed, we really need to free -// it immediately (instead of marking it as "dead"), which might -// necessitate stalling the CPU until the GPU is finished using -// that resource. Since we don't own the memory, delayed frees -// are not an option. -// -// Without GDRAW_MANAGE_MEM, there's no "Dead" resources, and all -// frees are performed immediately. - -typedef struct GDrawHandleCache GDrawHandleCache; -typedef struct GDrawHandle GDrawHandle; - -typedef struct { - U64 value; -} GDrawFence; - -typedef enum { - GDRAW_HANDLE_STATE_free = 0, - GDRAW_HANDLE_STATE_live, - GDRAW_HANDLE_STATE_locked, - GDRAW_HANDLE_STATE_dead, - GDRAW_HANDLE_STATE_pinned, - GDRAW_HANDLE_STATE_user_owned, - GDRAW_HANDLE_STATE_alloc, - GDRAW_HANDLE_STATE__count, - - // not an actual state! - GDRAW_HANDLE_STATE_sentinel = GDRAW_HANDLE_STATE__count, -} GDrawHandleState; - -struct GDrawHandle { - GDrawNativeHandle handle; // platform handle to a resource (variable size) - void* owner; // 4/8 // opaque handle used to allow freeing resources - // without calling back to owner - - GDrawHandleCache* cache; // 4/8 // which cache this handle came from - - GDrawHandle *next, *prev; // 8/16 // doubly-linked list - -#if defined(GDRAW_MANAGE_MEM) - void* raw_ptr; // 4/8 // pointer to allocation - when you're managing - // memory manually -#if defined(GDRAW_CORRUPTION_CHECK) - U32 cached_raw_value[4]; - rrbool has_check_value; -#endif -#endif - - GDrawFence fence; // 8 // (optional) platform fence for resource - // 4 - U32 bytes : 28; // estimated storage cost to allow setting a loose limit - U32 state : 4; // state the handle is in -}; - -// validate alignment to make sure structure will pack correctly -#if defined(__RAD64__) -RR_COMPILER_ASSERT((sizeof(GDrawHandle) & 7) == 0); -#else -RR_COMPILER_ASSERT((sizeof(GDrawHandle) & 3) == 0); -#endif - -struct GDrawHandleCache { - S32 bytes_free; - S32 total_bytes; - S32 max_handles; - U32 is_vertex : 1; // vertex buffers have different warning codes and - // generate discard callbacks - U32 is_thrashing : 1; - U32 did_defragment : 1; - // 30 unused bits - GDrawHandle state[GDRAW_HANDLE_STATE__count]; // sentinel nodes for all of - // the state lists -#if defined(GDRAW_MANAGE_MEM) - struct gfx_allocator* alloc; -#endif -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) - struct gfx_allocator* alloc_other; -#endif - GDrawFence prev_frame_start, - prev_frame_end; // fence value at start/end of previous frame, for - // thrashing detection - GDrawHandle handle[1]; // the rest of the handles must be stored right - // after this in the containing structure -}; - -#if defined(GDRAW_CORRUPTION_CHECK) -// values for corruption checking -#define GDRAW_CORRUPTIONCHECK_renderbegin 0x10 -#define GDRAW_CORRUPTIONCHECK_renderend 0x20 -#define GDRAW_CORRUPTIONCHECK_nomoregdraw 0x30 -#define GDRAW_CORRUPTIONCHECK_maketexbegin 0x40 -#define GDRAW_CORRUPTIONCHECK_maketexend 0x50 - -#define GDRAW_CORRUPTIONCHECK_wrappedcreateend 0x60 -#define GDRAW_CORRUPTIONCHECK_wrappedcreatebegin 0x61 -#define GDRAW_CORRUPTIONCHECK_wrappeddestroyend 0x70 -#define GDRAW_CORRUPTIONCHECK_wrappeddestroybegin 0x71 - -#define GDRAW_CORRUPTIONCHECK_allochandle 0x80 -#define GDRAW_CORRUPTIONCHECK_allochandle_begin 0x81 -#define GDRAW_CORRUPTIONCHECK_allochandle_postreap 0x82 -#define GDRAW_CORRUPTIONCHECK_allochandle_postfree1 0x83 -#define GDRAW_CORRUPTIONCHECK_allochandle_postfree2 0x84 -#define GDRAW_CORRUPTIONCHECK_allochandle_postfree3 0x85 -#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc1 0x86 -#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc2 0x87 -#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc3 0x88 -#define GDRAW_CORRUPTIONCHECK_allochandle_defrag 0x89 - -#define GDRAW_CORRUPTIONCHECK_freetex 0x90 - -static U32* debug_raw_address(GDrawHandle* t, int choice) { - static int offset_table[4] = {0x555555, 0xaaaaaa, 0x333333, 0x6e6e6e}; - U8* base = (U8*)t->raw_ptr; - int offset = offset_table[choice] & (t->bytes - 1) & ~3; - return (U32*)(base + offset); -} - -static void debug_check_overlap_one(GDrawHandle* t, U8* ptr, S32 len) { - assert(len >= 0); - if (t->raw_ptr && t->raw_ptr != ptr) { - assert(t->raw_ptr < ptr || t->raw_ptr >= ptr + len); - } -} - -static void debug_check_overlap(GDrawHandleCache* c, U8* ptr, S32 len) { - GDrawHandle* t = c->head; - while (t) { - debug_check_overlap_one(t, ptr, len); - t = t->next; - } - t = c->active; - while (t) { - debug_check_overlap_one(t, ptr, len); - t = t->next; - } -} - -static void debug_check_raw_values(GDrawHandleCache* c) { - GDrawHandle* t = c->head; - while (t) { - if (t->raw_ptr && t->has_check_value) { - int i; - for (i = 0; i < 4; ++i) { - if (*debug_raw_address(t, i) != t->cached_raw_value[i]) { - // zlog("!Iggy texture corruption found\n"); - // zlog("t=%p, t->raw_ptr=%p\n", t, t->raw_ptr); - // zlog("Cached values: %08x %08x %08x %08x\n", - // t->cached_raw_value[0], t->cached_raw_value[1], - // t->cached_raw_value[2], t->cached_raw_value[3]); - // zlog("Current values: %08x %08x %08x %08x\n", - // *debug_raw_address(t,0), *debug_raw_address(t,1), - // *debug_raw_address(t,2), *debug_raw_address(t,3)); - assert(0); - } - } - } - t = t->next; - } - t = c->active; - while (t) { - if (t->raw_ptr && t->has_check_value) { - int i; - for (i = 0; i < 4; ++i) { - if (*debug_raw_address(t, i) != t->cached_raw_value[i]) { - // zlog("!Iggy texture corruption found\n"); - // zlog("t=%p, t->raw_ptr=%p\n", t, t->raw_ptr); - // zlog("Cached values: %08x %08x %08x %08x\n", - // t->cached_raw_value[0], t->cached_raw_value[1], - // t->cached_raw_value[2], t->cached_raw_value[3]); - // zlog("Current values: %08x %08x %08x %08x\n", - // *debug_raw_address(t,0), *debug_raw_address(t,1), - // *debug_raw_address(t,2), *debug_raw_address(t,3)); - assert(0); - } - } - } - t = t->next; - } -} - -#if !defined(GDRAW_CORRUPTION_MASK) -#define GDRAW_CORRUPTION_MASK 0 -#endif -#define debug_check_raw_values_if(c, v) \ - if ((GDRAW_CORRUPTION_CHECK & ~GDRAW_CORRUPTION_MASK) == \ - ((v) & ~GDRAW_CORRUPTION_MASK)) \ - debug_check_raw_values(c); \ - else - -static void debug_set_raw_value(GDrawHandle* t) { - if (t->raw_ptr) { - int i; - for (i = 0; i < 4; ++i) - t->cached_raw_value[i] = *debug_raw_address(t, i); - t->has_check_value = true; - } -} - -static void debug_unset_raw_value(GDrawHandle* t) { - t->has_check_value = false; -} - -static void debug_check_value_is_unreferenced(GDrawHandleCache* c, void* ptr) { - GDrawHandle* t = c->head; - while (t) { - assert(t->raw_ptr != ptr); - t = t->next; - } - t = c->active; - while (t) { - assert(t->raw_ptr != ptr); - t = t->next; - } -} - -#else - -#define debug_check_overlap(c, p, len) -#define debug_set_raw_value(t) -#define debug_check_value_is_unreferenced(c, p) -#define debug_unset_raw_value(t) -#define debug_check_raw_values(c) -#define debug_check_raw_values_if(c, v) -#endif - -#if defined(SUPERDEBUG) -static void check_lists(GDrawHandleCache* c) { - GDrawHandle *sentinel, *t; - U32 state; - - // for all lists, verify that they are consistent and - // properly linked - for (state = 0; state < GDRAW_HANDLE_STATE__count; state++) { - S32 count = 0; - sentinel = &c->state[state]; - - assert(!sentinel->cache); - assert(sentinel->state == GDRAW_HANDLE_STATE_sentinel); - for (t = sentinel->next; t != sentinel; t = t->next) { - count++; - assert(t->cache == c); - assert(t->state == state); - assert(t->prev->next == t); - assert(t->next->prev == t); - assert(count < 50000); - } - } - - // for dead list, additionally verify that it's in the right - // order (namely, sorted by ascending fence index) - sentinel = &c->state[GDRAW_HANDLE_STATE_dead]; - for (t = sentinel->next; t != sentinel; t = t->next) { - assert(t->prev == sentinel || t->fence.value >= t->prev->fence.value); - } -} - -#include - -static const char* gdraw_StateName(U32 state) { - switch (state) { - case GDRAW_HANDLE_STATE_free: - return "free"; - case GDRAW_HANDLE_STATE_live: - return "live"; - case GDRAW_HANDLE_STATE_locked: - return "locked"; - case GDRAW_HANDLE_STATE_dead: - return "dead"; - case GDRAW_HANDLE_STATE_pinned: - return "pinned"; - case GDRAW_HANDLE_STATE_user_owned: - return "user-owned"; - case GDRAW_HANDLE_STATE_alloc: - return "alloc"; - case GDRAW_HANDLE_STATE_sentinel: - return ""; - default: - return "???"; - } -} - -#else -static RADINLINE void check_lists(GDrawHandleCache* c) { - RR_UNUSED_VARIABLE(c); -} -#endif - -static void gdraw_HandleTransitionInsertBefore(GDrawHandle* t, - GDrawHandleState new_state, - GDrawHandle* succ) { - check_lists(t->cache); - assert(t->state != - GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! - assert(t->state != (U32)new_state); // code should never call "transition" - // if it's not transitioning! - // unlink from prev state - t->prev->next = t->next; - t->next->prev = t->prev; - // add to list for new state - t->next = succ; - t->prev = succ->prev; - t->prev->next = t; - t->next->prev = t; -#if defined(SUPERDEBUG) - printf("GD %chandle %p %s->%s\n", t->cache->is_vertex ? 'v' : 't', t, - gdraw_StateName(t->state), gdraw_StateName(new_state)); -#endif - t->state = new_state; - check_lists(t->cache); -} - -static RADINLINE void gdraw_HandleTransitionTo(GDrawHandle* t, - GDrawHandleState new_state) { - gdraw_HandleTransitionInsertBefore(t, new_state, - &t->cache->state[new_state]); -} - -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) -static rrbool gdraw_MigrateResource(GDrawHandle* t, GDrawStats* stats); -static void gdraw_res_free(GDrawHandle* t, GDrawStats* stats); -#endif - -static rrbool gdraw_HandleCacheLockStats(GDrawHandle* t, void* owner, - GDrawStats* stats) { - RR_UNUSED_VARIABLE(stats); - - // if the GPU memory is owned by the user, then we never spontaneously - // free it, and we can always report true. moreover, Iggy doesn't bother - // keeping 'owner' consistent in this case, so we must check this before - // verifying t->owner. - if (t->state == GDRAW_HANDLE_STATE_user_owned) return true; - - // if t->owner has changed, then Iggy is trying to lock an old version - // of this handle from before (the handle has already been recycled to - // point to a new resource) - if (t->owner != owner) return false; - - // otherwise, it's a valid resource and we should lock it until the next - // unlock call - assert(t->state == GDRAW_HANDLE_STATE_live || - t->state == GDRAW_HANDLE_STATE_locked || - t->state == GDRAW_HANDLE_STATE_pinned); - if (t->state == GDRAW_HANDLE_STATE_live) { -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) - // if we defragmented this frame, we can't just make resources live; - // we need to migrate them to their new location. (which might fail - // if we don't have enough memory left in the new pool) - if (t->cache->did_defragment) { - if (!gdraw_MigrateResource(t, stats)) { - gdraw_res_free(t, stats); - return false; - } - } -#endif - gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_locked); - } - return true; -} - -static rrbool gdraw_HandleCacheLock(GDrawHandle* t, void* owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); -} - -static void gdraw_HandleCacheUnlock(GDrawHandle* t) { - assert(t->state == GDRAW_HANDLE_STATE_locked || - t->state == GDRAW_HANDLE_STATE_pinned || - t->state == GDRAW_HANDLE_STATE_user_owned); - if (t->state == GDRAW_HANDLE_STATE_locked) - gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_live); -} - -static void gdraw_HandleCacheUnlockAll(GDrawHandleCache* c) { - GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_locked]; - while (sentinel->next != sentinel) - gdraw_HandleTransitionTo(sentinel->next, GDRAW_HANDLE_STATE_live); -} - -static void gdraw_HandleCacheInit(GDrawHandleCache* c, S32 num_handles, - S32 bytes) { - S32 i; - assert(num_handles > 0); - c->max_handles = num_handles; - c->total_bytes = bytes; - c->bytes_free = c->total_bytes; - c->is_vertex = false; - c->is_thrashing = false; - c->did_defragment = false; - for (i = 0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = - NULL; // should never follow cache link from sentinels! - c->state[i].next = c->state[i].prev = &c->state[i]; -#if defined(GDRAW_MANAGE_MEM) - c->state[i].raw_ptr = NULL; -#endif - c->state[i].fence.value = 0; - c->state[i].bytes = 0; - c->state[i].state = GDRAW_HANDLE_STATE_sentinel; - } - for (i = 0; i < num_handles; ++i) { - c->handle[i].cache = c; - c->handle[i].prev = - (i == 0) ? &c->state[GDRAW_HANDLE_STATE_free] : &c->handle[i - 1]; - c->handle[i].next = (i == num_handles - 1) - ? &c->state[GDRAW_HANDLE_STATE_free] - : &c->handle[i + 1]; - c->handle[i].bytes = 0; - c->handle[i].state = GDRAW_HANDLE_STATE_free; -#if defined(GDRAW_MANAGE_MEM) - c->handle[i].raw_ptr = NULL; -#endif - } - c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; - c->state[GDRAW_HANDLE_STATE_free].prev = &c->handle[num_handles - 1]; - c->prev_frame_start.value = 0; - c->prev_frame_end.value = 0; -#if defined(GDRAW_MANAGE_MEM) - c->alloc = NULL; -#endif -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) - c->alloc_other = NULL; -#endif - check_lists(c); -} - -static GDrawHandle* gdraw_HandleCacheAllocateBegin(GDrawHandleCache* c) { - GDrawHandle* free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle* t = NULL; - if (free_list->next != free_list) { - t = free_list->next; - gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); - t->bytes = 0; - t->owner = 0; -#if defined(GDRAW_MANAGE_MEM) - t->raw_ptr = NULL; -#endif -#if defined(GDRAW_CORRUPTION_CHECK) - t->has_check_value = false; -#endif - } - return t; -} - -static void gdraw_HandleCacheAllocateEnd(GDrawHandle* t, S32 bytes, void* owner, - GDrawHandleState new_state) { - assert(t->cache); - assert(t->bytes == 0); - assert(t->owner == 0); - assert(t->state == GDRAW_HANDLE_STATE_alloc); - if (bytes == 0) - assert(new_state == GDRAW_HANDLE_STATE_user_owned); - else - assert(new_state == GDRAW_HANDLE_STATE_locked || - new_state == GDRAW_HANDLE_STATE_pinned); - t->bytes = bytes; - t->owner = owner; - t->cache->bytes_free -= bytes; - - gdraw_HandleTransitionTo(t, new_state); -} - -static void gdraw_HandleCacheFree(GDrawHandle* t) { - GDrawHandleCache* c = t->cache; - assert(t->state != GDRAW_HANDLE_STATE_alloc && - t->state != GDRAW_HANDLE_STATE_sentinel); - c->bytes_free += t->bytes; - t->bytes = 0; - t->owner = 0; -#if defined(GDRAW_MANAGE_MEM) - t->raw_ptr = 0; -#endif -#if defined(GDRAW_CORRUPTION_CHECK) - t->has_check_value = false; -#endif - gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_free); -} - -static void gdraw_HandleCacheAllocateFail(GDrawHandle* t) { - assert(t->state == GDRAW_HANDLE_STATE_alloc); - gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_free); -} - -static GDrawHandle* gdraw_HandleCacheGetLRU(GDrawHandleCache* c) { - // TransitionTo always inserts at the end, which means that the resources - // at the front of the LRU list are the oldest ones, since in-use resources - // will get appended on every transition from "locked" to "live". - GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; -} - -static void gdraw_HandleCacheTick(GDrawHandleCache* c, GDrawFence now) { - c->prev_frame_start = c->prev_frame_end; - c->prev_frame_end = now; - - // reset these flags every frame - c->is_thrashing = false; - c->did_defragment = false; -} - -#if defined(GDRAW_MANAGE_MEM) - -static void gdraw_HandleCacheInsertDead(GDrawHandle* t) { - GDrawHandle *s, *sentinel; - - assert(t->state == GDRAW_HANDLE_STATE_live || - t->state == GDRAW_HANDLE_STATE_locked || - t->state == GDRAW_HANDLE_STATE_pinned); - - // figure out where t belongs in the dead list in "chronological order" - // do this by finding its (chronological) successor s - sentinel = &t->cache->state[GDRAW_HANDLE_STATE_dead]; - s = sentinel->next; - while (s != sentinel && s->fence.value <= t->fence.value) s = s->next; - - // and then insert it there - gdraw_HandleTransitionInsertBefore(t, GDRAW_HANDLE_STATE_dead, s); -} - -#endif - -//////////////////////////////////////////////////////////////////////// -// -// Set transformation matrices -// - -// Our vertex shaders use this convention: -// world: our world matrices always look like this -// m00 m01 0 t0 -// m10 m11 0 t1 -// 0 0 0 d -// 0 0 0 1 -// -// we just store the first two rows and insert d -// in the first row, third column. our input position vectors are -// always (x,y,0,1) or (x,y,0,0), so we can still just use dp4 to -// compute final x/y. after that it's a single move to set the -// correct depth value. -// -// viewproj: our view-projection matrix is always just a 2D scale+translate, -// i.e. the matrix looks like this: -// -// p[0] 0 0 p[2] -// 0 p[1] 0 p[3] -// 0 0 1 0 -// 0 0 0 1 -// -// just store (p[0],p[1],p[2],p[3]) in a 4-component vector and the -// projection transform is a single multiply-add. -// -// The output is volatile since it's often in Write-Combined memory where we -// really don't want compiler reordering. - -static RADINLINE void gdraw_PixelSpace(volatile F32* RADRESTRICT vvec) { - // 1:1 pixel mapping - just identity since our "view space" is pixels - vvec[0] = 1.0f; - vvec[1] = 0.0f; - vvec[2] = 0.0f; - vvec[3] = 0.0f; - vvec[4] = 0.0f; - vvec[5] = 1.0f; - vvec[6] = 0.0f; - vvec[7] = 0.0f; -} - -static RADINLINE void gdraw_WorldSpace(volatile F32* RADRESTRICT vvec, - F32* RADRESTRICT world_to_pixel, - F32 depth, F32 misc) { - // World->pixel space transform is just a scale - vvec[0] = world_to_pixel[0]; - vvec[1] = 0.0f; - vvec[2] = depth; - vvec[3] = 0.0f; - vvec[4] = 0.0f; - vvec[5] = world_to_pixel[1]; - vvec[6] = misc; - vvec[7] = 0.0f; -} - -static RADINLINE void gdraw_ObjectSpace(volatile F32* RADRESTRICT vvec, - gswf_matrix* RADRESTRICT xform, - F32 depth, F32 misc) { - // Object->pixel transform is a 2D homogeneous matrix transform - F32 m00 = xform->m00; - F32 m01 = xform->m01; - F32 m10 = xform->m10; - F32 m11 = xform->m11; - F32 trans0 = xform->trans[0]; - F32 trans1 = xform->trans[1]; - - vvec[0] = m00; - vvec[1] = m01; - vvec[2] = depth; - vvec[3] = trans0; - vvec[4] = m10; - vvec[5] = m11; - vvec[6] = misc; - vvec[7] = trans1; -} - -static void gdraw_GetObjectSpaceMatrix(F32* RADRESTRICT mat, - gswf_matrix* RADRESTRICT xform, - F32* RADRESTRICT proj, F32 depth, - int out_col_major) { - int row = out_col_major ? 1 : 4; - int col = out_col_major ? 4 : 1; - - F32 xs = proj[0]; - F32 ys = proj[1]; - - mat[0 * row + 0 * col] = xform->m00 * xs; - mat[0 * row + 1 * col] = xform->m01 * xs; - mat[0 * row + 2 * col] = 0.0f; - mat[0 * row + 3 * col] = xform->trans[0] * xs + proj[2]; - - mat[1 * row + 0 * col] = xform->m10 * ys; - mat[1 * row + 1 * col] = xform->m11 * ys; - mat[1 * row + 2 * col] = 0.0f; - mat[1 * row + 3 * col] = xform->trans[1] * ys + proj[3]; - - mat[2 * row + 0 * col] = 0.0f; - mat[2 * row + 1 * col] = 0.0f; - mat[2 * row + 2 * col] = 0.0f; - mat[2 * row + 3 * col] = depth; - - mat[3 * row + 0 * col] = 0.0f; - mat[3 * row + 1 * col] = 0.0f; - mat[3 * row + 2 * col] = 0.0f; - mat[3 * row + 3 * col] = 1.0f; -} - -//////////////////////////////////////////////////////////////////////// -// -// Blurs -// -// symmetrically expand a rectangle by ex/ey pixels on both sides, then clamp to -// tile bounds -static void gdraw_ExpandRect(gswf_recti* out, gswf_recti const* in, S32 ex, - S32 ey, S32 w, S32 h) { - out->x0 = RR_MAX(in->x0 - ex, 0); - out->y0 = RR_MAX(in->y0 - ey, 0); - out->x1 = RR_MIN(in->x1 + ex, w); - out->y1 = RR_MIN(in->y1 + ey, h); -} - -static void gdraw_ShiftRect(gswf_recti* out, gswf_recti const* in, S32 dx, - S32 dy) { - out->x0 = in->x0 + dx; - out->y0 = in->y0 + dy; - out->x1 = in->x1 + dx; - out->y1 = in->y1 + dy; -} - -#define MAX_TAPS 9 // max # of bilinear samples in one 'convolution' step - -enum { - // basic shader family - VAR_tex0 = 0, - VAR_tex1, - VAR_cmul, - VAR_cadd, - VAR_focal, - - // filter family - VAR_filter_tex0 = 0, - VAR_filter_tex1, - VAR_filter_color, - VAR_filter_tc_off, - VAR_filter_tex2, - VAR_filter_clamp0, - VAR_filter_clamp1, - VAR_filter_color2, - MAX_VARS, - - // blur family - VAR_blur_tex0 = 0, - VAR_blur_tap, - VAR_blur_clampv, - - // color matrix family - VAR_colormatrix_tex0 = 0, - VAR_colormatrix_data, - - // ihud family - VAR_ihudv_worldview = 0, - VAR_ihudv_material, - VAR_ihudv_textmode, -}; - -typedef struct { - S32 w, h, frametex_width, frametex_height; - void (*BlurPass)(GDrawRenderState* r, int taps, float* data, gswf_recti* s, - float* tc, float height_max, float* clampv, - GDrawStats* gstats); -} GDrawBlurInfo; - -static GDrawTexture* gdraw_BlurPass(GDrawFunctions* g, GDrawBlurInfo* c, - GDrawRenderState* r, int taps, float* data, - gswf_recti* draw_bounds, - gswf_recti* sample_bounds, - GDrawStats* gstats) { - F32 tc[4]; - F32 clamp[4]; - F32 t = 0; - F32 texel_scale_s = 1.0f / c->frametex_width; - F32 texel_scale_t = 1.0f / c->frametex_height; - S32 i; - for (i = 0; i < taps; ++i) t += data[4 * i + 2]; - assert(t >= 0.99f && t <= 1.01f); - - tc[0] = texel_scale_s * draw_bounds->x0; - tc[1] = texel_scale_t * draw_bounds->y0; - tc[2] = texel_scale_s * draw_bounds->x1; - tc[3] = texel_scale_t * draw_bounds->y1; - - // sample_bounds is (x0,y0) inclusive, (x1,y1) exclusive - // texel centers are offset by 0.5 from integer coordinates and we don't - // want to sample outside sample_bounds - clamp[0] = texel_scale_s * (sample_bounds->x0 + 0.5f); - clamp[1] = texel_scale_t * (sample_bounds->y0 + 0.5f); - clamp[2] = texel_scale_s * (sample_bounds->x1 - 0.5f); - clamp[3] = texel_scale_t * (sample_bounds->y1 - 0.5f); - - if (!g->TextureDrawBufferBegin( - draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - 0, gstats)) - return r->tex[0]; - - c->BlurPass(r, taps, data, draw_bounds, tc, (F32)c->h / c->frametex_height, - clamp, gstats); - return g->TextureDrawBufferEnd(gstats); -} - -static GDrawTexture* gdraw_BlurPassDownsample( - GDrawFunctions* g, GDrawBlurInfo* c, GDrawRenderState* r, int taps, - float* data, gswf_recti* draw_bounds, int axis, int divisor, int tex_w, - int tex_h, gswf_recti* sample_bounds, GDrawStats* gstats) { - S32 i; - F32 t = 0; - F32 tc[4]; - F32 clamp[4]; - F32 texel_scale_s = 1.0f / tex_w; - F32 texel_scale_t = 1.0f / tex_h; - gswf_recti z; - - for (i = 0; i < taps; ++i) t += data[4 * i + 2]; - assert(t >= 0.99f && t <= 1.01f); - - // following must be integer divides! - if (axis == 0) { - z.x0 = draw_bounds->x0 / divisor; - z.x1 = (draw_bounds->x1 - 1) / divisor + 1; - z.y0 = draw_bounds->y0; - z.y1 = draw_bounds->y1; - - tc[0] = ((z.x0 - 0.5f) * divisor + 0.5f) * texel_scale_s; - tc[2] = ((z.x1 - 0.5f) * divisor + 0.5f) * texel_scale_s; - tc[1] = z.y0 * texel_scale_t; - tc[3] = z.y1 * texel_scale_t; - } else { - z.x0 = draw_bounds->x0; - z.x1 = draw_bounds->x1; - z.y0 = draw_bounds->y0 / divisor; - z.y1 = (draw_bounds->y1 - 1) / divisor + 1; - - tc[0] = z.x0 * texel_scale_s; - tc[2] = z.x1 * texel_scale_s; - tc[1] = ((z.y0 - 0.5f) * divisor + 0.5f) * texel_scale_t; - tc[3] = ((z.y1 - 0.5f) * divisor + 0.5f) * texel_scale_t; - } - - if (!g->TextureDrawBufferBegin( - &z, GDRAW_TEXTURE_FORMAT_rgba32, - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | - GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, - 0, gstats)) - return r->tex[0]; - - clamp[0] = texel_scale_s * (sample_bounds->x0 + 0.5f); - clamp[1] = texel_scale_t * (sample_bounds->y0 + 0.5f); - clamp[2] = texel_scale_s * (sample_bounds->x1 - 0.5f); - clamp[3] = texel_scale_t * (sample_bounds->y1 - 0.5f); - - assert(clamp[0] <= clamp[2]); - assert(clamp[1] <= clamp[3]); - - c->BlurPass(r, taps, data, &z, tc, (F32)c->h / c->frametex_height, clamp, - gstats); - return g->TextureDrawBufferEnd(gstats); -} - -#define unmap(t, a, b) (((t) - (a)) / (F32)((b) - (a))) -#define linear_remap(t, a, b, c, d) ((c) + unmap(t, a, b) * ((d) - (c))) - -static void gdraw_BlurAxis(S32 axis, GDrawFunctions* g, GDrawBlurInfo* c, - GDrawRenderState* r, F32 blur_width, F32 texel, - gswf_recti* draw_bounds, gswf_recti* sample_bounds, - GDrawTexture* protect, GDrawStats* gstats) { - GDrawTexture* t; - F32 data[MAX_TAPS][4]; - S32 off_axis = 1 - axis; - S32 w = ((S32)ceil((blur_width - 1) / 2)) * 2 + - 1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 - F32 edge_weight = - 1 - (w - blur_width) / 2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 - F32 inverse_weight = 1.0f / blur_width; - - w = ((w - 1) >> 1) + - 1; // 3 => 2, 5 => 3, 7 => 4 (number of texture samples) - - if (!r->tex[0]) return; - - // horizontal filter - if (w > 1) { - if (w <= MAX_TAPS) { - // we have enough taps to just do it - // use 'w' taps - S32 i, expand; - - // just go through and place all the taps in the right place - - // if w is 2 (sample from -1,0,1) - // 0 => -0.5 - // 1 => 1 - - // if w is 3: - // 0 => -1.5 samples from -2,-1 - // 1 => 0.5 samples from 0,1 - // 2 => 2 samples from 2 - - // if w is 4: - // 0 => -2.5 samples from -3,-2 - // 1 => -0.5 samples from -1,0 - // 2 => 1.5 samples from 1,2 - // 3 => 3 samples from 3 - - for (i = 0; i < w; ++i) { - // first texsample samples from -w+1 and -w+2, e.g. w=2 => - // -1,0,1 - data[i][axis] = (-w + 1.5f + i * 2) * texel; - data[i][off_axis] = 0; - data[i][2] = 2 * inverse_weight; // 2 full-weight samples - data[i][3] = 0; - } - // now reweight the last one - data[i - 1][axis] = (w - 1) * texel; - data[i - 1][2] = edge_weight * inverse_weight; - // now reweight the first one - // (ew*0 + 1*1)/(1+ew) = 1/(1+ew) - data[0][axis] = (-w + 1.0f + 1 / (edge_weight + 1)) * texel; - data[0][2] = (edge_weight + 1) * inverse_weight; - - expand = w - 1; - gdraw_ExpandRect(draw_bounds, draw_bounds, axis ? 0 : expand, - axis ? expand : 0, c->w, c->h); - - t = gdraw_BlurPass(g, c, r, w, data[0], draw_bounds, sample_bounds, - gstats); - if (r->tex[0] != protect && r->tex[0] != t) - g->FreeTexture(r->tex[0], 0, gstats); - r->tex[0] = t; - gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, - c->h); // for next pass - } else { - // @OPTIMIZE: for symmetrical blurs we can get a 2-wide blur in the - // *off* axis at the same time we get N-wide in the on axis, which - // could double our max width - S32 i, expand; - // @HACK: this is really a dumb way to do it, i kind of had a brain - // fart, you could get the exact same result by just doing the - // downsample the naive way and then the final sample uses texture - // samples spaced by a texel rather than spaced by two texels -- the - // current method is just as inefficient, it just puts the - // inefficiency in the way the downsampled texture is - // self-overlapping, so the downsampled texture is twice as larger - // as it should be. - - // we COULD be exact by generating a mipmap, then sampling some - // number of samples from the mipmap and some from the original, but - // that would require being polyphase. instead we just are - // approximate. the mipmap weights the edge pixels by one half and - // overlaps them by one sample, so then in phase two we sample N - // slightly-overlapping mipmap samples - // - // instead we do the following. - // divide the source data up into clusters that are K samples - // long. - // ...K0... ...K1... ...K2... ...K3... - // - // Suppose K[i] is the average of all the items in cluster i. - // - // We compute a downsampled texture where T[i] = K[i] + K[i+1]. - // - // Now, we sample N taps from adjacent elements of T, allowing the - // texture unit to bilerp. Suppose a given sample falls at - // coordinate i with sub-position p. Then tap #j will compute: - // T[i+j]*(1-p) + T[i+j+1]*p - // But tap #j+1 will compute: - // T[i+j+1]*(1-p) + T[i+j+2]*p - // so we end up computing: - // sum(T[i+j]) except for the end samples. - // - // So, how do we create these initial clusters? That's easy, we use - // K taps to sample 2K texels. - // - // What value of k do we use? Well, we're constrained to using - // MAX_TAPS on each pass. So at the high end, we're bounded by: - // K = MAX_TAPS - // S = MAX_TAPS (S is number of samples in second pass) - // S addresses S*2-1 texels of T, and each texel adds K more - // samples, so (ignoring the edges) we basically have w = K*S - - // if w == MAX_TAPS*MAX_TAPS, then k = MAX_TAPS - // if w == MAX_TAPS+1, then k = 2 - // - // suppose we have 3 taps, then we can sample 5 samples in one pass, - // so then our max coverage is 25 samples, or a filter width of 13. - // with 7 taps, we sample 13 samples in one pass, max coverage is - // 13*13 samples or (13*13-1)/2 width, which is ((2T-1)*(2T-1)-1)/2 - // or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) - S32 w_mip = (S32)ceil(linear_remap( - w, MAX_TAPS + 1, MAX_TAPS * MAX_TAPS, 2, MAX_TAPS)); - S32 downsample = w_mip; - F32 sample_spacing = texel; - if (downsample < 2) downsample = 2; - if (w_mip > MAX_TAPS) { - // if w_mip > MAX_TAPS, then we ought to use more than one - // mipmap pass, but since that's a huge filter ( > 80 pixels) - // let's just try subsampling and see if it's good enough. - sample_spacing *= w_mip / MAX_TAPS; - w_mip = MAX_TAPS; - } else { - assert(w / downsample <= MAX_TAPS); - } - inverse_weight = 1.0f / (2 * w_mip); - for (i = 0; i < w_mip; ++i) { - data[i][axis] = (-w_mip + 1 + i * 2 + 0.5f) * sample_spacing; - data[i][off_axis] = 0; - data[i][2] = 2 * inverse_weight; - data[i][3] = 0; - } - w = w * 2 / w_mip; - - // @TODO: compute the correct bboxes for this size - // the downsampled texture samples from -w_mip+1 to w_mip - // the sample from within that samples w spots within that, - // or w/2 of those, but they're overlapping by 50%. - // so if a sample is a point i, it samples from the original - // from -w_mip+1 to w_mip + i*w_mip. - // So then the minimum is: -w_mip+1 + (w/2)*w_mip, and - // the maximum is w_mip + (w/2)*w_mip - expand = (((w + 1) >> 1) + 1) * w_mip + 1; - gdraw_ExpandRect(draw_bounds, draw_bounds, axis ? 0 : expand, - axis ? expand : 0, c->w, c->h); - - t = gdraw_BlurPassDownsample( - g, c, r, w_mip, data[0], draw_bounds, axis, downsample, - c->frametex_width, c->frametex_height, sample_bounds, gstats); - if (r->tex[0] != protect && r->tex[0] != t) - g->FreeTexture(r->tex[0], 0, gstats); - r->tex[0] = t; - gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, c->h); - if (!r->tex[0]) return; - - // now do a regular blur pass sampling from that - // the raw texture now contains 'downsample' samples per texel - if (w > 2 * MAX_TAPS) { - sample_spacing = texel * (w - 1) / (2 * MAX_TAPS - 1); - w = 2 * MAX_TAPS; - } else { - sample_spacing = texel; - } - // sample_spacing *= 1.0f/2; - assert(w >= 2 && w <= 2 * MAX_TAPS); - - if (w & 1) { - // we just want to evenly weight even-spaced samples - inverse_weight = 1.0f / w; - - // just go through and place all the taps in the right place - - w = (w + 1) >> 1; - for (i = 0; i < w; ++i) { - data[i][axis] = (-w + 1.0f + 0.5f + i * 2) * sample_spacing; - data[i][off_axis] = 0; - data[i][2] = 2 * inverse_weight; // 2 full-weight samples - data[i][3] = 0; - } - - // fix up the last tap - - // the following test is always true, but we're testing it here - // explicitly so as to make VS2012's static analyzer not - // complain - if (i > 0) { - data[i - 1][axis] = - (-w + 1.0f + (i - 1) * 2) * sample_spacing; - data[i - 1][2] = inverse_weight; - } - } else { - // we just want to evenly weight even-spaced samples - inverse_weight = 1.0f / w; - - // just go through and place all the taps in the right place - w >>= 1; - for (i = 0; i < w; ++i) { - data[i][axis] = (-w + 1.0f + i * 2) * sample_spacing; - data[i][off_axis] = 0; - data[i][2] = 2 * inverse_weight; // 2 full-weight samples - data[i][3] = 0; - } - } - - t = gdraw_BlurPassDownsample( - g, c, r, w, data[0], draw_bounds, axis, 1, - axis == 0 ? c->frametex_width * downsample : c->frametex_width, - axis == 1 ? c->frametex_height * downsample - : c->frametex_height, - sample_bounds, gstats); - if (r->tex[0] != protect && r->tex[0] != t) - g->FreeTexture(r->tex[0], 0, gstats); - r->tex[0] = t; - gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, c->h); - } - } -} - -static void gdraw_Blur(GDrawFunctions* g, GDrawBlurInfo* c, GDrawRenderState* r, - gswf_recti* draw_bounds, gswf_recti* sample_bounds, - GDrawStats* gstats) { - S32 p; - GDrawTexture* protect = r->tex[0]; - gswf_recti sbounds; - - // compute texel offset size - F32 dx = 1.0f / c->frametex_width; - F32 dy = 1.0f / c->frametex_height; - - // blur = 1 => 1 tap - // blur = 1.2 => 3 taps (0.1, 1, 0.1) - // blur = 2.2 => 3 taps (0.6, 1, 0.6) - // blur = 2.8 => 3 taps (0.9, 1, 0.9) - // blur = 3 => 3 taps (1 , 1, 1 ) - // blur = 3.2 => 5 taps (0.1, 1, 1, 1, 0.1) - - // S32 w = ((S32) ceil((r->blur_x-1)/2))*2+1; // 1.2 => (1.2-1)/2 => 0.1 - // => 1.0 => 1 => 2 => 3 S32 h = ((S32) ceil((r->blur_y-1)/2))*2+1; // 3 - // => (3-1)/2 => 1.0 => 1 => 2 => 3 - - // gdraw puts 1 border pixel around everything when producing rendertargets - // and we use this so expand the input sample bounds accordingly - gdraw_ExpandRect(&sbounds, sample_bounds, 1, 1, c->w, c->h); - - for (p = 0; p < r->blur_passes; ++p) { - { - // do the filter separably - gdraw_BlurAxis(0, g, c, r, r->blur_x, dx, draw_bounds, &sbounds, - protect, gstats); - gdraw_BlurAxis(1, g, c, r, r->blur_y, dy, draw_bounds, &sbounds, - protect, gstats); - } - } -} - -#if defined(GDRAW_MANAGE_MEM) - -static void make_pool_aligned(void** start, S32* num_bytes, U32 alignment) { - UINTa addr_orig = (UINTa)*start; - UINTa addr_aligned = (addr_orig + alignment - 1) & ~((UINTa)alignment - 1); - - if (addr_aligned != addr_orig) { - S32 diff = (S32)(addr_aligned - addr_orig); - if (*num_bytes < diff) { - *start = NULL; - *num_bytes = 0; - return; - } else { - *start = (void*)addr_aligned; - *num_bytes -= diff; - } - } -} - -// Very simple arena allocator -typedef struct { - U8* begin; - U8* current; - U8* end; -} GDrawArena; - -static void gdraw_arena_init(GDrawArena* arena, void* start, U32 size) { - arena->begin = (U8*)start; - arena->current = (U8*)start; - arena->end = (U8*)start + size; -} - -static GDRAW_MAYBE_UNUSED void gdraw_arena_reset(GDrawArena* arena) { - arena->current = arena->begin; -} - -static void* gdraw_arena_alloc(GDrawArena* arena, U32 size, U32 align) { - UINTa start_addr = - ((UINTa)arena->current + align - 1) & ~((UINTa)align - 1); - U8* ptr = (U8*)start_addr; - UINTa remaining = arena->end - arena->current; - UINTa total_size = (ptr - arena->current) + size; - if (remaining < total_size) // doesn't fit - return NULL; - - arena->current = ptr + size; - return ptr; -} - -// Allocator for graphics memory. -// Graphics memory is assumed to be write-combined and slow to read for the -// CPU, so we keep all heap management information separately in main memory. -// -// There's a constant management of about 1k (2k for 64bit) to create a heap, -// plus a per-block overhead. The maximum number of blocks the allocator can -// ever use is bounded by 2*max_allocs+1; since GDraw manages a limited -// amount of handles, max_allocs is a known value at heap creation time. -// -// The allocator uses a best-fit heuristic to minimize fragmentation. -// Currently, there are no size classes or other auxiliary data structures to -// speed up this process, since the number of free blocks at any point in time -// is assumed to be fairly low. -// -// The allocator maintains a number of invariants: -// - The free list and physical block list are proper double-linked lists. -// (i.e. block->next->prev == block->prev->next == block) -// - All allocated blocks are also kept in a hash table, indexed by their -// pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash -// bucket. -// - The physical block list is ordered. It always contains all currently -// active blocks and spans the whole managed memory range. There are no -// gaps between blocks, and all blocks have nonzero size. -// - There are no two adjacent free blocks; if two such blocks would be created, -// they are coalesced immediately. -// - The maximum number of blocks that could ever be necessary is allocated -// on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either -// in the physical block list or the unused list, and the total number of -// blocks is constant. -// These invariants always hold before and after an allocation/free. - -#if !defined(GFXALLOC_ASSERT) -#define GFXALLOC_ASSERT(x) -#endif - -typedef struct gfx_block_info { - U8* ptr; - gfx_block_info *prev, - *next; // for free blocks this is the free list, for allocated blocks - // it's a (single-linked!) list of elements in the corresponding - // hash bucket - gfx_block_info *prev_phys, *next_phys; - U32 is_free : 1; - U32 is_unused : 1; - U32 size : 30; -} gfx_block_info; -// 24 bytes/block on 32bit, 48 bytes/block on 64bit. - -#define GFXALLOC_HASH_SIZE 256 - -typedef struct gfx_allocator { - U8* mem_base; - U8* mem_end; - U32 max_allocs; - U32 block_align; - U32 block_shift; - S32 actual_bytes_free; - -#if defined(GFXALLOC_CHECK) - int num_blocks; - int num_unused; - int num_alloc; - int num_free; -#endif - - GDrawHandleCache* cache; - - gfx_block_info* unused_list; // next unused block_info (single-linked list) - gfx_block_info* hash[GFXALLOC_HASH_SIZE]; // allocated blocks - gfx_block_info blocks[1]; // first block is head of free list AND head of - // physical block list (sentinel) -} gfx_allocator; -// about 1k (32bit), 2k (64bit) with 256 hash buckets (the default). dominated -// by hash table. - -#if defined(GFXALLOC_CHECK) -#define GFXALLOC_IF_CHECK(x) x -#else -#define GFXALLOC_IF_CHECK(x) -#endif - -static U32 gfxalloc_get_hash_code(gfx_allocator* alloc, void* ptr) { - U32 a = (U32)(((U8*)ptr - alloc->mem_base) >> alloc->block_shift); - - // integer hash function by Bob Jenkins - // (http://burtleburtle.net/bob/hash/integer.html) I use this function - // because integer mults are slow on PPC and large literal constants take - // multiple instrs to set up on all RISC CPUs. - a -= (a << 6); - a ^= (a >> 17); - a -= (a << 9); - a ^= (a << 4); - a -= (a << 3); - a ^= (a << 10); - a ^= (a >> 15); - - return a & (GFXALLOC_HASH_SIZE - 1); -} - -#if defined(SUPERDEBUG) || defined(COMPLETE_DEBUG) -#include -#define MAX_REGIONS 8192 -typedef struct { - U32 begin, end; -} gfx_region; -static gfx_region region[MAX_REGIONS]; - -static int region_sort(const void* p, const void* q) { - U32 a = *(U32*)p; - U32 b = *(U32*)q; - if (a < b) return -1; - if (a > b) return 1; - return 0; -} - -static void gfxalloc_check1(gfx_allocator* alloc) { - assert(alloc->max_allocs * 2 + 1 < MAX_REGIONS); - int i, n = 0; - for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { - gfx_block_info* b = alloc->hash[i]; - while (b) { - region[n].begin = (UINTa)b->ptr; - region[n].end = region[n].begin + b->size; - ++n; - b = b->next; - } - } - gfx_block_info* b = alloc->blocks[0].next; - while (b != &alloc->blocks[0]) { - region[n].begin = (UINTa)b->ptr; - region[n].end = region[n].begin + b->size; - ++n; - b = b->next; - } - qsort(region, n, sizeof(region[0]), region_sort); - for (i = 0; i + 1 < n; ++i) { - assert(region[i].end == region[i + 1].begin); - } -} -#else -#define gfxalloc_check1(a) -#endif - -#if defined(COMPLETE_DEBUG) -static void verify_against_blocks(int num_regions, void* vptr, S32 len) { - U32* ptr = (U32*)vptr; - // binary search for ptr amongst regions - S32 s = 0, e = num_regions - 1; - assert(len != 0); - while (s < e) { - S32 i = (s + e + 1) >> 1; - // invariant: b[s] <= ptr <= b[e] - if (region[i].begin <= (UINTa)ptr) - s = i; - else - e = i - 1; - - // consider cases: - // s=0,e=1: i = 0, how do we get i to be 1? - } - // at this point, s >= e - assert(s < num_regions && region[s].begin == (UINTa)ptr && - (UINTa)ptr + len <= region[s].end); -} - -static void debug_complete_check(gfx_allocator* alloc, void* ptr, S32 len, - void* skip) { - GDrawHandleCache* c = alloc->cache; - assert(alloc->max_allocs * 2 + 1 < MAX_REGIONS); - int i, n = 0; - for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { - gfx_block_info* b = alloc->hash[i]; - while (b) { - region[n].begin = (UINTa)b->ptr; - region[n].end = region[n].begin + b->size; - ++n; - b = b->next; - } - } - gfx_block_info* b = alloc->blocks[0].next; - while (b != &alloc->blocks[0]) { - region[n].begin = (UINTa)b->ptr; - region[n].end = region[n].begin + b->size; - ++n; - b = b->next; - } - for (i = 0; i < n; ++i) assert(region[i].end > region[i].begin); - qsort(region, n, sizeof(region[0]), region_sort); - for (i = 0; i + 1 < n; ++i) { - assert(region[i].end == region[i + 1].begin); - } - - if (ptr) verify_against_blocks(n, ptr, len); - - if (c) { - GDrawHandle* t = c->head; - while (t) { - if (t->raw_ptr && t->raw_ptr != skip) - verify_against_blocks(n, t->raw_ptr, t->bytes); - t = t->next; - } - t = c->active; - while (t) { - if (t->raw_ptr && t->raw_ptr != skip) - verify_against_blocks(n, t->raw_ptr, t->bytes); - t = t->next; - } - } -} -#else -#define debug_complete_check(a, p, len, s) -#endif - -#if defined(GFXALLOC_CHECK) -static void gfxalloc_check2(gfx_allocator* alloc) { - int n = 0; - gfx_block_info* b = alloc->unused_list; - while (b) { - ++n; - b = b->next; - } - GFXALLOC_ASSERT(n == alloc->num_unused); - b = alloc->blocks->next; - n = 0; - while (b != alloc->blocks) { - ++n; - b = b->next; - } - GFXALLOC_ASSERT(n == alloc->num_free); - GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_unused + alloc->num_free + alloc->num_alloc); -} -#define gfxalloc_check(a) \ - do { \ - gfxalloc_check1(a); \ - gfxalloc_check2(a); \ - } while (0) -#else -#define gfxalloc_check2(a) -#define gfxalloc_check(a) -#endif - -static gfx_block_info* gfxalloc_pop_unused(gfx_allocator* alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); - GFXALLOC_ASSERT(alloc->unused_list->is_unused); - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) - - gfx_block_info* b = alloc->unused_list; - alloc->unused_list = b->next; - GFXALLOC_ASSERT(alloc->unused_list); - b->is_unused = 0; - GFXALLOC_IF_CHECK(--alloc->num_unused;) - return b; -} - -static void gfxalloc_push_unused(gfx_allocator* alloc, gfx_block_info* b) { - GFXALLOC_ASSERT(!b->is_unused); - b->is_unused = 1; - b->next = alloc->unused_list; - alloc->unused_list = b; - GFXALLOC_IF_CHECK(++alloc->num_unused); -} - -static void gfxalloc_add_free(gfx_allocator* alloc, gfx_block_info* b) { - gfx_block_info* head = alloc->blocks; - - b->is_free = 1; - b->next = head->next; - b->prev = head; - head->next->prev = b; - head->next = b; - GFXALLOC_IF_CHECK(++alloc->num_free;) -} - -static void gfxalloc_rem_free(gfx_allocator* alloc, gfx_block_info* b) { - RR_UNUSED_VARIABLE(alloc); - b->is_free = 0; - b->prev->next = b->next; - b->next->prev = b->prev; - GFXALLOC_IF_CHECK(--alloc->num_free;) -} - -static void gfxalloc_split_free(gfx_allocator* alloc, gfx_block_info* b, - U32 pos) { - gfx_block_info* n = gfxalloc_pop_unused(alloc); - - GFXALLOC_ASSERT(b->is_free); - GFXALLOC_ASSERT(pos > 0 && pos < b->size); - - // set up new free block - n->ptr = b->ptr + pos; - n->prev_phys = b; - n->next_phys = b->next_phys; - n->next_phys->prev_phys = n; - n->size = b->size - pos; - assert(n->size != 0); - gfxalloc_add_free(alloc, n); - - // fix original block - b->next_phys = n; - b->size = pos; - assert(b->size != 0); - - debug_complete_check(alloc, n->ptr, n->size, 0); - debug_complete_check(alloc, b->ptr, b->size, 0); -} - -static gfx_allocator* gfxalloc_create(void* mem, U32 mem_size, U32 align, - U32 max_allocs) { - gfx_allocator* a; - U32 i, max_blocks, size; - - if (!align || - (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; - - // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst - // case: [free][used][free] .... [free][used][free] - max_blocks = max_allocs * 2 + 1; - size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); - a = (gfx_allocator*)IggyGDrawMalloc(size); - if (!a) return NULL; - - memset(a, 0, size); - - GFXALLOC_IF_CHECK(a->num_blocks = max_blocks;) - GFXALLOC_IF_CHECK(a->num_alloc = 0;) - GFXALLOC_IF_CHECK(a->num_free = 1;) - GFXALLOC_IF_CHECK(a->num_unused = max_blocks - 1;) - - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(a->num_blocks == - a->num_alloc + a->num_free + a->num_unused);) - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(a->num_free <= a->num_blocks + 1);) - - a->actual_bytes_free = mem_size; - a->mem_base = (U8*)mem; - a->mem_end = a->mem_base + mem_size; - a->max_allocs = max_allocs; - a->block_align = align; - a->block_shift = 0; - while ((1u << a->block_shift) < a->block_align) a->block_shift++; - - // init sentinel block - a->blocks[0].prev = a->blocks[0].next = - &a->blocks[1]; // point to free block - a->blocks[0].prev_phys = a->blocks[0].next_phys = &a->blocks[1]; // same - - // init first free block - a->blocks[1].ptr = a->mem_base; - a->blocks[1].prev = a->blocks[1].next = &a->blocks[0]; - a->blocks[1].prev_phys = a->blocks[1].next_phys = &a->blocks[0]; - a->blocks[1].is_free = 1; - a->blocks[1].size = mem_size; - - // init "unused" list - a->unused_list = a->blocks + 2; - for (i = 2; i < max_blocks; i++) { - a->blocks[i].is_unused = 1; - a->blocks[i].next = a->blocks + (i + 1); - } - a->blocks[i].is_unused = 1; - - gfxalloc_check(a); - debug_complete_check(a, NULL, 0, 0); - return a; -} - -static void* gfxalloc_alloc(gfx_allocator* alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; - U32 i, best_wasted = ~0u; - U32 size = size_in_bytes; - debug_complete_check(alloc, NULL, 0, 0); - gfxalloc_check(alloc); - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) - - // round up to multiple of our block alignment - size = (size + alloc->block_align - 1) & ~(alloc->block_align - 1); - assert(size >= size_in_bytes); - assert(size != 0); - - // find best fit among all free blocks. this is O(N)! - for (cur = alloc->blocks[0].next; cur != alloc->blocks; cur = cur->next) { - if (cur->size >= size) { - U32 wasted = cur->size - size; - if (wasted < best_wasted) { - best_wasted = wasted; - best = cur; - if (!wasted) break; // can't get better than perfect - } - } - } - - // return the best fit, if we found any suitable block - if (best) { - debug_check_overlap(alloc->cache, best->ptr, best->size); - // split off allocated part - if (size != best->size) gfxalloc_split_free(alloc, best, size); - debug_complete_check(alloc, best->ptr, best->size, 0); - - // remove from free list and add to allocated hash table - GFXALLOC_ASSERT(best->size == size); - gfxalloc_rem_free(alloc, best); - - i = gfxalloc_get_hash_code(alloc, best->ptr); - best->next = alloc->hash[i]; - alloc->hash[i] = best; - alloc->actual_bytes_free -= size; - GFXALLOC_ASSERT(alloc->actual_bytes_free >= 0); - - GFXALLOC_IF_CHECK(++alloc->num_alloc;) - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) - - debug_complete_check(alloc, best->ptr, best->size, 0); - gfxalloc_check(alloc); - debug_check_overlap(alloc->cache, best->ptr, best->size); - return best->ptr; - } else - return NULL; // not enough space! -} - -static void gfxalloc_free(gfx_allocator* alloc, void* ptr) { - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) - - // find the block in the hash table - gfx_block_info *b, *t, **prevnext; - U32 i = gfxalloc_get_hash_code(alloc, ptr); - - prevnext = &alloc->hash[i]; - b = alloc->hash[i]; - - while (b) { - if (b->ptr == ptr) break; - prevnext = &b->next; - b = b->next; - } - - if (!b) { - GFXALLOC_ASSERT(0); // trying to free a non-allocated block - return; - } - - debug_complete_check(alloc, b->ptr, b->size, 0); - GFXALLOC_IF_CHECK(--alloc->num_alloc;) - - // remove it from the hash table - *prevnext = b->next; - - alloc->actual_bytes_free += b->size; - - // merge with previous block if it's free, else add it to free list - t = b->prev_phys; - if (t->is_free) { - t->size += b->size; - t->next_phys = b->next_phys; - t->next_phys->prev_phys = t; - gfxalloc_push_unused(alloc, b); - b = t; - } else - gfxalloc_add_free(alloc, b); - - // try to merge with next block - t = b->next_phys; - if (t->is_free) { - b->size += t->size; - b->next_phys = t->next_phys; - t->next_phys->prev_phys = b; - gfxalloc_rem_free(alloc, t); - gfxalloc_push_unused(alloc, t); - } - debug_complete_check(alloc, 0, 0, ptr); - gfxalloc_check(alloc); - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) -} - -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) - -static rrbool gfxalloc_is_empty(gfx_allocator* alloc) { - gfx_block_info* first_free = alloc->blocks[0].next; - - // we want to check whether there's exactly one free block that - // covers the entire pool. - if (first_free == alloc->blocks) // 0 free blocks - return false; - - if (first_free->next != alloc->blocks) // >1 free block - return false; - - return first_free->ptr == alloc->mem_base && - first_free->ptr + first_free->size == alloc->mem_end; -} - -static rrbool gfxalloc_mem_contains(gfx_allocator* alloc, void* ptr) { - return alloc->mem_base <= (U8*)ptr && (U8*)ptr < alloc->mem_end; -} - -#endif - -#if defined(GDRAW_DEBUG) - -static void gfxalloc_dump(gfx_allocator* alloc) { - static const char* type[] = { - "allocated", - "free", - }; - - for (gfx_block_info* b = alloc->blocks[0].next_phys; b != alloc->blocks; - b = b->next_phys) { - U8* start = b->ptr; - U8* end = b->ptr + b->size; - printf("%p-%p: %s (%d bytes)\n", start, end, type[b->is_free], b->size); - } -} - -#endif - -#endif - -#if defined(GDRAW_DEFRAGMENT) - -#define GDRAW_DEFRAGMENT_may_overlap \ - 1 // self-overlap for individual copies is OK - -// Defragmentation code for graphics memory. -// The platform implementation must provide a GPU memcpy function and handle all -// necessary synchronization. It must also adjust its resource descriptors to -// match the new addresses after defragmentation. - -static void gdraw_gpu_memcpy(GDrawHandleCache* c, void* dst, void* src, - U32 num_bytes); - -static void gdraw_Defragment_memmove(GDrawHandleCache* c, U8* dst, U8* src, - U32 num_bytes, U32 flags, - GDrawStats* stats) { - if (dst == src) return; - - assert(num_bytes != 0); - - stats->nonzero_flags |= GDRAW_STATS_defrag; - stats->defrag_objects += 1; - stats->defrag_bytes += num_bytes; - - if ((flags & GDRAW_DEFRAGMENT_may_overlap) || dst + num_bytes <= src || - src + num_bytes <= dst) // no problematic overlap - gdraw_gpu_memcpy(c, dst, src, num_bytes); - else { - // need to copy in multiple chunks - U32 chunk_size, pos = 0; - if (dst < src) - chunk_size = (U32)(src - dst); - else - chunk_size = (U32)(dst - src); - - while (pos < num_bytes) { - U32 amount = num_bytes - pos; - if (amount > chunk_size) amount = chunk_size; - gdraw_gpu_memcpy(c, dst + pos, src + pos, amount); - pos += amount; - } - } -} - -static rrbool gdraw_CanDefragment(GDrawHandleCache* c) { - // we can defragment (and extract some gain from it) if and only if there's - // more than one free block. since gfxalloc coalesces free blocks - // immediately and keeps them in a circular linked list, this is very easy - // to detect: just check if the "next" pointer of the first free block - // points to the sentinel. (this is only the case if there are 0 or 1 free - // blocks) - gfx_allocator* alloc = c->alloc; - return alloc->blocks[0].next->next != alloc->blocks; -} - -static void gdraw_DefragmentMain(GDrawHandleCache* c, U32 flags, - GDrawStats* stats) { - gfx_allocator* alloc = c->alloc; - gfx_block_info *b, *n; - U8* p; - S32 i; - - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) - - // go over all allocated memory blocks and clear the "prev" pointer - // (unused for allocated blocks, we'll use it to store a back-pointer to the - // corresponding handle) - for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b = b->next_phys) - if (!b->is_free) b->prev = NULL; - - // go through all handles and store a pointer to the handle in the - // corresponding memory block - for (i = 0; i < c->max_handles; i++) - if (c->handle[i].raw_ptr) { - assert(c->handle[i].bytes != 0); - for (b = alloc->hash[gfxalloc_get_hash_code(alloc, - c->handle[i].raw_ptr)]; - b; b = b->next) - if (b->ptr == c->handle[i].raw_ptr) { - void* block = &c->handle[i]; - b->prev = (gfx_block_info*)block; - break; - } - - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! - } - - // clear alloc hash table (we rebuild it during defrag) - memset(alloc->hash, 0, sizeof(alloc->hash)); - - // defragmentation proper: go over all blocks again, remove all free blocks - // from the physical block list and compact the remaining blocks together. - p = alloc->mem_base; - for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b = n) { - n = b->next_phys; - - if (!b->is_free) { - U32 h; - - // move block if necessary - if (p != b->ptr) { - assert(b->size != 0); - gdraw_Defragment_memmove(c, p, b->ptr, b->size, flags, stats); - b->ptr = p; - assert(b->prev); - if (b->prev) ((GDrawHandle*)b->prev)->raw_ptr = p; - } - - // re-insert into hash table - h = gfxalloc_get_hash_code(alloc, p); - b->next = alloc->hash[h]; - alloc->hash[h] = b; - - p += b->size; - } else { - // free block: remove it from the physical block list - b->prev_phys->next_phys = b->next_phys; - b->next_phys->prev_phys = b->prev_phys; - gfxalloc_rem_free(alloc, b); - gfxalloc_push_unused(alloc, b); - } - } - // the free list should be empty now - assert(alloc->blocks[0].next == &alloc->blocks[0]); - - // unless all memory is allocated, we now need to add a new block for the - // free space at the end - if (p != alloc->mem_end) { - b = gfxalloc_pop_unused(alloc); - - b->ptr = p; - b->prev_phys = alloc->blocks[0].prev_phys; - b->next_phys = &alloc->blocks[0]; - b->prev_phys->next_phys = b; - b->next_phys->prev_phys = b; - b->size = alloc->mem_end - p; - gfxalloc_add_free(alloc, b); - } - - GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == - alloc->num_alloc + alloc->num_free + - alloc->num_unused);) - GFXALLOC_IF_CHECK( - GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) -} - -#endif - -#if defined(GDRAW_MANAGE_MEM_TWOPOOL) - -// Defragmentation code for graphics memory, using two-pool strategy. -// -// The platform implementation must provide a GPU memcpy function and handle -// all necessary synchronization. It must also adjust its resource descriptors -// to match the new addresses after defragmentation. -// -// The high concept for two-pool is that we can't update the resource pools -// mid-frame; instead, while preparing for a frame, we need to produce a memory -// configuration that is suitable for rendering a whole frame at once (in -// contrast to our normal incremental strategy, where we can decide to -// defragment mid-frame if things are getting desperate). This is for tiled -// renderers. -// -// Two-pool works like this: -// - As the name suggests, each handle cache has two memory pools and -// corresponding backing -// allocators. The currently used allocator, "alloc", and a second allocator, -// "alloc_other". -// - Any resource used in a command buffer gets locked and *stays locked* until -// we're done -// preparing that command buffer (i.e. no unlocking after every draw as in the -// normal incremental memory management). -// - All allocations happen from "alloc", always. We mostly do our normal LRU -// cache freeing -// to make space when required. -// - We can still run out of space (no surprise) and get into a configuration -// where we have -// to defragment. This is the only tricky part, and where the second pool -// comes in. To defragment, we switch the roles of "alloc" and "alloc_other", -// and allocate new backing storage for all currently "locked" and "pinned" -// resources (i.e. everything we've used in the currently pending frame). -// - In general, we have the invariant that all resources we're using for -// batches we're -// working on must be in the "alloc" (fresh) pool, not in the "other" (stale) -// pool. Therefore, after a defragment/pool switch, any "live" resource (which -// means it's present in the stale pool) has to be copied to the "fresh" pool -// as it's getting locked to maintain this invariant. -// -// What this does is give us a guarantee that any given frame either only -// references resources in one pool (the common case), or does a defragment, in -// which case it looks like this: -// -// +------------------------------+ -// | | -// | | pool A is fresh (=alloc), pool B is stale -// (=alloc_other) | | all resources referenced -// in here are in pool A | | | | | | -// +------------------------------+ <-- defragment! pools flip roles here -// | | -// | | -// | | pool B is fresh (=alloc), pool A is stale -// (=alloc_other) | | all resources referenced -// in here are in pool B | | -// +------------------------------+ -// -// Now, at the end of the frame, we need to decide what to do with the -// resources that remain "live" (i.e. they're in the old pool but weren't -// referenced in the current frame so they didn't get copied). As of this -// writing, we simply free them, to maximize the amount of free memory in the -// new pool (and hopefully minimize the chance that we'll have to defragment -// again soon). It would also be possible to copy some of them though, assuming -// there's enough space. -// -// Freeing resources is an interesting case. When the CPU side of GDraw does a -// "free", we can't immediately reclaim the resource memory, since the GPU will -// generally still have outstanding commands that reference that resource. So -// our freed resources first enter the "Dead" state and only actually get freed -// once the GPU is done with them. What this means is that the list of -// resources in the "dead" state can end up holding references to both the -// fresh and the stale pool; the free implementation needs to be aware of this -// and return the memory to the right allocator. -// -// When we defragment, it's important to make sure that the pool we're flipping -// to is actually empty. What this means is that right before a defragment, we -// need to wait for all stale "dead" resources to actually become free. If the -// last defragment was several frames ago, this is fast - we haven't generated -// any new commands referencing the stale resources in several frames, so most -// likely they're all immediately free-able. By contrast, if we just -// defragmented last frame, this will be a slow operation since we need to wait -// for the GPU pipeline to drain - but if you're triggering defragments in -// several consecutive frames, you're thrashing the resource pools badly and -// are getting really bad performance anyway. - -static void gdraw_gpu_memcpy(GDrawHandleCache* c, void* dst, void* src, - U32 num_bytes); -static void gdraw_gpu_wait_for_transfer_completion(); -static void gdraw_resource_moved(GDrawHandle* t); - -static rrbool gdraw_CanDefragment(GDrawHandleCache* c) { - // we can defragment (and extract some gain from it) if and only if there's - // more than one free block. since gfxalloc coalesces free blocks - // immediately and keeps them in a circular linked list, this is very easy - // to detect: just check if the "next" pointer of the first free block - // points to the sentinel. (this is only the case if there are 0 or 1 free - // blocks) - gfx_allocator* alloc = c->alloc; - if (!c->alloc_other) // if we don't have a second pool, we can't defrag at - // all. - return false; - return alloc->blocks[0].next->next != alloc->blocks; -} - -static rrbool gdraw_MigrateResource(GDrawHandle* t, GDrawStats* stats) { - GDrawHandleCache* c = t->cache; - void* ptr = NULL; - - assert(t->state == GDRAW_HANDLE_STATE_live || - t->state == GDRAW_HANDLE_STATE_locked || - t->state == GDRAW_HANDLE_STATE_pinned); - // anything we migrate should be in the "other" (old) pool - assert(gfxalloc_mem_contains(c->alloc_other, t->raw_ptr)); - - ptr = gfxalloc_alloc(c->alloc, t->bytes); - if (ptr) { - // update stats - stats->nonzero_flags |= GDRAW_STATS_defrag; - stats->defrag_objects += 1; - stats->defrag_bytes += t->bytes; - - // copy contents to new storage - gdraw_gpu_memcpy(c, ptr, t->raw_ptr, t->bytes); - - // free old storage - gfxalloc_free(c->alloc_other, t->raw_ptr); - - // adjust pointers to point to new location - t->raw_ptr = ptr; - gdraw_resource_moved(t); - - return true; - } else - return false; -} - -static rrbool gdraw_MigrateAllResources(GDrawHandle* sentinel, - GDrawStats* stats) { - GDrawHandle* h; - for (h = sentinel->next; h != sentinel; h = h->next) { - if (!gdraw_MigrateResource(h, stats)) return false; - } - return true; -} - -static rrbool gdraw_TwoPoolDefragmentMain(GDrawHandleCache* c, - GDrawStats* stats) { - gfx_allocator* t; - - // swap allocators - t = c->alloc; - c->alloc = c->alloc_other; - c->alloc_other = t; - - // immediately migrate all currently pinned and locked resources - rrbool ok = true; - ok = ok && - gdraw_MigrateAllResources(&c->state[GDRAW_HANDLE_STATE_pinned], stats); - ok = ok && - gdraw_MigrateAllResources(&c->state[GDRAW_HANDLE_STATE_locked], stats); - - return ok; -} - -static rrbool gdraw_StateListIsEmpty(GDrawHandle* head) { - // a list is empty when the head sentinel is the only node - return head->next == head; -} - -static void gdraw_CheckAllPointersUpdated(GDrawHandle* head) { -#if defined(GDRAW_DEBUG) - GDrawHandle* h; - for (h = head->next; h != head; h = h->next) { - assert(gfxalloc_mem_contains(h->cache->alloc, h->raw_ptr)); - } -#endif -} - -static void gdraw_PostDefragmentCleanup(GDrawHandleCache* c, - GDrawStats* stats) { - // if we defragmented during this scene, this is the spot where - // we need to nuke all references to resources that weren't - // carried over into the new pool. - if (c->did_defragment) { - GDrawHandle* h; - - // alloc list should be empty at this point - assert(gdraw_StateListIsEmpty(&c->state[GDRAW_HANDLE_STATE_alloc])); - - // free all remaining live resources (these are the resources we didn't - // touch this frame, hence stale) - h = &c->state[GDRAW_HANDLE_STATE_live]; - while (!gdraw_StateListIsEmpty(h)) gdraw_res_free(h->next, stats); - - // "live" is now empty, and we already checked that "alloc" was empty - // earlier. "dead" may hold objects on the old heap still (that were - // freed before we swapped allocators). "user owned" is not managed by - // us. that leaves "locked" and "pinned" resources, both of which better - // be only pointing into the new heap now! - gdraw_CheckAllPointersUpdated(&c->state[GDRAW_HANDLE_STATE_locked]); - gdraw_CheckAllPointersUpdated(&c->state[GDRAW_HANDLE_STATE_pinned]); - - gdraw_gpu_wait_for_transfer_completion(); - } -} - -#endif - -// Image processing code - -// Compute average of 4 RGBA8888 pixels passed as U32. -// Variables are named assuming the values are stored as big-endian, but all -// bytes are treated equally, so this code will work just fine on little-endian -// data. -static U32 gdraw_Avg4_rgba8888(U32 p0, U32 p1, U32 p2, U32 p3) { - U32 mask = 0x00ff00ff; - U32 bias = 0x00020002; - - U32 gasum = ((p0 >> 0) & mask) + ((p1 >> 0) & mask) + ((p2 >> 0) & mask) + - ((p3 >> 0) & mask) + bias; - U32 rbsum = ((p0 >> 8) & mask) + ((p1 >> 8) & mask) + ((p2 >> 8) & mask) + - ((p3 >> 8) & mask) + bias; - - return ((gasum >> 2) & mask) | ((rbsum << 6) & ~mask); -} - -// Compute average of 2 RGBA8888 pixels passed as U32 -static U32 gdraw_Avg2_rgba8888(U32 p0, U32 p1) { - return (p0 | p1) - (((p0 ^ p1) >> 1) & 0x7f7f7f7f); -} - -// 2:1 downsample in both horizontal and vertical direction, for one line. -// width is width of destination line. -static void gdraw_Downsample_2x2_line(U8* dst, U8* line0, U8* line1, U32 width, - U32 bpp) { - U32 x; - if (bpp == 4) { - U32* in0 = (U32*)line0; - U32* in1 = (U32*)line1; - U32* out = (U32*)dst; - for (x = 0; x < width; x++, in0 += 2, in1 += 2) - *out++ = gdraw_Avg4_rgba8888(in0[0], in0[1], in1[0], in1[1]); - } else if (bpp == 1) { - for (x = 0; x < width; x++, line0 += 2, line1 += 2) - *dst++ = (line0[0] + line0[1] + line1[0] + line1[1] + 2) / 4; - } else - RR_BREAK(); -} - -// 2:1 downsample in horizontal but not vertical direction. -static void gdraw_Downsample_2x1_line(U8* dst, U8* src, U32 width, U32 bpp) { - U32 x; - if (bpp == 4) { - U32* in = (U32*)src; - U32* out = (U32*)dst; - for (x = 0; x < width; x++, in += 2) - *out++ = gdraw_Avg2_rgba8888(in[0], in[1]); - } else if (bpp == 1) { - for (x = 0; x < width; x++, src += 2) - *dst++ = (src[0] + src[1] + 1) / 2; - } else - RR_BREAK(); -} - -// 2:1 downsample in vertical but not horizontal direction. -static void gdraw_Downsample_1x2(U8* dst, S32 dstpitch, U8* src, S32 srcpitch, - U32 height, U32 bpp) { - U32 y; - if (bpp == 4) { - for (y = 0; y < height; y++, dst += dstpitch, src += 2 * srcpitch) - *((U32*)dst) = - gdraw_Avg2_rgba8888(*((U32*)src), *((U32*)(src + srcpitch))); - } else if (bpp == 1) { - for (y = 0; y < height; y++, dst += dstpitch, src += 2 * srcpitch) - *dst = (src[0] + src[srcpitch] + 1) / 2; - } else - RR_BREAK(); -} - -// 2:1 downsample (for mipmaps) -// dst: Pointer to destination buffer -// dstpitch: Pitch for destination buffer -// width: Width of *destination* image (i.e. downsampled version) -// height: Height of *destination* image (i.e. downsampled version) -// src: Pointer to source buffer -// srcpitch: Pitch of source buffer -// bpp: Bytes per pixel for image data -// -// can be used for in-place resizing if src==dst and dstpitch <= srcpitch! -static GDRAW_MAYBE_UNUSED void gdraw_Downsample(U8* dst, S32 dstpitch, - U32 width, U32 height, U8* src, - S32 srcpitch, U32 bpp) { - U32 y; - assert(bpp == 1 || bpp == 4); - - // @TODO gamma? - if (!height) // non-square texture, height was reduced to 1 in a previous - // step - gdraw_Downsample_2x1_line(dst, src, width, bpp); - else if (!width) // non-square texture, width was reduced to 1 in a - // previous step - gdraw_Downsample_1x2(dst, dstpitch, src, srcpitch, height, bpp); - else { - for (y = 0; y < height; y++) { - gdraw_Downsample_2x2_line(dst, src, src + srcpitch, width, bpp); - dst += dstpitch; - src += 2 * srcpitch; - } - } -} - -#if !defined(GDRAW_NO_STREAMING_MIPGEN) - -#define GDRAW_MAXMIPS 16 // maximum number of mipmaps supported. - -typedef struct GDrawMipmapContext { - U32 width; // width of the texture being mipmapped - U32 height; // height of the texture being mipmapped - U32 mipmaps; // number of mipmaps - U32 bpp; // bytes per pixel - - U32 partial_row; // bit N: is mipmap N currently storing a partial row? - U32 bheight; // height of the buffer at miplevel 0 - U8* pixels[GDRAW_MAXMIPS]; - U32 pitch[GDRAW_MAXMIPS]; -} GDrawMipmapContext; - -static rrbool gdraw_MipmapBegin(GDrawMipmapContext* c, U32 width, U32 height, - U32 mipmaps, U32 bpp, U8* buffer, - U32 buffer_size) { - U32 i; - U8* p; - - if (mipmaps > GDRAW_MAXMIPS) return false; - - c->width = width; - c->height = height; - c->mipmaps = mipmaps; - c->bpp = bpp; - c->partial_row = 0; - - // determine how many lines to buffer - // we try to use roughly 2/3rds of the buffer for the first miplevel (less - // than 3/4 since with our partial line buffers, we have extra buffer space - // for lower mip levels). - c->bheight = (2 * buffer_size) / (3 * width * bpp); - - // round down to next-smaller power of 2 (in case we need to swizzle; - // swizzling works on pow2-sized blocks) - while (c->bheight & (c->bheight - 1)) // while not a power of 2... - c->bheight &= c->bheight - 1; // clear least significant bit set - - // then keep lowering the number of buffered lines until they fit (or we - // reach zero, i.e. it doesn't fit) - while (c->bheight) { - p = buffer; - for (i = 0; i < c->mipmaps; i++) { - U32 mw = c->width >> i; - U32 bh = c->bheight >> i; - if (!mw) mw++; - if (!bh) mw *= 2, bh++; // need space for line of previous miplevel - - c->pixels[i] = p; - c->pitch[i] = mw * bpp; - p += c->pitch[i] * bh; - } - - // if it fits, we're done - if (p <= buffer + buffer_size) { - if (c->bheight > - height) // buffer doesn't need to be larger than the image! - c->bheight = height; - return true; - } - - // need to try a smaller line buffer... - c->bheight >>= 1; - } - - // can't fit even one line into our buffer. ouch! - return false; -} - -// returns true if there was data generated for this miplevel, false otherwise. -static rrbool gdraw_MipmapAddLines(GDrawMipmapContext* c, U32 level) { - U32 bw, bh; - - assert(level > 0); // doesn't make sense to call this on level 0 - if (level == 0 || level >= c->mipmaps) - return false; // this level doesn't exist - - bw = c->width >> level; // buffer width at this level - bh = c->bheight >> level; // buffer height at this level - - if (bh) { // we can still do regular downsampling - gdraw_Downsample(c->pixels[level], c->pitch[level], bw, bh, - c->pixels[level - 1], c->pitch[level - 1], c->bpp); - return true; - } else if (c->height >> level) { // need to buffer partial lines, but still - // doing vertical 2:1 downsampling - if ((c->partial_row ^= (1 << level)) & - (1 << level)) { // no buffered partial row for this miplevel yet, - // make one - memcpy(c->pixels[level], c->pixels[level - 1], bw * 2 * c->bpp); - return false; - } else { // have one buffered row, can generate output pixels - gdraw_Downsample_2x2_line(c->pixels[level], c->pixels[level], - c->pixels[level - 1], bw, c->bpp); - return true; - } - } else { // finish off with a chain of Nx1 miplevels - gdraw_Downsample_2x1_line(c->pixels[level], c->pixels[level - 1], bw, - c->bpp); - return true; - } -} - -#endif - -#if defined(GDRAW_CHECK_BLOCK) -static void check_block_alloc(gfx_allocator* alloc, void* ptr, - rrbool allocated) { - int i, n = 0, m = 0; - for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { - gfx_block_info* b = alloc->hash[i]; - while (b) { - if (b->ptr == ptr) ++n; - b = b->next; - } - } - gfx_block_info* b = alloc->blocks[0].next; - while (b != &alloc->blocks[0]) { - if (b->ptr == ptr) ++m; - b = b->next; - } - if (allocated) - assert(n == 1 && m == 0); - else - assert(n == 0 && m == 1); -} -#else -#define check_block_alloc(a, p, f) -#endif - -#if defined(GDRAW_BUFFER_RING) - -//////////////////////////////////////////////////////////////////////// -// -// Buffer ring -// - -// Implements a dynamic buffer backed by multiple physical buffers, with -// the usual append-only, DISCARD/NOOVERWRITE semantics. -// -// This can be used for dynamic vertex buffers, constant buffers, etc. -#define GDRAW_BUFRING_MAXSEGS 4 // max number of backing segments - -typedef struct gdraw_bufring_seg { - struct gdraw_bufring_seg* next; // next segment in ring - U8* data; // pointer to the allocation - GDrawFence fence; // fence for this segment - U32 used; // number of bytes used -} gdraw_bufring_seg; - -typedef struct gdraw_bufring { - gdraw_bufring_seg* cur; // active ring segment - U32 seg_size; // size of one segment - U32 align; // alignment of segment allocations - gdraw_bufring_seg all_segs[GDRAW_BUFRING_MAXSEGS]; -} gdraw_bufring; - -// forwards -static GDrawFence put_fence(); -static void wait_on_fence(GDrawFence fence); - -static void gdraw_bufring_init(gdraw_bufring* RADRESTRICT ring, void* ptr, - U32 size, U32 nsegs, U32 align) { - U32 i, seg_size; - - ring->seg_size = 0; - if (!ptr || nsegs < 1 || - size < nsegs * align) // bail if no ring buffer memory or too small - return; - - if (nsegs > GDRAW_BUFRING_MAXSEGS) nsegs = GDRAW_BUFRING_MAXSEGS; - - // align needs to be a positive power of two - assert(align >= 1 && (align & (align - 1)) == 0); - - // buffer really needs to be properly aligned - assert(((UINTa)ptr & (align - 1)) == 0); - - seg_size = (size / nsegs) & ~(align - 1); - for (i = 0; i < nsegs; ++i) { - ring->all_segs[i].next = &ring->all_segs[(i + 1) % nsegs]; - ring->all_segs[i].data = (U8*)ptr + i * seg_size; - ring->all_segs[i].fence.value = 0; - ring->all_segs[i].used = 0; - } - - ring->cur = ring->all_segs; - ring->seg_size = seg_size; - ring->align = align; -} - -static void gdraw_bufring_shutdown(gdraw_bufring* RADRESTRICT ring) { - ring->cur = NULL; - ring->seg_size = 0; -} - -static void* gdraw_bufring_alloc(gdraw_bufring* RADRESTRICT ring, U32 size, - U32 align) { - U32 align_up; - gdraw_bufring_seg* seg; - - if (size > ring->seg_size) return NULL; // nope, won't fit - - assert(align <= ring->align); - - // check if it fits in the active segment first - seg = ring->cur; - align_up = (seg->used + align - 1) & -align; - - if ((align_up + size) <= ring->seg_size) { - void* ptr = seg->data + align_up; - seg->used = align_up + size; - return ptr; - } - - // doesn't fit, we have to start a new ring segment. - seg->fence = put_fence(); - - // switch to the next segment, wait till GPU is done with it - seg = ring->cur = seg->next; - wait_on_fence(seg->fence); - - // allocate from the new segment. we assume that segment offsets - // satisfy the highest alignment requirements we ever ask for! - seg->used = size; - return seg->data; -} - -#endif - -//////////////////////////////////////////////////////////////////////// -// -// General resource manager -// - -#if !defined(GDRAW_FENCE_FLUSH) -#define GDRAW_FENCE_FLUSH() -#endif - -#if defined(GDRAW_MANAGE_MEM) -// functions the platform must implement -#if !defined(GDRAW_BUFFER_RING // avoid "redundant redeclaration" warning) -static void wait_on_fence(GDrawFence fence); -#endif -static rrbool is_fence_pending(GDrawFence fence); -static void gdraw_defragment_cache(GDrawHandleCache* c, GDrawStats* stats); - -// functions we implement -static void gdraw_res_reap(GDrawHandleCache* c, GDrawStats* stats); -#endif - -// If GDRAW_MANAGE_MEM is not #defined, this needs to perform the -// actual free using whatever API we're targeting. -// -// If GDRAW_MANAGE_MEM is #defined, the shared code handles the -// memory management part, but you might still need to update -// your state caching. -static void api_free_resource(GDrawHandle* r); - -// Actually frees a resource and releases all allocated resources -static void gdraw_res_free(GDrawHandle* r, GDrawStats* stats) { - assert(r->state == GDRAW_HANDLE_STATE_live || - r->state == GDRAW_HANDLE_STATE_locked || - r->state == GDRAW_HANDLE_STATE_dead || - r->state == GDRAW_HANDLE_STATE_pinned || - r->state == GDRAW_HANDLE_STATE_user_owned); - -#if defined(GDRAW_MANAGE_MEM) - GDRAW_FENCE_FLUSH(); - - // make sure resource isn't in use before we actually free the memory - wait_on_fence(r->fence); - if (r->raw_ptr) { -#if !defined(GDRAW_MANAGE_MEM_TWOPOOL) - gfxalloc_free(r->cache->alloc, r->raw_ptr); -#else - GDrawHandleCache* c = r->cache; - if (gfxalloc_mem_contains(c->alloc, r->raw_ptr)) - gfxalloc_free(c->alloc, r->raw_ptr); - else { - assert(gfxalloc_mem_contains(c->alloc_other, r->raw_ptr)); - gfxalloc_free(c->alloc_other, r->raw_ptr); - } -#endif - } -#endif - - api_free_resource(r); - - stats->nonzero_flags |= GDRAW_STATS_frees; - stats->freed_objects += 1; - stats->freed_bytes += r->bytes; - - gdraw_HandleCacheFree(r); -} - -// Frees the LRU resource in the given cache. -static rrbool gdraw_res_free_lru(GDrawHandleCache* c, GDrawStats* stats) { - GDrawHandle* r = gdraw_HandleCacheGetLRU(c); - if (!r) return false; - - if (c->is_vertex && r->owner) // check for r->owner since it may already be - // killed (if player destroyed first) - IggyDiscardVertexBufferCallback(r->owner, r); - - // was it referenced since end of previous frame (=in this frame)? - // if some, we're thrashing; report it to the user, but only once per frame. - if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex - ? "GDraw Thrashing vertex memory" - : "GDraw Thrashing texture memory"); - c->is_thrashing = true; - } - - gdraw_res_free(r, stats); - return true; -} - -static void gdraw_res_flush(GDrawHandleCache* c, GDrawStats* stats) { - c->is_thrashing = true; // prevents warnings being generated from free_lru - gdraw_HandleCacheUnlockAll(c); - while (gdraw_res_free_lru(c, stats)); -} - -static GDrawHandle* gdraw_res_alloc_outofmem(GDrawHandleCache* c, - GDrawHandle* t, - char const* failed_type) { - if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, - c->is_vertex ? "GDraw Out of static vertex buffer %s" - : "GDraw Out of texture %s", - failed_type); - return NULL; -} - -#if !defined(GDRAW_MANAGE_MEM) - -static GDrawHandle* gdraw_res_alloc_begin(GDrawHandleCache* c, S32 size, - GDrawStats* stats) { - GDrawHandle* t; - if (size > c->total_bytes) - gdraw_res_alloc_outofmem( - c, NULL, "memory (single resource larger than entire pool)"); - else { - // given how much data we're going to allocate, throw out - // data until there's "room" (this basically lets us use - // managed memory and just bound our usage, without actually - // packing it and being exact) - while (c->bytes_free < size) { - if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); - break; - } - } - } - - // now try to allocate a handle - t = gdraw_HandleCacheAllocateBegin(c); - if (!t) { - // it's possible we have no free handles, because all handles - // are in use without exceeding the max storage above--in that - // case, just free one texture to give us a free handle (ideally - // we'd trade off cost of regenerating) - if (gdraw_res_free_lru(c, stats)) { - t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); - } - } - } - return t; -} - -#else - -// Returns whether this resource holds pointers to one of the GDraw-managed -// pools. -static rrbool gdraw_res_is_managed(GDrawHandle* r) { - return r->state == GDRAW_HANDLE_STATE_live || - r->state == GDRAW_HANDLE_STATE_locked || - r->state == GDRAW_HANDLE_STATE_dead || - r->state == GDRAW_HANDLE_STATE_pinned; -} - -// "Reaps" dead resources. Even if the user requests that a -// resource be freed, it might still be in use in a pending -// command buffer. So we can't free the associated memory -// immediately; instead, we flag the resource as "dead" and -// periodically check whether we can actually free the -// pending memory of dead resources ("reap" them). -static void gdraw_res_reap(GDrawHandleCache* c, GDrawStats* stats) { - GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_dead]; - GDrawHandle* t; - GDRAW_FENCE_FLUSH(); - - // reap all dead resources that aren't in use anymore - while ((t = sentinel->next) != sentinel && !is_fence_pending(t->fence)) - gdraw_res_free(t, stats); -} - -// "Kills" a resource. This means GDraw won't use it anymore -// (it's dead), but there might still be outstanding references -// to it in a pending command buffer, so we can't physically -// free the associated memory until that's all processed. -static void gdraw_res_kill(GDrawHandle* r, GDrawStats* stats) { - GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all - // fence values are current. - - r->owner = NULL; - gdraw_HandleCacheInsertDead(r); - gdraw_res_reap(r->cache, stats); -} - -static GDrawHandle* gdraw_res_alloc_begin(GDrawHandleCache* c, S32 size, - GDrawStats* stats) { - GDrawHandle* t; - void* ptr = NULL; - - gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); - if (size > c->total_bytes) - return gdraw_res_alloc_outofmem( - c, NULL, "memory (single resource larger than entire pool)"); - - // now try to allocate a handle - t = gdraw_HandleCacheAllocateBegin(c); - if (!t) { - // it's possible we have no free handles, because all handles - // are in use without exceeding the max storage above--in that - // case, just free one texture to give us a free handle (ideally - // we'd trade off cost of regenerating) - gdraw_res_free_lru(c, stats); - t = gdraw_HandleCacheAllocateBegin(c); - if (!t) return gdraw_res_alloc_outofmem(c, NULL, "handles"); - } - - // try to allocate first - if (size) { - ptr = gfxalloc_alloc(c->alloc, size); - if (!ptr) { - // doesn't currently fit. try to free some allocations to get space - // to breathe. - S32 want_free = RR_MAX(size + (size / 2), GDRAW_MIN_FREE_AMOUNT); - if (want_free > c->total_bytes) - want_free = size; // okay, *really* big resource, just try to - // allocate its real size - - // always keep freeing textures until want_free bytes are free. - while (c->alloc->actual_bytes_free < want_free) { - if (!gdraw_res_free_lru(c, stats)) - return gdraw_res_alloc_outofmem(c, t, "memory"); - } - - // now, keep trying to allocate and free some more memory when it - // still doesn't fit - while (!(ptr = gfxalloc_alloc(c->alloc, size))) { - if (c->alloc->actual_bytes_free >= - 3 * size || // if we should have enough free bytes to - // satisfy the request by now - (c->alloc->actual_bytes_free >= size && - size * 2 >= - c->total_bytes)) // or the resource is very big and - // the alloc doesn't fit - { - // before we actually consider defragmenting, we want to - // free all stale resources (not referenced in the previous - // 2 frames). and if that frees up enough memory so we don't - // have to defragment, all the better! also, never - // defragment twice in a frame, just assume we're thrashing - // when we get in that situation and free up as much as - // possible. - if (!c->did_defragment && - c->prev_frame_start.value <= c->handle->fence.value) { - // defragment. - defrag: - if (gdraw_CanDefragment( - c)) { // only try defrag if it has a chance of - // helping. - gdraw_defragment_cache(c, stats); - c->did_defragment = true; - } - ptr = gfxalloc_alloc(c->alloc, size); - if (!ptr) - return gdraw_res_alloc_outofmem( - c, t, "memory (fragmentation)"); - break; - } - } - - // keep trying to free some more - if (!gdraw_res_free_lru(c, stats)) { - if (c->alloc->actual_bytes_free >= - size) // nothing left to free but we should be good - - // defrag again, even if it's the second time in - // a frame - goto defrag; - - return gdraw_res_alloc_outofmem(c, t, "memory"); - } - } - } - } - - t->fence.value = 0; // hasn't been used yet - t->raw_ptr = ptr; - return t; -} - -#endif diff --git a/targets/app/windows/Iggy/include/gdraw.h b/targets/app/windows/Iggy/include/gdraw.h deleted file mode 100644 index c6a171970..000000000 --- a/targets/app/windows/Iggy/include/gdraw.h +++ /dev/null @@ -1,841 +0,0 @@ -// gdraw.h - author: Sean Barrett - copyright 2009 RAD Game Tools -// -// This is the graphics rendering abstraction that Iggy is implemented -// on top of. - -#ifndef __RAD_INCLUDE_GDRAW_H__ -#define __RAD_INCLUDE_GDRAW_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -// idoc(parent,GDrawAPI_Buffers) - -#ifndef IGGY_GDRAW_SHARED_TYPEDEF - -#define IGGY_GDRAW_SHARED_TYPEDEF -typedef struct GDrawFunctions GDrawFunctions; - -typedef struct GDrawTexture GDrawTexture; - -#endif // IGGY_GDRAW_SHARED_TYPEDEF - -IDOC typedef struct GDrawVertexBuffer GDrawVertexBuffer; -/* An opaque handle to an internal GDraw vertex buffer. */ - -// idoc(parent,GDrawAPI_Base) - -IDOC typedef struct gswf_recti { - S32 x0, y0; // Minimum corner of the rectangle - S32 x1, y1; // Maximum corner of the rectangle -} gswf_recti; -/* A 2D rectangle with integer coordinates specifying its minimum and maximum - * corners. */ - -IDOC typedef struct gswf_rectf { - F32 x0, y0; // Minimum corner of the rectangle - F32 x1, y1; // Maximum corner of the rectangle -} gswf_rectf; -/* A 2D rectangle with floating-point coordinates specifying its minimum and - * maximum corners. */ - -IDOC typedef struct gswf_matrix { - union { - F32 m[2][2]; // 2x2 transform matrix - struct { - F32 m00; // Alternate name for m[0][0], for coding convenience - F32 m01; // Alternate name for m[0][1], for coding convenience - F32 m10; // Alternate name for m[1][0], for coding convenience - F32 m11; // Alternate name for m[1][1], for coding convenience - }; - }; - F32 trans[2]; // 2D translation vector (the affine component of the matrix) -} gswf_matrix; -/* A 2D transform matrix plus a translation offset. */ - -#define GDRAW_STATS_batches 1 -#define GDRAW_STATS_blits 2 -#define GDRAW_STATS_alloc_tex 4 -#define GDRAW_STATS_frees 8 -#define GDRAW_STATS_defrag 16 -#define GDRAW_STATS_rendtarg 32 -#define GDRAW_STATS_clears 64 -IDOC typedef struct GDrawStats { - S16 nonzero_flags; // which of the fields below are non-zero - - U16 num_batches; // number of batches, e.g. DrawPrim, DrawPrimUP - U16 num_blits; // number of blit operations (resolve, msaa resolve, blend - // readback) - U16 freed_objects; // number of cached objects freed - U16 defrag_objects; // number of cached objects defragmented - U16 alloc_tex; // number of textures/buffers allocated - U16 rendertarget_changes; // number of rendertarget changes - U16 num_clears; - // 0 mod 8 - - U32 drawn_indices; // number of indices drawn (3 times number of triangles) - U32 drawn_vertices; // number of unique vertices referenced - U32 num_blit_pixels; // number of pixels in blit operations - U32 alloc_tex_bytes; // number of bytes in textures/buffers allocated - U32 freed_bytes; // number of bytes in freed cached objects - U32 defrag_bytes; // number of bytes in defragmented cached objects - U32 cleared_pixels; // number of pixels cleared by clear operation - U32 reserved; - // 0 mod 8 -} GDrawStats; -/* A structure with statistics information to show in resource browser/Telemetry - */ - -//////////////////////////////////////////////////////////// -// -// Queries -// -// idoc(parent,GDrawAPI_Queries) - -IDOC typedef enum gdraw_bformat { - GDRAW_BFORMAT_vbib, // Platform uses vertex and index buffers - GDRAW_BFORMAT_wii_dlist, // Platform uses Wii-style display lists - GDRAW_BFORMAT_vbib_single_format, // Platform uses vertex and index - // buffers, but doesn't support multiple - // vertex formats in a single VB - - GDRAW_BFORMAT__count, -} gdraw_bformat; -/* Specifies what data format GDraw expects in MakeVertexBuffer_* and - DrawIndexedTriangles. - - Most supported platforms prefer Vertex and Index buffers so that's what we - use, but this format turns out to be somewhat awkward for Wii, so we use the - native graphics processor display list format on that platform. */ - -IDOC typedef struct GDrawInfo { - S32 num_stencil_bits; // number of (possibly emulated) stencil buffer bits - U32 max_id; // number of unique values that can be easily encoded in - // zbuffer - U32 max_texture_size; // edge length of largest square texture supported by - // hardware - U32 buffer_format; // one of $gdraw_bformat - rrbool shared_depth_stencil; // does 0'th framebuffer share depth & stencil - // with others? (on GL it can't?) - rrbool always_mipmap; // if GDraw can generate mipmaps nearly for free, - // then set this flag - rrbool conditional_nonpow2; // non-pow2 textures supported, but only using - // clamp and without mipmaps - rrbool has_rendertargets; // if true, then there is no rendertarget stack - // support - rrbool no_nonpow2; // non-pow2 textures aren't supported at all -} GDrawInfo; // must be a multiple of 8 -/* $GDrawInfo contains the information that Iggy needs to know about - what a GDraw implementation supports and what limits it places on - certain important values. */ - -IDOC typedef void RADLINK gdraw_get_info(GDrawInfo* d); -/* Iggy queries this at the beginning of rendering to get information - about the viewport and the device capabilities. */ - -//////////////////////////////////////////////////////////// -// -// Drawing State -// -// idoc(parent,GDrawAPI_DrawingState) - -IDOC typedef enum gdraw_blend { - GDRAW_BLEND_none, // Directly copy - GDRAW_BLEND_alpha, // Use the source alpha channel to modulate its - // contribution - GDRAW_BLEND_multiply, // Multiply colors componentwise - GDRAW_BLEND_add, // Add the source and destination together - - GDRAW_BLEND_filter, // Uses a secondary $gdraw_filter specification to - // determine how to blend - GDRAW_BLEND_special, // Uses a secondary $gdraw_blendspecial specification - // to determine how to blend - - GDRAW_BLEND__count, -} gdraw_blend; -/* Identifier indicating the type of blending operation to use when rendering.*/ - -IDOC typedef enum gdraw_blendspecial { - GDRAW_BLENDSPECIAL_layer, // s - GDRAW_BLENDSPECIAL_multiply, // s*d - GDRAW_BLENDSPECIAL_screen, // sa*da - (da-d)*(sa-s) - GDRAW_BLENDSPECIAL_lighten, // max(sa*d,s*da) - GDRAW_BLENDSPECIAL_darken, // min(sa*d,s*da) - GDRAW_BLENDSPECIAL_add, // min(d+s,1.0) - GDRAW_BLENDSPECIAL_subtract, // max(d-s,0.0) - GDRAW_BLENDSPECIAL_difference, // abs(sa*d-s*da) - GDRAW_BLENDSPECIAL_invert, // sa*(da-d) - GDRAW_BLENDSPECIAL_overlay, // d < da/2.0 ? (2.0*s*d) : (sa*da - // - 2.0*(da-d)*(sa-s)) - GDRAW_BLENDSPECIAL_hardlight, // s < sa/2.0 ? (2.0*s*d) : (sa*da - // - 2.0*(da-d)*(sa-s)) - - // these do extra-special math on the output alpha - GDRAW_BLENDSPECIAL_erase, // d*(1.0-sa) - GDRAW_BLENDSPECIAL_alpha_special, // d*sa - - GDRAW_BLENDSPECIAL__count, -} gdraw_blendspecial; -/* Specifies a type of "special" blend mode, which is defined as one - that has to read from the framebuffer to compute its effect. - - These modes are only used with a 1-to-1 textured quad containing - the exact output data in premultiplied alpha. They all need to - read from the framebuffer to compute their effect, so a GDraw - implementation will usually need a custom path to handle that. - Users will not warn in advance whether you're going to need this - operation, so implementations either need to always render to a - texture in case it happens, or copy the framebuffer to a texture - when it does. - - Note that $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_erase) and - $(gdraw_blendspecial::GDRAW_BLENDSPECIAL_alpha_special) are unique - among $gdraw_blendspecial modes in that they may not actually need - to be implemented with the destination input as a texture if - the destination buffer doesn't have an alpha channel. */ - -// (@OPTIMIZE: the last filter in each chain could be combined with -// the final blend, although only worth doing if the final blend is -// ALPHA/ADD/MULTIPLY--it's usually ALPHA though so worth doing!) -IDOC typedef enum gdraw_filter { - GDRAW_FILTER_blur, // Blurs the source image - GDRAW_FILTER_colormatrix, // Transform RGB pixel values by a matrix - GDRAW_FILTER_bevel, // Bevels the source image - GDRAW_FILTER_dropshadow, // Adds a dropshadow underneath the source image - - GDRAW_FILTER__count, -} gdraw_filter; -/* Specifies a type of post-processing graphics filter. - - These modes are only used to implement filter effects, and will - always be blending from a temporary buffer to another temporary - buffer with no blending, so in general they should not require - any additional input. -*/ - -IDOC typedef enum gdraw_texture { - GDRAW_TEXTURE_none, // No texture applied - GDRAW_TEXTURE_normal, // Texture is bitmap or linear gradient - GDRAW_TEXTURE_alpha, // Texture is an alpha-only font bitmap - GDRAW_TEXTURE_radial, // Texture is a radial gradient - GDRAW_TEXTURE_focal_gradient, // Texture is a "focal" radial gradient - GDRAW_TEXTURE_alpha_test, // Texture is an alpha-only font bitmap, alpha - // test for alpha >= 0.5 - - GDRAW_TEXTURE__count, -} gdraw_texture; -/* Specifies how to apply a texture while rendering. */ - -IDOC typedef enum gdraw_wrap { - GDRAW_WRAP_clamp, // Texture coordinates clamped to edges - GDRAW_WRAP_repeat, // Texture repeats periodically - GDRAW_WRAP_mirror, // Repeat periodically, mirror on odd repetititions - GDRAW_WRAP_clamp_to_border, // only used internally by some GDraws - - GDRAW_WRAP__count, -} gdraw_wrap; -/* Specifies what to do with texture coordinates outside [0,1]. */ - -typedef struct GDrawRenderState { - S32 id; // Object "identifier" used for high-quality AA mode - U32 test_id : 1; // Whether to test zbuffer == id - U32 set_id : 1; // Whether to set zbuffer == id - U32 use_world_space : 1; // Whether primitive is defined in object space or - // world space - U32 scissor : 1; // Whether rendering will be clipped to - // $(GDrawRenderState::scissor_rect) - U32 identical_state : 1; // Whether state is identical to the one used for - // the previous draw call - U32 unused : 27; - // aligned 0 mod 8 - - U8 texgen0_enabled; // Whether to use texgen for tex0 - U8 tex0_mode; // One of $gdraw_texture - U8 wrap0; // One of $gdraw_wrap - U8 nearest0; // Whether to sample texture 0 nearest neighbor - - U8 blend_mode; // One of $gdraw_blend - U8 special_blend; // One of $gdraw_blendspecial (used only if - // $(GDrawRenderState::blend_mode) == - // $(gdraw_blend::GDRAW_BLEND_special) - U8 filter; // One of $gdraw_filter (used only if - // $(GDrawRenderState::blend_mode) == - // $(gdraw_blend::GDRAW_BLEND_filter) - U8 filter_mode; // Used to select the right compositing operation for the - // $(gdraw_filter::GDRAW_FILTER_bevel) and - // $(gdraw_filter::GDRAW_FILTER_dropshadow) modes - // aligned 0 mod 8 - U8 stencil_test; // Only draw if these stencil bits are "set" - U8 stencil_set; // "Set" these stencil bits (note that actual - // implementation initializes stencil to 1, and "set" makes - // them 0) - - U8 reserved[2]; // Currently unused (used to make padding to 4/8-byte - // boundary for following pointer explicit) - S32 blur_passes; // For filters that include blurring, this is the number - // of box filter passes to run - // align 0 mod 8 - - S16* cxf_add; // Color transform addition (discourage additive alpha!) - - GDrawTexture* tex[3]; // One or more textures to apply -- need 3 for - // gradient dropshadow. - // 0 mod 8 - F32* edge_matrix; // Screen to object space matrix (for edge antialiasing) - gswf_matrix* o2w; // Object-to-world matrix - - // --- Everything below this point must be manually initialized - - // 0 mod 8 - F32 color[4]; // Color of the object - - // 0 mod 8 - gswf_recti scissor_rect; // The rectangle to which rendering will be - // clipped if $(GDrawRenderState::scissor) is set - // 0 mod 8 - // --- Everything below this point might be uninitialized if it's not used - // for this particular render state - - F32 s0_texgen[4]; // "s" (x) row of texgen matrix - F32 t0_texgen[4]; // "t" (y) row of texgen matrix - // 0 mod 8 - F32 focal_point[4]; // Data used for - // $(gdraw_texgen_mode::GDRAW_TEXTURE_focal_gradient) - // 0 mod 8 - F32 blur_x, blur_y; // The size of the box filter, where '1' is the - // identity and 2 adds half a pixel on each side - // 0 mod 8 - F32 shader_data[20]; // Various data that depends on filter (e.g. drop - // shadow direction, color) -} GDrawRenderState; -/* Encapsulation of the entire drawing state that affects a rendering command. - */ - -IDOC typedef void RADLINK gdraw_set_view_size_and_world_scale( - S32 w, S32 h, F32 x_world_to_pixel, F32 y_world_to_pixel); -/* Sets the size of the rendering viewport and the world to pixel scaling. - - Iggy calls this function with the full size that the viewport would - be if it were rendered untiled, even if it will eventually be - rendered as a collection of smaller tiles. - - The world scale is used to compensate non-square pixel aspect ratios - when rendering wide lines. Both scale factors are 1 unless Iggy is - running on a display with non-square pixels. */ - -typedef void RADLINK gdraw_set_3d_transform(F32* mat); /* mat[3][4] */ - -IDOC typedef void RADLINK gdraw_render_tile_begin(S32 tx0, S32 ty0, S32 tx1, - S32 ty1, S32 pad, - GDrawStats* stats); -/* Begins rendering of a sub-region of the rendered image. */ - -IDOC typedef void RADLINK gdraw_render_tile_end(GDrawStats* stats); -/* Ends rendering of a sub-region of the rendered image. */ - -IDOC typedef void RADLINK gdraw_rendering_begin(void); -/* Begins rendering; takes control of the graphics API. */ - -IDOC typedef void RADLINK gdraw_rendering_end(void); -/* Ends rendering; gives up control of the graphics API. */ - -//////////////////////////////////////////////////////////// -// -// Drawing -// -// idoc(parent,GDrawAPI_Drawing) - -IDOC typedef void RADLINK gdraw_clear_stencil_bits(U32 bits); -/* Clears the 'bits' parts of the stencil value in the entire framebuffer to the - * default value. */ - -IDOC typedef void RADLINK gdraw_clear_id(void); -/* Clears the 'id' buffer, which is typically the z-buffer but can also be the - * stencil buffer. */ - -IDOC typedef void RADLINK gdraw_filter_quad(GDrawRenderState* r, S32 x0, S32 y0, - S32 x1, S32 y1, GDrawStats* stats); -/* Draws a special quad in viewport-relative pixel space. - - May be normal, may be displaced by filters, etc. and require multiple passes, - may apply special blending (and require extra resolves/rendertargets) - for filter/blend., - - The x0,y0,x1,y1 always describes the "input" box. */ - -IDOC typedef struct GDrawPrimitive { - F32* vertices; // Pointer to an array of $gswf_vertex_xy, - // $gswf_vertex_xyst, or $gswf_vertex_xyoffs - U16* indices; // Pointer to an array of 16-bit indices into - // $(GDrawPrimitive::vertices) - - S32 num_vertices; // Count of elements in $(GDrawPrimitive::vertices) - S32 num_indices; // Count of elements in $(GDrawPrimitive::indices) - - S32 vertex_format; // One of $gdraw_vformat, specifying the type of element - // in $(GDrawPrimitive::vertices) - - U32 uniform_count; - F32* uniforms; - - U8 drawprim_mode; -} GDrawPrimitive; -/* Specifies the vertex and index data necessary to draw a batch of graphics - * primitives. */ - -IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState* r, - GDrawPrimitive* prim, - GDrawVertexBuffer* buf, - GDrawStats* stats); -/* Draws a collection of indexed triangles, ignoring special filters or blend - modes. - - If buf is NULL, then the pointers in 'prim' are machine pointers, and - you need to make a copy of the data (note currently all triangles - implementing strokes (wide lines) go this path). - - If buf is non-NULL, then use the appropriate vertex buffer, and the - pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; - (note there are separate spaces for vertices and indices; e.g. the - first mesh in a given vertex buffer will normally have a 0 offset - for the vertices and a 0 offset for the indices) -*/ - -IDOC typedef void RADLINK gdraw_set_antialias_texture(S32 width, U8* rgba); -/* Specifies the 1D texture data to be used for the antialiasing gradients. - - 'rgba' specifies the pixel values in rgba byte order. This will only be - called once during initialization. */ - -//////////////////////////////////////////////////////////// -// -// Texture and Vertex Buffers -// -// idoc(parent,GDrawAPI_Buffers) - -IDOC typedef enum gdraw_texture_format { - // Platform-independent formats - GDRAW_TEXTURE_FORMAT_rgba32, // 32bpp RGBA data in platform-preferred byte - // order (returned by - // $gdraw_make_texture_begin as - // $gdraw_texture_type) - GDRAW_TEXTURE_FORMAT_font, // Alpha-only data with at least 4 bits/pixel. - // Data is submitted as 8 bits/pixel, conversion - // (if necessary) done by GDraw. - - // First platform-specific format index (for reference) - GDRAW_TEXTURE_FORMAT__platform = 16, - - // In the future, we will support platform-specific formats and add them to - // this list. -} gdraw_texture_format; -/* Describes the format of a texture submitted to GDraw. */ - -IDOC typedef enum gdraw_texture_type { - GDRAW_TEXTURE_TYPE_rgba, // Raw 4-channel packed texels, in OpenGL-standard - // order - GDRAW_TEXTURE_TYPE_bgra, // Raw 4-channel packed texels, in - // Direct3D-standard order - GDRAW_TEXTURE_TYPE_argb, // Raw 4-channel packed texels, in Flash native - // order - - GDRAW_TEXTURE_TYPE__count, -} gdraw_texture_type; -/* Describes the channel layout of a RGBA texture submitted to GDraw. */ - -IDOC typedef struct GDraw_MakeTexture_ProcessingInfo { - U8* texture_data; // Pointer to the texture image bits - S32 num_rows; // Number of rows to upload in the current chunk - S32 stride_in_bytes; // Distance between a given pixel and the first pixel - // in the next row - S32 texture_type; // One of $gdraw_texture_type - - U32 temp_buffer_bytes; // Size of temp buffer in bytes - U8* temp_buffer; // Temp buffer for GDraw to work in (used during mipmap - // creation) - - void *p0, *p1, *p2, *p3, *p4, *p5, *p6, - *p7; // Pointers for GDraw to store data across "passes" (never touched - // by Iggy) - U32 i0, i1, i2, i3, i4, i5, i6, - i7; // Integers for GDraw to store data across "passes" (never touched - // by Iggy) -} GDraw_MakeTexture_ProcessingInfo; -/* $GDraw_MakeTexture_ProcessingInfo is used when building a texture. */ - -IDOC typedef struct GDraw_Texture_Description { - S32 width; // Width of the texture in pixels - S32 height; // Height of the texture in pixels - U32 size_in_bytes; // Size of the texture in bytes -} GDraw_Texture_Description; -/* $GDraw_Texture_Description contains information about a texture. */ - -IDOC typedef U32 gdraw_maketexture_flags; -#define GDRAW_MAKETEXTURE_FLAGS_mipmap \ - 1 IDOC // Generates mip-maps for the texture -#define GDRAW_MAKETEXTURE_FLAGS_updatable \ - 2 IDOC // Set if the texture might be updated subsequent to its initial - // submission -#define GDRAW_MAKETEXTURE_FLAGS_never_flush \ - 4 IDOC // Set to request that the texture never be flushed from the GDraw - // cache - -/* Flags that control the submission and management of GDraw textures. */ - -IDOC typedef void RADLINK gdraw_set_texture_unique_id(GDrawTexture* tex, - void* old_unique_id, - void* new_unique_id); -/* Changes unique id of a texture, only used for TextureSubstitution */ - -IDOC typedef rrbool RADLINK gdraw_make_texture_begin( - void* unique_id, S32 width, S32 height, gdraw_texture_format format, - gdraw_maketexture_flags flags, - GDraw_MakeTexture_ProcessingInfo* output_info, GDrawStats* stats); -/* Begins specifying a new texture. - - $:unique_id Unique value specified by Iggy that you can use to identify a - reference to the same texture even if its handle has been discarded - $:return Error code if there was a problem, IGGY_RESULT_OK otherwise -*/ - -IDOC typedef rrbool RADLINK -gdraw_make_texture_more(GDraw_MakeTexture_ProcessingInfo* info); -/* Continues specifying a new texture. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return True if specification can continue, false if specification must be - aborted -*/ - -IDOC typedef GDrawTexture* RADLINK gdraw_make_texture_end( - GDraw_MakeTexture_ProcessingInfo* info, GDrawStats* stats); -/* Ends specification of a new texture. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured -*/ - -IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Begins updating a previously submitted texture. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin - $:return True on success, false otherwise and the texture must be recreated -*/ - -IDOC typedef void RADLINK gdraw_update_texture_rect( - GDrawTexture* tex, void* unique_id, S32 x, S32 y, S32 stride, S32 w, S32 h, - U8* data, gdraw_texture_format format); -/* Updates a rectangle in a previously submitted texture. - - $:format Must be the $gdraw_texture_format that was originally passed to - $gdraw_make_texture_begin for this texture. -*/ - -IDOC typedef void RADLINK gdraw_update_texture_end(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Ends an update to a previously submitted texture. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin (and hence $gdraw_update_texture_begin) -*/ - -IDOC typedef void RADLINK -gdraw_describe_texture(GDrawTexture* tex, GDraw_Texture_Description* desc); -/* Returns a texture description for a given GDraw texture. */ - -IDOC typedef GDrawTexture* RADLINK gdraw_make_texture_from_resource( - U8* resource_file, S32 file_len, void* texture); -/* Loads a texture from a resource file and returns a wrapped pointer. */ - -IDOC typedef void RADLINK gdraw_free_texture_from_resource(GDrawTexture* tex); -/* Frees a texture created with gdraw_make_texture_from_resource. */ - -IDOC typedef struct gswf_vertex_xy { - F32 x, y; // Position of the vertex -} gswf_vertex_xy; -/* A 2D point with floating-point position. */ - -IDOC typedef struct gswf_vertex_xyoffs { - F32 x, y; // Position of the vertex - - S16 aa; // Stroke/aa texcoord - S16 dx, dy; // Vector offset from the position, used for anti-aliasing - // (signed 11.5 fixed point) - S16 unused; -} gswf_vertex_xyoffs; -/* A 2D point with floating-point position, additional integer parameter, and - * integer anti-aliasing offset vector. */ - -IDOC typedef struct gswf_vertex_xyst { - F32 x, y; // Position of the vertex - F32 s, t; // Explicit texture coordinates for rectangles -} gswf_vertex_xyst; -/* A 2D point with floating-point position and texture coordinates. */ - -typedef int gdraw_verify_size_xy[sizeof(gswf_vertex_xy) == 8 ? 1 : -1]; -typedef int gdraw_verify_size_xyoffs[sizeof(gswf_vertex_xyoffs) == 16 ? 1 : -1]; -typedef int gdraw_verify_size_xyst[sizeof(gswf_vertex_xyst) == 16 ? 1 : -1]; - -IDOC typedef enum gdraw_vformat { - GDRAW_vformat_v2, // Indicates vertices of type $gswf_vertex_xy (8 bytes - // per vertex) - GDRAW_vformat_v2aa, // Indicates vertices of type $gswf_vertex_xyoffs (16 - // bytes per vertex) - GDRAW_vformat_v2tc2, // Indicates vertices of type $gswf_vertex_xyst (16 - // bytes per vertex) - - GDRAW_vformat__basic_count, - GDRAW_vformat_ihud1 = - GDRAW_vformat__basic_count, // primary format for ihud, currently - // v2tc2mat4 (20 bytes per vertex) - - GDRAW_vformat__count, - GDRAW_vformat_mixed, // Special value that denotes a VB containing data in - // multiple vertex formats. Never used when drawing! -} gdraw_vformat; -/* Identifies one of the vertex data types. */ - -IDOC typedef struct GDraw_MakeVertexBuffer_ProcessingInfo { - U8* vertex_data; // location to write vertex data - U8* index_data; // location to write index data - - S32 vertex_data_length; // size of buffer to write vertex data - S32 index_data_length; // size of buffer to write index data - - void *p0, *p1, *p2, *p3, *p4, *p5, *p6, - *p7; // Pointers for GDraw to store data across "passes" (never touched - // by Iggy) - U32 i0, i1, i2, i3, i4, i5, i6, - i7; // Integers for GDraw to store data across "passes" (never touched - // by Iggy) -} GDraw_MakeVertexBuffer_ProcessingInfo; -/* $GDraw_MakeVertexBuffer_ProcessingInfo is used when building a vertex buffer. - */ - -IDOC typedef struct GDraw_VertexBuffer_Description { - S32 size_in_bytes; // Size of the vertex buffer in bytes -} GDraw_VertexBuffer_Description; -/* $GDraw_VertexBuffer_Description contains information about a vertex buffer. - */ - -IDOC typedef rrbool RADLINK gdraw_make_vertex_buffer_begin( - void* unique_id, gdraw_vformat vformat, S32 vdata_len_in_bytes, - S32 idata_len_in_bytes, GDraw_MakeVertexBuffer_ProcessingInfo* info, - GDrawStats* stats); -/* Begins specifying a new vertex buffer. - - $:unique_id Unique value that identifies this texture, across potentially - multiple flushes and re-creations of its $GDrawTexture handle in GDraw - $:vformat One of $gdraw_vformat, denoting the format of the vertex data - submitted - $:return false if there was a problem, true if ok -*/ - -IDOC typedef rrbool RADLINK -gdraw_make_vertex_buffer_more(GDraw_MakeVertexBuffer_ProcessingInfo* info); -/* Continues specifying a new vertex buffer. - - $:info The same handle initially passed to $gdraw_make_vertex_buffer_begin - $:return True if specification can continue, false if specification must be - aborted -*/ - -IDOC typedef GDrawVertexBuffer* RADLINK gdraw_make_vertex_buffer_end( - GDraw_MakeVertexBuffer_ProcessingInfo* info, GDrawStats* stats); -/* Ends specification of a new vertex buffer. - - $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created vertex buffer -*/ - -IDOC typedef void RADLINK gdraw_describe_vertex_buffer( - GDrawVertexBuffer* buffer, GDraw_VertexBuffer_Description* desc); -/* Returns a description for a given GDrawVertexBuffer */ - -IDOC typedef rrbool RADLINK gdraw_try_to_lock_texture(GDrawTexture* tex, - void* unique_id, - GDrawStats* stats); -/* Tells GDraw that a $GDrawTexture is going to be referenced. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin -*/ - -IDOC typedef rrbool RADLINK gdraw_try_to_lock_vertex_buffer( - GDrawVertexBuffer* vb, void* unique_id, GDrawStats* stats); -/* Tells GDraw that a $GDrawVertexBuffer is going to be referenced. - - $:unique_id Must be the same value initially passed to - $gdraw_make_vertex_buffer_begin -*/ - -IDOC typedef void RADLINK gdraw_unlock_handles(GDrawStats* stats); -/* Indicates that the user of GDraw will not try to reference anything without - locking it again. - - Note that although a call to $gdraw_unlock_handles indicates that - all $GDrawTexture and $GDrawVertexBuffer handles that have had a - "unique_id" specified will no longer be referenced by the user of - GDraw, it does not affect those $GDrawTexture handles that were - created by $gdraw_start_texture_draw_buffer with a unique_id of 0. -*/ - -IDOC typedef void RADLINK gdraw_free_vertex_buffer(GDrawVertexBuffer* vb, - void* unique_id, - GDrawStats* stats); -/* Free a vertex buffer and invalidate the handle - - $:unique_id Must be the same value initially passed to - $gdraw_make_vertex_buffer_begin -*/ - -IDOC typedef void RADLINK gdraw_free_texture(GDrawTexture* t, void* unique_id, - GDrawStats* stats); -/* Free a texture and invalidate the handle. - - $:unique_id Must be the same value initially passed to - $gdraw_make_texture_begin, or 0 for a texture created by - $gdraw_end_texture_draw_buffer -*/ - -//////////////////////////////////////////////////////////// -// -// Render targets -// -// idoc(parent,GDrawAPI_Targets) - -IDOC typedef U32 gdraw_texturedrawbuffer_flags; -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color \ - 1 IDOC // Tells GDraw that you will need the color channel when rendering a - // texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha \ - 2 IDOC // Tells GDraw that you will need the alpha channel when rendering a - // texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil \ - 4 IDOC // Tells GDraw that you will need the stencil channel when rendering - // a texture -#define GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id \ - 8 IDOC // Tells GDraw that you will need the id channel when rendering a - // texture - -/* Flags that control rendering to a texture. */ - -IDOC typedef rrbool RADLINK gdraw_texture_draw_buffer_begin( - gswf_recti* region, gdraw_texture_format format, - gdraw_texturedrawbuffer_flags flags, void* unique_id, GDrawStats* stats); -/* Starts rendering all GDraw commands to a new texture. - - Creates a rendertarget with destination alpha, initializes to all 0s and - prepares to render into it -*/ - -IDOC typedef GDrawTexture* RADLINK -gdraw_texture_draw_buffer_end(GDrawStats* stats); -/* Ends rendering GDraw commands to a texture, and returns the texture created. - - You can get the size of the resulting texture with $gdraw_query_texture_size. -*/ - -//////////////////////////////////////////////////////////// -// -// Masking -// -// idoc(parent,GDrawAPI_Masking) - -IDOC typedef void RADLINK gdraw_draw_mask_begin(gswf_recti* region, - S32 mask_bit, - GDrawStats* stats); -/* Start a masking operation on the given region for the specified mask bit. - - For most drivers, no special preparation is necessary to start masking, so - this is a no-op. -*/ - -IDOC typedef void RADLINK gdraw_draw_mask_end(gswf_recti* region, S32 mask_bit, - GDrawStats* stats); -/* End a masking operation on the given region for the specified mask bit. - - For most drivers, no special preparation is necessary to end masking, so this - is a no-op. -*/ - -//////////////////////////////////////////////////////////// -// -// GDraw API Function table -// -// idoc(parent,GDrawAPI_Base) - -IDOC struct GDrawFunctions { - // queries - gdraw_get_info* GetInfo; - - // drawing state - gdraw_set_view_size_and_world_scale* SetViewSizeAndWorldScale; - gdraw_render_tile_begin* RenderTileBegin; - gdraw_render_tile_end* RenderTileEnd; - gdraw_set_antialias_texture* SetAntialiasTexture; - - // drawing - gdraw_clear_stencil_bits* ClearStencilBits; - gdraw_clear_id* ClearID; - gdraw_filter_quad* FilterQuad; - gdraw_draw_indexed_triangles* DrawIndexedTriangles; - gdraw_make_texture_begin* MakeTextureBegin; - gdraw_make_texture_more* MakeTextureMore; - gdraw_make_texture_end* MakeTextureEnd; - gdraw_make_vertex_buffer_begin* MakeVertexBufferBegin; - gdraw_make_vertex_buffer_more* MakeVertexBufferMore; - gdraw_make_vertex_buffer_end* MakeVertexBufferEnd; - gdraw_try_to_lock_texture* TryToLockTexture; - gdraw_try_to_lock_vertex_buffer* TryToLockVertexBuffer; - gdraw_unlock_handles* UnlockHandles; - gdraw_free_texture* FreeTexture; - gdraw_free_vertex_buffer* FreeVertexBuffer; - gdraw_update_texture_begin* UpdateTextureBegin; - gdraw_update_texture_rect* UpdateTextureRect; - gdraw_update_texture_end* UpdateTextureEnd; - - // rendertargets - gdraw_texture_draw_buffer_begin* TextureDrawBufferBegin; - gdraw_texture_draw_buffer_end* TextureDrawBufferEnd; - - gdraw_describe_texture* DescribeTexture; - gdraw_describe_vertex_buffer* DescribeVertexBuffer; - - // new functions are always added at the end, so these have no structure - gdraw_set_texture_unique_id* SetTextureUniqueID; - - gdraw_draw_mask_begin* DrawMaskBegin; - gdraw_draw_mask_end* DrawMaskEnd; - - gdraw_rendering_begin* RenderingBegin; - gdraw_rendering_end* RenderingEnd; - - gdraw_make_texture_from_resource* MakeTextureFromResource; - gdraw_free_texture_from_resource* FreeTextureFromResource; - - gdraw_set_3d_transform* Set3DTransform; -}; -/* The function interface called by Iggy to render graphics on all - platforms. - - So that Iggy can integrate with the widest possible variety of - rendering scenarios, all of its renderer-specific drawing calls - go through this table of function pointers. This allows you - to dynamically configure which of RAD's supplied drawing layers - you wish to use, or to integrate it directly into your own - renderer by implementing your own versions of the drawing - functions Iggy requires. -*/ - -RADDEFEND - -#endif diff --git a/targets/app/windows/Iggy/include/iggy.h b/targets/app/windows/Iggy/include/iggy.h deleted file mode 100644 index bb84c5014..000000000 --- a/targets/app/windows/Iggy/include/iggy.h +++ /dev/null @@ -1,1639 +0,0 @@ -// Iggy -- Copyright 2008-2013 RAD Game Tools - -#ifndef __RAD_INCLUDE_IGGY_H__ -#define __RAD_INCLUDE_IGGY_H__ - -#include // size_t - -#define IggyVersion "1.2.30" -#define IggyFlashVersion "9,1,2,30" - -#include "rrCore.h" // base data types, macros - -RADDEFSTART - -#ifndef IGGY_GDRAW_SHARED_TYPEDEF - -#define IGGY_GDRAW_SHARED_TYPEDEF - -typedef struct GDrawFunctions GDrawFunctions; -typedef struct GDrawTexture GDrawTexture; - -#endif // IGGY_GDRAW_SHARED_TYPEDEF - -#define IDOCN // Used by documentation generation system - -//////////////////////////////////////////////////////////// -// -// Basic Operations -// - -typedef enum IggyResult { - IGGY_RESULT_SUCCESS = 0, - - IGGY_RESULT_Warning_None = 0, - - IGGY_RESULT_Warning_Misc = 100, - IGGY_RESULT_Warning_GDraw = 101, - IGGY_RESULT_Warning_ProgramFlow = 102, - IGGY_RESULT_Warning_Actionscript = 103, - IGGY_RESULT_Warning_Graphics = 104, - IGGY_RESULT_Warning_Font = 105, - IGGY_RESULT_Warning_Timeline = 106, - IGGY_RESULT_Warning_Library = 107, - IGGY_RESULT_Warning_ValuePath = 108, - IGGY_RESULT_Warning_Audio = 109, - - IGGY_RESULT_Warning_CannotSustainFrameRate = - 201, // During a call to $IggyPlayerReadyToTick, Iggy detected that its - // rendering of a Flash file was not keeping up with the frame - // rate requested. - IGGY_RESULT_Warning_ThrewException = 202, - - IGGY_RESULT_Error_Threshhold = 400, - - IGGY_RESULT_Error_Misc = 400, // an uncategorized error - IGGY_RESULT_Error_GDraw = 401, // an error occured in GDraw - IGGY_RESULT_Error_ProgramFlow = - 402, // an error occured with the user's program flow through the Iggy - // API (e.g. reentrancy issues) - IGGY_RESULT_Error_Actionscript = - 403, // an error occurred in Actionscript processing - IGGY_RESULT_Error_Graphics = 404, - IGGY_RESULT_Error_Font = 405, - IGGY_RESULT_Error_Create = 406, - IGGY_RESULT_Error_Library = 407, - IGGY_RESULT_Error_ValuePath = - 408, // an error occurred while processing a ValuePath - IGGY_RESULT_Error_Audio = 409, - - IGGY_RESULT_Error_Internal = 499, - - IGGY_RESULT_Error_InvalidIggy = 501, - IGGY_RESULT_Error_InvalidArgument = 502, - IGGY_RESULT_Error_InvalidEntity = 503, - IGGY_RESULT_Error_UndefinedEntity = 504, - - IGGY_RESULT_Error_OutOfMemory = - 1001, // Iggy ran out of memory while processing the SWF. The Iggy - // player is now invalid and you cannot do anything further with - // it (except read AS3 variables). Should this happen, you'll - // want to $IggyPlayerDestroy and reopen the $Iggy. -} IggyResult; - -typedef enum IggyDatatype { - IGGY_DATATYPE__invalid_request, // Set only when there is an error - - IGGY_DATATYPE_undefined, // Undefined data type - IGGY_DATATYPE_null, // No data type - IGGY_DATATYPE_boolean, // Data of type rrbool - - IGGY_DATATYPE_number, // Data of type F64 - IGGY_DATATYPE_string_UTF8, // Data of type $IggyStringUTF8 - IGGY_DATATYPE_string_UTF16, // Data of type $IggyStringUTF16 - IGGY_DATATYPE_fastname, // Only used when calling functions (avoids a copy - // operation) - IGGY_DATATYPE_valuepath, // Only used when calling functions - IGGY_DATATYPE_valueref, // Only used when calling functions - - // the following datatypes can be queried, but cannot appear - // as function arguments - - IGGY_DATATYPE_array, // Data of type Array in AS3 (appears in datatype - // query, never as arguments) - IGGY_DATATYPE_object, // Data of type Object (or a subclass) in AS3 - // (appears in datatype query, never as arguments) - IGGY_DATATYPE_displayobj, // Data of type DisplayObject (or a subclass) in - // AS3 (only appears in callbacks) - - IGGY_DATATYPE_xml, // Data of type XML or XMLList in AS3 (appears in - // datatype query, never as arguments) - - // the following datatypes also exists, but you can't access any data - // from within them. we give you the exact type for e.g. debugging - IGGY_DATATYPE_namespace, // Data of type Namespace in AS3 (appears in - // datatype query, never as arguments) - IGGY_DATATYPE_qname, // Data of type QName in AS3 (appears in datatype - // query, never as arguments) - IGGY_DATATYPE_function, // Data of type Function in AS3 (appears in - // datatype query, never as arguments) - IGGY_DATATYPE_class, // Data of type Class in AS3 (appears in datatype - // query, never as arguments) -} IggyDatatype; -/* Describes an AS3 datatype visible through iggy interface. */ - -#ifdef __RADWIN__ -#include -IDOCN typedef char IggyUTF16; -#else -typedef unsigned short IggyUTF16; -#endif - -typedef struct IggyStringUTF16 { - IggyUTF16* string; // Null-terminated, UTF16-encoded characters - S32 length; // Count of 16-bit characters in string, not including - // the null terminator -} IggyStringUTF16; - -typedef struct IggyStringUTF8 { - char* string; // Null-terminated, UTF8-encoded characters - S32 length; // Count of 8-bit bytes in string, not including the - // null terminator -} IggyStringUTF8; - -typedef UINTa IggyName; -typedef struct IggyValuePath IggyValuePath; -typedef void* IggyValueRef; -typedef UINTa IggyTempRef; - -typedef struct IggyDataValue { - S32 type; // an $IggyDatatype which determines which of the union members - // is valid. -#ifdef __RAD64__ - S32 padding; -#endif - IggyTempRef - temp_ref; // An opaque temporary reference which you can efficiently - // turn into an $IggyValueRef; this is written by Iggy on - // callbacks but never read by Iggy - union { - IggyStringUTF16 - string16; // A UTF16 string, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_string_UTF16) - IggyStringUTF8 string8; // A UTF8 string, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_string_UTF8) - F64 number; // A 64-bit floating point number (a double); valid if type - // = $(IggyDatatype::IGGY_DATATYPE_number) - rrbool boolval; // A boolean value, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_boolean) - IggyName - fastname; // A fast name, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_fastname); this is only - // an "in" type; Iggy will never define these itself - void* userdata; // A userdata pointer from a DisplayObject, valid if - // type = $(IggyDatatype::IGGY_DATATYPE_displayobj) - IggyValuePath* - valuepath; // A path to an object in the AS3 VM, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_valuepath); this is - // only an "in" type--Iggy will never output this - IggyValueRef - valueref; // An IggyValueRef, valid if type = - // $(IggyDatatype::IGGY_DATATYPE_valueref); this is only - // an "in" type--Iggy will never output this - }; -} IggyDataValue; - -typedef struct IggyExternalFunctionCallUTF16 { - IggyStringUTF16 function_name; // The name of the function - S32 num_arguments; // The number of arguments that must be passed to the - // function - S32 padding; - IggyDataValue arguments[1]; // The argument types, assumed to contain - // num_arguments elements -} IggyExternalFunctionCallUTF16; - -typedef struct IggyExternalFunctionCallUTF8 { - IggyStringUTF8 function_name; // The name of the function - S32 num_arguments; // The number of arguments that must be passed to the - // function - S32 padding; - IggyDataValue arguments[1]; // The argument types, assumed to contain - // num_arguments elements -} IggyExternalFunctionCallUTF8; - -typedef void* RADLINK Iggy_AllocateFunction(void* alloc_callback_user_data, - size_t size_requested, - size_t* size_returned); -typedef void RADLINK Iggy_DeallocateFunction(void* alloc_callback_user_data, - void* ptr); - -typedef struct IggyAllocator { - void* user_callback_data; - Iggy_AllocateFunction* mem_alloc; - Iggy_DeallocateFunction* mem_free; -#ifndef __RAD64__ - void* struct_padding; // pad to 8-byte boundary -#endif -} IggyAllocator; - -RADEXPFUNC void RADEXPLINK IggyInit(IggyAllocator* allocator); -RADEXPFUNC void RADEXPLINK IggyShutdown(void); - -typedef enum IggyConfigureBoolName { - IGGY_CONFIGURE_BOOL_StartupExceptionsAreWarnings, // if true, ActionScript - // exceptions thrown - // during startup will - // not prevent Iggy from - // being created (default - // false) - IGGY_CONFIGURE_BOOL_IgnoreFlashVersion, - IGGY_CONFIGURE_BOOL_NeverDelayGotoProcessing, - IGGY_CONFIGURE_BOOL_SuppressAntialiasingOnAllBitmaps, - IGGY_CONFIGURE_BOOL_SuppressAntialiasingOn9SliceBitmaps, -} IggyConfigureBoolName; - -RADEXPFUNC void RADEXPLINK IggyConfigureBool(IggyConfigureBoolName prop, - rrbool value); - -typedef enum { - IGGY_VERSION_1_0_21 = 1, // behavior from 1.0.21 and earlier - IGGY_VERSION_1_0_24 = 3, // behavior from 1.0.24 and earlier - IGGY_VERSION_1_1_1 = 5, // behavior from 1.1.1 and earlier - IGGY_VERSION_1_1_8 = 7, // behavior from 1.1.8 and earlier - IGGY_VERSION_1_2_28 = 9, // behavior from 1.2.28 and earlier - IGGY_VERSION_default = 0x7fffffff, // default (current) Iggy behavior -} IggyVersionNumber; - -typedef enum { - IGGY_VERSIONED_BEHAVIOR_movieclip_gotoand = - 128, // This changes the behavior of AS3 gotoAndPlay and gotoAndStop. - // Valid values: IGGY_VERSION_1_0_21, IGGY_VERSION_default - IGGY_VERSIONED_BEHAVIOR_textfield_position = - 129, // This changes the behavior of textfield positioning as reported - // by AS3 getBounds/getRect and width/height. Values with - // different behavior: IGGY_VERSION_1_0_24, IGGY_VERSION_default. - IGGY_VERSIONED_BEHAVIOR_bitmap_smoothing = 130, - IGGY_VERSIONED_BEHAVIOR_textfield_autoscroll = - 131, // This makes textfield autoscrolling behave specially: Valid - // values: IGGY_VERSION_1_1_8, IGGY_VERSION_default - IGGY_VERSIONED_BEHAVIOR_fast_text_effects = - 132, // This fixes the behavior of fast text effects to be in the - // correct direction; Valid values: IGGY_VERSION_1_2_28, - // IGGY_VERSION_default -} IggyVersionedBehaviorName; - -RADEXPFUNC void RADEXPLINK IggyConfigureVersionedBehavior( - IggyVersionedBehaviorName prop, IggyVersionNumber value); - -typedef enum IggyTelemetryAmount { - IGGY_TELEMETRY_normal, // Normal amount for users debugging applications - // using Iggy - IGGY_TELEMETRY_internal, // Shows more internal details, useful when - // optimizing Iggy itself -} IggyTelemetryAmount; - -RADEXPFUNC void RADEXPLINK IggyUseTmLite(void* context, - IggyTelemetryAmount amount); -RADEXPFUNC void RADEXPLINK IggyUseTelemetry(void* context, - IggyTelemetryAmount amount); - -//////////////////////////////////////////////////////////// -// -// Translation -// - -typedef struct { - IggyUTF16* object_name; /* null-terminated Textfield.name value at the time - the text is set */ - rrbool autosize; /* true if the autosize value is non-zero at the time the - text is set */ - F32 width; /* the objectspace width of the textfield at the time the text is - set */ - F32 height; /* the objectspace height of the textfield at the time the text - is set */ - rrbool is_html_text; /* whether the provided text is going through - Textfield.htmlText or Textfield.text */ -} IggyTextfieldInfo; - -typedef void RADLINK Iggy_TranslationFreeFunction(void* callback_data, - void* data, S32 length); -typedef rrbool RADLINK Iggy_TranslateFunctionUTF16(void* callback_data, - IggyStringUTF16* src, - IggyStringUTF16* dest); -typedef rrbool RADLINK Iggy_TranslateFunctionUTF8(void* callback_data, - IggyStringUTF8* src, - IggyStringUTF8* dest); -typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF16( - void* callback_data, IggyStringUTF16* src, IggyStringUTF16* dest, - IggyTextfieldInfo* textfield); -typedef rrbool RADLINK Iggy_TextfieldTranslateFunctionUTF8( - void* callback_data, IggyStringUTF8* src, IggyStringUTF8* dest, - IggyTextfieldInfo* textfield); - -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunction( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF16( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetLoadtimeTranslationFunctionUTF8( - Iggy_TranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunction( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF16( - Iggy_TranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetRuntimeTranslationFunctionUTF8( - Iggy_TranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF16( - Iggy_TextfieldTranslateFunctionUTF16* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextfieldTranslationFunctionUTF8( - Iggy_TextfieldTranslateFunctionUTF8* func, void* callback_data, - Iggy_TranslationFreeFunction* freefunc, void* free_callback_data); - -typedef enum { - IGGY_LANG_default, - IGGY_LANG_ja, - IGGY_LANG_ja_flash, // more strictly matches Flash -} IggyLanguageCode; - -RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); - -//////////////////////////////////////////////////////////// -// -// Playback -// - -typedef struct Iggy Iggy; -typedef S32 IggyLibrary; - -typedef void RADLINK Iggy_TraceFunctionUTF16(void* user_callback_data, - Iggy* player, - IggyUTF16 const* utf16_string, - S32 length_in_16bit_chars); -typedef void RADLINK Iggy_TraceFunctionUTF8(void* user_callback_data, - Iggy* player, - char const* utf8_string, - S32 length_in_bytes); -typedef void RADLINK Iggy_WarningFunction(void* user_callback_data, - Iggy* player, IggyResult error_code, - char const* error_message); - -typedef struct { - S32 total_storage_in_bytes; // the total memory to use for the AS3 heap and - // garbage collector - S32 stack_size_in_bytes; // size of the stack used for AS3 expression - // evaluation and function activation records - S32 young_heap_size_in_bytes; // size of the heap from which initial - // allocations are made - S32 old_heap_size_in_bytes; // this parameter is not supported yet - S32 remembered_set_size_in_bytes; // storage used to keep track of pointers - // from old heap to young heap - S32 greylist_size_in_bytes; // storage used to keep track of - // partially-garbage collected objects on the - // old heap - S32 rootstack_size_in_bytes; // size of the stack used for exposing - // temporaries to the garbage collector - S32 padding; -} IggyPlayerGCSizes; - -typedef struct { - IggyAllocator allocator; - IggyPlayerGCSizes gc; - char* filename; - char* user_name; - rrbool load_in_place; - rrbool did_load_in_place; -} IggyPlayerConfig; - -RADEXPFUNC Iggy* RADEXPLINK IggyPlayerCreateFromFileAndPlay( - char const* filename, IggyPlayerConfig const* config); - -RADEXPFUNC Iggy* RADEXPLINK IggyPlayerCreateFromMemory( - void const* data, U32 data_size_in_bytes, IggyPlayerConfig* config); - -#define IGGY_INVALID_LIBRARY -1 - -RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemory( - char const* url_utf8_null_terminated, void const* data, - U32 data_size_in_bytes, IggyPlayerConfig* config); - -RADEXPFUNC IggyLibrary RADEXPLINK IggyLibraryCreateFromMemoryUTF16( - IggyUTF16 const* url_utf16_null_terminated, void const* data, - U32 data_size_in_bytes, IggyPlayerConfig* config); - -RADEXPFUNC void RADEXPLINK IggyPlayerDestroy(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyLibraryDestroy(IggyLibrary lib); -RADEXPFUNC void RADEXPLINK IggySetWarningCallback(Iggy_WarningFunction* error, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF8( - Iggy_TraceFunctionUTF8* trace_utf8, void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTraceCallbackUTF16( - Iggy_TraceFunctionUTF16* trace_utf16, void* user_callback_data); - -typedef struct IggyProperties { - S32 movie_width_in_pixels; // the width of the "document" specified in the - // SWF file - S32 movie_height_in_pixels; // the height of the "document" specified in - // the SWF file - - F32 movie_frame_rate_current_in_fps; // the current frame rate Iggy is - // trying to achieve for the file - F32 movie_frame_rate_from_file_in_fps; // the frame rate specified in the - // SWF file - - S32 frames_passed; // the number of times Tick() has been called - S32 swf_major_version_number; // the major SWF version number of the file, - // currently always 9 - - F64 time_passed_in_seconds; // the total time passed since starting the - // file - F64 seconds_since_last_tick; // the number of seconds that have ocurred - F64 seconds_per_drawn_frame; // 1/render fps, updated on - // $IggyPlayerDrawTilesStart -} IggyProperties; - -RADEXPFUNC IggyProperties* RADEXPLINK IggyPlayerProperties(Iggy* player); - -typedef enum { - IGGY_PAUSE_continue_audio, - IGGY_PAUSE_pause_audio, - IGGY_PAUSE_stop_audio -} IggyAudioPauseMode; - -RADEXPFUNC void* RADEXPLINK IggyPlayerGetUserdata(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerSetUserdata(Iggy* player, void* userdata); - -RADEXPFUNC void RADEXPLINK IggyPlayerInitializeAndTickRS(Iggy* player); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerReadyToTick(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerTickRS(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerPause(Iggy* player, - IggyAudioPauseMode pause_audio); -RADEXPFUNC void RADEXPLINK IggyPlayerPlay(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFrameRate(Iggy* player, - F32 frame_rate_in_fps); -RADEXPFUNC void RADEXPLINK IggyPlayerGotoFrameRS(Iggy* f, S32 frame, - rrbool stop); - -#ifndef __RAD_HIGGYEXP_ -#define __RAD_HIGGYEXP_ -typedef void* HIGGYEXP; -/* An IggyExplorer context, it represents a connection to Iggy Explorer. */ -#endif - -#ifndef __RAD_HIGGYPERFMON_ -#define __RAD_HIGGYPERFMON_ -typedef void* HIGGYPERFMON; -/* An IggyPerfMon context */ -#endif - -IDOCN typedef void RADLINK iggyexp_detach_callback(void* ptr); - -IDOCN typedef struct { - U64 tick_ticks; - U64 draw_ticks; -} IggyPerfmonStats; - -IDOCN typedef struct { - void(RADLINK* get_stats)(Iggy* swf, IggyPerfmonStats* pdest); - const char*(RADLINK* get_display_name)(Iggy* swf); -} IggyForPerfmonFunctions; - -// This is used by both Iggy Explorer and Perfmon -IDOCN typedef struct { - rrbool(RADLINK* connection_valid)( - Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy - // Explorer is still connected - S32(RADLINK* poll_command) - (Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes - void(RADLINK* send_command)( - Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, - S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage) - (Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands - rrbool(RADLINK* attach)( - Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, - IggyForPerfmonFunctions* - pmf); // an Iggy file is trying to attach itself to this connection - // (one at a time) - rrbool(RADLINK* detach)( - Iggy* swf, HIGGYEXP iggyexp); // the current Iggy file should be - // detached (generate callback) - void(RADLINK* draw_tile_hook)( - Iggy* swf, HIGGYEXP iggyexp, - GDrawFunctions* iggy_gdraw); // only used by perfmon -} IggyExpFunctions; - -RADEXPFUNC void RADEXPLINK IggyInstallPerfmon(void* perfmon_context); - -RADEXPFUNC void RADEXPLINK IggyUseExplorer(Iggy* swf, void* context); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSendFrameToExplorer(Iggy* f); - -//////////////////////////////////////////////////////////// -// -// Fonts -// - -typedef struct { - F32 ascent; - F32 descent; - F32 line_gap; - F32 average_glyph_width_for_tab_stops; // for embedded fonts, Iggy uses - // width of 'g' - F32 largest_glyph_bbox_y1; -} IggyFontMetrics; - -typedef struct { - F32 x0, y0, x1, y1; // bounding box - F32 advance; // distance to move origin after this character -} IggyGlyphMetrics; - -typedef enum { - IGGY_VERTEX_move = 1, - IGGY_VERTEX_line = 2, - IGGY_VERTEX_curve = 3, -} IggyShapeVertexType; - -typedef struct { - F32 x, y; // if IGGY_VERTEX_move, point to start a new loop; if - // IGGY_VERTEX_line/curve, endpoint of segment - F32 cx, cy; // if IGGY_VERTEX_curve, control point on segment; ignored - // otherwise - U8 type; // value from $IggyShapeVertexType - - S8 padding; // ignore - U16 f0; // set to 1 - U16 f1; // set to 0 - U16 line; // ignore -} IggyShapeVertex; - -typedef struct { - IggyShapeVertex* vertices; - S32 num_vertices; - void* user_context_for_free; // you can use this to store data to access on - // the corresponding free call -} IggyVectorShape; - -typedef struct { - U8* pixels_one_per_byte; // pixels from the top left, 0 is transparent and - // 255 is opaque - S32 width_in_pixels; // this is the actual width of the bitmap data - S32 height_in_pixels; // this is the actual height of the bitmap data - S32 stride_in_bytes; // the distance from one row to the next - S32 oversample; // this is the amount of oversampling (0 or 1 = not - // oversample, 2 = 2x oversampled, 4 = 4x oversampled) - rrbool point_sample; // if true, the bitmap will be drawn with point - // sampling; if false, it will be drawn with bilinear - S32 top_left_x; // the offset of the top left corner from the character - // origin - S32 top_left_y; // the offset of the top left corner from the character - // origin - F32 pixel_scale_correct; // the pixel_scale at which this character should - // be displayed at width_in_pixels - F32 pixel_scale_min; // the smallest pixel_scale to allow using this - // character (scaled down) - F32 pixel_scale_max; // the largest pixels cale to allow using this - // character (scaled up) - void* user_context_for_free; // you can use this to store data to access on - // the corresponding free call -} IggyBitmapCharacter; - -typedef IggyFontMetrics* RADLINK -IggyFontGetFontMetrics(void* user_context, IggyFontMetrics* metrics); - -#define IGGY_GLYPH_INVALID -1 -typedef S32 RADLINK IggyFontGetCodepointGlyph(void* user_context, - U32 codepoint); -typedef IggyGlyphMetrics* RADLINK IggyFontGetGlyphMetrics( - void* user_context, S32 glyph, IggyGlyphMetrics* metrics); -typedef rrbool RADLINK IggyFontIsGlyphEmpty(void* user_context, S32 glyph); -typedef F32 RADLINK IggyFontGetKerningForGlyphPair(void* user_context, - S32 first_glyph, - S32 second_glyph); - -typedef void RADLINK IggyVectorFontGetGlyphShape(void* user_context, S32 glyph, - IggyVectorShape* shape); -typedef void RADLINK IggyVectorFontFreeGlyphShape(void* user_context, S32 glyph, - IggyVectorShape* shape); - -typedef rrbool RADLINK IggyBitmapFontCanProvideBitmap(void* user_context, - S32 glyph, - F32 pixel_scale); -typedef rrbool RADLINK -IggyBitmapFontGetGlyphBitmap(void* user_context, S32 glyph, F32 pixel_scale, - IggyBitmapCharacter* bitmap); -typedef void RADLINK IggyBitmapFontFreeGlyphBitmap(void* user_context, - S32 glyph, F32 pixel_scale, - IggyBitmapCharacter* bitmap); - -typedef struct { - IggyFontGetFontMetrics* get_font_metrics; - - IggyFontGetCodepointGlyph* get_glyph_for_codepoint; - IggyFontGetGlyphMetrics* get_glyph_metrics; - IggyFontIsGlyphEmpty* is_empty; - IggyFontGetKerningForGlyphPair* get_kerning; - - IggyVectorFontGetGlyphShape* get_shape; - IggyVectorFontFreeGlyphShape* free_shape; - - S32 num_glyphs; - - void* userdata; -} IggyVectorFontProvider; - -typedef struct { - IggyFontGetFontMetrics* get_font_metrics; - - IggyFontGetCodepointGlyph* get_glyph_for_codepoint; - IggyFontGetGlyphMetrics* get_glyph_metrics; - IggyFontIsGlyphEmpty* is_empty; - IggyFontGetKerningForGlyphPair* get_kerning; - - IggyBitmapFontCanProvideBitmap* can_bitmap; - IggyBitmapFontGetGlyphBitmap* get_bitmap; - IggyBitmapFontFreeGlyphBitmap* free_bitmap; - - S32 num_glyphs; - - void* userdata; -} IggyBitmapFontProvider; - -typedef struct { - IggyBitmapFontCanProvideBitmap* can_bitmap; - IggyBitmapFontGetGlyphBitmap* get_bitmap; - IggyBitmapFontFreeGlyphBitmap* free_bitmap; - void* userdata; -} IggyBitmapFontOverride; - -RADEXPFUNC void RADEXPLINK IggySetInstalledFontMaxCount(S32 num); -RADEXPFUNC void RADEXPLINK IggySetIndirectFontMaxCount(S32 num); - -#define IGGY_FONTFLAG_none 0 -#define IGGY_FONTFLAG_bold 1 -#define IGGY_FONTFLAG_italic 2 -#define IGGY_FONTFLAG_all (~0U) // indirection only - -#define IGGY_TTC_INDEX_none 0 - -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF8( - const void* truetype_storage, S32 ttc_index, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeUTF16( - const void* truetype_storage, S32 ttc_index, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF8( - const char* fontname, S32 len, U32 fontflags, S32 fallback_codepoint); -RADEXPFUNC void RADEXPLINK IggyFontInstallTruetypeFallbackCodepointUTF16( - const U16* fontname, S32 len, U32 fontflags, S32 fallback_codepoint); -RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF8( - const IggyVectorFontProvider* vfp, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallVectorUTF16( - const IggyVectorFontProvider* vfp, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF8( - const IggyBitmapFontProvider* bmf, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapUTF16( - const IggyBitmapFontProvider* bmf, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF8( - const IggyBitmapFontOverride* bmf, const char* fontname, - S32 namelen_in_bytes, U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontInstallBitmapOverrideUTF16( - const IggyBitmapFontOverride* bmf, const U16* fontname, - S32 namelen_in_16bit_quantities, U32 fontflags); - -RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF8(const char* fontname, - S32 namelen_in_bytes, - U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontRemoveUTF16(const U16* fontname, - S32 namelen_in_16bit_quantities, - U32 fontflags); - -RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF8( - const char* request_name, S32 request_namelen, U32 request_flags, - const char* result_name, S32 result_namelen, U32 result_flags); -RADEXPFUNC void RADEXPLINK IggyFontSetIndirectUTF16( - const U16* request_name, S32 request_namelen, U32 request_flags, - const U16* result_name, S32 result_namelen, U32 result_flags); - -RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF8(const char* fontname, - S32 fontname_len, - U32 fontflags); -RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16* fontname, - S32 fontname_len, - U32 fontflags); - -//////////////////////////////////////////////////////////// -// -// Audio -// - -struct _RadSoundSystem; -IDOCN typedef S32 (*IGGYSND_OPEN_FUNC)(struct _RadSoundSystem* i_SoundSystem, - U32 i_MinBufferSizeInMs, U32 i_Frequency, - U32 i_ChannelCount, U32 i_MaxLockSize, - U32 i_Flags); - -IDOCN RADEXPFUNC void RADEXPLINK -IggyAudioSetDriver(IGGYSND_OPEN_FUNC driver_open, U32 flags); - -// These functions cause Iggy to use a specific audio API, most of which -// are only actually defined on one target platform. Probably, you'll just -// want to call IggyAudioUseDefault. - -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseDirectSound(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseWaveOut(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseXAudio2(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseLibAudio(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseAX(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyAudioUseCoreAudio(void); - -RADEXPFUNC void RADEXPLINK IggyAudioUseDefault(void); - -#ifndef __RAD_DEFINE_IGGYMP3__ -#define __RAD_DEFINE_IGGYMP3__ -IDOCN typedef struct IggyMP3Interface IggyMP3Interface; -IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface* decoder); -#endif - -#ifdef __RADNT__ -RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); -RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char* path); -RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(char* path); -#else -// this is overkill for non-DLL implementations, which could call into Iggy -// directly, but it means everything goes through the same indirection -// internally -IDOCN RADEXPFUNC IggyGetMP3Decoder* RADEXPLINK IggyAudioGetMP3Decoder(void); -IDOCN RADEXPFUNC void RADEXPLINK -IggyAudioInstallMP3DecoderExplicit(IggyGetMP3Decoder* init); - -#define IggyAudioInstallMP3Decoder() \ - IggyAudioInstallMP3DecoderExplicit(IggyAudioGetMP3Decoder()) IDOCN -#endif - -RADEXPFUNC rrbool RADEXPLINK IggyAudioSetMaxBufferTime(S32 ms); -RADEXPFUNC void RADEXPLINK IggyAudioSetLatency(S32 ms); -RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioVolume(Iggy* iggy, - F32 attenuation); - -#define IGGY_AUDIODEVICE_default 0 -#define IGGY_AUDIODEVICE_primary 1 -#define IGGY_AUDIODEVICE_secondary 2 - -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSetAudioDevice(Iggy* iggy, - S32 device); - -//////////////////////////////////////////////////////////// -// -// Rendering -// - -typedef struct IggyCustomDrawCallbackRegion { - IggyUTF16* name; // the name of the DisplayObject being substituted - F32 x0, y0, x1, - y1; // the bounding box of the original DisplayObject, in object space - F32 rgba_mul[4]; // any multiplicative color effect specified for the - // DisplayObject or its parents - F32 rgba_add[4]; // any additive color effect specified for the - // DisplayObject or its parents - S32 scissor_x0, scissor_y0, scissor_x1, - scissor_y1; // optional scissor rect box - U8 scissor_enable; // if non-zero, clip to the scissor rect - U8 stencil_func_mask; // D3DRS_STENCILMASK or equivalent - U8 stencil_func_ref; // D3DRS_STENCILREF or equivalent - U8 stencil_write_mask; // if non-zero, D3DRS_STENCILWRITEMASK or equivalent - struct gswf_matrix* o2w; // Iggy object-to-world matrix (used internally) -} IggyCustomDrawCallbackRegion; - -typedef void RADLINK -Iggy_CustomDrawCallback(void* user_callback_data, Iggy* player, - IggyCustomDrawCallbackRegion* Region); -typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallback( - void* user_callback_data, IggyUTF16* texture_name, S32* width, S32* height, - void** destroy_callback_data); -typedef void RADLINK Iggy_TextureSubstitutionDestroyCallback( - void* user_callback_data, void* destroy_callback_data, - GDrawTexture* handle); -typedef GDrawTexture* RADLINK Iggy_TextureSubstitutionCreateCallbackUTF8( - void* user_callback_data, char* texture_name, S32* width, S32* height, - void** destroy_callback_data); - -RADEXPFUNC void RADEXPLINK IggySetCustomDrawCallback( - Iggy_CustomDrawCallback* custom_draw, void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacks( - Iggy_TextureSubstitutionCreateCallback* texture_create, - Iggy_TextureSubstitutionDestroyCallback* texture_destroy, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetTextureSubstitutionCallbacksUTF8( - Iggy_TextureSubstitutionCreateCallbackUTF8* texture_create, - Iggy_TextureSubstitutionDestroyCallback* texture_destroy, - void* user_callback_data); - -typedef enum { - IGGY_FLUSH_no_callback, // do not generate the - // $Iggy_TextureSubstitutionDestroyCallback - IGGY_FLUSH_destroy_callback, // do generate the - // $Iggy_TextureSubstitutionDestroyCallback -} IggyTextureSubstitutionFlushMode; - -RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlush( - GDrawTexture* handle, IggyTextureSubstitutionFlushMode do_destroy_callback); -RADEXPFUNC void RADEXPLINK IggyTextureSubstitutionFlushAll( - IggyTextureSubstitutionFlushMode do_destroy_callback); - -RADEXPFUNC void RADEXPLINK IggySetGDraw(GDrawFunctions* gdraw); -RADEXPFUNC void RADEXPLINK IggyPlayerGetBackgroundColor(Iggy* player, - F32 output_color[3]); - -typedef enum { - IGGY_ROTATION_0_degrees = 0, - IGGY_ROTATION_90_degrees_counterclockwise = 1, - IGGY_ROTATION_180_degrees = 2, - IGGY_ROTATION_90_degrees_clockwise = 3, -} Iggy90DegreeRotation; - -RADEXPFUNC void RADEXPLINK IggyPlayerSetDisplaySize(Iggy* f, S32 w, S32 h); -RADEXPFUNC void RADEXPLINK IggyPlayerSetPixelShape(Iggy* swf, F32 pixel_x, - F32 pixel_y); -RADEXPFUNC void RADEXPLINK IggyPlayerSetStageRotation(Iggy* f, - Iggy90DegreeRotation rot); -RADEXPFUNC void RADEXPLINK IggyPlayerDraw(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerSetStageSize(Iggy* f, S32 w, S32 h); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFaux3DStage(Iggy* f, F32* top_left, - F32* top_right, - F32* bottom_left, - F32* bottom_right, - F32 depth_scale); -RADEXPFUNC void RADEXPLINK IggyPlayerForceMipmaps(Iggy* f, - rrbool force_mipmaps); - -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTile(Iggy* f, S32 x0, S32 y0, S32 x1, - S32 y1, S32 padding); -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesStart(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerDrawTilesEnd(Iggy* f); -RADEXPFUNC void RADEXPLINK IggyPlayerSetRootTransform(Iggy* f, F32 mat[4], - F32 tx, F32 ty); -RADEXPFUNC void RADEXPLINK IggyPlayerFlushAll(Iggy* player); -RADEXPFUNC void RADEXPLINK IggyLibraryFlushAll(IggyLibrary h); -RADEXPFUNC void RADEXPLINK IggySetTextCursorPixelWidth(S32 width); -RADEXPFUNC void RADEXPLINK IggyForceBitmapSmoothing(rrbool force_on); -RADEXPFUNC void RADEXPLINK IggyFlushInstalledFonts(void); -RADEXPFUNC void RADEXPLINK IggyFastTextFilterEffects(rrbool enable); - -typedef enum IggyAntialiasing { - IGGY_ANTIALIASING_FontsOnly = 2, // Anti-aliasing of bitmapped fonts only - IGGY_ANTIALIASING_FontsAndLinesOnly = - 4, // Anti-aliasing of fonts and lines, but nothing else - IGGY_ANTIALIASING_PrettyGood = - 8, // High-quality anti-aliasing on everything, but no rendertargets - // required - IGGY_ANTIALIASING_Good = - 10, // High-quality anti-aliasing on everything (on platforms where - // GDraw doesn't support rendertargets, such as the Wii, this - // behaves the same as PrettyGood) -} IggyAntialiasing; - -RADEXPFUNC void RADEXPLINK -IggyPlayerSetAntialiasing(Iggy* f, IggyAntialiasing antialias_mode); - -RADEXPFUNC void RADEXPLINK -IggyPlayerSetBitmapFontCaching(Iggy* f, S32 tex_w, S32 tex_h, - S32 max_char_pix_width, S32 max_char_pix_height); - -RADEXPFUNC void RADEXPLINK -IggySetFontCachingCalculationBuffer(S32 max_chars, void* optional_temp_buffer, - S32 optional_temp_buffer_size_in_bytes); - -typedef struct IggyGeneric IggyGeneric; - -RADEXPFUNC IggyGeneric* RADEXPLINK IggyPlayerGetGeneric(Iggy* player); -RADEXPFUNC IggyGeneric* RADEXPLINK IggyLibraryGetGeneric(IggyLibrary lib); - -// each texture metadata block contains one of these, where -// texture_info is an array of per-format data -IDOCN typedef struct { - U16 num_textures; - U16 load_alignment_log2; - U32 texture_file_size; - void* texture_info; -} IggyTextureResourceMetadata; - -RADEXPFUNC void RADEXPLINK IggyGenericInstallResourceFile(IggyGeneric* g, - void* data, - S32 data_length, - rrbool* can_free_now); -RADEXPFUNC IggyTextureResourceMetadata* RADEXPLINK -IggyGenericGetTextureResourceMetadata(IggyGeneric* f); -RADEXPFUNC void RADEXPLINK -IggyGenericSetTextureFromResource(IggyGeneric* f, U16 id, GDrawTexture* handle); - -// this is the encoding for the "raw" texture type, which doesn't -// depend on any platform headers -typedef enum { - IFT_FORMAT_rgba_8888, - IFT_FORMAT_rgba_4444_LE, - IFT_FORMAT_rgba_5551_LE, - IFT_FORMAT_la_88, - IFT_FORMAT_la_44, - IFT_FORMAT_i_8, - IFT_FORMAT_i_4, - IFT_FORMAT_l_8, - IFT_FORMAT_l_4, - IFT_FORMAT_DXT1, - IFT_FORMAT_DXT3, - IFT_FORMAT_DXT5, -} IggyFileTexture_Format; - -typedef struct { - U32 file_offset; - U8 format; - U8 mipmaps; - U16 w, h; - U16 swf_id; -} IggyFileTextureRaw; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U16 padding; - struct { - U32 data[13]; - } texture; -} IggyFileTexture360; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data[6]; - } texture; -} IggyFileTexturePS3; - -IDOCN typedef struct { - U32 file_offset1; - U32 file_offset2; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data1[39]; - } texture; -} IggyFileTextureWiiu; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 data[8]; - } texture; -} IggyFileTexturePS4; - -IDOCN typedef struct { - U32 file_offset; - U16 swf_id; - U8 format; - U8 padding; - struct { - U32 format; - U32 type; - U16 width; - U16 height; - U8 mip_count; - U8 pad[3]; - } texture; -} IggyFileTexturePSP2; - -//////////////////////////////////////////////////////////// -// -// AS3 -// - -typedef rrbool RADLINK Iggy_AS3ExternalFunctionUTF8( - void* user_callback_data, Iggy* player, IggyExternalFunctionCallUTF8* call); -typedef rrbool RADLINK -Iggy_AS3ExternalFunctionUTF16(void* user_callback_data, Iggy* player, - IggyExternalFunctionCallUTF16* call); - -RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF8( - Iggy_AS3ExternalFunctionUTF8* as3_external_function_utf8, - void* user_callback_data); -RADEXPFUNC void RADEXPLINK IggySetAS3ExternalFunctionCallbackUTF16( - Iggy_AS3ExternalFunctionUTF16* as3_external_function_utf16, - void* user_callback_data); -RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastName(Iggy* f, - IggyUTF16 const* name, - S32 len); -RADEXPFUNC IggyName RADEXPLINK IggyPlayerCreateFastNameUTF8(Iggy* f, - char const* name, - S32 len); -RADEXPFUNC IggyResult RADEXPLINK IggyPlayerCallFunctionRS(Iggy* player, - IggyDataValue* result, - IggyName function, - S32 numargs, - IggyDataValue* args); -RADEXPFUNC IggyResult RADEXPLINK -IggyPlayerCallMethodRS(Iggy* f, IggyDataValue* result, IggyValuePath* target, - IggyName methodname, S32 numargs, IggyDataValue* args); -RADEXPFUNC void RADEXPLINK IggyPlayerGarbageCollect(Iggy* player, S32 strength); - -#define IGGY_GC_MINIMAL 0 -#define IGGY_GC_NORMAL 30 -#define IGGY_GC_MAXIMAL 100 - -typedef struct { - U32 young_heap_size; // the size of the young heap is the smaller of this - // number and the size the young heap was originally - // allocated when the Iggy was created - U32 base_old_amount; // the base number of words to process on each minor - // cycle, default 200 - F32 old_heap_fraction; // the fraction 0..1 (default 0.125) of the - // outstanding allocations from the last major GC - // cycle to traverse during one GC cycle - F32 new_allocation_multiplier; // a number from 1..infinity (default 2) - // which is the amount of the allocations in - // the last cycle to traverse - F32 sweep_multiplier; // a positive number (default 2) which weights the - // amount of data swept vs marked -} IggyGarbageCollectorControl; - -typedef enum { - IGGY_GC_EVENT_tenure, - IGGY_GC_EVENT_mark_increment, - IGGY_GC_EVENT_mark_roots, - IGGY_GC_EVENT_sweep_finalize, - IGGY_GC_EVENT_sweep_increment, - IGGY_GC_WARNING_greylist_overflow, // the grey list overflowed, increase - // the size of - // $(IggyPlayerGCSizes::greylist_size_in_bytes). - IGGY_GC_WARNING_remembered_overflow, // the remembered set overflowed, - // increase the size of - // $(IggyPlayerGCSizes::remembered_set_size_in_bytes). -} IggyGarbageCollectionEvent; - -typedef struct { - U64 event_time_in_microseconds; - U64 total_marked_bytes; // total bytes ever marked by the GC - U64 total_swept_bytes; // total bytes ever swept by the GC - U64 total_allocated_bytes; // total bytes ever allocated from the old heap - U64 total_gc_time_in_microseconds; // total time spent in GC while notify - // callback was active - - char* name; - - IggyGarbageCollectionEvent - event; // the type of garbage collection event that was just performed - - U32 increment_processing_bytes; // the number of bytes that were processed - // in that event - - U32 last_slice_tenured_bytes; // the number of bytes that were tenured from - // young-to-old heap since the previous GC - // step - U32 last_slice_old_allocation_bytes; // the number of bytes that were - // tenured or were directly allocated - // from the old heap since the - // previous GC step - - U32 heap_used_bytes; // the number of bytes in use in the old heap (the - // young heap is empty) - U32 heap_size_bytes; // the number of bytes allocated for the old heap - - U32 onstage_display_objects; // the number of on-stage display objects - // (MovieClips, TextFields, Shapes, etc) - // visited during tenuring only - U32 offstage_display_objects; // the number of off-stage display objects - // visited during tenuring only -} IggyGarbageCollectionInfo; - -typedef void RADLINK -Iggy_GarbageCollectionCallback(Iggy* player, IggyGarbageCollectionInfo* info); -RADEXPFUNC void RADEXPLINK IggyPlayerConfigureGCBehavior( - Iggy* player, Iggy_GarbageCollectionCallback* notify_callack, - IggyGarbageCollectorControl* control); -RADEXPFUNC void RADEXPLINK IggyPlayerQueryGCSizes(Iggy* player, - IggyPlayerGCSizes* sizes); - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetValid(Iggy* f); - -IDOCN struct IggyValuePath { - Iggy* f; - IggyValuePath* parent; - // align 0 mod 8 - IggyName name; - IggyValueRef ref; - // align 0 mod 8 - S32 index; - S32 type; - // align 0 mod 8 -}; - -typedef enum { - IGGY_ValueRef, - IGGY_ValueRef_Weak, -} IggyValueRefType; - -RADEXPFUNC rrbool RADEXPLINK IggyValueRefCheck(IggyValueRef ref); -RADEXPFUNC void RADEXPLINK IggyValueRefFree(Iggy* p, IggyValueRef ref); -RADEXPFUNC IggyValueRef RADEXPLINK -IggyValueRefFromPath(IggyValuePath* var, IggyValueRefType reftype); -RADEXPFUNC rrbool RADEXPLINK -IggyIsValueRefSameObjectAsTempRef(IggyValueRef value_ref, IggyTempRef temp_ref); -RADEXPFUNC rrbool RADEXPLINK IggyIsValueRefSameObjectAsValuePath( - IggyValueRef value_ref, IggyValuePath* path, IggyName sub_name, - char const* sub_name_utf8); -RADEXPFUNC void RADEXPLINK IggySetValueRefLimit(Iggy* f, S32 max_value_refs); -RADEXPFUNC S32 RADEXPLINK IggyDebugGetNumValueRef(Iggy* f); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateArray(Iggy* f, - S32 num_slots); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefCreateEmptyObject(Iggy* f); -RADEXPFUNC IggyValueRef RADEXPLINK IggyValueRefFromTempRef( - Iggy* f, IggyTempRef temp_ref, IggyValueRefType reftype); - -RADEXPFUNC IggyValuePath* RADEXPLINK IggyPlayerRootPath(Iggy* f); -RADEXPFUNC IggyValuePath* RADEXPLINK IggyPlayerCallbackResultPath(Iggy* f); -RADEXPFUNC rrbool RADEXPLINK IggyValuePathMakeNameRef(IggyValuePath* result, - IggyValuePath* parent, - char const* text_utf8); -RADEXPFUNC void RADEXPLINK IggyValuePathFromRef(IggyValuePath* result, - Iggy* iggy, IggyValueRef ref); - -RADEXPFUNC void RADEXPLINK IggyValuePathMakeNameRefFast(IggyValuePath* result, - IggyValuePath* parent, - IggyName name); -RADEXPFUNC void RADEXPLINK IggyValuePathMakeArrayRef(IggyValuePath* result, - IggyValuePath* array_path, - int array_index); - -RADEXPFUNC void RADEXPLINK IggyValuePathSetParent(IggyValuePath* result, - IggyValuePath* new_parent); -RADEXPFUNC void RADEXPLINK IggyValuePathSetArrayIndex(IggyValuePath* result, - int new_index); - -RADEXPFUNC void RADEXPLINK IggyValuePathSetName(IggyValuePath* result, - IggyName name); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetTypeRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - IggyDatatype* result); - -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF64RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F64* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetF32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetS32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - S32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetU32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - U32* result); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF8RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - S32 max_result_len, char* utf8_result, S32* result_len); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetStringUTF16RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - S32 max_result_len, IggyUTF16* utf16_result, S32* result_len); -RADEXPFUNC IggyResult RADEXPLINK -IggyValueGetBooleanRS(IggyValuePath* var, IggyName sub_name, - char const* sub_name_utf8, rrbool* result); -RADEXPFUNC IggyResult RADEXPLINK -IggyValueGetArrayLengthRS(IggyValuePath* var, IggyName sub_name, - char const* sub_name_utf8, S32* result); - -RADEXPFUNC rrbool RADEXPLINK IggyValueSetF64RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F64 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetF32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - F32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetS32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - S32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetU32RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - U32 value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF8RS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - char const* utf8_string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetStringUTF16RS( - IggyValuePath* var, IggyName sub_name, char const* sub_name_utf8, - IggyUTF16 const* utf16_string, S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetBooleanRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - rrbool value); -RADEXPFUNC rrbool RADEXPLINK IggyValueSetValueRefRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - IggyValueRef value_ref); - -RADEXPFUNC rrbool RADEXPLINK IggyValueSetUserDataRS(IggyValuePath* result, - void const* userdata); -RADEXPFUNC IggyResult RADEXPLINK IggyValueGetUserDataRS(IggyValuePath* result, - void** userdata); - -//////////////////////////////////////////////////////////// -// -// Input Events -// - -typedef enum IggyEventType { - IGGY_EVENTTYPE_None, - IGGY_EVENTTYPE_MouseLeftDown, - IGGY_EVENTTYPE_MouseLeftUp, - IGGY_EVENTTYPE_MouseRightDown, - IGGY_EVENTTYPE_MouseRightUp, - IGGY_EVENTTYPE_MouseMiddleDown, - IGGY_EVENTTYPE_MouseMiddleUp, - IGGY_EVENTTYPE_MouseMove, - IGGY_EVENTTYPE_MouseWheel, - IGGY_EVENTTYPE_KeyUp, - IGGY_EVENTTYPE_KeyDown, - IGGY_EVENTTYPE_Char, - IGGY_EVENTTYPE_Activate, - IGGY_EVENTTYPE_Deactivate, - IGGY_EVENTTYPE_Resize, - IGGY_EVENTTYPE_MouseLeave, - IGGY_EVENTTYPE_FocusLost, -} IggyEventType; - -typedef enum IggyKeyloc { - IGGY_KEYLOC_Standard = 0, // For keys that have no variants - // TODO(casey): Shouldn't these work for ALT and CONTROL too? The code in - // D3DTEST looks like it only handles VK_SHIFT... - IGGY_KEYLOC_Left = - 1, // Specifies the left-hand-side key for keys with left/right - // variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), - // $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */ - IGGY_KEYLOC_Right = - 2, // Specifies the right-hand-side key for keys with left/right - // variants (such as $(IggyKeycode::IGGY_KEYCODE_SHIFT), - // $(IggyKeycode::IGGY_KEYCODE_ALTERNATE), etc.) */ - IGGY_KEYLOC_Numpad = 3, // TODO(casey): Is this ever used? -} IggyKeyloc; - -typedef enum IggyKeyevent { - IGGY_KEYEVENT_Up = IGGY_EVENTTYPE_KeyUp, - IGGY_KEYEVENT_Down = IGGY_EVENTTYPE_KeyDown, -} IggyKeyevent; - -typedef enum IggyMousebutton { - IGGY_MOUSEBUTTON_LeftDown = IGGY_EVENTTYPE_MouseLeftDown, - IGGY_MOUSEBUTTON_LeftUp = IGGY_EVENTTYPE_MouseLeftUp, - IGGY_MOUSEBUTTON_RightDown = IGGY_EVENTTYPE_MouseRightDown, - IGGY_MOUSEBUTTON_RightUp = IGGY_EVENTTYPE_MouseRightUp, - IGGY_MOUSEBUTTON_MiddleDown = IGGY_EVENTTYPE_MouseMiddleDown, - IGGY_MOUSEBUTTON_MiddleUp = IGGY_EVENTTYPE_MouseMiddleUp, -} IggyMousebutton; - -typedef enum IggyActivestate { - IGGY_ACTIVESTATE_Activated = IGGY_EVENTTYPE_Activate, - IGGY_ACTIVESTATE_Deactivated = IGGY_EVENTTYPE_Deactivate, -} IggyActivestate; - -typedef enum IggyKeycode { - IGGY_KEYCODE_A = 65, - IGGY_KEYCODE_B = 66, - IGGY_KEYCODE_C = 67, - IGGY_KEYCODE_D = 68, - IGGY_KEYCODE_E = 69, - IGGY_KEYCODE_F = 70, - IGGY_KEYCODE_G = 71, - IGGY_KEYCODE_H = 72, - IGGY_KEYCODE_I = 73, - IGGY_KEYCODE_J = 74, - IGGY_KEYCODE_K = 75, - IGGY_KEYCODE_L = 76, - IGGY_KEYCODE_M = 77, - IGGY_KEYCODE_N = 78, - IGGY_KEYCODE_O = 79, - IGGY_KEYCODE_P = 80, - IGGY_KEYCODE_Q = 81, - IGGY_KEYCODE_R = 82, - IGGY_KEYCODE_S = 83, - IGGY_KEYCODE_T = 84, - IGGY_KEYCODE_U = 85, - IGGY_KEYCODE_V = 86, - IGGY_KEYCODE_W = 87, - IGGY_KEYCODE_X = 88, - IGGY_KEYCODE_Y = 89, - IGGY_KEYCODE_Z = 90, - - IGGY_KEYCODE_0 = 48, - IGGY_KEYCODE_1 = 49, - IGGY_KEYCODE_2 = 50, - IGGY_KEYCODE_3 = 51, - IGGY_KEYCODE_4 = 52, - IGGY_KEYCODE_5 = 53, - IGGY_KEYCODE_6 = 54, - IGGY_KEYCODE_7 = 55, - IGGY_KEYCODE_8 = 56, - IGGY_KEYCODE_9 = 57, - - IGGY_KEYCODE_F1 = 112, - IGGY_KEYCODE_F2 = 113, - IGGY_KEYCODE_F3 = 114, - IGGY_KEYCODE_F4 = 115, - IGGY_KEYCODE_F5 = 116, - IGGY_KEYCODE_F6 = 117, - IGGY_KEYCODE_F7 = 118, - IGGY_KEYCODE_F8 = 119, - IGGY_KEYCODE_F9 = 120, - IGGY_KEYCODE_F10 = 121, - IGGY_KEYCODE_F11 = 122, - IGGY_KEYCODE_F12 = 123, - IGGY_KEYCODE_F13 = 124, - IGGY_KEYCODE_F14 = 125, - IGGY_KEYCODE_F15 = 126, - - IGGY_KEYCODE_COMMAND = 15, - IGGY_KEYCODE_SHIFT = 16, - IGGY_KEYCODE_CONTROL = 17, - IGGY_KEYCODE_ALTERNATE = 18, - - IGGY_KEYCODE_BACKQUOTE = 192, - IGGY_KEYCODE_BACKSLASH = 220, - IGGY_KEYCODE_BACKSPACE = 8, - IGGY_KEYCODE_CAPS_LOCK = 20, - IGGY_KEYCODE_COMMA = 188, - IGGY_KEYCODE_DELETE = 46, - IGGY_KEYCODE_DOWN = 40, - IGGY_KEYCODE_END = 35, - IGGY_KEYCODE_ENTER = 13, - IGGY_KEYCODE_EQUAL = 187, - IGGY_KEYCODE_ESCAPE = 27, - IGGY_KEYCODE_HOME = 36, - IGGY_KEYCODE_INSERT = 45, - IGGY_KEYCODE_LEFT = 37, - IGGY_KEYCODE_LEFTBRACKET = 219, - IGGY_KEYCODE_MINUS = 189, - IGGY_KEYCODE_NUMPAD = 21, - IGGY_KEYCODE_NUMPAD_0 = 96, - IGGY_KEYCODE_NUMPAD_1 = 97, - IGGY_KEYCODE_NUMPAD_2 = 98, - IGGY_KEYCODE_NUMPAD_3 = 99, - IGGY_KEYCODE_NUMPAD_4 = 100, - IGGY_KEYCODE_NUMPAD_5 = 101, - IGGY_KEYCODE_NUMPAD_6 = 102, - IGGY_KEYCODE_NUMPAD_7 = 103, - IGGY_KEYCODE_NUMPAD_8 = 104, - IGGY_KEYCODE_NUMPAD_9 = 105, - IGGY_KEYCODE_NUMPAD_ADD = 107, - IGGY_KEYCODE_NUMPAD_DECIMAL = 110, - IGGY_KEYCODE_NUMPAD_DIVIDE = 111, - IGGY_KEYCODE_NUMPAD_ENTER = 108, - IGGY_KEYCODE_NUMPAD_MULTIPLY = 106, - IGGY_KEYCODE_NUMPAD_SUBTRACT = 109, - IGGY_KEYCODE_PAGE_DOWN = 34, - IGGY_KEYCODE_PAGE_UP = 33, - IGGY_KEYCODE_PERIOD = 190, - IGGY_KEYCODE_QUOTE = 222, - IGGY_KEYCODE_RIGHT = 39, - IGGY_KEYCODE_RIGHTBRACKET = 221, - IGGY_KEYCODE_SEMICOLON = 186, - IGGY_KEYCODE_SLASH = 191, - IGGY_KEYCODE_SPACE = 32, - IGGY_KEYCODE_TAB = 9, - IGGY_KEYCODE_UP = 38, -} IggyKeycode; - -typedef enum IggyEventFlag { - IGGY_EVENTFLAG_PreventDispatchToObject = 0x1, - IGGY_EVENTFLAG_PreventFocusTabbing = 0x2, - IGGY_EVENTFLAG_PreventDefault = 0x4, - IGGY_EVENTFLAG_RanAtLeastOneHandler = 0x8, -} IggyEventFlag; - -typedef struct IggyEvent { - S32 type; // an $IggyEventType - U32 flags; - S32 x, y; // mouse position at time of event - S32 keycode, keyloc; // keyboard inputs -} IggyEvent; - -typedef enum IggyFocusChange { - IGGY_FOCUS_CHANGE_None, // The keyboard focus didn't change - IGGY_FOCUS_CHANGE_TookFocus, // The keyboard focus changed to something in - // this Iggy - IGGY_FOCUS_CHANGE_LostFocus, // The keyboard focus was lost from this Iggy -} IggyFocusChange; - -typedef struct IggyEventResult { - U32 new_flags; - S32 focus_change; // an $IggyFocusChange that indicates how the focus (may - // have) changed in response to the event - S32 focus_direction; // -} IggyEventResult; - -RADEXPFUNC void RADEXPLINK IggyMakeEventNone(IggyEvent* event); - -RADEXPFUNC void RADEXPLINK IggyMakeEventResize(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventActivate(IggyEvent* event, - IggyActivestate event_type); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseLeave(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseMove(IggyEvent* event, S32 x, - S32 y); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseButton(IggyEvent* event, - IggyMousebutton event_type); -RADEXPFUNC void RADEXPLINK IggyMakeEventMouseWheel(IggyEvent* event, - S16 mousewheel_delta); -RADEXPFUNC void RADEXPLINK IggyMakeEventKey(IggyEvent* event, - IggyKeyevent event_type, - IggyKeycode keycode, - IggyKeyloc keyloc); -RADEXPFUNC void RADEXPLINK IggyMakeEventChar(IggyEvent* event, S32 charcode); -RADEXPFUNC void RADEXPLINK IggyMakeEventFocusLost(IggyEvent* event); -RADEXPFUNC void RADEXPLINK IggyMakeEventFocusGained(IggyEvent* event, - S32 focus_direction); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerDispatchEventRS(Iggy* player, - IggyEvent* event, - IggyEventResult* result); -RADEXPFUNC void RADEXPLINK IggyPlayerSetShiftState(Iggy* f, rrbool shift, - rrbool control, rrbool alt, - rrbool command); -RADEXPFUNC void RADEXPLINK -IggySetDoubleClickTime(S32 time_in_ms_from_first_down_to_second_up); -RADEXPFUNC void RADEXPLINK IggySetTextCursorFlash(U32 cycle_time_in_ms, - U32 visible_time_in_ms); - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerHasFocusedEditableTextfield(Iggy* f); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF16(Iggy* f, U16* string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerPasteUTF8(Iggy* f, char* string, - S32 stringlen); -RADEXPFUNC rrbool RADEXPLINK IggyPlayerCut(Iggy* f); - -#define IGGY_PLAYER_COPY_no_focused_textfield -1 -#define IGGY_PLAYER_COPY_textfield_has_no_selection 0 -RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF16(Iggy* f, U16* buffer, - S32 bufferlen); -RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF8(Iggy* f, char* buffer, - S32 bufferlen); - -//////////////////////////////////////////////////////////// -// -// IME -// - -#ifdef __RADNT__ -#define IGGY_IME_SUPPORT -#endif - -RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF8(Iggy* f, - const char* font_name_utf8, - S32 namelen_in_bytes); -RADEXPFUNC void RADEXPLINK IggyPlayerSetIMEFontUTF16( - Iggy* f, const IggyUTF16* font_name_utf16, S32 namelen_in_2byte_words); - -#ifdef IGGY_IME_SUPPORT - -#define IGGY_IME_MAX_CANDIDATE_LENGTH \ - 256 // matches def in ImeUi.cpp, so no overflow checks needed when copying - // out. - -IDOCN typedef enum { - IGGY_IME_COMPOSITION_STYLE_NONE, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_DOTTED_THICK, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID, - IGGY_IME_COMPOSITION_STYLE_UNDERLINE_SOLID_THICK, -} IggyIMECompositionDrawStyle; - -IDOCN typedef enum { - IGGY_IME_COMPOSITION_CLAUSE_NORMAL, - IGGY_IME_COMPOSITION_CLAUSE_START, -} IggyIMECompositionClauseState; - -IDOCN typedef struct { - IggyUTF16 str[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionDrawStyle char_style[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionClauseState clause_state[IGGY_IME_MAX_CANDIDATE_LENGTH]; - S32 cursor_pos; - rrbool display_block_cursor; - int candicate_clause_start_pos; - int candicate_clause_end_pos; // inclusive -} IggyIMECompostitionStringState; - -IDOCN RADEXPFUNC void RADEXPLINK -IggyIMEWin32SetCompositionState(Iggy* f, IggyIMECompostitionStringState* s); - -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEGetTextExtents(Iggy* f, U32* pdw, - U32* pdh, - const IggyUTF16* str, - U32 text_height); -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawString(Iggy* f, S32 px, S32 py, - const IggyUTF16* str, - U32 text_height, - const U8 rgba[4]); - -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32GetCandidatePosition( - Iggy* f, F32* pdx, F32* pdy, F32* pdcomp_str_height); -IDOCN RADEXPFUNC void* RADEXPLINK IggyIMEGetFocusedTextfield(Iggy* f); -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, - const U8 rgb[3]); - -#endif - -//////////////////////////////////////////////////////////// -// -// Input focus handling -// - -typedef void* IggyFocusHandle; - -#define IGGY_FOCUS_NULL 0 - -typedef struct { - IggyFocusHandle object; // unique identifier of Iggy object - F32 x0, y0, x1, y1; // bounding box of displayed shape -} IggyFocusableObject; - -RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetFocusableObjects( - Iggy* f, IggyFocusHandle* current_focus, IggyFocusableObject* objs, - S32 max_obj, S32* num_obj); -RADEXPFUNC void RADEXPLINK IggyPlayerSetFocusRS(Iggy* f, IggyFocusHandle object, - int focus_key_char); - -//////////////////////////////////////////////////////////// -// -// GDraw helper functions accessors -// - -RADEXPFUNC void* RADEXPLINK IggyGDrawMalloc(SINTa size); -#define IggyGDrawMalloc(size) \ - IggyGDrawMallocAnnotated(size, __FILE__, __LINE__) IDOCN -IDOCN RADEXPFUNC void* RADEXPLINK IggyGDrawMallocAnnotated(SINTa size, - const char* file, - int line); - -RADEXPFUNC void RADEXPLINK IggyGDrawFree(void* ptr); -RADEXPFUNC void RADEXPLINK IggyGDrawSendWarning(Iggy* f, char const* message, - ...); -RADEXPFUNC void RADEXPLINK IggyWaitOnFence(void* id, U32 fence); -RADEXPFUNC void RADEXPLINK IggyDiscardVertexBufferCallback(void* owner, - void* vertex_buffer); -RADEXPFUNC void RADEXPLINK IggyPlayerDebugEnableFilters(Iggy* f, rrbool enable); -RADEXPFUNC void RADEXPLINK IggyPlayerDebugSetTime(Iggy* f, F64 time); - -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchStartFrame(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchInit(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchMove(S32 dir); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchSplit(void); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchChooseEnd(S32 end); - -//////////////////////////////////////////////////////////// -// -// debugging -// - -IDOCN RADEXPFUNC void RADEXPLINK -IggyPlayerDebugUpdateReadyToTickWithFakeRender(Iggy* f); -IDOCN RADEXPFUNC void RADEXPLINK IggyDebugBreakOnAS3Exception(void); - -typedef struct { - S32 size; - char* source_file; - S32 source_line; - char* iggy_file; - char* info; -} IggyLeakResultData; - -typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData* data); - -typedef struct { - char* subcategory; - S32 subcategory_stringlen; - - S32 static_allocation_count; // number of non-freeable allocations for this - // subcategory - S32 static_allocation_bytes; // bytes of non-freeable allocations for this - // subcategory - - S32 dynamic_allocation_count; // number of freeable allocations for this - // subcategory - S32 dynamic_allocation_bytes; // estimated bytes of freeable allocations - // for this subcategory -} IggyMemoryUseInfo; - -RADEXPFUNC rrbool RADEXPLINK IggyDebugGetMemoryUseInfo( - Iggy* player, IggyLibrary lib, char const* category_string, - S32 category_stringlen, S32 iteration, IggyMemoryUseInfo* data); -RADEXPFUNC void RADEXPLINK -IggyDebugSetLeakResultCallback(IggyLeakResultCallback* leak_result_func); - -IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_todisk(char* filename_or_null, - U32 flags); -IDOCN RADEXPFUNC void RADEXPLINK -iggy_sync_check_fromdisk(char* filename_or_null, U32 flags); -IDOCN RADEXPFUNC void RADEXPLINK iggy_sync_check_end(void); -#define IGGY_SYNCCHECK_readytotick 1U IDOCN - -RADDEFEND - -#endif diff --git a/targets/app/windows/Iggy/include/iggyexpruntime.h b/targets/app/windows/Iggy/include/iggyexpruntime.h deleted file mode 100644 index b9221bf7b..000000000 --- a/targets/app/windows/Iggy/include/iggyexpruntime.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __RAD_INCLUDE_IGGYEXPRUNTIME_H__ -#define __RAD_INCLUDE_IGGYEXPRUNTIME_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -#ifndef __RAD_HIGGYEXP_ -#define __RAD_HIGGYEXP_ -typedef void* HIGGYEXP; -#endif - -// idoc(parent,IggyExpRuntime_API) - -#define IGGYEXP_MIN_STORAGE 1024 IDOC -/* The minimum-sized block you must provide to $IggyExpCreate */ - -IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char* ip_address, S32 port, - void* storage, - S32 storage_size_in_bytes); -/* Opens a connection to $IggyExplorer and returns an $HIGGYEXP wrapping the -connection. - - $:ip_address The address of the machine running Iggy Explorer (can be numeric -with dots, or textual, including "localhost") - $:port The port number on which Iggy Explorer is listening for a network -connection (the default is 9190) - $:storage A small block of storage that needed to store the $HIGGYEXP, must -be at least $IGGYEXP_MIN_STORAGE - $:storage_size_in_bytes The size of the block pointer to by storage - -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy -Explorer can be contacted at the specified address/port. Otherwise returns a -non-NULL $HIGGYEXP which you can pass to $IggyUseExplorer. */ - -IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); -/* Closes and destroys a connection to $IggyExplorer */ - -IDOC RADEXPFUNC rrbool RADEXPLINK IggyExpCheckValidity(HIGGYEXP p); -/* Checks if the connection represented by an $HIGGYEXP is still valid, i.e. -still connected to $IggyExplorer. - -Returns true if the connection is still valid; returns false if it is not valid. - -This might happen if someone closes Iggy Explorer, Iggy Explorer crashes, or -the network fails. You can this to poll and detect these conditions and do -something in response, such as trying to open a new connection. - -An invalid $HIGGYEXP must still be shutdown with $IggyExpDestroy. */ - -RADDEFEND - -#endif //__RAD_INCLUDE_IGGYEXPRUNTIME_H__ \ No newline at end of file diff --git a/targets/app/windows/Iggy/include/iggyperfmon.h b/targets/app/windows/Iggy/include/iggyperfmon.h deleted file mode 100644 index 68f70b728..000000000 --- a/targets/app/windows/Iggy/include/iggyperfmon.h +++ /dev/null @@ -1,106 +0,0 @@ -// $$COPYRIGHT$$ - -#ifndef __RAD_INCLUDE_IGGYPERFMON_H__ -#define __RAD_INCLUDE_IGGYPERFMON_H__ - -#include "rrCore.h" - -#define IDOC - -RADDEFSTART - -#ifndef __RAD_HIGGYPERFMON_ -#define __RAD_HIGGYPERFMON_ -typedef void* HIGGYPERFMON; -#endif - -// idoc(parent,IggyPerfmon_API) - -typedef void* RADLINK iggyperfmon_malloc(void* handle, U32 size); -typedef void RADLINK iggyperfmon_free(void* handle, void* ptr); - -IDOC RADEXPFUNC HIGGYPERFMON RADEXPLINK -IggyPerfmonCreate(iggyperfmon_malloc* perf_malloc, iggyperfmon_free* perf_free, - void* callback_handle); -/* Creates an IggyPerfmon. - -You must supply allocator functions. The amount allocated depends on the -complexity of the Iggys being profiled. */ - -typedef struct Iggy Iggy; -typedef struct GDrawFunctions GDrawFunctions; - -IDOC typedef union { - U32 bits; - struct { - U32 dpad_up : 1; - U32 dpad_down : 1; - U32 dpad_left : 1; - U32 dpad_right : 1; - U32 button_up : 1; // XBox Y, PS3 tri - U32 button_down : 1; // XBox A, PS3 X - U32 button_left : 1; // XBox X, PS3 square - U32 button_right : 1; // XBox B, PS3 circle - U32 shoulder_left_hi : 1; // LB/L1 - U32 shoulder_right_hi : 1; // RB/R1 - U32 trigger_left_low : 1; - U32 trigger_right_low : 1; - } field; -} IggyPerfmonPad; - -#define IggyPerfmonPadFromXInputStatePointer(pad, xis) \ - (pad).bits = 0, \ - (pad).field.dpad_up = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP), \ - (pad).field.dpad_down = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN), \ - (pad).field.dpad_left = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT), \ - (pad).field.dpad_right = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT), \ - (pad).field.button_up = 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_Y), \ - (pad).field.button_down = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_A), \ - (pad).field.button_left = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_X), \ - (pad).field.button_right = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_B), \ - (pad).field.shoulder_left_hi = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER), \ - (pad).field.shoulder_right_hi = \ - 0 != ((xis)->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER), \ - (pad).field.trigger_left_low = 0 != ((xis)->Gamepad.bLeftTrigger >= \ - XINPUT_GAMEPAD_TRIGGER_THRESHOLD), \ - (pad).field.trigger_right_low = 0 != ((xis)->Gamepad.bRightTrigger >= \ - XINPUT_GAMEPAD_TRIGGER_THRESHOLD) - -// All positions in window coords -IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonTickAndDraw( - HIGGYPERFMON p, GDrawFunctions* gdraw_funcs, const IggyPerfmonPad* pad, - int pm_tile_ul_x, int pm_tile_ul_y, int pm_tile_lr_x, int pm_tile_lr_y); -/* Draw and tick an IggyPerfmon. - -$:p A perfmon context previously created with IggyPerfmonCreate -$:gdraw_functions The same GDraw handle used for rendering Iggy -$:pad An abstracted gamepad state structure. iggyperfmon.h -includes an example that initializes the abstract gamepad from a 360 controller -as defined by XInput; this will work on both Windows and the Xbox 360. -$:pm_tile_ul_x The left coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_ul_y The top coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_lr_x The right coordinate of the rectangle where the perfmon display -should be drawn -$:pm_tile_lr_y The bottom coordinate of the rectangle where the perfmon display -should be drawn - -You should only call this function when you want Iggy Perfmon to be visible. -See $IggyPerfmon for more information. */ - -IDOC RADEXPFUNC void RADEXPLINK IggyPerfmonDestroy(HIGGYPERFMON p, - GDrawFunctions* iggy_draw); -/* Closes and destroys an IggyPerfmon */ - -RADDEFEND - -#endif //__RAD_INCLUDE_IGGYPERFMON_H__ \ No newline at end of file diff --git a/targets/app/windows/Iggy/include/rrCore.h b/targets/app/windows/Iggy/include/rrCore.h deleted file mode 100644 index 54cc183f0..000000000 --- a/targets/app/windows/Iggy/include/rrCore.h +++ /dev/null @@ -1,2437 +0,0 @@ -/// ======================================================================== -// (C) Copyright 1994- 2014 RAD Game Tools, Inc. Global types header file -// ======================================================================== - -#ifndef __RADRR_COREH__ -#define __RADRR_COREH__ -#define RADCOPYRIGHT "Copyright (C) 1994-2014, RAD Game Tools, Inc." - -// __RAD16__ means 16 bit code (Win16) -// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac AND Win64) -// __RAD64__ means 64 bit code (x64) - -// Note oddness - __RAD32__ essentially means "at *least* 32-bit code". -// So, on 64-bit systems, both __RAD32__ and __RAD64__ will be defined. - -// __RADDOS__ means DOS code (16 or 32 bit) -// __RADWIN__ means Windows API (Win16, Win386, Win32s, Win64, Xbox, Xenon) -// __RADWINEXT__ means Windows 386 extender (Win386) -// __RADNT__ means Win32 or Win64 code -// __RADWINRTAPI__ means Windows RT API (Win 8, Win Phone, ARM, Durango) -// __RADMAC__ means Macintosh -// __RADCARBON__ means Carbon -// __RADMACH__ means MachO -// __RADXBOX__ means the XBox console -// __RADXENON__ means the Xenon console -// __RADDURANGO__ or __RADXBOXONE__ means Xbox One -// __RADNGC__ means the Nintendo GameCube -// __RADWII__ means the Nintendo Wii -// __RADWIIU__ means the Nintendo Wii U -// __RADNDS__ means the Nintendo DS -// __RADTWL__ means the Nintendo DSi (__RADNDS__ also defined) -// __RAD3DS__ means the Nintendo 3DS -// __RADPS2__ means the Sony PlayStation 2 -// __RADPSP__ means the Sony PlayStation Portable -// __RADPS3__ means the Sony PlayStation 3 -// __RADPS4__ means the Sony PlayStation 4 -// __RADANDROID__ means Android NDK -// __RADNACL__ means Native Client SDK -// __RADNTBUILDLINUX__ means building Linux on NT -// __RADLINUX__ means actually building on Linux (most likely with GCC) -// __RADPSP2__ means NGP -// __RADBSD__ means a BSD-style UNIX (OS X, FreeBSD, OpenBSD, NetBSD) -// __RADPOSIX__ means POSIX-compliant -// __RADQNX__ means QNX -// __RADIPHONE__ means iphone -// __RADIPHONESIM__ means iphone simulator - -// __RADX86__ means Intel x86 -// __RADMMX__ means Intel x86 MMX instructions are allowed -// __RADX64__ means Intel/AMD x64 (NOT IA64=Itanium) -// __RAD68K__ means 68K -// __RADPPC__ means PowerPC -// __RADMIPS__ means Mips (only R5900 right now) -// __RADARM__ mean ARM processors - -// __RADLITTLEENDIAN__ means processor is little-endian (x86) -// __RADBIGENDIAN__ means processor is big-endian (680x0, PPC) - -// __RADNOVARARGMACROS__ means #defines can't use ... - -#ifdef WINAPI_FAMILY -// If this is #defined, we might be in a Windows Store App. But -// VC++ by default #defines this to a symbolic name, not an integer -// value, and those names are defined in "winapifamily.h". So if -// WINAPI_FAMILY is #defined, #include the header so we can parse it. -#include -#define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) -#else -#define RAD_WINAPI_IS_APP 0 -#endif - -#ifndef __RADRES__ -// Theoretically, this is to pad structs on platforms that don't support pragma -// pack or do it poorly. (PS3, PS2) In general it is assumed that your padding -// is set via pragma, so this is just a struct. -#define RADSTRUCT struct - -#ifdef __GNUC_MINOR__ -// make a combined GCC version for testing : - -#define __RAD_GCC_VERSION__ \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - -/* Test for GCC > 3.2.0 */ -// #if GCC_VERSION > 30200 -#endif - -#if defined(__RADX32__) - -#define __RADX86__ -#define __RADMMX__ -#define __RAD32__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -// known platforms under the RAD generic build type -#if defined(_WIN32) || defined(_Windows) || defined(WIN32) || \ - defined(__WINDOWS__) || defined(_WINDOWS) -#define __RADNT__ -#define __RADWIN__ -#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ - defined(THINK_C) || defined(powerc) || defined(macintosh) || \ - defined(__powerc) || defined(__APPLE__) || defined(__MACH__) -#define __RADMAC__ -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) -#elif defined(__linux__) -#define __RADLINUX__ -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) -#endif - -#elif defined(ANDROID) -#define __RADANDROID__ -#define __RAD32__ -#define __RADLITTLEENDIAN__ -#ifdef __i386__ -#define __RADX86__ -#else -#define __RADARM__ -#endif -#define RADINLINE inline -#define RADRESTRICT __restrict -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(__QNX__) -#define __RAD32__ -#define __RADQNX__ - -#ifdef __arm__ -#define __RADARM__ -#elif defined __i386__ -#define __RADX86__ -#else -#error Unknown processor -#endif -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) -#elif defined(__linux__) && \ - defined(__arm__) // This should pull in Raspberry Pi as well - -#define __RAD32__ -#define __RADLINUX__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(__native_client__) -#define __RADNACL__ -#define __RAD32__ -#define __RADLITTLEENDIAN__ -#define __RADX86__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(_DURANGO) || defined(_SEKRIT) || defined(_SEKRIT1) || \ - defined(_XBOX_ONE) - -#define __RADDURANGO__ 1 -#define __RADXBOXONE__ 1 -#if !defined(__RADSEKRIT__) // keep sekrit around for a bit for compat -#define __RADSEKRIT__ 1 -#endif - -#define __RADWIN__ -#define __RAD32__ -#define __RAD64__ -#define __RADX64__ -#define __RADMMX__ -#define __RADX86__ -#define __RAD64REGS__ -#define __RADLITTLEENDIAN__ -#define RADINLINE __inline -#define RADRESTRICT __restrict -#define __RADWINRTAPI__ - -#elif defined(__ORBIS__) - -#define __RADPS4__ -#if !defined(__RADSEKRIT2__) // keep sekrit2 around for a bit for compat -#define __RADSEKRIT2__ 1 -#endif -#define __RAD32__ -#define __RAD64__ -#define __RADX64__ -#define __RADMMX__ -#define __RADX86__ -#define __RAD64REGS__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(WINAPI_FAMILY) && RAD_WINAPI_IS_APP - -#define __RADWINRTAPI__ -#define __RADWIN__ -#define RADINLINE __inline -#define RADRESTRICT __restrict - -#if defined(_M_IX86) // WinRT on x86 - -#define __RAD32__ -#define __RADX86__ -#define __RADMMX__ -#define __RADLITTLEENDIAN__ - -#elif defined(_M_X64) // WinRT on x64 -#define __RAD32__ -#define __RAD64__ -#define __RADX86__ -#define __RADX64__ -#define __RADMMX__ -#define __RAD64REGS__ -#define __RADLITTLEENDIAN__ - -#elif defined(_M_ARM) // WinRT on ARM - -#define __RAD32__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ - -#else - -#error Unrecognized WinRT platform! - -#endif - -#elif defined(_WIN64) - -#define __RADWIN__ -#define __RADNT__ -// See note at top for why both __RAD32__ and __RAD64__ are defined. -#define __RAD32__ -#define __RAD64__ -#define __RADX64__ -#define __RADMMX__ -#define __RADX86__ -#define __RAD64REGS__ -#define __RADLITTLEENDIAN__ -#define RADINLINE __inline -#define RADRESTRICT __restrict - -#elif defined(GENERIC_ARM) - -#define __RAD32__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ -#define __RADFIXEDPOINT__ -#define RADINLINE inline -#if (defined(__GCC__) || defined(__GNUC__)) -#define RADRESTRICT __restrict -#else -#define RADRESTRICT // __restrict not supported on cw -#endif -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(CAFE) // has to be before HOLLYWOOD_REV since it also defines it - -#define __RADWIIU__ -#define __RAD32__ -#define __RADPPC__ -#define __RADBIGENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(HOLLYWOOD_REV) || defined(REVOLUTION) - -#define __RADWII__ -#define __RAD32__ -#define __RADPPC__ -#define __RADBIGENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#elif defined(NN_PLATFORM_CTR) - -#define __RAD3DS__ -#define __RAD32__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(GEKKO) - -#define __RADNGC__ -#define __RAD32__ -#define __RADPPC__ -#define __RADBIGENDIAN__ -#define RADINLINE inline -#define RADRESTRICT // __restrict not supported on cw - -#elif defined(SDK_ARM9) || defined(SDK_TWL) || \ - (defined(__arm) && defined(__MWERKS__)) - -#define __RADNDS__ -#define __RAD32__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ -#define __RADFIXEDPOINT__ -#define RADINLINE inline -#if (defined(__GCC__) || defined(__GNUC__)) -#define RADRESTRICT __restrict -#else -#define RADRESTRICT // __restrict not supported on cw -#endif - -#if defined(SDK_TWL) -#define __RADTWL__ -#endif - -#elif defined(R5900) - -#define __RADPS2__ -#define __RAD32__ -#define __RADMIPS__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict -#define __RAD64REGS__ -#define U128 u_long128 - -#if !defined(__MWERKS__) -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) -#endif - -#elif defined(__psp__) - -#define __RADPSP__ -#define __RAD32__ -#define __RADMIPS__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#elif defined(__psp2__) - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#define __RADPSP2__ -#define __RAD32__ -#define __RADARM__ -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict - -// need packed attribute for struct with snc? -#elif defined(__CELLOS_LV2__) - -// CB change : 10-29-10 : RAD64REGS on PPU but NOT SPU - -#ifdef __SPU__ -#define __RADSPU__ -#define __RAD32__ -#define __RADCELL__ -#define __RADBIGENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict -#else -#define __RAD64REGS__ -#define __RADPS3__ -#define __RADPPC__ -#define __RAD32__ -#define __RADCELL__ -#define __RADBIGENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict -#define __RADALTIVEC__ -#endif - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#ifndef __LP32__ -#error "PS3 32bit ABI support only" -#endif -#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || \ - defined(THINK_C) || defined(powerc) || defined(macintosh) || \ - defined(__powerc) || defined(__APPLE__) || defined(__MACH__) -#ifdef __APPLE__ -#include "TargetConditionals.h" -#endif - -#if ((defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ - (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) - -// iPhone/iPad/iOS -#define __RADIPHONE__ -#define __RADMACAPI__ - -#define __RAD32__ -#if defined(__x86_64__) -#define __RAD64__ -#endif - -#define __RADLITTLEENDIAN__ -#define RADINLINE inline -#define RADRESTRICT __restrict -#define __RADMACH__ - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR -#if defined(__x86_64__) -#define __RADX64__ -#else -#define __RADX86__ -#endif -#define __RADIPHONESIM__ -#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -#define __RADARM__ -#endif -#else - -// An actual MacOSX machine -#define __RADMAC__ -#define __RADMACAPI__ - -#if defined(powerc) || defined(__powerc) || defined(__ppc__) -#define __RADPPC__ -#define __RADBIGENDIAN__ -#define __RADALTIVEC__ -#define RADRESTRICT -#elif defined(__i386__) -#define __RADX86__ -#define __RADMMX__ -#define __RADLITTLEENDIAN__ -#define RADRESTRICT __restrict -#elif defined(__x86_64__) -#define __RAD32__ -#define __RAD64__ -#define __RADX86__ -#define __RADX64__ -#define __RAD64REGS__ -#define __RADMMX__ -#define __RADLITTLEENDIAN__ -#define RADRESTRICT __restrict -#else -#define __RAD68K__ -#define __RADBIGENDIAN__ -#define __RADALTIVEC__ -#define RADRESTRICT -#endif - -#define __RAD32__ - -#if defined(__MWERKS__) -#if (defined(__cplusplus) || !__option(only_std_keywords)) -#define RADINLINE inline -#endif -#ifdef __MACH__ -#define __RADMACH__ -#endif -#elif defined(__MRC__) -#if defined(__cplusplus) -#define RADINLINE inline -#endif -#elif defined(__GNUC__) || defined(__GNUG__) || defined(__MACH__) -#define RADINLINE inline -#define __RADMACH__ - -#undef RADRESTRICT /* could have been defined above... */ -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) -#endif - -#ifdef __RADX86__ -#ifndef __RADCARBON__ -#define __RADCARBON__ -#endif -#endif - -#ifdef TARGET_API_MAC_CARBON -#if TARGET_API_MAC_CARBON -#ifndef __RADCARBON__ -#define __RADCARBON__ -#endif -#endif -#endif -#endif -#elif defined(__linux__) - -#define __RADLINUX__ -#define __RADMMX__ -#define __RADLITTLEENDIAN__ -#define __RADX86__ -#ifdef __x86_64 -#define __RAD32__ -#define __RAD64__ -#define __RADX64__ -#define __RAD64REGS__ -#else -#define __RAD32__ -#endif -#define RADINLINE inline -#define RADRESTRICT __restrict - -#undef RADSTRUCT -#define RADSTRUCT struct __attribute__((__packed__)) - -#else - -#if _MSC_VER >= 1400 -#undef RADRESTRICT -#define RADRESTRICT __restrict -#else -#define RADRESTRICT -#define __RADNOVARARGMACROS__ -#endif - -#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) -// Remember that Xenon also defines _XBOX -#define __RADPPC__ -#define __RADBIGENDIAN__ -#define __RADALTIVEC__ -#else -#define __RADX86__ -#define __RADMMX__ -#define __RADLITTLEENDIAN__ -#endif - -#ifdef __MWERKS__ -#define _WIN32 -#endif - -#ifdef __DOS__ -#define __RADDOS__ -#define S64_DEFINED // turn off these types -#define U64_DEFINED -#define S64 double // should error -#define U64 double // should error -#define __RADNOVARARGMACROS__ -#endif - -#ifdef __386__ -#define __RAD32__ -#endif - -#ifdef _Windows // For Borland -#ifdef __WIN32__ -#define WIN32 -#else -#define __WINDOWS__ -#endif -#endif - -#ifdef _WINDOWS // For MS -#ifndef _WIN32 -#define __WINDOWS__ -#endif -#endif - -#ifdef _WIN32 -#if defined(_XENON) || (defined(_XBOX_VER) && (_XBOX_VER == 200)) -// Remember that Xenon also defines _XBOX -#define __RADXENON__ -#define __RAD64REGS__ -#elif defined(_XBOX) -#define __RADXBOX__ -#elif !defined(__RADWINRTAPI__) -#define __RADNT__ -#endif -#define __RADWIN__ -#define __RAD32__ -#else -#ifdef __NT__ -#if defined(_XENON) || (_XBOX_VER == 200) -// Remember that Xenon also defines _XBOX -#define __RADXENON__ -#define __RAD64REGS__ -#elif defined(_XBOX) -#define __RADXBOX__ -#else -#define __RADNT__ -#endif -#define __RADWIN__ -#define __RAD32__ -#else -#ifdef __WINDOWS_386__ -#define __RADWIN__ -#define __RADWINEXT__ -#define __RAD32__ -#define S64_DEFINED // turn off these types -#define U64_DEFINED -#define S64 double // should error -#define U64 double // should error -#else -#ifdef __WINDOWS__ -#define __RADWIN__ -#define __RAD16__ -#else -#ifdef WIN32 -#if defined(_XENON) || (_XBOX_VER == 200) -// Remember that Xenon also defines _XBOX -#define __RADXENON__ -#elif defined(_XBOX) -#define __RADXBOX__ -#else -#define __RADNT__ -#endif -#define __RADWIN__ -#define __RAD32__ -#endif -#endif -#endif -#endif -#endif - -#ifdef __WATCOMC__ -#define RADINLINE -#else -#define RADINLINE __inline -#endif -#endif - -#if defined __RADMAC__ || defined __RADIPHONE__ -#define __RADBSD__ -#endif - -#if defined __RADBSD__ || defined __RADLINUX__ -#define __RADPOSIX__ -#endif - -#if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && \ - !defined(__RADNGC__) && !defined(__RADNDS__) && !defined(__RADXBOX__) && \ - !defined(__RADXENON__) && !defined(__RADDURANGO__) && \ - !defined(__RADPS4__) && !defined(__RADLINUX__) && !defined(__RADPS2__) && \ - !defined(__RADPSP__) && !defined(__RADPSP2__) && !defined(__RADPS3__) && \ - !defined(__RADSPU__) && !defined(__RADWII__) && \ - !defined(__RADIPHONE__) && !defined(__RADX32__) && \ - !defined(__RADARM__) && !defined(__RADWIIU__) && \ - !defined(__RADANDROID__) && !defined(__RADNACL__) && \ - !defined(__RADQNX__)) -#error \ - "RAD.H did not detect your platform. Define DOS, WINDOWS, WIN32, macintosh, powerpc, or appropriate console." -#endif - -#ifdef __RADFINAL__ -#define RADTODO(str) \ - { char __str[0] = str; } -#else -#define RADTODO(str) -#endif - -#ifdef __RADX32__ -#if defined(_MSC_VER) -#define RADLINK __stdcall -#define RADEXPLINK __stdcall -#else -#define RADLINK __attribute__((stdcall)) -#define RADEXPLINK __attribute__((stdcall)) -#endif -#define RADEXPFUNC RADDEFFUNC - -#elif (defined(__RADNGC__) || defined(__RADWII__) || defined(__RADPS2__) || \ - defined(__RADPSP__) || defined(__RADPSP2__) || defined(__RADPS3__) || \ - defined(__RADSPU__) || defined(__RADNDS__) || defined(__RADIPHONE__) || \ - (defined(__RADARM__) && !defined(__RADWINRTAPI__)) || \ - defined(__RADWIIU__) || defined(__RADPS4__)) - -#define RADLINK -#define RADEXPLINK -#define RADEXPFUNC RADDEFFUNC -#define RADASMLINK - -#elif defined(__RADANDROID__) -#define RADLINK -#define RADEXPLINK -#define RADEXPFUNC RADDEFFUNC -#define RADASMLINK -#elif defined(__RADNACL__) -#define RADLINK -#define RADEXPLINK -#define RADEXPFUNC RADDEFFUNC -#define RADASMLINK -#elif defined(__RADLINUX__) || defined(__RADQNX__) - -#ifdef __RAD64__ -#define RADLINK -#define RADEXPLINK -#else -#define RADLINK __attribute__((cdecl)) -#define RADEXPLINK __attribute__((cdecl)) -#endif - -#define RADEXPFUNC RADDEFFUNC -#define RADASMLINK - -#elif defined(__RADMAC__) - -// this define is for CodeWarrior 11's stupid new libs (even though -// we don't use longlong's). - -#define __MSL_LONGLONG_SUPPORT__ - -#define RADLINK -#define RADEXPLINK - -#if defined(__CFM68K__) || defined(__MWERKS__) -#ifdef __RADINDLL__ -#define RADEXPFUNC RADDEFFUNC __declspec(export) -#else -#define RADEXPFUNC RADDEFFUNC __declspec(import) -#endif -#else -#if defined(__RADMACH__) && !defined(__MWERKS__) -#ifdef __RADINDLL__ -#define RADEXPFUNC RADDEFFUNC __attribute__((visibility("default"))) -#else -#define RADEXPFUNC RADDEFFUNC -#endif -#else -#define RADEXPFUNC RADDEFFUNC -#endif -#endif -#define RADASMLINK - -#else - -#ifdef __RADNT__ -#ifndef _WIN32 -#define _WIN32 -#endif -#ifndef WIN32 -#define WIN32 -#endif -#endif - -#ifdef __RADWIN__ -#ifdef __RAD32__ - -#ifdef __RADXBOX__ - -#define RADLINK __stdcall -#define RADEXPLINK __stdcall -#define RADEXPFUNC RADDEFFUNC - -#elif defined(__RADXENON__) || defined(__RADDURANGO__) - -#define RADLINK __stdcall -#define RADEXPLINK __stdcall - -#define RADEXPFUNC RADDEFFUNC - -#elif defined(__RADWINRTAPI__) - -#define RADLINK __stdcall -#define RADEXPLINK __stdcall - -#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ - (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ - (!defined(__RADINSTATICLIB__)))) -#define RADEXPFUNC RADDEFFUNC -#else -#ifndef __RADINDLL__ -#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) -#else -#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) -#endif -#endif - -#elif defined(__RADNTBUILDLINUX__) - -#define RADLINK __cdecl -#define RADEXPLINK __cdecl -#define RADEXPFUNC RADDEFFUNC - -#else -#ifdef __RADNT__ - -#define RADLINK __stdcall -#define RADEXPLINK __stdcall - -#if (defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__) || \ - (defined(__RADNOEXEEXPORTS__) && (!defined(__RADINDLL__)) && \ - (!defined(__RADINSTATICLIB__)))) -#define RADEXPFUNC RADDEFFUNC -#else -#ifndef __RADINDLL__ -#define RADEXPFUNC RADDEFFUNC __declspec(dllimport) -#ifdef __BORLANDC__ -#if __BORLANDC__ <= 0x460 -#undef RADEXPFUNC -#define RADEXPFUNC RADDEFFUNC -#endif -#endif -#else -#define RADEXPFUNC RADDEFFUNC __declspec(dllexport) -#endif -#endif -#else -#define RADLINK __pascal -#define RADEXPLINK __far __pascal -#define RADEXPFUNC RADDEFFUNC -#endif -#endif -#else -#define RADLINK __pascal -#define RADEXPLINK __far __pascal __export -#define RADEXPFUNC RADDEFFUNC -#endif -#else -#define RADLINK __pascal -#define RADEXPLINK __pascal -#define RADEXPFUNC RADDEFFUNC -#endif - -#define RADASMLINK __cdecl - -#endif - -#if !defined(__RADXBOX__) && !defined(__RADXENON__) && \ - !defined(__RADDURANGO__) && !defined(__RADXBOXONE__) -#ifdef __RADWIN__ -#ifndef _WINDOWS -#define _WINDOWS -#endif -#endif -#endif - -#ifdef __RADLITTLEENDIAN__ -#ifdef __RADBIGENDIAN__ -#error both endians !? -#endif -#endif - -#if !defined(__RADLITTLEENDIAN__) && !defined(__RADBIGENDIAN__) -#error neither endian! -#endif - -//----------------------------------------------------------------- - -#ifndef RADDEFFUNC - -#ifdef __cplusplus -#define RADDEFFUNC extern "C" -#define RADDEFSTART extern "C" { -#define RADDEFEND } -#define RADDEFINEDATA extern "C" -#define RADDECLAREDATA extern "C" -#define RADDEFAULT(val) = val - -#define RR_NAMESPACE rr -#define RR_NAMESPACE_START namespace RR_NAMESPACE { -#define RR_NAMESPACE_END \ - } \ - ; -#define RR_NAMESPACE_USE using namespace RR_NAMESPACE; - -#else -#define RADDEFFUNC -#define RADDEFSTART -#define RADDEFEND -#define RADDEFINEDATA -#define RADDECLAREDATA extern -#define RADDEFAULT(val) - -#define RR_NAMESPACE -#define RR_NAMESPACE_START -#define RR_NAMESPACE_END -#define RR_NAMESPACE_USE - -#endif - -#endif - -// probably s.b: RAD_DECLARE_ALIGNED(type, name, alignment) -#if (defined(__RADWII__) || defined(__RADWIIU__) || defined(__RADPSP__) || \ - defined(__RADPSP2__) || defined(__RADPS3__) || defined(__RADSPU__) || \ - defined(__RADPS4__) || defined(__RADLINUX__) || defined(__RADMAC__)) || \ - defined(__RADNDS__) || defined(__RAD3DS__) || defined(__RADIPHONE__) || \ - defined(__RADANDROID__) || defined(__RADQNX__) -#define RAD_ALIGN(type, var, num) type __attribute__((aligned(num))) var -#elif (defined(__RADNGC__) || defined(__RADPS2__)) -#define RAD_ALIGN(type, var, num) __attribute__((aligned(num))) type var -#elif (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__RADWINRTAPI__) -#define RAD_ALIGN(type, var, num) type __declspec(align(num)) var -#else -// NOTE: / / is a guaranteed parse error in C/C++. -#define RAD_ALIGN(type, var, num) RAD_ALIGN_USED_BUT_NOT_DEFINED / / -#endif - -// WARNING : RAD_TLS should really only be used for debug/tools stuff -// it's not reliable because even if we are built as a lib, our lib can -// be put into a DLL and then it doesn't work -#if defined(__RADNT__) || defined(__RADXENON__) -#ifndef __RADINDLL__ -// note that you can't use this in windows DLLs -#define RAD_TLS(type, var) __declspec(thread) type var -#endif -#elif defined(__RADPS3__) || defined(__RADLINUX__) || defined(__RADMAC__) -// works on PS3/gcc I believe : -#define RAD_TLS(type, var) __thread type var -#else -// RAD_TLS not defined -#endif - -// Note that __RAD16__/__RAD32__/__RAD64__ refers to the size of a pointer. -// The size of integers is specified explicitly in the code, i.e. u32 or -// whatever. - -#define RAD_S8 signed char -#define RAD_U8 unsigned char - -#if defined(__RAD64__) -// Remember that __RAD32__ will also be defined! -#if defined(__RADX64__) -// x64 still has 32-bit ints! -#define RAD_U32 unsigned int -#define RAD_S32 signed int -// But pointers are 64 bits. -#if (_MSC_VER >= 1300 && defined(_Wp64) && _Wp64) -#define RAD_SINTa __w64 signed int64_t -#define RAD_UINTa __w64 unsigned int64_t -#else // non-vc.net compiler or /Wp64 turned off -#define RAD_UINTa unsigned long long -#define RAD_SINTa signed long long -#endif -#else -#error Unknown 64-bit processor (see radbase.h) -#endif -#elif defined(__RAD32__) -#define RAD_U32 unsigned int -#define RAD_S32 signed int -// Pointers are 32 bits. - -#if ((defined(_MSC_VER) && (_MSC_VER >= 1300)) && (defined(_Wp64) && (_Wp64))) -#define RAD_SINTa __w64 signed long -#define RAD_UINTa __w64 unsigned long -#else // non-vc.net compiler or /Wp64 turned off -#ifdef _Wp64 -#define RAD_SINTa signed long -#define RAD_UINTa unsigned long -#else -#define RAD_SINTa signed int -#define RAD_UINTa unsigned int -#endif -#endif -#else -#define RAD_U32 unsigned long -#define RAD_S32 signed long -// Pointers in 16-bit land are still 32 bits. -#define RAD_UINTa unsigned long -#define RAD_SINTa signed long -#endif - -#define RAD_F32 float -#if defined(__RADPS2__) || defined(__RADPSP__) -typedef RADSTRUCT RAD_F64 // do this so that we don't accidentally use doubles -{ // while using the same space - RAD_U32 vals[2]; -} -RAD_F64; -#define RAD_F64_OR_32 float // type is F64 if available, otherwise F32 -#else -#define RAD_F64 double -#define RAD_F64_OR_32 double // type is F64 if available, otherwise F32 -#endif - -#if (defined(__RADMAC__) || defined(__MRC__) || defined(__RADNGC__) || \ - defined(__RADLINUX__) || defined(__RADWII__) || defined(__RADWIIU__) || \ - defined(__RADNDS__) || defined(__RADPSP__) || defined(__RADPS3__) || \ - defined(__RADPS4__) || defined(__RADSPU__) || defined(__RADIPHONE__) || \ - defined(__RADNACL__) || defined(__RADANDROID__) || defined(__RADQNX__)) -#define RAD_U64 unsigned long long -#define RAD_S64 signed long long -#elif defined(__RADPS2__) -#define RAD_U64 unsigned long -#define RAD_S64 signed long -#elif defined(__RADARM__) -#define RAD_U64 unsigned long long -#define RAD_S64 signed long long -#elif defined(__RADX64__) || defined(__RAD32__) -#define RAD_U64 unsigned int64_t -#define RAD_S64 signed int64_t -#else -// 16-bit -typedef RADSTRUCT RAD_U64 // do this so that we don't accidentally use U64s -{ // while using the same space - RAD_U32 vals[2]; -} -RAD_U64; -typedef RADSTRUCT RAD_S64 // do this so that we don't accidentally use S64s -{ // while using the same space - RAD_S32 vals[2]; -} -RAD_S64; -#endif - -#if defined(__RAD32__) -#define PTR4 -#define RAD_U16 unsigned short -#define RAD_S16 signed short -#else -#define PTR4 __far -#define RAD_U16 unsigned int -#define RAD_S16 signed int -#endif - -//------------------------------------------------- -// RAD_PTRBITS and such defined here without using sizeof() -// so that they can be used in align() and other macros - -#ifdef __RAD64__ - -#define RAD_PTRBITS 64 -#define RAD_PTRBYTES 8 -#define RAD_TWOPTRBYTES 16 - -#else - -#define RAD_PTRBITS 32 -#define RAD_PTRBYTES 4 -#define RAD_TWOPTRBYTES 8 - -#endif - -//------------------------------------------------- -// UINTr = int the size of a register - -#ifdef __RAD64REGS__ - -#define RAD_UINTr RAD_U64 -#define RAD_SINTr RAD_S64 - -#else - -#define RAD_UINTr RAD_U32 -#define RAD_SINTr RAD_S32 - -#endif - -//=========================================================================== - -/* -// CB : meh this is enough of a mess that it's probably best to just let each -#if defined(__RADX86__) && defined(_MSC_VER) && _MSC_VER >= 1300 - #define __RADX86INTRIN2003__ -#endif -*/ - -// RADASSUME(expr) tells the compiler that expr is always true -// RADUNREACHABLE must never be reachable - even in event of error -// eg. it's okay for compiler to generate completely invalid code after -// RADUNREACHABLE - -#ifdef _MSC_VER -#define RADFORCEINLINE __forceinline -#if _MSC_VER >= 1300 -#define RADNOINLINE __declspec(noinline) -#else -#define RADNOINLINE -#endif -#define RADUNREACHABLE __assume(0) -#define RADASSUME(exp) __assume(exp) -#elif defined(__clang__) -#ifdef _DEBUG -#define RADFORCEINLINE inline -#else -#define RADFORCEINLINE inline __attribute((always_inline)) -#endif -#define RADNOINLINE __attribute__((noinline)) - -#define RADUNREACHABLE __builtin_unreachable() - -#if __has_builtin(__builtin_assume) -#define RADASSUME(exp) __builtin_assume(exp) -#else -#define RADASSUME(exp) \ - RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) -#endif -#elif (defined(__GCC__) || defined(__GNUC__)) || defined(ANDROID) -#ifdef _DEBUG -#define RADFORCEINLINE inline -#else -#define RADFORCEINLINE inline __attribute((always_inline)) -#endif -#define RADNOINLINE __attribute__((noinline)) - -#if __RAD_GCC_VERSION__ >= 40500 -#define RADUNREACHABLE __builtin_unreachable() -#define RADASSUME(exp) \ - RAD_STATEMENT_WRAPPER(if (!(exp)) __builtin_unreachable();) -#else -#define RADUNREACHABLE RAD_INFINITE_LOOP(RR_BREAK();) -#define RADASSUME(exp) -#endif -#elif defined(__CWCC__) -#define RADFORCEINLINE inline -#define RADNOINLINE __attribute__((never_inline)) -#define RADUNREACHABLE -#define RADASSUME(x) (void)0 -#else -// ? #define RADFORCEINLINE ? -#define RADFORCEINLINE inline -#define RADNOINLINE -#define RADASSUME(x) (void)0 -#endif - -//=========================================================================== - -// RAD_ALIGN_HINT tells the compiler how a given pointer is aligned -// it *must* be true, but the compiler may or may not use that information -// it is not for cases where the pointer is to an inherently aligned data type, -// it's when the compiler cannot tell the alignment but you have extra -// information. -// eg : -// U8 * ptr = rrMallocAligned(256,16); -// RAD_ALIGN_HINT(ptr,16,0); - -#ifdef __RADSPU__ -#define RAD_ALIGN_HINT(ptr, alignment, offset) \ - __align_hint(ptr, alignment, offset); \ - RR_ASSERT(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) -#else -#define RAD_ALIGN_HINT(ptr, alignment, offset) \ - RADASSUME(((UINTa)(ptr) & ((alignment) - 1)) == (UINTa)(offset)) -#endif - -//=========================================================================== - -// RAD_EXPECT is to tell the compiler the *likely* value of an expression -// different than RADASSUME in that expr might not have that value -// it's use for branch code layout and static branch prediction -// condition can technically be a variable but should usually be 0 or 1 - -#if (defined(__GCC__) || defined(__GNUC__)) || defined(__clang__) - -// __builtin_expect returns value of expr -#define RAD_EXPECT(expr, cond) __builtin_expect(expr, cond) - -#else - -#define RAD_EXPECT(expr, cond) (expr) - -#endif - -// helpers for doing an if ( ) with expect : -// if ( RAD_LIKELY(expr) ) { ... } - -#define RAD_LIKELY(expr) RAD_EXPECT(expr, 1) -#define RAD_UNLIKELY(expr) RAD_EXPECT(expr, 0) - -//=========================================================================== - -// __RADX86ASM__ means you can use __asm {} style inline assembly -#if defined(__RADX86__) && !defined(__RADX64__) && defined(_MSC_VER) -#define __RADX86ASM__ -#endif - -//------------------------------------------------- -// typedefs : - -#ifndef RADNOTYPEDEFS - -#ifndef S8_DEFINED -#define S8_DEFINED -typedef RAD_S8 S8; -#endif - -#ifndef U8_DEFINED -#define U8_DEFINED -typedef RAD_U8 U8; -#endif - -#ifndef S16_DEFINED -#define S16_DEFINED -typedef RAD_S16 S16; -#endif - -#ifndef U16_DEFINED -#define U16_DEFINED -typedef RAD_U16 U16; -#endif - -#ifndef S32_DEFINED -#define S32_DEFINED -typedef RAD_S32 S32; -#endif - -#ifndef U32_DEFINED -#define U32_DEFINED -typedef RAD_U32 U32; -#endif - -#ifndef S64_DEFINED -#define S64_DEFINED -typedef RAD_S64 S64; -#endif - -#ifndef U64_DEFINED -#define U64_DEFINED -typedef RAD_U64 U64; -#endif - -#ifndef F32_DEFINED -#define F32_DEFINED -typedef RAD_F32 F32; -#endif - -#ifndef F64_DEFINED -#define F64_DEFINED -typedef RAD_F64 F64; -#endif - -#ifndef F64_OR_32_DEFINED -#define F64_OR_32_DEFINED -typedef RAD_F64_OR_32 F64_OR_32; -#endif - -// UINTa and SINTa are the ints big enough for an address - -#ifndef SINTa_DEFINED -#define SINTa_DEFINED -typedef RAD_SINTa SINTa; -#endif - -#ifndef UINTa_DEFINED -#define UINTa_DEFINED -typedef RAD_UINTa UINTa; -#endif - -#ifndef UINTr_DEFINED -#define UINTr_DEFINED -typedef RAD_UINTr UINTr; -#endif - -#ifndef SINTr_DEFINED -#define SINTr_DEFINED -typedef RAD_SINTr SINTr; -#endif - -#elif !defined(RADNOTYPEDEFINES) - -#ifndef S8_DEFINED -#define S8_DEFINED -#define S8 RAD_S8 -#endif - -#ifndef U8_DEFINED -#define U8_DEFINED -#define U8 RAD_U8 -#endif - -#ifndef S16_DEFINED -#define S16_DEFINED -#define S16 RAD_S16 -#endif - -#ifndef U16_DEFINED -#define U16_DEFINED -#define U16 RAD_U16 -#endif - -#ifndef S32_DEFINED -#define S32_DEFINED -#define S32 RAD_S32 -#endif - -#ifndef U32_DEFINED -#define U32_DEFINED -#define U32 RAD_U32 -#endif - -#ifndef S64_DEFINED -#define S64_DEFINED -#define S64 RAD_S64 -#endif - -#ifndef U64_DEFINED -#define U64_DEFINED -#define U64 RAD_U64 -#endif - -#ifndef F32_DEFINED -#define F32_DEFINED -#define F32 RAD_F32 -#endif - -#ifndef F64_DEFINED -#define F64_DEFINED -#define F64 RAD_F64 -#endif - -#ifndef F64_OR_32_DEFINED -#define F64_OR_32_DEFINED -#define F64_OR_32 RAD_F64_OR_32 -#endif - -// UINTa and SINTa are the ints big enough for an address (pointer) -#ifndef SINTa_DEFINED -#define SINTa_DEFINED -#define SINTa RAD_SINTa -#endif - -#ifndef UINTa_DEFINED -#define UINTa_DEFINED -#define UINTa RAD_UINTa -#endif - -#ifndef UINTr_DEFINED -#define UINTr_DEFINED -#define UINTr RAD_UINTr -#endif - -#ifndef SINTr_DEFINED -#define SINTr_DEFINED -#define SINTr RAD_SINTr -#endif - -#endif - -/// Some error-checking. -#if defined(__RAD64__) && !defined(__RAD32__) -// See top of file for why this is. -#error __RAD64__ must not be defined without __RAD32__ (see radbase.h) -#endif - -#ifdef _MSC_VER -// microsoft compilers - -#if _MSC_VER >= 1400 -#define RAD_STATEMENT_START do { -#define RAD_STATEMENT_END_FALSE \ - __pragma(warning(push)) __pragma(warning(disable : 4127)) \ - } \ - while (0) __pragma(warning(pop)) - -#define RAD_STATEMENT_END_TRUE \ - __pragma(warning(push)) __pragma(warning(disable : 4127)) \ - } \ - while (1) __pragma(warning(pop)) - -#else -#define RAD_USE_STANDARD_LOOP_CONSTRUCT -#endif -#else -#define RAD_USE_STANDARD_LOOP_CONSTRUCT -#endif - -#ifdef RAD_USE_STANDARD_LOOP_CONSTRUCT -#define RAD_STATEMENT_START do { -#define RAD_STATEMENT_END_FALSE \ - } \ - while ((void)0, 0) - -#define RAD_STATEMENT_END_TRUE \ - } \ - while ((void)1, 1) - -#endif - -#define RAD_STATEMENT_WRAPPER(code) \ - RAD_STATEMENT_START \ - code RAD_STATEMENT_END_FALSE - -#define RAD_INFINITE_LOOP(code) \ - RAD_STATEMENT_START \ - code RAD_STATEMENT_END_TRUE - -// Must be placed after variable declarations for code compiled as .c -#if defined(_MSC_VER) && _MSC_VER >= 1700 // in 2012 aka 11.0 and later -#define RR_UNUSED_VARIABLE(x) (void)x -#else -#define RR_UNUSED_VARIABLE(x) (void)(sizeof(x)) -#endif - -//----------------------------------------------- -// RR_UINT3264 is a U64 in 64-bit code and a U32 in 32-bit code -// eg. it's pointer sized and the same type as a U32/U64 of the same size -// -// @@ CB 05/21/2012 : I think RR_UINT3264 may be deprecated -// it was useful back when UINTa was /Wp64 -// but since we removed that maybe it's not anymore ? -// - -#ifdef __RAD64__ -#define RR_UINT3264 U64 -#else -#define RR_UINT3264 U32 -#endif - -// RR_COMPILER_ASSERT( sizeof(RR_UINT3264) == sizeof(UINTa) ); - -//-------------------------------------------------- - -// RR_LINESTRING is the current line number as a string -#define RR_STRINGIZE(L) #L -#define RR_DO_MACRO(M, X) M(X) -#define RR_STRINGIZE_DELAY(X) RR_DO_MACRO(RR_STRINGIZE, X) -#define RR_LINESTRING RR_STRINGIZE_DELAY(__LINE__) - -#define RR_CAT(X, Y) X##Y - -// RR_STRING_JOIN joins strings in the preprocessor and works with LINESTRING -#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2) -#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2) -#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1##arg2 - -// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to -// declare -// variable names and they won't conflict with each other -// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC -// extension that works - -#ifdef _MSC_VER -#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __COUNTER__) -#else -#define RR_NUMBERNAME(name) RR_STRING_JOIN(name, __LINE__) -#endif - -//-------------------------------------------------- -// current plan is to use "rrbool" with plain old "true" and "false" -// if true and false give us trouble we might have to go to rrtrue and rrfalse -// BTW there's a danger for evil bugs here !! If you're checking == true -// then the rrbool must be set to exactly "1" not just "not zero" !! - -#ifndef RADNOTYPEDEFS -#ifndef RRBOOL_DEFINED -#define RRBOOL_DEFINED -typedef S32 rrbool; -typedef S32 RRBOOL; -#endif -#elif !defined(RADNOTYPEDEFINES) -#ifndef RRBOOL_DEFINED -#define RRBOOL_DEFINED -#define rrbool S32 -#define RRBOOL S32 -#endif -#endif - -//-------------------------------------------------- -// Range macros - -#ifndef RR_MIN -#define RR_MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef RR_MAX -#define RR_MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef RR_ABS -#define RR_ABS(a) (((a) < 0) ? -(a) : (a)) -#endif - -#ifndef RR_CLAMP -#define RR_CLAMP(val, lo, hi) RR_MAX(RR_MIN(val, hi), lo) -#endif - -//-------------------------------------------------- -// Data layout macros - -#define RR_ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) - -// MEMBER_OFFSET tells you the offset of a member in a type -#ifdef __RAD3DS__ -#define RR_MEMBER_OFFSET(type, member) \ - (unsigned int)(((char *)&(((type *)0)->member) - (char *)0)) -#elif defined(__RADANDROID__) || defined(__RADPSP__) || defined(__RADPS3__) || \ - defined(__RADSPU__) -// offsetof() gets mucked with by system headers on android, making things -// dependent on #include order. -#define RR_MEMBER_OFFSET(type, member) __builtin_offsetof(type, member) -#elif defined(__RADLINUX__) -#define RR_MEMBER_OFFSET(type, member) (offsetof(type, member)) -#else -#define RR_MEMBER_OFFSET(type, member) ((size_t)(UINTa) & (((type *)0)->member)) -#endif - -// MEMBER_SIZE tells you the size of a member in a type -#define RR_MEMBER_SIZE(type, member) (sizeof(((type *)0)->member)) - -// just to make gcc shut up about derefing null : -#define RR_MEMBER_OFFSET_PTR(type, member, ptr) \ - ((SINTa) & (((type *)(ptr))->member) - (SINTa)(ptr)) -#define RR_MEMBER_SIZE_PTR(type, member, ptr) (sizeof(((type *)(ptr))->member)) - -// MEMBER_TO_OWNER takes a pointer to a member and gives you back the base of -// the object -// you should then RR_ASSERT( &(ret->member) == ptr ); -#define RR_MEMBER_TO_OWNER(type, member, ptr) \ - (type *)(((char *)(ptr)) - RR_MEMBER_OFFSET_PTR(type, member, ptr)) - -//-------------------------------------------------- -// Cache / prefetch macros : - -// RR_PREFETCH for various platforms : -// -// RR_PREFETCH_SEQUENTIAL : prefetch memory for reading in a sequential scan -// platforms that automatically prefetch sequential (eg. PC) should -//be a no-op here -// RR_PREFETCH_WRITE_INVALIDATE : prefetch memory for writing - contents of -// memory are undefined -// (may be a no-op, may be a normal prefetch, may zero memory) -// warning : RR_PREFETCH_WRITE_INVALIDATE may write memory so don't -//do it past the end of buffers - -#ifdef __RADX86__ - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // nop -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop - -#elif defined(__RADXENON__) - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __dcbt((int)(offset), (void *)(ptr)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ - __dcbz128((int)(offset), (void *)(ptr)) - -#elif defined(__RADPS3__) - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) \ - __dcbt((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ - __dcbz((char *)(ptr) + (int)(offset)) - -#elif defined(__RADSPU__) - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop - -#elif defined(__RADWII__) || defined(__RADWIIU__) - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // intentional NOP for now -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // nop - -#elif defined(__RAD3DS__) - -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) __pld((char *)(ptr) + (int)(offset)) -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) \ - __pldw((char *)(ptr) + (int)(offset)) - -#else - -// other platform -#define RR_PREFETCH_SEQUENTIAL(ptr, offset) // need_prefetch // compile error -#define RR_PREFETCH_WRITE_INVALIDATE(ptr, offset) // need_writezero // error - -#endif - -//-------------------------------------------------- -// LIGHTWEIGHT ASSERTS without rrAssert.h - -RADDEFSTART - -// set up RR_BREAK : - -#ifdef __RADNGC__ - -#define RR_BREAK() asm(" .long 0x00000001") -#define RR_CACHE_LINE_SIZE xxx - -#elif defined(__RADWII__) - -#define RR_BREAK() __asm__ volatile("trap") -#define RR_CACHE_LINE_SIZE 32 - -#elif defined(__RADWIIU__) - -#define RR_BREAK() asm("trap") -#define RR_CACHE_LINE_SIZE 32 - -#elif defined(__RAD3DS__) - -#define RR_BREAK() *((int volatile *)0) = 0 -#define RR_CACHE_LINE_SIZE 32 - -#elif defined(__RADNDS__) - -#define RR_BREAK() asm("BKPT 0") -#define RR_CACHE_LINE_SIZE xxx - -#elif defined(__RADPS2__) - -#define RR_BREAK() __asm__ volatile("break") -#define RR_CACHE_LINE_SIZE 64 - -#elif defined(__RADPSP__) - -#define RR_BREAK() __asm__("break 0") -#define RR_CACHE_LINE_SIZE 64 - -#elif defined(__RADPSP2__) - -#define RR_BREAK() \ - { __asm__ volatile("bkpt 0x0000"); } -#define RR_CACHE_LINE_SIZE 32 - -#elif defined(__RADQNX__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 32 -#elif defined(__RADARM__) && defined(__RADLINUX__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 32 -#elif defined(__RADSPU__) - -#define RR_BREAK() __asm volatile("stopd 0,1,1") -#define RR_CACHE_LINE_SIZE 128 - -#elif defined(__RADPS3__) - -// #ifdef snPause // in LibSN.h -// snPause -// __asm__ volatile ( "tw 31,1,1" ) - -#define RR_BREAK() __asm__ volatile("tw 31,1,1") -// #define RR_BREAK() __asm__ volatile("trap"); - -#define RR_CACHE_LINE_SIZE 128 - -#elif defined(__RADMAC__) - -#if defined(__GNUG__) || defined(__GNUC__) -#ifdef __RADX86__ -#define RR_BREAK() __asm__ volatile("int $3") -#else -#define RR_BREAK() __builtin_trap() -#endif -#else -#ifdef __RADMACH__ -void DebugStr(unsigned char const *); -#else -void pascal DebugStr(unsigned char const *); -#endif -#define RR_BREAK() DebugStr("\pRR_BREAK() was called") -#endif - -#define RR_CACHE_LINE_SIZE 64 - -#elif defined(__RADIPHONE__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 32 -#elif defined(__RADXENON__) -#define RR_BREAK() assert(0) -#define RR_CACHE_LINE_SIZE 128 -#elif defined(__RADANDROID__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 32 -#elif defined(__RADPS4__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 64 -#elif defined(__RADNACL__) -#define RR_BREAK() __builtin_trap() -#define RR_CACHE_LINE_SIZE 64 -#else -// x86 : -#define RR_CACHE_LINE_SIZE 64 - -#ifdef __RADLINUX__ -#define RR_BREAK() __asm__ volatile("int $3") -#elif defined(__WATCOMC__) - -void RR_BREAK(void); -#pragma aux RR_BREAK = "int 0x3"; - -#elif defined(__RADWIN__) && defined(_MSC_VER) && _MSC_VER >= 1300 - -#define RR_BREAK __debugbreak - -#else - -#define RR_BREAK() RAD_STATEMENT_WRAPPER(__asm {int 3}) - -#endif - -#endif - -// simple RR_ASSERT : - -// CB 5-27-10 : use RR_DO_ASSERTS to toggle asserts on and off : -#if (defined(_DEBUG) && !defined(NDEBUG)) || defined(ASSERT_IN_RELEASE) -#define RR_DO_ASSERTS -#endif - -/********* - -rrAsserts : - -RR_ASSERT(exp) - the normal assert thing, toggled with RR_DO_ASSERTS -RR_ASSERT_ALWAYS(exp) - assert that you want to test even in ALL builds -(including final!) RR_ASSERT_RELEASE(exp) - assert that you want to test even in -release builds (not for final!) RR_ASSERT_LITE(exp) - normal assert is not safe -from threads or inside malloc; use this instead RR_DURING_ASSERT(exp) - wrap -operations that compute stuff for assert in here RR_DO_ASSERTS - toggle tells -you if asserts are enabled or not - -RR_BREAK() - generate a debug break - always ! -RR_ASSERT_BREAK() - RR_BREAK for asserts ; disable with RAD_NO_BREAK - -RR_ASSERT_FAILURE(str) - just break with a messsage; like assert with no -condition RR_ASSERT_FAILURE_ALWAYS(str) - RR_ASSERT_FAILURE in release builds -too RR_CANT_GET_HERE() - put in spots execution should never go -RR_COMPILER_ASSERT(exp) - checks constant conditions at compile time - -RADTODO - note to search for nonfinal stuff -RR_PRAGMA_MESSAGE - message dealy, use with #pragma in MSVC - -*************/ - -//----------------------------------------------------------- - -#if defined(__GNUG__) || defined(__GNUC__) || \ - (defined(_MSC_VER) && _MSC_VER > 1200) -#define RR_FUNCTION_NAME __FUNCTION__ -#else -#define RR_FUNCTION_NAME 0 - -// __func__ is in the C99 standard -#endif - -//----------------------------------------------------------- - -// rrDisplayAssertion might just log, or it might pop a message box, depending -// on settings -// rrDisplayAssertion returns whether you should break or not -typedef rrbool(RADLINK fp_rrDisplayAssertion)(int *Ignored, - const char *fileName, - const int line, - const char *function, - const char *message); - -extern fp_rrDisplayAssertion *g_fp_rrDisplayAssertion; - -// if I have func pointer, call it, else true ; true = do int 3 -#define rrDisplayAssertion(i, n, l, f, m) \ - ((g_fp_rrDisplayAssertion) ? (*g_fp_rrDisplayAssertion)(i, n, l, f, m) : 1) - -//----------------------------------------------------------- - -// RAD_NO_BREAK : option if you don't like your assert to break -// CB : RR_BREAK is *always* a break ; RR_ASSERT_BREAK is optional -#ifdef RAD_NO_BREAK -#define RR_ASSERT_BREAK() 0 -#else -#define RR_ASSERT_BREAK() RR_BREAK() -#endif - -// assert_always is on FINAL ! -#define RR_ASSERT_ALWAYS(exp) \ - RAD_STATEMENT_WRAPPER(static int Ignored = 0; if (!(exp)) { \ - if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, RR_FUNCTION_NAME, \ - #exp)) \ - RR_ASSERT_BREAK(); \ - }) - -// RR_ASSERT_FAILURE is like an assert without a condition - if you hit it, -// you're bad -#define RR_ASSERT_FAILURE_ALWAYS(str) \ - RAD_STATEMENT_WRAPPER(static int Ignored = 0; \ - if (rrDisplayAssertion(&Ignored, __FILE__, __LINE__, \ - RR_FUNCTION_NAME, str)) \ - RR_ASSERT_BREAK();) - -#define RR_ASSERT_LITE_ALWAYS(exp) \ - RAD_STATEMENT_WRAPPER(if (!(exp)) { RR_ASSERT_BREAK(); }) - -//----------------------------------- -#ifdef RR_DO_ASSERTS - -#define RR_ASSERT(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE(exp) RR_ASSERT_LITE_ALWAYS(exp) -#define RR_ASSERT_NO_ASSUME(exp) RR_ASSERT_ALWAYS(exp) -// RR_DURING_ASSERT is to set up expressions or declare variables that are only -// used in asserts -#define RR_DURING_ASSERT(exp) exp - -#define RR_ASSERT_FAILURE(str) RR_ASSERT_FAILURE_ALWAYS(str) - -// RR_CANT_GET_HERE is for like defaults in switches that should never be hit -#define RR_CANT_GET_HERE() \ - RAD_STATEMENT_WRAPPER(RR_ASSERT_FAILURE("can't get here"); RADUNREACHABLE;) - -#else // RR_DO_ASSERTS //----------------------------------- - -#define RR_ASSERT(exp) (void)0 -#define RR_ASSERT_LITE(exp) (void)0 -#define RR_ASSERT_NO_ASSUME(exp) (void)0 - -#define RR_DURING_ASSERT(exp) (void)0 - -#define RR_ASSERT_FAILURE(str) (void)0 - -#define RR_CANT_GET_HERE() RADUNREACHABLE - -#endif // RR_DO_ASSERTS //----------------------------------- - -//================================================================= - -// RR_ASSERT_RELEASE is on in release build, but not final - -#ifndef __RADFINAL__ - -#define RR_ASSERT_RELEASE(exp) RR_ASSERT_ALWAYS(exp) -#define RR_ASSERT_LITE_RELEASE(exp) RR_ASSERT_LITE_ALWAYS(exp) - -#else - -#define RR_ASSERT_RELEASE(exp) (void)0 -#define RR_ASSERT_LITE_RELEASE(exp) (void)0 - -#endif - -// BH: This never gets compiled away except for __RADFINAL__ -#define RR_ASSERT_ALWAYS_NO_SHIP RR_ASSERT_RELEASE - -#define rrAssert RR_ASSERT -#define rrassert RR_ASSERT - -#ifdef _MSC_VER -// without this, our assert errors... -#if _MSC_VER >= 1300 -#pragma warning(disable : 4127) // conditional expression is constant -#endif -#endif - -//--------------------------------------- -// Get/Put from memory in little or big endian : -// -// val = RR_GET32_BE(ptr) -// RR_PUT32_BE(ptr,val) -// -// available here : -// RR_[GET/PUT][16/32]_[BE/LE][_UNALIGNED][_OFFSET] -// -// if you don't specify _UNALIGNED , then ptr & offset shoud both be -//aligned to type size _OFFSET is in *bytes* ! - -// you can #define RR_GET_RESTRICT to make all RR_GETs be RESTRICT -// if you set nothing they are not - -#ifdef RR_GET_RESTRICT -#define RR_GET_PTR_POST RADRESTRICT -#endif -#ifndef RR_GET_PTR_POST -#define RR_GET_PTR_POST -#endif - -// native version of get/put is always trivial : - -#define RR_GET16_NATIVE(ptr) *((const U16 *RR_GET_PTR_POST)(ptr)) -#define RR_PUT16_NATIVE(ptr, val) *((U16 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U16_PTR_OFFSET(ptr, offset) \ - ((U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET16_NATIVE_OFFSET(ptr, offset) *(RR_U16_PTR_OFFSET((ptr), offset)) -#define RR_PUT16_NATIVE_OFFSET(ptr, val, offset) \ - *(RR_U16_PTR_OFFSET((ptr), offset)) = (val) - -#define RR_GET32_NATIVE(ptr) *((const U32 *RR_GET_PTR_POST)(ptr)) -#define RR_PUT32_NATIVE(ptr, val) *((U32 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U32_PTR_OFFSET(ptr, offset) \ - ((U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET32_NATIVE_OFFSET(ptr, offset) *(RR_U32_PTR_OFFSET((ptr), offset)) -#define RR_PUT32_NATIVE_OFFSET(ptr, val, offset) \ - *(RR_U32_PTR_OFFSET((ptr), offset)) = (val) - -#define RR_GET64_NATIVE(ptr) *((const U64 *RR_GET_PTR_POST)(ptr)) -#define RR_PUT64_NATIVE(ptr, val) *((U64 * RR_GET_PTR_POST)(ptr)) = (val) - -// offset is in bytes -#define RR_U64_PTR_OFFSET(ptr, offset) \ - ((U64 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_GET64_NATIVE_OFFSET(ptr, offset) *(RR_U64_PTR_OFFSET((ptr), offset)) -#define RR_PUT64_NATIVE_OFFSET(ptr, val, offset) \ - *(RR_U64_PTR_OFFSET((ptr), offset)) = (val) - -//--------------------------------------------------- - -#ifdef __RADLITTLEENDIAN__ - -#define RR_GET16_LE RR_GET16_NATIVE -#define RR_PUT16_LE RR_PUT16_NATIVE -#define RR_GET16_LE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_LE_OFFSET RR_PUT16_NATIVE_OFFSET - -#define RR_GET32_LE RR_GET32_NATIVE -#define RR_PUT32_LE RR_PUT32_NATIVE -#define RR_GET32_LE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_LE_OFFSET RR_PUT32_NATIVE_OFFSET - -#define RR_GET64_LE RR_GET64_NATIVE -#define RR_PUT64_LE RR_PUT64_NATIVE -#define RR_GET64_LE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_LE_OFFSET RR_PUT64_NATIVE_OFFSET - -#else - -#define RR_GET16_BE RR_GET16_NATIVE -#define RR_PUT16_BE RR_PUT16_NATIVE -#define RR_GET16_BE_OFFSET RR_GET16_NATIVE_OFFSET -#define RR_PUT16_BE_OFFSET RR_PUT16_NATIVE_OFFSET - -#define RR_GET32_BE RR_GET32_NATIVE -#define RR_PUT32_BE RR_PUT32_NATIVE -#define RR_GET32_BE_OFFSET RR_GET32_NATIVE_OFFSET -#define RR_PUT32_BE_OFFSET RR_PUT32_NATIVE_OFFSET - -#define RR_GET64_BE RR_GET64_NATIVE -#define RR_PUT64_BE RR_PUT64_NATIVE -#define RR_GET64_BE_OFFSET RR_GET64_NATIVE_OFFSET -#define RR_PUT64_BE_OFFSET RR_PUT64_NATIVE_OFFSET - -#endif - -//------------------------- -// non-native Get/Put implementations go here : - -#if defined(__RADX86__) -// good implementation for X86 : - -#if (_MSC_VER >= 1300) - -unsigned short __cdecl _byteswap_ushort(unsigned short _Short); -unsigned long __cdecl _byteswap_ulong(unsigned long _Long); -#pragma intrinsic(_byteswap_ushort, _byteswap_ulong) - -#define RR_BSWAP16 _byteswap_ushort -#define RR_BSWAP32 _byteswap_ulong - -unsigned int64_t __cdecl _byteswap_uint64(unsigned int64_t val); -#pragma intrinsic(_byteswap_uint64) -#define RR_BSWAP64 _byteswap_uint64 - -#elif defined(_MSC_VER) // VC6 - -RADFORCEINLINE unsigned long RR_BSWAP16(unsigned long _Long) { - __asm { - mov eax, [_Long] - rol ax, 8 - mov [_Long], eax; - } - return _Long; -} - -RADFORCEINLINE unsigned long RR_BSWAP32(unsigned long _Long) { - __asm { - mov eax, [_Long] - bswap eax - mov [_Long], eax - } - return _Long; -} - -RADFORCEINLINE unsigned int64_t RR_BSWAP64(unsigned int64_t _Long) { - __asm { - mov eax, DWORD PTR _Long - mov edx, DWORD PTR _Long+4 - bswap eax - bswap edx - mov DWORD PTR _Long, edx - mov DWORD PTR _Long+4, eax - } - return _Long; -} - -#elif defined(__GNUC__) || defined(__clang__) - -// GCC has __builtin_bswap16, but Clang only seems to have added it recently. -// We use __builtin_bswap32/64 but 16 just uses the macro version. (No big -// deal if that turns into shifts anyway) -#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) -#define RR_BSWAP32 __builtin_bswap32 -#define RR_BSWAP64 __builtin_bswap64 - -#endif - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = (U16)RR_BSWAP16(val) -#define RR_GET16_BE_OFFSET(ptr, offset) \ - RR_BSWAP16(*RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_BE_OFFSET(ptr, val, offset) \ - *RR_U16_PTR_OFFSET(ptr, offset) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) -#define RR_GET32_BE_OFFSET(ptr, offset) \ - RR_BSWAP32(*RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_BE_OFFSET(ptr, val, offset) \ - *RR_U32_PTR_OFFSET(ptr, offset) = RR_BSWAP32(val) - -#define RR_GET64_BE(ptr) RR_BSWAP64(*((U64 *)(ptr))) -#define RR_PUT64_BE(ptr, val) *((U64 *)(ptr)) = RR_BSWAP64(val) -#define RR_GET64_BE_OFFSET(ptr, offset) \ - RR_BSWAP64(*RR_U64_PTR_OFFSET(ptr, offset)) -#define RR_PUT64_BE_OFFSET(ptr, val, offset) \ - *RR_U64_PTR_OFFSET(ptr, offset) = RR_BSWAP64(val) - -// end _MSC_VER - -#elif defined(__RADXENON__) // Xenon has built-in funcs for this - -unsigned short __loadshortbytereverse(int offset, const void *base); -unsigned long __loadwordbytereverse(int offset, const void *base); - -void __storeshortbytereverse(unsigned short val, int offset, void *base); -void __storewordbytereverse(unsigned int val, int offset, void *base); - -#define RR_GET16_LE(ptr) __loadshortbytereverse(0, ptr) -#define RR_PUT16_LE(ptr, val) __storeshortbytereverse((U16)(val), 0, ptr) - -#define RR_GET16_LE_OFFSET(ptr, offset) __loadshortbytereverse(offset, ptr) -#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ - __storeshortbytereverse((U16)(val), offset, ptr) - -#define RR_GET32_LE(ptr) __loadwordbytereverse(0, ptr) -#define RR_PUT32_LE(ptr, val) __storewordbytereverse((U32)(val), 0, ptr) - -#define RR_GET32_LE_OFFSET(ptr, offset) __loadwordbytereverse(offset, ptr) -#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ - __storewordbytereverse((U32)(val), offset, ptr) - -#define RR_GET64_LE(ptr) \ - (((U64)RR_GET32_OFFSET_LE(ptr, 4) << 32) | RR_GET32_LE(ptr)) -#define RR_PUT64_LE(ptr, val) \ - RR_PUT32_LE(ptr, (U32)(val)), RR_PUT32_OFFSET_LE(ptr, (U32)((val) >> 32), 4) - -#elif defined(__RADPS3__) - -#include - -#define RR_GET16_LE(ptr) __lhbrx(ptr) -#define RR_PUT16_LE(ptr, val) __sthbrx(ptr, (U16)(val)) - -#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ - __sthbrx(RR_U16_PTR_OFFSET(ptr, offset), (U16)(val)) - -#define RR_GET32_LE(ptr) __lwbrx(ptr) -#define RR_PUT32_LE(ptr, val) __stwbrx(ptr, (U32)(val)) - -#define RR_GET64_LE(ptr) __ldbrx(ptr) -#define RR_PUT64_LE(ptr, val) __stdbrx(ptr, (U32)(val)) - -#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ - __stwbrx(RR_U32_PTR_OFFSET(ptr, offset), (U32)(val)) - -#elif defined(__RADWII__) - -#define RR_GET16_LE(ptr) __lhbrx(ptr, 0) -#define RR_PUT16_LE(ptr, val) __sthbrx((U16)(val), ptr, 0) - -#define RR_GET16_LE_OFFSET(ptr, offset) __lhbrx(ptr, offset) -#define RR_PUT16_LE_OFFSET(ptr, val, offset) __sthbrx((U16)(val), ptr, offset) - -#define RR_GET32_LE(ptr) __lwbrx(ptr, 0) -#define RR_PUT32_LE(ptr, val) __stwbrx((U32)(val), ptr, 0) - -#define RR_GET32_LE_OFFSET(ptr, offset) __lwbrx(ptr, offset) -#define RR_PUT32_LE_OFFSET(ptr, val, offset) __stwbrx((U32)(val), ptr, offset) - -#elif defined(__RAD3DS__) - -#define RR_GET16_BE(ptr) __rev16(*(U16 *)(ptr)) -#define RR_PUT16_BE(ptr, val) *(U16 *)(ptr) = __rev16(val) - -#define RR_GET16_BE_OFFSET(ptr, offset) __rev16(*RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_BE_OFFSET(ptr, offset, val) \ - *RR_U16_PTR_OFFSET(ptr, offset) = __rev16(val) - -#define RR_GET32_BE(ptr) __rev(*(U32 *)(ptr)) -#define RR_PUT32_BE(ptr, val) *(U32 *)(ptr) = __rev(val) - -#define RR_GET32_BE_OFFSET(ptr, offset) __rev(*RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_BE_OFFSET(ptr, offset, val) \ - *RR_U32_PTR_OFFSET(ptr, offset) = __rev(val) - -#elif defined(__RADIPHONE__) - -// iPhone does not seem to have intrinsics for this, so use generic fallback! - -// Bswap is just here for use of implementing get/put -// caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) -#define RR_BSWAP32(u32) \ - ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ - (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#elif defined(__RADWIIU__) - -#include - -#define RR_GET16_LE(ptr) (*(__bytereversed U16 *)(ptr)) -#define RR_PUT16_LE(ptr, val) *(__bytereversed U16 *)(ptr) = val - -#define RR_GET16_LE_OFFSET(ptr, offset) \ - (*(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset)) -#define RR_PUT16_LE_OFFSET(ptr, val, offset) \ - *(__bytereversed U16 *)RR_U16_PTR_OFFSET(ptr, offset) = val - -#define RR_GET32_LE(ptr) (*(__bytereversed U32 *)(ptr)) -#define RR_PUT32_LE(ptr, val) *(__bytereversed U32 *)(ptr) = val - -#define RR_GET32_LE_OFFSET(ptr, offset) \ - (*(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT32_LE_OFFSET(ptr, val, offset) \ - *(__bytereversed U32 *)RR_U32_PTR_OFFSET(ptr, offset) = val - -#define RR_GET64_LE(ptr) (*(__bytereversed U64 *)(ptr)) -#define RR_PUT64_LE(ptr, val) *(__bytereversed U64 *)(ptr) = val - -#define RR_GET64_LE_OFFSET(ptr, offset) \ - (*(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset)) -#define RR_PUT64_LE_OFFSET(ptr, val, offset) \ - *(__bytereversed U64 *)RR_U32_PTR_OFFSET(ptr, offset) = val - -#elif defined(__RADWINRTAPI__) && defined(__RADARM__) - -#include - -#define RR_BSWAP16(u16) _arm_rev16(u16) -#define RR_BSWAP32(u32) _arm_rev(u32) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#elif defined(__RADPSP2__) - -// no rev16 exposed -#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) -#define RR_BSWAP32(u32) __builtin_rev(u32) - -#define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -#define RR_PUT16_BE(ptr, val) *((U16 *)(ptr)) = RR_BSWAP16(val) - -#define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -#define RR_PUT32_BE(ptr, val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#else // other platforms ? - -// fall back : - -// Bswap is just here for use of implementing get/put -// caller should use Get/Put , not bswap -#define RR_BSWAP16(u16) ((U16)(((u16) >> 8) | ((u16) << 8))) -#define RR_BSWAP32(u32) \ - ((U32)(((u32) >> 24) | (((u32) << 8) & 0x00FF0000) | \ - (((u32) >> 8) & 0x0000FF00) | ((u32) << 24))) -#define RR_BSWAP64(u64) \ - (((U64)RR_BSWAP32((U32)(u64)) << 32) | (U64)RR_BSWAP32((U32)((u64) >> 32))) - -#ifdef __RADLITTLEENDIAN__ - -// comment out fallbacks so users will get errors -// #define RR_GET16_BE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -// #define RR_PUT16_BE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -// #define RR_GET32_BE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -// #define RR_PUT32_BE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#else - -// comment out fallbacks so users will get errors -// #define RR_GET16_LE(ptr) RR_BSWAP16(*((U16 *)(ptr))) -// #define RR_PUT16_LE(ptr,val) *((U16 *)(ptr)) = RR_BSWAP16(val) -// #define RR_GET32_LE(ptr) RR_BSWAP32(*((U32 *)(ptr))) -// #define RR_PUT32_LE(ptr,val) *((U32 *)(ptr)) = RR_BSWAP32(val) - -#endif - -#endif - -//=================================================================== -// @@ TEMP : Aliases for old names : remove me when possible : - -#define RR_GET32_OFFSET_LE RR_GET32_LE_OFFSET -#define RR_GET32_OFFSET_BE RR_GET32_BE_OFFSET -#define RR_PUT32_OFFSET_LE RR_PUT32_LE_OFFSET -#define RR_PUT32_OFFSET_BE RR_PUT32_BE_OFFSET -#define RR_GET16_OFFSET_LE RR_GET16_LE_OFFSET -#define RR_GET16_OFFSET_BE RR_GET16_BE_OFFSET -#define RR_PUT16_OFFSET_LE RR_PUT16_LE_OFFSET -#define RR_PUT16_OFFSET_BE RR_PUT16_BE_OFFSET - -//=================================================================== -// UNALIGNED VERSIONS : - -#if defined(__RADX86__) || \ - defined(__RADPPC__) // platforms where unaligned is fast : - -#define RR_GET32_BE_UNALIGNED(ptr) RR_GET32_BE(ptr) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ - RR_GET32_BE_OFFSET(ptr, offset) -#define RR_GET16_BE_UNALIGNED(ptr) RR_GET16_BE(ptr) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ - RR_GET16_BE_OFFSET(ptr, offset) - -#define RR_GET32_LE_UNALIGNED(ptr) RR_GET32_LE(ptr) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ - RR_GET32_LE_OFFSET(ptr, offset) -#define RR_GET16_LE_UNALIGNED(ptr) RR_GET16_LE(ptr) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ - RR_GET16_LE_OFFSET(ptr, offset) - -#elif defined(__RAD3DS__) - -// arm has a "__packed" qualifier to tell the compiler to do unaligned accesses -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ - ((__packed U16 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ - ((__packed U32 * RR_GET_PTR_POST)((char *)(ptr) + (offset))) - -#define RR_GET32_BE_UNALIGNED(ptr) __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ - __rev(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET16_BE_UNALIGNED(ptr) __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ - __rev16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) - -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ - *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ - *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) - -#elif defined(__RADPSP2__) - -#define RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) \ - ((U16 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) -#define RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) \ - ((U32 __unaligned * RR_GET_PTR_POST)((char *)(ptr) + (offset))) - -#define RR_GET32_BE_UNALIGNED(ptr) \ - RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0)) -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ - RR_BSWAP32(*RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset)) -#define RR_GET16_BE_UNALIGNED(ptr) \ - RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0)) -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ - RR_BSWAP16(*RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset)) - -#define RR_GET32_LE_UNALIGNED(ptr) *RR_U32_PTR_OFFSET_UNALIGNED(ptr, 0) -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ - *RR_U32_PTR_OFFSET_UNALIGNED(ptr, offset) -#define RR_GET16_LE_UNALIGNED(ptr) *RR_U16_PTR_OFFSET_UNALIGNED(ptr, 0) -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ - *RR_U16_PTR_OFFSET_UNALIGNED(ptr, offset) - -#else -// Unaligned via bytes : - -#define RR_GET32_BE_UNALIGNED(ptr) \ - (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 24) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 16) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 8) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 0)) - -#define RR_GET32_BE_UNALIGNED_OFFSET(ptr, offset) \ - (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 24) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 16) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 8) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 0)) - -#define RR_GET16_BE_UNALIGNED(ptr) \ - (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 8) | \ - ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 0)) - -#define RR_GET16_BE_UNALIGNED_OFFSET(ptr, offset) \ - (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 8) | \ - ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 0)) - -#define RR_GET32_LE_UNALIGNED(ptr) \ - (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[3] << 24) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[2] << 16) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) - -#define RR_GET32_LE_UNALIGNED_OFFSET(ptr, offset) \ - (((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[3] << 24) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[2] << 16) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ - ((U32)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) - -#define RR_GET16_LE_UNALIGNED(ptr) \ - (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[1] << 8) | \ - ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)))[0] << 0)) - -#define RR_GET16_LE_UNALIGNED_OFFSET(ptr, offset) \ - (((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[1] << 8) | \ - ((U16)(((const U8 *RR_GET_PTR_POST)(ptr)) + (offset))[0] << 0)) - -#endif - -//=================================================================== -// RR_ROTL32 : 32-bit rotate -// - -#ifdef _MSC_VER - -unsigned long __cdecl _lrotl(unsigned long, int); -#pragma intrinsic(_lrotl) - -#define RR_ROTL32(x, k) _lrotl((unsigned long)(x), (int)(k)) - -#elif defined(__RADCELL__) || defined(__RADLINUX__) || defined(__RADWII__) || \ - defined(__RADMACAPI__) || defined(__RADWIIU__) || defined(__RADPS4__) || \ - defined(__RADPSP2__) - -// Compiler turns this into rotate correctly : -#define RR_ROTL32(u32, num) (((u32) << (num)) | ((u32) >> (32 - (num)))) - -#elif defined(__RAD3DS__) - -#define RR_ROTL32(u32, num) __ror(u32, (-(num)) & 31) - -#else - -// comment out fallbacks so users will get errors -// fallback implementation using shift and or : -// #define RR_ROTL32(u32,num) ( ( (u32) << (num) ) | ( (u32) >> (32 - (num))) ) - -#endif - -//=================================================================== -// RR_ROTL64 : 64-bit rotate - -#if (defined(_MSC_VER) && _MSC_VER >= 1300) - -unsigned int64_t __cdecl _rotl64(unsigned int64_t _Val, int _Shift); -#pragma intrinsic(_rotl64) - -#define RR_ROTL64(x, k) _rotl64((unsigned int64_t)(x), (int)(k)) - -#elif defined(__RADCELL__) - -// PS3 GCC turns this into rotate correctly : -#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) - -#elif defined(__RADLINUX__) || defined(__RADMACAPI__) - -// APTODO: Just to compile linux. Should we be doing better than this? If not, -// combine with above. -#define RR_ROTL64(u64, num) (((u64) << (num)) | ((u64) >> (64 - (num)))) - -#else - -// comment out fallbacks so users will get errors -// fallback implementation using shift and or : -// #define RR_ROTL64(u64,num) ( ( (u64) << (num) ) | ( (u64) >> (64 - (num))) ) - -#endif - -//=================================================================== - -RADDEFEND - -//=================================================================== - -// RR_COMPILER_ASSERT -#if defined(__cplusplus) && !defined(RR_COMPILER_ASSERT) -#if defined(_MSC_VER) && (_MSC_VER >= 1400) - -// better version of COMPILER_ASSERT using boost technique -template -struct RR_COMPILER_ASSERT_FAILURE; - -template <> -struct RR_COMPILER_ASSERT_FAILURE<1> { - enum { value = 1 }; -}; - -template -struct rr_compiler_assert_test {}; - -// __LINE__ macro broken when -ZI is used see Q199057 -#define RR_COMPILER_ASSERT(B) \ - typedef rr_compiler_assert_test)> \ - rr_compiler_assert_typedef_ - -#endif -#endif - -#ifndef RR_COMPILER_ASSERT -// this happens at declaration time, so if it's inside a function in a C file, -// drop {} around it -#define RR_COMPILER_ASSERT(exp) \ - typedef char RR_STRING_JOIN(_dummy_array, __LINE__)[(exp) ? 1 : -1] -#endif - -//=================================================================== -// some error checks : - -RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == - sizeof(RR_STRING_JOIN(RAD_U, RAD_PTRBITS))); -RR_COMPILER_ASSERT(sizeof(RAD_UINTa) == RAD_PTRBYTES); -RR_COMPILER_ASSERT(RAD_TWOPTRBYTES == 2 * RAD_PTRBYTES); - -//=================================================================== - -#endif // __RADRES__ - -// include "testconstant.inl" // uncomment and include to test statement -// constants - -#endif // __RADRR_COREH__ diff --git a/targets/app/windows/Windows64_App.cpp b/targets/app/windows/Windows64_App.cpp deleted file mode 100644 index 5d7ac43bd..000000000 --- a/targets/app/windows/Windows64_App.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -#include "WindowsGame.h" -#include "platform/game/game.h" -#include "app/common/Game.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/User.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/server/PlayerList.h" -#include "minecraft/server/level/ServerPlayer.h" -#include "minecraft/world/level/Level.h" -#include "minecraft/world/level/LevelSettings.h" -#include "minecraft/world/level/LevelType.h" -#include "minecraft/world/level/biome/BiomeSource.h" - -WindowsGame app; - -#define CONTEXT_GAME_STATE 0 - -WindowsGame::WindowsGame() : Game() {} - -void WindowsGame::StoreLaunchData() {} -void WindowsGame::ExitGame() {} -void WindowsGame::FatalLoadError() {} - -void WindowsGame::TemporaryCreateGameStart() { - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_Main::OnInit - - app.setLevelGenerationOptions(nullptr); - - // From CScene_Main::RunPlayGame - Minecraft* pMinecraft = Minecraft::GetInstance(); - PlatformGame.ReleaseSaveThumbnail(); - PlatformProfile.SetLockedProfile(0); - pMinecraft->user->name = "Windows"; - app.ApplyGameSettingsChanged(0); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameJoinLoad::OnInit - MinecraftServer::resetFlags(); - - // From CScene_MultiGameJoinLoad::OnNotifyPressEx - app.SetTutorialMode(false); - app.SetCorruptSaveDeleted(false); - - ////////////////////////////////////////////////////////////////////////////////////////////// - /// From CScene_MultiGameCreate::CreateGame - - app.ClearTerrainFeaturePosition(); - std::string wWorldName = "TestWorld"; - - PlatformStorage.ResetSaveData(); - PlatformStorage.SetSaveTitle(wWorldName.c_str()); - - bool isFlat = false; - int64_t seedValue = - 0; // BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); - // // 4J - was (new Random())->nextLong() - now trying to actually - // find a seed to suit our requirements - - NetworkGameInitData* param = new NetworkGameInitData(); - param->seed = seedValue; - param->saveData = nullptr; - - app.SetGameHostOption(eGameHostOption_Difficulty, 0); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends, 0); - app.SetGameHostOption(eGameHostOption_Gamertags, 1); - app.SetGameHostOption(eGameHostOption_BedrockFog, 1); - - app.SetGameHostOption( - eGameHostOption_GameType, - GameType::CREATIVE->getId()); // LevelSettings::GAMETYPE_SURVIVAL - app.SetGameHostOption(eGameHostOption_LevelType, 0); - app.SetGameHostOption(eGameHostOption_Structures, 1); - app.SetGameHostOption(eGameHostOption_BonusChest, 0); - - app.SetGameHostOption(eGameHostOption_PvP, 1); - app.SetGameHostOption(eGameHostOption_TrustPlayers, 1); - app.SetGameHostOption(eGameHostOption_FireSpreads, 1); - app.SetGameHostOption(eGameHostOption_TNT, 1); - app.SetGameHostOption(eGameHostOption_HostCanFly, 1); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1); - - param->settings = app.GetGameHostOption(eGameHostOption_All); - - g_NetworkManager.FakeLocalPlayerJoined(); - - LoadingInputParams* loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = param; - - // Reset the autosave time - app.SetAutosaveTimerTime(); - - C4JThread* thread = new C4JThread(loadingParams->func, - loadingParams->lpParam, "RunNetworkGame"); - thread->run(); -} - diff --git a/targets/app/windows/Windows64_UIController.cpp b/targets/app/windows/Windows64_UIController.cpp deleted file mode 100644 index a1056d9e8..000000000 --- a/targets/app/windows/Windows64_UIController.cpp +++ /dev/null @@ -1,179 +0,0 @@ - -#include "Windows64_UIController.h" - -// Temp -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/renderer/Textures.h" - -#define _ENABLEIGGY - -ConsoleUIController ui; - -void ConsoleUIController::init(ID3D11Device* dev, ID3D11DeviceContext* ctx, - ID3D11RenderTargetView* pRenderTargetView, - ID3D11DepthStencilView* pDepthStencilView, S32 w, - S32 h) { -#ifdef _ENABLEIGGY - m_pRenderTargetView = pRenderTargetView; - m_pDepthStencilView = pDepthStencilView; - - // Shared init - preInit(w, h); - - gdraw_funcs = gdraw_D3D11_CreateContext(dev, ctx, w, h); - - if (!gdraw_funcs) { - app.DebugPrintf("Failed to initialise GDraw!\n"); -#ifndef _CONTENT_PACKAGE - assert(0); -#endif - app.FatalLoadError(); - } - - /* For each of the resource types, we specify the size of the cache that - GDraw will use. We specify both the number of possible objects - (the number of "handles") of each type, and the maximum memory - to use for each one. - - For some platforms, we would actually pass - in the memory to use, and the GDraw will strictly obey the resource - request. For D3D, storage is managed by D3D, and GDraw only - approximates the requested storage amount. In fact, you don't - even have to set these at all for D3D, which has some "reasonable" defaults, - but we'll set it here for clarity. - (The storage required for - the handles is separate, and always allocated through the global allocator - specified in IggyInit.) - - The size that's actually needed here depends on the content of your - Flash file. There's more info in the documentation about how to - determine how big they should be. But for now, we'll just set them - really big so if you substitute a different file it should work. */ - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_vertexbuffer, 5000, - 16 * 1024 * 1024); - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_texture, 5000, - 128 * 1024 * 1024); - gdraw_D3D11_SetResourceLimits(GDRAW_D3D11_RESOURCE_rendertarget, 10, - 32 * 1024 * 1024); - - /* GDraw is all set, so we'll point Iggy at it. */ - IggySetGDraw(gdraw_funcs); - - /* Flash content can have audio embedded. We'd like to be able - to play back any audio there is in the Flash that we load, - but in this tutorial we don't care about processing the sound - ourselves. So we call $IggyAudioUseDirectSound to tell Iggy - to go ahead and send any sound from the Flash movie directly - to Win32's default DirectSound device. */ - IggyAudioUseDirectSound(); - - // Shared init - postInit(); -#endif -} - -void ConsoleUIController::render() { -#ifdef _ENABLEIGGY - /* Now that we've cleared, we need to tell GDraw which - render target to use, what depth/stencil buffer to use, - and where the origin should be. - - If we were using multisampling, we'd also need to give - GDraw a render target view for a non-multisampled texture - the size of main_rtv as a resolve target (this is the third - parameter). But since we're not using multisampling in this - example, no resolve targets are required. */ - gdraw_D3D11_SetTileOrigin(m_pRenderTargetView, m_pDepthStencilView, nullptr, - 0, 0); - - renderScenes(); - - /* Finally we're ready to display the frame. We call GDraw to - let it know we're done rendering, so it can do any finalization - it needs to do. */ - gdraw_D3D11_NoMoreGDrawThisFrame(); -#endif -} - -void ConsoleUIController::beginIggyCustomDraw4J( - IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) { - // get the correct object-to-world matrix from GDraw, and set the render - // state to a normal state - gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); -} - -CustomDrawData* ConsoleUIController::setupCustomDraw( - UIScene* scene, IggyCustomDrawCallbackRegion* region) { - CustomDrawData* customDrawRegion = new CustomDrawData(); - customDrawRegion->x0 = region->x0; - customDrawRegion->x1 = region->x1; - customDrawRegion->y0 = region->y0; - customDrawRegion->y1 = region->y1; - - // get the correct object-to-world matrix from GDraw, and set the render - // state to a normal state - gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); - - setupCustomDrawGameStateAndMatrices(scene, customDrawRegion); - - return customDrawRegion; -} - -CustomDrawData* ConsoleUIController::calculateCustomDraw( - IggyCustomDrawCallbackRegion* region) { - CustomDrawData* customDrawRegion = new CustomDrawData(); - customDrawRegion->x0 = region->x0; - customDrawRegion->x1 = region->x1; - customDrawRegion->y0 = region->y0; - customDrawRegion->y1 = region->y1; - - gdraw_D3D11_CalculateCustomDraw_4J(region, customDrawRegion->mat); - - return customDrawRegion; -} - -void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion* region) { - endCustomDrawGameStateAndMatrices(); - - gdraw_D3D11_EndCustomDraw(region); -} - -void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { - gdraw_D3D11_SetTileOrigin(m_pRenderTargetView, m_pDepthStencilView, nullptr, - xPos, yPos); -} - -GDrawTexture* ConsoleUIController::getSubstitutionTexture(int textureId) { - /* Create a wrapped texture from a shader resource view. - A wrapped texture can be used to let Iggy draw using the contents of a - texture you create and manage on your own. For example, you might render to - 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 = - PlatformRenderer.TextureGetTexture(textureId); - ID3D11Resource* resource; - tex->GetResource(&resource); - ID3D11Texture2D* tex2d = (ID3D11Texture2D*)resource; - D3D11_TEXTURE2D_DESC desc; - tex2d->GetDesc(&desc); - GDrawTexture* gdrawTex = gdraw_D3D11_WrappedTextureCreate(tex); - return gdrawTex; -} - -void ConsoleUIController::destroySubstitutionTexture(void* destroyCallBackData, - GDrawTexture* handle) { - /* Destroys the GDraw wrapper for a wrapped texture object. This will free - up a GDraw texture handle but not release the associated D3D texture; that - is up to you. */ - gdraw_D3D11_WrappedTextureDestroy(handle); -} - -void ConsoleUIController::shutdown() { -#ifdef _ENABLEIGGY - /* Destroy the GDraw context. This frees all resources, shaders etc. - allocated by GDraw. Note this is only safe to call after all - active Iggy player have been destroyed! */ - gdraw_D3D11_DestroyContext(); -#endif -} \ No newline at end of file diff --git a/targets/app/windows/Windows64_UIController.h b/targets/app/windows/Windows64_UIController.h deleted file mode 100644 index 70e05b148..000000000 --- a/targets/app/windows/Windows64_UIController.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "app/common/UI/UIController.h" - -class ConsoleUIController : public UIController { -private: - ID3D11RenderTargetView* m_pRenderTargetView; - ID3D11DepthStencilView* m_pDepthStencilView; - -public: - void init(ID3D11Device* dev, ID3D11DeviceContext* ctx, - ID3D11RenderTargetView* pRenderTargetView, - ID3D11DepthStencilView* pDepthStencilView, S32 w, S32 h); - - void render(); - void beginIggyCustomDraw4J(IggyCustomDrawCallbackRegion* region, - CustomDrawData* customDrawRegion); - virtual CustomDrawData* setupCustomDraw( - UIScene* scene, IggyCustomDrawCallbackRegion* region); - virtual CustomDrawData* calculateCustomDraw( - IggyCustomDrawCallbackRegion* region); - virtual void endCustomDraw(IggyCustomDrawCallbackRegion* region); - -protected: - virtual void setTileOrigin(S32 xPos, S32 yPos); - -public: - GDrawTexture* getSubstitutionTexture(int textureId); - void destroySubstitutionTexture(void* destroyCallBackData, - GDrawTexture* handle); - -public: - void shutdown(); -}; - -extern ConsoleUIController ui; \ No newline at end of file diff --git a/targets/app/windows/WindowsGame.h b/targets/app/windows/WindowsGame.h deleted file mode 100644 index 8531137bc..000000000 --- a/targets/app/windows/WindowsGame.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -class WindowsGame : public Game { -public: - WindowsGame(); - - virtual void StoreLaunchData(); - virtual void ExitGame(); - virtual void FatalLoadError(); - - C4JStringTable* GetStringTable() { return nullptr; } - - // original code - virtual void TemporaryCreateGameStart(); -}; - -extern WindowsGame app; diff --git a/targets/app/windows/XML/ATGXmlParser.cpp b/targets/app/windows/XML/ATGXmlParser.cpp deleted file mode 100644 index 6b804aa58..000000000 --- a/targets/app/windows/XML/ATGXmlParser.cpp +++ /dev/null @@ -1,821 +0,0 @@ -// 4J-PB - -// The ATG Framework is a common set of C++ class libraries that is used by the -// samples in the XDK, and was developed by the Advanced Technology Group (ATG). -// The ATG Framework offers a clean and consistent format for the samples. These -// classes define functions used by all the samples. The ATG Framework together -// with the samples demonstrates best practices and innovative techniques for -// Xbox 360. There are many useful sections of code in the samples. You are -// encouraged to incorporate this code into your titles. - -//------------------------------------------------------------------------------------- -// AtgXmlParser.cpp -// -// Simple callback non-validating XML parser implementation. -// -// Xbox Advanced Technology Group. -// Copyright (C) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------------- - -#include "ATGXmlParser.h" - -#include - -namespace ATG { - -//------------------------------------------------------------------------------------- -// Name: XMLParser::XMLParser -//------------------------------------------------------------------------------------- -XMLParser::XMLParser() { - m_pWritePtr = m_pWriteBuf; - m_pReadPtr = m_pReadBuf; - m_pISAXCallback = nullptr; - m_hFile = INVALID_HANDLE_VALUE; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::~XMLParser -//------------------------------------------------------------------------------------- -XMLParser::~XMLParser() {} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::FillBuffer -// Desc: Reads a block from the current open file -//------------------------------------------------------------------------------------- -void XMLParser::FillBuffer() { - uint32_t NChars; - - m_pReadPtr = m_pReadBuf; - - if (m_hFile == nullptr) { - if (m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE) - NChars = XML_READ_BUFFER_SIZE; - else - NChars = m_uInXMLBufferCharsLeft; - - std::memcpy(m_pReadBuf, m_pInXMLBuffer, NChars); - m_uInXMLBufferCharsLeft -= NChars; - m_pInXMLBuffer += NChars; - } else { - if (!ReadFile(m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, - nullptr)) { - return; - } - } - - m_dwCharsConsumed += NChars; - int64_t iProgress = - m_dwCharsTotal - ? (((int64_t)m_dwCharsConsumed * 1000) / (int64_t)m_dwCharsTotal) - : 0; - m_pISAXCallback->SetParseProgress((uint32_t)iProgress); - - m_pReadBuf[NChars] = '\0'; - m_pReadBuf[NChars + 1] = '\0'; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::SkipNextAdvance -// Desc: Puts the last character read back on the input stream -//------------------------------------------------------------------------------------- -void XMLParser::SkipNextAdvance() { m_bSkipNextAdvance = true; } - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ConsumeSpace -// Desc: Skips spaces in the current stream -//------------------------------------------------------------------------------------- -int32_t XMLParser::ConsumeSpace() { - int32_t hr; - - // Skip spaces - if (FAILED(hr = AdvanceCharacter())) return hr; - - while ((m_Ch == ' ') || (m_Ch == '\t') || (m_Ch == '\n') || - (m_Ch == '\r')) { - if (FAILED(hr = AdvanceCharacter())) return hr; - } - SkipNextAdvance(); - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ConvertEscape -// Desc: Copies and converts an escape sequence into m_pWriteBuf -//------------------------------------------------------------------------------------- -int32_t XMLParser::ConvertEscape() { - int32_t hr; - char wVal = 0; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // all escape sequences start with &, so ignore the first character - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '#') // character as hex or decimal - { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch == 'x') // hex number - { - if (FAILED(hr = AdvanceCharacter())) return hr; - - while (m_Ch != ';') { - wVal *= 16; - - if ((m_Ch >= '0') && (m_Ch <= '9')) { - wVal += m_Ch - '0'; - } else if ((m_Ch >= 'a') && (m_Ch <= 'f')) { - wVal += m_Ch - 'a' + 10; - } else if ((m_Ch >= 'A') && (m_Ch <= 'F')) { - wVal += m_Ch - 'A' + 10; - } else { - Error(E_INVALID_XML_SYNTAX, - "Expected hex digit as part of &#x escape sequence"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - } else // decimal number - { - while (m_Ch != ';') { - wVal *= 10; - - if ((m_Ch >= '0') && (m_Ch <= '9')) { - wVal += m_Ch - '0'; - } else { - Error( - E_INVALID_XML_SYNTAX, - "Expected decimal digit as part of &# escape sequence"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - } - - // copy character into the buffer - m_Ch = wVal; - - return 0; - } - - // must be an entity reference - - char* pEntityRefVal = m_pWritePtr; - uint32_t EntityRefLen; - - SkipNextAdvance(); - if (FAILED(hr = AdvanceName())) return hr; - - EntityRefLen = (uint32_t)(m_pWritePtr - pEntityRefVal); - m_pWritePtr = pEntityRefVal; - - if (EntityRefLen == 0) { - Error(E_INVALID_XML_SYNTAX, "Expecting entity name after &"); - return E_INVALID_XML_SYNTAX; - } - - if (!strncmp(pEntityRefVal, "lt", EntityRefLen)) - wVal = '<'; - else if (!strncmp(pEntityRefVal, "gt", EntityRefLen)) - wVal = '>'; - else if (!strncmp(pEntityRefVal, "amp", EntityRefLen)) - wVal = '&'; - else if (!strncmp(pEntityRefVal, "apos", EntityRefLen)) - wVal = '\''; - else if (!strncmp(pEntityRefVal, "quot", EntityRefLen)) - wVal = '"'; - else { - Error(E_INVALID_XML_SYNTAX, - "Unrecognized entity name after & - (should be lt, gt, amp, " - "apos, or quot)"); - return E_INVALID_XML_SYNTAX; // return false if unrecognized token - // sequence - } - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != ';') { - Error(E_INVALID_XML_SYNTAX, - "Expected terminating ; for entity reference"); - return E_INVALID_XML_SYNTAX; // malformed reference - needs terminating - // ; - } - - m_Ch = wVal; - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceAttrVal -// Desc: Copies an attribute value into m_pWrite buf, skipping surrounding -// quotes -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceAttrVal() { - int32_t hr; - char wQuoteChar; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if ((m_Ch != '"') && (m_Ch != '\'')) { - Error(E_INVALID_XML_SYNTAX, - "Attribute values must be enclosed in quotes"); - return E_INVALID_XML_SYNTAX; - } - - wQuoteChar = m_Ch; - - for (;;) { - if (FAILED(hr = AdvanceCharacter())) - return hr; - else if (m_Ch == wQuoteChar) - break; - else if (m_Ch == '&') { - SkipNextAdvance(); - if (FAILED(hr = ConvertEscape())) return hr; - } else if (m_Ch == '<') { - Error(E_INVALID_XML_SYNTAX, "Illegal character '<' in element tag"); - return E_INVALID_XML_SYNTAX; - } - - // copy character into the buffer - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - Error(E_INVALID_XML_SYNTAX, - "Total element tag size may not be more than %d characters", - XML_WRITE_BUFFER_SIZE); - return E_INVALID_XML_SYNTAX; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - } - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceName -// Desc: Copies a name into the m_pWriteBuf - returns true on success, false on -// failure -// Ignores leading whitespace. Currently does not support unicode names -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceName() { - int32_t hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (((m_Ch < 'A') || (m_Ch > 'Z')) && ((m_Ch < 'a') || (m_Ch > 'z')) && - (m_Ch != '_') && (m_Ch != ':')) { - Error(E_INVALID_XML_SYNTAX, - "Names must start with an alphabetic character or _ or :"); - return E_INVALID_XML_SYNTAX; - } - - while (((m_Ch >= 'A') && (m_Ch <= 'Z')) || - ((m_Ch >= 'a') && (m_Ch <= 'z')) || - ((m_Ch >= '0') && (m_Ch <= '9')) || (m_Ch == '_') || (m_Ch == ':') || - (m_Ch == '-') || (m_Ch == '.')) { - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - Error(E_INVALID_XML_SYNTAX, - "Total element tag size may not be more than %d characters", - XML_WRITE_BUFFER_SIZE); - return E_INVALID_XML_SYNTAX; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - - SkipNextAdvance(); - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceCharacter -// Desc: Copies the character at *m_pReadPtr to m_Ch -// handling difference in UTF16 / UTF8, and big/little endian -// and getting another chunk of the file if needed -// Returns S_OK if there are more characters, E_ABORT for no characters to -// read -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCharacter(bool bOkToFail) { - if (m_bSkipNextAdvance) { - m_bSkipNextAdvance = false; - return 0; - } - - // If we hit EOF in the middle of a character, - // it's ok-- we'll just have a corrupt last character - // (the buffer is padded with double NULLs ) - - if ((m_pReadPtr[0] == '\0') && (m_pReadPtr[1] == '\0')) { - // Read more from the file - FillBuffer(); - - // We are at EOF if it is still nullptr - if ((m_pReadPtr[0] == '\0') && (m_pReadPtr[1] == '\0')) { - if (!bOkToFail) { - Error(E_INVALID_XML_SYNTAX, - "Unexpected EOF while parsing XML file"); - return E_INVALID_XML_SYNTAX; - } else { - return E_FAIL; - } - } - } - - if (m_bUnicode == false) { - m_Ch = *((char*)m_pReadPtr); - m_pReadPtr++; - } else // if( m_bUnicode == true ) - { - m_Ch = *((char*)m_pReadPtr); - - if (m_bReverseBytes) { - m_Ch = (m_Ch << 8) + (m_Ch >> 8); - } - - m_pReadPtr += 2; - } - - if (m_Ch == '\n') { - m_pISAXCallback->m_LineNum++; - m_pISAXCallback->m_LinePos = 0; - } else if (m_Ch != '\r') - m_pISAXCallback->m_LinePos++; - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceElement -// Desc: Builds data, calls callback -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceElement() { - int32_t hr; - - // write ptr at the beginning of the buffer - m_pWritePtr = m_pWriteBuf; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // if first character wasn't '<', we wouldn't be here - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '!') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch == '-') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch != '-') { - Error(E_INVALID_XML_SYNTAX, "Expecting '-' after 'ElementEnd( - pEntityRefVal, (uint32_t)(m_pWritePtr - pEntityRefVal)))) - return E_ABORT; - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != '>') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '>' after name for closing entity reference"); - return E_INVALID_XML_SYNTAX; - } - } else if (m_Ch == '?') { - // just skip any xml header tag since not really important after - // identifying character set - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch == '>') return 0; - } - } else { - XMLAttribute Attributes[XML_MAX_ATTRIBUTES_PER_ELEMENT]; - uint32_t NumAttrs; - - char* pEntityRefVal = m_pWritePtr; - uint32_t EntityRefLen; - - NumAttrs = 0; - - SkipNextAdvance(); - - // Entity tag - if (FAILED(hr = AdvanceName())) return hr; - - EntityRefLen = (uint32_t)(m_pWritePtr - pEntityRefVal); - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - // read attributes - while ((m_Ch != '>') && (m_Ch != '/')) { - SkipNextAdvance(); - - if (NumAttrs >= XML_MAX_ATTRIBUTES_PER_ELEMENT) { - Error(E_INVALID_XML_SYNTAX, - "Elements may not have more than %d attributes", - XML_MAX_ATTRIBUTES_PER_ELEMENT); - return E_INVALID_XML_SYNTAX; - } - - Attributes[NumAttrs].strName = m_pWritePtr; - - // Attribute name - if (FAILED(hr = AdvanceName())) return hr; - - Attributes[NumAttrs].NameLen = - (uint32_t)(m_pWritePtr - Attributes[NumAttrs].strName); - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - - if (m_Ch != '=') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '=' character after attribute name"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(hr = ConsumeSpace())) return hr; - - Attributes[NumAttrs].strValue = m_pWritePtr; - - if (FAILED(hr = AdvanceAttrVal())) return hr; - - Attributes[NumAttrs].ValueLen = - (uint32_t)(m_pWritePtr - Attributes[NumAttrs].strValue); - - ++NumAttrs; - - if (FAILED(hr = ConsumeSpace())) return hr; - - if (FAILED(hr = AdvanceCharacter())) return hr; - } - - if (m_Ch == '/') { - if (FAILED(hr = AdvanceCharacter())) return hr; - if (m_Ch != '>') { - Error(E_INVALID_XML_SYNTAX, - "Expecting '>' after '/' in element tag"); - return E_INVALID_XML_SYNTAX; - } - - if (FAILED(m_pISAXCallback->ElementBegin( - pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) - return E_ABORT; - - if (FAILED( - m_pISAXCallback->ElementEnd(pEntityRefVal, EntityRefLen))) - return E_ABORT; - } else { - if (FAILED(m_pISAXCallback->ElementBegin( - pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) - return E_ABORT; - } - } - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceCDATA -// Desc: Read a CDATA section -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCDATA() { - int32_t hr; - uint16_t wStage = 0; - - if (FAILED(m_pISAXCallback->CDATABegin())) return E_ABORT; - - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if ((m_Ch == ']') && (wStage == 0)) - wStage = 1; - else if ((m_Ch == ']') && (wStage == 1)) - wStage = 2; - else if ((m_Ch == '>') && (wStage == 2)) { - m_pWritePtr -= 3; - break; - } else - wStage = 0; - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - if (FAILED(m_pISAXCallback->CDATAData( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), true))) - return E_ABORT; - m_pWritePtr = m_pWriteBuf; - } - } - - if (FAILED(m_pISAXCallback->CDATAData( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), false))) - return E_ABORT; - - m_pWritePtr = m_pWriteBuf; - - if (FAILED(m_pISAXCallback->CDATAEnd())) return E_ABORT; - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::AdvanceComment -// Desk: Skips over a comment -//------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceComment() { - int32_t hr; - uint16_t wStage; - - wStage = 0; - for (;;) { - if (FAILED(hr = AdvanceCharacter())) return hr; - - if ((m_Ch == '-') && (wStage == 0)) - wStage = 1; - else if ((m_Ch == '-') && (wStage == 1)) - wStage = 2; - else if ((m_Ch == '>') && (wStage == 2)) - break; - else - wStage = 0; - } - - return 0; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::RegisterSAXCallbackInterface -// Desc: Registers callback interface -//------------------------------------------------------------------------------------- -void XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) { - m_pISAXCallback = pISAXCallback; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::GetSAXCallbackInterface -// Desc: Returns current callback interface -//------------------------------------------------------------------------------------- -ISAXCallback* XMLParser::GetSAXCallbackInterface() { return m_pISAXCallback; } - -//------------------------------------------------------------------------------------- -// Name: XMLParser::MainParseLoop -// Desc: Main Loop to Parse Data - source agnostic -//------------------------------------------------------------------------------------- -int32_t XMLParser::MainParseLoop() { - bool bWhiteSpaceOnly = true; - int32_t hr = 0; - - if (FAILED(m_pISAXCallback->StartDocument())) return E_ABORT; - - m_pWritePtr = m_pWriteBuf; - - FillBuffer(); - - if (*((char*)m_pReadBuf) == 0xFEFF) { - m_bUnicode = true; - m_bReverseBytes = false; - m_pReadPtr += 2; - } else if (*((char*)m_pReadBuf) == 0xFFFE) { - m_bUnicode = true; - m_bReverseBytes = true; - m_pReadPtr += 2; - } else if (*((char*)m_pReadBuf) == 0x003C) { - m_bUnicode = true; - m_bReverseBytes = false; - } else if (*((char*)m_pReadBuf) == 0x3C00) { - m_bUnicode = true; - m_bReverseBytes = true; - } else if (m_pReadBuf[0] == 0x3C) { - m_bUnicode = false; - m_bReverseBytes = false; - } else { - Error(E_INVALID_XML_SYNTAX, - "Unrecognized encoding (parser does not support UTF-8 language " - "encodings)"); - return E_INVALID_XML_SYNTAX; - } - - for (;;) { - if (FAILED(AdvanceCharacter(true))) { - if (((uint32_t)(m_pWritePtr - m_pWriteBuf) != 0) && - (!bWhiteSpaceOnly)) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - false))) - return E_ABORT; - - bWhiteSpaceOnly = true; - } - - if (FAILED(m_pISAXCallback->EndDocument())) return E_ABORT; - - return 0; - } - - if (m_Ch == '<') { - if (((uint32_t)(m_pWritePtr - m_pWriteBuf) != 0) && - (!bWhiteSpaceOnly)) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - false))) - return E_ABORT; - - bWhiteSpaceOnly = true; - } - - SkipNextAdvance(); - - m_pWritePtr = m_pWriteBuf; - - if (FAILED(hr = AdvanceElement())) return hr; - - m_pWritePtr = m_pWriteBuf; - } else { - if (m_Ch == '&') { - SkipNextAdvance(); - if (FAILED(hr = ConvertEscape())) return hr; - } - - if (bWhiteSpaceOnly && (m_Ch != ' ') && (m_Ch != '\n') && - (m_Ch != '\r') && (m_Ch != '\t')) { - bWhiteSpaceOnly = false; - } - - *m_pWritePtr = m_Ch; - m_pWritePtr++; - - if (m_pWritePtr - m_pWriteBuf >= XML_WRITE_BUFFER_SIZE) { - if (!bWhiteSpaceOnly) { - if (FAILED(m_pISAXCallback->ElementContent( - m_pWriteBuf, (uint32_t)(m_pWritePtr - m_pWriteBuf), - true))) { - return E_ABORT; - } - } - - m_pWritePtr = m_pWriteBuf; - bWhiteSpaceOnly = true; - } - } - } -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ParseXMLFile -// Desc: Builds element data -//------------------------------------------------------------------------------------- -int32_t XMLParser::ParseXMLFile(const char* strFilename) { - int32_t hr; - - if (m_pISAXCallback == nullptr) return E_NOINTERFACE; - - m_pISAXCallback->m_LineNum = 1; - m_pISAXCallback->m_LinePos = 0; - m_pISAXCallback->m_strFilename = - strFilename; // save this off only while we parse the file - - m_bSkipNextAdvance = false; - m_pReadPtr = m_pReadBuf; - - m_pReadBuf[0] = '\0'; - m_pReadBuf[1] = '\0'; - - m_pInXMLBuffer = nullptr; - m_uInXMLBufferCharsLeft = 0; - m_hFile = CreateFile(strFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, - OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); - - if (m_hFile == INVALID_HANDLE_VALUE) { - Error(E_COULD_NOT_OPEN_FILE, "Error opening file"); - hr = E_COULD_NOT_OPEN_FILE; - - } else { - LARGE_INTEGER iFileSize; - GetFileSizeEx(m_hFile, &iFileSize); - m_dwCharsTotal = (uint32_t)iFileSize.QuadPart; - m_dwCharsConsumed = 0; - hr = MainParseLoop(); - } - - // Close the file - if (m_hFile != INVALID_HANDLE_VALUE) CloseHandle(m_hFile); - m_hFile = INVALID_HANDLE_VALUE; - - // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; - - return hr; -} - -//------------------------------------------------------------------------------------- -// Name: XMLParser::ParseXMLFile -// Desc: Builds element data -//------------------------------------------------------------------------------------- -int32_t XMLParser::ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize) { - int32_t hr; - - if (m_pISAXCallback == nullptr) return E_NOINTERFACE; - - m_pISAXCallback->m_LineNum = 1; - m_pISAXCallback->m_LinePos = 0; - m_pISAXCallback->m_strFilename = - ""; // save this off only while we parse the file - - m_bSkipNextAdvance = false; - m_pReadPtr = m_pReadBuf; - - m_pReadBuf[0] = '\0'; - m_pReadBuf[1] = '\0'; - - m_hFile = nullptr; - m_pInXMLBuffer = strBuffer; - m_uInXMLBufferCharsLeft = uBufferSize; - m_dwCharsTotal = uBufferSize; - m_dwCharsConsumed = 0; - - hr = MainParseLoop(); - - // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = nullptr; - - return hr; -} - -//------------------------------------------------------------------------------------- -// XMLParser::Error() -// Logs an error through the callback interface -//------------------------------------------------------------------------------------- -#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation -void XMLParser::Error(int32_t hErr, - _In_z_ _Printf_format_string_ const char* strFormat, ...) -#else -void XMLParser::Error(int32_t hErr, const char* strFormat, ...) -#endif -{ - const int32_t MAX_OUTPUT_STR = 160; - char strBuffer[MAX_OUTPUT_STR]; - va_list pArglist; - va_start(pArglist, strFormat); - - vsprintf(strBuffer, strFormat, pArglist); - - m_pISAXCallback->Error(hErr, strBuffer); - va_end(pArglist); -} - -} // namespace ATG diff --git a/targets/app/windows/XML/ATGXmlParser.h b/targets/app/windows/XML/ATGXmlParser.h deleted file mode 100644 index 45ebfaee1..000000000 --- a/targets/app/windows/XML/ATGXmlParser.h +++ /dev/null @@ -1,159 +0,0 @@ -// 4J-PB - -// The ATG Framework is a common set of C++ class libraries that is used by the -// samples in the XDK, and was developed by the Advanced Technology Group (ATG). -// The ATG Framework offers a clean and consistent format for the samples. These -// classes define functions used by all the samples. The ATG Framework together -// with the samples demonstrates best practices and innovative techniques for -// Xbox 360. There are many useful sections of code in the samples. You are -// encouraged to incorporate this code into your titles. - -//------------------------------------------------------------------------------------- -// AtgXmlParser.h -// -// XMLParser and SAX interface declaration -// -// Xbox Advanced Technology Group -// Copyright (C) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------------- - -#pragma once -#ifndef ATGXMLPARSER_H -#define ATGXMLPARSER_H - -namespace ATG { - -//----------------------------------------------------------------------------- -// error returns from XMLParse -//----------------------------------------------------------------------------- -#define _ATGFAC 0x61B -#define E_COULD_NOT_OPEN_FILE MAKE_HRESULT(1, _ATGFAC, 0x0001) -#define E_INVALID_XML_SYNTAX MAKE_HRESULT(1, _ATGFAC, 0x0002) - -const uint32_t XML_MAX_ATTRIBUTES_PER_ELEMENT = 32; -const uint32_t XML_MAX_NAME_LENGTH = 128; -const uint32_t XML_READ_BUFFER_SIZE = 2048; -const uint32_t XML_WRITE_BUFFER_SIZE = 2048; - -// No tag can be longer than XML_WRITE_BUFFER_SIZE - an error will be returned -// if it is - -//------------------------------------------------------------------------------------- -struct XMLAttribute { - char* strName; - uint32_t NameLen; - char* strValue; - uint32_t ValueLen; -}; - -//------------------------------------------------------------------------------------- -class ISAXCallback { - friend class XMLParser; - -public: - ISAXCallback(){}; - virtual ~ISAXCallback(){}; - - virtual int32_t StartDocument() = 0; - virtual int32_t EndDocument() = 0; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) = 0; - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) = 0; - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) = 0; - - virtual int32_t CDATABegin() = 0; - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) = 0; - virtual int32_t CDATAEnd() = 0; - - virtual void Error(int32_t hError, const char* strMessage) = 0; - - virtual void SetParseProgress(uint32_t dwProgress) {} - - const char* GetFilename() { return m_strFilename; } - uint32_t GetLineNumber() { return m_LineNum; } - uint32_t GetLinePosition() { return m_LinePos; } - -private: - const char* m_strFilename; - uint32_t m_LineNum; - uint32_t m_LinePos; -}; - -//------------------------------------------------------------------------------------- -class XMLParser { -public: - XMLParser(); - ~XMLParser(); - - // Register an interface inheiriting from ISAXCallback - void RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback); - - // Get the registered interface - ISAXCallback* GetSAXCallbackInterface(); - - // ParseXMLFile returns one of the following: - // E_COULD_NOT_OPEN_FILE - couldn't open the file - // E_INVALID_XML_SYNTAX - bad XML syntax according to this parser - // E_NOINTERFACE - RegisterSAXCallbackInterface not called - // E_ABORT - callback returned a fail code - // S_OK - file parsed and completed - - int32_t ParseXMLFile(const char* strFilename); - - // Parses from a buffer- if you pass a char buffer (and cast it), it - // will - // correctly detect it and use unicode instead. Return codes are - // the same as for ParseXMLFile - - int32_t ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize); - -private: - int32_t MainParseLoop(); - - int32_t AdvanceCharacter(bool bOkToFail = false); - void SkipNextAdvance(); - - int32_t ConsumeSpace(); - int32_t ConvertEscape(); - int32_t AdvanceElement(); - int32_t AdvanceName(); - int32_t AdvanceAttrVal(); - int32_t AdvanceCDATA(); - int32_t AdvanceComment(); - - void FillBuffer(); - -#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation - void Error(int32_t hRet, - _In_z_ _Printf_format_string_ const char* strFormat, ...); -#else - void Error(int32_t hRet, const char* strFormat, ...); -#endif - - ISAXCallback* m_pISAXCallback; - - void* m_hFile; - const char* m_pInXMLBuffer; - uint32_t m_uInXMLBufferCharsLeft; - uint32_t m_dwCharsTotal; - uint32_t m_dwCharsConsumed; - - uint8_t m_pReadBuf[XML_READ_BUFFER_SIZE + 2]; // room for a trailing NULL - char m_pWriteBuf[XML_WRITE_BUFFER_SIZE]; - - uint8_t* m_pReadPtr; - char* m_pWritePtr; // write pointer within m_pBuf - - bool m_bUnicode; // true = 16-bits, false = 8-bits - bool m_bReverseBytes; // true = reverse bytes, false = don't reverse - - bool m_bSkipNextAdvance; - char m_Ch; // Current character being parsed -}; - -} // namespace ATG - -#endif diff --git a/targets/app/windows/XML/xmlFilesCallback.h b/targets/app/windows/XML/xmlFilesCallback.h deleted file mode 100644 index 06d5fd3bc..000000000 --- a/targets/app/windows/XML/xmlFilesCallback.h +++ /dev/null @@ -1,303 +0,0 @@ - -#pragma once -#if !defined(XMLMOJANGCALLBACK_H) -#define XMLMOJANGCALLBACK_H -// xml reading - -using namespace ATG; - -class xmlMojangCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wAttName[32] = ""; - char wNameXUID[32] = ""; - char wNameSkin[32] = ""; - char wNameCloak[32] = ""; - PlayerUID xuid = 0LL; - - if (NameLen > 31) - return 1; - else - strncpy(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "name") == 0) { - if (pAttributes[i].ValueLen <= 32) - wcsncpy_s(wNameXUID, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } else if (_wcsicmp(wAttName, "xuid") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - xuid = _wcstoui64(wTemp, nullptr, 10); - } - } else if (_wcsicmp(wAttName, "cape") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameCloak, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "skin") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameSkin, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (xuid != 0LL) { - return Game::RegisterMojangData(wNameXUID, xuid, wNameSkin, - wNameCloak); - } else - return 1; - } else { - return 1; - } - }; - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing xuids.XML\n"); - }; -}; - -class xmlConfigCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wType[32] = ""; - char wAttName[32] = ""; - char wValue[32] = ""; - int iValue = -1; - - if (NameLen > 31) - return 1; - else - wcsncpy_s(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "Type") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wType, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Value") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wValue, pAttributes[i].strValue, - pAttributes[i].ValueLen); - - iValue = strtol(wValue, nullptr, 10); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (iValue != -1) { -#if defined(_DEBUG) - printf("Type - %s, Value - %d, ", wType, iValue); -#endif - - return Game::RegisterConfigValues(wType, iValue); - } else { - return 1; - } - } else { - return 1; - } - } - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing xuids.XML\n"); - }; -}; - -class xmlDLCInfoCallback : public ATG::ISAXCallback { -public: - virtual int32_t StartDocument() { return 0; }; - virtual int32_t EndDocument() { return 0; }; - - virtual int32_t ElementBegin(const char* strName, uint32_t NameLen, - const XMLAttribute* pAttributes, - uint32_t NumAttributes) { - char wTemp[35] = ""; - char wAttName[32] = ""; - char wNameBanner[32] = ""; - char wDataFile[32] = ""; - char wType[32] = ""; - char wFirstSkin[32] = ""; - char wConfig[32] = ""; - uint64_t ullFull = 0ll; - uint64_t ullTrial = 0ll; - unsigned int uiSortIndex = 0L; - int iGender = 0; - int iConfig = 0; - - if (NameLen > 31) - return 1; - else - wcsncpy_s(wAttName, strName, NameLen); - - if (_wcsicmp(wAttName, "root") == 0) { - return 0; - } else if (_wcsicmp(wAttName, "data") == 0) { - for (uint32_t i = 0; i < NumAttributes; i++) { - wcsncpy_s(wAttName, pAttributes[i].strName, - pAttributes[i].NameLen); - if (_wcsicmp(wAttName, "SortIndex") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - uiSortIndex = wcstoul(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "Banner") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wNameBanner, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Full") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - ullFull = _wcstoui64(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "Trial") == 0) { - if (pAttributes[i].ValueLen <= 32) { - memset(wTemp, 0, sizeof(char) * 35); - wcsncpy_s(wTemp, pAttributes[i].strValue, - pAttributes[i].ValueLen); - ullTrial = _wcstoui64(wTemp, nullptr, 16); - } - } else if (_wcsicmp(wAttName, "FirstSkin") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wFirstSkin, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Type") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wType, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } else if (_wcsicmp(wAttName, "Gender") == 0) { - if (_wcsicmp(wAttName, "Male") == 0) { - iGender = 1; - } else if (_wcsicmp(wAttName, "Female") == 0) { - iGender = 2; - } else { - iGender = 0; - } - } else if (_wcsicmp(wAttName, "Config") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wConfig, pAttributes[i].strValue, - pAttributes[i].ValueLen); - - iConfig = strtol(wConfig, nullptr, 10); - } - } else if (_wcsicmp(wAttName, "DataFile") == 0) { - if (pAttributes[i].ValueLen <= 32) { - wcsncpy_s(wDataFile, pAttributes[i].strValue, - pAttributes[i].ValueLen); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if (ullFull != 0LL) { -#if defined(_DEBUG) - printf("Type - %s, Name - %s, ", wType, wNameBanner); -#endif - app.DebugPrintf("Full = %lld, Trial %lld\n", ullFull, ullTrial); - - return Game::RegisterDLCData(wType, wNameBanner, iGender, - ullFull, ullTrial, wFirstSkin, - uiSortIndex, iConfig, wDataFile); - } else { - return 1; - } - } else { - return 1; - } - }; - - virtual int32_t ElementContent(const char* strData, uint32_t DataLen, - bool More) { - return 0; - }; - - virtual int32_t ElementEnd(const char* strName, uint32_t NameLen) { - return 0; - }; - - virtual int32_t CDATABegin() { return 0; }; - - virtual int32_t CDATAData(const char* strCDATA, uint32_t CDATALen, - bool bMore) { - return 0; - }; - - virtual int32_t CDATAEnd() { return 0; }; - - virtual void Error(int32_t hError, const char* strMessage) { - app.DebugPrintf("Error when Parsing DLC.XML\n"); - }; -}; - -#endif diff --git a/targets/app/windows/src/Windows64_Minecraft.cpp b/targets/app/windows/src/Windows64_Minecraft.cpp deleted file mode 100644 index 5abe340b9..000000000 --- a/targets/app/windows/src/Windows64_Minecraft.cpp +++ /dev/null @@ -1,849 +0,0 @@ -// Minecraft.cpp : Defines the entry point for the application. -// - -#include - -#include - -#include "minecraft/network/Socket.h" -#include "minecraft/client/User.h" -#include "minecraft/client/multiplayer/ClientConnection.h" -#include "minecraft/client/multiplayer/ConnectScreen.h" -#include "minecraft/client/player/LocalPlayer.h" -#include "minecraft/locale/Language.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/stats/StatsCounter.h" -#include "minecraft/world/item/ItemInstance.h" -#include "minecraft/world/item/MapItem.h" -#include "minecraft/world/item/crafting/Recipes.h" -#include "minecraft/world/item/crafting/Recipy.h" -#include "minecraft/world/level/Level.h" -#include "minecraft/world/phys/AABB.h" -#include "minecraft/world/phys/Vec3.h" -#include "util/StringHelpers.h" -// #include "Social/SocialManager.h" -// #include "app/common/Leaderboards/LeaderboardManager.h" -// #include "../Common/XUI/XUI_Scene_Container.h" -// #include "NetworkManager.h" -#include "../Resource.h" -#include "Sentient/SentientManager.h" -#include "minecraft/client/Options.h" -#include "minecraft/client/renderer/Tesselator.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/world/level/chunk/storage/OldChunkStorage.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" - -HINSTANCE hMyInst; -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, - LPARAM lParam); -char chGlobalText[256]; -uint16_t ui16GlobalText[256]; - -#define THEME_NAME "584111F70AAAAAAA" -#define THEME_FILESIZE 2797568 - -// #define THREE_MB 3145728 // minimum save size (checking for this on a -// selected device) #define FIVE_MB 5242880 // minimum save size (checking for -// this on a selected device) #define FIFTY_TWO_MB (1024*1024*52) // Maximum TCR -// space required for a save (checking for this on a selected device) -#define FIFTY_ONE_MB \ - (1000000 * 51) // Maximum TCR space required for a save is 52MB (checking - // for this on a selected device) - -// #define PROFILE_VERSION 3 // new version for the interim bug fix 166 TU -#define NUM_PROFILE_VALUES 5 -#define NUM_PROFILE_SETTINGS 4 -uint32_t dwProfileSettingsA[NUM_PROFILE_VALUES] = {0, 0, 0, 0, 0}; - -//------------------------------------------------------------------------------------- -// Time Since fAppTime is a float, we need to keep the quadword app -// time -// as a LARGE_INTEGER so that we don't lose precision after -// running for a long time. -//------------------------------------------------------------------------------------- - -bool g_bWidescreen = true; - -int g_iScreenWidth = 1920; -int g_iScreenHeight = 1080; - -void DefineActions(void) { - // The app needs to define the actions required, and the possible mappings - // for these - - // Split into Menu actions, and in-game actions - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_0, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_1, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_UP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_DOWN, - _360_JOY_BUTTON_DPAD_DOWN | _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_LEFT, - _360_JOY_BUTTON_DPAD_LEFT | _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps( - MAP_STYLE_2, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); - - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); - PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); -} - -HINSTANCE g_hInst = nullptr; -HWND g_hWnd = nullptr; -D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; -D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = nullptr; -ID3D11DeviceContext* g_pImmediateContext = nullptr; -IDXGISwapChain* g_pSwapChain = nullptr; -ID3D11RenderTargetView* g_pRenderTargetView = nullptr; -ID3D11DepthStencilView* g_pDepthStencilView = nullptr; -ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; - -// -// FUNCTION: WndProc(HWND, uint32_t, WPARAM, LPARAM) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - process the application menu -// WM_PAINT - Paint the main window -// WM_DESTROY - post a quit message and return -// -// -LRESULT CALLBACK WndProc(HWND hWnd, uint32_t message, WPARAM wParam, - LPARAM lParam) { - int wmId, wmEvent; - PAINTSTRUCT ps; - HDC hdc; - - switch (message) { - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) { - case IDM_EXIT: - DestroyWindow(hWnd); - break; - - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - break; - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - // TODO: Add any drawing code here... - EndPaint(hWnd, &ps); - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - return 0; -} - -// -// FUNCTION: MyRegisterClass() -// -// PURPOSE: Registers the window class. -// -ATOM MyRegisterClass(HINSTANCE hInstance) { - WNDCLASSEX wcex; - - wcex.cbSize = sizeof(WNDCLASSEX); - - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wcex.lpszMenuName = "Minecraft"; - wcex.lpszClassName = "MinecraftClass"; - wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); - - return RegisterClassEx(&wcex); -} - -// -// FUNCTION: InitInstance(HINSTANCE, int) -// -// PURPOSE: Saves instance handle and creates main window -// -// COMMENTS: -// -// In this function, we save the instance handle in a global variable and -// create and display the main program window. -// -bool InitInstance(HINSTANCE hInstance, int nCmdShow) { - g_hInst = hInstance; // Store instance handle in our global variable - - RECT wr = {0, 0, g_iScreenWidth, - g_iScreenHeight}; // set the size, but not the position - AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false); // adjust the size - - g_hWnd = CreateWindow("MinecraftClass", "Minecraft", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, - wr.right - wr.left, // width of the window - wr.bottom - wr.top, // height of the window - nullptr, nullptr, hInstance, nullptr); - - if (!g_hWnd) { - return false; - } - - ShowWindow(g_hWnd, nCmdShow); - UpdateWindow(g_hWnd); - - return true; -} - -// 4J Stu - These functions are referenced from the Windows Input library -void ClearGlobalText() { - // clear the global text - memset(chGlobalText, 0, 256); - memset(ui16GlobalText, 0, 512); -} - -uint16_t* GetGlobalText() { - // copy the ch text to ui16 - char* pchBuffer = (char*)ui16GlobalText; - for (int i = 0; i < 256; i++) { - pchBuffer[i * 2] = chGlobalText[i]; - } - return ui16GlobalText; -} -void SeedEditBox() { - DialogBox(hMyInst, MAKEINTRESOURCE(IDD_SEED), g_hWnd, - reinterpret_cast(DlgProc)); -} - -//--------------------------------------------------------------------------- -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, - LPARAM lParam) { - switch (Msg) { - case WM_INITDIALOG: - return true; - - case WM_COMMAND: - switch (wParam) { - case IDOK: - // Set the text - GetDlgItemText(hWndDlg, IDC_EDIT, chGlobalText, 256); - EndDialog(hWndDlg, 0); - return true; - } - break; - } - - return false; -} - -//-------------------------------------------------------------------------------------- -// Create Direct3D device and swap chain -//-------------------------------------------------------------------------------------- -int32_t InitDevice() { - int32_t hr = 0; - - RECT rc; - GetClientRect(g_hWnd, &rc); - uint32_t width = rc.right - rc.left; - uint32_t height = rc.bottom - rc.top; - // app.DebugPrintf("width: %d, height: %d\n", width, height); - width = g_iScreenWidth; - height = g_iScreenHeight; - app.DebugPrintf("width: %d, height: %d\n", width, height); - - uint32_t createDeviceFlags = 0; -#if defined(_DEBUG) - createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; -#endif - - D3D_DRIVER_TYPE driverTypes[] = { - D3D_DRIVER_TYPE_HARDWARE, - D3D_DRIVER_TYPE_WARP, - D3D_DRIVER_TYPE_REFERENCE, - }; - uint32_t numDriverTypes = ARRAYSIZE(driverTypes); - - D3D_FEATURE_LEVEL featureLevels[] = { - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - }; - uint32_t numFeatureLevels = ARRAYSIZE(featureLevels); - - DXGI_SWAP_CHAIN_DESC sd; - memset(&sd, 0, sizeof(sd)); - sd.BufferCount = 1; - sd.BufferDesc.Width = width; - sd.BufferDesc.Height = height; - sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - sd.BufferDesc.RefreshRate.Numerator = 60; - sd.BufferDesc.RefreshRate.Denominator = 1; - sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - sd.OutputWindow = g_hWnd; - sd.SampleDesc.Count = 1; - sd.SampleDesc.Quality = 0; - sd.Windowed = true; - - for (uint32_t driverTypeIndex = 0; driverTypeIndex < numDriverTypes; - driverTypeIndex++) { - g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( - nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, - numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, - &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext); - if (HRESULT_SUCCEEDED(hr)) break; - } - if (FAILED(hr)) return hr; - - // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; - hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), - (void**)&pBackBuffer); - if (FAILED(hr)) return hr; - - // Create a depth stencil buffer - D3D11_TEXTURE2D_DESC descDepth; - - descDepth.Width = width; - descDepth.Height = height; - descDepth.MipLevels = 1; - descDepth.ArraySize = 1; - descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDepth.SampleDesc.Count = 1; - descDepth.SampleDesc.Quality = 0; - descDepth.Usage = D3D11_USAGE_DEFAULT; - descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; - descDepth.CPUAccessFlags = 0; - descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, - &g_pDepthStencilBuffer); - - D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; - descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; - descDSView.Texture2D.MipSlice = 0; - - hr = g_pd3dDevice->CreateDepthStencilView( - g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - - hr = g_pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, - &g_pRenderTargetView); - pBackBuffer->Release(); - if (FAILED(hr)) return hr; - - g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, - g_pDepthStencilView); - - // Setup the viewport - D3D11_VIEWPORT vp; - vp.Width = (float)width; - vp.Height = (float)height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - vp.TopLeftX = 0; - vp.TopLeftY = 0; - g_pImmediateContext->RSSetViewports(1, &vp); - - PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); - - return 0; -} - -//-------------------------------------------------------------------------------------- -// Render the frame -//-------------------------------------------------------------------------------------- -void Render() { - // Just clear the backbuffer - float ClearColor[4] = {0.0f, 0.125f, 0.3f, 1.0f}; // red,green,blue,alpha - - g_pImmediateContext->ClearRenderTargetView(g_pRenderTargetView, ClearColor); - g_pSwapChain->Present(0, 0); -} - -//-------------------------------------------------------------------------------------- -// Clean up the objects we've created -//-------------------------------------------------------------------------------------- -void CleanupDevice() { - if (g_pImmediateContext) g_pImmediateContext->ClearState(); - - if (g_pRenderTargetView) g_pRenderTargetView->Release(); - if (g_pSwapChain) g_pSwapChain->Release(); - if (g_pImmediateContext) g_pImmediateContext->Release(); - if (g_pd3dDevice) g_pd3dDevice->Release(); -} - -int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, - _In_ int nCmdShow) { - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); - - if (lpCmdLine) { - if (lpCmdLine[0] == '1') { - g_iScreenWidth = 1280; - g_iScreenHeight = 720; - } else if (lpCmdLine[0] == '2') { - g_iScreenWidth = 640; - g_iScreenHeight = 480; - } else if (lpCmdLine[0] == '3') { - // Vita - g_iScreenWidth = 720; - g_iScreenHeight = 408; - - // Vita native - // g_iScreenWidth = 960; - // g_iScreenHeight = 544; - } - } - - // Initialize global strings - MyRegisterClass(hInstance); - - // Perform application initialization: - if (!InitInstance(hInstance, nCmdShow)) { - return false; - } - - hMyInst = hInstance; - - if (FAILED(InitDevice())) { - CleanupDevice(); - return 0; - } - - static bool bTrialTimerDisplayed = true; - - app.loadMediaArchive(); - - PlatformRenderer.Initialise(g_pd3dDevice, g_pSwapChain); - - app.loadStringTable(); - ui.init(g_pd3dDevice, g_pImmediateContext, g_pRenderTargetView, - g_pDepthStencilView, g_iScreenWidth, g_iScreenHeight); - - //////////////// - // Initialise // - //////////////// - - // Set the number of possible joypad layouts that the user can switch - // between, and the number of actions - PlatformInput.Initialise(1, 3, MINECRAFT_ACTION_MAX, ACTION_MAX_MENU); - - // Set the default joypad action mappings for Minecraft - DefineActions(); - 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 - 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 - 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 PlatformProfile for - // XN_LIVE_INVITE_ACCEPTED for QNet. - g_NetworkManager.Initialise(); - - // 4J-PB moved further down - // app.InitGameSettings(); - - // debug switch to trial version - 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 - Compression::CreateNewThreadStorage(); - OldChunkStorage::CreateNewThreadStorage(); - Level::enableLightingCache(); - Tile::CreateNewThreadStorage(); - - Minecraft::main(); - Minecraft* pMinecraft = Minecraft::GetInstance(); - - app.InitGameSettings(); - - app.InitialiseTips(); - - // Set the default sound levels - pMinecraft->options->set(Options::Option::MUSIC, 1.0f); - pMinecraft->options->set(Options::Option::SOUND, 1.0f); - - // app.TemporaryCreateGameStart(); - - // Sleep(10000); - MSG msg = {0}; - while (WM_QUIT != msg.message) { - if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - continue; - } - PlatformRenderer.StartFrame(); - - // static bool bPlay=false; - // if(bPlay) - // { - // bPlay=false; - // app.audio.PlaySound(); - // } - - app.UpdateTime(); - PlatformInput.Tick(); - - // PlatformProfile.Tick(); - - PlatformStorage.Tick(); - - PlatformRenderer.Tick(); - - // Tick the social networking manager. - // CSocialManager::Instance()->Tick(); - - // Tick sentient. - // SentientManager.Tick(); - - // g_NetworkManager.DoWork(); - - // PlatformLeaderboard.Tick(); - // Render game graphics. - if (app.GetGameStarted()) { - pMinecraft->run_middle(); - app.SetAppPaused( - g_NetworkManager.IsLocalGame() && - g_NetworkManager.GetPlayerCount() == 1 && - ui.IsPauseMenuDisplayed(PlatformProfile.GetPrimaryPad())); - } else { - pMinecraft->soundEngine->tick(nullptr, 0.0f); - pMinecraft->textures->tick(true, false); - if (app.GetReallyChangingSessionType()) { - pMinecraft - ->tickAllConnections(); // Added to stop timing out when we - // are waiting after converting to - // an offline game - } - } - - pMinecraft->soundEngine->playMusicTick(); - - ui.tick(); - ui.render(); - // Present the frame. - PlatformRenderer.Present(); - - ui.CheckMenuDisplayed(); - // Any threading type things to deal with from the xui side? - app.HandleXuiActions(); - - // need to turn off the trial timer if it was on - if (bTrialTimerDisplayed) { - ui.ShowTrialTimer(false); - bTrialTimerDisplayed = false; - } - - // Fix for #7318 - Title crashes after short soak in the leaderboards - } - - // Free resources, unregister custom classes, and exit. - // app.Uninit(); - g_pd3dDevice->Release(); -} diff --git a/targets/minecraft/client/gui/Minimap.cpp b/targets/minecraft/client/gui/Minimap.cpp index b34f818fa..55cd03f07 100644 --- a/targets/minecraft/client/gui/Minimap.cpp +++ b/targets/minecraft/client/gui/Minimap.cpp @@ -71,11 +71,11 @@ void Minimap::reloadColours() { int b = ((color) & 0xff) * br / 255; // 4J - changed byte order to save having to reorder later -// #if defined(_WIN64) || __linux__ +#if 1 LUT[i] = 255 << 24 | b << 16 | g << 8 | r; -// #else -// LUT[i] = r << 24 | g << 16 | b << 8 | 255; -// #endif +#else + LUT[i] = r << 24 | g << 16 | b << 8 | 255; +#endif // pixels[i] = (255) << 24 | r << 16 | g << 8 | b; } diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 1d50d5887..757ecaa35 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -988,11 +988,11 @@ void GameRenderer::updateLightTexture(float a) { int g = (int)(_g * 255); int b = (int)(_b * 255); -// #if defined(_WIN64) || __linux__ +#if 1 lightPixels[j][i] = alpha << 24 | b << 16 | g << 8 | r; -// #else +#else // lightPixels[j][i] = r << 24 | g << 16 | b << 8 | alpha; -// #endif +#endif } mc->textures->replaceTextureDirect(lightPixels[j], 16, 16, diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 932253177..def0ad791 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -200,10 +200,6 @@ bool Connection::writeTick() { } Packet::writePacket(packet, bufferedDos); -// #if defined(__linux__) -// bufferedDos->flush(); // Ensure buffered data reaches socket before any -// // other writes -// #endif #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging @@ -252,15 +248,6 @@ bool Connection::writeTick() { // write it to QNet as a single packet with priority flags Otherwise // just buffer the packet with other outgoing packets as the java game // did -// #if defined(__linux__) -// // Linux fix: For local connections, always use bufferedDos to avoid -// // byte interleaving between the BufferedOutputStream buffer and direct -// // sos writes. The shouldDelay/writeWithFlags path writes directly to -// // sos, which can inject bytes BEFORE unflushed bufferedDos data. -// Packet::writePacket(packet, bufferedDos); -// bufferedDos->flush(); // Ensure data reaches socket immediately for -// // delayed packets -// #else if (packet->shouldDelay) { Packet::writePacket(packet, byteArrayDos); @@ -276,8 +263,6 @@ bool Connection::writeTick() { Packet::writePacket(packet, bufferedDos); } -// #endif - #if !defined(_CONTENT_PACKAGE) // 4J Added for debugging if (!socket->isLocal()) { From 69c418213e0d0f92bafcbc07e76dd15b55d1c0ea Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:39:33 -0500 Subject: [PATCH 077/104] nuke util/Definitions.h --- targets/minecraft/client/renderer/LevelRenderer.h | 1 - targets/minecraft/world/level/chunk/CompressedTileStorage.cpp | 1 - .../minecraft/world/level/chunk/storage/OldChunkStorage.cpp | 3 ++- .../level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h | 1 - .../level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h | 1 - .../world/level/storage/ConsoleSaveFileIO/FileHeader.cpp | 1 - targets/util/Definitions.h | 3 --- 7 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 targets/util/Definitions.h diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index aa5baa062..233cd38bd 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -8,7 +8,6 @@ #include "minecraft/world/phys/AABB.h" #include "platform/C4JThread.h" #include "platform/network/NetTypes.h" -#include "util/Definitions.h" class ClipChunk; class HitResult; diff --git a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp index 32f9081c2..0e3285bfc 100644 --- a/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp +++ b/targets/minecraft/world/level/chunk/CompressedTileStorage.cpp @@ -12,7 +12,6 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" #include "platform/network/NetTypes.h" -#include "util/Definitions.h" // Note: See header for an overview of this class diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 87a467c7c..9105ad805 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -31,7 +31,6 @@ #include "nbt/ListTag.h" #include "nbt/NbtIo.h" #include "platform/input/input.h" -#include "util/Definitions.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; @@ -97,6 +96,8 @@ void to_base36(int value, char* buf) { } File OldChunkStorage::getFile(int x, int z) { + inline constexpr int MAX_PATH_SIZE = 256; + char name[MAX_PATH_SIZE]; char path1[MAX_PATH_SIZE]; char path2[MAX_PATH_SIZE]; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h index af1771527..aac482dea 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h @@ -7,7 +7,6 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" -#include "util/Definitions.h" class ConsoleSaveFileOriginal : public ConsoleSaveFile { private: diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h index a62d12407..cb7e635a6 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h @@ -8,7 +8,6 @@ #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSavePath.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" -#include "util/Definitions.h" class ProgressRenderer; class ProgressListener; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp index 8d00295ad..cbac4d7de 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.cpp @@ -12,7 +12,6 @@ #include "java/System.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" -#include "util/Definitions.h" FileHeader::FileHeader() { lastFile = nullptr; diff --git a/targets/util/Definitions.h b/targets/util/Definitions.h deleted file mode 100644 index b02596765..000000000 --- a/targets/util/Definitions.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -inline constexpr int MAX_PATH_SIZE = 256; From b7d200a5b1c3227eae812bfd29a92c319ff92363 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:46:02 -0500 Subject: [PATCH 078/104] move C4JThread and ShutdownManager to platform/thread --- targets/app/common/Audio/SoundEngine.cpp | 2 +- .../app/common/Network/GameNetworkManager.h | 2 +- .../app/common/UI/All Platforms/UIStructs.h | 2 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 2 +- targets/app/common/UI/UIController.cpp | 2 +- targets/app/meson.build | 1 - targets/minecraft/client/Minecraft.h | 2 +- .../client/renderer/GameRenderer.cpp | 2 +- .../minecraft/client/renderer/GameRenderer.h | 2 +- .../minecraft/client/renderer/LevelRenderer.h | 2 +- targets/minecraft/network/Connection.cpp | 2 +- targets/minecraft/network/Connection.h | 2 +- targets/minecraft/network/Socket.cpp | 2 +- targets/minecraft/network/Socket.h | 2 +- targets/minecraft/server/MinecraftServer.cpp | 2 +- targets/minecraft/server/MinecraftServer.h | 2 +- .../minecraft/server/level/ServerChunkCache.h | 2 +- .../minecraft/server/level/ServerLevel.cpp | 2 +- targets/minecraft/server/level/ServerLevel.h | 2 +- targets/minecraft/world/level/Level.h | 2 +- .../chunk/storage/McRegionChunkStorage.cpp | 2 +- .../level/chunk/storage/OldChunkStorage.cpp | 2 +- targets/platform/meson.build | 27 ++++++++++--------- .../network/stub/StubPlatformNetwork.cpp | 2 +- targets/platform/{ => thread}/C4JThread.cpp | 4 +-- targets/platform/{ => thread}/C4JThread.h | 0 .../platform/{ => thread}/ShutdownManager.cpp | 4 +-- .../platform/{ => thread}/ShutdownManager.h | 2 +- targets/platform/thread/meson.build | 1 + 29 files changed, 42 insertions(+), 41 deletions(-) rename targets/platform/{ => thread}/C4JThread.cpp (99%) rename targets/platform/{ => thread}/C4JThread.h (100%) rename targets/platform/{ => thread}/ShutdownManager.cpp (88%) rename targets/platform/{ => thread}/ShutdownManager.h (96%) create mode 100644 targets/platform/thread/meson.build diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 7b769ffad..86e20e4d5 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -20,7 +20,7 @@ #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/fs/fs.h" diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 240a55a15..622d44112 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -5,7 +5,7 @@ #include #include #include "minecraft/network/INetworkService.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/network/IPlatformNetwork.h" diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 61cb842b3..1f303e75c 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -8,7 +8,7 @@ #include "UIEnums.h" #include "minecraft/GameHostOptions.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/storage/storage.h" class Container; diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index 5b267ba42..b7481f470 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -17,7 +17,7 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 0e8f16a1e..d4cfc9edf 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -45,7 +45,7 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/XboxStubs.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/meson.build b/targets/app/meson.build index 717a1678e..920f4c386 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -50,7 +50,6 @@ if get_option('ui_backend') == 'shiggy' client_dependencies += shiggy_dep endif - client = executable( 'Minecraft.Client', platform_sources + localisation[1], diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 5c2c3d45b..3468ae23a 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -9,7 +9,7 @@ #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/stubs.h" #include "platform/leaderboard/leaderboard.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index 757ecaa35..c256a50a4 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -76,7 +76,7 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "platform/PlatformTypes.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/renderer/GameRenderer.h b/targets/minecraft/client/renderer/GameRenderer.h index 11a1dfa10..84e835c31 100644 --- a/targets/minecraft/client/renderer/GameRenderer.h +++ b/targets/minecraft/client/renderer/GameRenderer.h @@ -9,7 +9,7 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/phys/Vec3.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class Minecraft; class Entity; diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index 233cd38bd..feee11326 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -6,7 +6,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/network/NetTypes.h" class ClipChunk; diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index def0ad791..4e290838e 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -18,7 +18,7 @@ #include "minecraft/network/packet/PacketListener.h" #include "platform/network/network.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" #include "util/StringHelpers.h" class SocketAddress; diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index e6d60480d..8d3ccaca6 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -12,7 +12,7 @@ #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class DataInputStream; class DataOutputStream; diff --git a/targets/minecraft/network/Socket.cpp b/targets/minecraft/network/Socket.cpp index ad3f7c932..9ac574e16 100644 --- a/targets/minecraft/network/Socket.cpp +++ b/targets/minecraft/network/Socket.cpp @@ -10,7 +10,7 @@ #include "platform/network/network.h" #include "minecraft/server/network/ServerConnection.h" #include "platform/network/NetTypes.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/minecraft/network/Socket.h b/targets/minecraft/network/Socket.h index f0cb5b491..7c15f2b89 100644 --- a/targets/minecraft/network/Socket.h +++ b/targets/minecraft/network/Socket.h @@ -9,7 +9,7 @@ #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" #include "platform/network/network.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class INetworkPlayer; diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index dce5f4509..79622019f 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -80,7 +80,7 @@ #include "minecraft/world/level/chunk/SparseLightStorage.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" class ConsoleInputSource; diff --git a/targets/minecraft/server/MinecraftServer.h b/targets/minecraft/server/MinecraftServer.h index e88f0d5f3..659865b6e 100644 --- a/targets/minecraft/server/MinecraftServer.h +++ b/targets/minecraft/server/MinecraftServer.h @@ -11,7 +11,7 @@ #include "minecraft/SharedConstants.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "util/Timer.h" class ServerConnection; diff --git a/targets/minecraft/server/level/ServerChunkCache.h b/targets/minecraft/server/level/ServerChunkCache.h index 12554b626..00af9cd5f 100644 --- a/targets/minecraft/server/level/ServerChunkCache.h +++ b/targets/minecraft/server/level/ServerChunkCache.h @@ -10,7 +10,7 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/levelgen/RandomLevelSource.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class ServerLevel; class ChunkStorage; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index e041d390e..9b8746b62 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -60,7 +60,7 @@ #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/Vec3.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" #include "platform/storage/storage.h" #include "strings.h" diff --git a/targets/minecraft/server/level/ServerLevel.h b/targets/minecraft/server/level/ServerLevel.h index 8490d3910..6de6131e7 100644 --- a/targets/minecraft/server/level/ServerLevel.h +++ b/targets/minecraft/server/level/ServerLevel.h @@ -18,7 +18,7 @@ #include "minecraft/world/level/TickNextTickData.h" #include "minecraft/world/level/TileEventData.h" #include "minecraft/world/level/biome/Biome.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class ServerChunkCache; class MinecraftServer; diff --git a/targets/minecraft/world/level/Level.h b/targets/minecraft/world/level/Level.h index 43fa76d0b..741f607b7 100644 --- a/targets/minecraft/world/level/Level.h +++ b/targets/minecraft/world/level/Level.h @@ -22,7 +22,7 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "minecraft/world/phys/AABB.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" class CompoundTag; diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index ebad12c81..14b988009 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -29,7 +29,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/input/input.h" class DataInput; diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 9105ad805..4bd51bb3a 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -96,7 +96,7 @@ void to_base36(int value, char* buf) { } File OldChunkStorage::getFile(int x, int z) { - inline constexpr int MAX_PATH_SIZE = 256; + constexpr int MAX_PATH_SIZE = 256; char name[MAX_PATH_SIZE]; char path1[MAX_PATH_SIZE]; diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 2eec79af5..5224c1502 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -10,19 +10,6 @@ else _defs = [] endif -# Core: thread + shutdown plumbing, no backend. -lib_platform_core = static_library('platform_core', - files('C4JThread.cpp', 'ShutdownManager.cpp'), - include_directories: [platform_inc, include_directories('..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -platform_dep = declare_dependency( - link_with: lib_platform_core, - include_directories: platform_inc, -) - # Per-subsystem source lists. Each subdir owns its own list of backend # .cpp files via a `platform__sources` variable. The library # build is centralised so we get one library per platform target rather @@ -38,6 +25,20 @@ subdir('sound') subdir('network') subdir('leaderboard') subdir('game') +subdir('thread') + +# Core: thread + shutdown plumbing, no backend. +lib_platform_core = static_library('platform_core', + platform_thread_sources, + include_directories: [platform_inc, include_directories('..')], + dependencies: [_threads], + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_dep = declare_dependency( + link_with: lib_platform_core, + include_directories: platform_inc, +) lib_platform_sdl2 = static_library('platform_sdl2', platform_input_sources diff --git a/targets/platform/network/stub/StubPlatformNetwork.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp index 0a1032c62..f7870f4d6 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.cpp +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -8,7 +8,7 @@ #include "StubNetworkPlayer.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/Socket.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" #include "platform/network/NetTypes.h" #include "platform/network/network.h" diff --git a/targets/platform/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp similarity index 99% rename from targets/platform/C4JThread.cpp rename to targets/platform/thread/C4JThread.cpp index 4a577ff02..51bf0a84d 100644 --- a/targets/platform/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -26,8 +26,8 @@ #include #endif -#include "platform/C4JThread.h" -#include "platform/ShutdownManager.h" +#include "platform/thread/C4JThread.h" +#include "platform/thread/ShutdownManager.h" class Level; diff --git a/targets/platform/C4JThread.h b/targets/platform/thread/C4JThread.h similarity index 100% rename from targets/platform/C4JThread.h rename to targets/platform/thread/C4JThread.h diff --git a/targets/platform/ShutdownManager.cpp b/targets/platform/thread/ShutdownManager.cpp similarity index 88% rename from targets/platform/ShutdownManager.cpp rename to targets/platform/thread/ShutdownManager.cpp index ae78d1847..d2361dfef 100644 --- a/targets/platform/ShutdownManager.cpp +++ b/targets/platform/thread/ShutdownManager.cpp @@ -1,8 +1,8 @@ // Linux stub implementations for ShutdownManager // The PS3/PSVita versions have full implementations; on Linux these are no-ops. -#include "platform/ShutdownManager.h" +#include "platform/thread/ShutdownManager.h" -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" void ShutdownManager::Initialise() {} void ShutdownManager::StartShutdown() {} diff --git a/targets/platform/ShutdownManager.h b/targets/platform/thread/ShutdownManager.h similarity index 96% rename from targets/platform/ShutdownManager.h rename to targets/platform/thread/ShutdownManager.h index 33f1019be..551039576 100644 --- a/targets/platform/ShutdownManager.h +++ b/targets/platform/thread/ShutdownManager.h @@ -6,7 +6,7 @@ #include #include -#include "platform/C4JThread.h" +#include "platform/thread/C4JThread.h" class ShutdownManager { public: diff --git a/targets/platform/thread/meson.build b/targets/platform/thread/meson.build new file mode 100644 index 000000000..c42ec30ec --- /dev/null +++ b/targets/platform/thread/meson.build @@ -0,0 +1 @@ +platform_thread_sources = files('C4JThread.cpp', 'ShutdownManager.cpp') From 50f6bf8e68c0666f83836ce2f03a5715a94b37fd Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Thu, 9 Apr 2026 23:52:00 -0500 Subject: [PATCH 079/104] fix iggy includes --- targets/app/common/DLC/DLCAudioFile.cpp | 5 - targets/app/common/DLCController.cpp | 2 +- targets/app/common/Game.cpp | 4 - targets/app/common/Iggy/gdraw/gdraw.c | 2 +- targets/app/common/Iggy/gdraw/gdraw.h | 4 +- .../common/Iggy/gdraw/gdraw_gl_shaders.inl | 1536 ++++++++++ .../app/common/Iggy/gdraw/gdraw_gl_shared.inl | 2695 +++++++++++++++++ .../app/common/Iggy/gdraw/gdraw_shared.inl | 2693 ++++++++++++++++ targets/app/common/Iggy/include/iggy.h | 1 + targets/app/common/UI/ConsoleUIController.cpp | 2 +- targets/app/common/UI/UIController.cpp | 9 +- 11 files changed, 6931 insertions(+), 22 deletions(-) create mode 100644 targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl create mode 100644 targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl create mode 100644 targets/app/common/Iggy/gdraw/gdraw_shared.inl diff --git a/targets/app/common/DLC/DLCAudioFile.cpp b/targets/app/common/DLC/DLCAudioFile.cpp index a9626f7d2..7a9c6ef1b 100644 --- a/targets/app/common/DLC/DLCAudioFile.cpp +++ b/targets/app/common/DLC/DLCAudioFile.cpp @@ -13,11 +13,6 @@ #include "platform/storage/storage.h" #include "util/StringHelpers.h" -#if defined(_WINDOWS64) -#include "app/windows/XML/ATGXmlParser.h" -#include "app/windows/XML/xmlFilesCallback.h" -#endif - namespace { constexpr std::size_t AUDIO_DLC_WCHAR_BIN_SIZE = 2; diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 1948ce660..6e61d5c5e 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -240,7 +240,7 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName, pDLCData->uiSortIndex = uiSortIndex; pDLCData->iConfig = iConfig; - if (pBannerName != "") { + if (strcmp(!pBannerName, "") != 0) { strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); } if (pDataFile[0] != 0) { diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index e0a5d5d98..111b91a64 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -47,10 +47,6 @@ #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "strings.h" -#if defined(_WINDOWS64) -#include "app/windows/XML/ATGXmlParser.h" -#include "app/windows/XML/xmlFilesCallback.h" -#endif #include #include #include diff --git a/targets/app/common/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c index eeb97c02a..9a1ea981d 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -688,7 +688,7 @@ static void gdraw_FramebufferRenderbufferSafe(GLenum target, GLenum attachment, #define glFramebufferRenderbuffer_SAFE gdraw_FramebufferRenderbufferSafe #define glFramebufferRenderbuffer glFramebufferRenderbuffer_SAFE -#include "app/windows/Iggy/gdraw/gdraw_gl_shared.inl" +#include "gdraw_gl_shared.inl" #undef glVertexAttribPointer #define glVertexAttribPointer gdraw_real_vtxattrib diff --git a/targets/app/common/Iggy/gdraw/gdraw.h b/targets/app/common/Iggy/gdraw/gdraw.h index 3f99cf6ec..b88da0756 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.h +++ b/targets/app/common/Iggy/gdraw/gdraw.h @@ -2,8 +2,8 @@ #define __LINUX_IGGY_GDRAW_H__ #include "app/common/Iggy/include/rrCore.h" -#include "app/windows/Iggy/include/gdraw.h" -#include "app/windows/Iggy/include/iggy.h" +#include "app/common/Iggy/include/gdraw.h" +#include "app/common/Iggy/include/iggy.h" #ifdef __cplusplus extern "C" { diff --git a/targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl b/targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl new file mode 100644 index 000000000..89899d295 --- /dev/null +++ b/targets/app/common/Iggy/gdraw/gdraw_gl_shaders.inl @@ -0,0 +1,1536 @@ +// This file was automatically generated by shadergen. Do not edit by hand! + +static char pshader_basic_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_basic_frag1[] = ""; +static char pshader_basic_frag2[] = + "COMMON_PSCONSTANTS;\n" + "\n" + "#ifdef TEX0\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "#endif\n" + "\n" + "#ifndef READ_ALPHA_TEX\n" + "#define READ_ALPHA_TEX(x) ((x).a)\n" + "#endif\n" + "\n" + "#ifndef AATEX_USE_SAMPLER1\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 7);\n" + "#else\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" + "#endif\n" + "\n" + "MAIN((ARGS))\n" + "{\n" + " LOWP VEC4 z;\n" + " MEDIUMP VEC4 t;\n" + " \n" + " z = color_mul;\n" + " \n" + " #ifndef ADDITIVE_ALPHA\n" + " z.rgb *= z.a; // premultiply; could do outside\n" + " #endif\n" + " \n" + " #ifdef TEX0\n" + " MEDIUMP VEC2 c,tc0;\n" + " tc0 = TC0;\n" + "\n" + " #ifdef EXPLICIT_PROJECTION\n" + " float one_over_w = 1.0 / TC1.y;\n" + " tc0.x *= one_over_w;\n" + " tc0.y *= one_over_w;\n" + " #endif\n" + " \n" + " #ifdef TEX0_RADIAL\n" + " tc0.x = sqrt(dot(tc0.xy,tc0.xy));\n" + " tc0.y = tc0.x; // necessary on some OpenGL devices\n" + " #else\n" + " #ifdef TEX0_FOCAL\n" + " c.x = tc0.x + focal.x;\n" + " c.y = tc0.y;\n" + " t.x = c.x * focal.y;\n" + " t.y = (c.x*c.x + c.y*c.y) * focal.z;\n" + " tc0.x = sqrt(t.y + t.x*t.x) - t.x;\n" + " tc0.y = tc0.x;\n" + " #endif\n" + " #endif\n" + "\n" + " #ifdef TEX0_ALPHA\n" + " t.a = READ_ALPHA_TEX(TEX2D(tex0, tc0));\n" + " #ifdef ADDITIVE_ALPHA\n" + " z.a *= t.a;\n" + " #else\n" + " z *= t.a;\n" + " #endif\n" + " #else\n" + " t = TEX2D(tex0, tc0);\n" + " #ifdef ADDITIVE_ALPHA\n" + " if (t.a != 0.0) t.rgb = t.rgb * (1.0/t.a); // unpremultiply\n" + " #endif\n" + " z *= t;\n" + " #endif\n" + " #endif\n" + "\n" + " MEDIUMP VEC2 tc1;\n" + " tc1.xy = TC1.xy;\n" + "\n" + " #ifdef EXPLICIT_PROJECTION\n" + " tc1.x /= TC1.y;\n" + " #endif\n" + "\n" + " // antialiasing blend curve\n" + " t = TEX2D(tex1, tc1.xy);\n" + " #ifdef ADDITIVE_ALPHA\n" + " z.a *= t.a;\n" + " #else\n" + " z *= t;\n" + " #endif\n" + "\n" + " #ifdef ADDITIVE_ALPHA\n" + " z += color_add;\n" + " z.rgb *= z.a; // premultiply\n" + " #else\n" + " #ifdef ADDITIVE\n" + " z.rgb += color_add.rgb * z.a; // scale addend to match premultiply\n" + " z.rgb = min(z.rgb, z.a);\n" + " #endif\n" + " #endif\n" + " \n" + " #ifdef TEX0_ALPHA_TEST\n" + " SHADER_ALPHATEST(z.a);\n" + " #endif\n" + "\n" + " OUTPUT(z);\n" + "}\n"; +static char pshader_basic_frag3[] = "#define ADDITIVE\n"; +static char pshader_basic_frag4[] = "#define ADDITIVE_ALPHA\n"; +static char pshader_basic_frag5[] = "#define TEX0\n"; +static char pshader_basic_frag6[] = + "#define TEX0\n" + "#define TEX0_ALPHA\n"; +static char pshader_basic_frag7[] = + "#define TEX0\n" + "#define TEX0_RADIAL\n"; +static char pshader_basic_frag8[] = + "#define TEX0\n" + "#define TEX0_FOCAL\n"; +static char pshader_basic_frag9[] = + "#define TEX0\n" + "#define TEX0_ALPHA\n" + "#define TEX0_ALPHA_TEST\n"; + +#define NUMFRAGMENTS_pshader_basic 4 +static char* pshader_basic_arr[18][NUMFRAGMENTS_pshader_basic] = { + { + pshader_basic_frag0, + pshader_basic_frag1, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag1, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag1, + pshader_basic_frag4, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag5, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag5, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag5, + pshader_basic_frag4, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag6, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag6, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag6, + pshader_basic_frag4, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag7, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag7, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag7, + pshader_basic_frag4, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag8, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag8, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag8, + pshader_basic_frag4, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag9, + pshader_basic_frag1, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag9, + pshader_basic_frag3, + pshader_basic_frag2, + }, + { + pshader_basic_frag0, + pshader_basic_frag9, + pshader_basic_frag4, + pshader_basic_frag2, + }, +}; + +static char** pshader_basic(int tex0, int additive) { + return pshader_basic_arr[0 + tex0 * 3 + additive * 1]; +} + +static char* pshader_basic_vars[] = {"tex0", "tex1", "color_mul", + "color_add", "focal", NULL}; + +static char pshader_general2_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_general2_frag1[] = + "COMMON_PCONSTANTS2\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "MAIN((ARGS2))\n" + "{\n" + " // get t, the basic texture color\n" + "\n" + " LOWP VEC4 t;\n" + " \n" + " t = TEX2D(tex0, tex_coord.xy);\n" + "\n" + " // now color-transform t\n" + " //\n" + " // to determine optimal format for vertex shader to output the color, " + "let's\n" + " // start by doing the math assuming the texture is premultiplied, but " + "not\n" + " // the color transform:\n" + " //\n" + " // out.r = (tex.r * color_mul.r * color_mul.a) + (color_add.r * " + "tex.a * color_mul.a)\n" + " // out.a = tex.a * color_mul.a * color_add.a // color_add.a is " + "blend mode emulation\n" + " //\n" + " // now, we can see in the above we can premultiply both mul and add by " + "color_mul.a\n" + " //\n" + " // out.r = (tex.r * color_mulp.r) + (color_addp.r * tex.a)\n" + " // out.a = tex.a * color_mulp.a // can premultiply color_add.a " + "here as well\n" + "\n" + " \n" + " LOWP VEC4 c;\n" + " c.rgb = t.rgb * color_mul.rgb + t.a * color_add.rgb;\n" + " c.a = t.a * color_mul.a;\n" + "\n" + " // apply clip rect\n" + " //\n" + " // naive math, using panel-space coordinates\n" + " //\n" + " // panel_offset = abs(pos-center) - half_width\n" + " //\n" + " // Above function is negative where not clipped, positive\n" + " // where clipped. Now, we want to capture a one-pixel boundary,\n" + " // so we need to go to pixel coordinates:\n" + " //\n" + " // panel_offset *= pixels_per_panel_unit;\n" + " // // note this doesn't account for non-uniform scale of panel\n" + " //\n" + " // And now, with an offset in pixels, we want to compute an AA " + "mask:\n" + " //\n" + " // saturate(1-panel_offset)\n" + " //\n" + " // Note that we can just multiply pixels_per_panel_unit into\n" + " // each of the terms in panel offset, and we're left with:\n" + " //\n" + " // saturate(1 - (abs() - k))\n" + " //\n" + " // which becomes:\n" + " //\n" + " // saturate(k+1 - abs())\n" + " //\n" + " // and the +1 is folded into k.\n" + "\n" + " LOWP VEC2 cliprect_alpha = saturate(clip_rect.zw - abs(tex_coord.zw - " + "clip_rect.xy));\n" + "\n" + " float edge_alpha = cliprect_alpha.x * cliprect_alpha.y;\n" + " // could be min, but multiply represents coverage better in theory; " + "@TODO check visually\n" + "\n" + " // multiply it into c's alpha, but c's already premultiplied so " + "multiply it all\n" + " c *= edge_alpha;\n" + "\n" + " OUTPUT(c);\n" + "}\n"; + +#define NUMFRAGMENTS_pshader_general2 2 +static char* pshader_general2_arr[1][NUMFRAGMENTS_pshader_general2] = { + { + pshader_general2_frag0, + pshader_general2_frag1, + }, +}; + +static char** pshader_general2(void) { return pshader_general2_arr[0]; } + +static char* pshader_general2_vars[] = {"tex0", NULL}; + +static char pshader_exceptional_blend_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_exceptional_blend_frag1[] = + "#define BLENDPROG return s*d;\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag2[] = + "#define TEX0\n" + "\n" + "MEDIUMP float compute(MEDIUMP float s, MEDIUMP float sa, MEDIUMP float d, " + "MEDIUMP float da)\n" + "{\n" + " BLENDPROG\n" + "}\n" + "\n" + "MEDIUMP float compute_a(MEDIUMP float sa, MEDIUMP float da)\n" + "{\n" + " ALPHAFUNC\n" + "}\n" + "\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" + "COMMON_PSCONSTANTS;\n" + "\n" + "MAIN((ARGS))\n" + "{\n" + " MEDIUMP VEC4 srcc,dstc;\n" + " MEDIUMP VEC3 mixed;\n" + " MEDIUMP VEC2 tc;\n" + " srcc = TEX2D(tex0, TC0.xy);\n" + " srcc = srcc*VEC4(color_mul.rgb, 1.0)*color_mul.a + color_add*srcc.a;\n" + " srcc = clamp(srcc,VEC4(0.0,0.0,0.0,0.0),VEC4(1.0,1.0,1.0,1.0));\n" + " tc = TC0.xy;\n" + " #ifndef EXCEPTIONAL_BLEND_LOAD\n" + " #ifndef EXCEPTIONAL_BLEND_RESCALE\n" + " dstc = TEX2D(tex1, tc).rgba;\n" + " #else\n" + " dstc = TEX2D(tex1, tc*rescale1.xy + rescale1.zw).rgba;\n" + " #endif\n" + " #else\n" + " dstc = EXCEPTIONAL_BLEND_LOAD(tex1, tc);\n" + " #endif\n" + " mixed.r = compute(srcc.r,srcc.a, dstc.r,dstc.a);\n" + " mixed.g = compute(srcc.g,srcc.a, dstc.g,dstc.a);\n" + " mixed.b = compute(srcc.b,srcc.a, dstc.b,dstc.a);\n" + " MEDIUMP VEC4 res;\n" + " #ifdef DIRECT\n" + " res.rgb = mixed;\n" + " #else\n" + " res.rgb = mixed + (1.0-srcc.a)*dstc.rgb + (1.0-dstc.a)*srcc.rgb;\n" + " #endif\n" + " res.a = compute_a(srcc.a,dstc.a);\n" + " OUTPUT(res);\n" + "}\n"; +static char pshader_exceptional_blend_frag3[] = + "#define BLENDPROG return sa*da - (da-d)*(sa-s);\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag4[] = + "#define BLENDPROG return max(sa*d,s*da);\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag5[] = + "#define BLENDPROG return min(sa*d,s*da);\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag6[] = + "#define DIRECT\n" + "#define BLENDPROG return min(d+s,1.0);\n" + "#define ALPHAFUNC return min(sa+da,1.0);\n"; +static char pshader_exceptional_blend_frag7[] = + "#define DIRECT\n" + "#define BLENDPROG return max(d-s,0.0);\n" + "#define ALPHAFUNC return min(sa+da,1.0);\n"; +static char pshader_exceptional_blend_frag8[] = + "#define BLENDPROG return abs(sa*d-s*da);\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag9[] = + "#define BLENDPROG return sa*(da-d);\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag10[] = + "#define BLENDPROG return d < da/2.0 ? (2.0*s*d) : (sa*da - " + "2.0*(da-d)*(sa-s));\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag11[] = + "#define BLENDPROG return s < sa/2.0 ? (2.0*s*d) : (sa*da - " + "2.0*(da-d)*(sa-s));\n" + "#define ALPHAFUNC return sa+da-sa*da;\n"; +static char pshader_exceptional_blend_frag12[] = + "#define DIRECT\n" + "#define BLENDPROG return d*(1.0-sa);\n" + "#define ALPHAFUNC return (1.0-sa)*da;\n"; +static char pshader_exceptional_blend_frag13[] = + "#define DIRECT\n" + "#define BLENDPROG return d*sa;\n" + "#define ALPHAFUNC return sa*da;\n"; + +#define NUMFRAGMENTS_pshader_exceptional_blend 3 +static char* + pshader_exceptional_blend_arr[13][NUMFRAGMENTS_pshader_exceptional_blend] = + { + { + NULL, + NULL, + NULL, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag1, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag3, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag4, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag5, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag6, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag7, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag8, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag9, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag10, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag11, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag12, + pshader_exceptional_blend_frag2, + }, + { + pshader_exceptional_blend_frag0, + pshader_exceptional_blend_frag13, + pshader_exceptional_blend_frag2, + }, +}; + +static char** pshader_exceptional_blend(int blend_mode) { + return pshader_exceptional_blend_arr[0 + blend_mode * 1]; +} + +static char* pshader_exceptional_blend_vars[] = {"tex0", "tex1", "color_mul", + "color_add", NULL}; + +static char pshader_filter_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_filter_frag1[] = ""; +static char pshader_filter_frag2[] = + "#define TEX0\n" + "\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex1, 1);\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex2, 2);\n" + "\n" + "COMMON_PSCONSTANTS;\n" + "\n" + "BEGIN_CONSTANTS \n" + " DECLARE_CONST_EXTRA(HIGHP VEC4, clamp0, 4);\n" + " DECLARE_CONST_EXTRA(HIGHP VEC4, clamp1, 5);\n" + " #define CLAMP(a,b) clamp(a.xy, b.xy, b.zw)\n" + "\n" + " DECLARE_CONST_EXTRA(LOWP VEC4, color, 6);\n" + " DECLARE_CONST_EXTRA(LOWP VEC4, color2, 7);\n" + " DECLARE_CONST_EXTRA(MEDIUMP VEC4, tc_off, 8);\n" + "END_CONSTANTS\n" + " \n" + "MAIN((ARGS))\n" + "{\n" + " LOWP VEC4 source;\n" + " source = TEX2D(tex1, CLAMP(TC0.xy,clamp1));\n" + " MEDIUMP float shadow_a = TEX2D(tex0, CLAMP(TC0.xy + " + "tc_off.xy,clamp0)).a;\n" + " \n" + " #ifdef BEVEL\n" + " MEDIUMP float shadow_b = TEX2D(tex0, CLAMP(TC0.xy - " + "tc_off.xy,clamp0)).a;\n" + " shadow_a = (shadow_b - shadow_a) * tc_off.z;\n" + " #ifdef GRADIENT\n" + " shadow_a = clamp(shadow_a*0.5 + 0.5, 0.0, 1.0);\n" + " #else\n" + " shadow_b = clamp(-shadow_a, 0.0, 1.0);\n" + " shadow_a = clamp(shadow_a, 0.0, 1.0);\n" + " #endif\n" + " #else\n" + " #ifdef INNER\n" + " #ifndef GRADIENT\n" + " shadow_a = 1.0-shadow_a;\n" + " #endif // !GRADIENT\n" + " #endif // INNER\n" + " shadow_a = min(shadow_a*tc_off.z,1.0);\n" + " #endif // BEVEL\n" + " \n" + " #ifdef GRADIENT\n" + " MEDIUMP VEC2 gtc = VEC2(shadow_a, 0.5);\n" + " MEDIUMP VEC4 ecolor = TEX2D(tex2, gtc);\n" + " shadow_a = 1.0;\n" + " #else\n" + " #ifdef BEVEL\n" + " MEDIUMP VEC4 ecolor = shadow_b*color + shadow_a*color2;\n" + " shadow_a = 1.0;\n" + " #else\n" + " MEDIUMP VEC4 ecolor = color;\n" + " #endif\n" + " #endif\n" + " \n" + " #ifdef ONTOP\n" + " #ifdef KNOCKOUT\n" + " OUTPUT(ecolor);\n" + " #else\n" + " OUTPUT(ecolor + source * (1.0-ecolor.a));\n" + " #endif\n" + " #else\n" + " \n" + " #ifdef KNOCKOUT\n" + " #ifdef INNER\n" + " // KNOCKOUT & INNER\n" + " OUTPUT(ecolor * source.a * shadow_a);\n" + " #else\n" + " // KNOCKOUT & !INNER\n" + " OUTPUT(ecolor * (1.0-source.a) * shadow_a);\n" + " #endif\n" + " #else // !KNOCKOUT\n" + " \n" + " #ifdef INNER\n" + " // !KNOCKOUT & INNER\n" + " /* this is particularly subtle; effectively computes\n" + " invert shadow\n" + " unpremultiply source\n" + " shadow*color over source.rgb (treat as opaque)\n" + " multiply through by source alpha (i.e. make premultiplied again)\n" + " but expressed without *actually* unpremultiplying\n" + " */\n" + " LOWP VEC4 shadow = ecolor * shadow_a;\n" + " LOWP VEC4 res;\n" + " res.rgb = shadow.rgb*source.a + source.rgb*(1.0-shadow.a);\n" + " res.a = source.a;\n" + " OUTPUT(res);\n" + " #else\n" + " // !KNOCKOUT & !INNER\n" + " LOWP VEC4 shadow = ecolor * shadow_a;\n" + " OUTPUT(shadow * (1.0-source.a) + source);\n" + " #endif // INNER\n" + "\n" + " #endif // KNOCKOUT\n" + " #endif // ONTOP\n" + "}\n"; +static char pshader_filter_frag3[] = "#define KNOCKOUT\n"; +static char pshader_filter_frag4[] = "#define GRADIENT\n"; +static char pshader_filter_frag5[] = "#define INNER\n"; +static char pshader_filter_frag6[] = "#define ONTOP\n"; +static char pshader_filter_frag7[] = "#define BEVEL\n"; + +#define NUMFRAGMENTS_pshader_filter 7 +static char* pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag1, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag1, + pshader_filter_frag5, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag1, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag1, + pshader_filter_frag2, + }, + { + pshader_filter_frag0, + pshader_filter_frag7, + pshader_filter_frag6, + pshader_filter_frag1, + pshader_filter_frag4, + pshader_filter_frag3, + pshader_filter_frag2, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static char** pshader_filter(int bevel, int ontop, int inner, int gradient, + int knockout) { + return pshader_filter_arr[0 + bevel * 16 + ontop * 8 + inner * 4 + + gradient * 2 + knockout * 1]; +} + +static char* pshader_filter_vars[] = {"tex0", "tex1", "color", + "tc_off", "tex2", "clamp0", + "clamp1", "color2", NULL}; + +static char pshader_blur_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_blur_frag1[] = "#define TAPS TAP(0); TAP(1);\n"; +static char pshader_blur_frag2[] = + "#define TEX0\n" + "\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "COMMON_PSCONSTANTS;\n" + "\n" + "BEGIN_CONSTANTS\n" + " DECLARE_CONST_EXTRA(HIGHP VEC4, clampv, 4);\n" + " #define CLAMP(t) clamp(t, clampv.xy, clampv.zw)\n" + " \n" + " DECLARE_CONST_EXTRA(MEDIUMP VEC4, tap[9], 5);\n" + "END_CONSTANTS\n" + "\n" + "MAIN((ARGS))\n" + "{\n" + " MEDIUMP VEC4 s = VEC4(0,0,0,0);\n" + " \n" + " #define TAP(i) s += TEX2D(tex0, CLAMP(TC0.xy + tap[i].xy)) * " + "tap[i].z\n" + " TAPS\n" + " \n" + " OUTPUT(s);\n" + "}\n"; +static char pshader_blur_frag3[] = "#define TAPS TAP(0); TAP(1); TAP(2);\n"; +static char pshader_blur_frag4[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3);\n"; +static char pshader_blur_frag5[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4);\n"; +static char pshader_blur_frag6[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5);\n"; +static char pshader_blur_frag7[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6);\n"; +static char pshader_blur_frag8[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6); " + "TAP(7);\n"; +static char pshader_blur_frag9[] = + "#define TAPS TAP(0); TAP(1); TAP(2); TAP(3); TAP(4); TAP(5); TAP(6); " + "TAP(7); TAP(8);\n"; + +#define NUMFRAGMENTS_pshader_blur 3 +static char* pshader_blur_arr[10][NUMFRAGMENTS_pshader_blur] = { + { + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + }, + { + pshader_blur_frag0, + pshader_blur_frag1, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag3, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag4, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag5, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag6, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag7, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag8, + pshader_blur_frag2, + }, + { + pshader_blur_frag0, + pshader_blur_frag9, + pshader_blur_frag2, + }, +}; + +static char** pshader_blur(int numtaps) { + return pshader_blur_arr[0 + numtaps * 1]; +} + +static char* pshader_blur_vars[] = {"tex0", "tap", "clampv", NULL}; + +static char pshader_color_matrix_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_color_matrix_frag1[] = + "#define TEX0\n" + "\n" + "DECLARE_SAMPLER(LOWP SAMPLER, tex0, 0);\n" + "COMMON_PSCONSTANTS;\n" + "\n" + "BEGIN_CONSTANTS\n" + " DECLARE_CONST_EXTRA(MEDIUMP VEC4, data[5], 4);\n" + "END_CONSTANTS\n" + "\n" + "MAIN((ARGS))\n" + "{\n" + " MEDIUMP VEC4 t,color;\n" + " t = TEX2D(tex0, TC0.xy);\n" + " \n" + "#ifndef COLORMATRIX_HAS_ALPHA_EFFECTS\n" + " // version of colormatrix assuming no additive alpha in matrix,\n" + " // which is all CS3 seems to be able to output\n" + " color.r = dot(data[0], t) + data[4].r*t.a;\n" + " color.g = dot(data[1], t) + data[4].g*t.a;\n" + " color.b = dot(data[2], t) + data[4].b*t.a;\n" + " color.a = data[3].a * t.a;\n" + " color.rgb = color.rgb * data[3].a;\n" + "#else\n" + " // version of colormatrix that matches spec \n" + " if (t.a == 0.0)\n" + " t.rgb = VEC3(0.0);\n" + " else\n" + " t.rgb /= t.a;\n" + " color.r = dot(data[0], t) + data[4].r;\n" + " color.g = dot(data[1], t) + data[4].g;\n" + " color.b = dot(data[2], t) + data[4].b;\n" + " color.a = dot(data[3], t) + data[4].a;\n" + " color.rgb = color.rgb * color.a;\n" + "#endif\n" + " OUTPUT(color);\n" + "}\n"; + +#define NUMFRAGMENTS_pshader_color_matrix 2 +static char* pshader_color_matrix_arr[1][NUMFRAGMENTS_pshader_color_matrix] = { + { + pshader_color_matrix_frag0, + pshader_color_matrix_frag1, + }, +}; + +static char** pshader_color_matrix(void) { return pshader_color_matrix_arr[0]; } + +static char* pshader_color_matrix_vars[] = {"tex0", "data", NULL}; + +static char pshader_manual_clear_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char pshader_manual_clear_frag1[] = + "COMMON_PSCONSTANTS;\n" + "\n" + "MAIN((ARGS))\n" + "{\n" + " OUTPUT(color_mul);\n" + "}\n"; + +#define NUMFRAGMENTS_pshader_manual_clear 2 +static char* pshader_manual_clear_arr[1][NUMFRAGMENTS_pshader_manual_clear] = { + { + pshader_manual_clear_frag0, + pshader_manual_clear_frag1, + }, +}; + +static char** pshader_manual_clear(void) { return pshader_manual_clear_arr[0]; } + +static char* pshader_manual_clear_vars[] = {"color_mul", NULL}; + +static char vshader_vsgl_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char vshader_vsgl_frag1[] = "#define FORMAT_V2\n"; +static char vshader_vsgl_frag2[] = + " uniform vec4 world0;\n" + " uniform vec4 world1;\n" + " uniform vec4 x_off;\n" + " uniform vec4 texgen_s;\n" + " uniform vec4 texgen_t;\n" + "#ifdef FLASH_10\n" + " uniform vec4 x3d;\n" + " uniform vec4 y3d;\n" + " uniform vec4 w3d;\n" + "#else\n" + " uniform vec4 viewproj;\n" + "#endif\n" + "\n" + " attribute vec4 position;\n" + " attribute vec4 in_attr;\n" + "\n" + " varying vec4 tex_coord;\n" + " \n" + " void main() {\n" + " // world transform\n" + " HIGHP vec4 wpos = vec4(dot(world0, position), dot(world1, " + "position), world0.z, 1.0);\n" + " \n" + " // texture coordinates\n" + " tex_coord = vec4(dot(texgen_s, position), dot(texgen_t, " + "position), 1.0, 0.0);\n" + " #ifdef FORMAT_V2TC2\n" + " tex_coord.xy = in_attr.xy;\n" + " #endif\n" + " \n" + " // antialias processing\n" + " #ifdef FORMAT_V2C4\n" + " HIGHP vec4 q,p;\n" + " HIGHP float len,newlen;\n" + " q.xy = in_attr.yz / 64.0;\n" + " len = length(q.xy);\n" + " p.x = q.x*x_off.x + q.y*x_off.y;\n" + " p.y = q.x*x_off.z + q.y*x_off.w;\n" + " p.z = 0.0; p.w = 0.0;\n" + " p.xy = vec2(dot(world0, p), dot(world1, p));\n" + " newlen = length(p.xy);\n" + " p *= (newlen!=0.0) ? len / newlen : 0.0;\n" + " wpos.xy += p.xy;\n" + " tex_coord.z = in_attr.x / 32.0;\n" + " #endif\n" + " \n" + " // view/projection transform\n" + " gl_Position = vec4(wpos.xy * viewproj.xy + viewproj.zw, " + "wpos.zw);\n" + "\n" + " #ifdef FLASH_10\n" + " gl_Position = wpos.x * x3d + wpos.y * y3d + w3d; // z is " + "ignored!\n" + " gl_Position.w = gl_Position.z;\n" + " gl_Position.z = wpos.z * gl_Position.w;\n" + " #endif\n" + " } \n"; +static char vshader_vsgl_frag3[] = "#define FORMAT_V2C4\n"; +static char vshader_vsgl_frag4[] = "#define FORMAT_V2TC2\n"; + +#define NUMFRAGMENTS_vshader_vsgl 3 +static char* vshader_vsgl_arr[3][NUMFRAGMENTS_vshader_vsgl] = { + { + vshader_vsgl_frag0, + vshader_vsgl_frag1, + vshader_vsgl_frag2, + }, + { + vshader_vsgl_frag0, + vshader_vsgl_frag3, + vshader_vsgl_frag2, + }, + { + vshader_vsgl_frag0, + vshader_vsgl_frag4, + vshader_vsgl_frag2, + }, +}; + +static char** vshader_vsgl(int vformat) { + return vshader_vsgl_arr[0 + vformat * 1]; +} + +static char* vshader_vsgl_vars[] = {"world0", "world1", "x_off", "texgen_s", + "texgen_t", "viewproj", NULL}; + +static char vshader_vsglihud_frag0[] = + "#version 110 // only need 100, but 110 works around a driver " + "issue\n" + "#define MAIN(x) void main()\n" + "#define ARGS\n" + "#define ARGS2\n" + "#define DECLARE_SAMPLER(type, name, reg) uniform type name\n" + "#define DECLARE_CONST(type, name, reg) uniform type name\n" + "#define DECLARE_CONST_EXTRA(type, name, reg) uniform type name\n" + "#define SAMPLER sampler2D\n" + "#define TEX2D texture2D\n" + "#define VEC4 vec4\n" + "#define VEC3 vec3\n" + "#define VEC2 vec2\n" + "#define LOWP\n" + "#define MEDIUMP\n" + "#define HIGHP\n" + "#define TC0 tex_coord.xy\n" + "#define TC1 tex_coord.zw\n" + "#define OUTPUT(x) gl_FragColor = x\n" + "\n" + "#define SHADER_ALPHATEST(x) if (x < 0.5) discard\n" + "\n" + "#define COMMON_PSCONSTANTS DECLARE_CONST(VEC4, color_mul, 0); " + "DECLARE_CONST(VEC4, color_add, 1); DECLARE_CONST(VEC4, focal, 2); varying " + "VEC4 tex_coord\n" + "#define COMMON_PCONSTANTS2 varying VEC4 tex_coord; varying VEC4 " + "color_mul; varying VEC4 color_add; varying VEC4 clip_rect;\n" + "#define BEGIN_CONSTANTS\n" + "#define END_CONSTANTS\n" + "\n" + "#define saturate(x) clamp(x,0.0,1.0)\n"; +static char vshader_vsglihud_frag1[] = + "uniform vec4 worldview[2];\n" + "uniform vec4 material[96];\n" + "uniform float textmode;\n" + "\n" + "#define pixels_per_panel_unit 1.0\n" + "\n" + "attribute vec2 position;\n" + "attribute vec2 texcoord;\n" + "attribute vec4 material_index; \n" + "\n" + "varying vec4 tex_coord;\n" + "varying vec4 color_mul;\n" + "varying vec4 color_add;\n" + "varying vec4 clip_rect;\n" + "\n" + "void main() {\n" + " // view/projection transform\n" + " gl_Position = vec4(worldview[0].w + dot(worldview[0].xy, position),\n" + " worldview[1].w + dot(worldview[1].xy, position),\n" + " 0.0,\n" + " 1.0);\n" + "\n" + " LOWP VEC4 c1_mul,c1_add,c2_mul,c2_add, c_mul,c_add;\n" + " HIGHP VEC4 clip;\n" + "\n" + " // convert 8-bit material_info loaded as float back to integers\n" + " LOWP VEC3 mat = floor(255.0*material_index.xyz + 0.5);\n" + "\n" + " // @TODO: flatten these into a single array\n" + " c1_mul = material[int(mat.r )];\n" + " c1_add = material[int(mat.r+1.0)];\n" + " c2_mul = material[int(mat.g )];\n" + " c2_add = material[int(mat.g+1.0)];\n" + " clip = material[int(mat.b )];\n" + "\n" + " // if textmode is 0, suppress c2_add.rgba\n" + "\n" + " // combine hierarchical and local colors\n" + " color_add.rgb = c1_mul.rgb * (c2_add.rgb * textmode) + c1_add.rgb;\n" + " color_mul = c1_mul * c2_mul;\n" + " color_mul.a *= material_index.w;\n" + "\n" + " // compute premultiplied alpha\n" + " color_mul.rgb *= color_mul.a;\n" + " color_add.rgb *= color_mul.a;\n" + "\n" + " // pass additive blending flag stored in c1_add.a and c2_add.a to " + "pixel shader\n" + " color_add.a = clamp(c1_add.a + c2_add.a * textmode,0.0,1.0);\n" + "\n" + " // except actually we'll premultiply that into color_mul.a\n" + " color_mul.a *= (1.0-color_add.a);\n" + "\n" + " // compute premultiplied cliprect\n" + " // for now cliprect comes in as x0,y0,x1,y1, not center/offset\n" + " \n" + " // coordinates come in already rotated into panel space, which is " + "also where cliprect is defined\n" + " HIGHP VEC2 center = (clip.xy + clip.zw) / 2.0;\n" + " HIGHP VEC2 offset = (clip.zw - clip.xy) / 2.0;\n" + "\n" + " // use of pixels_per_panel_unit here ignores effect of non-uniform " + "scaling\n" + " clip_rect.xy = center * pixels_per_panel_unit;\n" + " clip_rect.zw = offset * pixels_per_panel_unit + 1.0; // offset is " + "location where alpha goes to 0, so it's 1 pixel out\n" + "\n" + " tex_coord.zw = position * pixels_per_panel_unit;\n" + " tex_coord.xy = texcoord;\n" + "} \n"; + +#define NUMFRAGMENTS_vshader_vsglihud 2 +static char* vshader_vsglihud_arr[1][NUMFRAGMENTS_vshader_vsglihud] = { + { + vshader_vsglihud_frag0, + vshader_vsglihud_frag1, + }, +}; + +static char** vshader_vsglihud(void) { return vshader_vsglihud_arr[0]; } + +static char* vshader_vsglihud_vars[] = {"worldview", "material", "textmode", + NULL}; \ No newline at end of file diff --git a/targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl b/targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl new file mode 100644 index 000000000..e08fd755b --- /dev/null +++ b/targets/app/common/Iggy/gdraw/gdraw_gl_shared.inl @@ -0,0 +1,2695 @@ +// gdraw_gl_shared.inl - copyright 2012 RAD Game Tools +// +// This file implements the part of the Iggy graphics driver layer shared +// between GL and GL ES 2 (which is most of it). It heavily depends on a bunch +// of typedefs, #defines and some utility functions that need to be set up +// correctly for the GL version being targeted. It also targets a kind of +// pseudo-GL 2.0; the platform implementation has to set up some #defines and +// perform extra initialization work if we go through extensions instead. This +// is all a bit ugly, but much easier to maintain than the original solution, +// where we just kept two almost identical versions of this code. + +///////////////////////////////////////////////////////////// +// +// common code shared by all GDraw implemetations +// + +// The native handle type holds resource handles and a coarse description. +typedef union { + // handle that is a texture + struct { + GLuint gl; + GLuint gl_renderbuf; + U32 w : 24; + U32 nonpow2 : 8; + U32 h : 24; + U32 reserved : 8; + } tex; + + // handle that is a vertex buffer + struct { + GLuint base; + GLuint indices; + } vbuf; +} GDrawNativeHandle; + +#include "gdraw_shared.inl" + +// max rendertarget stack depth. this depends on the extent to which you +// use filters and non-standard blend modes, and how nested they are. +#define MAX_RENDER_STACK_DEPTH \ + 8 // Iggy is hardcoded to a limit of 16... probably 1-3 is realistic +#define AATEX_SAMPLER 3 // sampler that aa_tex gets set in +#define QUAD_IB_COUNT 4096 // quad index buffer has indices for this many quads + +#define ASSERT_COUNT(a, b) ((a) == (b) ? (b) : -1) + +/////////////////////////////////////////////////////////////////////////////// +// +// debugging/validation +// + +static RADINLINE void break_on_err(GLint e) { +#ifdef _DEBUG + if (e) { + RR_BREAK(); + } +#endif +} + +#ifndef GDRAW_PLATFORM_REPORT_GL_SITE +#define GDRAW_PLATFORM_REPORT_GL_SITE(site) ((void)0) +#endif + +static void report_err(GLint e) { + break_on_err(e); + IggyGDrawSendWarning(NULL, "OpenGL glGetError error"); +} + +static void compilation_err(const char* msg) { + error_msg_platform_specific(msg); + report_err(GL_INVALID_VALUE); +} + +static void eat_gl_err(void) { while (glGetError() != GL_NO_ERROR); } + +static void opengl_check_site(const char* site); + +static void opengl_check(void) { opengl_check_site(NULL); } + +static void opengl_check_site(const char* site) { +#ifdef _DEBUG + GLint e = glGetError(); + if (e != GL_NO_ERROR) { + GDRAW_PLATFORM_REPORT_GL_SITE(site); + report_err(e); + eat_gl_err(); + } +#else + (void)site; +#endif +} + +#ifndef OPENGL_CHECK_SITE +#define OPENGL_CHECK_SITE(site) opengl_check_site(site) +#endif + +static U32 is_pow2(S32 n) { return ((U32)n & (U32)(n - 1)) == 0; } + +/////////////////////////////////////////////////////////////////////////////// +// +// GDraw +// +// This data structure stores all the data for the GDraw, just to keep +// it a bit cleaner instead of storing in globals, even though GDraw is +// a singleton. + +// fragment and vertex program + +// The mac doesn't use extensions for the functions dealing with programs, and +// the non-extension versions take GLuint instead of GLhandle. The mac defines +// GDrawGLProgram to GLuint before including gdraw_gl_shared.inl to account for +// this. +#ifndef GDrawGLProgram +#define GDrawGLProgram GLhandle +#endif + +typedef struct ProgramWithCachedVariableLocations { + GDrawGLProgram program; + GLint vars[2][MAX_VARS]; +} ProgramWithCachedVariableLocations; + +// render-stack state +typedef struct { + GDrawHandle* color_buffer; + GDrawHandle* stencil_depth; + S32 base_x, base_y, width, height; + rrbool cached; +} GDrawFramebufferState; + +// texture format description +typedef struct { + U8 iggyfmt; // IFT_FORMAT_* + U8 blkx, blky; // compressed block size in pixels (for compressed formats) + U8 blkbytes; // block bytes + GLenum intfmt; // GL internal format + GLenum fmt; // GL_TEXTURE_COMPRESSED for compressed formats! + GLenum type; +} TextureFormatDesc; + +static GDrawFunctions gdraw_funcs; + +/////////////////////////////////////////////////////////////////////////////// +// +// GDraw data structure +// +// +// This is the primary rendering abstraction, which hides all +// the platform-specific rendering behavior from /G/. It is +// full of platform-specific graphics state, and also general +// graphics state so that it doesn't have to callback into /G/ +// to get at that graphics state. + +static struct { + S32 multisampling; // number of samples if multisampling (always 0 if no + // GDRAW_MULTISAMPLING) + + S32 vx, vy; // viewport width/height in pixels + S32 fw, fh; // full width/height of bound rendertarget + S32 tw, th; // actual width/height of current tile + S32 tpw, tph; // width/height of padded version of tile + + // tile origin location (without and with padding) + rrbool tile_enabled; + S32 tx0, ty0; + S32 tx0p, ty0p; + + // if we're in the middle of rendering a blur, certain viewport-related + // functions have to behave differently, so they check this flag + rrbool in_blur; + + F32 projection[4]; // scalex, scaley, transx, transy + + // conversion from worldspace to viewspace <0,0>.. -- no translation or + // rotation + F32 world_to_pixel[2]; + + // 3d transformation + F32 xform_3d[3][4]; + rrbool use_3d; + + // render-state stack for 'temporary' rendering + GDrawFramebufferState frame[MAX_RENDER_STACK_DEPTH]; + GDrawFramebufferState* cur; + + // texture and vertex buffer pools + GDrawHandleCache* texturecache; + GDrawHandleCache* vbufcache; + + // GL_EXT_separate_shader_objects isn't sufficiently standard, + // so we have to bind every vertex shader to every fragment shader + + // raw vertex shaders + GLuint vert[GDRAW_vformat__count]; + + // fragment shaders with vertex shaders + ProgramWithCachedVariableLocations + fprog[GDRAW_TEXTURE__count][3][3]; // [tex0mode][additive][vformat] + ProgramWithCachedVariableLocations ihud[2]; + + // fragment shaders with fixed-function + ProgramWithCachedVariableLocations + exceptional_blend[GDRAW_BLENDSPECIAL__count]; + ProgramWithCachedVariableLocations filter_prog[2][16]; + ProgramWithCachedVariableLocations blur_prog[MAX_TAPS + 1]; + ProgramWithCachedVariableLocations colormatrix; + ProgramWithCachedVariableLocations manual_clear; + + // render targets + + // these two lines must be adjacent because of how rendertargets works + GDrawHandleCache rendertargets; + GDrawHandle + rendertarget_handles[MAX_RENDER_STACK_DEPTH]; // not -1, because we use + // +1 to initialize + + gswf_recti rt_valid[MAX_RENDER_STACK_DEPTH + 1]; + GDrawHandle stencil_depth; + + // size of our render targets + S32 frametex_width, frametex_height; + + // framebuffer object used for render-to-texture + GLuint framebuffer_stack_object; + + // framebuffer object used to copy from MSAA renderbuffer to texture + GLuint framebuffer_copy_to_texture; + + // framebuffer object used for main screen (set to non-0 to do render to + // texture) + GLuint main_framebuffer; + + // antialias texture + GLuint aa_tex; + + // canned quad indices + GLuint quad_ib; + + // texture formats + const TextureFormatDesc* tex_formats; + + // caps + U32 has_conditional_non_power_of_two + : 1; // non-power-of-2 supported, but only CLAMP_TO_EDGE and can't have + // mipmaps + U32 has_packed_depth_stencil : 1; + U32 has_depth24 : 1; + U32 has_mapbuffer : 1; + U32 has_texture_max_level : 1; + + // fake fence tracking for thrashing detection + U64 frame_counter; +}* gdraw; + +//////////////////////////////////////////////////////////////////////// +// +// General resource management for both textures and vertex buffers +// + +// make a texture with reasonable default state +static void make_texture(GLuint tex) { + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +} + +static void make_rendertarget(GDrawHandle* t, GLuint tex, GLenum int_type, + GLenum ext_type, GLenum data_type, S32 w, S32 h, + S32 size) { + glBindTexture(GL_TEXTURE_2D, tex); + glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, + NULL); + make_texture(tex); + glBindTexture(GL_TEXTURE_2D, 0); +} + +static void api_free_resource(GDrawHandle* r) { + if (r->state == GDRAW_HANDLE_STATE_user_owned) return; + + if (!r->cache->is_vertex) { + glDeleteTextures(1, &r->handle.tex.gl); + if (r->handle.tex.gl_renderbuf && + r->handle.tex.gl_renderbuf != r->handle.tex.gl) + glDeleteRenderbuffers(1, &r->handle.tex.gl_renderbuf); + } else { + glDeleteBuffers(1, &r->handle.vbuf.base); + glDeleteBuffers(1, &r->handle.vbuf.indices); + } + opengl_check(); +} + +static void RADLINK gdraw_UnlockHandles(GDrawStats* gstats) { + // since we're not using fences for this implementation, move all textures + // off the active list if you're using fences, this is when the fence needs + // to actually occur + gdraw_HandleCacheUnlockAll(gdraw->texturecache); + gdraw_HandleCacheUnlockAll(gdraw->vbufcache); +} + +//////////////////////////////////////////////////////////////////////// +// +// Texture creation/updating +// + +extern GDrawTexture* gdraw_GLx_(WrappedTextureCreate)(S32 gl_texture_handle, + S32 width, S32 height, + rrbool has_mipmaps) { + GDrawStats stats = {0}; + GDrawHandle* p = gdraw_res_alloc_begin( + gdraw->texturecache, 0, + &stats); // it may need to free one item to give us a handle + GLint old; + + glGetIntegerv(GL_TEXTURE_BINDING_2D, &old); + glBindTexture(GL_TEXTURE_2D, gl_texture_handle); + if (has_mipmaps) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, old); + + p->bytes = 0; + p->handle.tex.gl = gl_texture_handle; + p->handle.tex.w = width; + p->handle.tex.h = height; + p->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); + gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + return (GDrawTexture*)p; +} + +extern void gdraw_GLx_(WrappedTextureChange)(GDrawTexture* tex, + S32 new_gl_texture_handle, + S32 new_width, S32 new_height, + rrbool has_mipmaps) { + GDrawHandle* p = (GDrawHandle*)tex; + GLint old; + + glGetIntegerv(GL_TEXTURE_BINDING_2D, &old); + glBindTexture(GL_TEXTURE_2D, new_gl_texture_handle); + if (has_mipmaps) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, old); + + p->handle.tex.gl = new_gl_texture_handle; + p->handle.tex.w = new_width; + p->handle.tex.h = new_height; + p->handle.tex.nonpow2 = !(is_pow2(new_width) && is_pow2(new_height)); +} + +extern void gdraw_GLx_(WrappedTextureDestroy)(GDrawTexture* tex) { + GDrawStats stats = {0}; + gdraw_res_free((GDrawHandle*)tex, &stats); +} + +static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture* tex, void* old_id, + void* new_id) { + GDrawHandle* p = (GDrawHandle*)tex; + // if this is still the handle it's thought to be, change the owner; + // if the owner *doesn't* match, then they're changing a stale handle, so + // ignore + if (p->owner == old_id) p->owner = new_id; +} + +static rrbool RADLINK gdraw_MakeTextureBegin( + void* owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, + GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* gstats) { + S32 size = 0, asize, stride; + GDrawHandle* t = NULL; + opengl_check(); + + stride = width; + if (format == GDRAW_TEXTURE_FORMAT_rgba32) stride *= 4; + size = stride * height; + + asize = size; + if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) asize = asize * 4 / 3; + + t = gdraw_res_alloc_begin(gdraw->texturecache, asize, gstats); + if (!t) return IGGY_RESULT_Error_GDraw; + + glGenTextures(1, &t->handle.tex.gl); + + p->texture_data = IggyGDrawMalloc(size); + if (!p->texture_data) { + gdraw_HandleCacheAllocateFail(t); + IggyGDrawSendWarning(NULL, "GDraw malloc for texture data failed"); + return false; + } + + t->handle.tex.w = width; + t->handle.tex.h = height; + t->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); + + p->num_rows = height; + p->p0 = t; + p->p1 = owner; + p->stride_in_bytes = stride; + p->texture_type = GDRAW_TEXTURE_TYPE_rgba; + p->i0 = format; + p->i1 = flags; + p->i2 = width; + p->i3 = height; + p->i4 = asize; + opengl_check(); + return true; +} + +static GDrawTexture* RADLINK +gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* stats) { + gdraw_texture_format format = (gdraw_texture_format)p->i0; + S32 flags = p->i1; + rrbool mipmap = (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) != 0; + S32 width = p->i2, height = p->i3; + GLuint z, e; + GDrawHandle* t = (GDrawHandle*)p->p0; + + z = t->handle.tex.gl; + assert(z != 0); + + make_texture(z); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (format == GDRAW_TEXTURE_FORMAT_font) + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, + GL_UNSIGNED_BYTE, p->texture_data); + else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, + GL_UNSIGNED_BYTE, p->texture_data); + e = glGetError(); + break_on_err(e); + + if (mipmap) glGenerateMipmap(GL_TEXTURE_2D); + if (!e) e = glGetError(); + + if (e != 0) { + gdraw_HandleCacheAllocateFail(t); + IggyGDrawSendWarning(NULL, "GDraw OpenGL error creating texture"); + eat_gl_err(); + return NULL; + } else { + gdraw_HandleCacheAllocateEnd( + t, p->i4, p->p1, + (flags & GDRAW_MAKETEXTURE_FLAGS_never_flush) + ? GDRAW_HANDLE_STATE_pinned + : GDRAW_HANDLE_STATE_locked); + stats->nonzero_flags |= GDRAW_STATS_alloc_tex; + stats->alloc_tex += 1; + stats->alloc_tex_bytes += p->i4; + } + + // default wrap mode is clamp to edge + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + if (mipmap) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + IggyGDrawFree(p->texture_data); + + opengl_check(); + return (GDrawTexture*)t; +} + +static rrbool RADLINK gdraw_UpdateTextureBegin(GDrawTexture* tex, + void* unique_id, + GDrawStats* stats) { + RR_UNUSED_VARIABLE(stats); + return gdraw_HandleCacheLock((GDrawHandle*)tex, unique_id); +} + +static void RADLINK gdraw_UpdateTextureRect(GDrawTexture* tex, void* unique_id, + S32 x, S32 y, S32 stride, S32 w, + S32 h, U8* data, + gdraw_texture_format format) { + glBindTexture(GL_TEXTURE_2D, ((GDrawHandle*)tex)->handle.tex.gl); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + // @TODO: use 'stride' + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, + (format == GDRAW_TEXTURE_FORMAT_font) ? GL_ALPHA : GL_RGBA, + GL_UNSIGNED_BYTE, data); + opengl_check(); +} + +static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture* tex, void* unique_id, + GDrawStats* stats) { + gdraw_HandleCacheUnlock((GDrawHandle*)tex); +} + +static void RADLINK gdraw_FreeTexture(GDrawTexture* tt, void* unique_id, + GDrawStats* gstats) { + GDrawHandle* t = (GDrawHandle*)tt; + assert(t != NULL); + if (t->owner == unique_id || unique_id == NULL) { + if (t->cache == &gdraw->rendertargets) { + gdraw_HandleCacheUnlock(t); + // cache it by simply not freeing it + return; + } + + gdraw_res_free(t, gstats); + } +} + +static rrbool RADLINK gdraw_TryToLockTexture(GDrawTexture* t, void* unique_id, + GDrawStats* gstats) { + RR_UNUSED_VARIABLE(gstats); + return gdraw_HandleCacheLock((GDrawHandle*)t, unique_id); +} + +static void RADLINK gdraw_DescribeTexture(GDrawTexture* tex, + GDraw_Texture_Description* desc) { + GDrawHandle* p = (GDrawHandle*)tex; + desc->width = p->handle.tex.w; + desc->height = p->handle.tex.h; + desc->size_in_bytes = p->bytes; +} + +static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8* rgba) { + if (!gdraw->aa_tex) glGenTextures(1, &gdraw->aa_tex); + + make_texture(gdraw->aa_tex); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, 1, 0, GL_RGBA, + GL_UNSIGNED_BYTE, rgba); + opengl_check(); +} + +//////////////////////////////////////////////////////////////////////// +// +// Vertex buffer creation/deletion +// + +static rrbool RADLINK gdraw_MakeVertexBufferBegin( + void* unique_id, gdraw_vformat vformat, S32 vbuf_size, S32 ibuf_size, + GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* gstats) { + GLuint e; + GDrawHandle* vb; + opengl_check(); + vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, gstats); + if (!vb) { + IggyGDrawSendWarning(NULL, "GDraw out of vertex buffer memory"); + return false; + } + + e = glGetError(); + vb->handle.vbuf.base = 0; + vb->handle.vbuf.indices = 0; + glGenBuffers(1, &vb->handle.vbuf.base); + glGenBuffers(1, &vb->handle.vbuf.indices); + glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); + glBufferData(GL_ARRAY_BUFFER, vbuf_size, NULL, GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, NULL, GL_STATIC_DRAW); + if (!e) e = glGetError(); + if (e != GL_NO_ERROR) { + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glDeleteBuffers(1, &vb->handle.vbuf.base); + glDeleteBuffers(1, &vb->handle.vbuf.indices); + gdraw_HandleCacheAllocateFail(vb); + eat_gl_err(); + IggyGDrawSendWarning(NULL, + "GDraw OpenGL vertex buffer creation failed"); + return false; + } + + p->i0 = vbuf_size; + p->i1 = ibuf_size; + p->p0 = vb; + p->p1 = unique_id; + + if (!gdraw->has_mapbuffer) { + p->vertex_data = IggyGDrawMalloc(vbuf_size); + p->vertex_data_length = vbuf_size; + p->index_data = IggyGDrawMalloc(ibuf_size); + p->index_data_length = ibuf_size; + + // check for out of memory conditions + if (!p->vertex_data || !p->index_data) { + if (p->vertex_data) IggyGDrawFree(p->vertex_data); + if (p->index_data) IggyGDrawFree(p->index_data); + IggyGDrawSendWarning( + NULL, "GDraw malloc for vertex buffer temporary memory failed"); + return false; + } + } else { + p->vertex_data = (U8*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); + p->vertex_data_length = vbuf_size; + + p->index_data = + (U8*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); + p->index_data_length = ibuf_size; + } + + opengl_check(); + return true; +} + +static rrbool RADLINK +gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_ProcessingInfo* p) { + assert(0); + return false; +} + +static GDrawVertexBuffer* RADLINK gdraw_MakeVertexBufferEnd( + GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* stats) { + GDrawHandle* vb = (GDrawHandle*)p->p0; + rrbool ok = true; + GLuint e; + + if (!gdraw->has_mapbuffer) { + glBufferData(GL_ARRAY_BUFFER, p->i0, p->vertex_data, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, p->i1, p->index_data, + GL_STATIC_DRAW); + IggyGDrawFree(p->vertex_data); + IggyGDrawFree(p->index_data); + } else { + if (!glUnmapBuffer(GL_ARRAY_BUFFER)) ok = false; + if (!glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER)) ok = false; + } + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + e = glGetError(); + if (!ok || e != GL_NO_ERROR) { + glDeleteBuffers(1, &vb->handle.vbuf.base); + glDeleteBuffers(1, &vb->handle.vbuf.indices); + gdraw_HandleCacheAllocateFail(vb); + eat_gl_err(); + return NULL; + } else + gdraw_HandleCacheAllocateEnd(vb, p->i0 + p->i1, p->p1, + GDRAW_HANDLE_STATE_locked); + + opengl_check(); + return (GDrawVertexBuffer*)vb; +} + +static rrbool RADLINK gdraw_TryToLockVertexBuffer(GDrawVertexBuffer* vb, + void* unique_id, + GDrawStats* stats) { + RR_UNUSED_VARIABLE(stats); + return gdraw_HandleCacheLock((GDrawHandle*)vb, unique_id); +} + +static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer* vb, + void* unique_id, GDrawStats* stats) { + GDrawHandle* h = (GDrawHandle*)vb; + assert(h != NULL); + if (h->owner == unique_id) gdraw_res_free(h, stats); +} + +static void RADLINK gdraw_DescribeVertexBuffer( + GDrawVertexBuffer* vbuf, GDraw_VertexBuffer_Description* desc) { + GDrawHandle* p = (GDrawHandle*)vbuf; + desc->size_in_bytes = p->bytes; +} + +//////////////////////////////////////////////////////////////////////// +// +// Create/free (or cache) render targets +// + +#ifdef __linux__ +typedef struct { + S32 free_count; + S32 live_count; + S32 locked_count; + S32 dead_count; + S32 pinned_count; + S32 user_owned_count; + S32 alloc_count; +} GDrawHandleStateCounts; + +enum { + GDRAW_RT_DIAG_color_memory = 1 << 0, + GDRAW_RT_DIAG_color_handles = 1 << 1, + GDRAW_RT_DIAG_cache_bitmap = 1 << 2, + GDRAW_RT_DIAG_stack_depth = 1 << 3, + GDRAW_RT_DIAG_empty_request = 1 << 4, +}; + +static U32 gdraw_rt_diag_emitted = 0; + +static void gdraw_CountHandleStates(GDrawHandleCache* cache, + GDrawHandleStateCounts* counts) { + S32 i; + counts->free_count = 0; + counts->live_count = 0; + counts->locked_count = 0; + counts->dead_count = 0; + counts->pinned_count = 0; + counts->user_owned_count = 0; + counts->alloc_count = 0; + + if (!cache) return; + + for (i = 0; i < cache->max_handles; ++i) { + switch (cache->handle[i].state) { + case GDRAW_HANDLE_STATE_free: + ++counts->free_count; + break; + case GDRAW_HANDLE_STATE_live: + ++counts->live_count; + break; + case GDRAW_HANDLE_STATE_locked: + ++counts->locked_count; + break; + case GDRAW_HANDLE_STATE_dead: + ++counts->dead_count; + break; + case GDRAW_HANDLE_STATE_pinned: + ++counts->pinned_count; + break; + case GDRAW_HANDLE_STATE_user_owned: + ++counts->user_owned_count; + break; + case GDRAW_HANDLE_STATE_alloc: + ++counts->alloc_count; + break; + default: + break; + } + } +} + +static void gdraw_ReportHandleCacheDiag(char const* label, + GDrawHandleCache* cache, U32 once_bit, + S32 req_w, S32 req_h) { + GDrawHandleStateCounts counts; + + if (gdraw_rt_diag_emitted & once_bit) return; + gdraw_rt_diag_emitted |= once_bit; + + gdraw_CountHandleStates(cache, &counts); + IggyGDrawSendWarning( + NULL, + "GDraw[%s] diag: frame=%dx%d tile=%dx%d padded=%dx%d req=%dx%d " + "depth=%d bytes_free=%d total_bytes=%d handles free=%d live=%d " + "locked=%d dead=%d pinned=%d user=%d alloc=%d", + label, gdraw->frametex_width, gdraw->frametex_height, gdraw->tw, + gdraw->th, gdraw->tpw, gdraw->tph, req_w, req_h, + (int)(gdraw->cur - gdraw->frame), cache ? cache->bytes_free : 0, + cache ? cache->total_bytes : 0, counts.free_count, counts.live_count, + counts.locked_count, counts.dead_count, counts.pinned_count, + counts.user_owned_count, counts.alloc_count); +} +#else +#define gdraw_ReportHandleCacheDiag(label, cache, once_bit, req_w, req_h) \ + ((void)0) +#endif + +static GDrawHandle* get_rendertarget_texture(int width, int height, void* owner, + GDrawStats* gstats) { + S32 size; + GDrawHandle* t; + opengl_check(); + t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); + if (t) { + gdraw_HandleCacheLock(t, (void*)(UINTa)1); + return t; + } + + size = gdraw->frametex_width * gdraw->frametex_height * 4; + t = gdraw_res_alloc_begin(gdraw->texturecache, size, gstats); + if (!t) return t; + + glGenTextures(1, &t->handle.tex.gl); + make_rendertarget(t, t->handle.tex.gl, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, + width, height, 4); + t->handle.tex.w = gdraw->frametex_width; + t->handle.tex.h = gdraw->frametex_height; + t->handle.tex.nonpow2 = + 1; // assume all rendertargets are non-pow2 for consistency + gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; + gstats->alloc_tex += 1; + gstats->alloc_tex_bytes += size; + opengl_check(); + gdraw_HandleCacheAllocateEnd(t, size, owner, GDRAW_HANDLE_STATE_locked); + + return t; +} + +static GDrawHandle* get_color_rendertarget(GDrawStats* gstats) { + S32 size; + GDrawHandle* t; + opengl_check(); + t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); + if (t) { + gdraw_HandleCacheLock(t, (void*)(UINTa)1); + return t; + } + + // ran out of RTs, allocate a new one + size = gdraw->frametex_width * gdraw->frametex_height * 4; + if (gdraw->rendertargets.bytes_free < size) { + gdraw_ReportHandleCacheDiag("rt-color-memory", &gdraw->rendertargets, + GDRAW_RT_DIAG_color_memory, gdraw->tpw, + gdraw->tph); + IggyGDrawSendWarning( + NULL, "GDraw[rt-color] exceeded available rendertarget memory"); + return NULL; + } + + t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); + if (!t) { + gdraw_ReportHandleCacheDiag("rt-color-handles", &gdraw->rendertargets, + GDRAW_RT_DIAG_color_handles, gdraw->tpw, + gdraw->tph); + IggyGDrawSendWarning( + NULL, "GDraw[rt-color] exceeded available rendertarget handles"); + return t; + } + + glGenTextures(1, &t->handle.tex.gl); + make_rendertarget(t, t->handle.tex.gl, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, + gdraw->frametex_width, gdraw->frametex_height, 4); + t->handle.tex.w = gdraw->frametex_width; + t->handle.tex.h = gdraw->frametex_height; + t->handle.tex.nonpow2 = + 1; // assume all rendertargets are non-pow2 for consistency + +#ifdef GDRAW_MULTISAMPLING + if (gdraw->multisampling) { + glGenRenderbuffers(1, &t->handle.tex.gl_renderbuf); + glBindRenderbuffer(GL_RENDERBUFFER, t->handle.tex.gl_renderbuf); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, gdraw->multisampling, + GL_RGBA, gdraw->frametex_width, + gdraw->frametex_height); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + } +#endif + opengl_check(); + + gdraw_HandleCacheAllocateEnd(t, size, (void*)(UINTa)1, + GDRAW_HANDLE_STATE_locked); + gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; + gstats->alloc_tex += gdraw->multisampling ? 2 : 1; + gstats->alloc_tex_bytes += (1 + gdraw->multisampling) * size; + + return t; +} + +static GDrawHandle* get_depthstencil_renderbuffer(GDrawStats* gstats) { + if (!gdraw->stencil_depth.handle.tex.gl) { + gstats->nonzero_flags |= GDRAW_STATS_alloc_tex; + gstats->alloc_tex += 1; + +#ifdef GDRAW_MULTISAMPLING + if (gdraw->multisampling) { + glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); + glBindRenderbuffer(GL_RENDERBUFFER, + gdraw->stencil_depth.handle.tex.gl); + glRenderbufferStorageMultisample( + GL_RENDERBUFFER, gdraw->multisampling, GL_DEPTH24_STENCIL8, + gdraw->frametex_width, gdraw->frametex_height); + + gstats->alloc_tex_bytes += gdraw->multisampling * 4 * + gdraw->frametex_width * + gdraw->frametex_height; + } else { +#endif + if (gdraw->has_packed_depth_stencil) { + glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); + glBindRenderbuffer(GL_RENDERBUFFER, + gdraw->stencil_depth.handle.tex.gl); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, + gdraw->frametex_width, + gdraw->frametex_height); + + gdraw->stencil_depth.handle.tex.gl_renderbuf = + gdraw->stencil_depth.handle.tex.gl; + } else { + // this path is mainly for the iOS simulator + glGenRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); + glBindRenderbuffer(GL_RENDERBUFFER, + gdraw->stencil_depth.handle.tex.gl); + glRenderbufferStorage(GL_RENDERBUFFER, + gdraw->has_depth24 ? GL_DEPTH_COMPONENT24 + : GL_DEPTH_COMPONENT16, + gdraw->frametex_width, + gdraw->frametex_height); + + glGenRenderbuffers( + 1, &gdraw->stencil_depth.handle.tex.gl_renderbuf); + glBindRenderbuffer( + GL_RENDERBUFFER, + gdraw->stencil_depth.handle.tex.gl_renderbuf); + glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, + gdraw->frametex_width, + gdraw->frametex_height); + } + + gstats->alloc_tex_bytes += + 4 * gdraw->frametex_width * gdraw->frametex_height; +#ifdef GDRAW_MULTISAMPLING + } +#endif + + glBindRenderbuffer(GL_RENDERBUFFER, 0); + opengl_check(); + } + return &gdraw->stencil_depth; +} + +static void flush_rendertargets(GDrawStats* stats) { + gdraw_res_flush(&gdraw->rendertargets, stats); + + if (gdraw->stencil_depth.handle.tex.gl_renderbuf && + gdraw->stencil_depth.handle.tex.gl_renderbuf != + gdraw->stencil_depth.handle.tex.gl) { + glDeleteRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl_renderbuf); + gdraw->stencil_depth.handle.tex.gl_renderbuf = 0; + } + + if (gdraw->stencil_depth.handle.tex.gl) { + glDeleteRenderbuffers(1, &gdraw->stencil_depth.handle.tex.gl); + gdraw->stencil_depth.handle.tex.gl = 0; + } + opengl_check(); +} + +//////////////////////////////////////////////////////////////////////// +// +// Begin rendering for a frame +// + +static void lazy_shader(ProgramWithCachedVariableLocations* ptr); + +static RADINLINE void use_lazy_shader(ProgramWithCachedVariableLocations* prg) { + if (!prg->program) + lazy_shader(prg); // already does a glUseProgram! + else + glUseProgram(prg->program); +} + +static void set_viewport(void) { + if (gdraw->in_blur) { + glViewport(0, 0, gdraw->tpw, gdraw->tph); + } else if (gdraw->cur == gdraw->frame) { + glViewport(gdraw->vx, gdraw->vy, gdraw->tw, gdraw->th); + } else if (gdraw->cur->cached) { + glViewport(0, 0, gdraw->cur->width, gdraw->cur->height); + } else { + glViewport(0, 0, gdraw->tpw, gdraw->tph); + // we need to translate from naive pixel space to align a tile + } + opengl_check(); +} + +static void set_projection_raw(S32 x0, S32 x1, S32 y0, S32 y1) { + gdraw->projection[0] = 2.0f / (x1 - x0); + gdraw->projection[1] = 2.0f / (y1 - y0); + gdraw->projection[2] = (x1 + x0) / (F32)(x0 - x1); + gdraw->projection[3] = (y1 + y0) / (F32)(y0 - y1); +} + +static void set_projection(void) { + if (gdraw->in_blur) + set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); + else if (gdraw->cur == gdraw->frame) + set_projection_raw(gdraw->tx0, gdraw->tx0 + gdraw->tw, + gdraw->ty0 + gdraw->th, gdraw->ty0); + else if (gdraw->cur->cached) + set_projection_raw( + gdraw->cur->base_x, gdraw->cur->base_x + gdraw->cur->width, + gdraw->cur->base_y, gdraw->cur->base_y + gdraw->cur->height); + else + set_projection_raw(gdraw->tx0p, gdraw->tx0p + gdraw->tpw, + gdraw->ty0p + gdraw->tph, gdraw->ty0p); +} + +static void clear_renderstate(void) { + clear_renderstate_platform_specific(); + + // deactivate aa_tex + glActiveTexture(GL_TEXTURE0 + AATEX_SAMPLER); + glBindTexture(GL_TEXTURE_2D, 0); + + glColorMask(1, 1, 1, 1); + glDepthMask(GL_TRUE); + + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + glDisable(GL_SCISSOR_TEST); + glActiveTexture(GL_TEXTURE0); + + glUseProgram(0); + opengl_check(); +} + +static void set_common_renderstate(void) { + clear_renderstate(); + + // activate aa_tex + glActiveTexture(GL_TEXTURE0 + AATEX_SAMPLER); + glBindTexture(GL_TEXTURE_2D, gdraw->aa_tex); + glActiveTexture(GL_TEXTURE0); +} + +void gdraw_GLx_(SetTileOrigin)(S32 x, S32 y, U32 framebuffer) { + gdraw->vx = x; + gdraw->vy = y; + gdraw->main_framebuffer = framebuffer; +} + +static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, + F32 scaley) { + memset(gdraw->frame, 0, sizeof(gdraw->frame)); + gdraw->cur = gdraw->frame; + gdraw->fw = w; + gdraw->fh = h; + gdraw->world_to_pixel[0] = scalex; + gdraw->world_to_pixel[1] = scaley; +} + +static void RADLINK gdraw_Set3DTransform(F32* mat) { + if (mat == NULL) + gdraw->use_3d = 0; + else { + gdraw->use_3d = 1; + memcpy(gdraw->xform_3d, mat, sizeof(gdraw->xform_3d)); + } +} + +// must include anything necessary for texture creation/update +static void RADLINK gdraw_RenderingBegin(void) {} +static void RADLINK gdraw_RenderingEnd(void) {} + +static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, + S32 pad, GDrawStats* gstats) { + opengl_check(); + + if (x0 == 0 && y0 == 0 && x1 == gdraw->fw && y1 == gdraw->fh) { + pad = 0; + gdraw->tile_enabled = false; + } else { + gdraw->tile_enabled = true; + } + + gdraw->tx0 = x0; + gdraw->ty0 = y0; + gdraw->tw = x1 - x0; + gdraw->th = y1 - y0; + gdraw->tpw = gdraw->tw + pad * 2; + gdraw->tph = gdraw->th + pad * 2; + // origin of padded region + gdraw->tx0p = x0 - pad; + gdraw->ty0p = y0 - pad; + + if (gdraw->tpw > gdraw->frametex_width || + gdraw->tph > gdraw->frametex_height) { + gdraw->frametex_width = RR_MAX(gdraw->tpw, gdraw->frametex_width); + gdraw->frametex_height = RR_MAX(gdraw->tph, gdraw->frametex_height); + + flush_rendertargets(gstats); + } + + set_viewport(); + set_projection(); + set_common_renderstate(); + + glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); + opengl_check(); +} + +static void RADLINK gdraw_RenderTileEnd(GDrawStats* stats) { + clear_renderstate(); +} + +#define MAX_DEPTH_VALUE (1 << 13) + +static void RADLINK gdraw_GetInfo(GDrawInfo* d) { + GLint maxtex; + + opengl_check(); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtex); + + d->num_stencil_bits = 8; + d->max_id = MAX_DEPTH_VALUE - 2; + // for floating point depth, just use mantissa, e.g. 16-20 bits + d->max_texture_size = maxtex; + d->buffer_format = GDRAW_BFORMAT_vbib; + d->shared_depth_stencil = 0; + d->always_mipmap = 0; + d->conditional_nonpow2 = gdraw->has_conditional_non_power_of_two; + opengl_check(); +} + +//////////////////////////////////////////////////////////////////////// +// +// Enable/disable rendertargets in stack fashion +// + +static void clear_with_rect(gswf_recti* region, rrbool clear_depth, + GDrawStats* stats); + +static void set_render_target_state(void) { + GLint h; +#ifdef GDRAW_MULTISAMPLING + if (gdraw->multisampling) { + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &h); + h = gdraw->cur->color_buffer + ? gdraw->cur->color_buffer->handle.tex.gl_renderbuf + : 0; + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, h); + h = gdraw->cur->stencil_depth ? gdraw->cur->stencil_depth->handle.tex.gl + : 0; + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, h); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, h); + } else { +#endif + h = gdraw->cur->color_buffer ? gdraw->cur->color_buffer->handle.tex.gl + : 0; + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, h, 0); + if (gdraw->cur->stencil_depth) { + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, + gdraw->cur->stencil_depth->handle.tex.gl); + glFramebufferRenderbuffer( + GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, + gdraw->cur->stencil_depth->handle.tex.gl_renderbuf); + } else { + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, 0); + } +#ifdef GDRAW_MULTISAMPLING + } +#endif + opengl_check(); +} + +static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti* region, + gdraw_texture_format format, + U32 flags, void* owner, + GDrawStats* gstats) { + GDrawFramebufferState* n = gdraw->cur + 1; + GDrawHandle* t; + int k; + if (gdraw->tw == 0 || gdraw->th == 0) { + gdraw_ReportHandleCacheDiag( + "rt-empty", &gdraw->rendertargets, GDRAW_RT_DIAG_empty_request, + region->x1 - region->x0, region->y1 - region->y0); + IggyGDrawSendWarning( + NULL, "GDraw[rt-stack] got a request for an empty rendertarget"); + return false; + } + + if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { + gdraw_ReportHandleCacheDiag( + "rt-stack-depth", &gdraw->rendertargets, GDRAW_RT_DIAG_stack_depth, + region->x1 - region->x0, region->y1 - region->y0); + IggyGDrawSendWarning(NULL, + "GDraw[rt-stack] rendertarget nesting exceeded " + "MAX_RENDER_STACK_DEPTH"); + return false; + } + + if (owner) { + t = get_rendertarget_texture(region->x1 - region->x0, + region->y1 - region->y0, owner, gstats); + if (!t) { + gdraw_ReportHandleCacheDiag("rt-cacheAsBitmap", gdraw->texturecache, + GDRAW_RT_DIAG_cache_bitmap, + region->x1 - region->x0, + region->y1 - region->y0); + IggyGDrawSendWarning( + NULL, "GDraw[rt-cacheAsBitmap] ran out of rendertargets"); + return false; + } + } else { + t = get_color_rendertarget(gstats); + if (!t) { + IggyGDrawSendWarning(NULL, + "GDraw[rt-color] ran out of rendertargets"); + return false; + } + } + n->color_buffer = t; + assert(n->color_buffer != NULL); + + if (n == gdraw->frame + 1) + n->stencil_depth = get_depthstencil_renderbuffer(gstats); + else + n->stencil_depth = (n - 1)->stencil_depth; + ++gdraw->cur; + + gdraw->cur->cached = owner != NULL; + if (owner) { + gdraw->cur->base_x = region->x0; + gdraw->cur->base_y = region->y0; + gdraw->cur->width = region->x1 - region->x0; + gdraw->cur->height = region->y1 - region->y0; + } + + gstats->nonzero_flags |= GDRAW_STATS_rendtarg; + + glBindFramebuffer(GL_FRAMEBUFFER, gdraw->framebuffer_stack_object); + set_render_target_state(); + + assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); + + // viewport for clear (make sure scissor is inside viewport just in case) + glViewport(0, 0, gdraw->frametex_width, gdraw->frametex_height); + + k = (int)(n->color_buffer - gdraw->rendertargets.handle); + if (region) { + S32 ox, oy; + + // in a perfect world, we'd only need 1 pixel of border on all sides for + // bilinear filtering, which would mean pad = 1. however, texture + // interpolator precision is not that high even on PC parts, and if we + // only use 1 pixel of padding we will often get some un-filled pixels + // "creeping in" from the sides. pad = 2 is fine on recent PC parts, but + // not old PC parts or even fairly new mobile parts, so we play it safe + // and use 3 pixels which so far gives good results everywhere. + S32 pad = 3; + + // region.x0,y0 are the top left of the rectangle in display space + // x,y are the *bottom* left of the rectangle in window space + S32 h = gdraw->tph; + S32 xt0, yt0, xt1, yt1; + S32 x0, y0, x1, y1; + + if (gdraw->in_blur || !gdraw->tile_enabled) + ox = oy = 0; + else + ox = gdraw->tx0, oy = gdraw->ty0; + + // clamp region to tile (in gdraw coords) + xt0 = RR_MAX(region->x0 - ox, 0); + yt0 = RR_MAX(region->y0 - oy, 0); + xt1 = RR_MIN(region->x1 - ox, gdraw->tpw); + yt1 = RR_MIN(region->y1 - oy, gdraw->tph); + + // but the padding gets clamped to framebuffer coords! also transfer to + // window space here. + x0 = RR_MAX(xt0 - pad, 0); + y0 = RR_MAX(h - yt1 - pad, 0); + x1 = RR_MIN(xt1 + pad, gdraw->frametex_width); + y1 = RR_MIN(h - yt0 + pad, gdraw->frametex_height); + + if (x1 <= x0 || + y1 <= y0) { // region doesn't intersect with current tile + --gdraw->cur; + + // remove color and stencil buffers + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_TEXTURE_2D, 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, 0, 0); + + // switch render target back + if (gdraw->cur == gdraw->frame) + glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); + else + set_render_target_state(); + + set_viewport(); + set_projection(); + opengl_check(); + + // free our render target + gdraw_FreeTexture((GDrawTexture*)n->color_buffer, 0, gstats); + + // note: don't send a warning since this will happen during regular + // tiled rendering + return false; + } + + glEnable(GL_SCISSOR_TEST); + glScissor(x0, y0, x1 - x0, y1 - y0); + gdraw->rt_valid[k].x0 = xt0; + gdraw->rt_valid[k].y0 = yt0; + gdraw->rt_valid[k].x1 = xt1; + gdraw->rt_valid[k].y1 = yt1; + gstats->cleared_pixels += (x1 - x0) * (y1 - y0); + } else { + glDisable(GL_SCISSOR_TEST); + gdraw->rt_valid[k].x0 = 0; + gdraw->rt_valid[k].y0 = 0; + gdraw->rt_valid[k].x1 = gdraw->frametex_width; + gdraw->rt_valid[k].y1 = gdraw->frametex_height; + gstats->cleared_pixels += + gdraw->frametex_width * gdraw->frametex_height; + } + + gstats->nonzero_flags |= GDRAW_STATS_clears; + gstats->num_clears += 1; + +#ifdef GDRAW_FEWER_CLEARS + if (region) { + clear_with_rect(region, n == gdraw->frame + 1, gstats); + } else +#endif // GDRAW_FEWER_CLEARS + { + glClearColor(0, 0, 0, 0); // must clear destination alpha + glClearStencil(0); + glClearDepth(1); + glStencilMask(255); + glDepthMask(GL_TRUE); + glColorMask(1, 1, 1, 1); + glDisable(GL_STENCIL_TEST); + if (n == gdraw->frame + 1) + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT); + else + glClear(GL_COLOR_BUFFER_BIT); + } + + set_viewport(); + set_projection(); + + opengl_check(); + + return true; +} + +static GDrawTexture* RADLINK gdraw_TextureDrawBufferEnd(GDrawStats* gstats) { + GDrawFramebufferState* n = gdraw->cur; + GDrawFramebufferState* m = --gdraw->cur; + if (gdraw->fw == 0 || gdraw->fh == 0) return 0; + + if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) + return 0; // already returned a warning in Start...() + + assert(m >= gdraw->frame); // bug in Iggy -- unbalanced + + if (m != gdraw->frame) assert(m->color_buffer != NULL); + assert(n->color_buffer != NULL); + + // remove color and stencil buffers + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, 0); + +#ifdef GDRAW_MULTISAMPLING + if (gdraw->multisampling) { + // blit from multisample to texture + if (n->color_buffer->handle.tex.gl_renderbuf) { + GLuint res; + glBindFramebuffer(GL_READ_FRAMEBUFFER, + gdraw->framebuffer_copy_to_texture); + glFramebufferRenderbuffer( + GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer( + GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + n->color_buffer->handle.tex.gl_renderbuf); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, + n->color_buffer->handle.tex.gl, 0); + res = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + glBlitFramebuffer(0, 0, gdraw->tpw, gdraw->tph, 0, 0, gdraw->tpw, + gdraw->tph, GL_COLOR_BUFFER_BIT, GL_NEAREST); + gstats->nonzero_flags |= GDRAW_STATS_blits; + gstats->num_blits += 1; + gstats->num_blit_pixels += (gdraw->tpw * gdraw->tph); + + glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, 0); + glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, 0); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + } + } +#endif + + gstats->nonzero_flags |= GDRAW_STATS_rendtarg; + gstats->rendertarget_changes += 1; + + // set the new state + if (m == gdraw->frame) // back to initial framebuffer + glBindFramebuffer(GL_FRAMEBUFFER, gdraw->main_framebuffer); + else + set_render_target_state(); + + // reset the viewport if we've reached the root scope + set_viewport(); + set_projection(); + + opengl_check(); + + return (GDrawTexture*)n->color_buffer; +} + +//////////////////////////////////////////////////////////////////////// +// +// Clear stencil/depth buffers +// +// Open question whether we'd be better off finding bounding boxes +// and only clearing those; it depends exactly how fast clearing works. +// + +static void RADLINK gdraw_ClearStencilBits(U32 bits) { + glDisable(GL_SCISSOR_TEST); + glStencilMask(bits); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); + opengl_check(); +} + +// this only happens rarely (hopefully never) if we use the depth buffer, +// so we can just clear the whole thing +static void RADLINK gdraw_ClearID(void) { + glDisable(GL_SCISSOR_TEST); + glClearDepth(1); + glDepthMask(GL_TRUE); + glClear(GL_DEPTH_BUFFER_BIT); + opengl_check(); +} + +//////////////////////////////////////////////////////////////////////// +// +// Set all the render state from GDrawRenderState +// +// This also is responsible for getting the framebuffer into a texture +// if the read-modify-write blend operation can't be expressed with +// the native blend operators. (E.g. "screen") +// + +enum { + VVAR_world0 = 0, + VVAR_world1 = 1, + VVAR_xoff = 2, + VVAR_texgen_s = 3, + VVAR_texgen_t = 4, + VVAR_viewproj = 5, + VVAR_x3d = 5, + VVAR_y3d = 6, + VVAR_z3d = 7, +}; + +// convert an ID request to a value suitable for the depth buffer, +// in homogeneous clip space with w=1 (depth from -1..1) +static float depth_from_id(S32 id) { + return 1.0f - 2.0f * (id + 1) / (F32)MAX_DEPTH_VALUE; +} + +static void set_texture(U32 texunit, GDrawTexture* tex) { + glActiveTexture(GL_TEXTURE0 + texunit); + if (tex == NULL) + glBindTexture(GL_TEXTURE_2D, 0); + else + glBindTexture(GL_TEXTURE_2D, ((GDrawHandle*)tex)->handle.tex.gl); +} + +static void set_world_projection(const int* vvars, const F32 world[2 * 4]) { + assert(vvars[VVAR_world0] >= 0 && vvars[VVAR_world1] >= 0 && + vvars[VVAR_viewproj] >= 0); + glUniform4fv(vvars[VVAR_world0], 1, world + 0); + glUniform4fv(vvars[VVAR_world1], 1, world + 4); + glUniform4fv(vvars[VVAR_viewproj], 1, gdraw->projection); +} + +static void set_3d_projection(const int* vvars, const F32 world[2 * 4], + const F32 xform[3][4]) { + assert(vvars[VVAR_world0] >= 0 && vvars[VVAR_world1] >= 0); + glUniform4fv(vvars[VVAR_world0], 1, world + 0); + glUniform4fv(vvars[VVAR_world1], 1, world + 4); + + assert(vvars[VVAR_x3d] >= 0 && vvars[VVAR_y3d] >= 0 && + vvars[VVAR_z3d] >= 0); + glUniform4fv(vvars[VVAR_x3d], 1, xform[0]); + glUniform4fv(vvars[VVAR_y3d], 1, xform[1]); + glUniform4fv(vvars[VVAR_z3d], 1, xform[2]); +} + +static int set_render_state(GDrawRenderState* r, S32 vformat, + const int** ovvars, GDrawPrimitive* p, + GDrawStats* gstats) { + static struct gdraw_gl_blendspec { + GLboolean enable; + GLenum src; + GLenum dst; + } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { + {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_none + {GL_TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA}, // GDRAW_BLEND_alpha + {GL_TRUE, GL_DST_COLOR, + GL_ONE_MINUS_SRC_ALPHA}, // GDRAW_BLEND_multiply + {GL_TRUE, GL_ONE, GL_ONE}, // GDRAW_BLEND_add + + {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_filter + {GL_FALSE, GL_ONE, GL_ZERO}, // GDRAW_BLEND_special + }; + + F32 world[2 * 4]; + ProgramWithCachedVariableLocations* prg; + int *fvars, *vvars; + int blend_mode; + + opengl_check(); + assert((vformat >= 0 && vformat < GDRAW_vformat__basic_count) || + vformat == GDRAW_vformat_ihud1); + + if (vformat == GDRAW_vformat_ihud1) { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, + GL_ONE_MINUS_SRC_ALPHA); // premultiplied alpha blend mode + prg = &gdraw->ihud[0]; + } else { + // apply the major blend mode + blend_mode = r->blend_mode; + assert(blend_mode >= 0 && + blend_mode < sizeof(blends) / sizeof(*blends)); + if (blends[blend_mode].enable) { + glEnable(GL_BLEND); + glBlendFunc(blends[blend_mode].src, blends[blend_mode].dst); + } else + glDisable(GL_BLEND); + + // set the fragment program if it wasn't set above + if (r->blend_mode != GDRAW_BLEND_special) { + // make sure data has been initialized + int which = r->tex0_mode, additive = 0; + + if (r->cxf_add) { + additive = 1; + if (r->cxf_add[3]) additive = 2; + } + + prg = &gdraw->fprog[which][additive][vformat]; + } else + prg = &gdraw->exceptional_blend[r->special_blend]; + } + + use_lazy_shader(prg); + OPENGL_CHECK_SITE("set_render_state:use_lazy_shader"); + fvars = prg->vars[0]; + vvars = prg->vars[1]; + + if (vformat == GDRAW_vformat_ihud1) { + F32 wv[2][4] = {1.0f / 960, 0, 0, -1.0, 0, -1.0f / 540, 0, +1.0}; + glUniform4fv(vvars[VAR_ihudv_worldview], 2, wv[0]); + OPENGL_CHECK_SITE("set_render_state:ihud_worldview"); + glUniform4fv(vvars[VAR_ihudv_material], p->uniform_count, p->uniforms); + OPENGL_CHECK_SITE("set_render_state:ihud_material"); + glUniform1f(vvars[VAR_ihudv_textmode], p->drawprim_mode ? 0.0f : 1.0f); + OPENGL_CHECK_SITE("set_render_state:ihud_textmode"); + } else { + // set vertex shader constants + if (!r->use_world_space) + gdraw_ObjectSpace(world, r->o2w, depth_from_id(r->id), 0.0f); + else + gdraw_WorldSpace(world, gdraw->world_to_pixel, depth_from_id(r->id), + 0.0f); + +#ifdef FLASH_10 + set_3d_projection(vvars, world, gdraw->xform_3d); +#else + set_world_projection(vvars, world); +#endif + + if (vvars[VVAR_xoff] >= 0) + glUniform4fv(vvars[VVAR_xoff], 1, r->edge_matrix); + + if (r->texgen0_enabled) { + assert(vvars[VVAR_texgen_s] >= 0 && vvars[VVAR_texgen_t] >= 0); + glUniform4fv(vvars[VVAR_texgen_s], 1, r->s0_texgen); + glUniform4fv(vvars[VVAR_texgen_t], 1, r->t0_texgen); + } + } + + // texture stuff + set_texture(0, r->tex[0]); + OPENGL_CHECK_SITE("set_render_state:set_texture0"); + + if (r->tex[0] && gdraw->has_conditional_non_power_of_two && + ((GDrawHandle*)r->tex[0])->handle.tex.nonpow2) { + // only wrap mode allowed in conditional nonpow2 is clamp; this should + // have been set when the texture was created, but to be on the safe + // side... + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } else + switch (r->wrap0) { + case GDRAW_WRAP_repeat: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + break; + case GDRAW_WRAP_clamp: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + GL_CLAMP_TO_EDGE); + break; + case GDRAW_WRAP_mirror: + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + GL_MIRRORED_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + GL_MIRRORED_REPEAT); + break; + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + r->nearest0 ? GL_NEAREST : GL_LINEAR); + + // fragment shader constants + + if (fvars[VAR_cmul] >= 0) + glUniform4f(fvars[VAR_cmul], r->color[0], r->color[1], r->color[2], + r->color[3]); + if (fvars[VAR_cadd] >= 0) { + if (r->cxf_add) + glUniform4f(fvars[VAR_cadd], r->cxf_add[0] / 255.0f, + r->cxf_add[1] / 255.0f, r->cxf_add[2] / 255.0f, + r->cxf_add[3] / 255.0f); + else + glUniform4f(fvars[VAR_cadd], 0, 0, 0, 0); + } + if (fvars[VAR_focal] >= 0) + glUniform4fv(fvars[VAR_focal], 1, r->focal_point); + + glActiveTexture(GL_TEXTURE0); + + // Set pixel operation states + + if (r->scissor) { + S32 x0, y0, x1, y1; + // scissor.x0,y0 are the top left of the rectangle in display space + // x,y are the *bottom* left of the rectangle in window space + x0 = r->scissor_rect.x0; + y0 = r->scissor_rect.y1; + x1 = r->scissor_rect.x1; + y1 = r->scissor_rect.y0; + // convert into tile-relative coordinates + if (gdraw->tile_enabled) { + x0 -= gdraw->tx0; + y0 -= gdraw->ty0; + x1 -= gdraw->tx0; + y1 -= gdraw->ty0; + } + // convert bottom-most edge to bottom-relative + y0 = (gdraw->th) - y0; + y1 = (gdraw->th) - y1; + if (gdraw->cur == gdraw->frame) { + // move into viewport space + x0 += gdraw->vx; + y0 += gdraw->vy; + x1 += gdraw->vx; + y1 += gdraw->vy; + } + glScissor(x0, y0, x1 - x0, y1 - y0); + glEnable(GL_SCISSOR_TEST); + } else + glDisable(GL_SCISSOR_TEST); + + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + glStencilMask(r->stencil_set); + glStencilFunc(GL_EQUAL, 255, r->stencil_test); + if (r->stencil_set | r->stencil_test) + glEnable(GL_STENCIL_TEST); + else + glDisable(GL_STENCIL_TEST); + + if (r->stencil_set) + glColorMask(0, 0, 0, 0); + else + glColorMask(1, 1, 1, 1); + + if (r->test_id) { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + } else { + glDisable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + } + + if (r->set_id) + glDepthMask(GL_TRUE); + else + glDepthMask(GL_FALSE); + + OPENGL_CHECK_SITE("set_render_state:final"); + if (ovvars) *ovvars = vvars; + + return 1; +} + +//////////////////////////////////////////////////////////////////////// +// +// Vertex formats +// + +static void set_vertex_format(S32 format, F32* vertices) { + const void* vertex_offset_0 = (const void*)(size_t)vertices; + const void* vertex_offset_8 = + (const void*)((size_t)vertices + (2 * sizeof(F32))); + const void* vertex_offset_16 = + (const void*)((size_t)vertices + (4 * sizeof(F32))); + + switch (format) { + case GDRAW_vformat_v2: + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertex_offset_0); + glEnableVertexAttribArray(0); + break; + + case GDRAW_vformat_v2aa: + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 16, + vertex_offset_0); + glVertexAttribPointer(1, 4, GL_SHORT, GL_FALSE, 16, + vertex_offset_8); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + break; + + case GDRAW_vformat_v2tc2: + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 16, + vertex_offset_0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 16, + vertex_offset_8); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + break; + + case GDRAW_vformat_ihud1: + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 20, + vertex_offset_0); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 20, + vertex_offset_8); + glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, 20, + vertex_offset_16); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + glEnableVertexAttribArray(2); + break; + + default: + assert(0); + } +} + +static void reset_vertex_format(S32 format) { + // we don't use attrib #1 for all formats, but doesn't seem worthwhile to + // check + format = format; + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + glDisableVertexAttribArray(2); +} + +//////////////////////////////////////////////////////////////////////// +// +// Draw triangles with a given renderstate +// + +static void tag_resources(void* r1, void* r2, void* r3) { + U64 now = gdraw->frame_counter; + if (r1) ((GDrawHandle*)r1)->fence.value = now; + if (r2) ((GDrawHandle*)r2)->fence.value = now; + if (r3) ((GDrawHandle*)r3)->fence.value = now; +} + +static int vformat_stride[] = {2, 4, 4, 5}; + +static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState* r, + GDrawPrimitive* p, + GDrawVertexBuffer* buf, + GDrawStats* gstats) { + GDrawHandle* vb = (GDrawHandle*)buf; + if (vb) { + glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); + } else { + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + } + + if (!set_render_state(r, p->vertex_format, NULL, p, gstats)) return; + gstats->nonzero_flags |= GDRAW_STATS_batches; + gstats->num_batches += 1; + gstats->drawn_indices += p->num_indices; + gstats->drawn_vertices += p->num_vertices; + + if (vb || p->indices) { // regular path + set_vertex_format(p->vertex_format, p->vertices); + glDrawElements(GL_TRIANGLES, p->num_indices, GL_UNSIGNED_SHORT, + p->indices); + } else { // dynamic quads + S32 pos = 0; + U32 stride = + vformat_stride[p->vertex_format]; // in units of sizeof(F32) + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gdraw->quad_ib); + assert(p->num_vertices % 4 == 0); + + while (pos < p->num_vertices) { + S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); + set_vertex_format(p->vertex_format, p->vertices + pos * stride); + glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, + GL_UNSIGNED_SHORT, NULL); + pos += vert_count; + } + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + } + reset_vertex_format(p->vertex_format); + + if (vb) { + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + } + + OPENGL_CHECK_SITE("gdraw_DrawIndexedTriangles:final"); + tag_resources(vb, r->tex[0], r->tex[1]); +} + +/////////////////////////////////////////////////////////////////////// +// +// Flash 8 filter effects +// + +// caller sets up texture coordinates +static void do_screen_quad(gswf_recti* s, F32* tc, const int* vvars, + GDrawStats* gstats, F32 depth) { + F32 px0 = (F32)s->x0, py0 = (F32)s->y0, px1 = (F32)s->x1, py1 = (F32)s->y1; + F32 s0 = tc[0], t0 = tc[1], s1 = tc[2], t1 = tc[3]; + F32 vert[4][4]; + F32 world[2 * 4]; + + OPENGL_CHECK_SITE("do_screen_quad:begin"); + + vert[0][0] = px0; + vert[0][1] = py0; + vert[0][2] = s0; + vert[0][3] = t0; + vert[1][0] = px1; + vert[1][1] = py0; + vert[1][2] = s1; + vert[1][3] = t0; + vert[2][0] = px1; + vert[2][1] = py1; + vert[2][2] = s1; + vert[2][3] = t1; + vert[3][0] = px0; + vert[3][1] = py1; + vert[3][2] = s0; + vert[3][3] = t1; + + OPENGL_CHECK_SITE("do_screen_quad:after_vertices"); + gdraw_PixelSpace(world); + world[2] = depth; + set_world_projection(vvars, world); + OPENGL_CHECK_SITE("do_screen_quad:after_projection"); + + set_vertex_format(GDRAW_vformat_v2tc2, vert[0]); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + OPENGL_CHECK_SITE("do_screen_quad:before_draw"); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + reset_vertex_format(GDRAW_vformat_v2tc2); + OPENGL_CHECK_SITE("do_screen_quad:after_draw"); + + gstats->nonzero_flags |= GDRAW_STATS_batches; + gstats->num_batches += 1; + gstats->drawn_vertices += 4; + gstats->drawn_indices += 6; + + OPENGL_CHECK_SITE("do_screen_quad:final"); +} + +#ifdef GDRAW_FEWER_CLEARS +static void clear_with_rect(gswf_recti* region, rrbool clear_depth, + GDrawStats* gstats) { + F32 tc[4] = {0, 0, 0, 0}; + + use_lazy_shader(&gdraw->manual_clear); + glUniform4f(gdraw->manual_clear.vars[0][0], 0.0, 0, 0, 0); + + glDisable(GL_BLEND); + + if (clear_depth) { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_ALWAYS); + glDepthMask(GL_TRUE); + + glEnable(GL_STENCIL_TEST); + glStencilMask(255); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + glStencilFunc(GL_ALWAYS, 0, 255); + } else { + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + } + + glColorMask(1, 1, 1, 1); + glColor4f(0, 0, 0, 0); + + { + // coordinate system doesn't match, so just draw whole screen, rely on + // scissor to clip it properly + gswf_recti foo = {-10000, -10000, 10000, 10000}; + do_screen_quad(&foo, tc, gdraw->manual_clear.vars[1], gstats, 1.0f); + } +} +#endif + +static void gdraw_DriverBlurPass(GDrawRenderState* r, int taps, F32* data, + gswf_recti* s, F32* tc, F32 height_max, + F32* clamp, GDrawStats* gstats) { + ProgramWithCachedVariableLocations* prg = &gdraw->blur_prog[taps]; + F32 clampv[4]; + + // fix OpenGL t values for rendertargets are from bottom, not top + tc[1] = height_max - tc[1]; + tc[3] = height_max - tc[3]; + + clampv[0] = clamp[0]; + clampv[1] = height_max - clamp[3]; + clampv[2] = clamp[2]; + clampv[3] = height_max - clamp[1]; + + use_lazy_shader(prg); + set_texture(0, r->tex[0]); + + glColorMask(1, 1, 1, 1); + glDisable(GL_BLEND); + glDisable(GL_SCISSOR_TEST); + + assert(prg->vars[0][VAR_blur_tap] >= 0); + glUniform4fv(prg->vars[0][VAR_blur_tap], taps, data); + glUniform4fv(prg->vars[0][VAR_blur_clampv], 1, clampv); + + do_screen_quad(s, tc, prg->vars[1], gstats, 0); + tag_resources(r->tex[0], 0, 0); +} + +static void gdraw_Colormatrix(GDrawRenderState* r, gswf_recti* s, float* tc, + GDrawStats* gstats) { + ProgramWithCachedVariableLocations* prg = &gdraw->colormatrix; + if (!gdraw_TextureDrawBufferBegin( + s, GDRAW_TEXTURE_FORMAT_rgba32, + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, + NULL, gstats)) + return; + use_lazy_shader(prg); + set_texture(0, r->tex[0]); + glUniform4fv(prg->vars[0][VAR_colormatrix_data], 5, r->shader_data); + do_screen_quad(s, tc, gdraw->colormatrix.vars[1], gstats, 0); + tag_resources(r->tex[0], 0, 0); + r->tex[0] = gdraw_TextureDrawBufferEnd(gstats); +} + +static gswf_recti* get_valid_rect(GDrawTexture* tex) { + GDrawHandle* h = (GDrawHandle*)tex; + S32 n = (S32)(h - gdraw->rendertargets.handle); + assert(n >= 0 && n <= MAX_RENDER_STACK_DEPTH + 1); + return &gdraw->rt_valid[n]; +} + +static void set_clamp_constant(GLint constant, GDrawTexture* tex) { + gswf_recti* s = get_valid_rect(tex); + // when we make the valid data, we make sure there is an extra empty pixel + // at the border we also have to convert from GDraw coords to GL coords + // here. + glUniform4f(constant, (s->x0 - 0.5f) / gdraw->frametex_width, + (gdraw->tph - s->y1 - 0.5f) / gdraw->frametex_height, + (s->x1 + 0.5f) / gdraw->frametex_width, + (gdraw->tph - s->y0 + 0.5f) / gdraw->frametex_height); +} + +static void gdraw_Filter(GDrawRenderState* r, gswf_recti* s, float* tc, + int isbevel, GDrawStats* gstats) { + ProgramWithCachedVariableLocations* prg = + &gdraw->filter_prog[isbevel][r->filter_mode]; + if (!gdraw_TextureDrawBufferBegin( + s, GDRAW_TEXTURE_FORMAT_rgba32, + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, + NULL, gstats)) + return; + use_lazy_shader(prg); + set_texture(0, r->tex[0]); + set_texture(1, r->tex[1]); + set_texture(2, r->tex[2]); + glUniform4fv(prg->vars[0][VAR_filter_color], 1, &r->shader_data[0]); + glUniform4f(prg->vars[0][VAR_filter_tc_off], + -r->shader_data[4] / (F32)gdraw->frametex_width, + r->shader_data[5] / (F32)gdraw->frametex_height, + r->shader_data[6], 0); + if (prg->vars[0][VAR_filter_color2] >= 0) + glUniform4fv(prg->vars[0][VAR_filter_color2], 1, &r->shader_data[8]); + set_clamp_constant(prg->vars[0][VAR_filter_clamp0], r->tex[0]); + set_clamp_constant(prg->vars[0][VAR_filter_clamp1], r->tex[1]); + do_screen_quad(s, tc, prg->vars[1], gstats, 0); + tag_resources(r->tex[0], 0, 0); + r->tex[0] = gdraw_TextureDrawBufferEnd(gstats); +} + +static void RADLINK gdraw_FilterQuad(GDrawRenderState* r, S32 x0, S32 y0, + S32 x1, S32 y1, GDrawStats* gstats) { + F32 tc[4]; + gswf_recti s; + + // clip to tile boundaries + s.x0 = RR_MAX(x0, gdraw->tx0p); + s.y0 = RR_MAX(y0, gdraw->ty0p); + s.x1 = RR_MIN(x1, gdraw->tx0p + gdraw->tpw); + s.y1 = RR_MIN(y1, gdraw->ty0p + gdraw->tph); + if (s.x1 <= s.x0 || s.y1 <= s.y0) return; + + // if it's a rendertarget, it's inverted from our design because OpenGL is + // bottom-left 0,0 and we have to compensate for scaling + tc[0] = (s.x0 - gdraw->tx0p) / (F32)gdraw->frametex_width; + tc[1] = (gdraw->tph - (s.y0 + gdraw->ty0p)) / (F32)gdraw->frametex_height; + tc[2] = (s.x1 - gdraw->tx0p) / (F32)gdraw->frametex_width; + tc[3] = (gdraw->tph - (s.y1 - gdraw->ty0p)) / (F32)gdraw->frametex_height; + + glUseProgram(0); + set_texture(0, 0); + set_texture(1, 0); + set_texture(2, 0); + + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + glStencilMask(255); + glDisable(GL_STENCIL_TEST); + glColorMask(1, 1, 1, 1); + glDisable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + OPENGL_CHECK_SITE("gdraw_FilterQuad:pre_filter"); + + if (r->blend_mode == GDRAW_BLEND_filter) { + switch (r->filter) { + case GDRAW_FILTER_blur: { + GDrawBlurInfo b; + gswf_recti bounds = *get_valid_rect(r->tex[0]); + gdraw_ShiftRect(&s, &s, -gdraw->tx0p, + -gdraw->ty0p); // blur uses physical + // rendertarget coordinates + + b.BlurPass = gdraw_DriverBlurPass; + b.w = gdraw->tpw; + b.h = gdraw->tph; + b.frametex_width = gdraw->frametex_width; + b.frametex_height = gdraw->frametex_height; + + // blur passes must override the viewport/ortho projection + + gdraw->in_blur = true; // prevent viewport/projection munging + // in start/end texture + set_viewport(); + set_projection(); + gdraw_Blur(&gdraw_funcs, &b, r, &s, &bounds, gstats); + + gdraw->in_blur = false; + + set_viewport(); + set_projection(); + break; + } + + case GDRAW_FILTER_colormatrix: + gdraw_Colormatrix(r, &s, tc, gstats); + break; + + case GDRAW_FILTER_dropshadow: + gdraw_Filter(r, &s, tc, 0, gstats); + break; + + case GDRAW_FILTER_bevel: + gdraw_Filter(r, &s, tc, 1, gstats); + break; + + default: + assert(0); + } + } else { + GDrawTexture* blend_tex = NULL; + const int* vvars; + + // for crazy blend modes, we need to read back from the framebuffer + // and do the blending in the pixel shader. we do this with + // CopyTexSubImage, rather than trying to render-to-texture-all-along, + // because that's a pain. + // @TODO: propogate the rectangle down and only copy what we need, like + // in 360 + + if (r->blend_mode == GDRAW_BLEND_special) { + blend_tex = (GDrawTexture*)get_color_rendertarget(gstats); + glBindTexture(GL_TEXTURE_2D, + ((GDrawHandle*)blend_tex)->handle.tex.gl); + if (gdraw->cur != gdraw->frame) + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, gdraw->tpw, + gdraw->tph); + else + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, gdraw->tx0 - gdraw->tx0p, + gdraw->ty0 - gdraw->ty0p, gdraw->vx, + gdraw->vy, gdraw->tw, gdraw->th); + + set_texture(1, blend_tex); + } + + if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, NULL, gstats)) + return; + do_screen_quad(&s, tc, vvars, gstats, 0); + tag_resources(r->tex[0], r->tex[1], 0); + if (blend_tex) gdraw_FreeTexture(blend_tex, 0, gstats); + } +} + +void gdraw_GLx_(NoMoreGDrawThisFrame)(void) { + clear_renderstate(); + ++gdraw->frame_counter; +} + +void gdraw_GLx_(BeginCustomDraw)(IggyCustomDrawCallbackRegion* region, + F32* matrix) { + clear_renderstate(); + gdraw_GetObjectSpaceMatrix(matrix, region->o2w, gdraw->projection, + depth_from_id(0), 1); +} + +void gdraw_GLx_(EndCustomDraw)(IggyCustomDrawCallbackRegion* region) { + set_common_renderstate(); +} + +/////////////////////////////////////////////////////////////////////// +// +// Vertex and Fragment program initialization +// + +#include GDRAW_SHADERS + +static void make_vars(GDrawGLProgram prog, S32 vars[2][8], char** varn) { + if (prog) { + char** varn2 = (varn == pshader_general2_vars ? vshader_vsglihud_vars + : vshader_vsgl_vars); + S32 k; + for (k = 0; varn[k]; ++k) + if (varn[k][0]) + vars[0][k] = glGetUniformLocation(prog, varn[k]); + else + vars[0][k] = -1; + + for (k = 0; varn2[k]; ++k) + if (varn2[k][0]) + vars[1][k] = glGetUniformLocation(prog, varn2[k]); + else + vars[1][k] = -1; + + if (vars[0][0] >= 0) assert(vars[0][0] != vars[0][1]); + } +} + +static void make_fragment_program(ProgramWithCachedVariableLocations* p, + int num_strings, char** strings, + char** varn) { + S32 i; + GLint res; + GDrawGLProgram shad; + opengl_check(); + for (i = 0; i < MAX_VARS; ++i) { + p->vars[0][i] = -1; + p->vars[1][i] = -1; + } + + shad = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(shad, num_strings, (const GLchar**)strings, NULL); + glCompileShader(shad); + glGetShaderiv(shad, GL_COMPILE_STATUS, &res); + if (!res) { + char errors[512]; + glGetShaderInfoLog(shad, sizeof(errors) - 2, &res, errors); + compilation_err(errors); + p->program = 0; + } else { + S32 vert = GDRAW_vformat_v2tc2; + ProgramWithCachedVariableLocations* basic_fprog_begin = + &gdraw->fprog[0][0][0]; + ProgramWithCachedVariableLocations* basic_fprog_end = + basic_fprog_begin + + (sizeof(gdraw->fprog) / sizeof(gdraw->fprog[0][0][0])); + if (p >= basic_fprog_begin && p < basic_fprog_end) { + // for basic rendering shaders, we have three versions corresponding + // to the three vertex formats we support. + S32 n = (S32)(p - basic_fprog_begin); + vert = n % 3; + } + + if (p == &gdraw->ihud[0]) vert = GDRAW_vformat_ihud1; + + opengl_check(); + p->program = glCreateProgram(); + glAttachShader(p->program, shad); + glAttachShader(p->program, gdraw->vert[vert]); + opengl_check(); + + if (vert == GDRAW_vformat_ihud1) { + glBindAttribLocation(p->program, 0, "position"); + glBindAttribLocation(p->program, 1, "texcoord"); + glBindAttribLocation(p->program, 2, "material_index"); + } else { + glBindAttribLocation(p->program, 0, "position"); + glBindAttribLocation(p->program, 1, "in_attr"); + } + + glLinkProgram(p->program); + glGetProgramiv(p->program, GL_LINK_STATUS, &res); + if (!res) { + char errors[512]; + glGetProgramiv(p->program, GL_INFO_LOG_LENGTH, &res); + glGetProgramInfoLog(p->program, sizeof(errors) - 2, &res, errors); + compilation_err(errors); + glDeleteShader(shad); + glDeleteProgram(p->program); + p->program = 0; + } else + make_vars(p->program, p->vars, varn); + } + opengl_check(); + glUseProgram(p->program); // now activate the program + opengl_check(); +} + +static void make_vertex_program(GLuint* vprog, int num_strings, + char** strings) { + GLint res; + GDrawGLProgram shad; + opengl_check(); + + if (strings[0]) { + shad = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(shad, num_strings, (const GLchar**)strings, NULL); + glCompileShader(shad); + glGetShaderiv(shad, GL_COMPILE_STATUS, &res); + if (!res) { + char errors[512]; + glGetShaderInfoLog(shad, sizeof(errors) - 2, &res, errors); + compilation_err(errors); + glDeleteShader(shad); + shad = 0; + } + opengl_check(); + *vprog = shad; + } else { + *vprog = 0; + } +} + +static void bind_sampler(ProgramWithCachedVariableLocations* prog, int varidx, + int sampleridx) { + int var = prog->vars[0][varidx]; + if (var >= 0) glUniform1i(var, sampleridx); +} + +static void make_vertex_programs(void) { + int type; + for (type = 0; type < GDRAW_vformat__basic_count; type++) + make_vertex_program(&gdraw->vert[type], NUMFRAGMENTS_vshader_vsgl, + vshader_vsgl(type)); + type = GDRAW_vformat_ihud1; + make_vertex_program(&gdraw->vert[type], NUMFRAGMENTS_vshader_vsglihud, + vshader_vsglihud()); +} + +static void lazy_shader(ProgramWithCachedVariableLocations* ptr) { + ProgramWithCachedVariableLocations* basic_fprog_begin = + &gdraw->fprog[0][0][0]; + ProgramWithCachedVariableLocations* basic_fprog_end = + basic_fprog_begin + + (sizeof(gdraw->fprog) / sizeof(gdraw->fprog[0][0][0])); + + if (ptr >= basic_fprog_begin && ptr < basic_fprog_end) { + S32 n = (S32)(ptr - basic_fprog_begin); + n /= 3; + + make_fragment_program(ptr, NUMFRAGMENTS_pshader_basic, + pshader_basic_arr[n], pshader_basic_vars); + bind_sampler(ptr, VAR_tex0, 0); + bind_sampler(ptr, VAR_tex1, AATEX_SAMPLER); + return; + } + + if (ptr >= &gdraw->exceptional_blend[0] && + ptr < &gdraw->exceptional_blend[GDRAW_BLENDSPECIAL__count]) { + S32 n = (S32)(ptr - gdraw->exceptional_blend); + make_fragment_program(ptr, NUMFRAGMENTS_pshader_exceptional_blend, + pshader_exceptional_blend_arr[n], + pshader_exceptional_blend_vars); + bind_sampler(ptr, VAR_tex0, 0); + bind_sampler(ptr, VAR_tex1, 1); + return; + } + + if (ptr >= &gdraw->filter_prog[0][0] && ptr <= &gdraw->filter_prog[1][15]) { + S32 n = (S32)(ptr - gdraw->filter_prog[0]); + make_fragment_program(ptr, NUMFRAGMENTS_pshader_filter, + pshader_filter_arr[n], pshader_filter_vars); + bind_sampler(ptr, VAR_filter_tex0, 0); + bind_sampler(ptr, VAR_filter_tex1, 1); + bind_sampler(ptr, VAR_filter_tex2, 2); + return; + } + + if (ptr >= &gdraw->blur_prog[0] && ptr <= &gdraw->blur_prog[MAX_TAPS]) { + S32 n = (S32)(ptr - gdraw->blur_prog); + make_fragment_program(ptr, NUMFRAGMENTS_pshader_blur, + pshader_blur_arr[n], pshader_blur_vars); + bind_sampler(ptr, VAR_blur_tex0, 0); + return; + } + + if (ptr == &gdraw->colormatrix) { + make_fragment_program(ptr, NUMFRAGMENTS_pshader_color_matrix, + pshader_color_matrix_arr[0], + pshader_color_matrix_vars); + bind_sampler(ptr, VAR_colormatrix_tex0, 0); + return; + } + + if (ptr == &gdraw->manual_clear) { + make_fragment_program(ptr, NUMFRAGMENTS_pshader_manual_clear, + pshader_manual_clear_arr[0], + pshader_manual_clear_vars); + return; + } + + if (ptr == &gdraw->ihud[0]) { + make_fragment_program(ptr, NUMFRAGMENTS_pshader_general2, + pshader_general2_arr[0], pshader_general2_vars); + bind_sampler(ptr, VAR_tex0, 0); + return; + } + + RR_BREAK(); +} + +static rrbool make_quad_indices(void) { + int size = QUAD_IB_COUNT * 6 * sizeof(GLushort); + GLushort* inds = IggyGDrawMalloc(size); + int i, e; + + if (!inds) return 0; + + // make quad inds + for (i = 0; i < QUAD_IB_COUNT; i++) { + inds[i * 6 + 0] = (GLushort)(i * 4 + 0); + inds[i * 6 + 1] = (GLushort)(i * 4 + 1); + inds[i * 6 + 2] = (GLushort)(i * 4 + 2); + inds[i * 6 + 3] = (GLushort)(i * 4 + 0); + inds[i * 6 + 4] = (GLushort)(i * 4 + 2); + inds[i * 6 + 5] = (GLushort)(i * 4 + 3); + } + + glGenBuffers(1, &gdraw->quad_ib); + glBindBuffer(GL_ARRAY_BUFFER, gdraw->quad_ib); + glBufferData(GL_ARRAY_BUFFER, size, inds, GL_STATIC_DRAW); + IggyGDrawFree(inds); + e = glGetError(); + if (e != GL_NO_ERROR) { + eat_gl_err(); + return 0; + } + + return 1; +} + +//////////////////////////////////////////////////////////////////////// +// +// Create and tear-down the state +// + +typedef struct { + S32 num_handles; + S32 num_bytes; +} GDrawResourceLimit; + +// These are the defaults limits used by GDraw unless the user specifies +// something else. +static GDrawResourceLimit gdraw_limits[GDRAW_GLx_(RESOURCE__count)] = { + MAX_RENDER_STACK_DEPTH + 1, + 16 * 1024 * 1024, // GDRAW_GLx_RESOURCE_rendertarget + 500, + 20 * 1024 * 1024, // GDRAW_GLx_RESOURCE_texture + 1000, + 2 * 1024 * 1024, // GDRAW_GLx_RESOURCE_vertexbuffer +}; + +static GDrawHandleCache* make_handle_cache(gdraw_resourcetype type) { + S32 num_handles = gdraw_limits[type].num_handles; + S32 num_bytes = gdraw_limits[type].num_bytes; + GDrawHandleCache* cache = (GDrawHandleCache*)IggyGDrawMalloc( + sizeof(GDrawHandleCache) + (num_handles - 1) * sizeof(GDrawHandle)); + if (cache) { + gdraw_HandleCacheInit(cache, num_handles, num_bytes); + cache->is_vertex = (type == GDRAW_GLx_(RESOURCE_vertexbuffer)); + } + + return cache; +} + +static void free_gdraw() { + if (!gdraw) return; + if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); + if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); + IggyGDrawFree(gdraw); + gdraw = NULL; +} + +int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, + S32 num_bytes) { + GDrawStats stats = {0}; + + if (type == GDRAW_GLx_(RESOURCE_rendertarget)) // RT count is small and + // space is preallocated + num_handles = MAX_RENDER_STACK_DEPTH + 1; + + assert(type >= GDRAW_GLx_(RESOURCE_rendertarget) && + type < GDRAW_GLx_(RESOURCE__count)); + assert(num_handles >= 0); + assert(num_bytes >= 0); + + // nothing to do if the values are unchanged + if (gdraw_limits[type].num_handles == num_handles && + gdraw_limits[type].num_bytes == num_bytes) + return 1; + + gdraw_limits[type].num_handles = num_handles; + gdraw_limits[type].num_bytes = num_bytes; + + // if no gdraw context created, there's nothing to worry about + if (!gdraw) return 1; + + // resize the appropriate pool + switch (type) { + case GDRAW_GLx_(RESOURCE_rendertarget): + flush_rendertargets(&stats); + gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, + num_bytes); + return 1; + + case GDRAW_GLx_(RESOURCE_texture): + if (gdraw->texturecache) { + gdraw_res_flush(gdraw->texturecache, &stats); + IggyGDrawFree(gdraw->texturecache); + } + gdraw->texturecache = + make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); + return gdraw->texturecache != NULL; + + case GDRAW_GLx_(RESOURCE_vertexbuffer): + if (gdraw->vbufcache) { + gdraw_res_flush(gdraw->vbufcache, &stats); + IggyGDrawFree(gdraw->vbufcache); + } + gdraw->vbufcache = + make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); + return gdraw->vbufcache != NULL; + + default: + return 0; + } +} + +GDrawTexture* RADLINK gdraw_GLx_(MakeTextureFromResource)( + U8* resource_file, S32 len, IggyFileTextureRaw* texture) { + int i, offset, mips; + const TextureFormatDesc* fmt; + GDrawTexture* tex; + GLuint gl_texture_handle; + + // look up the texture format + fmt = gdraw->tex_formats; + while (fmt->iggyfmt != texture->format && fmt->blkbytes) fmt++; + if (!fmt->blkbytes) // end of list - i.e. format not supported + return NULL; + + // prepare texture + glGenTextures(1, &gl_texture_handle); + if (gl_texture_handle == 0) return NULL; + + opengl_check(); + make_texture(gl_texture_handle); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + offset = texture->file_offset; + mips = RR_MAX(texture->mipmaps, 1); + + // disable mipmaps if non-pow-2 is unsupported + if (gdraw->has_conditional_non_power_of_two) + if (!is_pow2(texture->w) || !is_pow2(texture->h)) mips = 1; + + // disable mipmaps if chain is incomplete and GL_TEXTURE_MAX_LEVEL is + // unsupported + if (!gdraw->has_texture_max_level && mips > 1) { + int lastmip = mips - 1; + if ((texture->w >> lastmip) > 1 || (texture->h >> lastmip) > 1) + mips = 1; + } + + for (i = 0; i < mips; i++) { + U8* data = resource_file + offset; + int w = RR_MAX(texture->w >> i, 1); + int h = RR_MAX(texture->h >> i, 1); + int j; + + if (texture->format == IFT_FORMAT_rgba_4444_LE) { + for (j = 0; j < w * h; ++j) { + unsigned short x = *(unsigned short*)(data + j * 2); + x = ((x >> 12) & 0xf) | ((x << 4) & 0xfff0); + *(unsigned short*)(data + j * 2) = x; + } + } + if (texture->format == IFT_FORMAT_rgba_5551_LE) { + for (j = 0; j < w * h; ++j) { + unsigned short x = *(unsigned short*)(data + j * 2); + x = (x >> 15) | (x << 1); + *(unsigned short*)(data + j * 2) = x; + } + } + + if (fmt->fmt != 0) { + glTexImage2D(GL_TEXTURE_2D, i, fmt->intfmt, w, h, 0, fmt->fmt, + fmt->type, data); + offset += w * h * fmt->blkbytes; + } else { + int size = ((w + fmt->blkx - 1) / fmt->blkx) * + ((h + fmt->blky - 1) / fmt->blky) * fmt->blkbytes; + glCompressedTexImage2D(GL_TEXTURE_2D, i, fmt->intfmt, w, h, 0, size, + data); + offset += size; + } + + opengl_check(); + } + + if (gdraw->has_texture_max_level) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mips - 1); + + tex = gdraw_GLx_(WrappedTextureCreate)(gl_texture_handle, texture->w, + texture->h, mips > 1); + if (tex == NULL) glDeleteTextures(1, &gl_texture_handle); + opengl_check(); + return tex; +} + +void RADLINK gdraw_GLx_(DestroyTextureFromResource)(GDrawTexture* tex) { + if (tex) gdraw_GLx_(WrappedTextureDestroy)(tex); +} + +static rrbool hasext(const char* exts, const char* which) { + const char* where; + size_t len; + +#ifdef GDRAW_USE_glGetStringi + if (exts == NULL) { + GLint i, num_exts; + glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts); + for (i = 0; i < num_exts; ++i) + if (0 == strcmp(which, (char const*)glGetStringi(GL_EXTENSIONS, i))) + return 1; + return 0; + } +#endif + + where = exts; + len = strlen(which); + + for (;;) { + where = strstr(where, which); + if (where == NULL) return false; + + if ((where == exts || *(where - 1) == ' ') // starts with terminator + && (where[len] == ' ' || where[len] == 0)) // ends with terminator + return true; + where += len; + } +} + +static GDrawFunctions* create_context(S32 w, S32 h) { + gdraw = IggyGDrawMalloc(sizeof(*gdraw)); + if (!gdraw) return NULL; + + memset(gdraw, 0, sizeof(*gdraw)); + + gdraw->texturecache = make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); + gdraw->vbufcache = make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); + gdraw_HandleCacheInit( + &gdraw->rendertargets, + gdraw_limits[GDRAW_GLx_(RESOURCE_rendertarget)].num_handles, + gdraw_limits[GDRAW_GLx_(RESOURCE_rendertarget)].num_bytes); + + if (!gdraw->texturecache || !gdraw->vbufcache || !make_quad_indices()) { + free_gdraw(); + return NULL; + } + + opengl_check(); + + gdraw->frametex_width = w; + gdraw->frametex_height = h; + gdraw->frame->cached = false; + + // if the globals have already been initialized, this has no effect; + // otherwise it initializes them with no global texture storage and the + // default global rendertarget storage + + glGenFramebuffers(1, &gdraw->framebuffer_stack_object); + glGenFramebuffers(1, &gdraw->framebuffer_copy_to_texture); + opengl_check(); + + make_vertex_programs(); + // fragment shaders are created lazily + + gdraw_funcs.SetViewSizeAndWorldScale = gdraw_SetViewSizeAndWorldScale; + gdraw_funcs.RenderingBegin = gdraw_RenderingBegin; + gdraw_funcs.RenderingEnd = gdraw_RenderingEnd; + gdraw_funcs.RenderTileBegin = gdraw_RenderTileBegin; + gdraw_funcs.RenderTileEnd = gdraw_RenderTileEnd; + gdraw_funcs.GetInfo = gdraw_GetInfo; + gdraw_funcs.DescribeTexture = gdraw_DescribeTexture; + gdraw_funcs.DescribeVertexBuffer = gdraw_DescribeVertexBuffer; + + gdraw_funcs.TextureDrawBufferBegin = gdraw_TextureDrawBufferBegin; + gdraw_funcs.TextureDrawBufferEnd = gdraw_TextureDrawBufferEnd; + + gdraw_funcs.DrawIndexedTriangles = gdraw_DrawIndexedTriangles; + gdraw_funcs.FilterQuad = gdraw_FilterQuad; + + gdraw_funcs.SetAntialiasTexture = gdraw_SetAntialiasTexture; + + gdraw_funcs.ClearStencilBits = gdraw_ClearStencilBits; + gdraw_funcs.ClearID = gdraw_ClearID; + + gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; + gdraw_funcs.MakeTextureMore = NULL; + gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; + + gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; + gdraw_funcs.UpdateTextureBegin = gdraw_UpdateTextureBegin; + gdraw_funcs.UpdateTextureEnd = gdraw_UpdateTextureEnd; + gdraw_funcs.FreeTexture = gdraw_FreeTexture; + gdraw_funcs.TryToLockTexture = gdraw_TryToLockTexture; + + gdraw_funcs.MakeVertexBufferBegin = gdraw_MakeVertexBufferBegin; + gdraw_funcs.MakeVertexBufferMore = gdraw_MakeVertexBufferMore; + gdraw_funcs.MakeVertexBufferEnd = gdraw_MakeVertexBufferEnd; + gdraw_funcs.TryToLockVertexBuffer = gdraw_TryToLockVertexBuffer; + gdraw_funcs.FreeVertexBuffer = gdraw_FreeVertexBuffer; + + gdraw_funcs.UnlockHandles = gdraw_UnlockHandles; + gdraw_funcs.SetTextureUniqueID = gdraw_SetTextureUniqueID; + + gdraw_funcs.MakeTextureFromResource = + (gdraw_make_texture_from_resource*)gdraw_GLx_(MakeTextureFromResource); + gdraw_funcs.FreeTextureFromResource = + gdraw_GLx_(DestroyTextureFromResource); + + gdraw_funcs.Set3DTransform = gdraw_Set3DTransform; + + return &gdraw_funcs; +} + +void gdraw_GLx_(DestroyContext)(void) { + if (gdraw) { + GDrawStats stats = {0}; + if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); + if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); + flush_rendertargets(&stats); + + if (gdraw->aa_tex) glDeleteTextures(1, &gdraw->aa_tex); + + if (gdraw->quad_ib) glDeleteBuffers(1, &gdraw->quad_ib); + } + + opengl_check(); + free_gdraw(); +} \ No newline at end of file diff --git a/targets/app/common/Iggy/gdraw/gdraw_shared.inl b/targets/app/common/Iggy/gdraw/gdraw_shared.inl new file mode 100644 index 000000000..fac66a23d --- /dev/null +++ b/targets/app/common/Iggy/gdraw/gdraw_shared.inl @@ -0,0 +1,2693 @@ +// gdraw_shared.inl - author: Sean Barrett - copyright 2010 RAD Game Tools +// +// This file implements some common code that can be shared across +// all the sample implementations of GDraw. + +#if defined(IGGY_DISABLE_GDRAW_ASSERT) +#define assert(x) +#else +#include +#endif + +#include + +#if !defined(GDRAW_MAYBE_UNUSED) +#define GDRAW_MAYBE_UNUSED +#endif + +/////////////////////////////////////////////////////////////// +// +// GDrawHandleCache manages resource "handles" used by Iggy +// (i.e. these handles wrap the platform resource handles, +// and this file provides those wrappers and facilities for +// LRU tracking them). Moreover, for console platforms, we +// actually implement our own managed resource pools. +// +// This is the main state machine when GDRAW_MANAGE_MEM is defined: +// (which covers all console platforms) +// +// +------+ +--------+ | +// | Live |<------->| Locked | | +// +------+ +--------+ | +// / \ ^ | +// / \ \ | +// v v \ | +// +------+ +------+ +------+ | | +// | Dead |--->| Free |<---| User | | | +// +------+ +------+ +------+ | | +// ^ ^ ^ ^ | | +// \ / \ | | | +// \ / v | | | +// +--------+ +-------+ / | +// | Pinned |<--------| Alloc |/ | +// +--------+ +-------+ | +// +// "Free" handles are not in use and available for allocation. +// "Alloc" handles have been assigned by GDraw, but do not yet +// have a system resource backing them. Resources stay in +// this state until we know that for sure that we're going +// to be able to successfully complete creation, at which +// point the resource transitions to one of the regular states. +// "Live" handles correspond to resources that may be used +// for rendering. They are kept in LRU order. Old resources +// may be evicted to make space. +// "Locked" handles cover resources that are going to be used +// in the next draw command. Once a resource is marked locked, +// it may not be evicted until it's back to "Live". +// "Dead" handles describe resources that have been freed on the +// CPU side, but are still in use by the GPU. Their memory may +// only be reclaimed once the GPU is done with them, at which +// point they are moved to the "Free" list. Items on the "Dead" +// list appear ordered by the last time they were used by the +// GPU - "most stale" first. +// "Pinned" resources can be used in any draw call without getting +// locked first. They can never be LRU-freed, but their memory +// is still managed by GDraw. Currently this is only used for +// the Iggy font cache. +// "User" (user-owned) resources are exactly that. They act much like +// pinned resources, but their memory isn't managed by GDraw. +// When a user-owned resource is freed, we really need to free +// it immediately (instead of marking it as "dead"), which might +// necessitate stalling the CPU until the GPU is finished using +// that resource. Since we don't own the memory, delayed frees +// are not an option. +// +// Without GDRAW_MANAGE_MEM, there's no "Dead" resources, and all +// frees are performed immediately. + +typedef struct GDrawHandleCache GDrawHandleCache; +typedef struct GDrawHandle GDrawHandle; + +typedef struct { + U64 value; +} GDrawFence; + +typedef enum { + GDRAW_HANDLE_STATE_free = 0, + GDRAW_HANDLE_STATE_live, + GDRAW_HANDLE_STATE_locked, + GDRAW_HANDLE_STATE_dead, + GDRAW_HANDLE_STATE_pinned, + GDRAW_HANDLE_STATE_user_owned, + GDRAW_HANDLE_STATE_alloc, + GDRAW_HANDLE_STATE__count, + + // not an actual state! + GDRAW_HANDLE_STATE_sentinel = GDRAW_HANDLE_STATE__count, +} GDrawHandleState; + +struct GDrawHandle { + GDrawNativeHandle handle; // platform handle to a resource (variable size) + void* owner; // 4/8 // opaque handle used to allow freeing resources + // without calling back to owner + + GDrawHandleCache* cache; // 4/8 // which cache this handle came from + + GDrawHandle *next, *prev; // 8/16 // doubly-linked list + +#if defined(GDRAW_MANAGE_MEM) + void* raw_ptr; // 4/8 // pointer to allocation - when you're managing + // memory manually +#if defined(GDRAW_CORRUPTION_CHECK) + U32 cached_raw_value[4]; + rrbool has_check_value; +#endif +#endif + + GDrawFence fence; // 8 // (optional) platform fence for resource + // 4 + U32 bytes : 28; // estimated storage cost to allow setting a loose limit + U32 state : 4; // state the handle is in +}; + +// validate alignment to make sure structure will pack correctly +#if defined(__RAD64__) +RR_COMPILER_ASSERT((sizeof(GDrawHandle) & 7) == 0); +#else +RR_COMPILER_ASSERT((sizeof(GDrawHandle) & 3) == 0); +#endif + +struct GDrawHandleCache { + S32 bytes_free; + S32 total_bytes; + S32 max_handles; + U32 is_vertex : 1; // vertex buffers have different warning codes and + // generate discard callbacks + U32 is_thrashing : 1; + U32 did_defragment : 1; + // 30 unused bits + GDrawHandle state[GDRAW_HANDLE_STATE__count]; // sentinel nodes for all of + // the state lists +#if defined(GDRAW_MANAGE_MEM) + struct gfx_allocator* alloc; +#endif +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) + struct gfx_allocator* alloc_other; +#endif + GDrawFence prev_frame_start, + prev_frame_end; // fence value at start/end of previous frame, for + // thrashing detection + GDrawHandle handle[1]; // the rest of the handles must be stored right + // after this in the containing structure +}; + +#if defined(GDRAW_CORRUPTION_CHECK) +// values for corruption checking +#define GDRAW_CORRUPTIONCHECK_renderbegin 0x10 +#define GDRAW_CORRUPTIONCHECK_renderend 0x20 +#define GDRAW_CORRUPTIONCHECK_nomoregdraw 0x30 +#define GDRAW_CORRUPTIONCHECK_maketexbegin 0x40 +#define GDRAW_CORRUPTIONCHECK_maketexend 0x50 + +#define GDRAW_CORRUPTIONCHECK_wrappedcreateend 0x60 +#define GDRAW_CORRUPTIONCHECK_wrappedcreatebegin 0x61 +#define GDRAW_CORRUPTIONCHECK_wrappeddestroyend 0x70 +#define GDRAW_CORRUPTIONCHECK_wrappeddestroybegin 0x71 + +#define GDRAW_CORRUPTIONCHECK_allochandle 0x80 +#define GDRAW_CORRUPTIONCHECK_allochandle_begin 0x81 +#define GDRAW_CORRUPTIONCHECK_allochandle_postreap 0x82 +#define GDRAW_CORRUPTIONCHECK_allochandle_postfree1 0x83 +#define GDRAW_CORRUPTIONCHECK_allochandle_postfree2 0x84 +#define GDRAW_CORRUPTIONCHECK_allochandle_postfree3 0x85 +#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc1 0x86 +#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc2 0x87 +#define GDRAW_CORRUPTIONCHECK_allochandle_postalloc3 0x88 +#define GDRAW_CORRUPTIONCHECK_allochandle_defrag 0x89 + +#define GDRAW_CORRUPTIONCHECK_freetex 0x90 + +static U32* debug_raw_address(GDrawHandle* t, int choice) { + static int offset_table[4] = {0x555555, 0xaaaaaa, 0x333333, 0x6e6e6e}; + U8* base = (U8*)t->raw_ptr; + int offset = offset_table[choice] & (t->bytes - 1) & ~3; + return (U32*)(base + offset); +} + +static void debug_check_overlap_one(GDrawHandle* t, U8* ptr, S32 len) { + assert(len >= 0); + if (t->raw_ptr && t->raw_ptr != ptr) { + assert(t->raw_ptr < ptr || t->raw_ptr >= ptr + len); + } +} + +static void debug_check_overlap(GDrawHandleCache* c, U8* ptr, S32 len) { + GDrawHandle* t = c->head; + while (t) { + debug_check_overlap_one(t, ptr, len); + t = t->next; + } + t = c->active; + while (t) { + debug_check_overlap_one(t, ptr, len); + t = t->next; + } +} + +static void debug_check_raw_values(GDrawHandleCache* c) { + GDrawHandle* t = c->head; + while (t) { + if (t->raw_ptr && t->has_check_value) { + int i; + for (i = 0; i < 4; ++i) { + if (*debug_raw_address(t, i) != t->cached_raw_value[i]) { + // zlog("!Iggy texture corruption found\n"); + // zlog("t=%p, t->raw_ptr=%p\n", t, t->raw_ptr); + // zlog("Cached values: %08x %08x %08x %08x\n", + // t->cached_raw_value[0], t->cached_raw_value[1], + // t->cached_raw_value[2], t->cached_raw_value[3]); + // zlog("Current values: %08x %08x %08x %08x\n", + // *debug_raw_address(t,0), *debug_raw_address(t,1), + // *debug_raw_address(t,2), *debug_raw_address(t,3)); + assert(0); + } + } + } + t = t->next; + } + t = c->active; + while (t) { + if (t->raw_ptr && t->has_check_value) { + int i; + for (i = 0; i < 4; ++i) { + if (*debug_raw_address(t, i) != t->cached_raw_value[i]) { + // zlog("!Iggy texture corruption found\n"); + // zlog("t=%p, t->raw_ptr=%p\n", t, t->raw_ptr); + // zlog("Cached values: %08x %08x %08x %08x\n", + // t->cached_raw_value[0], t->cached_raw_value[1], + // t->cached_raw_value[2], t->cached_raw_value[3]); + // zlog("Current values: %08x %08x %08x %08x\n", + // *debug_raw_address(t,0), *debug_raw_address(t,1), + // *debug_raw_address(t,2), *debug_raw_address(t,3)); + assert(0); + } + } + } + t = t->next; + } +} + +#if !defined(GDRAW_CORRUPTION_MASK) +#define GDRAW_CORRUPTION_MASK 0 +#endif +#define debug_check_raw_values_if(c, v) \ + if ((GDRAW_CORRUPTION_CHECK & ~GDRAW_CORRUPTION_MASK) == \ + ((v) & ~GDRAW_CORRUPTION_MASK)) \ + debug_check_raw_values(c); \ + else + +static void debug_set_raw_value(GDrawHandle* t) { + if (t->raw_ptr) { + int i; + for (i = 0; i < 4; ++i) + t->cached_raw_value[i] = *debug_raw_address(t, i); + t->has_check_value = true; + } +} + +static void debug_unset_raw_value(GDrawHandle* t) { + t->has_check_value = false; +} + +static void debug_check_value_is_unreferenced(GDrawHandleCache* c, void* ptr) { + GDrawHandle* t = c->head; + while (t) { + assert(t->raw_ptr != ptr); + t = t->next; + } + t = c->active; + while (t) { + assert(t->raw_ptr != ptr); + t = t->next; + } +} + +#else + +#define debug_check_overlap(c, p, len) +#define debug_set_raw_value(t) +#define debug_check_value_is_unreferenced(c, p) +#define debug_unset_raw_value(t) +#define debug_check_raw_values(c) +#define debug_check_raw_values_if(c, v) +#endif + +#if defined(SUPERDEBUG) +static void check_lists(GDrawHandleCache* c) { + GDrawHandle *sentinel, *t; + U32 state; + + // for all lists, verify that they are consistent and + // properly linked + for (state = 0; state < GDRAW_HANDLE_STATE__count; state++) { + S32 count = 0; + sentinel = &c->state[state]; + + assert(!sentinel->cache); + assert(sentinel->state == GDRAW_HANDLE_STATE_sentinel); + for (t = sentinel->next; t != sentinel; t = t->next) { + count++; + assert(t->cache == c); + assert(t->state == state); + assert(t->prev->next == t); + assert(t->next->prev == t); + assert(count < 50000); + } + } + + // for dead list, additionally verify that it's in the right + // order (namely, sorted by ascending fence index) + sentinel = &c->state[GDRAW_HANDLE_STATE_dead]; + for (t = sentinel->next; t != sentinel; t = t->next) { + assert(t->prev == sentinel || t->fence.value >= t->prev->fence.value); + } +} + +#include + +static const char* gdraw_StateName(U32 state) { + switch (state) { + case GDRAW_HANDLE_STATE_free: + return "free"; + case GDRAW_HANDLE_STATE_live: + return "live"; + case GDRAW_HANDLE_STATE_locked: + return "locked"; + case GDRAW_HANDLE_STATE_dead: + return "dead"; + case GDRAW_HANDLE_STATE_pinned: + return "pinned"; + case GDRAW_HANDLE_STATE_user_owned: + return "user-owned"; + case GDRAW_HANDLE_STATE_alloc: + return "alloc"; + case GDRAW_HANDLE_STATE_sentinel: + return ""; + default: + return "???"; + } +} + +#else +static RADINLINE void check_lists(GDrawHandleCache* c) { + RR_UNUSED_VARIABLE(c); +} +#endif + +static void gdraw_HandleTransitionInsertBefore(GDrawHandle* t, + GDrawHandleState new_state, + GDrawHandle* succ) { + check_lists(t->cache); + assert(t->state != + GDRAW_HANDLE_STATE_sentinel); // sentinels should never get here! + assert(t->state != (U32)new_state); // code should never call "transition" + // if it's not transitioning! + // unlink from prev state + t->prev->next = t->next; + t->next->prev = t->prev; + // add to list for new state + t->next = succ; + t->prev = succ->prev; + t->prev->next = t; + t->next->prev = t; +#if defined(SUPERDEBUG) + printf("GD %chandle %p %s->%s\n", t->cache->is_vertex ? 'v' : 't', t, + gdraw_StateName(t->state), gdraw_StateName(new_state)); +#endif + t->state = new_state; + check_lists(t->cache); +} + +static RADINLINE void gdraw_HandleTransitionTo(GDrawHandle* t, + GDrawHandleState new_state) { + gdraw_HandleTransitionInsertBefore(t, new_state, + &t->cache->state[new_state]); +} + +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) +static rrbool gdraw_MigrateResource(GDrawHandle* t, GDrawStats* stats); +static void gdraw_res_free(GDrawHandle* t, GDrawStats* stats); +#endif + +static rrbool gdraw_HandleCacheLockStats(GDrawHandle* t, void* owner, + GDrawStats* stats) { + RR_UNUSED_VARIABLE(stats); + + // if the GPU memory is owned by the user, then we never spontaneously + // free it, and we can always report true. moreover, Iggy doesn't bother + // keeping 'owner' consistent in this case, so we must check this before + // verifying t->owner. + if (t->state == GDRAW_HANDLE_STATE_user_owned) return true; + + // if t->owner has changed, then Iggy is trying to lock an old version + // of this handle from before (the handle has already been recycled to + // point to a new resource) + if (t->owner != owner) return false; + + // otherwise, it's a valid resource and we should lock it until the next + // unlock call + assert(t->state == GDRAW_HANDLE_STATE_live || + t->state == GDRAW_HANDLE_STATE_locked || + t->state == GDRAW_HANDLE_STATE_pinned); + if (t->state == GDRAW_HANDLE_STATE_live) { +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) + // if we defragmented this frame, we can't just make resources live; + // we need to migrate them to their new location. (which might fail + // if we don't have enough memory left in the new pool) + if (t->cache->did_defragment) { + if (!gdraw_MigrateResource(t, stats)) { + gdraw_res_free(t, stats); + return false; + } + } +#endif + gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_locked); + } + return true; +} + +static rrbool gdraw_HandleCacheLock(GDrawHandle* t, void* owner) { + return gdraw_HandleCacheLockStats(t, owner, NULL); +} + +static void gdraw_HandleCacheUnlock(GDrawHandle* t) { + assert(t->state == GDRAW_HANDLE_STATE_locked || + t->state == GDRAW_HANDLE_STATE_pinned || + t->state == GDRAW_HANDLE_STATE_user_owned); + if (t->state == GDRAW_HANDLE_STATE_locked) + gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_live); +} + +static void gdraw_HandleCacheUnlockAll(GDrawHandleCache* c) { + GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_locked]; + while (sentinel->next != sentinel) + gdraw_HandleTransitionTo(sentinel->next, GDRAW_HANDLE_STATE_live); +} + +static void gdraw_HandleCacheInit(GDrawHandleCache* c, S32 num_handles, + S32 bytes) { + S32 i; + assert(num_handles > 0); + c->max_handles = num_handles; + c->total_bytes = bytes; + c->bytes_free = c->total_bytes; + c->is_vertex = false; + c->is_thrashing = false; + c->did_defragment = false; + for (i = 0; i < GDRAW_HANDLE_STATE__count; i++) { + c->state[i].owner = NULL; + c->state[i].cache = + NULL; // should never follow cache link from sentinels! + c->state[i].next = c->state[i].prev = &c->state[i]; +#if defined(GDRAW_MANAGE_MEM) + c->state[i].raw_ptr = NULL; +#endif + c->state[i].fence.value = 0; + c->state[i].bytes = 0; + c->state[i].state = GDRAW_HANDLE_STATE_sentinel; + } + for (i = 0; i < num_handles; ++i) { + c->handle[i].cache = c; + c->handle[i].prev = + (i == 0) ? &c->state[GDRAW_HANDLE_STATE_free] : &c->handle[i - 1]; + c->handle[i].next = (i == num_handles - 1) + ? &c->state[GDRAW_HANDLE_STATE_free] + : &c->handle[i + 1]; + c->handle[i].bytes = 0; + c->handle[i].state = GDRAW_HANDLE_STATE_free; +#if defined(GDRAW_MANAGE_MEM) + c->handle[i].raw_ptr = NULL; +#endif + } + c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; + c->state[GDRAW_HANDLE_STATE_free].prev = &c->handle[num_handles - 1]; + c->prev_frame_start.value = 0; + c->prev_frame_end.value = 0; +#if defined(GDRAW_MANAGE_MEM) + c->alloc = NULL; +#endif +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) + c->alloc_other = NULL; +#endif + check_lists(c); +} + +static GDrawHandle* gdraw_HandleCacheAllocateBegin(GDrawHandleCache* c) { + GDrawHandle* free_list = &c->state[GDRAW_HANDLE_STATE_free]; + GDrawHandle* t = NULL; + if (free_list->next != free_list) { + t = free_list->next; + gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); + t->bytes = 0; + t->owner = 0; +#if defined(GDRAW_MANAGE_MEM) + t->raw_ptr = NULL; +#endif +#if defined(GDRAW_CORRUPTION_CHECK) + t->has_check_value = false; +#endif + } + return t; +} + +static void gdraw_HandleCacheAllocateEnd(GDrawHandle* t, S32 bytes, void* owner, + GDrawHandleState new_state) { + assert(t->cache); + assert(t->bytes == 0); + assert(t->owner == 0); + assert(t->state == GDRAW_HANDLE_STATE_alloc); + if (bytes == 0) + assert(new_state == GDRAW_HANDLE_STATE_user_owned); + else + assert(new_state == GDRAW_HANDLE_STATE_locked || + new_state == GDRAW_HANDLE_STATE_pinned); + t->bytes = bytes; + t->owner = owner; + t->cache->bytes_free -= bytes; + + gdraw_HandleTransitionTo(t, new_state); +} + +static void gdraw_HandleCacheFree(GDrawHandle* t) { + GDrawHandleCache* c = t->cache; + assert(t->state != GDRAW_HANDLE_STATE_alloc && + t->state != GDRAW_HANDLE_STATE_sentinel); + c->bytes_free += t->bytes; + t->bytes = 0; + t->owner = 0; +#if defined(GDRAW_MANAGE_MEM) + t->raw_ptr = 0; +#endif +#if defined(GDRAW_CORRUPTION_CHECK) + t->has_check_value = false; +#endif + gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_free); +} + +static void gdraw_HandleCacheAllocateFail(GDrawHandle* t) { + assert(t->state == GDRAW_HANDLE_STATE_alloc); + gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_free); +} + +static GDrawHandle* gdraw_HandleCacheGetLRU(GDrawHandleCache* c) { + // TransitionTo always inserts at the end, which means that the resources + // at the front of the LRU list are the oldest ones, since in-use resources + // will get appended on every transition from "locked" to "live". + GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_live]; + return (sentinel->next != sentinel) ? sentinel->next : NULL; +} + +static void gdraw_HandleCacheTick(GDrawHandleCache* c, GDrawFence now) { + c->prev_frame_start = c->prev_frame_end; + c->prev_frame_end = now; + + // reset these flags every frame + c->is_thrashing = false; + c->did_defragment = false; +} + +#if defined(GDRAW_MANAGE_MEM) + +static void gdraw_HandleCacheInsertDead(GDrawHandle* t) { + GDrawHandle *s, *sentinel; + + assert(t->state == GDRAW_HANDLE_STATE_live || + t->state == GDRAW_HANDLE_STATE_locked || + t->state == GDRAW_HANDLE_STATE_pinned); + + // figure out where t belongs in the dead list in "chronological order" + // do this by finding its (chronological) successor s + sentinel = &t->cache->state[GDRAW_HANDLE_STATE_dead]; + s = sentinel->next; + while (s != sentinel && s->fence.value <= t->fence.value) s = s->next; + + // and then insert it there + gdraw_HandleTransitionInsertBefore(t, GDRAW_HANDLE_STATE_dead, s); +} + +#endif + +//////////////////////////////////////////////////////////////////////// +// +// Set transformation matrices +// + +// Our vertex shaders use this convention: +// world: our world matrices always look like this +// m00 m01 0 t0 +// m10 m11 0 t1 +// 0 0 0 d +// 0 0 0 1 +// +// we just store the first two rows and insert d +// in the first row, third column. our input position vectors are +// always (x,y,0,1) or (x,y,0,0), so we can still just use dp4 to +// compute final x/y. after that it's a single move to set the +// correct depth value. +// +// viewproj: our view-projection matrix is always just a 2D scale+translate, +// i.e. the matrix looks like this: +// +// p[0] 0 0 p[2] +// 0 p[1] 0 p[3] +// 0 0 1 0 +// 0 0 0 1 +// +// just store (p[0],p[1],p[2],p[3]) in a 4-component vector and the +// projection transform is a single multiply-add. +// +// The output is volatile since it's often in Write-Combined memory where we +// really don't want compiler reordering. + +static RADINLINE void gdraw_PixelSpace(volatile F32* RADRESTRICT vvec) { + // 1:1 pixel mapping - just identity since our "view space" is pixels + vvec[0] = 1.0f; + vvec[1] = 0.0f; + vvec[2] = 0.0f; + vvec[3] = 0.0f; + vvec[4] = 0.0f; + vvec[5] = 1.0f; + vvec[6] = 0.0f; + vvec[7] = 0.0f; +} + +static RADINLINE void gdraw_WorldSpace(volatile F32* RADRESTRICT vvec, + F32* RADRESTRICT world_to_pixel, + F32 depth, F32 misc) { + // World->pixel space transform is just a scale + vvec[0] = world_to_pixel[0]; + vvec[1] = 0.0f; + vvec[2] = depth; + vvec[3] = 0.0f; + vvec[4] = 0.0f; + vvec[5] = world_to_pixel[1]; + vvec[6] = misc; + vvec[7] = 0.0f; +} + +static RADINLINE void gdraw_ObjectSpace(volatile F32* RADRESTRICT vvec, + gswf_matrix* RADRESTRICT xform, + F32 depth, F32 misc) { + // Object->pixel transform is a 2D homogeneous matrix transform + F32 m00 = xform->m00; + F32 m01 = xform->m01; + F32 m10 = xform->m10; + F32 m11 = xform->m11; + F32 trans0 = xform->trans[0]; + F32 trans1 = xform->trans[1]; + + vvec[0] = m00; + vvec[1] = m01; + vvec[2] = depth; + vvec[3] = trans0; + vvec[4] = m10; + vvec[5] = m11; + vvec[6] = misc; + vvec[7] = trans1; +} + +static void gdraw_GetObjectSpaceMatrix(F32* RADRESTRICT mat, + gswf_matrix* RADRESTRICT xform, + F32* RADRESTRICT proj, F32 depth, + int out_col_major) { + int row = out_col_major ? 1 : 4; + int col = out_col_major ? 4 : 1; + + F32 xs = proj[0]; + F32 ys = proj[1]; + + mat[0 * row + 0 * col] = xform->m00 * xs; + mat[0 * row + 1 * col] = xform->m01 * xs; + mat[0 * row + 2 * col] = 0.0f; + mat[0 * row + 3 * col] = xform->trans[0] * xs + proj[2]; + + mat[1 * row + 0 * col] = xform->m10 * ys; + mat[1 * row + 1 * col] = xform->m11 * ys; + mat[1 * row + 2 * col] = 0.0f; + mat[1 * row + 3 * col] = xform->trans[1] * ys + proj[3]; + + mat[2 * row + 0 * col] = 0.0f; + mat[2 * row + 1 * col] = 0.0f; + mat[2 * row + 2 * col] = 0.0f; + mat[2 * row + 3 * col] = depth; + + mat[3 * row + 0 * col] = 0.0f; + mat[3 * row + 1 * col] = 0.0f; + mat[3 * row + 2 * col] = 0.0f; + mat[3 * row + 3 * col] = 1.0f; +} + +//////////////////////////////////////////////////////////////////////// +// +// Blurs +// +// symmetrically expand a rectangle by ex/ey pixels on both sides, then clamp to +// tile bounds +static void gdraw_ExpandRect(gswf_recti* out, gswf_recti const* in, S32 ex, + S32 ey, S32 w, S32 h) { + out->x0 = RR_MAX(in->x0 - ex, 0); + out->y0 = RR_MAX(in->y0 - ey, 0); + out->x1 = RR_MIN(in->x1 + ex, w); + out->y1 = RR_MIN(in->y1 + ey, h); +} + +static void gdraw_ShiftRect(gswf_recti* out, gswf_recti const* in, S32 dx, + S32 dy) { + out->x0 = in->x0 + dx; + out->y0 = in->y0 + dy; + out->x1 = in->x1 + dx; + out->y1 = in->y1 + dy; +} + +#define MAX_TAPS 9 // max # of bilinear samples in one 'convolution' step + +enum { + // basic shader family + VAR_tex0 = 0, + VAR_tex1, + VAR_cmul, + VAR_cadd, + VAR_focal, + + // filter family + VAR_filter_tex0 = 0, + VAR_filter_tex1, + VAR_filter_color, + VAR_filter_tc_off, + VAR_filter_tex2, + VAR_filter_clamp0, + VAR_filter_clamp1, + VAR_filter_color2, + MAX_VARS, + + // blur family + VAR_blur_tex0 = 0, + VAR_blur_tap, + VAR_blur_clampv, + + // color matrix family + VAR_colormatrix_tex0 = 0, + VAR_colormatrix_data, + + // ihud family + VAR_ihudv_worldview = 0, + VAR_ihudv_material, + VAR_ihudv_textmode, +}; + +typedef struct { + S32 w, h, frametex_width, frametex_height; + void (*BlurPass)(GDrawRenderState* r, int taps, float* data, gswf_recti* s, + float* tc, float height_max, float* clampv, + GDrawStats* gstats); +} GDrawBlurInfo; + +static GDrawTexture* gdraw_BlurPass(GDrawFunctions* g, GDrawBlurInfo* c, + GDrawRenderState* r, int taps, float* data, + gswf_recti* draw_bounds, + gswf_recti* sample_bounds, + GDrawStats* gstats) { + F32 tc[4]; + F32 clamp[4]; + F32 t = 0; + F32 texel_scale_s = 1.0f / c->frametex_width; + F32 texel_scale_t = 1.0f / c->frametex_height; + S32 i; + for (i = 0; i < taps; ++i) t += data[4 * i + 2]; + assert(t >= 0.99f && t <= 1.01f); + + tc[0] = texel_scale_s * draw_bounds->x0; + tc[1] = texel_scale_t * draw_bounds->y0; + tc[2] = texel_scale_s * draw_bounds->x1; + tc[3] = texel_scale_t * draw_bounds->y1; + + // sample_bounds is (x0,y0) inclusive, (x1,y1) exclusive + // texel centers are offset by 0.5 from integer coordinates and we don't + // want to sample outside sample_bounds + clamp[0] = texel_scale_s * (sample_bounds->x0 + 0.5f); + clamp[1] = texel_scale_t * (sample_bounds->y0 + 0.5f); + clamp[2] = texel_scale_s * (sample_bounds->x1 - 0.5f); + clamp[3] = texel_scale_t * (sample_bounds->y1 - 0.5f); + + if (!g->TextureDrawBufferBegin( + draw_bounds, GDRAW_TEXTURE_FORMAT_rgba32, + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, + 0, gstats)) + return r->tex[0]; + + c->BlurPass(r, taps, data, draw_bounds, tc, (F32)c->h / c->frametex_height, + clamp, gstats); + return g->TextureDrawBufferEnd(gstats); +} + +static GDrawTexture* gdraw_BlurPassDownsample( + GDrawFunctions* g, GDrawBlurInfo* c, GDrawRenderState* r, int taps, + float* data, gswf_recti* draw_bounds, int axis, int divisor, int tex_w, + int tex_h, gswf_recti* sample_bounds, GDrawStats* gstats) { + S32 i; + F32 t = 0; + F32 tc[4]; + F32 clamp[4]; + F32 texel_scale_s = 1.0f / tex_w; + F32 texel_scale_t = 1.0f / tex_h; + gswf_recti z; + + for (i = 0; i < taps; ++i) t += data[4 * i + 2]; + assert(t >= 0.99f && t <= 1.01f); + + // following must be integer divides! + if (axis == 0) { + z.x0 = draw_bounds->x0 / divisor; + z.x1 = (draw_bounds->x1 - 1) / divisor + 1; + z.y0 = draw_bounds->y0; + z.y1 = draw_bounds->y1; + + tc[0] = ((z.x0 - 0.5f) * divisor + 0.5f) * texel_scale_s; + tc[2] = ((z.x1 - 0.5f) * divisor + 0.5f) * texel_scale_s; + tc[1] = z.y0 * texel_scale_t; + tc[3] = z.y1 * texel_scale_t; + } else { + z.x0 = draw_bounds->x0; + z.x1 = draw_bounds->x1; + z.y0 = draw_bounds->y0 / divisor; + z.y1 = (draw_bounds->y1 - 1) / divisor + 1; + + tc[0] = z.x0 * texel_scale_s; + tc[2] = z.x1 * texel_scale_s; + tc[1] = ((z.y0 - 0.5f) * divisor + 0.5f) * texel_scale_t; + tc[3] = ((z.y1 - 0.5f) * divisor + 0.5f) * texel_scale_t; + } + + if (!g->TextureDrawBufferBegin( + &z, GDRAW_TEXTURE_FORMAT_rgba32, + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, + 0, gstats)) + return r->tex[0]; + + clamp[0] = texel_scale_s * (sample_bounds->x0 + 0.5f); + clamp[1] = texel_scale_t * (sample_bounds->y0 + 0.5f); + clamp[2] = texel_scale_s * (sample_bounds->x1 - 0.5f); + clamp[3] = texel_scale_t * (sample_bounds->y1 - 0.5f); + + assert(clamp[0] <= clamp[2]); + assert(clamp[1] <= clamp[3]); + + c->BlurPass(r, taps, data, &z, tc, (F32)c->h / c->frametex_height, clamp, + gstats); + return g->TextureDrawBufferEnd(gstats); +} + +#define unmap(t, a, b) (((t) - (a)) / (F32)((b) - (a))) +#define linear_remap(t, a, b, c, d) ((c) + unmap(t, a, b) * ((d) - (c))) + +static void gdraw_BlurAxis(S32 axis, GDrawFunctions* g, GDrawBlurInfo* c, + GDrawRenderState* r, F32 blur_width, F32 texel, + gswf_recti* draw_bounds, gswf_recti* sample_bounds, + GDrawTexture* protect, GDrawStats* gstats) { + GDrawTexture* t; + F32 data[MAX_TAPS][4]; + S32 off_axis = 1 - axis; + S32 w = ((S32)ceil((blur_width - 1) / 2)) * 2 + + 1; // 1.2 => 3, 2.8 => 3, 3.2 => 5 + F32 edge_weight = + 1 - (w - blur_width) / 2; // 3 => 0 => 1; 1.2 => 1.8 => 0.9 => 0.1 + F32 inverse_weight = 1.0f / blur_width; + + w = ((w - 1) >> 1) + + 1; // 3 => 2, 5 => 3, 7 => 4 (number of texture samples) + + if (!r->tex[0]) return; + + // horizontal filter + if (w > 1) { + if (w <= MAX_TAPS) { + // we have enough taps to just do it + // use 'w' taps + S32 i, expand; + + // just go through and place all the taps in the right place + + // if w is 2 (sample from -1,0,1) + // 0 => -0.5 + // 1 => 1 + + // if w is 3: + // 0 => -1.5 samples from -2,-1 + // 1 => 0.5 samples from 0,1 + // 2 => 2 samples from 2 + + // if w is 4: + // 0 => -2.5 samples from -3,-2 + // 1 => -0.5 samples from -1,0 + // 2 => 1.5 samples from 1,2 + // 3 => 3 samples from 3 + + for (i = 0; i < w; ++i) { + // first texsample samples from -w+1 and -w+2, e.g. w=2 => + // -1,0,1 + data[i][axis] = (-w + 1.5f + i * 2) * texel; + data[i][off_axis] = 0; + data[i][2] = 2 * inverse_weight; // 2 full-weight samples + data[i][3] = 0; + } + // now reweight the last one + data[i - 1][axis] = (w - 1) * texel; + data[i - 1][2] = edge_weight * inverse_weight; + // now reweight the first one + // (ew*0 + 1*1)/(1+ew) = 1/(1+ew) + data[0][axis] = (-w + 1.0f + 1 / (edge_weight + 1)) * texel; + data[0][2] = (edge_weight + 1) * inverse_weight; + + expand = w - 1; + gdraw_ExpandRect(draw_bounds, draw_bounds, axis ? 0 : expand, + axis ? expand : 0, c->w, c->h); + + t = gdraw_BlurPass(g, c, r, w, data[0], draw_bounds, sample_bounds, + gstats); + if (r->tex[0] != protect && r->tex[0] != t) + g->FreeTexture(r->tex[0], 0, gstats); + r->tex[0] = t; + gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, + c->h); // for next pass + } else { + // @OPTIMIZE: for symmetrical blurs we can get a 2-wide blur in the + // *off* axis at the same time we get N-wide in the on axis, which + // could double our max width + S32 i, expand; + // @HACK: this is really a dumb way to do it, i kind of had a brain + // fart, you could get the exact same result by just doing the + // downsample the naive way and then the final sample uses texture + // samples spaced by a texel rather than spaced by two texels -- the + // current method is just as inefficient, it just puts the + // inefficiency in the way the downsampled texture is + // self-overlapping, so the downsampled texture is twice as larger + // as it should be. + + // we COULD be exact by generating a mipmap, then sampling some + // number of samples from the mipmap and some from the original, but + // that would require being polyphase. instead we just are + // approximate. the mipmap weights the edge pixels by one half and + // overlaps them by one sample, so then in phase two we sample N + // slightly-overlapping mipmap samples + // + // instead we do the following. + // divide the source data up into clusters that are K samples + // long. + // ...K0... ...K1... ...K2... ...K3... + // + // Suppose K[i] is the average of all the items in cluster i. + // + // We compute a downsampled texture where T[i] = K[i] + K[i+1]. + // + // Now, we sample N taps from adjacent elements of T, allowing the + // texture unit to bilerp. Suppose a given sample falls at + // coordinate i with sub-position p. Then tap #j will compute: + // T[i+j]*(1-p) + T[i+j+1]*p + // But tap #j+1 will compute: + // T[i+j+1]*(1-p) + T[i+j+2]*p + // so we end up computing: + // sum(T[i+j]) except for the end samples. + // + // So, how do we create these initial clusters? That's easy, we use + // K taps to sample 2K texels. + // + // What value of k do we use? Well, we're constrained to using + // MAX_TAPS on each pass. So at the high end, we're bounded by: + // K = MAX_TAPS + // S = MAX_TAPS (S is number of samples in second pass) + // S addresses S*2-1 texels of T, and each texel adds K more + // samples, so (ignoring the edges) we basically have w = K*S + + // if w == MAX_TAPS*MAX_TAPS, then k = MAX_TAPS + // if w == MAX_TAPS+1, then k = 2 + // + // suppose we have 3 taps, then we can sample 5 samples in one pass, + // so then our max coverage is 25 samples, or a filter width of 13. + // with 7 taps, we sample 13 samples in one pass, max coverage is + // 13*13 samples or (13*13-1)/2 width, which is ((2T-1)*(2T-1)-1)/2 + // or (4T^2 - 4T + 1 -1)/2 or 2T^2 - 2T or 2T*(T-1) + S32 w_mip = (S32)ceil(linear_remap( + w, MAX_TAPS + 1, MAX_TAPS * MAX_TAPS, 2, MAX_TAPS)); + S32 downsample = w_mip; + F32 sample_spacing = texel; + if (downsample < 2) downsample = 2; + if (w_mip > MAX_TAPS) { + // if w_mip > MAX_TAPS, then we ought to use more than one + // mipmap pass, but since that's a huge filter ( > 80 pixels) + // let's just try subsampling and see if it's good enough. + sample_spacing *= w_mip / MAX_TAPS; + w_mip = MAX_TAPS; + } else { + assert(w / downsample <= MAX_TAPS); + } + inverse_weight = 1.0f / (2 * w_mip); + for (i = 0; i < w_mip; ++i) { + data[i][axis] = (-w_mip + 1 + i * 2 + 0.5f) * sample_spacing; + data[i][off_axis] = 0; + data[i][2] = 2 * inverse_weight; + data[i][3] = 0; + } + w = w * 2 / w_mip; + + // @TODO: compute the correct bboxes for this size + // the downsampled texture samples from -w_mip+1 to w_mip + // the sample from within that samples w spots within that, + // or w/2 of those, but they're overlapping by 50%. + // so if a sample is a point i, it samples from the original + // from -w_mip+1 to w_mip + i*w_mip. + // So then the minimum is: -w_mip+1 + (w/2)*w_mip, and + // the maximum is w_mip + (w/2)*w_mip + expand = (((w + 1) >> 1) + 1) * w_mip + 1; + gdraw_ExpandRect(draw_bounds, draw_bounds, axis ? 0 : expand, + axis ? expand : 0, c->w, c->h); + + t = gdraw_BlurPassDownsample( + g, c, r, w_mip, data[0], draw_bounds, axis, downsample, + c->frametex_width, c->frametex_height, sample_bounds, gstats); + if (r->tex[0] != protect && r->tex[0] != t) + g->FreeTexture(r->tex[0], 0, gstats); + r->tex[0] = t; + gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, c->h); + if (!r->tex[0]) return; + + // now do a regular blur pass sampling from that + // the raw texture now contains 'downsample' samples per texel + if (w > 2 * MAX_TAPS) { + sample_spacing = texel * (w - 1) / (2 * MAX_TAPS - 1); + w = 2 * MAX_TAPS; + } else { + sample_spacing = texel; + } + // sample_spacing *= 1.0f/2; + assert(w >= 2 && w <= 2 * MAX_TAPS); + + if (w & 1) { + // we just want to evenly weight even-spaced samples + inverse_weight = 1.0f / w; + + // just go through and place all the taps in the right place + + w = (w + 1) >> 1; + for (i = 0; i < w; ++i) { + data[i][axis] = (-w + 1.0f + 0.5f + i * 2) * sample_spacing; + data[i][off_axis] = 0; + data[i][2] = 2 * inverse_weight; // 2 full-weight samples + data[i][3] = 0; + } + + // fix up the last tap + + // the following test is always true, but we're testing it here + // explicitly so as to make VS2012's static analyzer not + // complain + if (i > 0) { + data[i - 1][axis] = + (-w + 1.0f + (i - 1) * 2) * sample_spacing; + data[i - 1][2] = inverse_weight; + } + } else { + // we just want to evenly weight even-spaced samples + inverse_weight = 1.0f / w; + + // just go through and place all the taps in the right place + w >>= 1; + for (i = 0; i < w; ++i) { + data[i][axis] = (-w + 1.0f + i * 2) * sample_spacing; + data[i][off_axis] = 0; + data[i][2] = 2 * inverse_weight; // 2 full-weight samples + data[i][3] = 0; + } + } + + t = gdraw_BlurPassDownsample( + g, c, r, w, data[0], draw_bounds, axis, 1, + axis == 0 ? c->frametex_width * downsample : c->frametex_width, + axis == 1 ? c->frametex_height * downsample + : c->frametex_height, + sample_bounds, gstats); + if (r->tex[0] != protect && r->tex[0] != t) + g->FreeTexture(r->tex[0], 0, gstats); + r->tex[0] = t; + gdraw_ExpandRect(sample_bounds, draw_bounds, 1, 1, c->w, c->h); + } + } +} + +static void gdraw_Blur(GDrawFunctions* g, GDrawBlurInfo* c, GDrawRenderState* r, + gswf_recti* draw_bounds, gswf_recti* sample_bounds, + GDrawStats* gstats) { + S32 p; + GDrawTexture* protect = r->tex[0]; + gswf_recti sbounds; + + // compute texel offset size + F32 dx = 1.0f / c->frametex_width; + F32 dy = 1.0f / c->frametex_height; + + // blur = 1 => 1 tap + // blur = 1.2 => 3 taps (0.1, 1, 0.1) + // blur = 2.2 => 3 taps (0.6, 1, 0.6) + // blur = 2.8 => 3 taps (0.9, 1, 0.9) + // blur = 3 => 3 taps (1 , 1, 1 ) + // blur = 3.2 => 5 taps (0.1, 1, 1, 1, 0.1) + + // S32 w = ((S32) ceil((r->blur_x-1)/2))*2+1; // 1.2 => (1.2-1)/2 => 0.1 + // => 1.0 => 1 => 2 => 3 S32 h = ((S32) ceil((r->blur_y-1)/2))*2+1; // 3 + // => (3-1)/2 => 1.0 => 1 => 2 => 3 + + // gdraw puts 1 border pixel around everything when producing rendertargets + // and we use this so expand the input sample bounds accordingly + gdraw_ExpandRect(&sbounds, sample_bounds, 1, 1, c->w, c->h); + + for (p = 0; p < r->blur_passes; ++p) { + { + // do the filter separably + gdraw_BlurAxis(0, g, c, r, r->blur_x, dx, draw_bounds, &sbounds, + protect, gstats); + gdraw_BlurAxis(1, g, c, r, r->blur_y, dy, draw_bounds, &sbounds, + protect, gstats); + } + } +} + +#if defined(GDRAW_MANAGE_MEM) + +static void make_pool_aligned(void** start, S32* num_bytes, U32 alignment) { + UINTa addr_orig = (UINTa)*start; + UINTa addr_aligned = (addr_orig + alignment - 1) & ~((UINTa)alignment - 1); + + if (addr_aligned != addr_orig) { + S32 diff = (S32)(addr_aligned - addr_orig); + if (*num_bytes < diff) { + *start = NULL; + *num_bytes = 0; + return; + } else { + *start = (void*)addr_aligned; + *num_bytes -= diff; + } + } +} + +// Very simple arena allocator +typedef struct { + U8* begin; + U8* current; + U8* end; +} GDrawArena; + +static void gdraw_arena_init(GDrawArena* arena, void* start, U32 size) { + arena->begin = (U8*)start; + arena->current = (U8*)start; + arena->end = (U8*)start + size; +} + +static GDRAW_MAYBE_UNUSED void gdraw_arena_reset(GDrawArena* arena) { + arena->current = arena->begin; +} + +static void* gdraw_arena_alloc(GDrawArena* arena, U32 size, U32 align) { + UINTa start_addr = + ((UINTa)arena->current + align - 1) & ~((UINTa)align - 1); + U8* ptr = (U8*)start_addr; + UINTa remaining = arena->end - arena->current; + UINTa total_size = (ptr - arena->current) + size; + if (remaining < total_size) // doesn't fit + return NULL; + + arena->current = ptr + size; + return ptr; +} + +// Allocator for graphics memory. +// Graphics memory is assumed to be write-combined and slow to read for the +// CPU, so we keep all heap management information separately in main memory. +// +// There's a constant management of about 1k (2k for 64bit) to create a heap, +// plus a per-block overhead. The maximum number of blocks the allocator can +// ever use is bounded by 2*max_allocs+1; since GDraw manages a limited +// amount of handles, max_allocs is a known value at heap creation time. +// +// The allocator uses a best-fit heuristic to minimize fragmentation. +// Currently, there are no size classes or other auxiliary data structures to +// speed up this process, since the number of free blocks at any point in time +// is assumed to be fairly low. +// +// The allocator maintains a number of invariants: +// - The free list and physical block list are proper double-linked lists. +// (i.e. block->next->prev == block->prev->next == block) +// - All allocated blocks are also kept in a hash table, indexed by their +// pointer (to allow free to locate the corresponding block_info quickly). +// There's a single-linked, NULL-terminated list of elements in each hash +// bucket. +// - The physical block list is ordered. It always contains all currently +// active blocks and spans the whole managed memory range. There are no +// gaps between blocks, and all blocks have nonzero size. +// - There are no two adjacent free blocks; if two such blocks would be created, +// they are coalesced immediately. +// - The maximum number of blocks that could ever be necessary is allocated +// on initialization. All block_infos not currently in use are kept in a +// single-linked, NULL-terminated list of unused blocks. Every block is either +// in the physical block list or the unused list, and the total number of +// blocks is constant. +// These invariants always hold before and after an allocation/free. + +#if !defined(GFXALLOC_ASSERT) +#define GFXALLOC_ASSERT(x) +#endif + +typedef struct gfx_block_info { + U8* ptr; + gfx_block_info *prev, + *next; // for free blocks this is the free list, for allocated blocks + // it's a (single-linked!) list of elements in the corresponding + // hash bucket + gfx_block_info *prev_phys, *next_phys; + U32 is_free : 1; + U32 is_unused : 1; + U32 size : 30; +} gfx_block_info; +// 24 bytes/block on 32bit, 48 bytes/block on 64bit. + +#define GFXALLOC_HASH_SIZE 256 + +typedef struct gfx_allocator { + U8* mem_base; + U8* mem_end; + U32 max_allocs; + U32 block_align; + U32 block_shift; + S32 actual_bytes_free; + +#if defined(GFXALLOC_CHECK) + int num_blocks; + int num_unused; + int num_alloc; + int num_free; +#endif + + GDrawHandleCache* cache; + + gfx_block_info* unused_list; // next unused block_info (single-linked list) + gfx_block_info* hash[GFXALLOC_HASH_SIZE]; // allocated blocks + gfx_block_info blocks[1]; // first block is head of free list AND head of + // physical block list (sentinel) +} gfx_allocator; +// about 1k (32bit), 2k (64bit) with 256 hash buckets (the default). dominated +// by hash table. + +#if defined(GFXALLOC_CHECK) +#define GFXALLOC_IF_CHECK(x) x +#else +#define GFXALLOC_IF_CHECK(x) +#endif + +static U32 gfxalloc_get_hash_code(gfx_allocator* alloc, void* ptr) { + U32 a = (U32)(((U8*)ptr - alloc->mem_base) >> alloc->block_shift); + + // integer hash function by Bob Jenkins + // (http://burtleburtle.net/bob/hash/integer.html) I use this function + // because integer mults are slow on PPC and large literal constants take + // multiple instrs to set up on all RISC CPUs. + a -= (a << 6); + a ^= (a >> 17); + a -= (a << 9); + a ^= (a << 4); + a -= (a << 3); + a ^= (a << 10); + a ^= (a >> 15); + + return a & (GFXALLOC_HASH_SIZE - 1); +} + +#if defined(SUPERDEBUG) || defined(COMPLETE_DEBUG) +#include +#define MAX_REGIONS 8192 +typedef struct { + U32 begin, end; +} gfx_region; +static gfx_region region[MAX_REGIONS]; + +static int region_sort(const void* p, const void* q) { + U32 a = *(U32*)p; + U32 b = *(U32*)q; + if (a < b) return -1; + if (a > b) return 1; + return 0; +} + +static void gfxalloc_check1(gfx_allocator* alloc) { + assert(alloc->max_allocs * 2 + 1 < MAX_REGIONS); + int i, n = 0; + for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { + gfx_block_info* b = alloc->hash[i]; + while (b) { + region[n].begin = (UINTa)b->ptr; + region[n].end = region[n].begin + b->size; + ++n; + b = b->next; + } + } + gfx_block_info* b = alloc->blocks[0].next; + while (b != &alloc->blocks[0]) { + region[n].begin = (UINTa)b->ptr; + region[n].end = region[n].begin + b->size; + ++n; + b = b->next; + } + qsort(region, n, sizeof(region[0]), region_sort); + for (i = 0; i + 1 < n; ++i) { + assert(region[i].end == region[i + 1].begin); + } +} +#else +#define gfxalloc_check1(a) +#endif + +#if defined(COMPLETE_DEBUG) +static void verify_against_blocks(int num_regions, void* vptr, S32 len) { + U32* ptr = (U32*)vptr; + // binary search for ptr amongst regions + S32 s = 0, e = num_regions - 1; + assert(len != 0); + while (s < e) { + S32 i = (s + e + 1) >> 1; + // invariant: b[s] <= ptr <= b[e] + if (region[i].begin <= (UINTa)ptr) + s = i; + else + e = i - 1; + + // consider cases: + // s=0,e=1: i = 0, how do we get i to be 1? + } + // at this point, s >= e + assert(s < num_regions && region[s].begin == (UINTa)ptr && + (UINTa)ptr + len <= region[s].end); +} + +static void debug_complete_check(gfx_allocator* alloc, void* ptr, S32 len, + void* skip) { + GDrawHandleCache* c = alloc->cache; + assert(alloc->max_allocs * 2 + 1 < MAX_REGIONS); + int i, n = 0; + for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { + gfx_block_info* b = alloc->hash[i]; + while (b) { + region[n].begin = (UINTa)b->ptr; + region[n].end = region[n].begin + b->size; + ++n; + b = b->next; + } + } + gfx_block_info* b = alloc->blocks[0].next; + while (b != &alloc->blocks[0]) { + region[n].begin = (UINTa)b->ptr; + region[n].end = region[n].begin + b->size; + ++n; + b = b->next; + } + for (i = 0; i < n; ++i) assert(region[i].end > region[i].begin); + qsort(region, n, sizeof(region[0]), region_sort); + for (i = 0; i + 1 < n; ++i) { + assert(region[i].end == region[i + 1].begin); + } + + if (ptr) verify_against_blocks(n, ptr, len); + + if (c) { + GDrawHandle* t = c->head; + while (t) { + if (t->raw_ptr && t->raw_ptr != skip) + verify_against_blocks(n, t->raw_ptr, t->bytes); + t = t->next; + } + t = c->active; + while (t) { + if (t->raw_ptr && t->raw_ptr != skip) + verify_against_blocks(n, t->raw_ptr, t->bytes); + t = t->next; + } + } +} +#else +#define debug_complete_check(a, p, len, s) +#endif + +#if defined(GFXALLOC_CHECK) +static void gfxalloc_check2(gfx_allocator* alloc) { + int n = 0; + gfx_block_info* b = alloc->unused_list; + while (b) { + ++n; + b = b->next; + } + GFXALLOC_ASSERT(n == alloc->num_unused); + b = alloc->blocks->next; + n = 0; + while (b != alloc->blocks) { + ++n; + b = b->next; + } + GFXALLOC_ASSERT(n == alloc->num_free); + GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_unused + alloc->num_free + alloc->num_alloc); +} +#define gfxalloc_check(a) \ + do { \ + gfxalloc_check1(a); \ + gfxalloc_check2(a); \ + } while (0) +#else +#define gfxalloc_check2(a) +#define gfxalloc_check(a) +#endif + +static gfx_block_info* gfxalloc_pop_unused(gfx_allocator* alloc) { + GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list->is_unused); + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) + + gfx_block_info* b = alloc->unused_list; + alloc->unused_list = b->next; + GFXALLOC_ASSERT(alloc->unused_list); + b->is_unused = 0; + GFXALLOC_IF_CHECK(--alloc->num_unused;) + return b; +} + +static void gfxalloc_push_unused(gfx_allocator* alloc, gfx_block_info* b) { + GFXALLOC_ASSERT(!b->is_unused); + b->is_unused = 1; + b->next = alloc->unused_list; + alloc->unused_list = b; + GFXALLOC_IF_CHECK(++alloc->num_unused); +} + +static void gfxalloc_add_free(gfx_allocator* alloc, gfx_block_info* b) { + gfx_block_info* head = alloc->blocks; + + b->is_free = 1; + b->next = head->next; + b->prev = head; + head->next->prev = b; + head->next = b; + GFXALLOC_IF_CHECK(++alloc->num_free;) +} + +static void gfxalloc_rem_free(gfx_allocator* alloc, gfx_block_info* b) { + RR_UNUSED_VARIABLE(alloc); + b->is_free = 0; + b->prev->next = b->next; + b->next->prev = b->prev; + GFXALLOC_IF_CHECK(--alloc->num_free;) +} + +static void gfxalloc_split_free(gfx_allocator* alloc, gfx_block_info* b, + U32 pos) { + gfx_block_info* n = gfxalloc_pop_unused(alloc); + + GFXALLOC_ASSERT(b->is_free); + GFXALLOC_ASSERT(pos > 0 && pos < b->size); + + // set up new free block + n->ptr = b->ptr + pos; + n->prev_phys = b; + n->next_phys = b->next_phys; + n->next_phys->prev_phys = n; + n->size = b->size - pos; + assert(n->size != 0); + gfxalloc_add_free(alloc, n); + + // fix original block + b->next_phys = n; + b->size = pos; + assert(b->size != 0); + + debug_complete_check(alloc, n->ptr, n->size, 0); + debug_complete_check(alloc, b->ptr, b->size, 0); +} + +static gfx_allocator* gfxalloc_create(void* mem, U32 mem_size, U32 align, + U32 max_allocs) { + gfx_allocator* a; + U32 i, max_blocks, size; + + if (!align || + (align & (align - 1)) != 0) // align must be >0 and a power of 2 + return NULL; + + // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst + // case: [free][used][free] .... [free][used][free] + max_blocks = max_allocs * 2 + 1; + size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); + a = (gfx_allocator*)IggyGDrawMalloc(size); + if (!a) return NULL; + + memset(a, 0, size); + + GFXALLOC_IF_CHECK(a->num_blocks = max_blocks;) + GFXALLOC_IF_CHECK(a->num_alloc = 0;) + GFXALLOC_IF_CHECK(a->num_free = 1;) + GFXALLOC_IF_CHECK(a->num_unused = max_blocks - 1;) + + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(a->num_blocks == + a->num_alloc + a->num_free + a->num_unused);) + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(a->num_free <= a->num_blocks + 1);) + + a->actual_bytes_free = mem_size; + a->mem_base = (U8*)mem; + a->mem_end = a->mem_base + mem_size; + a->max_allocs = max_allocs; + a->block_align = align; + a->block_shift = 0; + while ((1u << a->block_shift) < a->block_align) a->block_shift++; + + // init sentinel block + a->blocks[0].prev = a->blocks[0].next = + &a->blocks[1]; // point to free block + a->blocks[0].prev_phys = a->blocks[0].next_phys = &a->blocks[1]; // same + + // init first free block + a->blocks[1].ptr = a->mem_base; + a->blocks[1].prev = a->blocks[1].next = &a->blocks[0]; + a->blocks[1].prev_phys = a->blocks[1].next_phys = &a->blocks[0]; + a->blocks[1].is_free = 1; + a->blocks[1].size = mem_size; + + // init "unused" list + a->unused_list = a->blocks + 2; + for (i = 2; i < max_blocks; i++) { + a->blocks[i].is_unused = 1; + a->blocks[i].next = a->blocks + (i + 1); + } + a->blocks[i].is_unused = 1; + + gfxalloc_check(a); + debug_complete_check(a, NULL, 0, 0); + return a; +} + +static void* gfxalloc_alloc(gfx_allocator* alloc, U32 size_in_bytes) { + gfx_block_info *cur, *best = NULL; + U32 i, best_wasted = ~0u; + U32 size = size_in_bytes; + debug_complete_check(alloc, NULL, 0, 0); + gfxalloc_check(alloc); + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) + + // round up to multiple of our block alignment + size = (size + alloc->block_align - 1) & ~(alloc->block_align - 1); + assert(size >= size_in_bytes); + assert(size != 0); + + // find best fit among all free blocks. this is O(N)! + for (cur = alloc->blocks[0].next; cur != alloc->blocks; cur = cur->next) { + if (cur->size >= size) { + U32 wasted = cur->size - size; + if (wasted < best_wasted) { + best_wasted = wasted; + best = cur; + if (!wasted) break; // can't get better than perfect + } + } + } + + // return the best fit, if we found any suitable block + if (best) { + debug_check_overlap(alloc->cache, best->ptr, best->size); + // split off allocated part + if (size != best->size) gfxalloc_split_free(alloc, best, size); + debug_complete_check(alloc, best->ptr, best->size, 0); + + // remove from free list and add to allocated hash table + GFXALLOC_ASSERT(best->size == size); + gfxalloc_rem_free(alloc, best); + + i = gfxalloc_get_hash_code(alloc, best->ptr); + best->next = alloc->hash[i]; + alloc->hash[i] = best; + alloc->actual_bytes_free -= size; + GFXALLOC_ASSERT(alloc->actual_bytes_free >= 0); + + GFXALLOC_IF_CHECK(++alloc->num_alloc;) + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) + + debug_complete_check(alloc, best->ptr, best->size, 0); + gfxalloc_check(alloc); + debug_check_overlap(alloc->cache, best->ptr, best->size); + return best->ptr; + } else + return NULL; // not enough space! +} + +static void gfxalloc_free(gfx_allocator* alloc, void* ptr) { + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) + + // find the block in the hash table + gfx_block_info *b, *t, **prevnext; + U32 i = gfxalloc_get_hash_code(alloc, ptr); + + prevnext = &alloc->hash[i]; + b = alloc->hash[i]; + + while (b) { + if (b->ptr == ptr) break; + prevnext = &b->next; + b = b->next; + } + + if (!b) { + GFXALLOC_ASSERT(0); // trying to free a non-allocated block + return; + } + + debug_complete_check(alloc, b->ptr, b->size, 0); + GFXALLOC_IF_CHECK(--alloc->num_alloc;) + + // remove it from the hash table + *prevnext = b->next; + + alloc->actual_bytes_free += b->size; + + // merge with previous block if it's free, else add it to free list + t = b->prev_phys; + if (t->is_free) { + t->size += b->size; + t->next_phys = b->next_phys; + t->next_phys->prev_phys = t; + gfxalloc_push_unused(alloc, b); + b = t; + } else + gfxalloc_add_free(alloc, b); + + // try to merge with next block + t = b->next_phys; + if (t->is_free) { + b->size += t->size; + b->next_phys = t->next_phys; + t->next_phys->prev_phys = b; + gfxalloc_rem_free(alloc, t); + gfxalloc_push_unused(alloc, t); + } + debug_complete_check(alloc, 0, 0, ptr); + gfxalloc_check(alloc); + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) +} + +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) + +static rrbool gfxalloc_is_empty(gfx_allocator* alloc) { + gfx_block_info* first_free = alloc->blocks[0].next; + + // we want to check whether there's exactly one free block that + // covers the entire pool. + if (first_free == alloc->blocks) // 0 free blocks + return false; + + if (first_free->next != alloc->blocks) // >1 free block + return false; + + return first_free->ptr == alloc->mem_base && + first_free->ptr + first_free->size == alloc->mem_end; +} + +static rrbool gfxalloc_mem_contains(gfx_allocator* alloc, void* ptr) { + return alloc->mem_base <= (U8*)ptr && (U8*)ptr < alloc->mem_end; +} + +#endif + +#if defined(GDRAW_DEBUG) + +static void gfxalloc_dump(gfx_allocator* alloc) { + static const char* type[] = { + "allocated", + "free", + }; + + for (gfx_block_info* b = alloc->blocks[0].next_phys; b != alloc->blocks; + b = b->next_phys) { + U8* start = b->ptr; + U8* end = b->ptr + b->size; + printf("%p-%p: %s (%d bytes)\n", start, end, type[b->is_free], b->size); + } +} + +#endif + +#endif + +#if defined(GDRAW_DEFRAGMENT) + +#define GDRAW_DEFRAGMENT_may_overlap \ + 1 // self-overlap for individual copies is OK + +// Defragmentation code for graphics memory. +// The platform implementation must provide a GPU memcpy function and handle all +// necessary synchronization. It must also adjust its resource descriptors to +// match the new addresses after defragmentation. + +static void gdraw_gpu_memcpy(GDrawHandleCache* c, void* dst, void* src, + U32 num_bytes); + +static void gdraw_Defragment_memmove(GDrawHandleCache* c, U8* dst, U8* src, + U32 num_bytes, U32 flags, + GDrawStats* stats) { + if (dst == src) return; + + assert(num_bytes != 0); + + stats->nonzero_flags |= GDRAW_STATS_defrag; + stats->defrag_objects += 1; + stats->defrag_bytes += num_bytes; + + if ((flags & GDRAW_DEFRAGMENT_may_overlap) || dst + num_bytes <= src || + src + num_bytes <= dst) // no problematic overlap + gdraw_gpu_memcpy(c, dst, src, num_bytes); + else { + // need to copy in multiple chunks + U32 chunk_size, pos = 0; + if (dst < src) + chunk_size = (U32)(src - dst); + else + chunk_size = (U32)(dst - src); + + while (pos < num_bytes) { + U32 amount = num_bytes - pos; + if (amount > chunk_size) amount = chunk_size; + gdraw_gpu_memcpy(c, dst + pos, src + pos, amount); + pos += amount; + } + } +} + +static rrbool gdraw_CanDefragment(GDrawHandleCache* c) { + // we can defragment (and extract some gain from it) if and only if there's + // more than one free block. since gfxalloc coalesces free blocks + // immediately and keeps them in a circular linked list, this is very easy + // to detect: just check if the "next" pointer of the first free block + // points to the sentinel. (this is only the case if there are 0 or 1 free + // blocks) + gfx_allocator* alloc = c->alloc; + return alloc->blocks[0].next->next != alloc->blocks; +} + +static void gdraw_DefragmentMain(GDrawHandleCache* c, U32 flags, + GDrawStats* stats) { + gfx_allocator* alloc = c->alloc; + gfx_block_info *b, *n; + U8* p; + S32 i; + + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) + + // go over all allocated memory blocks and clear the "prev" pointer + // (unused for allocated blocks, we'll use it to store a back-pointer to the + // corresponding handle) + for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b = b->next_phys) + if (!b->is_free) b->prev = NULL; + + // go through all handles and store a pointer to the handle in the + // corresponding memory block + for (i = 0; i < c->max_handles; i++) + if (c->handle[i].raw_ptr) { + assert(c->handle[i].bytes != 0); + for (b = alloc->hash[gfxalloc_get_hash_code(alloc, + c->handle[i].raw_ptr)]; + b; b = b->next) + if (b->ptr == c->handle[i].raw_ptr) { + void* block = &c->handle[i]; + b->prev = (gfx_block_info*)block; + break; + } + + GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + } + + // clear alloc hash table (we rebuild it during defrag) + memset(alloc->hash, 0, sizeof(alloc->hash)); + + // defragmentation proper: go over all blocks again, remove all free blocks + // from the physical block list and compact the remaining blocks together. + p = alloc->mem_base; + for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b = n) { + n = b->next_phys; + + if (!b->is_free) { + U32 h; + + // move block if necessary + if (p != b->ptr) { + assert(b->size != 0); + gdraw_Defragment_memmove(c, p, b->ptr, b->size, flags, stats); + b->ptr = p; + assert(b->prev); + if (b->prev) ((GDrawHandle*)b->prev)->raw_ptr = p; + } + + // re-insert into hash table + h = gfxalloc_get_hash_code(alloc, p); + b->next = alloc->hash[h]; + alloc->hash[h] = b; + + p += b->size; + } else { + // free block: remove it from the physical block list + b->prev_phys->next_phys = b->next_phys; + b->next_phys->prev_phys = b->prev_phys; + gfxalloc_rem_free(alloc, b); + gfxalloc_push_unused(alloc, b); + } + } + // the free list should be empty now + assert(alloc->blocks[0].next == &alloc->blocks[0]); + + // unless all memory is allocated, we now need to add a new block for the + // free space at the end + if (p != alloc->mem_end) { + b = gfxalloc_pop_unused(alloc); + + b->ptr = p; + b->prev_phys = alloc->blocks[0].prev_phys; + b->next_phys = &alloc->blocks[0]; + b->prev_phys->next_phys = b; + b->next_phys->prev_phys = b; + b->size = alloc->mem_end - p; + gfxalloc_add_free(alloc, b); + } + + GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == + alloc->num_alloc + alloc->num_free + + alloc->num_unused);) + GFXALLOC_IF_CHECK( + GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks + 1);) +} + +#endif + +#if defined(GDRAW_MANAGE_MEM_TWOPOOL) + +// Defragmentation code for graphics memory, using two-pool strategy. +// +// The platform implementation must provide a GPU memcpy function and handle +// all necessary synchronization. It must also adjust its resource descriptors +// to match the new addresses after defragmentation. +// +// The high concept for two-pool is that we can't update the resource pools +// mid-frame; instead, while preparing for a frame, we need to produce a memory +// configuration that is suitable for rendering a whole frame at once (in +// contrast to our normal incremental strategy, where we can decide to +// defragment mid-frame if things are getting desperate). This is for tiled +// renderers. +// +// Two-pool works like this: +// - As the name suggests, each handle cache has two memory pools and +// corresponding backing +// allocators. The currently used allocator, "alloc", and a second allocator, +// "alloc_other". +// - Any resource used in a command buffer gets locked and *stays locked* until +// we're done +// preparing that command buffer (i.e. no unlocking after every draw as in the +// normal incremental memory management). +// - All allocations happen from "alloc", always. We mostly do our normal LRU +// cache freeing +// to make space when required. +// - We can still run out of space (no surprise) and get into a configuration +// where we have +// to defragment. This is the only tricky part, and where the second pool +// comes in. To defragment, we switch the roles of "alloc" and "alloc_other", +// and allocate new backing storage for all currently "locked" and "pinned" +// resources (i.e. everything we've used in the currently pending frame). +// - In general, we have the invariant that all resources we're using for +// batches we're +// working on must be in the "alloc" (fresh) pool, not in the "other" (stale) +// pool. Therefore, after a defragment/pool switch, any "live" resource (which +// means it's present in the stale pool) has to be copied to the "fresh" pool +// as it's getting locked to maintain this invariant. +// +// What this does is give us a guarantee that any given frame either only +// references resources in one pool (the common case), or does a defragment, in +// which case it looks like this: +// +// +------------------------------+ +// | | +// | | pool A is fresh (=alloc), pool B is stale +// (=alloc_other) | | all resources referenced +// in here are in pool A | | | | | | +// +------------------------------+ <-- defragment! pools flip roles here +// | | +// | | +// | | pool B is fresh (=alloc), pool A is stale +// (=alloc_other) | | all resources referenced +// in here are in pool B | | +// +------------------------------+ +// +// Now, at the end of the frame, we need to decide what to do with the +// resources that remain "live" (i.e. they're in the old pool but weren't +// referenced in the current frame so they didn't get copied). As of this +// writing, we simply free them, to maximize the amount of free memory in the +// new pool (and hopefully minimize the chance that we'll have to defragment +// again soon). It would also be possible to copy some of them though, assuming +// there's enough space. +// +// Freeing resources is an interesting case. When the CPU side of GDraw does a +// "free", we can't immediately reclaim the resource memory, since the GPU will +// generally still have outstanding commands that reference that resource. So +// our freed resources first enter the "Dead" state and only actually get freed +// once the GPU is done with them. What this means is that the list of +// resources in the "dead" state can end up holding references to both the +// fresh and the stale pool; the free implementation needs to be aware of this +// and return the memory to the right allocator. +// +// When we defragment, it's important to make sure that the pool we're flipping +// to is actually empty. What this means is that right before a defragment, we +// need to wait for all stale "dead" resources to actually become free. If the +// last defragment was several frames ago, this is fast - we haven't generated +// any new commands referencing the stale resources in several frames, so most +// likely they're all immediately free-able. By contrast, if we just +// defragmented last frame, this will be a slow operation since we need to wait +// for the GPU pipeline to drain - but if you're triggering defragments in +// several consecutive frames, you're thrashing the resource pools badly and +// are getting really bad performance anyway. + +static void gdraw_gpu_memcpy(GDrawHandleCache* c, void* dst, void* src, + U32 num_bytes); +static void gdraw_gpu_wait_for_transfer_completion(); +static void gdraw_resource_moved(GDrawHandle* t); + +static rrbool gdraw_CanDefragment(GDrawHandleCache* c) { + // we can defragment (and extract some gain from it) if and only if there's + // more than one free block. since gfxalloc coalesces free blocks + // immediately and keeps them in a circular linked list, this is very easy + // to detect: just check if the "next" pointer of the first free block + // points to the sentinel. (this is only the case if there are 0 or 1 free + // blocks) + gfx_allocator* alloc = c->alloc; + if (!c->alloc_other) // if we don't have a second pool, we can't defrag at + // all. + return false; + return alloc->blocks[0].next->next != alloc->blocks; +} + +static rrbool gdraw_MigrateResource(GDrawHandle* t, GDrawStats* stats) { + GDrawHandleCache* c = t->cache; + void* ptr = NULL; + + assert(t->state == GDRAW_HANDLE_STATE_live || + t->state == GDRAW_HANDLE_STATE_locked || + t->state == GDRAW_HANDLE_STATE_pinned); + // anything we migrate should be in the "other" (old) pool + assert(gfxalloc_mem_contains(c->alloc_other, t->raw_ptr)); + + ptr = gfxalloc_alloc(c->alloc, t->bytes); + if (ptr) { + // update stats + stats->nonzero_flags |= GDRAW_STATS_defrag; + stats->defrag_objects += 1; + stats->defrag_bytes += t->bytes; + + // copy contents to new storage + gdraw_gpu_memcpy(c, ptr, t->raw_ptr, t->bytes); + + // free old storage + gfxalloc_free(c->alloc_other, t->raw_ptr); + + // adjust pointers to point to new location + t->raw_ptr = ptr; + gdraw_resource_moved(t); + + return true; + } else + return false; +} + +static rrbool gdraw_MigrateAllResources(GDrawHandle* sentinel, + GDrawStats* stats) { + GDrawHandle* h; + for (h = sentinel->next; h != sentinel; h = h->next) { + if (!gdraw_MigrateResource(h, stats)) return false; + } + return true; +} + +static rrbool gdraw_TwoPoolDefragmentMain(GDrawHandleCache* c, + GDrawStats* stats) { + gfx_allocator* t; + + // swap allocators + t = c->alloc; + c->alloc = c->alloc_other; + c->alloc_other = t; + + // immediately migrate all currently pinned and locked resources + rrbool ok = true; + ok = ok && + gdraw_MigrateAllResources(&c->state[GDRAW_HANDLE_STATE_pinned], stats); + ok = ok && + gdraw_MigrateAllResources(&c->state[GDRAW_HANDLE_STATE_locked], stats); + + return ok; +} + +static rrbool gdraw_StateListIsEmpty(GDrawHandle* head) { + // a list is empty when the head sentinel is the only node + return head->next == head; +} + +static void gdraw_CheckAllPointersUpdated(GDrawHandle* head) { +#if defined(GDRAW_DEBUG) + GDrawHandle* h; + for (h = head->next; h != head; h = h->next) { + assert(gfxalloc_mem_contains(h->cache->alloc, h->raw_ptr)); + } +#endif +} + +static void gdraw_PostDefragmentCleanup(GDrawHandleCache* c, + GDrawStats* stats) { + // if we defragmented during this scene, this is the spot where + // we need to nuke all references to resources that weren't + // carried over into the new pool. + if (c->did_defragment) { + GDrawHandle* h; + + // alloc list should be empty at this point + assert(gdraw_StateListIsEmpty(&c->state[GDRAW_HANDLE_STATE_alloc])); + + // free all remaining live resources (these are the resources we didn't + // touch this frame, hence stale) + h = &c->state[GDRAW_HANDLE_STATE_live]; + while (!gdraw_StateListIsEmpty(h)) gdraw_res_free(h->next, stats); + + // "live" is now empty, and we already checked that "alloc" was empty + // earlier. "dead" may hold objects on the old heap still (that were + // freed before we swapped allocators). "user owned" is not managed by + // us. that leaves "locked" and "pinned" resources, both of which better + // be only pointing into the new heap now! + gdraw_CheckAllPointersUpdated(&c->state[GDRAW_HANDLE_STATE_locked]); + gdraw_CheckAllPointersUpdated(&c->state[GDRAW_HANDLE_STATE_pinned]); + + gdraw_gpu_wait_for_transfer_completion(); + } +} + +#endif + +// Image processing code + +// Compute average of 4 RGBA8888 pixels passed as U32. +// Variables are named assuming the values are stored as big-endian, but all +// bytes are treated equally, so this code will work just fine on little-endian +// data. +static U32 gdraw_Avg4_rgba8888(U32 p0, U32 p1, U32 p2, U32 p3) { + U32 mask = 0x00ff00ff; + U32 bias = 0x00020002; + + U32 gasum = ((p0 >> 0) & mask) + ((p1 >> 0) & mask) + ((p2 >> 0) & mask) + + ((p3 >> 0) & mask) + bias; + U32 rbsum = ((p0 >> 8) & mask) + ((p1 >> 8) & mask) + ((p2 >> 8) & mask) + + ((p3 >> 8) & mask) + bias; + + return ((gasum >> 2) & mask) | ((rbsum << 6) & ~mask); +} + +// Compute average of 2 RGBA8888 pixels passed as U32 +static U32 gdraw_Avg2_rgba8888(U32 p0, U32 p1) { + return (p0 | p1) - (((p0 ^ p1) >> 1) & 0x7f7f7f7f); +} + +// 2:1 downsample in both horizontal and vertical direction, for one line. +// width is width of destination line. +static void gdraw_Downsample_2x2_line(U8* dst, U8* line0, U8* line1, U32 width, + U32 bpp) { + U32 x; + if (bpp == 4) { + U32* in0 = (U32*)line0; + U32* in1 = (U32*)line1; + U32* out = (U32*)dst; + for (x = 0; x < width; x++, in0 += 2, in1 += 2) + *out++ = gdraw_Avg4_rgba8888(in0[0], in0[1], in1[0], in1[1]); + } else if (bpp == 1) { + for (x = 0; x < width; x++, line0 += 2, line1 += 2) + *dst++ = (line0[0] + line0[1] + line1[0] + line1[1] + 2) / 4; + } else + RR_BREAK(); +} + +// 2:1 downsample in horizontal but not vertical direction. +static void gdraw_Downsample_2x1_line(U8* dst, U8* src, U32 width, U32 bpp) { + U32 x; + if (bpp == 4) { + U32* in = (U32*)src; + U32* out = (U32*)dst; + for (x = 0; x < width; x++, in += 2) + *out++ = gdraw_Avg2_rgba8888(in[0], in[1]); + } else if (bpp == 1) { + for (x = 0; x < width; x++, src += 2) + *dst++ = (src[0] + src[1] + 1) / 2; + } else + RR_BREAK(); +} + +// 2:1 downsample in vertical but not horizontal direction. +static void gdraw_Downsample_1x2(U8* dst, S32 dstpitch, U8* src, S32 srcpitch, + U32 height, U32 bpp) { + U32 y; + if (bpp == 4) { + for (y = 0; y < height; y++, dst += dstpitch, src += 2 * srcpitch) + *((U32*)dst) = + gdraw_Avg2_rgba8888(*((U32*)src), *((U32*)(src + srcpitch))); + } else if (bpp == 1) { + for (y = 0; y < height; y++, dst += dstpitch, src += 2 * srcpitch) + *dst = (src[0] + src[srcpitch] + 1) / 2; + } else + RR_BREAK(); +} + +// 2:1 downsample (for mipmaps) +// dst: Pointer to destination buffer +// dstpitch: Pitch for destination buffer +// width: Width of *destination* image (i.e. downsampled version) +// height: Height of *destination* image (i.e. downsampled version) +// src: Pointer to source buffer +// srcpitch: Pitch of source buffer +// bpp: Bytes per pixel for image data +// +// can be used for in-place resizing if src==dst and dstpitch <= srcpitch! +static GDRAW_MAYBE_UNUSED void gdraw_Downsample(U8* dst, S32 dstpitch, + U32 width, U32 height, U8* src, + S32 srcpitch, U32 bpp) { + U32 y; + assert(bpp == 1 || bpp == 4); + + // @TODO gamma? + if (!height) // non-square texture, height was reduced to 1 in a previous + // step + gdraw_Downsample_2x1_line(dst, src, width, bpp); + else if (!width) // non-square texture, width was reduced to 1 in a + // previous step + gdraw_Downsample_1x2(dst, dstpitch, src, srcpitch, height, bpp); + else { + for (y = 0; y < height; y++) { + gdraw_Downsample_2x2_line(dst, src, src + srcpitch, width, bpp); + dst += dstpitch; + src += 2 * srcpitch; + } + } +} + +#if !defined(GDRAW_NO_STREAMING_MIPGEN) + +#define GDRAW_MAXMIPS 16 // maximum number of mipmaps supported. + +typedef struct GDrawMipmapContext { + U32 width; // width of the texture being mipmapped + U32 height; // height of the texture being mipmapped + U32 mipmaps; // number of mipmaps + U32 bpp; // bytes per pixel + + U32 partial_row; // bit N: is mipmap N currently storing a partial row? + U32 bheight; // height of the buffer at miplevel 0 + U8* pixels[GDRAW_MAXMIPS]; + U32 pitch[GDRAW_MAXMIPS]; +} GDrawMipmapContext; + +static rrbool gdraw_MipmapBegin(GDrawMipmapContext* c, U32 width, U32 height, + U32 mipmaps, U32 bpp, U8* buffer, + U32 buffer_size) { + U32 i; + U8* p; + + if (mipmaps > GDRAW_MAXMIPS) return false; + + c->width = width; + c->height = height; + c->mipmaps = mipmaps; + c->bpp = bpp; + c->partial_row = 0; + + // determine how many lines to buffer + // we try to use roughly 2/3rds of the buffer for the first miplevel (less + // than 3/4 since with our partial line buffers, we have extra buffer space + // for lower mip levels). + c->bheight = (2 * buffer_size) / (3 * width * bpp); + + // round down to next-smaller power of 2 (in case we need to swizzle; + // swizzling works on pow2-sized blocks) + while (c->bheight & (c->bheight - 1)) // while not a power of 2... + c->bheight &= c->bheight - 1; // clear least significant bit set + + // then keep lowering the number of buffered lines until they fit (or we + // reach zero, i.e. it doesn't fit) + while (c->bheight) { + p = buffer; + for (i = 0; i < c->mipmaps; i++) { + U32 mw = c->width >> i; + U32 bh = c->bheight >> i; + if (!mw) mw++; + if (!bh) mw *= 2, bh++; // need space for line of previous miplevel + + c->pixels[i] = p; + c->pitch[i] = mw * bpp; + p += c->pitch[i] * bh; + } + + // if it fits, we're done + if (p <= buffer + buffer_size) { + if (c->bheight > + height) // buffer doesn't need to be larger than the image! + c->bheight = height; + return true; + } + + // need to try a smaller line buffer... + c->bheight >>= 1; + } + + // can't fit even one line into our buffer. ouch! + return false; +} + +// returns true if there was data generated for this miplevel, false otherwise. +static rrbool gdraw_MipmapAddLines(GDrawMipmapContext* c, U32 level) { + U32 bw, bh; + + assert(level > 0); // doesn't make sense to call this on level 0 + if (level == 0 || level >= c->mipmaps) + return false; // this level doesn't exist + + bw = c->width >> level; // buffer width at this level + bh = c->bheight >> level; // buffer height at this level + + if (bh) { // we can still do regular downsampling + gdraw_Downsample(c->pixels[level], c->pitch[level], bw, bh, + c->pixels[level - 1], c->pitch[level - 1], c->bpp); + return true; + } else if (c->height >> level) { // need to buffer partial lines, but still + // doing vertical 2:1 downsampling + if ((c->partial_row ^= (1 << level)) & + (1 << level)) { // no buffered partial row for this miplevel yet, + // make one + memcpy(c->pixels[level], c->pixels[level - 1], bw * 2 * c->bpp); + return false; + } else { // have one buffered row, can generate output pixels + gdraw_Downsample_2x2_line(c->pixels[level], c->pixels[level], + c->pixels[level - 1], bw, c->bpp); + return true; + } + } else { // finish off with a chain of Nx1 miplevels + gdraw_Downsample_2x1_line(c->pixels[level], c->pixels[level - 1], bw, + c->bpp); + return true; + } +} + +#endif + +#if defined(GDRAW_CHECK_BLOCK) +static void check_block_alloc(gfx_allocator* alloc, void* ptr, + rrbool allocated) { + int i, n = 0, m = 0; + for (i = 0; i < GFXALLOC_HASH_SIZE; ++i) { + gfx_block_info* b = alloc->hash[i]; + while (b) { + if (b->ptr == ptr) ++n; + b = b->next; + } + } + gfx_block_info* b = alloc->blocks[0].next; + while (b != &alloc->blocks[0]) { + if (b->ptr == ptr) ++m; + b = b->next; + } + if (allocated) + assert(n == 1 && m == 0); + else + assert(n == 0 && m == 1); +} +#else +#define check_block_alloc(a, p, f) +#endif + +#if defined(GDRAW_BUFFER_RING) + +//////////////////////////////////////////////////////////////////////// +// +// Buffer ring +// + +// Implements a dynamic buffer backed by multiple physical buffers, with +// the usual append-only, DISCARD/NOOVERWRITE semantics. +// +// This can be used for dynamic vertex buffers, constant buffers, etc. +#define GDRAW_BUFRING_MAXSEGS 4 // max number of backing segments + +typedef struct gdraw_bufring_seg { + struct gdraw_bufring_seg* next; // next segment in ring + U8* data; // pointer to the allocation + GDrawFence fence; // fence for this segment + U32 used; // number of bytes used +} gdraw_bufring_seg; + +typedef struct gdraw_bufring { + gdraw_bufring_seg* cur; // active ring segment + U32 seg_size; // size of one segment + U32 align; // alignment of segment allocations + gdraw_bufring_seg all_segs[GDRAW_BUFRING_MAXSEGS]; +} gdraw_bufring; + +// forwards +static GDrawFence put_fence(); +static void wait_on_fence(GDrawFence fence); + +static void gdraw_bufring_init(gdraw_bufring* RADRESTRICT ring, void* ptr, + U32 size, U32 nsegs, U32 align) { + U32 i, seg_size; + + ring->seg_size = 0; + if (!ptr || nsegs < 1 || + size < nsegs * align) // bail if no ring buffer memory or too small + return; + + if (nsegs > GDRAW_BUFRING_MAXSEGS) nsegs = GDRAW_BUFRING_MAXSEGS; + + // align needs to be a positive power of two + assert(align >= 1 && (align & (align - 1)) == 0); + + // buffer really needs to be properly aligned + assert(((UINTa)ptr & (align - 1)) == 0); + + seg_size = (size / nsegs) & ~(align - 1); + for (i = 0; i < nsegs; ++i) { + ring->all_segs[i].next = &ring->all_segs[(i + 1) % nsegs]; + ring->all_segs[i].data = (U8*)ptr + i * seg_size; + ring->all_segs[i].fence.value = 0; + ring->all_segs[i].used = 0; + } + + ring->cur = ring->all_segs; + ring->seg_size = seg_size; + ring->align = align; +} + +static void gdraw_bufring_shutdown(gdraw_bufring* RADRESTRICT ring) { + ring->cur = NULL; + ring->seg_size = 0; +} + +static void* gdraw_bufring_alloc(gdraw_bufring* RADRESTRICT ring, U32 size, + U32 align) { + U32 align_up; + gdraw_bufring_seg* seg; + + if (size > ring->seg_size) return NULL; // nope, won't fit + + assert(align <= ring->align); + + // check if it fits in the active segment first + seg = ring->cur; + align_up = (seg->used + align - 1) & -align; + + if ((align_up + size) <= ring->seg_size) { + void* ptr = seg->data + align_up; + seg->used = align_up + size; + return ptr; + } + + // doesn't fit, we have to start a new ring segment. + seg->fence = put_fence(); + + // switch to the next segment, wait till GPU is done with it + seg = ring->cur = seg->next; + wait_on_fence(seg->fence); + + // allocate from the new segment. we assume that segment offsets + // satisfy the highest alignment requirements we ever ask for! + seg->used = size; + return seg->data; +} + +#endif + +//////////////////////////////////////////////////////////////////////// +// +// General resource manager +// + +#if !defined(GDRAW_FENCE_FLUSH) +#define GDRAW_FENCE_FLUSH() +#endif + +#if defined(GDRAW_MANAGE_MEM) +// functions the platform must implement +#if !defined(GDRAW_BUFFER_RING // avoid "redundant redeclaration" warning) +static void wait_on_fence(GDrawFence fence); +#endif +static rrbool is_fence_pending(GDrawFence fence); +static void gdraw_defragment_cache(GDrawHandleCache* c, GDrawStats* stats); + +// functions we implement +static void gdraw_res_reap(GDrawHandleCache* c, GDrawStats* stats); +#endif + +// If GDRAW_MANAGE_MEM is not #defined, this needs to perform the +// actual free using whatever API we're targeting. +// +// If GDRAW_MANAGE_MEM is #defined, the shared code handles the +// memory management part, but you might still need to update +// your state caching. +static void api_free_resource(GDrawHandle* r); + +// Actually frees a resource and releases all allocated resources +static void gdraw_res_free(GDrawHandle* r, GDrawStats* stats) { + assert(r->state == GDRAW_HANDLE_STATE_live || + r->state == GDRAW_HANDLE_STATE_locked || + r->state == GDRAW_HANDLE_STATE_dead || + r->state == GDRAW_HANDLE_STATE_pinned || + r->state == GDRAW_HANDLE_STATE_user_owned); + +#if defined(GDRAW_MANAGE_MEM) + GDRAW_FENCE_FLUSH(); + + // make sure resource isn't in use before we actually free the memory + wait_on_fence(r->fence); + if (r->raw_ptr) { +#if !defined(GDRAW_MANAGE_MEM_TWOPOOL) + gfxalloc_free(r->cache->alloc, r->raw_ptr); +#else + GDrawHandleCache* c = r->cache; + if (gfxalloc_mem_contains(c->alloc, r->raw_ptr)) + gfxalloc_free(c->alloc, r->raw_ptr); + else { + assert(gfxalloc_mem_contains(c->alloc_other, r->raw_ptr)); + gfxalloc_free(c->alloc_other, r->raw_ptr); + } +#endif + } +#endif + + api_free_resource(r); + + stats->nonzero_flags |= GDRAW_STATS_frees; + stats->freed_objects += 1; + stats->freed_bytes += r->bytes; + + gdraw_HandleCacheFree(r); +} + +// Frees the LRU resource in the given cache. +static rrbool gdraw_res_free_lru(GDrawHandleCache* c, GDrawStats* stats) { + GDrawHandle* r = gdraw_HandleCacheGetLRU(c); + if (!r) return false; + + if (c->is_vertex && r->owner) // check for r->owner since it may already be + // killed (if player destroyed first) + IggyDiscardVertexBufferCallback(r->owner, r); + + // was it referenced since end of previous frame (=in this frame)? + // if some, we're thrashing; report it to the user, but only once per frame. + if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { + IggyGDrawSendWarning(NULL, c->is_vertex + ? "GDraw Thrashing vertex memory" + : "GDraw Thrashing texture memory"); + c->is_thrashing = true; + } + + gdraw_res_free(r, stats); + return true; +} + +static void gdraw_res_flush(GDrawHandleCache* c, GDrawStats* stats) { + c->is_thrashing = true; // prevents warnings being generated from free_lru + gdraw_HandleCacheUnlockAll(c); + while (gdraw_res_free_lru(c, stats)); +} + +static GDrawHandle* gdraw_res_alloc_outofmem(GDrawHandleCache* c, + GDrawHandle* t, + char const* failed_type) { + if (t) gdraw_HandleCacheAllocateFail(t); + IggyGDrawSendWarning(NULL, + c->is_vertex ? "GDraw Out of static vertex buffer %s" + : "GDraw Out of texture %s", + failed_type); + return NULL; +} + +#if !defined(GDRAW_MANAGE_MEM) + +static GDrawHandle* gdraw_res_alloc_begin(GDrawHandleCache* c, S32 size, + GDrawStats* stats) { + GDrawHandle* t; + if (size > c->total_bytes) + gdraw_res_alloc_outofmem( + c, NULL, "memory (single resource larger than entire pool)"); + else { + // given how much data we're going to allocate, throw out + // data until there's "room" (this basically lets us use + // managed memory and just bound our usage, without actually + // packing it and being exact) + while (c->bytes_free < size) { + if (!gdraw_res_free_lru(c, stats)) { + gdraw_res_alloc_outofmem(c, NULL, "memory"); + break; + } + } + } + + // now try to allocate a handle + t = gdraw_HandleCacheAllocateBegin(c); + if (!t) { + // it's possible we have no free handles, because all handles + // are in use without exceeding the max storage above--in that + // case, just free one texture to give us a free handle (ideally + // we'd trade off cost of regenerating) + if (gdraw_res_free_lru(c, stats)) { + t = gdraw_HandleCacheAllocateBegin(c); + if (t == NULL) { + gdraw_res_alloc_outofmem(c, NULL, "handles"); + } + } + } + return t; +} + +#else + +// Returns whether this resource holds pointers to one of the GDraw-managed +// pools. +static rrbool gdraw_res_is_managed(GDrawHandle* r) { + return r->state == GDRAW_HANDLE_STATE_live || + r->state == GDRAW_HANDLE_STATE_locked || + r->state == GDRAW_HANDLE_STATE_dead || + r->state == GDRAW_HANDLE_STATE_pinned; +} + +// "Reaps" dead resources. Even if the user requests that a +// resource be freed, it might still be in use in a pending +// command buffer. So we can't free the associated memory +// immediately; instead, we flag the resource as "dead" and +// periodically check whether we can actually free the +// pending memory of dead resources ("reap" them). +static void gdraw_res_reap(GDrawHandleCache* c, GDrawStats* stats) { + GDrawHandle* sentinel = &c->state[GDRAW_HANDLE_STATE_dead]; + GDrawHandle* t; + GDRAW_FENCE_FLUSH(); + + // reap all dead resources that aren't in use anymore + while ((t = sentinel->next) != sentinel && !is_fence_pending(t->fence)) + gdraw_res_free(t, stats); +} + +// "Kills" a resource. This means GDraw won't use it anymore +// (it's dead), but there might still be outstanding references +// to it in a pending command buffer, so we can't physically +// free the associated memory until that's all processed. +static void gdraw_res_kill(GDrawHandle* r, GDrawStats* stats) { + GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all + // fence values are current. + + r->owner = NULL; + gdraw_HandleCacheInsertDead(r); + gdraw_res_reap(r->cache, stats); +} + +static GDrawHandle* gdraw_res_alloc_begin(GDrawHandleCache* c, S32 size, + GDrawStats* stats) { + GDrawHandle* t; + void* ptr = NULL; + + gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); + if (size > c->total_bytes) + return gdraw_res_alloc_outofmem( + c, NULL, "memory (single resource larger than entire pool)"); + + // now try to allocate a handle + t = gdraw_HandleCacheAllocateBegin(c); + if (!t) { + // it's possible we have no free handles, because all handles + // are in use without exceeding the max storage above--in that + // case, just free one texture to give us a free handle (ideally + // we'd trade off cost of regenerating) + gdraw_res_free_lru(c, stats); + t = gdraw_HandleCacheAllocateBegin(c); + if (!t) return gdraw_res_alloc_outofmem(c, NULL, "handles"); + } + + // try to allocate first + if (size) { + ptr = gfxalloc_alloc(c->alloc, size); + if (!ptr) { + // doesn't currently fit. try to free some allocations to get space + // to breathe. + S32 want_free = RR_MAX(size + (size / 2), GDRAW_MIN_FREE_AMOUNT); + if (want_free > c->total_bytes) + want_free = size; // okay, *really* big resource, just try to + // allocate its real size + + // always keep freeing textures until want_free bytes are free. + while (c->alloc->actual_bytes_free < want_free) { + if (!gdraw_res_free_lru(c, stats)) + return gdraw_res_alloc_outofmem(c, t, "memory"); + } + + // now, keep trying to allocate and free some more memory when it + // still doesn't fit + while (!(ptr = gfxalloc_alloc(c->alloc, size))) { + if (c->alloc->actual_bytes_free >= + 3 * size || // if we should have enough free bytes to + // satisfy the request by now + (c->alloc->actual_bytes_free >= size && + size * 2 >= + c->total_bytes)) // or the resource is very big and + // the alloc doesn't fit + { + // before we actually consider defragmenting, we want to + // free all stale resources (not referenced in the previous + // 2 frames). and if that frees up enough memory so we don't + // have to defragment, all the better! also, never + // defragment twice in a frame, just assume we're thrashing + // when we get in that situation and free up as much as + // possible. + if (!c->did_defragment && + c->prev_frame_start.value <= c->handle->fence.value) { + // defragment. + defrag: + if (gdraw_CanDefragment( + c)) { // only try defrag if it has a chance of + // helping. + gdraw_defragment_cache(c, stats); + c->did_defragment = true; + } + ptr = gfxalloc_alloc(c->alloc, size); + if (!ptr) + return gdraw_res_alloc_outofmem( + c, t, "memory (fragmentation)"); + break; + } + } + + // keep trying to free some more + if (!gdraw_res_free_lru(c, stats)) { + if (c->alloc->actual_bytes_free >= + size) // nothing left to free but we should be good - + // defrag again, even if it's the second time in + // a frame + goto defrag; + + return gdraw_res_alloc_outofmem(c, t, "memory"); + } + } + } + } + + t->fence.value = 0; // hasn't been used yet + t->raw_ptr = ptr; + return t; +} + +#endif \ No newline at end of file diff --git a/targets/app/common/Iggy/include/iggy.h b/targets/app/common/Iggy/include/iggy.h index 188064dac..21f839c8f 100644 --- a/targets/app/common/Iggy/include/iggy.h +++ b/targets/app/common/Iggy/include/iggy.h @@ -126,6 +126,7 @@ typedef enum IggyDatatype { #include IDOCN typedef char IggyUTF16; #else +#include typedef const char16_t IggyUTF16; #endif diff --git a/targets/app/common/UI/ConsoleUIController.cpp b/targets/app/common/UI/ConsoleUIController.cpp index 030342608..a72817a6c 100644 --- a/targets/app/common/UI/ConsoleUIController.cpp +++ b/targets/app/common/UI/ConsoleUIController.cpp @@ -12,7 +12,7 @@ #endif #include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" -#include "app/windows/Iggy/include/gdraw.h" +#include "app/common/Iggy/include/gdraw.h" ConsoleUIController ui; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index d4cfc9edf..6a8c6b5b9 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -58,19 +58,12 @@ class Tutorial; // #define EXCLUDE_IGGY_ALLOCATIONS_FROM_HEAP_INSPECTOR // #define ENABLE_IGGY_EXPLORER -#if defined(ENABLE_IGGY_EXPLORER) -#include "app/windows/Iggy/include/iggyexpruntime.h" -#endif // #define ENABLE_IGGY_PERFMON #if defined(ENABLE_IGGY_PERFMON) #define PM_ORIGIN_X 24 -#define PM_ORIGIN_Y 34 - -#if defined(__WINDOWS64) -#include "app/windows/Iggy/include/iggyperfmon.h" -#endif +#define PM_ORIGIN_ #endif From 347265c3622800075478edcd7be0aa21a66d0013 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 00:22:58 -0500 Subject: [PATCH 080/104] chore: format repo, add format script --- scripts/find_dead_app_includes.py | 182 ------------ scripts/format.py | 183 ++++++++++++ scripts/sweep_linuxgame_includes.py | 108 ------- scripts/sweep_winapi_stubs_includes.py | 126 -------- targets/app/common/App_structs.h | 4 +- targets/app/common/Audio/SoundEngine.cpp | 5 +- targets/app/common/Audio/SoundEngine.h | 2 +- targets/app/common/DLC/DLCGameRulesHeader.cpp | 2 +- targets/app/common/DLC/DLCManager.cpp | 4 +- targets/app/common/Game.cpp | 94 +++--- targets/app/common/Game.h | 6 +- .../app/common/GameRules/GameRuleManager.cpp | 4 +- .../ApplySchematicRuleDefinition.cpp | 2 +- .../ApplySchematicRuleDefinition.h | 2 +- .../ConsoleGenerateStructure.cpp | 2 +- .../LevelGenerationOptions.cpp | 4 +- .../XboxStructureActionGenerateBox.cpp | 2 +- .../XboxStructureActionPlaceBlock.cpp | 2 +- .../XboxStructureActionPlaceContainer.cpp | 2 +- .../CompleteAllRuleDefinition.cpp | 2 +- .../RuleDefinitions/GameRuleDefinition.cpp | 2 +- .../UpdatePlayerRuleDefinition.cpp | 2 +- targets/app/common/GameSettingsManager.cpp | 1 - targets/app/common/Game_XuiActions.cpp | 25 +- targets/app/common/Iggy/gdraw/gdraw.c | 2 +- targets/app/common/Iggy/gdraw/gdraw.h | 2 +- targets/app/common/Iggy/iggy_stubs.h | 3 +- targets/app/common/Iggy/include/iggy.h | 13 +- targets/app/common/LocalizationManager.cpp | 2 +- targets/app/common/MenuController.cpp | 3 +- .../app/common/Network/GameNetworkManager.cpp | 23 +- .../app/common/Network/GameNetworkManager.h | 5 +- targets/app/common/NetworkController.cpp | 1 - targets/app/common/NetworkController.h | 2 +- targets/app/common/SaveManager.cpp | 1 - .../Constraints/ChangeStateConstraint.cpp | 4 +- .../Constraints/ChangeStateConstraint.h | 2 +- targets/app/common/Tutorial/FullTutorial.cpp | 2 +- .../app/common/Tutorial/Hints/AreaHint.cpp | 2 +- targets/app/common/Tutorial/Hints/AreaHint.h | 2 +- .../common/Tutorial/Hints/DiggerItemHint.cpp | 2 +- .../common/Tutorial/Hints/LookAtEntityHint.h | 4 +- .../common/Tutorial/Hints/LookAtTileHint.cpp | 2 +- .../common/Tutorial/Hints/LookAtTileHint.h | 2 +- .../common/Tutorial/Hints/TakeItemHint.cpp | 2 +- .../app/common/Tutorial/Hints/TakeItemHint.h | 2 +- .../common/Tutorial/Hints/TutorialHint.cpp | 2 +- .../app/common/Tutorial/Hints/TutorialHint.h | 2 +- .../app/common/Tutorial/Tasks/ChoiceTask.cpp | 2 +- .../common/Tutorial/Tasks/ControllerTask.cpp | 2 +- .../common/Tutorial/Tasks/HorseChoiceTask.cpp | 4 +- .../common/Tutorial/Tasks/RideEntityTask.cpp | 2 +- targets/app/common/Tutorial/Tutorial.cpp | 6 +- .../IUIScene_AbstractContainerMenu.cpp | 8 +- .../IUIScene_AbstractContainerMenu.h | 2 +- .../UI/All Platforms/IUIScene_AnvilMenu.cpp | 2 +- .../UI/All Platforms/IUIScene_BeaconMenu.cpp | 4 +- .../All Platforms/IUIScene_CraftingMenu.cpp | 4 +- .../UI/All Platforms/IUIScene_CraftingMenu.h | 2 +- .../All Platforms/IUIScene_CreativeMenu.cpp | 4 +- .../common/UI/All Platforms/IUIScene_HUD.cpp | 13 +- .../UI/All Platforms/IUIScene_PauseMenu.cpp | 4 +- .../UI/All Platforms/IUIScene_TradingMenu.cpp | 4 +- .../UI/All Platforms/IUIScene_TradingMenu.h | 2 +- .../app/common/UI/All Platforms/UIStructs.h | 2 +- .../common/UI/Components/UIComponent_Chat.cpp | 2 +- .../common/UI/Components/UIComponent_Chat.h | 2 +- .../UIComponent_DebugUIMarketingGuide.cpp | 2 +- .../UIComponent_DebugUIMarketingGuide.h | 2 +- .../Components/UIComponent_MenuBackground.cpp | 2 +- .../Components/UIComponent_MenuBackground.h | 2 +- .../UI/Components/UIComponent_Panorama.cpp | 2 +- .../UI/Components/UIComponent_Panorama.h | 2 +- .../UIComponent_PressStartToPlay.cpp | 4 +- .../Components/UIComponent_PressStartToPlay.h | 2 +- .../UI/Components/UIComponent_Tooltips.cpp | 4 +- .../UI/Components/UIComponent_Tooltips.h | 2 +- .../Components/UIComponent_TutorialPopup.cpp | 6 +- .../UI/Components/UIComponent_TutorialPopup.h | 2 +- .../app/common/UI/Components/UIScene_HUD.cpp | 4 +- .../app/common/UI/Components/UIScene_HUD.h | 2 +- targets/app/common/UI/ConsoleUIController.cpp | 9 +- targets/app/common/UI/ConsoleUIController.h | 4 +- targets/app/common/UI/Controls/UIControl.cpp | 4 +- .../app/common/UI/Controls/UIControl_Base.cpp | 2 +- .../app/common/UI/Controls/UIControl_Base.h | 2 +- .../Controls/UIControl_BeaconEffectButton.cpp | 2 +- .../Controls/UIControl_BeaconEffectButton.h | 2 +- .../UI/Controls/UIControl_BitmapIcon.cpp | 2 +- .../common/UI/Controls/UIControl_BitmapIcon.h | 2 +- .../common/UI/Controls/UIControl_Button.cpp | 2 +- .../app/common/UI/Controls/UIControl_Button.h | 2 +- .../UI/Controls/UIControl_ButtonList.cpp | 2 +- .../common/UI/Controls/UIControl_ButtonList.h | 2 +- .../common/UI/Controls/UIControl_CheckBox.cpp | 2 +- .../common/UI/Controls/UIControl_CheckBox.h | 2 +- .../common/UI/Controls/UIControl_Cursor.cpp | 2 +- .../app/common/UI/Controls/UIControl_Cursor.h | 2 +- .../common/UI/Controls/UIControl_DLCList.cpp | 2 +- .../common/UI/Controls/UIControl_DLCList.h | 2 +- .../UI/Controls/UIControl_DynamicLabel.cpp | 2 +- .../UI/Controls/UIControl_DynamicLabel.h | 2 +- .../UI/Controls/UIControl_EnchantmentBook.cpp | 2 +- .../UI/Controls/UIControl_EnchantmentBook.h | 2 +- .../Controls/UIControl_EnchantmentButton.cpp | 2 +- .../UI/Controls/UIControl_EnchantmentButton.h | 2 +- .../UI/Controls/UIControl_HTMLLabel.cpp | 2 +- .../common/UI/Controls/UIControl_HTMLLabel.h | 2 +- .../common/UI/Controls/UIControl_Label.cpp | 2 +- .../app/common/UI/Controls/UIControl_Label.h | 2 +- .../UI/Controls/UIControl_LeaderboardList.cpp | 2 +- .../UI/Controls/UIControl_LeaderboardList.h | 2 +- .../UI/Controls/UIControl_MinecraftHorse.cpp | 2 +- .../UI/Controls/UIControl_MinecraftHorse.h | 2 +- .../UI/Controls/UIControl_MinecraftPlayer.cpp | 2 +- .../UI/Controls/UIControl_MinecraftPlayer.h | 2 +- .../UI/Controls/UIControl_PlayerList.cpp | 2 +- .../common/UI/Controls/UIControl_PlayerList.h | 2 +- .../Controls/UIControl_PlayerSkinPreview.cpp | 2 +- .../UI/Controls/UIControl_PlayerSkinPreview.h | 2 +- .../common/UI/Controls/UIControl_Progress.cpp | 2 +- .../common/UI/Controls/UIControl_Progress.h | 2 +- .../common/UI/Controls/UIControl_SaveList.cpp | 2 +- .../common/UI/Controls/UIControl_SaveList.h | 2 +- .../common/UI/Controls/UIControl_Slider.cpp | 4 +- .../app/common/UI/Controls/UIControl_Slider.h | 2 +- .../common/UI/Controls/UIControl_SlotList.cpp | 2 +- .../common/UI/Controls/UIControl_SlotList.h | 2 +- .../Controls/UIControl_SpaceIndicatorBar.cpp | 2 +- .../UI/Controls/UIControl_SpaceIndicatorBar.h | 2 +- .../UI/Controls/UIControl_TextInput.cpp | 2 +- .../common/UI/Controls/UIControl_TextInput.h | 2 +- .../UI/Controls/UIControl_TexturePackList.cpp | 2 +- .../UI/Controls/UIControl_TexturePackList.h | 2 +- .../common/UI/Controls/UIControl_Touch.cpp | 2 +- .../app/common/UI/Controls/UIControl_Touch.h | 2 +- .../Debug/UIScene_DebugCreateSchematic.cpp | 6 +- .../Debug/UIScene_DebugCreateSchematic.h | 2 +- .../UI/Scenes/Debug/UIScene_DebugOptions.cpp | 2 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.cpp | 4 +- .../UI/Scenes/Debug/UIScene_DebugOverlay.h | 2 +- .../Scenes/Debug/UIScene_DebugSetCamera.cpp | 6 +- .../UI/Scenes/Debug/UIScene_DebugSetCamera.h | 2 +- .../IUIScene_StartGame.cpp | 4 +- .../IUIScene_StartGame.h | 2 +- .../UIScene_CreateWorldMenu.cpp | 8 +- .../UIScene_CreateWorldMenu.h | 2 +- .../UIScene_DLCMainMenu.cpp | 4 +- .../UIScene_DLCMainMenu.h | 2 +- .../UIScene_DLCOffersMenu.cpp | 4 +- .../UIScene_DLCOffersMenu.h | 2 +- .../Frontend Menu screens/UIScene_EULA.cpp | 6 +- .../Frontend Menu screens/UIScene_EULA.h | 2 +- .../Frontend Menu screens/UIScene_Intro.cpp | 4 +- .../Frontend Menu screens/UIScene_Intro.h | 2 +- .../UIScene_JoinMenu.cpp | 8 +- .../Frontend Menu screens/UIScene_JoinMenu.h | 2 +- .../UIScene_LaunchMoreOptionsMenu.cpp | 6 +- .../UIScene_LaunchMoreOptionsMenu.h | 2 +- .../UIScene_LeaderboardsMenu.cpp | 22 +- .../UIScene_LeaderboardsMenu.h | 4 +- .../UIScene_LoadMenu.cpp | 8 +- .../Frontend Menu screens/UIScene_LoadMenu.h | 2 +- .../UIScene_LoadOrJoinMenu.cpp | 10 +- .../UIScene_LoadOrJoinMenu.h | 2 +- .../UIScene_MainMenu.cpp | 10 +- .../Frontend Menu screens/UIScene_MainMenu.h | 2 +- .../UIScene_NewUpdateMessage.cpp | 6 +- .../UIScene_NewUpdateMessage.h | 2 +- .../UIScene_SaveMessage.cpp | 6 +- .../UIScene_SaveMessage.h | 2 +- .../UIScene_TrialExitUpsell.cpp | 4 +- .../Help & Options/UIScene_ControlsMenu.cpp | 14 +- .../Help & Options/UIScene_ControlsMenu.h | 2 +- .../Scenes/Help & Options/UIScene_Credits.cpp | 4 +- .../Scenes/Help & Options/UIScene_Credits.h | 2 +- .../UIScene_HelpAndOptionsMenu.cpp | 6 +- .../UIScene_HelpAndOptionsMenu.h | 2 +- .../Help & Options/UIScene_HowToPlay.cpp | 6 +- .../Scenes/Help & Options/UIScene_HowToPlay.h | 2 +- .../Help & Options/UIScene_HowToPlayMenu.cpp | 10 +- .../Help & Options/UIScene_HowToPlayMenu.h | 2 +- .../UIScene_LanguageSelector.cpp | 6 +- .../Help & Options/UIScene_LanguageSelector.h | 4 +- .../Help & Options/UIScene_ReinstallMenu.cpp | 4 +- .../Help & Options/UIScene_ReinstallMenu.h | 2 +- .../UIScene_SettingsAudioMenu.cpp | 4 +- .../UIScene_SettingsAudioMenu.h | 2 +- .../UIScene_SettingsControlMenu.cpp | 4 +- .../UIScene_SettingsControlMenu.h | 2 +- .../UIScene_SettingsGraphicsMenu.cpp | 4 +- .../UIScene_SettingsGraphicsMenu.h | 2 +- .../Help & Options/UIScene_SettingsMenu.cpp | 6 +- .../Help & Options/UIScene_SettingsMenu.h | 2 +- .../UIScene_SettingsOptionsMenu.cpp | 6 +- .../UIScene_SettingsOptionsMenu.h | 2 +- .../Help & Options/UIScene_SettingsUIMenu.cpp | 4 +- .../Help & Options/UIScene_SettingsUIMenu.h | 2 +- .../Help & Options/UIScene_SkinSelectMenu.cpp | 6 +- .../Help & Options/UIScene_SkinSelectMenu.h | 2 +- .../UIScene_AbstractContainerMenu.cpp | 4 +- .../UIScene_AbstractContainerMenu.h | 2 +- .../Containers/UIScene_AnvilMenu.cpp | 6 +- .../Containers/UIScene_AnvilMenu.h | 2 +- .../Containers/UIScene_BeaconMenu.cpp | 6 +- .../Containers/UIScene_BeaconMenu.h | 2 +- .../Containers/UIScene_BrewingStandMenu.cpp | 6 +- .../Containers/UIScene_ContainerMenu.cpp | 4 +- .../Containers/UIScene_CreativeMenu.cpp | 8 +- .../Containers/UIScene_CreativeMenu.h | 2 +- .../Containers/UIScene_DispenserMenu.cpp | 4 +- .../Containers/UIScene_EnchantingMenu.cpp | 8 +- .../Containers/UIScene_EnchantingMenu.h | 2 +- .../Containers/UIScene_FireworksMenu.cpp | 4 +- .../Containers/UIScene_FireworksMenu.h | 2 +- .../Containers/UIScene_FurnaceMenu.cpp | 6 +- .../Containers/UIScene_HopperMenu.cpp | 4 +- .../Containers/UIScene_HorseInventoryMenu.cpp | 6 +- .../Containers/UIScene_HorseInventoryMenu.h | 2 +- .../Containers/UIScene_InventoryMenu.cpp | 6 +- .../Containers/UIScene_InventoryMenu.h | 2 +- .../Containers/UIScene_TradingMenu.cpp | 8 +- .../Containers/UIScene_TradingMenu.h | 2 +- .../UIScene_CraftingMenu.cpp | 8 +- .../UIScene_CraftingMenu.h | 2 +- .../UIScene_DeathMenu.cpp | 4 +- .../In-Game Menu Screens/UIScene_DeathMenu.h | 2 +- .../In-Game Menu Screens/UIScene_EndPoem.cpp | 4 +- .../In-Game Menu Screens/UIScene_EndPoem.h | 2 +- .../UIScene_InGameHostOptionsMenu.cpp | 6 +- .../UIScene_InGameHostOptionsMenu.h | 2 +- .../UIScene_InGameInfoMenu.cpp | 8 +- .../UIScene_InGameInfoMenu.h | 2 +- .../UIScene_InGamePlayerOptionsMenu.cpp | 6 +- .../UIScene_InGamePlayerOptionsMenu.h | 2 +- .../UIScene_PauseMenu.cpp | 6 +- .../In-Game Menu Screens/UIScene_PauseMenu.h | 2 +- .../UIScene_SignEntryMenu.cpp | 6 +- .../UIScene_SignEntryMenu.h | 2 +- .../UIScene_TeleportMenu.cpp | 8 +- .../UIScene_TeleportMenu.h | 2 +- .../UI/Scenes/UIScene_ConnectingProgress.cpp | 4 +- .../UI/Scenes/UIScene_ConnectingProgress.h | 2 +- .../UI/Scenes/UIScene_FullscreenProgress.cpp | 6 +- .../UI/Scenes/UIScene_FullscreenProgress.h | 2 +- .../app/common/UI/Scenes/UIScene_Keyboard.cpp | 4 +- .../app/common/UI/Scenes/UIScene_Keyboard.h | 2 +- .../common/UI/Scenes/UIScene_MessageBox.cpp | 4 +- .../app/common/UI/Scenes/UIScene_MessageBox.h | 2 +- .../UI/Scenes/UIScene_QuadrantSignin.cpp | 12 +- .../common/UI/Scenes/UIScene_QuadrantSignin.h | 2 +- targets/app/common/UI/UIBitmapFont.cpp | 2 +- targets/app/common/UI/UIController.cpp | 5 +- targets/app/common/UI/UIController.h | 7 +- targets/app/common/UI/UIGroup.cpp | 6 +- targets/app/common/UI/UIGroup.h | 2 +- targets/app/common/UI/UILayer.cpp | 6 +- targets/app/common/UI/UILayer.h | 2 +- targets/app/common/UI/UIScene.cpp | 6 +- targets/app/common/UI/UIScene.h | 8 +- targets/app/common/UI/UITTFFont.cpp | 2 +- targets/app/linux/main.cpp | 268 +++++++++--------- .../java/InputOutputStream/GZIPInputStream.h | 2 +- .../java/InputOutputStream/GZIPOutputStream.h | 2 +- targets/java/src/File.cpp | 13 +- targets/minecraft/BuildVer.h | 2 +- targets/minecraft/client/BufferedImage.h | 2 +- targets/minecraft/client/Minecraft.cpp | 24 +- targets/minecraft/client/Minecraft.h | 4 +- targets/minecraft/client/gui/Screen.cpp | 2 +- .../client/gui/achievement/StatsScreen.cpp | 3 +- targets/minecraft/client/model/BookModel.h | 2 +- targets/minecraft/client/model/OcelotModel.h | 2 +- .../client/multiplayer/ClientConnection.cpp | 49 ++-- .../multiplayer/MultiPlayerChunkCache.cpp | 4 +- .../multiplayer/MultiPlayerGameMode.cpp | 3 +- .../multiplayer/MultiPlayerLocalPlayer.cpp | 17 +- .../client/particle/FireworksParticles.cpp | 2 +- .../client/particle/ParticleEngine.cpp | 4 +- .../minecraft/client/player/LocalPlayer.cpp | 18 +- .../client/renderer/GameRenderer.cpp | 30 +- .../client/renderer/ItemInHandRenderer.cpp | 4 +- .../client/renderer/LevelRenderer.cpp | 16 +- .../minecraft/client/renderer/LevelRenderer.h | 2 +- .../minecraft/client/renderer/Textures.cpp | 8 +- .../client/renderer/entity/EntityRenderer.cpp | 6 +- .../renderer/entity/LivingEntityRenderer.cpp | 9 +- .../client/renderer/entity/MobRenderer.cpp | 2 +- .../client/renderer/entity/PlayerRenderer.cpp | 2 +- .../client/renderer/entity/ZombieRenderer.cpp | 2 +- .../renderer/tileentity/SkullTileRenderer.cpp | 4 +- .../minecraft/client/skins/DLCTexturePack.cpp | 4 +- .../core/DefaultDispenseItemBehavior.h | 4 +- .../minecraft/core/ItemDispenseBehaviors.cpp | 2 +- targets/minecraft/locale/StringTable.cpp | 3 +- targets/minecraft/network/Connection.cpp | 2 +- targets/minecraft/network/Connection.h | 2 +- targets/minecraft/network/Socket.cpp | 2 +- targets/minecraft/network/Socket.h | 2 +- .../network/packet/AddGlobalEntityPacket.cpp | 2 +- targets/minecraft/network/packet/Packet.cpp | 8 +- .../network/packet/PlayerInfoPacket.cpp | 5 +- targets/minecraft/server/MinecraftServer.cpp | 14 +- targets/minecraft/server/PlayerList.cpp | 4 +- .../minecraft/server/level/EntityTracker.cpp | 54 ++-- .../minecraft/server/level/PlayerChunkMap.cpp | 2 +- .../server/level/ServerChunkCache.cpp | 4 +- .../minecraft/server/level/ServerLevel.cpp | 58 ++-- .../minecraft/server/level/ServerPlayer.cpp | 19 +- .../minecraft/server/level/TrackedEntity.cpp | 75 +++-- .../server/network/PendingConnection.cpp | 4 +- .../server/network/PlayerConnection.cpp | 10 +- targets/minecraft/stats/NumberFormatters.h | 2 +- targets/minecraft/stats/StatsCounter.cpp | 2 +- .../world/damageSource/CombatEntry.cpp | 4 +- .../world/damageSource/CombatTracker.cpp | 21 +- .../world/damageSource/EntityDamageSource.cpp | 11 +- .../IndirectEntityDamageSource.cpp | 4 +- targets/minecraft/world/effect/MobEffect.cpp | 4 +- targets/minecraft/world/entity/Entity.cpp | 13 +- targets/minecraft/world/entity/Entity.h | 4 +- .../minecraft/world/entity/EntitySelector.cpp | 6 +- .../minecraft/world/entity/ExperienceOrb.cpp | 2 +- .../minecraft/world/entity/HangingEntity.cpp | 15 +- targets/minecraft/world/entity/ItemFrame.cpp | 2 +- .../minecraft/world/entity/LivingEntity.cpp | 39 ++- targets/minecraft/world/entity/Mob.cpp | 22 +- targets/minecraft/world/entity/Painting.cpp | 2 +- targets/minecraft/world/entity/Painting.h | 2 +- .../minecraft/world/entity/PathfinderMob.cpp | 3 +- .../world/entity/ai/control/LookControl.cpp | 2 +- .../entity/ai/goal/ControlledByPlayerGoal.cpp | 4 +- .../world/entity/ai/goal/MeleeAttackGoal.cpp | 2 +- .../entity/ai/goal/RunAroundLikeCrazyGoal.cpp | 2 +- .../target/NearestAttackableTargetGoal.cpp | 2 +- .../entity/ai/goal/target/TargetGoal.cpp | 2 +- .../minecraft/world/entity/ambient/Bat.cpp | 2 +- .../minecraft/world/entity/animal/Animal.cpp | 22 +- .../minecraft/world/entity/animal/Chicken.cpp | 2 +- targets/minecraft/world/entity/animal/Cow.cpp | 2 +- .../world/entity/animal/EntityHorse.cpp | 11 +- .../minecraft/world/entity/animal/Ocelot.cpp | 2 +- targets/minecraft/world/entity/animal/Pig.cpp | 6 +- .../minecraft/world/entity/animal/Sheep.cpp | 2 +- .../minecraft/world/entity/animal/SnowMan.cpp | 2 +- .../world/entity/animal/VillagerGolem.cpp | 6 +- .../minecraft/world/entity/animal/Wolf.cpp | 18 +- .../entity/boss/enderdragon/EnderCrystal.cpp | 4 +- .../entity/boss/enderdragon/EnderDragon.cpp | 21 +- .../world/entity/boss/wither/WitherBoss.cpp | 30 +- .../world/entity/global/GlobalEntity.h | 2 +- .../world/entity/global/LightningBolt.cpp | 2 +- targets/minecraft/world/entity/item/Boat.cpp | 21 +- .../world/entity/item/ItemEntity.cpp | 2 +- .../minecraft/world/entity/item/Minecart.cpp | 30 +- .../world/entity/item/MinecartRideable.cpp | 4 +- .../world/entity/item/MinecartTNT.cpp | 2 +- .../minecraft/world/entity/monster/Blaze.cpp | 2 +- .../world/entity/monster/CaveSpider.cpp | 2 +- .../world/entity/monster/Creeper.cpp | 13 +- .../world/entity/monster/EnderMan.cpp | 12 +- .../minecraft/world/entity/monster/Enemy.cpp | 2 +- .../minecraft/world/entity/monster/Ghast.cpp | 6 +- .../world/entity/monster/LavaSlime.cpp | 2 +- .../world/entity/monster/Monster.cpp | 4 +- .../world/entity/monster/PigZombie.cpp | 6 +- .../world/entity/monster/Silverfish.cpp | 2 +- .../world/entity/monster/Skeleton.cpp | 15 +- .../minecraft/world/entity/monster/Slime.cpp | 2 +- .../minecraft/world/entity/monster/Spider.cpp | 2 +- .../minecraft/world/entity/monster/Witch.cpp | 2 +- .../minecraft/world/entity/monster/Zombie.cpp | 8 +- .../minecraft/world/entity/npc/Villager.cpp | 8 +- .../minecraft/world/entity/player/Player.cpp | 45 ++- .../world/entity/projectile/Arrow.cpp | 29 +- .../world/entity/projectile/Fireball.cpp | 2 +- .../projectile/FireworksRocketEntity.cpp | 2 +- .../world/entity/projectile/FishingHook.cpp | 2 +- .../world/entity/projectile/Snowball.cpp | 2 +- .../world/entity/projectile/Throwable.cpp | 4 +- .../entity/projectile/ThrownEnderpearl.cpp | 4 +- .../world/entity/projectile/WitherSkull.cpp | 2 +- targets/minecraft/world/item/ArmorItem.cpp | 4 +- targets/minecraft/world/item/BowItem.cpp | 2 +- targets/minecraft/world/item/BucketItem.cpp | 2 +- targets/minecraft/world/item/EggItem.cpp | 2 +- targets/minecraft/world/item/EnderEyeItem.cpp | 2 +- .../minecraft/world/item/EnderpearlItem.cpp | 2 +- .../minecraft/world/item/ExperienceItem.cpp | 2 +- .../minecraft/world/item/FireChargeItem.cpp | 2 +- .../minecraft/world/item/FishingRodItem.cpp | 2 +- .../world/item/FlintAndSteelItem.cpp | 2 +- targets/minecraft/world/item/FoodItem.cpp | 2 +- targets/minecraft/world/item/MapItem.cpp | 6 +- targets/minecraft/world/item/NameTagItem.cpp | 2 +- targets/minecraft/world/item/PotionItem.cpp | 2 +- targets/minecraft/world/item/SaddleItem.cpp | 2 +- targets/minecraft/world/item/SkullItem.cpp | 4 +- targets/minecraft/world/item/SnowballItem.cpp | 2 +- targets/minecraft/world/item/SpawnEggItem.cpp | 12 +- .../minecraft/world/item/crafting/Recipes.h | 2 +- .../item/enchantment/ThornsEnchantment.cpp | 2 +- .../minecraft/world/level/BaseMobSpawner.cpp | 10 +- targets/minecraft/world/level/Coord.h | 2 +- targets/minecraft/world/level/Explosion.cpp | 8 +- targets/minecraft/world/level/Level.cpp | 24 +- targets/minecraft/world/level/Level.h | 2 +- .../minecraft/world/level/biome/IceBiome.cpp | 2 +- .../world/level/chunk/LevelChunk.cpp | 16 +- .../world/level/chunk/SparseDataStorage.cpp | 8 +- .../world/level/chunk/SparseLightStorage.cpp | 8 +- .../chunk/storage/McRegionChunkStorage.cpp | 2 +- .../level/chunk/storage/OldChunkStorage.cpp | 2 +- .../level/levelgen/ConsoleSchematicFile.cpp | 24 +- .../level/levelgen/CustomLevelSource.cpp | 10 +- .../world/level/levelgen/feature/Feature.h | 2 +- .../newbiome/layer/BiomeOverrideLayer.cpp | 2 +- .../minecraft/world/level/pathfinder/Path.cpp | 3 +- .../ConsoleSaveFileIO/ConsoleSaveFile.h | 2 +- .../level/tile/BasePressurePlateTile.cpp | 2 +- .../minecraft/world/level/tile/ButtonTile.cpp | 2 +- .../world/level/tile/CauldronTile.cpp | 2 +- .../world/level/tile/ComparatorTile.cpp | 2 +- .../minecraft/world/level/tile/FarmTile.cpp | 2 +- .../minecraft/world/level/tile/FireTile.cpp | 2 +- .../minecraft/world/level/tile/LeverTile.cpp | 2 +- .../minecraft/world/level/tile/LiquidTile.cpp | 2 +- .../world/level/tile/NotGateTile.cpp | 2 +- .../world/level/tile/NoteBlockTile.cpp | 2 +- .../minecraft/world/level/tile/PortalTile.cpp | 2 +- targets/minecraft/world/level/tile/Tile.cpp | 2 +- .../minecraft/world/level/tile/TntTile.cpp | 6 +- .../world/level/tile/TripWireSourceTile.cpp | 2 +- .../world/level/tile/WaterLilyTile.cpp | 2 +- .../level/tile/entity/ChestTileEntity.cpp | 2 +- .../tile/entity/EnderChestTileEntity.cpp | 2 +- .../level/tile/entity/TheEndPortalTile.cpp | 2 +- .../level/tile/piston/PistonBaseTile.cpp | 2 +- targets/platform/network/IPlatformNetwork.h | 2 +- targets/platform/network/network.h | 2 +- .../network/stub/StubNetworkPlayer.cpp | 2 +- .../platform/network/stub/StubNetworkPlayer.h | 2 +- .../network/stub/StubPlatformNetwork.cpp | 2 +- .../network/stub/StubPlatformNetwork.h | 2 +- targets/platform/thread/C4JThread.cpp | 3 +- targets/platform/thread/C4JThread.h | 3 +- 446 files changed, 1491 insertions(+), 1710 deletions(-) delete mode 100644 scripts/find_dead_app_includes.py create mode 100644 scripts/format.py delete mode 100644 scripts/sweep_linuxgame_includes.py delete mode 100644 scripts/sweep_winapi_stubs_includes.py diff --git a/scripts/find_dead_app_includes.py b/scripts/find_dead_app_includes.py deleted file mode 100644 index 649cc518c..000000000 --- a/scripts/find_dead_app_includes.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env python3 -"""Heuristic dead-include detector for app/ includes in minecraft/. - -For each minecraft/ source file that includes a header from app/, check -whether the file references any of the top-level identifiers that header -defines. If zero references, the include is a candidate for removal. - -Usage: - python3 scripts/find_dead_app_includes.py [--apply] [DIR ...] - -Without --apply, prints candidates only. With --apply, removes them. -DIR is one or more subdirectories of targets/minecraft/ to scope the -sweep (e.g. world/entity, server). Defaults to all of targets/minecraft/. - -Caveats: -- The "identifiers a header defines" heuristic catches type names, - function names, struct/class/enum names, and macros. It can miss - constants used through unusual paths and is fooled by includes that - are needed only for transitive type completion. Always build clean - after applying. -- Comments and strings are not stripped from the consumer scan, so a - file that mentions an app symbol only in a comment will look "live" - and the include is conservatively kept. -""" - -from __future__ import annotations - -import argparse -import os -import re -import sys -from pathlib import Path - -REPO_ROOT = Path(__file__).resolve().parent.parent -MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" -APP_ROOT = REPO_ROOT / "targets" / "app" - -INCLUDE_RE = re.compile(r'^\s*#\s*include\s*"(app/[^"]+)"\s*$', re.MULTILINE) - -# Identifier-extracting regexes for header analysis. Best-effort. -IDENT_RES = [ - # class/struct/union/enum tag definitions - re.compile(r'\b(?:class|struct|union|enum(?:\s+class)?)\s+([A-Za-z_]\w*)'), - # typedef NAME or typedef ... NAME; - re.compile(r'\btypedef\b[^;]*?\b([A-Za-z_]\w*)\s*(?:\[|;)'), - # using NAME = ... - re.compile(r'\busing\s+([A-Za-z_]\w*)\s*='), - # function declarations: WORD WORD ( where second WORD is identifier - # this is too loose; skip in favour of usage by name - # #define MACRO - re.compile(r'^\s*#\s*define\s+([A-Za-z_]\w*)', re.MULTILINE), - # extern variable declarations - re.compile(r'\bextern\b[^;]*?\b([A-Za-z_]\w*)\s*[;\[(]'), -] - -CXX_KEYWORDS = { - "if", "else", "while", "for", "do", "switch", "case", "default", - "break", "continue", "return", "void", "int", "char", "short", "long", - "float", "double", "bool", "true", "false", "nullptr", "class", "struct", - "union", "enum", "namespace", "using", "typedef", "template", "typename", - "const", "constexpr", "static", "extern", "inline", "virtual", "override", - "final", "public", "private", "protected", "friend", "this", "new", - "delete", "sizeof", "auto", "decltype", "operator", "throw", "try", - "catch", "noexcept", "mutable", "volatile", "register", "explicit", - "signed", "unsigned", "wchar_t", "char8_t", "char16_t", "char32_t", - "size_t", "ptrdiff_t", "nullptr_t", "ifndef", "ifdef", "endif", "define", - "include", "pragma", "elif", "error", "warning", "line", "undef", - "alignas", "alignof", "concept", "requires", "co_await", "co_yield", - "co_return", "consteval", "constinit", "static_cast", "dynamic_cast", - "reinterpret_cast", "const_cast", -} - - -def extract_header_identifiers(header_path: Path) -> set[str]: - """Best-effort extraction of identifiers a header defines.""" - if not header_path.exists(): - return set() - try: - text = header_path.read_text(encoding="utf-8", errors="surrogateescape") - except OSError: - return set() - idents: set[str] = set() - for regex in IDENT_RES: - for match in regex.finditer(text): - name = match.group(1) - if name and name not in CXX_KEYWORDS and not name.startswith("_"): - idents.add(name) - return idents - - -def file_references_any(file_text: str, idents: set[str]) -> bool: - """Check if any identifier appears as a whole-word match in the file.""" - if not idents: - return False - # Build one big alternation - pattern = r'\b(?:' + '|'.join(re.escape(i) for i in idents) + r')\b' - return re.search(pattern, file_text) is not None - - -def collect_minecraft_files(roots: list[Path]) -> list[Path]: - files: list[Path] = [] - for root in roots: - for dirpath, _dirnames, filenames in os.walk(root): - for name in filenames: - if name.endswith((".cpp", ".c", ".h", ".hpp")): - files.append(Path(dirpath) / name) - files.sort() - return files - - -def analyse(roots: list[Path], apply: bool) -> int: - files = collect_minecraft_files(roots) - header_cache: dict[str, set[str]] = {} - candidate_count = 0 - - for path in files: - try: - text = path.read_text(encoding="utf-8", errors="surrogateescape") - except OSError: - continue - includes = INCLUDE_RE.findall(text) - if not includes: - continue - # Strip the include lines from the text we scan for symbols, so we - # don't false-positive on the include path itself mentioning the - # symbol name (e.g. ColourTable.h). - scan_text = INCLUDE_RE.sub("", text) - dead_includes: list[str] = [] - for include_path in includes: - cache_key = include_path - if cache_key not in header_cache: - header_path = REPO_ROOT / "targets" / include_path - header_cache[cache_key] = extract_header_identifiers(header_path) - idents = header_cache[cache_key] - if not idents: - # Header has no extractable identifiers (or doesn't exist). - # Conservatively skip - don't claim it's dead. - continue - if not file_references_any(scan_text, idents): - dead_includes.append(include_path) - if dead_includes: - candidate_count += len(dead_includes) - rel = path.relative_to(REPO_ROOT) - for inc in dead_includes: - print(f"{rel}: {inc}") - if apply: - new_text = text - for inc in dead_includes: - pattern = re.compile( - r'^\s*#\s*include\s*"' + re.escape(inc) + r'"\s*\n', - re.MULTILINE, - ) - new_text = pattern.sub("", new_text) - path.write_text(new_text, encoding="utf-8", errors="surrogateescape") - - print(f"\n{candidate_count} candidate dead include lines" - f" {'removed' if apply else 'identified'}") - return 0 - - -def main() -> int: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--apply", action="store_true", - help="Actually remove the candidate includes") - parser.add_argument("dirs", nargs="*", - help="Subdirectories of targets/minecraft/ to scan") - args = parser.parse_args() - - if args.dirs: - roots = [MINECRAFT_ROOT / d for d in args.dirs] - for r in roots: - if not r.exists(): - print(f"error: {r} does not exist", file=sys.stderr) - return 1 - else: - roots = [MINECRAFT_ROOT] - - return analyse(roots, args.apply) - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/scripts/format.py b/scripts/format.py new file mode 100644 index 000000000..6819e4dad --- /dev/null +++ b/scripts/format.py @@ -0,0 +1,183 @@ +#!/usr/bin/env python3 +import argparse +import os +import subprocess +import sys +from concurrent.futures import ThreadPoolExecutor, as_completed +from pathlib import Path + +DEFAULT_EXTENSIONS = { + ".c", + ".cc", + ".cpp", + ".cxx", + ".h", + ".hh", + ".hpp", + ".hxx", + ".inl", + ".ipp", +} +DEFAULT_JOBS = os.cpu_count() or 4 +DEFAULT_TIMEOUT = 10 + +# ansi escapes +RESET = "\033[0m" if sys.stdout.isatty() else "" +GREEN = "\033[32m" if sys.stdout.isatty() else "" +YELLOW = "\033[33m" if sys.stdout.isatty() else "" +RED = "\033[31m" if sys.stdout.isatty() else "" +BOLD = "\033[1m" if sys.stdout.isatty() else "" + +def format_file(path, clang_format, extra_args, timeout): + cmd = [clang_format, "-i"] + cmd += extra_args + cmd.append(str(path)) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + timeout=timeout, + ) + if result.returncode != 0: + msg = (result.stderr or result.stdout or "non-zero exit code").strip() + return ("error", str(path), msg) + return ("ok", str(path), None) + + except subprocess.TimeoutExpired: + return ("timeout", str(path), f"exceeded {timeout}s timeout") + + except FileNotFoundError: + return ("error", str(path), f"'{clang_format}' not found — is it installed?") + + except Exception as exc: + return ("error", str(path), str(exc)) + +def find_files(root, extensions, exclude_dirs): + found = [] + for dirpath, dirnames, filenames in os.walk(root): + dirnames[:] = [d for d in dirnames if d not in exclude_dirs] + for fname in filenames: + if Path(fname).suffix.lower() in extensions: + found.append(Path(dirpath) / fname) + return sorted(found) + +def main(): + p = argparse.ArgumentParser( + description="Recursively runs clang-format on C/C++ files.", + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + p.add_argument("directory", nargs="?", default=".", type=Path) + p.add_argument( + "--clang-format", + default="clang-format", + metavar="BIN", + help="Path to the clang-format executable. (default: clang-format)", + ) + p.add_argument( + "-j", + "--jobs", + type=int, + default=DEFAULT_JOBS, + metavar="N", + help=f"Number of parallel workers. (default: {DEFAULT_JOBS})", + ) + p.add_argument( + "--timeout", + type=int, + default=DEFAULT_TIMEOUT, + metavar="SECS", + help=f"Per-file timeout in seconds. (default: {DEFAULT_TIMEOUT})", + ) + p.add_argument( + "--extensions", + nargs="+", + metavar="EXT", + help="File extensions to process (including the dot)." + f"(default: {' '.join(sorted(DEFAULT_EXTENSIONS))})", + ) + p.add_argument( + "--exclude", + nargs="*", + default=[], + metavar="DIR", + help="Directory names to skip during traversal (e.g. build third_party).", + ) + p.add_argument( + "--clang-format-args", + nargs=argparse.REMAINDER, + default=[], + metavar="...", + ) + args = p.parse_args() + + root = args.directory.resolve() + if not root.is_dir(): + print(f"{RED}Error:{RESET} '{root}' is not a directory.", file=sys.stderr) + return 1 + + extensions = ( + {e if e.startswith(".") else f".{e}" for e in args.extensions} + if args.extensions + else DEFAULT_EXTENSIONS + ) + + exclude_dirs = set(args.exclude) + + files = find_files(root, extensions, exclude_dirs) + if not files: + print(f"{YELLOW}No source files found.{RESET}") + return 0 + + total = len(files) + print(f"Found {BOLD}{total}{RESET} file(s).") + + counters = {"ok": 0, "timeout": 0, "error": 0} + completed = 0 + + with ThreadPoolExecutor(max_workers=args.jobs) as pool: + futures = { + pool.submit( + format_file, + f, + args.clang_format, + args.clang_format_args, + args.timeout, + ): f + for f in files + } + + for future in as_completed(futures): + status, path_str, error = future.result() + counters[status] += 1 + completed += 1 + rel = os.path.relpath(path_str, root) + + if status == "ok": + tag = f"{GREEN}[ OK ]{RESET}" + elif status == "timeout": + tag = f"{YELLOW}[ TIMEOUT ]{RESET}" + else: + tag = f"{RED}[ ERROR ]{RESET}" + + progress = f"[{completed:>{len(str(total))}}/{total}]" + line = f"{progress} {tag} {rel}" + if error: + line += f"\n {RED}{error}{RESET}" + print(line) + + print() + print(f"{BOLD}Summary{RESET}") + print(f"Total: {total}") + print(f"{GREEN}OK: {counters['ok']}{RESET}") + + if counters["timeout"]: + print(f"{YELLOW}Timeout: {counters['timeout']}{RESET}") + if counters["error"]: + print(f"{RED}Error: {counters['error']}{RESET}") + + return 1 if (counters["timeout"] or counters["error"]) else 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/sweep_linuxgame_includes.py b/scripts/sweep_linuxgame_includes.py deleted file mode 100644 index dcd693d67..000000000 --- a/scripts/sweep_linuxgame_includes.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python3 -"""Conservative sweep: remove dead app/linux/LinuxGame.h includes from minecraft/. - -LinuxGame.h is included by 155 files in targets/minecraft/ but most of -those are leftover from before the IGameServices refactor. The only real -reasons to include it are: - - to use the global `LinuxGame app;` extern - - to use the LinuxGame class type by name - - to use C4JStringTable (forward-declared in the header) - -For each minecraft/ file that includes LinuxGame.h, this script checks -whether the file references any of: LinuxGame, C4JStringTable, or -contains `app.`/`app::`. If none of those appear, the include is dead -and removed. - -Usage: - python3 scripts/sweep_linuxgame_includes.py [--apply] -""" - -from __future__ import annotations - -import argparse -import os -import re -import sys -from pathlib import Path - -REPO_ROOT = Path(__file__).resolve().parent.parent -MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" - -INCLUDE_RE = re.compile( - r'^[ \t]*#[ \t]*include[ \t]*"app/linux/LinuxGame\.h"[ \t]*\n', - re.MULTILINE, -) - -# Patterns that mean the include is genuinely needed. -# LinuxGame.h transitively pulls in Game.h (LinuxGame : public Game), so any -# reference to the Game class also keeps the include alive. -USAGE_PATTERNS = [ - re.compile(r'\bLinuxGame\b'), - re.compile(r'\bC4JStringTable\b'), - re.compile(r'\bapp\s*\.'), - re.compile(r'\bapp\s*::'), - re.compile(r'\bGame\s*::'), - re.compile(r'\bGame\s*\*'), - re.compile(r'\bGame\s*&'), - re.compile(r'class\s+\w+\s*:\s*(?:public|private|protected)?\s*Game\b'), -] - - -def strip_comments(text: str) -> str: - text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL) - text = re.sub(r'//[^\n]*', '', text) - return text - - -def file_needs_linuxgame(text: str) -> bool: - # Strip the LinuxGame.h include line itself before checking, to avoid - # the include path matching `LinuxGame`. Also strip comments so - # references in commented-out code don't keep the include alive. - scan = INCLUDE_RE.sub("", text) - scan = strip_comments(scan) - for pat in USAGE_PATTERNS: - if pat.search(scan): - return True - return False - - -def main() -> int: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--apply", action="store_true", - help="Actually remove the dead includes") - args = parser.parse_args() - - candidates: list[Path] = [] - for dirpath, _dirnames, filenames in os.walk(MINECRAFT_ROOT): - for name in filenames: - if not name.endswith((".cpp", ".c", ".h", ".hpp")): - continue - path = Path(dirpath) / name - try: - text = path.read_text(encoding="utf-8", errors="surrogateescape") - except OSError: - continue - if not INCLUDE_RE.search(text): - continue - if file_needs_linuxgame(text): - continue - candidates.append(path) - - candidates.sort() - for path in candidates: - print(path.relative_to(REPO_ROOT)) - - print(f"\n{len(candidates)} files have a dead LinuxGame.h include") - - if args.apply: - for path in candidates: - text = path.read_text(encoding="utf-8", errors="surrogateescape") - new_text = INCLUDE_RE.sub("", text) - path.write_text(new_text, encoding="utf-8", errors="surrogateescape") - print(f"Removed from {len(candidates)} files") - - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/scripts/sweep_winapi_stubs_includes.py b/scripts/sweep_winapi_stubs_includes.py deleted file mode 100644 index 5b966c4c1..000000000 --- a/scripts/sweep_winapi_stubs_includes.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python3 -"""Conservative sweep: remove dead app/linux/Stubs/winapi_stubs.h includes. - -winapi_stubs.h provides Windows API typedefs and constants for Linux -(LARGE_INTEGER, FILETIME, ERROR_*, etc.). Many minecraft/ files include -it as transitive leftovers and never actually reference any of those -symbols. - -Usage: - python3 scripts/sweep_winapi_stubs_includes.py [--apply] -""" - -from __future__ import annotations - -import argparse -import os -import re -import sys -from pathlib import Path - -REPO_ROOT = Path(__file__).resolve().parent.parent -MINECRAFT_ROOT = REPO_ROOT / "targets" / "minecraft" - -INCLUDE_RE = re.compile( - r'^[ \t]*#[ \t]*include[ \t]*"app/linux/Stubs/winapi_stubs\.h"[ \t]*\n', - re.MULTILINE, -) - -# Symbols defined by winapi_stubs.h. If any appear in the consumer, the -# include is needed. -USAGE_PATTERNS = [ - re.compile(r'\bLARGE_INTEGER\b'), - re.compile(r'\bULARGE_INTEGER\b'), - re.compile(r'\bFILETIME\b'), - re.compile(r'\bSYSTEMTIME\b'), - re.compile(r'\bERROR_SUCCESS\b'), - re.compile(r'\bERROR_IO_PENDING\b'), - re.compile(r'\bERROR_CANCELLED\b'), - re.compile(r'\bMEM_COMMIT\b'), - re.compile(r'\bMEM_RESERVE\b'), - re.compile(r'\bMEM_DECOMMIT\b'), - re.compile(r'\bPAGE_READWRITE\b'), - re.compile(r'\bDWORD\b'), - re.compile(r'\bBYTE\b'), - re.compile(r'\bWORD\b'), - re.compile(r'\bHANDLE\b'), - re.compile(r'\bHRESULT\b'), - re.compile(r'\bGetLastError\b'), - re.compile(r'\bGetFileSize\b'), - re.compile(r'\bGetSystemTime\b'), - re.compile(r'\bSystemTimeToFileTime\b'), - re.compile(r'\bMakeAbsoluteSD\b'), - re.compile(r'\bSetFilePointer\b'), - re.compile(r'\bReadFile\b'), - re.compile(r'\bWriteFile\b'), - re.compile(r'\bCloseHandle\b'), - re.compile(r'\bCreateFile\b'), - re.compile(r'\bVirtualAlloc\b'), - re.compile(r'\bVirtualFree\b'), - re.compile(r'\bSleep\s*\('), - re.compile(r'\bWaitForSingleObject\b'), - re.compile(r'\bSetEvent\b'), - re.compile(r'\bResetEvent\b'), - re.compile(r'\bInterlocked'), - re.compile(r'\bOutputDebugString\b'), - re.compile(r'\bMessageBox\b'), -] - - -def strip_comments(text: str) -> str: - """Strip C++ // and /* */ comments. Approximate but good enough for - detecting whether a symbol appears in real code vs commented-out - code.""" - # Strip /* ... */ comments (multiline) - text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL) - # Strip // ... comments (single line) - text = re.sub(r'//[^\n]*', '', text) - return text - - -def needs_winapi(text: str) -> bool: - scan = INCLUDE_RE.sub("", text) - scan = strip_comments(scan) - return any(p.search(scan) for p in USAGE_PATTERNS) - - -def main() -> int: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--apply", action="store_true", - help="Actually remove the dead includes") - args = parser.parse_args() - - candidates: list[Path] = [] - for dirpath, _dirnames, filenames in os.walk(MINECRAFT_ROOT): - for name in filenames: - if not name.endswith((".cpp", ".c", ".h", ".hpp")): - continue - path = Path(dirpath) / name - try: - text = path.read_text(encoding="utf-8", errors="surrogateescape") - except OSError: - continue - if not INCLUDE_RE.search(text): - continue - if needs_winapi(text): - continue - candidates.append(path) - - candidates.sort() - for path in candidates: - print(path.relative_to(REPO_ROOT)) - - print(f"\n{len(candidates)} files have a dead winapi_stubs.h include") - - if args.apply: - for path in candidates: - text = path.read_text(encoding="utf-8", errors="surrogateescape") - new_text = INCLUDE_RE.sub("", text) - path.write_text(new_text, encoding="utf-8", errors="surrogateescape") - print(f"Removed from {len(candidates)} files") - - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/targets/app/common/App_structs.h b/targets/app/common/App_structs.h index 2888d32a9..e138baded 100644 --- a/targets/app/common/App_structs.h +++ b/targets/app/common/App_structs.h @@ -2,13 +2,13 @@ #include -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/network/NetTypes.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" #include "platform/profile/ProfileConstants.h" #include "platform/storage/storage.h" diff --git a/targets/app/common/Audio/SoundEngine.cpp b/targets/app/common/Audio/SoundEngine.cpp index 86e20e4d5..298124cc4 100644 --- a/targets/app/common/Audio/SoundEngine.cpp +++ b/targets/app/common/Audio/SoundEngine.cpp @@ -11,8 +11,8 @@ #include #include "app/common/Audio/ConsoleSoundEngine.h" -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/Random.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -20,9 +20,9 @@ #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Mob.h" #include "minecraft/world/level/storage/LevelData.h" -#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/fs/fs.h" +#include "platform/thread/C4JThread.h" #define STB_VORBIS_HEADER_ONLY #include "stb_vorbis.c" @@ -880,4 +880,3 @@ char* SoundEngine::ConvertSoundPathToName(const std::string& name, bool bConvertSpaces) { return nullptr; } - diff --git a/targets/app/common/Audio/SoundEngine.h b/targets/app/common/Audio/SoundEngine.h index 8642b6ad4..701a92d36 100644 --- a/targets/app/common/Audio/SoundEngine.h +++ b/targets/app/common/Audio/SoundEngine.h @@ -8,8 +8,8 @@ class Random; #include #include "app/common/Audio/ConsoleSoundEngine.h" -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Audio/SoundTypes.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/PlatformTypes.h" // Forward-declare the miniaudio backing state. The full struct lives in diff --git a/targets/app/common/DLC/DLCGameRulesHeader.cpp b/targets/app/common/DLC/DLCGameRulesHeader.cpp index 16beb8b57..12a7e19f0 100644 --- a/targets/app/common/DLC/DLCGameRulesHeader.cpp +++ b/targets/app/common/DLC/DLCGameRulesHeader.cpp @@ -4,8 +4,8 @@ #include "DLCManager.h" #include "app/common/DLC/DLCGameRules.h" -#include "app/common/GameRules/GameRuleManager.h" #include "app/common/Game.h" +#include "app/common/GameRules/GameRuleManager.h" class StringTable; diff --git a/targets/app/common/DLC/DLCManager.cpp b/targets/app/common/DLC/DLCManager.cpp index efedd845c..db04bcf38 100644 --- a/targets/app/common/DLC/DLCManager.cpp +++ b/targets/app/common/DLC/DLCManager.cpp @@ -15,8 +15,8 @@ #include "DLCFile.h" #include "DLCPack.h" -#include "app/common/GameRules/GameRuleManager.h" #include "app/common/Game.h" +#include "app/common/GameRules/GameRuleManager.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePackRepository.h" @@ -482,7 +482,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, std::uint8_t* pbTemp = &pbData [dwTemp]; //+ - //sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; + // sizeof(IPlatformStorage::DLC_FILE_DETAILS)*ulFileCount; DLC_READ_DETAIL(&fileBuf, pbData, uiCurrentByte); for (unsigned int i = 0; i < uiFileCount; i++) { diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index 111b91a64..dd251d5ab 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -1,52 +1,5 @@ #include "app/common/Game.h" -#include "app/common/App_structs.h" -#include "app/common/DLC/DLCManager.h" -#include "app/common/DLC/DLCSkinFile.h" -#include "app/common/GameRules/GameRuleManager.h" -#include "app/common/Network/GameNetworkManager.h" -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/common/UI/ConsoleUIController.h" -#include "java/Class.h" -#include "java/File.h" -#include "java/Random.h" -#include "minecraft/Console_Debug_enum.h" -#include "minecraft/GameEnums.h" -#include "minecraft/GameHostOptions.h" -#include "minecraft/GameTypes.h" -#include "minecraft/client/Minecraft.h" -#include "minecraft/client/Options.h" -#include "minecraft/client/ProgressRenderer.h" -#include "minecraft/client/model/SkinBox.h" -#include "minecraft/client/model/geom/Model.h" -#include "minecraft/client/multiplayer/ClientConnection.h" -#include "minecraft/client/multiplayer/MultiPlayerGameMode.h" -#include "minecraft/client/multiplayer/MultiPlayerLevel.h" -#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "minecraft/client/renderer/GameRenderer.h" -#include "minecraft/client/renderer/Textures.h" -#include "minecraft/client/renderer/entity/EntityRenderer.h" -#include "minecraft/client/skins/TexturePack.h" -#include "minecraft/network/packet/DisconnectPacket.h" -#include "minecraft/server/MinecraftServer.h" -#include "minecraft/stats/StatsCounter.h" -#include "minecraft/world/Container.h" -#include "minecraft/world/entity/item/MinecartHopper.h" -#include "minecraft/world/entity/player/Player.h" -#include "minecraft/world/item/crafting/Recipy.h" -#include "minecraft/world/level/tile/Tile.h" -#include "minecraft/world/level/tile/entity/HopperTileEntity.h" -#include "platform/PlatformTypes.h" -#include "platform/XboxStubs.h" -#include "platform/network/NetTypes.h" -#include "platform/network/network.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "strings.h" #include #include #include @@ -66,22 +19,69 @@ #include #include +#include "app/common/App_structs.h" #include "app/common/Audio/SoundEngine.h" +#include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/DLC/DLCSkinFile.h" +#include "app/common/GameRules/GameRuleManager.h" +#include "app/common/Network/GameNetworkManager.h" +#include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/ArchiveFile.h" +#include "app/common/UI/All Platforms/UIEnums.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" +#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" +#include "java/Class.h" +#include "java/File.h" +#include "java/Random.h" +#include "minecraft/Console_Debug_enum.h" +#include "minecraft/GameEnums.h" +#include "minecraft/GameHostOptions.h" +#include "minecraft/GameTypes.h" #include "minecraft/Minecraft_Macros.h" +#include "minecraft/client/Minecraft.h" +#include "minecraft/client/Options.h" +#include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/User.h" #include "minecraft/client/gui/Gui.h" +#include "minecraft/client/model/SkinBox.h" +#include "minecraft/client/model/geom/Model.h" +#include "minecraft/client/multiplayer/ClientConnection.h" +#include "minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "minecraft/client/multiplayer/MultiPlayerLevel.h" +#include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" +#include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/client/renderer/Textures.h" #include "minecraft/client/renderer/entity/EntityRenderDispatcher.h" +#include "minecraft/client/renderer/entity/EntityRenderer.h" #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/skins/DLCTexturePack.h" +#include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/locale/StringTable.h" +#include "minecraft/network/packet/DisconnectPacket.h" +#include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" +#include "minecraft/stats/StatsCounter.h" +#include "minecraft/world/Container.h" +#include "minecraft/world/entity/item/MinecartHopper.h" +#include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/item/crafting/Recipy.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "minecraft/world/level/tile/Tile.h" +#include "minecraft/world/level/tile/entity/HopperTileEntity.h" +#include "platform/PlatformTypes.h" +#include "platform/XboxStubs.h" #include "platform/input/input.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" +#include "strings.h" #include "util/StringHelpers.h" #include "util/Timer.h" diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index c8e08930d..0653257a4 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -4,8 +4,8 @@ #include #include "platform/profile/profile.h" -#include "platform/storage/storage.h" #include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "util/Timer.h" // using namespace std; @@ -25,7 +25,6 @@ #include "app/common/SaveManager.h" #include "app/common/SkinManager.h" #include "app/common/TerrainFeatureManager.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "minecraft/client/model/SkinBox.h" @@ -33,8 +32,9 @@ #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "platform/network/NetTypes.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" // JoinFromInviteData moved to NetworkController.h diff --git a/targets/app/common/GameRules/GameRuleManager.cpp b/targets/app/common/GameRules/GameRuleManager.cpp index 0faab72ad..be4ca8b70 100644 --- a/targets/app/common/GameRules/GameRuleManager.cpp +++ b/targets/app/common/GameRules/GameRuleManager.cpp @@ -12,11 +12,10 @@ #include "app/common/DLC/DLCLocalisationFile.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" -#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" +#include "app/common/Game.h" #include "app/common/GameRules/LevelGeneration/LevelGenerators.h" #include "app/common/GameRules/LevelRules/LevelRules.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/Game.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" @@ -25,6 +24,7 @@ #include "minecraft/locale/StringTable.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "strings.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index 8200ddb49..6a4d1c8fb 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -4,7 +4,6 @@ #include #include "app/common/Game.h" -#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" @@ -12,6 +11,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/phys/AABB.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h index cc5073a35..3a0eaafae 100644 --- a/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h +++ b/targets/app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h @@ -5,8 +5,8 @@ #include #include "minecraft/world/level/ConsoleGameRulesConstants.h" -#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" diff --git a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp index 714c77637..122dd1222 100644 --- a/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp +++ b/targets/app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.cpp @@ -4,12 +4,12 @@ #include +#include "app/common/Game.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceSpawner.h" -#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Direction.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" diff --git a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp index b2e2479f3..4dd8d39a0 100644 --- a/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/targets/app/common/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -9,13 +9,12 @@ #include "app/common/DLC/DLCGameRulesHeader.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/GameRules/LevelGeneration/ApplySchematicRuleDefinition.h" #include "app/common/GameRules/LevelGeneration/BiomeOverride.h" #include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructure.h" -#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "app/common/GameRules/LevelGeneration/StartFeature.h" -#include "app/common/Game.h" #include "java/File.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -27,6 +26,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/levelgen/structure/BoundingBox.h" #include "minecraft/world/phys/AABB.h" #include "platform/fs/fs.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp index e3254aab9..9651a4011 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionGenerateBox.cpp @@ -1,7 +1,7 @@ #include "XboxStructureActionGenerateBox.h" -#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/Game.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp index b0690c711..5c8f82bde 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.cpp @@ -1,7 +1,7 @@ #include "XboxStructureActionPlaceBlock.h" -#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "app/common/Game.h" +#include "app/common/GameRules/LevelGeneration/ConsoleGenerateStructureAction.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRuleDefinition.h" diff --git a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp index 494fb30a7..a14a46bce 100644 --- a/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp +++ b/targets/app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceContainer.cpp @@ -4,9 +4,9 @@ #include +#include "app/common/Game.h" #include "app/common/GameRules/LevelGeneration/StructureActions/XboxStructureActionPlaceBlock.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" -#include "app/common/Game.h" #include "minecraft/world/Container.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/Level.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp index 9b48fc742..ed9107916 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.cpp @@ -4,8 +4,8 @@ #include #include -#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "app/common/Game.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/CompoundGameRuleDefinition.h" #include "minecraft/network/Connection.h" #include "minecraft/network/packet/UpdateGameRuleProgressPacket.h" #include "minecraft/world/level/GameRules/GameRule.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp index 9149bc99e..d759f5304 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.cpp @@ -8,9 +8,9 @@ #include #include +#include "app/common/Game.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/CompleteAllRuleDefinition.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "app/common/Game.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules/GameRule.h" diff --git a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp index b95f6600e..508b22a58 100644 --- a/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp +++ b/targets/app/common/GameRules/LevelRules/RuleDefinitions/UpdatePlayerRuleDefinition.cpp @@ -4,8 +4,8 @@ #include -#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "app/common/Game.h" +#include "app/common/GameRules/LevelRules/RuleDefinitions/AddItemRuleDefinition.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/Pos.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 1b7c87741..8eee1fedf 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -5,7 +5,6 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 34c5a8c9b..2e244ea1b 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -1,5 +1,4 @@ #include "app/common/Audio/SoundEngine.h" -#include "platform/game/game.h" #include "app/common/DLC/DLCManager.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" @@ -7,9 +6,8 @@ #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" #include "minecraft/client/Minecraft.h" @@ -26,10 +24,11 @@ #include "minecraft/client/skins/DLCTexturePack.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/stats/StatsCounter.h" #include "platform/PlatformTypes.h" +#include "platform/game/game.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "util/StringHelpers.h" @@ -469,7 +468,8 @@ void Game::HandleXuiActions(void) { } } } else { - PlatformGame.SetRichPresenceContext(i, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext( + i, CONTEXT_GAME_STATE_BLANK); if (g_NetworkManager.IsLocalGame()) { PlatformProfile.SetCurrentGameActivity( i, CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE, @@ -994,12 +994,11 @@ void Game::HandleXuiActions(void) { // streaming audio from the default texture pack now // reset the streaming sounds back to the normal ones static_cast(pMinecraft->soundEngine) - ->SetStreamingSounds(eStream_Overworld_Calm1, - eStream_Overworld_piano3, - eStream_Nether1, - eStream_Nether4, - eStream_end_dragon, - eStream_end_end, eStream_CD_1); + ->SetStreamingSounds( + eStream_Overworld_Calm1, + eStream_Overworld_piano3, eStream_Nether1, + eStream_Nether4, eStream_end_dragon, + eStream_end_end, eStream_CD_1); pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1, 1); @@ -1288,7 +1287,9 @@ void Game::HandleXuiActions(void) { } break; case eAppAction_DebugText: // launch the xui for text entry - { SetAction(i, eAppAction_Idle); } + { + SetAction(i, eAppAction_Idle); + } break; case eAppAction_ReloadTexturePack: { diff --git a/targets/app/common/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c index 9a1ea981d..71c17cf81 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -10,8 +10,8 @@ #include #include -#include "app/common/Iggy/include/iggy.h" #include "SDL_video.h" +#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY void* IggyGDrawMallocAnnotated(SINTa size, const char* file, int line) { diff --git a/targets/app/common/Iggy/gdraw/gdraw.h b/targets/app/common/Iggy/gdraw/gdraw.h index b88da0756..cc6a0d02a 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.h +++ b/targets/app/common/Iggy/gdraw/gdraw.h @@ -1,9 +1,9 @@ #ifndef __LINUX_IGGY_GDRAW_H__ #define __LINUX_IGGY_GDRAW_H__ -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Iggy/include/gdraw.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/Iggy/include/rrCore.h" #ifdef __cplusplus extern "C" { diff --git a/targets/app/common/Iggy/iggy_stubs.h b/targets/app/common/Iggy/iggy_stubs.h index 5df1121e1..509f5ffd0 100644 --- a/targets/app/common/Iggy/iggy_stubs.h +++ b/targets/app/common/Iggy/iggy_stubs.h @@ -9,7 +9,8 @@ #include "app/common/Iggy/include/iggy.h" #define STUBBED \ - {} + { \ + } RADEXPFUNC inline IggyValuePath* RADEXPLINK IggyPlayerRootPath(Iggy* f) { STUBBED; diff --git a/targets/app/common/Iggy/include/iggy.h b/targets/app/common/Iggy/include/iggy.h index 21f839c8f..5d4d43027 100644 --- a/targets/app/common/Iggy/include/iggy.h +++ b/targets/app/common/Iggy/include/iggy.h @@ -489,16 +489,15 @@ IDOCN typedef struct { rrbool(RADLINK* connection_valid)( Iggy* swf, HIGGYEXP iggyexp); // Iggy queries this to check if Iggy // Explorer is still connected - S32(RADLINK* poll_command) - (Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // stores command in *buffer, returns number of bytes + S32(RADLINK* poll_command)( + Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // stores command in *buffer, returns number of bytes void(RADLINK* send_command)( Iggy* swf, HIGGYEXP iggyexp, U8 command, void* buffer, S32 len); // writes a command with a payload of buffer:len - S32(RADLINK* get_storage) - (Iggy* swf, HIGGYEXP iggyexp, - U8** buffer); // returns temporary storage Iggy - // can use for assembling commands + S32(RADLINK* get_storage)(Iggy* swf, HIGGYEXP iggyexp, + U8** buffer); // returns temporary storage Iggy + // can use for assembling commands rrbool(RADLINK* attach)( Iggy* swf, HIGGYEXP iggyexp, iggyexp_detach_callback* cb, void* cbdata, IggyForPerfmonFunctions* diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 037b134d5..c84713ef4 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -7,8 +7,8 @@ #include #include "app/common/App_structs.h" -#include "app/common/UI/All Platforms/ArchiveFile.h" #include "app/common/Game.h" +#include "app/common/UI/All Platforms/ArchiveFile.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 865d138c8..5b1257e7e 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -8,9 +8,8 @@ #include "app/common/Game.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Scenes/UIScene_FullscreenProgress.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Network/GameNetworkManager.cpp b/targets/app/common/Network/GameNetworkManager.cpp index 2206784c6..5c8bc0144 100644 --- a/targets/app/common/Network/GameNetworkManager.cpp +++ b/targets/app/common/Network/GameNetworkManager.cpp @@ -1,5 +1,4 @@ #include "GameNetworkManager.h" -#include "platform/game/game.h" #include @@ -10,14 +9,12 @@ #include #include -#include "minecraft/network/Socket.h" #include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_PauseMenu.h" #include "java/File.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" @@ -30,9 +27,9 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/network/Connection.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerAction.h" @@ -47,13 +44,14 @@ #include "minecraft/world/level/tile/Tile.h" #include "platform/XboxStubs.h" #include "platform/fs/fs.h" +#include "platform/game/game.h" #include "platform/input/input.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" #include "strings.h" #include "util/StringHelpers.h" -#include "platform/network/network.h" class FriendSessionInfo; class INVITE_INFO; @@ -350,7 +348,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, createdConnections.push_back(connection); int primaryPad = PlatformProfile.GetPrimaryPad(); - PlatformGame.SetRichPresenceContext(primaryPad, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(primaryPad, + CONTEXT_GAME_STATE_BLANK); if (GetPlayerCount() > 1) // Are we offline or online, and how many players are there { @@ -381,7 +380,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, Socket* socket = pNetworkPlayer->GetSocket(); app.DebugPrintf( "Closing socket due to player %d not being signed in any " - "more\n", idx); + "more\n", + idx); if (!socket->close(false)) socket->close(true); continue; @@ -452,7 +452,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, if (g_NetworkManager.IsLeavingGame() || !IsInSession()) break; if (PlatformProfile.IsSignedIn(idx) && !connection->isClosed()) { - PlatformGame.SetRichPresenceContext(idx, CONTEXT_GAME_STATE_BLANK); + PlatformGame.SetRichPresenceContext(idx, + CONTEXT_GAME_STATE_BLANK); if (IsLocalGame()) PlatformProfile.SetCurrentGameActivity( idx, CONTEXT_PRESENCE_MULTIPLAYEROFFLINE, false); @@ -1328,7 +1329,9 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // pInviteInfo; // tell the app to process this - { app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); } + { + app.ProcessInvite(userIndex, localUsersMask, pInviteInfo); + } } } } diff --git a/targets/app/common/Network/GameNetworkManager.h b/targets/app/common/Network/GameNetworkManager.h index 622d44112..84ee1078b 100644 --- a/targets/app/common/Network/GameNetworkManager.h +++ b/targets/app/common/Network/GameNetworkManager.h @@ -4,12 +4,13 @@ #include #include #include + #include "minecraft/network/INetworkService.h" -#include "platform/thread/C4JThread.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/network/IPlatformNetwork.h" +#include "platform/network/NetTypes.h" #include "platform/network/network.h" +#include "platform/thread/C4JThread.h" class ClientConnection; class Minecraft; diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index d4b4618f0..e7e309a03 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -7,7 +7,6 @@ #include "app/common/DLC/DLCPack.h" #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/NetworkController.h b/targets/app/common/NetworkController.h index 29ebaa0e0..82a1e0032 100644 --- a/targets/app/common/NetworkController.h +++ b/targets/app/common/NetworkController.h @@ -4,8 +4,8 @@ #include "app/common/App_structs.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" #include "platform/storage/storage.h" struct INVITE_INFO; diff --git a/targets/app/common/SaveManager.cpp b/targets/app/common/SaveManager.cpp index 3b10dbe4a..9919d6021 100644 --- a/targets/app/common/SaveManager.cpp +++ b/targets/app/common/SaveManager.cpp @@ -4,7 +4,6 @@ #include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/Game.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp index 58c08a47d..e77054799 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.cpp @@ -4,17 +4,17 @@ #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/PlayerInfoPacket.h" -#include "platform/network/network.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/network/network.h" ChangeStateConstraint::ChangeStateConstraint( Tutorial* tutorial, eTutorial_State targetState, diff --git a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h index c6df3a7a6..22a99e4f1 100644 --- a/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h +++ b/targets/app/common/Tutorial/Constraints/ChangeStateConstraint.h @@ -3,8 +3,8 @@ #include #include "TutorialConstraint.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class AABB; class Tutorial; diff --git a/targets/app/common/Tutorial/FullTutorial.cpp b/targets/app/common/Tutorial/FullTutorial.cpp index c5213a11c..81ee5e570 100644 --- a/targets/app/common/Tutorial/FullTutorial.cpp +++ b/targets/app/common/Tutorial/FullTutorial.cpp @@ -3,6 +3,7 @@ #include #include +#include "app/common/Game.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "app/common/Tutorial/Constraints/AreaConstraint.h" #include "app/common/Tutorial/Constraints/ChangeStateConstraint.h" @@ -23,7 +24,6 @@ #include "app/common/Tutorial/Tasks/UseTileTask.h" #include "app/common/Tutorial/Tasks/XuiCraftingTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "app/common/Game.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/alchemy/PotionMacros.h" diff --git a/targets/app/common/Tutorial/Hints/AreaHint.cpp b/targets/app/common/Tutorial/Hints/AreaHint.cpp index 90531693a..34fe58eb4 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.cpp +++ b/targets/app/common/Tutorial/Hints/AreaHint.cpp @@ -4,11 +4,11 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/TutorialEnum.h" AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial, eTutorial_State displayState, eTutorial_State completeState, diff --git a/targets/app/common/Tutorial/Hints/AreaHint.h b/targets/app/common/Tutorial/Hints/AreaHint.h index c94c6039f..26887218c 100644 --- a/targets/app/common/Tutorial/Hints/AreaHint.h +++ b/targets/app/common/Tutorial/Hints/AreaHint.h @@ -1,8 +1,8 @@ #pragma once #include "TutorialHint.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class AABB; class Tutorial; diff --git a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp index 573f8bedb..dfea1d621 100644 --- a/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/DiggerItemHint.cpp @@ -57,7 +57,7 @@ int DiggerItemHint::attack(std::shared_ptr item, if (itemFound) { // It's also possible that we could hit TileEntities (eg falling // sand) so don't want to give this hint then - if (entity->instanceof (eTYPE_MOB)) { + if (entity->instanceof(eTYPE_MOB)) { return IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL; } else { return -1; diff --git a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h index 863a61720..533edffeb 100644 --- a/targets/app/common/Tutorial/Hints/LookAtEntityHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtEntityHint.h @@ -2,8 +2,8 @@ // using namespace std; #include "TutorialHint.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class ItemInstance; class Tutorial; @@ -17,7 +17,7 @@ public: LookAtEntityHint(eTutorial_Hint id, Tutorial* tutorial, int descriptionId, int titleId, eINSTANCEOF type); // TODO: 4jcraft added, this was not implemented - ~LookAtEntityHint(){}; + ~LookAtEntityHint() {}; virtual bool onLookAtEntity(eINSTANCEOF type); }; diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp index 96fd5abc9..07e028a8a 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.cpp @@ -4,8 +4,8 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/item/Item.h" +#include "minecraft/world/tutorial/TutorialEnum.h" LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial* tutorial, int tiles[], unsigned int tilesLength, diff --git a/targets/app/common/Tutorial/Hints/LookAtTileHint.h b/targets/app/common/Tutorial/Hints/LookAtTileHint.h index 548ba652e..c0eff2458 100644 --- a/targets/app/common/Tutorial/Hints/LookAtTileHint.h +++ b/targets/app/common/Tutorial/Hints/LookAtTileHint.h @@ -20,7 +20,7 @@ public: unsigned int tilesLength, int iconOverride = -1, int iData = -1, int iDataOverride = -1); // TODO: 4jcraft, added, destructor was never implemented - ~LookAtTileHint(){}; + ~LookAtTileHint() {}; virtual bool onLookAt(int id, int iData = 0); }; diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp index 65641d141..934442fb2 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.cpp +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.cpp @@ -4,8 +4,8 @@ #include "app/common/Tutorial/Hints/TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/tutorial/TutorialEnum.h" TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], unsigned int itemsLength) diff --git a/targets/app/common/Tutorial/Hints/TakeItemHint.h b/targets/app/common/Tutorial/Hints/TakeItemHint.h index d5e06f1ed..4826b2bfc 100644 --- a/targets/app/common/Tutorial/Hints/TakeItemHint.h +++ b/targets/app/common/Tutorial/Hints/TakeItemHint.h @@ -16,7 +16,7 @@ public: TakeItemHint(eTutorial_Hint id, Tutorial* tutorial, int items[], unsigned int itemsLength); // TODO: 4jcraft, added, it was never implemented - virtual ~TakeItemHint(){}; + virtual ~TakeItemHint() {}; virtual bool onTake(std::shared_ptr item); }; diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.cpp b/targets/app/common/Tutorial/Hints/TutorialHint.cpp index eb4b5435e..c5482e446 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.cpp +++ b/targets/app/common/Tutorial/Hints/TutorialHint.cpp @@ -1,10 +1,10 @@ #include "TutorialHint.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Entity; class ItemInstance; diff --git a/targets/app/common/Tutorial/Hints/TutorialHint.h b/targets/app/common/Tutorial/Hints/TutorialHint.h index 3efca9d42..c1d247a64 100644 --- a/targets/app/common/Tutorial/Hints/TutorialHint.h +++ b/targets/app/common/Tutorial/Hints/TutorialHint.h @@ -3,8 +3,8 @@ #include -#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Entity; class ItemInstance; diff --git a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp index 0c178167a..377299499 100644 --- a/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ChoiceTask.cpp @@ -6,11 +6,11 @@ #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/level/material/Material.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "platform/input/input.h" ChoiceTask::ChoiceTask( diff --git a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp index 7add2ad70..835d3cefc 100644 --- a/targets/app/common/Tutorial/Tasks/ControllerTask.cpp +++ b/targets/app/common/Tutorial/Tasks/ControllerTask.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Constraints/InputConstraint.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" -#include "app/common/Game.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp index 775a35f23..1eb60cc15 100644 --- a/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp +++ b/targets/app/common/Tutorial/Tasks/HorseChoiceTask.cpp @@ -3,10 +3,10 @@ #include #include "app/common/Tutorial/Tasks/ChoiceTask.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "java/Class.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/animal/EntityHorse.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class Tutorial; @@ -39,7 +39,7 @@ int HorseChoiceTask::getDescriptionId() { } void HorseChoiceTask::onLookAtEntity(std::shared_ptr entity) { - if ((m_eHorseType < 0) && entity->instanceof (eTYPE_HORSE)) { + if ((m_eHorseType < 0) && entity->instanceof(eTYPE_HORSE)) { std::shared_ptr horse = std::dynamic_pointer_cast(entity); if (horse->isAdult()) m_eHorseType = horse->getType(); diff --git a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp index b36f9de03..af7a61733 100644 --- a/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp +++ b/targets/app/common/Tutorial/Tasks/RideEntityTask.cpp @@ -21,7 +21,7 @@ RideEntityTask::RideEntityTask(const int eType, Tutorial* tutorial, bool RideEntityTask::isCompleted() { return bIsCompleted; } void RideEntityTask::onRideEntity(std::shared_ptr entity) { - if (entity->instanceof ((eINSTANCEOF)m_eType)) { + if (entity->instanceof((eINSTANCEOF)m_eType)) { bIsCompleted = true; } } \ No newline at end of file diff --git a/targets/app/common/Tutorial/Tutorial.cpp b/targets/app/common/Tutorial/Tutorial.cpp index 957520108..0be4a2e96 100644 --- a/targets/app/common/Tutorial/Tutorial.cpp +++ b/targets/app/common/Tutorial/Tutorial.cpp @@ -8,6 +8,7 @@ #include "TutorialMessage.h" #include "app/common/App_structs.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Constraints/TutorialConstraint.h" #include "app/common/Tutorial/Hints/DiggerItemHint.h" #include "app/common/Tutorial/Hints/LookAtEntityHint.h" @@ -20,7 +21,6 @@ #include "app/common/Tutorial/Tasks/RideEntityTask.h" #include "app/common/Tutorial/Tasks/TutorialTask.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" #include "minecraft/GameEnums.h" @@ -2802,8 +2802,8 @@ void Tutorial::onLookAtEntity(std::shared_ptr entity) { } } - if ((m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof - (eTYPE_HORSE)) { + if ((m_CurrentState == e_Tutorial_State_Gameplay) && + entity->instanceof(eTYPE_HORSE)) { changeTutorialState(e_Tutorial_State_Horse); } diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp index 3bfbb9ba9..285d02a63 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.cpp @@ -7,17 +7,17 @@ #include #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" @@ -782,7 +782,9 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { buttonX = eToolTipPickUpHalf; } - { buttonRT = eToolTipWhatIsThis; } + { + buttonRT = eToolTipWhatIsThis; + } } else { // Nothing in slot and nothing in hand. } diff --git a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h index f7742227f..56850199d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h @@ -4,8 +4,8 @@ #include #include "UIStructs.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/UI/All Platforms/UIEnums.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class HtmlString; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp index effa9750f..cde45a9ec 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_AnvilMenu.cpp @@ -3,8 +3,8 @@ #include #include -#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/Game.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp index b470964d3..a8ff44b9d 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_BeaconMenu.cpp @@ -5,11 +5,11 @@ #include #include -#include "minecraft/GameEnums.h" -#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/Game.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp index 99afc9955..b62eb32e3 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -7,16 +7,16 @@ #include #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/LocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h index 0d1189b82..da6fe24a8 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_CraftingMenu.h @@ -2,10 +2,10 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class LocalPlayer; class ItemInstance; diff --git a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp index 66a5348e4..97de9e63f 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -6,14 +6,14 @@ #include #include -#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/Game.h" +#include "app/common/UI/All Platforms/IUIScene_AbstractContainerMenu.h" #include "app/common/UI/ConsoleUIController.h" #include "java/JavaMath.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" #include "minecraft/world/entity/Painting.h" #include "minecraft/world/entity/animal/EntityHorse.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp index f8b3d944d..71b48b145 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_HUD.cpp @@ -3,12 +3,10 @@ #include #include -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "minecraft/GameEnums.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" #include "java/Class.h" +#include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" @@ -22,6 +20,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/level/material/Material.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" IUIScene_HUD::IUIScene_HUD() { m_lastActiveSlot = -1; @@ -79,9 +79,10 @@ void IUIScene_HUD::updateFrameTick() { SetDisplayName(PlatformProfile.GetDisplayName(iPad)); - SetTooltipsEnabled(((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || - (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), - eGameSetting_Tooltips) != 0))); + SetTooltipsEnabled( + ((ui.GetMenuDisplayed(PlatformProfile.GetPrimaryPad())) || + (app.GetGameSettings(PlatformProfile.GetPrimaryPad(), + eGameSetting_Tooltips) != 0))); SetActiveSlot(pMinecraft->localplayers[iPad]->inventory->selected); diff --git a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp index 015a83b6b..7b782bf40 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_PauseMenu.cpp @@ -11,11 +11,11 @@ #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/GameRules/GameRuleManager.h" #include "app/common/Network/GameNetworkManager.h" -#include "app/common/UI/UIScene.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UIScene.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp index f01c72940..38ae75cd9 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.cpp @@ -4,11 +4,10 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" -#include "util/StringHelpers.h" #include "java/InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/client/Minecraft.h" @@ -24,6 +23,7 @@ #include "minecraft/world/item/trading/MerchantRecipe.h" #include "minecraft/world/item/trading/MerchantRecipeList.h" #include "strings.h" +#include "util/StringHelpers.h" IUIScene_TradingMenu::IUIScene_TradingMenu() { m_validOffersCount = 0; diff --git a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h index 7e269a451..79df467b7 100644 --- a/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h +++ b/targets/app/common/UI/All Platforms/IUIScene_TradingMenu.h @@ -6,11 +6,11 @@ #include #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/inventory/MerchantMenu.h" #include "minecraft/world/item/Rarity.h" #include "minecraft/world/item/trading/Merchant.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class MerchantRecipe; class HtmlString; diff --git a/targets/app/common/UI/All Platforms/UIStructs.h b/targets/app/common/UI/All Platforms/UIStructs.h index 1f303e75c..65f527bfc 100644 --- a/targets/app/common/UI/All Platforms/UIStructs.h +++ b/targets/app/common/UI/All Platforms/UIStructs.h @@ -8,8 +8,8 @@ #include "UIEnums.h" #include "minecraft/GameHostOptions.h" -#include "platform/thread/C4JThread.h" #include "platform/storage/storage.h" +#include "platform/thread/C4JThread.h" class Container; class Inventory; diff --git a/targets/app/common/UI/Components/UIComponent_Chat.cpp b/targets/app/common/UI/Components/UIComponent_Chat.cpp index 2dbc61780..1a967e72e 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.cpp +++ b/targets/app/common/UI/Components/UIComponent_Chat.cpp @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIComponent_Chat.h b/targets/app/common/UI/Components/UIComponent_Chat.h index 68333ce51..3283c2a0a 100644 --- a/targets/app/common/UI/Components/UIComponent_Chat.h +++ b/targets/app/common/UI/Components/UIComponent_Chat.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp index d57d95314..11ffd7495 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.cpp @@ -1,7 +1,7 @@ #include "UIComponent_DebugUIMarketingGuide.h" -#include "app/common/UI/UIScene.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/UIScene.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h index 88681a955..3735cdaa8 100644 --- a/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h +++ b/targets/app/common/UI/Components/UIComponent_DebugUIMarketingGuide.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp index 8f8e1a866..d230bb1d6 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.cpp @@ -1,8 +1,8 @@ #include "UIComponent_MenuBackground.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIComponent_MenuBackground.h b/targets/app/common/UI/Components/UIComponent_MenuBackground.h index 02beeb6b6..2999fde7d 100644 --- a/targets/app/common/UI/Components/UIComponent_MenuBackground.h +++ b/targets/app/common/UI/Components/UIComponent_MenuBackground.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/renderer/renderer.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.cpp b/targets/app/common/UI/Components/UIComponent_Panorama.cpp index c22ec72c8..e663598b0 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.cpp +++ b/targets/app/common/UI/Components/UIComponent_Panorama.cpp @@ -4,9 +4,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIComponent_Panorama.h b/targets/app/common/UI/Components/UIComponent_Panorama.h index fcf16038c..73e85f686 100644 --- a/targets/app/common/UI/Components/UIComponent_Panorama.h +++ b/targets/app/common/UI/Components/UIComponent_Panorama.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp index ba45d5cac..4ec77d637 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.cpp @@ -1,9 +1,9 @@ #include "UIComponent_PressStartToPlay.h" -#include "app/common/UI/Controls/UIControl_Label.h" -#include "app/common/UI/UIScene.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h index 020c887ef..bcff89963 100644 --- a/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h +++ b/targets/app/common/UI/Components/UIComponent_PressStartToPlay.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp index 1ebda0182..7b734b56c 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.cpp +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.cpp @@ -1,18 +1,18 @@ #include "UIComponent_Tooltips.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/ConsoleUIController.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Components/UIComponent_Tooltips.h b/targets/app/common/UI/Components/UIComponent_Tooltips.h index 33cb096dc..4c1b4930b 100644 --- a/targets/app/common/UI/Components/UIComponent_Tooltips.h +++ b/targets/app/common/UI/Components/UIComponent_Tooltips.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp index 15d352d61..2c6956927 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.cpp @@ -4,19 +4,19 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "platform/profile/profile.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h index 70362f144..b168f1fbf 100644 --- a/targets/app/common/UI/Components/UIComponent_TutorialPopup.h +++ b/targets/app/common/UI/Components/UIComponent_TutorialPopup.h @@ -3,12 +3,12 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Components/UIScene_HUD.cpp b/targets/app/common/UI/Components/UIScene_HUD.cpp index e1f77974c..6340bf06c 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.cpp +++ b/targets/app/common/UI/Components/UIScene_HUD.cpp @@ -4,12 +4,12 @@ #include #include +#include "app/common/Game.h" #include "app/common/UI/Components/UIComponent_Chat.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Components/UIScene_HUD.h b/targets/app/common/UI/Components/UIScene_HUD.h index 464a6c0af..ea016b888 100644 --- a/targets/app/common/UI/Components/UIScene_HUD.h +++ b/targets/app/common/UI/Components/UIScene_HUD.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/ConsoleUIController.cpp b/targets/app/common/UI/ConsoleUIController.cpp index a72817a6c..8614b6e68 100644 --- a/targets/app/common/UI/ConsoleUIController.cpp +++ b/targets/app/common/UI/ConsoleUIController.cpp @@ -1,18 +1,19 @@ // GDraw GL backend for Linux -#include "platform/renderer/renderer.h" -#include "renderer/gl/gl_compat.h" #include "ConsoleUIController.h" -#include "app/common/UI/All Platforms/UIStructs.h" + #include "app/common/Iggy/gdraw/gdraw.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "platform/renderer/renderer.h" +#include "renderer/gl/gl_compat.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" #include "app/common/Iggy/include/gdraw.h" +#include "app/common/Iggy/include/rrCore.h" ConsoleUIController ui; diff --git a/targets/app/common/UI/ConsoleUIController.h b/targets/app/common/UI/ConsoleUIController.h index 624a2c501..24a951c0a 100644 --- a/targets/app/common/UI/ConsoleUIController.h +++ b/targets/app/common/UI/ConsoleUIController.h @@ -1,9 +1,9 @@ #pragma once -#include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/UIController.h" #include "app/common/Iggy/include/iggy.h" #include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/UIController.h" #include "platform/profile/profile.h" class ConsoleUIController : public UIController { diff --git a/targets/app/common/UI/Controls/UIControl.cpp b/targets/app/common/UI/Controls/UIControl.cpp index 66e38ee68..5087b3ebe 100644 --- a/targets/app/common/UI/Controls/UIControl.cpp +++ b/targets/app/common/UI/Controls/UIControl.cpp @@ -1,12 +1,12 @@ #include "UIControl.h" -#include "app/common/UI/UIScene.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/UIScene.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "java/JavaMath.h" UIControl::UIControl() { diff --git a/targets/app/common/UI/Controls/UIControl_Base.cpp b/targets/app/common/UI/Controls/UIControl_Base.cpp index 8efd3d9a5..157ec0487 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.cpp +++ b/targets/app/common/UI/Controls/UIControl_Base.cpp @@ -3,10 +3,10 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Base.h b/targets/app/common/UI/Controls/UIControl_Base.h index 0f4c75e54..ae473c079 100644 --- a/targets/app/common/UI/Controls/UIControl_Base.h +++ b/targets/app/common/UI/Controls/UIControl_Base.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp index c950d6e59..e4c065e86 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.cpp @@ -1,8 +1,8 @@ #include "UIControl_BeaconEffectButton.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h index ddaf7166a..9deb12b08 100644 --- a/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h +++ b/targets/app/common/UI/Controls/UIControl_BeaconEffectButton.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp index df0bf0200..719241704 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.cpp @@ -1,8 +1,8 @@ #include "UIControl_BitmapIcon.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h index f114dc331..a92f5f5c4 100644 --- a/targets/app/common/UI/Controls/UIControl_BitmapIcon.h +++ b/targets/app/common/UI/Controls/UIControl_BitmapIcon.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Button.cpp b/targets/app/common/UI/Controls/UIControl_Button.cpp index 9ff0647c3..e28738511 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.cpp +++ b/targets/app/common/UI/Controls/UIControl_Button.cpp @@ -1,10 +1,10 @@ #include "UIControl_Button.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Button.h b/targets/app/common/UI/Controls/UIControl_Button.h index f20bdd6eb..a20be07b7 100644 --- a/targets/app/common/UI/Controls/UIControl_Button.h +++ b/targets/app/common/UI/Controls/UIControl_Button.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp index 94cf3950b..b382fc939 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.cpp +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.cpp @@ -1,10 +1,10 @@ #include "UIControl_ButtonList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_ButtonList.h b/targets/app/common/UI/Controls/UIControl_ButtonList.h index f46ea438b..8598a56b7 100644 --- a/targets/app/common/UI/Controls/UIControl_ButtonList.h +++ b/targets/app/common/UI/Controls/UIControl_ButtonList.h @@ -3,11 +3,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp index c3d382d1e..8c61e80c0 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.cpp +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.cpp @@ -1,10 +1,10 @@ #include "UIControl_CheckBox.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_CheckBox.h b/targets/app/common/UI/Controls/UIControl_CheckBox.h index f349efb40..c5b4b8100 100644 --- a/targets/app/common/UI/Controls/UIControl_CheckBox.h +++ b/targets/app/common/UI/Controls/UIControl_CheckBox.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.cpp b/targets/app/common/UI/Controls/UIControl_Cursor.cpp index c0a9bc31a..c36aa0fea 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.cpp +++ b/targets/app/common/UI/Controls/UIControl_Cursor.cpp @@ -1,8 +1,8 @@ #include "UIControl_Cursor.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Cursor.h b/targets/app/common/UI/Controls/UIControl_Cursor.h index 52397d65d..7a517999b 100644 --- a/targets/app/common/UI/Controls/UIControl_Cursor.h +++ b/targets/app/common/UI/Controls/UIControl_Cursor.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.cpp b/targets/app/common/UI/Controls/UIControl_DLCList.cpp index 3bc119b9e..c8dd98724 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.cpp +++ b/targets/app/common/UI/Controls/UIControl_DLCList.cpp @@ -1,9 +1,9 @@ #include "UIControl_DLCList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_DLCList.h b/targets/app/common/UI/Controls/UIControl_DLCList.h index 8a63aa730..40b5e85ce 100644 --- a/targets/app/common/UI/Controls/UIControl_DLCList.h +++ b/targets/app/common/UI/Controls/UIControl_DLCList.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp index 93250ad5a..29974fb3a 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.cpp @@ -1,9 +1,9 @@ #include "UIControl_DynamicLabel.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h index 622ef07e2..e2b897ff2 100644 --- a/targets/app/common/UI/Controls/UIControl_DynamicLabel.h +++ b/targets/app/common/UI/Controls/UIControl_DynamicLabel.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp index 6e30bc79c..bdc3aabe1 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h index 1820d27dd..ef672a20f 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentBook.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp index ec1ceaf30..b5fa3c325 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.cpp @@ -5,11 +5,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY diff --git a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h index 2bfd154b3..5fc294883 100644 --- a/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h +++ b/targets/app/common/UI/Controls/UIControl_EnchantmentButton.h @@ -3,9 +3,9 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp index 9b37206ed..8cdd394f2 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.cpp @@ -1,9 +1,9 @@ #include "UIControl_HTMLLabel.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h index 7f82d9902..520ca3df9 100644 --- a/targets/app/common/UI/Controls/UIControl_HTMLLabel.h +++ b/targets/app/common/UI/Controls/UIControl_HTMLLabel.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Label.cpp b/targets/app/common/UI/Controls/UIControl_Label.cpp index d05165c4d..6c46af9de 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.cpp +++ b/targets/app/common/UI/Controls/UIControl_Label.cpp @@ -1,10 +1,10 @@ #include "UIControl_Label.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Label.h b/targets/app/common/UI/Controls/UIControl_Label.h index a91daeb63..09b61dcd8 100644 --- a/targets/app/common/UI/Controls/UIControl_Label.h +++ b/targets/app/common/UI/Controls/UIControl_Label.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp index be5a218c6..c16fa9f8b 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.cpp @@ -1,9 +1,9 @@ #include "UIControl_LeaderboardList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h index 0843c9ef8..b173d4280 100644 --- a/targets/app/common/UI/Controls/UIControl_LeaderboardList.h +++ b/targets/app/common/UI/Controls/UIControl_LeaderboardList.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp index 8b6c42a35..a1640bdf5 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.cpp @@ -3,9 +3,9 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h index e353401e8..ef44ad127 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftHorse.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp index d60571d4b..95e3b4fa0 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.cpp @@ -3,9 +3,9 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h index 3bb87792a..04b5558b7 100644 --- a/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h +++ b/targets/app/common/UI/Controls/UIControl_MinecraftPlayer.h @@ -1,7 +1,7 @@ #pragma once -#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp index 49094c335..b097b7226 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.cpp @@ -1,9 +1,9 @@ #include "UIControl_PlayerList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_PlayerList.h b/targets/app/common/UI/Controls/UIControl_PlayerList.h index 277a298cf..ca4439562 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerList.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerList.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp index 7d5ab5f02..a27d21c71 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.cpp @@ -6,8 +6,8 @@ #include #include -#include "app/common/UI/Controls/UIControl.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/Controls/UIControl.h" #include "minecraft/GameEnums.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY diff --git a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h index e32732b85..fb4a23171 100644 --- a/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h +++ b/targets/app/common/UI/Controls/UIControl_PlayerSkinPreview.h @@ -5,8 +5,8 @@ #include #include -#include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Progress.cpp b/targets/app/common/UI/Controls/UIControl_Progress.cpp index 466922f69..d1d1b352e 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.cpp +++ b/targets/app/common/UI/Controls/UIControl_Progress.cpp @@ -1,10 +1,10 @@ #include "UIControl_Progress.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Progress.h b/targets/app/common/UI/Controls/UIControl_Progress.h index d4d715585..dc7518d9e 100644 --- a/targets/app/common/UI/Controls/UIControl_Progress.h +++ b/targets/app/common/UI/Controls/UIControl_Progress.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.cpp b/targets/app/common/UI/Controls/UIControl_SaveList.cpp index f92ad5467..c2688b39c 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SaveList.cpp @@ -1,9 +1,9 @@ #include "UIControl_SaveList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SaveList.h b/targets/app/common/UI/Controls/UIControl_SaveList.h index fef3b7fca..a50ca548b 100644 --- a/targets/app/common/UI/Controls/UIControl_SaveList.h +++ b/targets/app/common/UI/Controls/UIControl_SaveList.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Slider.cpp b/targets/app/common/UI/Controls/UIControl_Slider.cpp index b5272faff..fa56baaeb 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.cpp +++ b/targets/app/common/UI/Controls/UIControl_Slider.cpp @@ -1,16 +1,16 @@ #include "UIControl_Slider.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif +#include "app/common/Audio/SoundTypes.h" #include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/ConsoleUIController.h" -#include "app/common/Audio/SoundTypes.h" #include "util/StringHelpers.h" UIControl_Slider::UIControl_Slider() { diff --git a/targets/app/common/UI/Controls/UIControl_Slider.h b/targets/app/common/UI/Controls/UIControl_Slider.h index 830028174..67e7bae17 100644 --- a/targets/app/common/UI/Controls/UIControl_Slider.h +++ b/targets/app/common/UI/Controls/UIControl_Slider.h @@ -3,11 +3,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.cpp b/targets/app/common/UI/Controls/UIControl_SlotList.cpp index dcedc81e6..b92f9e02c 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.cpp +++ b/targets/app/common/UI/Controls/UIControl_SlotList.cpp @@ -1,9 +1,9 @@ #include "UIControl_SlotList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SlotList.h b/targets/app/common/UI/Controls/UIControl_SlotList.h index 85f9cccba..bb0004669 100644 --- a/targets/app/common/UI/Controls/UIControl_SlotList.h +++ b/targets/app/common/UI/Controls/UIControl_SlotList.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp index 7361929d5..d7f581f4f 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.cpp @@ -1,10 +1,10 @@ #include "UIControl_SpaceIndicatorBar.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h index 4604e411e..3103a0dec 100644 --- a/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h +++ b/targets/app/common/UI/Controls/UIControl_SpaceIndicatorBar.h @@ -7,11 +7,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SpaceIndicatorBar.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.cpp b/targets/app/common/UI/Controls/UIControl_TextInput.cpp index 94c093a10..275f574ff 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.cpp +++ b/targets/app/common/UI/Controls/UIControl_TextInput.cpp @@ -1,10 +1,10 @@ #include "UIControl_TextInput.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_TextInput.h b/targets/app/common/UI/Controls/UIControl_TextInput.h index 81cce8103..8804e1816 100644 --- a/targets/app/common/UI/Controls/UIControl_TextInput.h +++ b/targets/app/common/UI/Controls/UIControl_TextInput.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp index 5fa272f0d..623f92f36 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.cpp @@ -1,10 +1,10 @@ #include "UIControl_TexturePackList.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_TexturePackList.h b/targets/app/common/UI/Controls/UIControl_TexturePackList.h index 564ffa6fd..61afb1c93 100644 --- a/targets/app/common/UI/Controls/UIControl_TexturePackList.h +++ b/targets/app/common/UI/Controls/UIControl_TexturePackList.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Touch.cpp b/targets/app/common/UI/Controls/UIControl_Touch.cpp index 27ac76b77..2e35b3ef1 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.cpp +++ b/targets/app/common/UI/Controls/UIControl_Touch.cpp @@ -1,9 +1,9 @@ #include "UIControl_Touch.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Base.h" -#include "app/common/UI/ConsoleUIController.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Controls/UIControl_Touch.h b/targets/app/common/UI/Controls/UIControl_Touch.h index 7002d3832..2fc78791b 100644 --- a/targets/app/common/UI/Controls/UIControl_Touch.h +++ b/targets/app/common/UI/Controls/UIControl_Touch.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Touch.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp index a20f7146f..b5e2938a6 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.cpp @@ -3,14 +3,14 @@ #include +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h index 827070346..b864f1c0e 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h @@ -2,13 +2,13 @@ #ifdef _DEBUG_MENUS_ENABLED #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "minecraft/server/ServerAction.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp index 48fe9c309..455f36fda 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOptions.cpp @@ -1,7 +1,7 @@ #include "UIScene_DebugOptions.h" -#include "app/common/UI/UIScene.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/UIScene.h" #include "minecraft/Console_Debug_enum.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp index 5866dfb34..03e96e2d3 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.cpp @@ -5,20 +5,20 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.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" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/profile/profile.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/commands/common/EnchantItemCommand.h" #include "minecraft/commands/common/GiveItemCommand.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h index b5c71b8d8..a7a6921e5 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h @@ -5,12 +5,12 @@ #include #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp index d8c0e299c..2e5a8222c 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.cpp @@ -5,14 +5,14 @@ #include +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/world/phys/Vec3.h" #include "platform/input/input.h" diff --git a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h index 9c43f482c..59e4b1d4f 100644 --- a/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h +++ b/targets/app/common/UI/Scenes/Debug/UIScene_DebugSetCamera.h @@ -2,13 +2,13 @@ #ifdef _DEBUG_MENUS_ENABLED #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 cbe183937..e03066933 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 @@ -6,12 +6,12 @@ #include "app/common/App_structs.h" #include "app/common/DLC/DLCManager.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Game.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/Scenes/Frontend Menu screens/IUIScene_StartGame.h b/targets/app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h index 67e4c1729..d4a8730ac 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,13 +2,13 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 7da5d9084..6fb96d952 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 @@ -6,10 +6,13 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -17,8 +20,6 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" @@ -28,12 +29,11 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/LevelSettings.h" #include "minecraft/world/level/chunk/ChunkSource.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" +#include "platform/network/NetTypes.h" #include "platform/profile/profile.h" #include "strings.h" #include "util/StringHelpers.h" 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 f48be57a3..e7ddeb5b9 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 @@ -6,6 +6,7 @@ #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -16,7 +17,6 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class DLCPack; 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 135c020f9..597731396 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,12 +1,12 @@ #include "UIScene_DLCMainMenu.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "strings.h" 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 e21e4713a..f572e61dc 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,12 +2,12 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 5857d64fe..e67158bfc 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 @@ -3,13 +3,13 @@ #include +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_DLCList.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #include "strings.h" 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 e03f4eaa2..5968ea869 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,6 +2,7 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 296d44c1a..3987c9415 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 @@ -3,15 +3,15 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h index c544dcd38..b0d2b7221 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_EULA.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 1f3fbff69..dab36146a 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,9 +1,9 @@ #include "UIScene_Intro.h" -#include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/UIScene.h" #include "app/common/Iggy/include/iggy.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UIScene.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h index 417b939d2..49a6414d5 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_Intro.h @@ -2,9 +2,9 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 e78e29497..50ff87332 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 @@ -4,22 +4,22 @@ #include #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "platform/network/network.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/level/LevelSettings.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" 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 348534ad7..eab94aad9 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,12 +2,12 @@ #include +#include "app/common/Iggy/include/rrCore.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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class FriendSessionInfo; 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 e983ff248..9156eda3d 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,6 +4,9 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" @@ -11,12 +14,9 @@ #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h index ed9c2d703..4de255444 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_LaunchMoreOptionsMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 e4177b3a0..1b23301ad 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,18 +8,18 @@ #include -#include "platform/leaderboard/leaderboard.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/leaderboard/leaderboard.h" #include "platform/profile/profile.h" #include "strings.h" @@ -206,8 +206,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_RIGHT_SCROLL: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - PlatformLeaderboard.isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -239,8 +238,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_RIGHT: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - PlatformLeaderboard.isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -270,8 +268,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_PAGEDOWN: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - PlatformLeaderboard.isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -284,8 +281,7 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, case ACTION_MENU_X: { // Do nothing if a stats read is currently in progress, otherwise // the system complains about to many read requests - if (pressed && m_bPopulatedOnce && - PlatformLeaderboard.isIdle()) { + if (pressed && m_bPopulatedOnce && PlatformLeaderboard.isIdle()) { // CD - Added for audio ui.PlayUISFX(eSFX_Scroll); @@ -347,7 +343,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { m_newEntryIndex = (unsigned int)startIndex; // m_newReadSize = std::min((int)READ_SIZE, // (int)m_leaderboard.m_totalEntryCount-(startIndex-1)); - } + } // app.DebugPrintf("Requesting stats read %d - %d - %d\n", // m_currentLeaderboard, startIndex == -1 ? m_currentFilter : 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 c3534bb47..41df37f72 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 @@ -3,14 +3,14 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_LeaderboardList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" -#include "platform/storage/storage.h" #include "platform/leaderboard/leaderboard.h" +#include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.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 590695afc..a9182a013 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 @@ -4,10 +4,13 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" @@ -15,8 +18,6 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Scenes/Frontend Menu screens/IUIScene_StartGame.h" #include "app/common/UI/UILayer.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameHostOptions.h" #include "minecraft/GameTypes.h" @@ -26,11 +27,10 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "strings.h" 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 1ccabe697..005126ca0 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 @@ -5,6 +5,7 @@ #include "IUIScene_StartGame.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" @@ -14,7 +15,6 @@ #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/Controls/UIControl_TexturePackList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class DLCPack; 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 9b419a500..6575211f8 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,14 +6,15 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "java/File.h" #include "java/InputOutputStream/FileInputStream.h" #include "minecraft/GameEnums.h" @@ -21,13 +22,12 @@ #include "minecraft/client/Minecraft.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" -#include "platform/network/NetTypes.h" #include "platform/input/input.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" 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 3c89fa2e4..104394ca3 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,13 +5,13 @@ #include #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SaveList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "java/File.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/FileHeader.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 0283787eb..a0ea8582f 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 @@ -1,6 +1,5 @@ #include "UIScene_MainMenu.h" -#include "platform/game/game.h" #include #include @@ -9,14 +8,15 @@ #include #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/InputStreamReader.h" @@ -29,9 +29,9 @@ #include "minecraft/client/gui/Font.h" #include "minecraft/client/gui/ScreenSizeCalculator.h" #include "minecraft/server/MinecraftServer.h" -#include "app/common/Audio/SoundTypes.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/game/game.h" +#include "platform/network/NetTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "strings.h" 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 687e70d31..98712efca 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,11 +5,11 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.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 805722248..e32a94edc 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,15 +3,15 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/GameTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "strings.h" UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h index f7490622f..4fff97e1b 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_NewUpdateMessage.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 aba3cb3e9..b50713a4a 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 @@ -1,14 +1,14 @@ #include "UIScene_SaveMessage.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/ProfileConstants.h" diff --git a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h index a62ab5c40..2a512b612 100644 --- a/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h +++ b/targets/app/common/UI/Scenes/Frontend Menu screens/UIScene_SaveMessage.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 6d6d771e1..980f65d3e 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,11 +1,11 @@ #include "UIScene_TrialExitUpsell.h" -#include "app/common/UI/UIScene.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UIScene.h" #include "minecraft/GameTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.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 9765e1ea5..8c29b49ba 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.cpp @@ -4,17 +4,17 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/BuildVer.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Abilities.h" #include "platform/input/input.h" #include "strings.h" @@ -75,7 +75,9 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData, char* layoutString = new char[128]; snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[iSelected])); - { m_labelCurrentLayout.init(layoutString); } + { + m_labelCurrentLayout.init(layoutString); + } m_iCurrentNavigatedControlsLayout = iSelected; @@ -172,7 +174,9 @@ void UIScene_ControlsMenu::handlePress(F64 controlId, F64 childId) { snprintf(layoutString, 128, "%s : %s", app.GetString(IDS_CURRENT_LAYOUT), app.GetString(m_iSchemeTextA[control])); - { m_labelCurrentLayout.setLabel(layoutString); } + { + m_labelCurrentLayout.setLabel(layoutString); + } break; }; diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h index 8a2f3f97c..cfec284b6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ControlsMenu.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 b8a4602df..aa51481b6 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.cpp @@ -4,10 +4,10 @@ #include #include -#include "app/common/UI/UILayer.h" -#include "app/common/UI/UIScene.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h index c70a3724e..f2f77632c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_Credits.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 897f778b4..28143d744 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.cpp @@ -1,13 +1,13 @@ #include "UIScene_HelpAndOptionsMenu.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h index 769d0dd88..147566885 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HelpAndOptionsMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 05b239820..d8be9f2ab 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.cpp @@ -6,12 +6,12 @@ #include -#include "app/common/UI/Controls/UIControl_Label.h" -#include "app/common/UI/UIScene.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Controls/UIControl_Label.h" +#include "app/common/UI/UIScene.h" #include "minecraft/GameEnums.h" -#include "app/common/Audio/SoundTypes.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h index a04b6c215..a29f00e9e 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlay.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_DynamicLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 ac71449da..51c1468e1 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.cpp @@ -3,13 +3,13 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" -#include "app/common/Audio/SoundTypes.h" #include "strings.h" // strings for buttons in the list @@ -110,7 +110,9 @@ void UIScene_HowToPlayMenu::updateComponents() { void UIScene_HowToPlayMenu::handleReload() { for (unsigned int i = 0; i < eHTPButton_Max; ++i) { // 4J Stu - Re-add for future platforms - { m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); } + { + m_buttonListHowTo.addItem(app.GetString(m_uiHTPButtonNameA[i]), i); + } } doHorizontalResizeCheck(); diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h index e47fa6825..582bcb40d 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_HowToPlayMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 d34d56dac..678631c89 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.cpp @@ -1,12 +1,12 @@ #include "UIScene_LanguageSelector.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" -#include "app/common/Audio/SoundTypes.h" #include "strings.h" // strings for buttons in the list diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h index e7913966a..9d1240b9f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_LanguageSelector.h @@ -2,14 +2,14 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_ButtonList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/network/NetTypes.h" #include "platform/XboxStubs.h" +#include "platform/network/NetTypes.h" #include "platform/profile/ProfileConstants.h" class UILayer; 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 258808d44..c91307abc 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.cpp @@ -1,10 +1,10 @@ #include "UIScene_ReinstallMenu.h" -#include "app/common/UI/UILayer.h" -#include "app/common/UI/UIScene.h" #include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UILayer.h" +#include "app/common/UI/UIScene.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h index 7ccb555cd..d64ff33e9 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_ReinstallMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 15fb016e8..e79cd3599 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.cpp @@ -3,11 +3,11 @@ #include +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h index b3a5fcaf1..c74f4cf33 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsAudioMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 6a51d1e9c..7b5a30786 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.cpp @@ -2,11 +2,11 @@ #include +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h index 06752c112..b2d563757 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsControlMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 8a8ae7b89..ef9e7a073 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.cpp @@ -2,13 +2,13 @@ #include +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h index 205dccd66..0e3943fcb 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsGraphicsMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 48488c295..d9e13f32b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.cpp @@ -1,13 +1,13 @@ #include "UIScene_SettingsMenu.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.h" 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 87faa8070..ff2c03e9c 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsMenu.h @@ -2,10 +2,10 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 98cf633f9..dc3a0fb01 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.cpp @@ -3,18 +3,18 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h index 71e67acb6..692ed4d2b 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsOptionsMenu.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 ac43c3c69..2eb5912df 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.cpp @@ -3,12 +3,12 @@ #include +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h index 26a8a9c19..fc135ff38 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SettingsUIMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Slider.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 2f241c1fa..cc4de5bff 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -5,20 +5,20 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" #include "app/common/DLC/DLCSkinFile.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Minecraft_Macros.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/model/SkinBox.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/ProfileConstants.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" 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 f186e6286..b7e9299bf 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -4,12 +4,12 @@ #include #include "app/common/DLC/DLCPack.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerSkinPreview.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.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 06f2f0e32..725618e7a 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,16 +4,16 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Cursor.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" 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 1791c2a82..62a0ecd1f 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,13 +2,13 @@ #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.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 b313afc82..13d78f813 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 @@ -1,6 +1,5 @@ #include "UIScene_AnvilMenu.h" -#include "platform/game/game.h" #include #include @@ -8,14 +7,13 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/world/entity/player/Abilities.h" @@ -23,6 +21,8 @@ #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/inventory/AnvilMenu.h" #include "minecraft/world/inventory/Slot.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "strings.h" 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 d373e7c36..28b906b24 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,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_AnvilMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" @@ -11,7 +12,6 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/input/input.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp index 328b196da..5097afe16 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.cpp @@ -1,24 +1,24 @@ #include "UIScene_BeaconMenu.h" -#include "platform/game/game.h" #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_BeaconEffectButton.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/BeaconMenu.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h index d0f1f53a1..5282a8965 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_BeaconMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_BeaconMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -10,7 +11,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 a85be489c..ba2670a51 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 @@ -1,22 +1,22 @@ #include "UIScene_BrewingStandMenu.h" -#include "platform/game/game.h" #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/BrewingStandMenu.h" #include "minecraft/world/item/alchemy/PotionBrewing.h" #include "minecraft/world/level/tile/entity/BrewingStandTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/profile/profile.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp index f57e6b61c..405b31139 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_ContainerMenu.cpp @@ -4,18 +4,18 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/inventory/AbstractContainerMenu.h" #include "minecraft/world/inventory/ContainerMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp index 26aaa6096..60fd450ec 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.cpp @@ -4,24 +4,24 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Iggy/include/iggy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/SimpleContainer.h" #include "platform/XboxStubs.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h index 001372706..92e86282d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_CreativeMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_CreativeMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Base.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp index 09346d5df..99166d7fc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_DispenserMenu.cpp @@ -4,17 +4,17 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/TrapMenu.h" #include "minecraft/world/level/tile/entity/DispenserTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; 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 2f94b1942..06ec9498e 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 @@ -1,23 +1,23 @@ #include "UIScene_EnchantingMenu.h" -#include "platform/game/game.h" #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_EnchantmentBook.h" #include "app/common/UI/Controls/UIControl_EnchantmentButton.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/EnchantmentMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h index ad96ee171..f4de320cb 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_EnchantingMenu.h @@ -3,6 +3,7 @@ #include #include "UIScene_AbstractContainerMenu.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_EnchantingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -12,7 +13,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" class InventoryMenu; class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp index 1cce87774..2df9c6a4a 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.cpp @@ -4,16 +4,16 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/world/inventory/FireworksMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h index b9f4aeba9..b11207dfb 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_FireworksMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_FireworksMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 1ae2b33af..fb463ad2b 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 @@ -1,20 +1,20 @@ #include "UIScene_FurnaceMenu.h" -#include "platform/game/game.h" #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/inventory/FurnaceMenu.h" #include "minecraft/world/level/tile/entity/FurnaceTileEntity.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp index 5221755d6..71aa4f94b 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HopperMenu.cpp @@ -4,18 +4,18 @@ #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" #include "minecraft/client/Minecraft.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/inventory/HopperMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp index 095bee858..775d1af5c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.cpp @@ -1,19 +1,19 @@ #include "UIScene_HorseInventoryMenu.h" -#include "platform/game/game.h" #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Iggy/include/iggy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h index c54f491fc..3e624caf4 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_HorseInventoryMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_HorseInventoryMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -10,7 +11,6 @@ #include "app/common/UI/Controls/UIControl_MinecraftHorse.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp index 4e5c4e3fc..9cbc3fdfc 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.cpp @@ -7,14 +7,13 @@ #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_AbstractContainerMenu.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -22,6 +21,7 @@ #include "minecraft/stats/GenericStats.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/inventory/InventoryMenu.h" +#include "minecraft/world/tutorial/TutorialEnum.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h index d2d0c012c..601d0e95d 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_InventoryMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_InventoryMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_MinecraftPlayer.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 2a55d0f5a..8f58c8451 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 @@ -1,20 +1,18 @@ #include "UIScene_TradingMenu.h" -#include "platform/game/game.h" #include #include #include +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/util/HtmlString.h" @@ -22,6 +20,8 @@ #include "minecraft/world/inventory/Slot.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/trading/MerchantRecipe.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/profile/profile.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h index 172b6c31d..a4161d29c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_TradingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 a941f5264..89c9306c0 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,17 +1,15 @@ #include "UIScene_CraftingMenu.h" -#include "platform/game/game.h" +#include "app/common/Game.h" #include "app/common/Tutorial/Tutorial.h" -#include "minecraft/world/tutorial/TutorialEnum.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_HTMLLabel.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/client/player/LocalPlayer.h" @@ -22,6 +20,8 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/item/ItemInstance.h" #include "minecraft/world/item/crafting/Recipy.h" +#include "minecraft/world/tutorial/TutorialEnum.h" +#include "platform/game/game.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h index 0f0f2fea9..8a6c9124c 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_CraftingMenu.h @@ -3,6 +3,7 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/IUIScene_CraftingMenu.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" @@ -10,7 +11,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_SlotList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 a06577e42..957a7f8f1 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,15 +3,15 @@ #include +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h index 957c007e8..05b284cd5 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_DeathMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.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" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 5973ec0c5..45fca4abc 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 @@ -6,10 +6,10 @@ #include -#include "app/common/Tutorial/Tutorial.h" -#include "app/common/UI/UIScene.h" #include "app/common/Game.h" +#include "app/common/Tutorial/Tutorial.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UIScene.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/SharedConstants.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h index b3e84ac73..bbb4ea473 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_EndPoem.h @@ -3,9 +3,9 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif 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 8810fe807..ea3ad81ec 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,20 +3,20 @@ #include +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" -#include "platform/network/network.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/network/network.h" #include "strings.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h index 56cf2932b..236cc1306 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameHostOptionsMenu.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; 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 1f593e443..98b654614 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 @@ -2,24 +2,24 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" -#include "platform/network/network.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" 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 881c31800..60f75b8fb 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,13 +4,13 @@ #include #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Network/GameNetworkManager.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" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class INetworkPlayer; 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 0ac04f288..527d23d7c 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,23 +3,23 @@ #include +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Scenes/In-Game Menu Screens/UIScene_InGameInfoMenu.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/KickPlayerPacket.h" #include "minecraft/network/packet/PlayerInfoPacket.h" -#include "platform/network/network.h" #include "minecraft/world/entity/player/Player.h" +#include "platform/network/network.h" #include "strings.h" class UILayer; 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 eca332c3a..62d6d4866 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,13 +3,13 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_CheckBox.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.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 2c8c5332c..27f93a7c4 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,17 +5,18 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "app/common/DLC/DLCManager.h" #include "app/common/DLC/DLCPack.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/IUIScene_PauseMenu.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" @@ -23,7 +24,6 @@ #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/profile/profile.h" #include "strings.h" 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 67a5235dc..ce1ea3377 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,11 +2,11 @@ #include +#include "app/common/Iggy/include/rrCore.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" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/storage/storage.h" class UILayer; 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 78c10f4f8..c28be48be 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,20 +1,20 @@ #include "UIScene_SignEntryMenu.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "minecraft/network/packet/SignUpdatePacket.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "platform/input/input.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h index 7c970c6e6..ac41b5f67 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_SignEntryMenu.h @@ -3,12 +3,12 @@ #include #include +#include "app/common/Iggy/include/rrCore.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" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class SignTileEntity; class UILayer; 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 7001ea596..0166c1c05 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,21 +3,21 @@ #include +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/ClientConnection.h" #include "minecraft/network/packet/GameCommandPacket.h" -#include "platform/network/network.h" #include "minecraft/server/commands/TeleportCommand.h" -#include "app/common/Audio/SoundTypes.h" +#include "platform/network/network.h" #include "strings.h" UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h index 6fd744c92..615dba118 100644 --- a/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h +++ b/targets/app/common/UI/Scenes/In-Game Menu Screens/UIScene_TeleportMenu.h @@ -3,12 +3,12 @@ #include #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_PlayerList.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" #include "platform/network/NetTypes.h" class INetworkPlayer; diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp index 68f002824..4eaaa2ae3 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.cpp @@ -1,15 +1,15 @@ #include "UIScene_ConnectingProgress.h" +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" diff --git a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h index 77142221c..084582a83 100644 --- a/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_ConnectingProgress.h @@ -2,13 +2,13 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp index b7481f470..c56edb1ff 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.cpp @@ -4,22 +4,22 @@ #include #include +#include "app/common/Game.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/Tutorial/Tutorial.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameEnums.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" -#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" +#include "platform/thread/C4JThread.h" #include "strings.h" UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void* initData, diff --git a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h index 7fd8730cf..0dcf321ea 100644 --- a/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h +++ b/targets/app/common/UI/Scenes/UIScene_FullscreenProgress.h @@ -2,6 +2,7 @@ #include +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -9,7 +10,6 @@ #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_Progress.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" class C4JThread; class UILayer; diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp index e81b0e72e..f1b74a608 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.cpp @@ -1,12 +1,12 @@ #include "UIScene_Keyboard.h" +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "minecraft/GameTypes.h" #include "strings.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/Scenes/UIScene_Keyboard.h b/targets/app/common/UI/Scenes/UIScene_Keyboard.h index 3c1cd0e57..5b7d98d18 100644 --- a/targets/app/common/UI/Scenes/UIScene_Keyboard.h +++ b/targets/app/common/UI/Scenes/UIScene_Keyboard.h @@ -2,12 +2,12 @@ #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/Controls/UIControl_TextInput.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp index 6d232223f..e3b9516b5 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.cpp @@ -1,13 +1,13 @@ #include "UIScene_MessageBox.h" +#include "app/common/Game.h" #include "app/common/UI/All Platforms/UIStructs.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_Button.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/app/common/UI/Scenes/UIScene_MessageBox.h b/targets/app/common/UI/Scenes/UIScene_MessageBox.h index 7f086b4b0..8c2c121f5 100644 --- a/targets/app/common/UI/Scenes/UIScene_MessageBox.h +++ b/targets/app/common/UI/Scenes/UIScene_MessageBox.h @@ -2,11 +2,11 @@ #include +#include "app/common/Iggy/include/iggy.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" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/storage/storage.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp index a3515f42a..a8019e001 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.cpp @@ -3,12 +3,12 @@ #include +#include "app/common/Game.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UILayer.h" #include "app/common/UI/UIScene.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" @@ -138,7 +138,9 @@ void UIScene_QuadrantSignin::updateState() { // app.DebugPrintf("Index %d is signed in, display name - '%s'\n", // i, PlatformProfile.GetDisplayName(i).data()); - { setControllerState(i, eControllerStatus_PlayerDetails); } + { + setControllerState(i, eControllerStatus_PlayerDetails); + } m_labelDisplayName[i].setLabel(PlatformProfile.GetDisplayName(i)); // m_buttonControllers[i].setLabel(app.GetString(IDS_TOOLTIPS_CONTINUE),i); @@ -223,7 +225,9 @@ void UIScene_QuadrantSignin::_initQuadrants() { if (PlatformProfile.IsSignedIn(i)) { app.DebugPrintf("Index %d is signed in\n", i); - { setControllerState(i, eControllerStatus_PlayerDetails); } + { + setControllerState(i, eControllerStatus_PlayerDetails); + } m_labelDisplayName[i].init(PlatformProfile.GetDisplayName(i)); } else if (PlatformInput.IsPadConnected(i)) { diff --git a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h index dc7a4c684..af04d0d32 100644 --- a/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h +++ b/targets/app/common/UI/Scenes/UIScene_QuadrantSignin.h @@ -3,13 +3,13 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" #include "app/common/UI/Controls/UIControl_BitmapIcon.h" #include "app/common/UI/Controls/UIControl_Label.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/iggy.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/common/UI/UIBitmapFont.cpp b/targets/app/common/UI/UIBitmapFont.cpp index 2ba16f8d4..50062c000 100644 --- a/targets/app/common/UI/UIBitmapFont.cpp +++ b/targets/app/common/UI/UIBitmapFont.cpp @@ -282,7 +282,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, while ((0.5f + glyphScale) * truePixelScale < targetPixelScale) glyphScale++; - // 4J-JEV: Debug code to check which font sizes are being used. + // 4J-JEV: Debug code to check which font sizes are being used. #if (!defined _CONTENT_PACKAGE) && (VERBOSE_FONT_OUTPUT > 0) struct DebugData { diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 6a8c6b5b9..21db28c7a 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -12,6 +12,7 @@ #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCManager.h" +#include "app/common/Iggy/include/iggy.h" #include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" @@ -26,7 +27,6 @@ #include "app/common/UI/UIScene.h" #include "app/common/UI/UIString.h" #include "app/common/UI/UITTFFont.h" -#include "app/common/Iggy/include/iggy.h" #include "minecraft/GameEnums.h" #include "platform/input/input.h" #include "platform/profile/profile.h" @@ -45,8 +45,8 @@ #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/client/title/TitleScreen.h" -#include "platform/thread/C4JThread.h" #include "platform/XboxStubs.h" +#include "platform/thread/C4JThread.h" #include "strings.h" #include "util/StringHelpers.h" #include "util/Timer.h" @@ -962,7 +962,6 @@ void UIController::setupCustomDrawGameState() { m_customRenderingClearRect.top = LONG_MAX; m_customRenderingClearRect.bottom = LONG_MIN; - PlatformRenderer.StartFrame(); PlatformRenderer.Set_matrixDirty(); diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 3843b63e8..b44e3b873 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -8,19 +8,18 @@ #include #include -#include "util/Timer.h" - #include "app/common/Iggy/include/iggy.h" +#include "util/Timer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif #include "UIGroup.h" +#include "app/common/Audio/SoundTypes.h" +#include "app/common/Iggy/include/rrCore.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" #include "app/common/UI/Controls/UIControl.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" diff --git a/targets/app/common/UI/UIGroup.cpp b/targets/app/common/UI/UIGroup.cpp index 9a9b62e7a..f008de7b7 100644 --- a/targets/app/common/UI/UIGroup.cpp +++ b/targets/app/common/UI/UIGroup.cpp @@ -1,12 +1,12 @@ #include "UIGroup.h" +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/Tutorial/Tutorial.h" #include "app/common/Tutorial/TutorialMode.h" #include "app/common/UI/All Platforms/UIEnums.h" -#include "app/common/UI/UILayer.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Game.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/UILayer.h" #include "minecraft/client/MemoryTracker.h" #include "minecraft/client/Minecraft.h" #include "platform/profile/profile.h" diff --git a/targets/app/common/UI/UIGroup.h b/targets/app/common/UI/UIGroup.h index 0cbec519c..5d69416b9 100644 --- a/targets/app/common/UI/UIGroup.h +++ b/targets/app/common/UI/UIGroup.h @@ -2,8 +2,8 @@ #include #include "UILayer.h" -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "platform/renderer/renderer.h" class UIComponent_Tooltips; diff --git a/targets/app/common/UI/UILayer.cpp b/targets/app/common/UI/UILayer.cpp index 29d82b0ee..efa8abaf0 100644 --- a/targets/app/common/UI/UILayer.cpp +++ b/targets/app/common/UI/UILayer.cpp @@ -2,6 +2,8 @@ #include +#include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.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" @@ -13,6 +15,7 @@ #include "app/common/UI/Components/UIComponent_Tooltips.h" #include "app/common/UI/Components/UIComponent_TutorialPopup.h" #include "app/common/UI/Components/UIScene_HUD.h" +#include "app/common/UI/ConsoleUIController.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugCreateSchematic.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugOptions.h" #include "app/common/UI/Scenes/Debug/UIScene_DebugOverlay.h" @@ -75,9 +78,6 @@ #include "app/common/UI/Scenes/UIScene_Timer.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UIScene.h" -#include "app/common/Iggy/include/rrCore.h" -#include "app/common/Game.h" -#include "app/common/UI/ConsoleUIController.h" #include "platform/renderer/renderer.h" UILayer::UILayer(UIGroup* parent) { diff --git a/targets/app/common/UI/UILayer.h b/targets/app/common/UI/UILayer.h index c5c06cb6e..1d66d8dd4 100644 --- a/targets/app/common/UI/UILayer.h +++ b/targets/app/common/UI/UILayer.h @@ -6,8 +6,8 @@ #include #include -#include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/Iggy/include/rrCore.h" +#include "app/common/UI/All Platforms/UIEnums.h" #include "platform/renderer/renderer.h" // using namespace std; diff --git a/targets/app/common/UI/UIScene.cpp b/targets/app/common/UI/UIScene.cpp index f4434a368..140f73542 100644 --- a/targets/app/common/UI/UIScene.cpp +++ b/targets/app/common/UI/UIScene.cpp @@ -4,6 +4,7 @@ #include #include +#include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/Controls/UIControl.h" @@ -11,20 +12,19 @@ #include "app/common/UI/UIController.h" #include "app/common/UI/UIGroup.h" #include "app/common/UI/UILayer.h" -#include "app/common/Iggy/include/iggy.h" #include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "app/common/UI/ConsoleUIController.h" #include "java/System.h" #include "minecraft/client/Lighting.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/entity/ItemRenderer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/item/ItemInstance.h" #include "util/StringHelpers.h" diff --git a/targets/app/common/UI/UIScene.h b/targets/app/common/UI/UIScene.h index 72dad25a9..81664313e 100644 --- a/targets/app/common/UI/UIScene.h +++ b/targets/app/common/UI/UIScene.h @@ -13,10 +13,10 @@ #include #include +#include "app/common/Iggy/include/iggy.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" -#include "app/common/Iggy/include/iggy.h" #include "platform/renderer/renderer.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" @@ -55,8 +55,10 @@ class UIControl; currentRoot = lastRoot; \ } -#define UI_MAP_NAME(var, name) \ - { var = registerFastName(name); } +#define UI_MAP_NAME(var, name) \ + { \ + var = registerFastName(name); \ + } class UIScene { friend class UILayer; diff --git a/targets/app/common/UI/UITTFFont.cpp b/targets/app/common/UI/UITTFFont.cpp index aeffffb07..39436fea5 100644 --- a/targets/app/common/UI/UITTFFont.cpp +++ b/targets/app/common/UI/UITTFFont.cpp @@ -6,8 +6,8 @@ #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif -#include "app/common/Iggy/include/rrCore.h" #include "app/common/Game.h" +#include "app/common/Iggy/include/rrCore.h" #include "platform/fs/fs.h" #include "util/StringHelpers.h" diff --git a/targets/app/linux/main.cpp b/targets/app/linux/main.cpp index b51a2c55f..478f68959 100644 --- a/targets/app/linux/main.cpp +++ b/targets/app/linux/main.cpp @@ -48,27 +48,27 @@ static void sigsegv_handler(int sig) { #include #include -#include "platform/leaderboard/leaderboard.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/world/level/Level.h" +#include "platform/leaderboard/leaderboard.h" // #include "../Common/XUI/XUI_Scene_Container.h" // #include "NetworkManager.h" -#include "platform/PlatformTypes.h" -#include "platform/input/input.h" -#include "platform/profile/profile.h" -#include "platform/renderer/renderer.h" -#include "platform/storage/storage.h" -#include "platform/profile/ProfileConstants.h" #include "app/common/Audio/SoundEngine.h" -#include "app/common/Network/GameNetworkManager.h" #include "app/common/Game.h" +#include "app/common/Network/GameNetworkManager.h" #include "app/common/UI/ConsoleUIController.h" -#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/renderer/Tesselator.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/world/level/chunk/storage/OldChunkStorage.h" +#include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/PlatformTypes.h" +#include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" +#include "platform/profile/profile.h" +#include "platform/renderer/renderer.h" +#include "platform/storage/storage.h" #include "strings.h" #define THEME_NAME "584111F70AAAAAAA" @@ -103,17 +103,17 @@ void DefineActions(void) { // Split into Menu actions, and in-game actions PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_0, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -127,92 +127,92 @@ void DefineActions(void) { MAP_STYLE_0, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_0, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_1, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -226,92 +226,92 @@ void DefineActions(void) { MAP_STYLE_1, ACTION_MENU_RIGHT, _360_JOY_BUTTON_DPAD_RIGHT | _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEUP, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_RTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_1, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_A, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_B, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_X, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_Y, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OK, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_CANCEL, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps( MAP_STYLE_2, ACTION_MENU_UP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LSTICK_UP); @@ -328,77 +328,77 @@ void DefineActions(void) { MAP_STYLE_2, ACTION_MENU_PAGEUP, _360_JOY_BUTTON_DPAD_UP | _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAGEDOWN, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_RIGHT_SCROLL, - _360_JOY_BUTTON_RB); + _360_JOY_BUTTON_RB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_LEFT_SCROLL, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_JUMP, - _360_JOY_BUTTON_LT); + _360_JOY_BUTTON_LT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_FORWARD, - _360_JOY_BUTTON_LSTICK_UP); + _360_JOY_BUTTON_LSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_BACKWARD, - _360_JOY_BUTTON_LSTICK_DOWN); + _360_JOY_BUTTON_LSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT, - _360_JOY_BUTTON_LSTICK_LEFT); + _360_JOY_BUTTON_LSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT, - _360_JOY_BUTTON_LSTICK_RIGHT); + _360_JOY_BUTTON_LSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LOOK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_USE, - _360_JOY_BUTTON_RT); + _360_JOY_BUTTON_RT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_ACTION, - _360_JOY_BUTTON_A); + _360_JOY_BUTTON_A); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_RIGHT_SCROLL, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_LEFT_SCROLL, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_INVENTORY, - _360_JOY_BUTTON_Y); + _360_JOY_BUTTON_Y); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DROP, - _360_JOY_BUTTON_B); + _360_JOY_BUTTON_B); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_SNEAK_TOGGLE, - _360_JOY_BUTTON_LB); + _360_JOY_BUTTON_LB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_CRAFTING, - _360_JOY_BUTTON_X); + _360_JOY_BUTTON_X); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, - MINECRAFT_ACTION_RENDER_THIRD_PERSON, - _360_JOY_BUTTON_LTHUMB); + MINECRAFT_ACTION_RENDER_THIRD_PERSON, + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_GAME_INFO, - _360_JOY_BUTTON_BACK); + _360_JOY_BUTTON_BACK); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_PAUSEMENU, - _360_JOY_BUTTON_START); + _360_JOY_BUTTON_START); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_STICK_PRESS, - _360_JOY_BUTTON_LTHUMB); + _360_JOY_BUTTON_LTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_PRESS, - _360_JOY_BUTTON_RTHUMB); + _360_JOY_BUTTON_RTHUMB); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_UP, - _360_JOY_BUTTON_RSTICK_UP); + _360_JOY_BUTTON_RSTICK_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_DOWN, - _360_JOY_BUTTON_RSTICK_DOWN); + _360_JOY_BUTTON_RSTICK_DOWN); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_LEFT, - _360_JOY_BUTTON_RSTICK_LEFT); + _360_JOY_BUTTON_RSTICK_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, ACTION_MENU_OTHER_STICK_RIGHT, - _360_JOY_BUTTON_RSTICK_RIGHT); + _360_JOY_BUTTON_RSTICK_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_LEFT, - _360_JOY_BUTTON_DPAD_LEFT); + _360_JOY_BUTTON_DPAD_LEFT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_RIGHT, - _360_JOY_BUTTON_DPAD_RIGHT); + _360_JOY_BUTTON_DPAD_RIGHT); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_UP, - _360_JOY_BUTTON_DPAD_UP); + _360_JOY_BUTTON_DPAD_UP); PlatformInput.SetGameJoypadMaps(MAP_STYLE_2, MINECRAFT_ACTION_DPAD_DOWN, - _360_JOY_BUTTON_DPAD_DOWN); + _360_JOY_BUTTON_DPAD_DOWN); } int main(int argc, const char* argv[]) { diff --git a/targets/java/include/java/InputOutputStream/GZIPInputStream.h b/targets/java/include/java/InputOutputStream/GZIPInputStream.h index 3aa36bcb7..6fa590f70 100644 --- a/targets/java/include/java/InputOutputStream/GZIPInputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPInputStream.h @@ -11,7 +11,7 @@ private: InputStream* stream; public: - GZIPInputStream(InputStream* out) : stream(out){}; + GZIPInputStream(InputStream* out) : stream(out) {}; virtual int read() { return stream->read(); }; virtual int read(std::vector& b) { return stream->read(b); }; virtual int read(std::vector& b, unsigned int offset, diff --git a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h index d14e47821..b7015ee4f 100644 --- a/targets/java/include/java/InputOutputStream/GZIPOutputStream.h +++ b/targets/java/include/java/InputOutputStream/GZIPOutputStream.h @@ -9,7 +9,7 @@ private: OutputStream* stream; public: - GZIPOutputStream(OutputStream* out) : stream(out){}; + GZIPOutputStream(OutputStream* out) : stream(out) {}; virtual void write(unsigned int b) { stream->write(b); }; virtual void write(const std::vector& b) { stream->write(b); }; virtual void write(const std::vector& b, unsigned int offset, diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 70b3caf80..1e2ce80b5 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -90,12 +90,13 @@ File::File(const std::string& pathname) { return; } } -// #ifdef _WINDOWS64 -// std::string path = std::filesystem::path(m_abstractPathName).string(); -// std::string finalPath = PlatformStorage.GetMountedPath(path.c_str()); -// if (finalPath.size() == 0) finalPath = path; -// m_abstractPathName = finalPath; -// #endif + // #ifdef _WINDOWS64 + // std::string path = + // std::filesystem::path(m_abstractPathName).string(); std::string + // finalPath = PlatformStorage.GetMountedPath(path.c_str()); if + // (finalPath.size() == 0) finalPath = path; m_abstractPathName = + // finalPath; + // #endif /* std::vector path = stringSplit( pathname, pathSeparator ); diff --git a/targets/minecraft/BuildVer.h b/targets/minecraft/BuildVer.h index fcf6eb240..e8481b9d0 100644 --- a/targets/minecraft/BuildVer.h +++ b/targets/minecraft/BuildVer.h @@ -50,7 +50,7 @@ VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y #define VER_FILEVERSION_STR2_W(x, y) \ VER_FILEVERSION_STRING_W \ - "." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y) + "." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) "." VER_WIDE_PREFIX(#y) #define VER_FILEVERSION_STR1(x, y) VER_FILEVERSION_STR2(x, y) #define VER_FILEVERSION_STR1_W(x, y) VER_FILEVERSION_STR2_W(x, y) diff --git a/targets/minecraft/client/BufferedImage.h b/targets/minecraft/client/BufferedImage.h index d06d1cd79..c75d933ac 100644 --- a/targets/minecraft/client/BufferedImage.h +++ b/targets/minecraft/client/BufferedImage.h @@ -18,7 +18,7 @@ public: BufferedImage(int width, int height, int type); BufferedImage(const std::string& File, bool filenameHasExtension = false, bool bTitleUpdateTexture = false, - const std::string& drive = ""); // 4J added + const std::string& drive = ""); // 4J added BufferedImage(std::uint8_t* pbData, std::uint32_t dataBytes); // 4J added ~BufferedImage(); diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index f4890ddb3..efecfa163 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -17,7 +17,7 @@ #include "Timer.h" #include "User.h" #include "app/common/Audio/SoundEngine.h" -#include "minecraft/world/tutorial/ITutorial.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/UI/All Platforms/UIEnums.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "app/common/UI/ConsoleUIController.h" @@ -53,8 +53,6 @@ #include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/Packet.h" -#include "platform/network/network.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/Stats.h" #include "minecraft/stats/StatsCounter.h" #include "minecraft/util/Log.h" @@ -94,7 +92,9 @@ #include "minecraft/world/level/tile/TallGrassPlantTile.h" #include "minecraft/world/level/tile/Tile.h" #include "minecraft/world/phys/HitResult.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "platform/XboxStubs.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" #include "platform/storage/storage.h" @@ -1683,9 +1683,10 @@ void Minecraft::run_middle() { if (unoccupiedQuadrant > -1) { // render a logo PlatformRenderer.StateSetViewport(( - IPlatformRenderer::eViewportType)( - IPlatformRenderer::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + - unoccupiedQuadrant)); + IPlatformRenderer:: + eViewportType)(IPlatformRenderer:: + VIEWPORT_TYPE_QUADRANT_TOP_LEFT + + unoccupiedQuadrant)); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -2163,8 +2164,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (player->isRiding()) { std::shared_ptr mount = player->riding; - if (mount->instanceof (eTYPE_MINECART) || mount->instanceof - (eTYPE_BOAT)) { + if (mount->instanceof(eTYPE_MINECART) || + mount->instanceof(eTYPE_BOAT)) { *piAlt = IDS_TOOLTIPS_EXIT; } else { *piAlt = IDS_TOOLTIPS_DISMOUNT; @@ -3190,7 +3191,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { break; default: - if (hitResult->entity->instanceof (eTYPE_MOB)) { + if (hitResult->entity->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast( hitResult->entity); @@ -4119,9 +4120,8 @@ void Minecraft::startAndConnectTo(const std::string& name, Minecraft* minecraft; // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); - minecraft = - new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen, - leaderboard); + minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen, + leaderboard); /* - 4J - removed { diff --git a/targets/minecraft/client/Minecraft.h b/targets/minecraft/client/Minecraft.h index 3468ae23a..efb538884 100644 --- a/targets/minecraft/client/Minecraft.h +++ b/targets/minecraft/client/Minecraft.h @@ -9,10 +9,10 @@ #include "java/File.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/network/packet/DisconnectPacket.h" -#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" -#include "platform/stubs.h" #include "platform/leaderboard/leaderboard.h" +#include "platform/stubs.h" +#include "platform/thread/C4JThread.h" class Timer; class MultiPlayerLevel; diff --git a/targets/minecraft/client/gui/Screen.cpp b/targets/minecraft/client/gui/Screen.cpp index 4ef01b073..d3f7ba96f 100644 --- a/targets/minecraft/client/gui/Screen.cpp +++ b/targets/minecraft/client/gui/Screen.cpp @@ -2,6 +2,7 @@ #include "Button.h" #include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/client/Minecraft.h" @@ -12,7 +13,6 @@ #include "minecraft/network/INetworkService.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/ServerAction.h" -#include "app/common/Audio/SoundTypes.h" #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/gui/achievement/StatsScreen.cpp b/targets/minecraft/client/gui/achievement/StatsScreen.cpp index 7ab9ca3f6..8e8f129c2 100644 --- a/targets/minecraft/client/gui/achievement/StatsScreen.cpp +++ b/targets/minecraft/client/gui/achievement/StatsScreen.cpp @@ -1,5 +1,7 @@ #include "StatsScreen.h" + #include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/gui/Button.h" #include "minecraft/client/gui/Font.h" @@ -8,7 +10,6 @@ #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/locale/Language.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/ItemStat.h" #include "minecraft/stats/Stat.h" #include "minecraft/stats/Stats.h" diff --git a/targets/minecraft/client/model/BookModel.h b/targets/minecraft/client/model/BookModel.h index 940ba85b1..4efb7d06e 100644 --- a/targets/minecraft/client/model/BookModel.h +++ b/targets/minecraft/client/model/BookModel.h @@ -9,7 +9,7 @@ public: ModelPart *leftLid, *rightLid; ModelPart *leftPages, *rightPages; ModelPart *flipPage1, *flipPage2; - ModelPart *seam; + ModelPart* seam; BookModel(); virtual void render(std::shared_ptr entity, float time, float r, diff --git a/targets/minecraft/client/model/OcelotModel.h b/targets/minecraft/client/model/OcelotModel.h index c54154d3e..ee5a4d96e 100644 --- a/targets/minecraft/client/model/OcelotModel.h +++ b/targets/minecraft/client/model/OcelotModel.h @@ -39,7 +39,7 @@ public: void render(std::shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled); - void render(OcelotModel *model, float scale, bool usecompiled); + void render(OcelotModel* model, float scale, bool usecompiled); void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, std::shared_ptr entity, unsigned int uiBitmaskOverrideAnim = 0); diff --git a/targets/minecraft/client/multiplayer/ClientConnection.cpp b/targets/minecraft/client/multiplayer/ClientConnection.cpp index e28f0cee7..fc7039ecf 100644 --- a/targets/minecraft/client/multiplayer/ClientConnection.cpp +++ b/targets/minecraft/client/multiplayer/ClientConnection.cpp @@ -12,14 +12,12 @@ #include "MultiPlayerLevel.h" #include "ReceivingLevelScreen.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/ConsoleGameMode.h" -#include "minecraft/client/skins/ISkinAssetData.h" -#include "minecraft/network/Socket.h" #include "app/common/Tutorial/FullTutorialMode.h" -#include "minecraft/world/tutorial/ITutorial.h" #include "app/common/UI/All Platforms/UIStructs.h" -#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "app/common/UI/ConsoleUIController.h" +#include "app/common/UI/Scenes/In-Game Menu Screens/Containers/UIScene_TradingMenu.h" #include "java/Class.h" #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" @@ -41,10 +39,12 @@ #include "minecraft/client/player/LocalPlayer.h" #include "minecraft/client/player/RemotePlayer.h" #include "minecraft/client/renderer/LevelRenderer.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/AddEntityPacket.h" #include "minecraft/network/packet/AddExperienceOrbPacket.h" #include "minecraft/network/packet/AddGlobalEntityPacket.h" @@ -112,9 +112,7 @@ #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" #include "minecraft/network/packet/XZPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/world/SimpleContainer.h" @@ -190,8 +188,10 @@ #include "minecraft/world/level/tile/entity/SkullTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "platform/PlatformTypes.h" #include "platform/input/input.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" #include "util/StringHelpers.h" @@ -530,7 +530,7 @@ void ClientConnection::handleAddEntity( } } - if (owner->instanceof (eTYPE_PLAYER)) { + if (owner->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); std::shared_ptr hook = @@ -784,8 +784,7 @@ void ClientConnection::handleAddEntity( } } - if (owner != nullptr && owner->instanceof - (eTYPE_LIVINGENTITY)) { + if (owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(e)->owner = std::dynamic_pointer_cast(owner); } @@ -1318,7 +1317,6 @@ void ClientConnection::handleTileUpdate( void ClientConnection::handleDisconnect( std::shared_ptr packet) { - connection->close(DisconnectPacket::eDisconnect_Kicked); done = true; @@ -1869,12 +1867,12 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); if (e == nullptr) return; if (packet->action == AnimatePacket::SWING) { - if (e->instanceof (eTYPE_LIVINGENTITY)) + if (e->instanceof(eTYPE_LIVINGENTITY)) std::dynamic_pointer_cast(e)->swing(); } else if (packet->action == AnimatePacket::HURT) { e->animateHurt(); } else if (packet->action == AnimatePacket::WAKE_UP) { - if (e->instanceof (eTYPE_PLAYER)) + if (e->instanceof(eTYPE_PLAYER)) std::dynamic_pointer_cast(e)->stopSleepInBed(false, false, false); } else if (packet->action == AnimatePacket::RESPAWN) { @@ -1890,8 +1888,8 @@ void ClientConnection::handleAnimate(std::shared_ptr packet) { new CritParticle(minecraft->level, e, eParticleType_magicCrit)); critParticle->CritParticlePostConstructor(); minecraft->particleEngine->add(critParticle); - } else if ((packet->action == AnimatePacket::EAT) && e->instanceof - (eTYPE_REMOTEPLAYER)) { + } else if ((packet->action == AnimatePacket::EAT) && + e->instanceof(eTYPE_REMOTEPLAYER)) { } } @@ -2167,13 +2165,13 @@ void ClientConnection::handleEntityLinkPacket( ->entityId) { sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; - if (destEntity != nullptr && destEntity->instanceof (eTYPE_BOAT)) + if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) (std::dynamic_pointer_cast(destEntity))->setDoLerp(false); displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr); - } else if (destEntity != nullptr && destEntity->instanceof - (eTYPE_BOAT)) { + } else if (destEntity != nullptr && + destEntity->instanceof(eTYPE_BOAT)) { (std::dynamic_pointer_cast(destEntity))->setDoLerp(true); } @@ -2190,7 +2188,7 @@ void ClientConnection::handleEntityLinkPacket( } */ } else if (packet->type == SetEntityLinkPacket::LEASH) { - if ((sourceEntity != nullptr) && sourceEntity->instanceof (eTYPE_MOB)) { + if ((sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB)) { if (destEntity != nullptr) { (std::dynamic_pointer_cast(sourceEntity)) ->setLeashedTo(destEntity, false); @@ -2303,9 +2301,8 @@ void ClientConnection::handleTextureAndGeometry( if (pSkinAsset) { if (pSkinAsset->getAdditionalBoxesCount() != 0) { send(std::shared_ptr( - new TextureAndGeometryPacket(packet->textureName, - pbData, dwBytes, - pSkinAsset))); + new TextureAndGeometryPacket( + packet->textureName, pbData, dwBytes, pSkinAsset))); } else { send(std::shared_ptr( new TextureAndGeometryPacket(packet->textureName, @@ -2349,7 +2346,7 @@ void ClientConnection::handleTextureAndGeometry( void ClientConnection::handleTextureChange( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->id); - if ((e == nullptr) || !e->instanceof (eTYPE_PLAYER)) return; + if ((e == nullptr) || !e->instanceof(eTYPE_PLAYER)) return; std::shared_ptr player = std::dynamic_pointer_cast(e); bool isLocalPlayer = false; @@ -3077,7 +3074,7 @@ void ClientConnection::handleAwardStat( void ClientConnection::handleUpdateMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; //( std::dynamic_pointer_cast(e) )->addEffect(new // MobEffectInstance(packet->effectId, packet->effectDurationTicks, @@ -3092,7 +3089,7 @@ void ClientConnection::handleUpdateMobEffect( void ClientConnection::handleRemoveMobEffect( std::shared_ptr packet) { std::shared_ptr e = getEntity(packet->entityId); - if ((e == nullptr) || !e->instanceof (eTYPE_LIVINGENTITY)) return; + if ((e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY)) return; (std::dynamic_pointer_cast(e)) ->removeEffectNoUpdate(packet->effectId); @@ -3121,7 +3118,7 @@ void ClientConnection::handlePlayerInfo( packet->m_playerPrivileges); std::shared_ptr entity = getEntity(packet->m_entityId); - if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, @@ -3531,7 +3528,7 @@ void ClientConnection::handleUpdateAttributes( std::shared_ptr entity = getEntity(packet->getEntityId()); if (entity == nullptr) return; - if (!entity->instanceof (eTYPE_LIVINGENTITY)) { + if (!entity->instanceof(eTYPE_LIVINGENTITY)) { // Entity is not a living entity! assert(0); } diff --git a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp index 7fa6694c6..0b00ebc9b 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerChunkCache.cpp @@ -176,8 +176,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { if (MinecraftServer::getInstance()->serverHalted()) return nullptr; - // If we're the host, then don't create the chunk, share - // data from the server's copy + // If we're the host, then don't create the chunk, share + // data from the server's copy #ifdef _LARGE_WORLDS LevelChunk* serverChunk = MinecraftServer::getInstance() diff --git a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp index 1c87bad35..c9b3e47f7 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerGameMode.cpp @@ -513,8 +513,7 @@ bool MultiPlayerGameMode::hasFarPickRange() { // only happens when the player is riding a horse. bool MultiPlayerGameMode::isServerControlledInventory() { return minecraft->player->isRiding() && - minecraft->player->riding->instanceof - (eTYPE_HORSE); + minecraft->player->riding->instanceof(eTYPE_HORSE); } bool MultiPlayerGameMode::handleCraftItem(int recipe, diff --git a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index 8dd22a999..34e40f06c 100644 --- a/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/targets/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -6,7 +6,6 @@ #include "ClientConnection.h" #include "minecraft/IGameServices.h" -#include "minecraft/world/tutorial/ITutorial.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "minecraft/client/player/Input.h" @@ -33,6 +32,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/dimension/Dimension.h" #include "minecraft/world/phys/AABB.h" +#include "minecraft/world/tutorial/ITutorial.h" class User; class ItemEntity; @@ -233,8 +233,7 @@ void MultiplayerLocalPlayer::actuallyHurt(DamageSource* source, float dmg) { void MultiplayerLocalPlayer::completeUsingItem() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (useItem != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - pMinecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->completeUsingItem(useItem); } @@ -245,8 +244,7 @@ void MultiplayerLocalPlayer::completeUsingItem() { void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - pMinecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -258,8 +256,7 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, bool doRefreshAttributes) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - pMinecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->onEffectChanged(MobEffect::effects[effect->getId()]); } @@ -270,8 +267,7 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance* effect, void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance* effect) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - pMinecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->onEffectChanged(MobEffect::effects[effect->getId()], true); @@ -355,8 +351,7 @@ void MultiplayerLocalPlayer::ride(std::shared_ptr e) { Minecraft* pMinecraft = Minecraft::GetInstance(); if (pMinecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - pMinecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = pMinecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { if (wasRiding && !isRiding) { tutorial->changeTutorialState(e_Tutorial_State_Gameplay); diff --git a/targets/minecraft/client/particle/FireworksParticles.cpp b/targets/minecraft/client/particle/FireworksParticles.cpp index ab8d756d0..a95e5fa8d 100644 --- a/targets/minecraft/client/particle/FireworksParticles.cpp +++ b/targets/minecraft/client/particle/FireworksParticles.cpp @@ -6,13 +6,13 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/particle/Particle.h" #include "minecraft/client/particle/ParticleEngine.h" #include "minecraft/client/renderer/Tesselator.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/item/FireworksItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/client/particle/ParticleEngine.cpp b/targets/minecraft/client/particle/ParticleEngine.cpp index f10fb25c0..969e07fba 100644 --- a/targets/minecraft/client/particle/ParticleEngine.cpp +++ b/targets/minecraft/client/particle/ParticleEngine.cpp @@ -29,7 +29,9 @@ ResourceLocation ParticleEngine::PARTICLES_LOCATION = ParticleEngine::ParticleEngine(Level* level, Textures* textures) { // if (level != nullptr) // 4J - removed - we want level to be // initialised to *something* - { this->level = level; } + { + this->level = level; + } this->textures = textures; this->random = new Random(); diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 63173838c..17be12f19 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -31,8 +31,7 @@ #include "PlatformTypes.h" #include "Pos.h" #include "app/common/Audio/ConsoleSoundEngine.h" -#include "platform/profile/ProfileConstants.h" -#include "minecraft/world/tutorial/ITutorial.h" +#include "app/common/Audio/SoundTypes.h" #include "app/common/UI/ConsoleUIController.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" @@ -54,7 +53,6 @@ #include "minecraft/commands/CommandsEnum.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/CommonStats.h" #include "minecraft/stats/GenericStats.h" @@ -80,7 +78,9 @@ #include "minecraft/world/phys/AABB.h" #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "platform/input/input.h" +#include "platform/profile/ProfileConstants.h" #include "platform/profile/profile.h" #include "platform/renderer/renderer.h" @@ -1220,8 +1220,7 @@ bool LocalPlayer::hasPermission(EGameCommand command) { void LocalPlayer::onCrafted(std::shared_ptr item) { if (minecraft->localgameModes[m_iPad] != nullptr) { - ITutorial* tutorial = - minecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = minecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->onCrafted(item); } @@ -1589,13 +1588,13 @@ void LocalPlayer::updateRichPresence() { selectedItem->id == Item::map_Id) { gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); - } else if ((riding != nullptr) && riding->instanceof (eTYPE_MINECART)) { + } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { gameServices().setRichPresenceContext( m_iPad, CONTEXT_GAME_STATE_RIDING_MINECART); - } else if ((riding != nullptr) && riding->instanceof (eTYPE_BOAT)) { + } else if ((riding != nullptr) && riding->instanceof(eTYPE_BOAT)) { gameServices().setRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_BOATING); - } else if ((riding != nullptr) && riding->instanceof (eTYPE_PIG)) { + } else if ((riding != nullptr) && riding->instanceof(eTYPE_PIG)) { gameServices().setRichPresenceContext( m_iPad, CONTEXT_GAME_STATE_RIDING_PIG); } else if (this->dimension == -1) { @@ -1647,8 +1646,7 @@ void LocalPlayer::handleCollectItem(std::shared_ptr item) { } } } - ITutorial* tutorial = - minecraft->localgameModes[m_iPad]->getTutorial(); + ITutorial* tutorial = minecraft->localgameModes[m_iPad]->getTutorial(); if (tutorial != nullptr) { tutorial->onTake(item, itemCountAnyAux, itemCountThisAux); } diff --git a/targets/minecraft/client/renderer/GameRenderer.cpp b/targets/minecraft/client/renderer/GameRenderer.cpp index c256a50a4..1081c7bf3 100644 --- a/targets/minecraft/client/renderer/GameRenderer.cpp +++ b/targets/minecraft/client/renderer/GameRenderer.cpp @@ -11,6 +11,7 @@ #include "ItemInHandRenderer.h" #include "LevelRenderer.h" #include "Tesselator.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/FloatBuffer.h" #include "java/JavaMath.h" @@ -47,7 +48,6 @@ #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/client/skins/TexturePack.h" #include "minecraft/client/skins/TexturePackRepository.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/SmoothFloat.h" #include "minecraft/world/effect/MobEffect.h" @@ -76,10 +76,10 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "platform/PlatformTypes.h" -#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" #include "platform/renderer/renderer.h" #include "platform/stubs.h" +#include "platform/thread/ShutdownManager.h" #include "util/FrameProfiler.h" bool GameRenderer::anaglyph3d = false; @@ -375,7 +375,7 @@ void GameRenderer::pick(float a) { if (nearest < dist || (mc->hitResult == nullptr)) { if (mc->hitResult != nullptr) delete mc->hitResult; mc->hitResult = new HitResult(hovered); - if (hovered->instanceof (eTYPE_LIVINGENTITY)) { + if (hovered->instanceof(eTYPE_LIVINGENTITY)) { mc->crosshairPickMob = std::dynamic_pointer_cast(hovered); } @@ -448,7 +448,7 @@ void GameRenderer::bobHurt(float a) { } void GameRenderer::bobView(float a) { - if (!mc->cameraTargetPlayer->instanceof (eTYPE_LIVINGENTITY)) return; + if (!mc->cameraTargetPlayer->instanceof(eTYPE_LIVINGENTITY)) return; std::shared_ptr player = std::dynamic_pointer_cast(mc->cameraTargetPlayer); @@ -706,8 +706,7 @@ void GameRenderer::renderItemInHand(float a, int eye) { // 4J-JEV: I'm fairly confident this method would crash if the cameratarget // isnt a local player anyway, but oh well. std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof - (eTYPE_LOCALPLAYER) + mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast(mc->cameraTargetPlayer) : nullptr; @@ -808,7 +807,8 @@ void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO PlatformRenderer.TextureBindVertex(-1); } - // // 4jcraft: manually handle this in order to ensure that the light layer is + // // 4jcraft: manually handle this in order to ensure that the light layer + // is // // turned off correctly // if (SharedConstants::TEXTURE_LIGHTING) { // glClientActiveTexture(GL_TEXTURE1); @@ -1242,7 +1242,9 @@ void GameRenderer::renderLevel(float a, int64_t until) { // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we // want to update this is mc->player changes for different local players - { mc->cameraTargetPlayer = mc->player; } + { + mc->cameraTargetPlayer = mc->player; + } pick(a); std::shared_ptr cameraEntity = mc->cameraTargetPlayer; @@ -1380,9 +1382,9 @@ void GameRenderer::renderLevel(float a, int64_t until) { turnOffLightLayer(a); // 4J - brought forward from 1.8.2 if ((mc->hitResult != nullptr) && - cameraEntity->isUnderLiquid(Material::water) && - cameraEntity->instanceof - (eTYPE_PLAYER)) //&& !mc->options.hideGui) + cameraEntity->isUnderLiquid(Material::water) && + cameraEntity->instanceof( + eTYPE_PLAYER)) //&& !mc->options.hideGui) { std::shared_ptr player = std::dynamic_pointer_cast(cameraEntity); @@ -1458,8 +1460,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { glEnable(GL_CULL_FACE); glDisable(GL_BLEND); - if ((zoom == 1) && cameraEntity->instanceof - (eTYPE_PLAYER)) //&& !mc->options.hideGui) + if ((zoom == 1) && + cameraEntity->instanceof(eTYPE_PLAYER)) //&& !mc->options.hideGui) { if (mc->hitResult != nullptr && !cameraEntity->isUnderLiquid(Material::water)) { @@ -2018,7 +2020,7 @@ void GameRenderer::setupFog(int i, float alpha) { // 4J - check for creative mode brought forward from 1.2.3 bool creative = false; - if (player->instanceof (eTYPE_PLAYER)) { + if (player->instanceof(eTYPE_PLAYER)) { creative = (std::dynamic_pointer_cast(player))->abilities.instabuild; } diff --git a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp index 139b65d61..67dec6abd 100644 --- a/targets/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/targets/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -465,8 +465,8 @@ void ItemInHandRenderer::render(float a) { static int lightmapLogCount = 0; if (lightmapLogCount < 8) { ++lightmapLogCount; - Log::info("[4jcraft-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", col, - u, v); + Log::info("[4jcraft-lightmap] item-hand raw=0x%08x uv=(%d,%d)\n", + col, u, v); } glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); diff --git a/targets/minecraft/client/renderer/LevelRenderer.cpp b/targets/minecraft/client/renderer/LevelRenderer.cpp index 7f84ec8d0..9af935f7f 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.cpp +++ b/targets/minecraft/client/renderer/LevelRenderer.cpp @@ -16,6 +16,7 @@ #include "GameRenderer.h" #include "Tesselator.h" #include "app/common/Audio/ConsoleSoundEngine.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -73,7 +74,6 @@ #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/client/resources/ResourceLocation.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" @@ -622,7 +622,7 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { (entity->noCulling || culler->isVisible(&entity->bb))); // Render the mob if the mob's leash holder is within the culler - if (!shouldRender && entity->instanceof (eTYPE_MOB)) { + if (!shouldRender && entity->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->isLeashed() && (mob->getLeashHolder() != nullptr)) { std::shared_ptr leashHolder = mob->getLeashHolder(); @@ -636,10 +636,10 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { // !mc->options->thirdPersonView && // !mc->cameraTargetPlayer->isSleeping()) continue; std::shared_ptr localplayer = - mc->cameraTargetPlayer->instanceof - (eTYPE_LOCALPLAYER) ? std::dynamic_pointer_cast( - mc->cameraTargetPlayer) - : nullptr; + mc->cameraTargetPlayer->instanceof(eTYPE_LOCALPLAYER) + ? std::dynamic_pointer_cast( + mc->cameraTargetPlayer) + : nullptr; if (localplayer && entity == mc->cameraTargetPlayer && !localplayer->ThirdPersonView() && @@ -3204,7 +3204,7 @@ std::shared_ptr LevelRenderer::addParticleInternal( } void LevelRenderer::entityAdded(std::shared_ptr entity) { - if (entity->instanceof (eTYPE_PLAYER)) { + if (entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); player->prepareCustomTextures(); @@ -3222,7 +3222,7 @@ void LevelRenderer::entityAdded(std::shared_ptr entity) { } void LevelRenderer::entityRemoved(std::shared_ptr entity) { - if (entity->instanceof (eTYPE_PLAYER)) { + if (entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (player->customTextureUrl != "") { diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index feee11326..f2b496abb 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -6,8 +6,8 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelListener.h" #include "minecraft/world/phys/AABB.h" -#include "platform/thread/C4JThread.h" #include "platform/network/NetTypes.h" +#include "platform/thread/C4JThread.h" class ClipChunk; class HitResult; diff --git a/targets/minecraft/client/renderer/Textures.cpp b/targets/minecraft/client/renderer/Textures.cpp index c4ef4d783..040b73adc 100644 --- a/targets/minecraft/client/renderer/Textures.cpp +++ b/targets/minecraft/client/renderer/Textures.cpp @@ -414,7 +414,9 @@ int Textures::loadTexture(int idx) { // renderer that map the single 8-bit channel to RGBA differently. void Textures::setTextureFormat(const std::string& resourceName) { // 4J Stu - These texture formats are not currently in the render header - { TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; } + { + TEXTURE_FORMAT = IPlatformRenderer::TEXTURE_FORMAT_RxGyBzAw; + } } void Textures::bindTexture(const std::string& resourceName) { @@ -1225,7 +1227,9 @@ BufferedImage* Textures::readImage( name, false, isTu, drive); // new BufferedImage(name,false,isTu,drive); } else { - { drive = skins->getDefault()->getPath(isTu); } + { + drive = skins->getDefault()->getPath(isTu); + } if (IsOriginalImage(texId, name) || isTu) { img = skins->getDefault()->getImageResource( diff --git a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp index 9dcb82ba5..cac1c5b83 100644 --- a/targets/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -156,11 +156,11 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, float r = shadowRadius; float fYLocalPlayerShadowOffset = 0.0f; - if (e->instanceof (eTYPE_MOB)) { + if (e->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); r *= mob->getSizeScale(); - if (mob->instanceof (eTYPE_ANIMAL)) { + if (mob->instanceof(eTYPE_ANIMAL)) { if (std::dynamic_pointer_cast(mob)->isBaby()) { r *= 0.5f; } @@ -173,7 +173,7 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, // 4J-PB - local players seem to have a position at their head, and remote // players have a foot position. get the shadow to render by changing the // check here depending on the player type - if (e->instanceof (eTYPE_LOCALPLAYER)) { + if (e->instanceof(eTYPE_LOCALPLAYER)) { ey -= 1.62; fYLocalPlayerShadowOffset = -1.62f; } diff --git a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index e6fd1a2ff..026b8e61c 100644 --- a/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -66,7 +66,7 @@ void LivingEntityRenderer::render(std::shared_ptr _mob, double x, float bodyRot = rotlerp(mob->yBodyRotO, mob->yBodyRot, a); float headRot = rotlerp(mob->yHeadRotO, mob->yHeadRot, a); - if (mob->isRiding() && mob->riding->instanceof (eTYPE_LIVINGENTITY)) { + if (mob->isRiding() && mob->riding->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr riding = std::dynamic_pointer_cast(mob->riding); bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a); @@ -284,9 +284,8 @@ void LivingEntityRenderer::setupRotations(std::shared_ptr mob, } else { std::string name = mob->getAName(); if (name == "Dinnerbone" || name == "Grumm") { - if (!mob->instanceof - (eTYPE_PLAYER) || - !std::dynamic_pointer_cast(mob)->isCapeHidden()) { + if (!mob->instanceof(eTYPE_PLAYER) || + !std::dynamic_pointer_cast(mob)->isCapeHidden()) { glTranslatef(0, mob->bbHeight + 0.1f, 0); glRotatef(180, 0, 0, 1); } @@ -527,7 +526,7 @@ void LivingEntityRenderer::renderNameTag(std::shared_ptr mob, std::string playerName; char wchName[2]; - if (mob->instanceof (eTYPE_PLAYER)) { + if (mob->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(mob); if (gameServices().isXuidDeadmau5(player->getXuid())) offs = -10; diff --git a/targets/minecraft/client/renderer/entity/MobRenderer.cpp b/targets/minecraft/client/renderer/entity/MobRenderer.cpp index aabf17f07..5feeb17e1 100644 --- a/targets/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/MobRenderer.cpp @@ -54,7 +54,7 @@ void MobRenderer::renderLeash(std::shared_ptr entity, double x, double y, double rotOffCos = cos(roperYRot); double rotOffSin = sin(roperYRot); double yOff = sin(roperXRot); - if (roper->instanceof (eTYPE_HANGING_ENTITY)) { + if (roper->instanceof(eTYPE_HANGING_ENTITY)) { rotOffCos = 0; rotOffSin = 0; yOff = -1; diff --git a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp index 1d2ab8331..0975aee47 100644 --- a/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/PlayerRenderer.cpp @@ -195,7 +195,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, mob->isSneaking(); double yp = y - mob->heightOffset; - if (mob->isSneaking() && !mob->instanceof (eTYPE_LOCALPLAYER)) { + if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER)) { yp -= 2 / 16.0f; } diff --git a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp index 25815c572..b1bb89c51 100644 --- a/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp +++ b/targets/minecraft/client/renderer/entity/ZombieRenderer.cpp @@ -68,7 +68,7 @@ ResourceLocation* ZombieRenderer::getTextureLocation( std::shared_ptr mob = std::dynamic_pointer_cast(entity); // TODO Extract this clusterfck into 3 renderers - if (entity->instanceof (eTYPE_PIGZOMBIE)) { + if (entity->instanceof(eTYPE_PIGZOMBIE)) { return &ZOMBIE_PIGMAN_LOCATION; } diff --git a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp index f04a12f4c..845bca4e3 100644 --- a/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp +++ b/targets/minecraft/client/renderer/tileentity/SkullTileRenderer.cpp @@ -82,7 +82,9 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, // bindTexture(url, "/mob/char.png"); //} // else - { bindTexture(&PlayerRenderer::DEFAULT_LOCATION); } + { + bindTexture(&PlayerRenderer::DEFAULT_LOCATION); + } break; case SkullTileEntity::TYPE_CREEPER: bindTexture(&CREEPER_LOCATION); diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index da9b38edd..0556f936c 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -5,6 +5,7 @@ #include #include #include + #include "app/common/Audio/SoundEngine.h" #include "app/common/DLC/DLCAudioFile.h" #include "app/common/DLC/DLCColourTableFile.h" @@ -414,8 +415,7 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr, iOverworldStart, iOverworldStart + iOverworldC, iNetherStart, iNetherStart + iNetherC, iEndStart, iEndStart + iEndC, - iEndStart + - iEndC); // push the CD start to after + iEndStart + iEndC); // push the CD start to after } } texturePack->loadColourTable(); diff --git a/targets/minecraft/core/DefaultDispenseItemBehavior.h b/targets/minecraft/core/DefaultDispenseItemBehavior.h index 76296aba2..65e221dda 100644 --- a/targets/minecraft/core/DefaultDispenseItemBehavior.h +++ b/targets/minecraft/core/DefaultDispenseItemBehavior.h @@ -23,8 +23,8 @@ protected: }; public: - DefaultDispenseItemBehavior(){}; - virtual ~DefaultDispenseItemBehavior(){}; + DefaultDispenseItemBehavior() {}; + virtual ~DefaultDispenseItemBehavior() {}; virtual std::shared_ptr dispense( BlockSource* source, std::shared_ptr dispensed); diff --git a/targets/minecraft/core/ItemDispenseBehaviors.cpp b/targets/minecraft/core/ItemDispenseBehaviors.cpp index ef22049e6..7776bcfce 100644 --- a/targets/minecraft/core/ItemDispenseBehaviors.cpp +++ b/targets/minecraft/core/ItemDispenseBehaviors.cpp @@ -135,7 +135,7 @@ std::shared_ptr SpawnEggDispenseBehavior::execute( return dispensed; } - if (entity->instanceof (eTYPE_MOB) && dispensed->hasCustomHoverName()) { + if (entity->instanceof(eTYPE_MOB) && dispensed->hasCustomHoverName()) { std::dynamic_pointer_cast(entity)->setCustomName( dispensed->getHoverName()); } diff --git a/targets/minecraft/locale/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp index 427e77ddf..9bfcffda6 100644 --- a/targets/minecraft/locale/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -26,8 +26,7 @@ void StringTable::ReloadStringTable(std::span locales) { ProcessStringTableData(locales); } -void StringTable::ProcessStringTableData( - std::span locales) { +void StringTable::ProcessStringTableData(std::span locales) { ByteArrayInputStream bais(src); DataInputStream dis(&bais); diff --git a/targets/minecraft/network/Connection.cpp b/targets/minecraft/network/Connection.cpp index 4e290838e..463b1f3aa 100644 --- a/targets/minecraft/network/Connection.cpp +++ b/targets/minecraft/network/Connection.cpp @@ -16,8 +16,8 @@ #include "minecraft/network/packet/KeepAlivePacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/PacketListener.h" -#include "platform/network/network.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" +#include "platform/network/network.h" #include "platform/thread/ShutdownManager.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/network/Connection.h b/targets/minecraft/network/Connection.h index 8d3ccaca6..be2106324 100644 --- a/targets/minecraft/network/Connection.h +++ b/targets/minecraft/network/Connection.h @@ -7,10 +7,10 @@ #include #include -#include "minecraft/network/Socket.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "java/System.h" +#include "minecraft/network/Socket.h" #include "minecraft/network/packet/DisconnectPacket.h" #include "platform/thread/C4JThread.h" diff --git a/targets/minecraft/network/Socket.cpp b/targets/minecraft/network/Socket.cpp index 9ac574e16..99730677c 100644 --- a/targets/minecraft/network/Socket.cpp +++ b/targets/minecraft/network/Socket.cpp @@ -7,9 +7,9 @@ #include #include "app/common/Network/GameNetworkManager.h" -#include "platform/network/network.h" #include "minecraft/server/network/ServerConnection.h" #include "platform/network/NetTypes.h" +#include "platform/network/network.h" #include "platform/thread/ShutdownManager.h" class SocketAddress {}; diff --git a/targets/minecraft/network/Socket.h b/targets/minecraft/network/Socket.h index 7c15f2b89..db16b2716 100644 --- a/targets/minecraft/network/Socket.h +++ b/targets/minecraft/network/Socket.h @@ -2,9 +2,9 @@ #include #include #include -#include #include #include +#include #include "java/InputOutputStream/InputStream.h" #include "java/InputOutputStream/OutputStream.h" diff --git a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp index bd885912b..7a2258570 100644 --- a/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp +++ b/targets/minecraft/network/packet/AddGlobalEntityPacket.cpp @@ -24,7 +24,7 @@ AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr e) { x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - if (e->instanceof (eTYPE_LIGHTNINGBOLT)) { + if (e->instanceof(eTYPE_LIGHTNINGBOLT)) { type = LIGHTNING; } else { type = 0; diff --git a/targets/minecraft/network/packet/Packet.cpp b/targets/minecraft/network/packet/Packet.cpp index 21256b114..3ef25ece0 100644 --- a/targets/minecraft/network/packet/Packet.cpp +++ b/targets/minecraft/network/packet/Packet.cpp @@ -674,7 +674,9 @@ std::shared_ptr Packet::readItem(DataInputStream* dis) { // 4J Stu - Always read/write the tag // if (Item.items[id].canBeDepleted() || // Item.items[id].shouldOverrideMultiplayerNBT()) - { item->tag = readNbt(dis); } + { + item->tag = readNbt(dis); + } } return item; @@ -691,7 +693,9 @@ void Packet::writeItem(std::shared_ptr item, // 4J Stu - Always read/write the tag // if (item.getItem().canBeDepleted() || // item.getItem().shouldOverrideMultiplayerNBT()) - { writeNbt(item->tag, dos); } + { + writeNbt(item->tag, dos); + } } } diff --git a/targets/minecraft/network/packet/PlayerInfoPacket.cpp b/targets/minecraft/network/packet/PlayerInfoPacket.cpp index eaa94323e..d98f09392 100644 --- a/targets/minecraft/network/packet/PlayerInfoPacket.cpp +++ b/targets/minecraft/network/packet/PlayerInfoPacket.cpp @@ -1,10 +1,11 @@ +#include "PlayerInfoPacket.h" + #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" #include "minecraft/network/packet/PacketListener.h" -#include "platform/network/network.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "PlayerInfoPacket.h" +#include "platform/network/network.h" PlayerInfoPacket::PlayerInfoPacket() { m_networkSmallId = 0; diff --git a/targets/minecraft/server/MinecraftServer.cpp b/targets/minecraft/server/MinecraftServer.cpp index 79622019f..73ce35362 100644 --- a/targets/minecraft/server/MinecraftServer.cpp +++ b/targets/minecraft/server/MinecraftServer.cpp @@ -24,14 +24,12 @@ #include "minecraft/IGameServices.h" #include "minecraft/Pos.h" #include "minecraft/client/Options.h" -#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/commands/Command.h" #include "minecraft/network/INetworkService.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/ServerSettingsChangedPacket.h" #include "minecraft/network/packet/SetTimePacket.h" #include "minecraft/network/packet/UpdateProgressPacket.h" -#include "platform/network/network.h" #include "minecraft/server/level/DerivedServerLevel.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerChunkCache.h" @@ -43,6 +41,7 @@ #include "minecraft/world/entity/Mob.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/ItemInstance.h" +#include "minecraft/world/level/ConsoleGameRulesConstants.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/LevelSettings.h" @@ -58,6 +57,7 @@ #include "minecraft/world/level/storage/McRegionLevelStorageSource.h" #include "minecraft/world/level/tile/Tile.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "strings.h" @@ -65,12 +65,11 @@ #if defined(SPLIT_SAVES) #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.h" #endif -#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" -#include "minecraft/network/Socket.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/ProgressRenderer.h" #include "minecraft/client/renderer/GameRenderer.h" +#include "minecraft/network/Socket.h" #include "minecraft/server/commands/ServerCommandDispatcher.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/world/level/Level.h" @@ -78,10 +77,11 @@ #include "minecraft/world/level/chunk/CompressedTileStorage.h" #include "minecraft/world/level/chunk/SparseDataStorage.h" #include "minecraft/world/level/chunk/SparseLightStorage.h" +#include "minecraft/world/level/levelgen/ConsoleSchematicFile.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileOriginal.h" #include "minecraft/world/level/storage/ConsoleSaveFileIO/compression.h" -#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" +#include "platform/thread/ShutdownManager.h" class ConsoleInputSource; @@ -895,7 +895,9 @@ bool MinecraftServer::IsSuspending() { return m_suspending; } void MinecraftServer::stopServer(bool didInit) { // 4J-PB - need to halt the rendering of the data, since we're about to // remove it - { Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); } + { + Minecraft::GetInstance()->gameRenderer->DisableUpdateThread(); + } connection->stop(); diff --git a/targets/minecraft/server/PlayerList.cpp b/targets/minecraft/server/PlayerList.cpp index 4dacfd31a..717f9f318 100644 --- a/targets/minecraft/server/PlayerList.cpp +++ b/targets/minecraft/server/PlayerList.cpp @@ -11,7 +11,6 @@ #include "MinecraftServer.h" #include "Settings.h" #include "app/common/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" -#include "minecraft/world/tutorial/ITutorial.h" #include "java/Class.h" #include "java/JavaMath.h" #include "minecraft/GameEnums.h" @@ -36,7 +35,6 @@ #include "minecraft/network/packet/TexturePacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" #include "minecraft/network/packet/XZPacket.h" -#include "platform/network/network.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/PlayerChunkMap.h" #include "minecraft/server/level/ServerChunkCache.h" @@ -69,8 +67,10 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/storage/LevelStorage.h" #include "minecraft/world/level/storage/PlayerIO.h" +#include "minecraft/world/tutorial/ITutorial.h" #include "nbt/CompoundTag.h" #include "platform/network/NetTypes.h" +#include "platform/network/network.h" #include "platform/profile/profile.h" #include "strings.h" diff --git a/targets/minecraft/server/level/EntityTracker.cpp b/targets/minecraft/server/level/EntityTracker.cpp index e5a186478..4241f547b 100644 --- a/targets/minecraft/server/level/EntityTracker.cpp +++ b/targets/minecraft/server/level/EntityTracker.cpp @@ -11,7 +11,6 @@ #include "ServerPlayer.h" #include "TrackedEntity.h" #include "java/Class.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -19,6 +18,7 @@ #include "minecraft/world/entity/Entity.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/dimension/Dimension.h" +#include "platform/network/network.h" EntityTracker::EntityTracker(ServerLevel* level) { this->level = level; @@ -26,7 +26,7 @@ EntityTracker::EntityTracker(ServerLevel* level) { } void EntityTracker::addEntity(std::shared_ptr e) { - if (e->instanceof (eTYPE_SERVERPLAYER)) { + if (e->instanceof(eTYPE_SERVERPLAYER)) { addEntity(e, 32 * 16, 2); std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -35,57 +35,57 @@ void EntityTracker::addEntity(std::shared_ptr e) { (*it)->updatePlayer(this, player); } } - } else if (e->instanceof (eTYPE_FISHINGHOOK)) + } else if (e->instanceof(eTYPE_FISHINGHOOK)) addEntity(e, 16 * 4, 5, true); - else if (e->instanceof (eTYPE_SMALL_FIREBALL)) + else if (e->instanceof(eTYPE_SMALL_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof (eTYPE_DRAGON_FIREBALL)) + else if (e->instanceof(eTYPE_DRAGON_FIREBALL)) addEntity(e, 16 * 4, 10, false); // 4J Added TU9 - else if (e->instanceof (eTYPE_ARROW)) + else if (e->instanceof(eTYPE_ARROW)) addEntity(e, 16 * 4, 20, false); - else if (e->instanceof (eTYPE_FIREBALL)) + else if (e->instanceof(eTYPE_FIREBALL)) addEntity(e, 16 * 4, 10, false); - else if (e->instanceof (eTYPE_SNOWBALL)) + else if (e->instanceof(eTYPE_SNOWBALL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_THROWNENDERPEARL)) + else if (e->instanceof(eTYPE_THROWNENDERPEARL)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) + else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) addEntity(e, 16 * 4, 4, true); - else if (e->instanceof (eTYPE_THROWNEGG)) + else if (e->instanceof(eTYPE_THROWNEGG)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_THROWNPOTION)) + else if (e->instanceof(eTYPE_THROWNPOTION)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) + else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) + else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) addEntity(e, 16 * 4, 10, true); - else if (e->instanceof (eTYPE_ITEMENTITY)) + else if (e->instanceof(eTYPE_ITEMENTITY)) addEntity(e, 16 * 4, 20, true); - else if (e->instanceof (eTYPE_MINECART)) + else if (e->instanceof(eTYPE_MINECART)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof (eTYPE_BOAT)) + else if (e->instanceof(eTYPE_BOAT)) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof (eTYPE_SQUID)) + else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 3, true); - else if (e->instanceof (eTYPE_WITHERBOSS)) + else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 3, false); - else if (e->instanceof (eTYPE_BAT)) + else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 3, false); else if (std::dynamic_pointer_cast(e) != nullptr) addEntity(e, 16 * 5, 3, true); - else if (e->instanceof (eTYPE_ENDERDRAGON)) + else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 3, true); - else if (e->instanceof (eTYPE_PRIMEDTNT)) + else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); - else if (e->instanceof (eTYPE_FALLINGTILE)) + else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof (eTYPE_HANGING_ENTITY)) + else if (e->instanceof(eTYPE_HANGING_ENTITY)) addEntity(e, 16 * 10, INT_MAX, false); - else if (e->instanceof (eTYPE_EXPERIENCEORB)) + else if (e->instanceof(eTYPE_EXPERIENCEORB)) addEntity(e, 16 * 10, 20, true); - else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) + else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) addEntity(e, 16 * 16, INT_MAX, false); - else if (e->instanceof (eTYPE_ITEM_FRAME)) + else if (e->instanceof(eTYPE_ITEM_FRAME)) addEntity(e, 16 * 10, INT_MAX, false); } diff --git a/targets/minecraft/server/level/PlayerChunkMap.cpp b/targets/minecraft/server/level/PlayerChunkMap.cpp index 58513f308..00240639b 100644 --- a/targets/minecraft/server/level/PlayerChunkMap.cpp +++ b/targets/minecraft/server/level/PlayerChunkMap.cpp @@ -19,7 +19,6 @@ #include "minecraft/network/packet/ChunkVisibilityPacket.h" #include "minecraft/network/packet/Packet.h" #include "minecraft/network/packet/TileUpdatePacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -28,6 +27,7 @@ #include "minecraft/world/level/Level.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/tile/entity/TileEntity.h" +#include "platform/network/network.h" PlayerChunkMap::PlayerChunk::PlayerChunk(int x, int z, PlayerChunkMap* pcm) : pos(x, z) { diff --git a/targets/minecraft/server/level/ServerChunkCache.cpp b/targets/minecraft/server/level/ServerChunkCache.cpp index c7e35790a..c1b7e746a 100644 --- a/targets/minecraft/server/level/ServerChunkCache.cpp +++ b/targets/minecraft/server/level/ServerChunkCache.cpp @@ -104,7 +104,9 @@ void ServerChunkCache::drop(int x, int z) { //} // } // else - { canDrop = true; } + { + canDrop = true; + } if (canDrop) { int ix = x + XZOFFSET; int iz = z + XZOFFSET; diff --git a/targets/minecraft/server/level/ServerLevel.cpp b/targets/minecraft/server/level/ServerLevel.cpp index 9b8746b62..754b4b1e0 100644 --- a/targets/minecraft/server/level/ServerLevel.cpp +++ b/targets/minecraft/server/level/ServerLevel.cpp @@ -24,7 +24,6 @@ #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/network/packet/LevelParticlesPacket.h" #include "minecraft/network/packet/TileEventPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/ServerScoreboard.h" @@ -60,9 +59,10 @@ #include "minecraft/world/level/tile/entity/ChestTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/Vec3.h" -#include "platform/thread/ShutdownManager.h" #include "platform/input/input.h" +#include "platform/network/network.h" #include "platform/storage/storage.h" +#include "platform/thread/ShutdownManager.h" #include "strings.h" class ChunkStorage; @@ -225,9 +225,15 @@ ServerLevel::~ServerLevel() { } // Make sure that the update thread isn't actually doing any updating - { std::lock_guard lock(m_updateCS[0]); } - { std::lock_guard lock(m_updateCS[1]); } - { std::lock_guard lock(m_updateCS[2]); } + { + std::lock_guard lock(m_updateCS[0]); + } + { + std::lock_guard lock(m_updateCS[1]); + } + { + std::lock_guard lock(m_updateCS[2]); + } m_updateTrigger->clearAll(); } @@ -754,7 +760,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, void ServerLevel::tick(std::shared_ptr e, bool actual) { if (!server->isAnimals() && - (e->instanceof (eTYPE_ANIMAL) || e->instanceof (eTYPE_WATERANIMAL))) { + (e->instanceof(eTYPE_ANIMAL) || e->instanceof(eTYPE_WATERANIMAL))) { e->remove(); } if (!server->isNpcsEnabled() && @@ -1235,7 +1241,7 @@ void ServerLevel::runQueuedSendTileUpdates() { // removed and added so we can limit the number of itementities created bool ServerLevel::addEntity(std::shared_ptr e) { // If its an item entity, and we've got to our capacity, delete the oldest - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1246,7 +1252,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an hanging entity, and we've got to our capacity, delete the // oldest - else if (e->instanceof (eTYPE_HANGING_ENTITY)) { + else if (e->instanceof(eTYPE_HANGING_ENTITY)) { // printf("Adding item entity count //%d\n",m_itemEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1261,7 +1267,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } } // If its an arrow entity, and we've got to our capacity, delete the oldest - else if (e->instanceof (eTYPE_ARROW)) { + else if (e->instanceof(eTYPE_ARROW)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1272,7 +1278,7 @@ bool ServerLevel::addEntity(std::shared_ptr e) { } // If its an experience orb entity, and we've got to our capacity, delete // the oldest - else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + else if (e->instanceof(eTYPE_EXPERIENCEORB)) { // printf("Adding arrow entity count //%d\n",m_arrowEntities.size()); std::lock_guard lock(m_limiterCS); @@ -1291,16 +1297,16 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { bool atLimit = false; - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_itemEntities.size() >= MAX_ITEM_ENTITIES; - } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); atLimit = m_hangingEntities.size() >= MAX_HANGING_ENTITIES; - } else if (e->instanceof (eTYPE_ARROW)) { + } else if (e->instanceof(eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); atLimit = m_arrowEntities.size() >= MAX_ARROW_ENTITIES; - } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); atLimit = m_experienceOrbEntities.size() >= MAX_EXPERIENCEORB_ENTITIES; } @@ -1310,30 +1316,30 @@ bool ServerLevel::atEntityLimit(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level void ServerLevel::entityAddedExtra(std::shared_ptr e) { - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); m_itemEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); m_hangingEntities.push_back(e); // printf("entity added: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof (eTYPE_ARROW)) { + } else if (e->instanceof(eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); m_arrowEntities.push_back(e); // printf("entity added: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); m_experienceOrbEntities.push_back(e); // printf("entity added: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof (eTYPE_PRIMEDTNT)) { + } else if (e->instanceof(eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount++; - } else if (e->instanceof (eTYPE_FALLINGTILE)) { + } else if (e->instanceof(eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount++; } @@ -1342,7 +1348,7 @@ void ServerLevel::entityAddedExtra(std::shared_ptr e) { // Maintain a cound of primed tnt & falling tiles in this level, and remove any // item entities from our list void ServerLevel::entityRemovedExtra(std::shared_ptr e) { - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1353,7 +1359,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof (eTYPE_HANGING_ENTITY)) { + } else if (e->instanceof(eTYPE_HANGING_ENTITY)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); @@ -1364,7 +1370,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: item entity count now //%d\n",m_itemEntities.size()); - } else if (e->instanceof (eTYPE_ARROW)) { + } else if (e->instanceof(eTYPE_ARROW)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: arrow entity count //%d\n",m_arrowEntities.size()); @@ -1375,7 +1381,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: arrow entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { std::lock_guard lock(m_limiterCS); // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); @@ -1387,10 +1393,10 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { } // printf("entity removed: experience orb entity count now //%d\n",m_arrowEntities.size()); - } else if (e->instanceof (eTYPE_PRIMEDTNT)) { + } else if (e->instanceof(eTYPE_PRIMEDTNT)) { std::lock_guard lock(m_limiterCS); m_primedTntCount--; - } else if (e->instanceof (eTYPE_FALLINGTILE)) { + } else if (e->instanceof(eTYPE_FALLINGTILE)) { std::lock_guard lock(m_limiterCS); m_fallingTileCount--; } diff --git a/targets/minecraft/server/level/ServerPlayer.cpp b/targets/minecraft/server/level/ServerPlayer.cpp index 290930124..7c616ac53 100644 --- a/targets/minecraft/server/level/ServerPlayer.cpp +++ b/targets/minecraft/server/level/ServerPlayer.cpp @@ -45,7 +45,6 @@ #include "minecraft/network/packet/SetHealthPacket.h" #include "minecraft/network/packet/TileEditorOpenPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -108,6 +107,7 @@ #include "minecraft/world/scores/criteria/ObjectiveCriteria.h" #include "nbt/CompoundTag.h" #include "platform/input/input.h" +#include "platform/network/network.h" #include "strings.h" class Objective; @@ -716,20 +716,19 @@ bool ServerPlayer::hurt(DamageSource* dmgSource, float dmg) { // sometimes nullptr. std::shared_ptr source = dmgSource->getDirectEntity(); - if (source->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(source)->canHarmPlayer( - std::dynamic_pointer_cast(shared_from_this()))) { + if (source->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(source)->canHarmPlayer( + std::dynamic_pointer_cast(shared_from_this()))) { return false; } - if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); - if ((arrow->owner != nullptr) && arrow->owner->instanceof - (eTYPE_PLAYER) && - !canHarmPlayer( - std::dynamic_pointer_cast(arrow->owner))) { + if ((arrow->owner != nullptr) && + arrow->owner->instanceof(eTYPE_PLAYER) && + !canHarmPlayer( + std::dynamic_pointer_cast(arrow->owner))) { return false; } } diff --git a/targets/minecraft/server/level/TrackedEntity.cpp b/targets/minecraft/server/level/TrackedEntity.cpp index f50c34428..ddcb4ee8d 100644 --- a/targets/minecraft/server/level/TrackedEntity.cpp +++ b/targets/minecraft/server/level/TrackedEntity.cpp @@ -29,7 +29,6 @@ #include "minecraft/network/packet/TeleportEntityPacket.h" #include "minecraft/network/packet/UpdateAttributesPacket.h" #include "minecraft/network/packet/UpdateMobEffectPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/network/PlayerConnection.h" @@ -56,6 +55,7 @@ #include "minecraft/world/item/MapItem.h" #include "minecraft/world/level/saveddata/MapItemSavedData.h" #include "platform/PlatformTypes.h" +#include "platform/network/network.h" class AttributeInstance; class MobEffectInstance; @@ -188,8 +188,8 @@ void TrackedEntity::tick(EntityTracker* tracker, // FallingTile depends on this because it removes its source block // in the first tick() - if (tickCount > 0 || e->instanceof (eTYPE_ARROW) || e->instanceof - (eTYPE_PLAYER)) // 4J: Modifed, see above + if (tickCount > 0 || e->instanceof(eTYPE_ARROW) || + e->instanceof(eTYPE_PLAYER)) // 4J: Modifed, see above { if (xa < -128 || xa >= 128 || ya < -128 || ya >= 128 || za < -128 || za >= 128 || @@ -382,7 +382,7 @@ void TrackedEntity::sendDirtyEntityData() { new SetEntityDataPacket(e->entityId, entityData, false))); } - if (e->instanceof (eTYPE_LIVINGENTITY)) { + if (e->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -467,9 +467,10 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { std::vector > sentTo; broadcast(packet); - std::shared_ptr sp = e->instanceof - (eTYPE_SERVERPLAYER) ? std::dynamic_pointer_cast(e) - : nullptr; + std::shared_ptr sp = + e->instanceof(eTYPE_SERVERPLAYER) + ? std::dynamic_pointer_cast(e) + : nullptr; if (sp != nullptr && sp->connection) { sp->connection->send(packet); } @@ -591,7 +592,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, yap = e->yd; zap = e->zd; - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr plr = std::dynamic_pointer_cast(e); Log::info( "TrackedEntity:: Player '%s' is now visible to player '%s', " @@ -609,7 +610,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, e->entityId, e->getEntityData(), true)); } - if (e->instanceof (eTYPE_LIVINGENTITY)) { + if (e->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(e); ServersideAttributeMap* attributeMap = @@ -633,16 +634,14 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, sp->connection->send(std::make_shared( SetEntityLinkPacket::RIDING, e, e->riding)); } - if (e->instanceof - (eTYPE_MOB) && - std::dynamic_pointer_cast(e)->getLeashHolder() != - nullptr) { + if (e->instanceof(eTYPE_MOB) && + std::dynamic_pointer_cast(e)->getLeashHolder() != nullptr) { sp->connection->send(std::make_shared( SetEntityLinkPacket::LEASH, e, std::dynamic_pointer_cast(e)->getLeashHolder())); } - if (e->instanceof (eTYPE_LIVINGENTITY)) { + if (e->instanceof(eTYPE_LIVINGENTITY)) { for (int i = 0; i < 5; i++) { std::shared_ptr item = std::dynamic_pointer_cast(e)->getCarried(i); @@ -652,7 +651,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr spe = std::dynamic_pointer_cast(e); if (spe->isSleeping()) { sp->connection->send( @@ -664,7 +663,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, } } - if (e->instanceof (eTYPE_LIVINGENTITY)) { + if (e->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); std::vector* activeEffects = @@ -721,12 +720,12 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { xp, yp, zp, yHeadRotp)); } - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { std::shared_ptr packet = std::make_shared(e, AddEntityPacket::ITEM, 1, yRotp, xRotp, xp, yp, zp); return packet; - } else if (e->instanceof (eTYPE_SERVERPLAYER)) { + } else if (e->instanceof(eTYPE_SERVERPLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -741,55 +740,55 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { // degrees. return std::make_shared( player, xuid, OnlineXuid, xp, yp, zp, yRotp, xRotp, yHeadRotp); - } else if (e->instanceof (eTYPE_MINECART)) { + } else if (e->instanceof(eTYPE_MINECART)) { std::shared_ptr minecart = std::dynamic_pointer_cast(e); return std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::MINECART, minecart->getType(), yRotp, xRotp, xp, yp, zp)); - } else if (e->instanceof (eTYPE_BOAT)) { + } else if (e->instanceof(eTYPE_BOAT)) { return std::make_shared(e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_ENDERDRAGON)) { + } else if (e->instanceof(eTYPE_ENDERDRAGON)) { yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp)); - } else if (e->instanceof (eTYPE_FISHINGHOOK)) { + } else if (e->instanceof(eTYPE_FISHINGHOOK)) { std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; return std::make_shared( e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_ARROW)) { + } else if (e->instanceof(eTYPE_ARROW)) { std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; return std::make_shared( e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_SNOWBALL)) { + } else if (e->instanceof(eTYPE_SNOWBALL)) { return std::make_shared(e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_THROWNPOTION)) { + } else if (e->instanceof(eTYPE_THROWNPOTION)) { return std::make_shared( e, AddEntityPacket::THROWN_POTION, ((std::dynamic_pointer_cast(e))->getPotionValue()), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_THROWNEXPBOTTLE)) { + } else if (e->instanceof(eTYPE_THROWNEXPBOTTLE)) { return std::make_shared( e, AddEntityPacket::THROWN_EXPBOTTLE, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_THROWNENDERPEARL)) { + } else if (e->instanceof(eTYPE_THROWNENDERPEARL)) { return std::make_shared( e, AddEntityPacket::THROWN_ENDERPEARL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_EYEOFENDERSIGNAL)) { + } else if (e->instanceof(eTYPE_EYEOFENDERSIGNAL)) { return std::make_shared( e, AddEntityPacket::EYEOFENDERSIGNAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_FIREWORKS_ROCKET)) { + } else if (e->instanceof(eTYPE_FIREWORKS_ROCKET)) { return std::make_shared(e, AddEntityPacket::FIREWORKS, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_FIREBALL)) { + } else if (e->instanceof(eTYPE_FIREBALL)) { eINSTANCEOF classType = e->GetType(); int type = AddEntityPacket::FIREBALL; if (classType == eTYPE_SMALL_FIREBALL) { @@ -813,25 +812,25 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { aep->ya = (int)(fb->yPower * 8000); aep->za = (int)(fb->zPower * 8000); return aep; - } else if (e->instanceof (eTYPE_THROWNEGG)) { + } else if (e->instanceof(eTYPE_THROWNEGG)) { return std::make_shared(e, AddEntityPacket::EGG, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_PRIMEDTNT)) { + } else if (e->instanceof(eTYPE_PRIMEDTNT)) { return std::make_shared(e, AddEntityPacket::PRIMED_TNT, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_ENDER_CRYSTAL)) { + } else if (e->instanceof(eTYPE_ENDER_CRYSTAL)) { return std::make_shared( e, AddEntityPacket::ENDER_CRYSTAL, yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_FALLINGTILE)) { + } else if (e->instanceof(eTYPE_FALLINGTILE)) { std::shared_ptr ft = std::dynamic_pointer_cast(e); return std::make_shared(e, AddEntityPacket::FALLING, ft->tile | (ft->data << 16), yRotp, xRotp, xp, yp, zp); - } else if (e->instanceof (eTYPE_PAINTING)) { + } else if (e->instanceof(eTYPE_PAINTING)) { return std::shared_ptr( new AddPaintingPacket(std::dynamic_pointer_cast(e))); - } else if (e->instanceof (eTYPE_ITEM_FRAME)) { + } else if (e->instanceof(eTYPE_ITEM_FRAME)) { std::shared_ptr frame = std::dynamic_pointer_cast(e); @@ -850,7 +849,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor(frame->yTile * 32.0f); packet->z = std::floor(frame->zTile * 32.0f); return packet; - } else if (e->instanceof (eTYPE_LEASHFENCEKNOT)) { + } else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) { std::shared_ptr knot = std::dynamic_pointer_cast(e); std::shared_ptr packet = @@ -860,7 +859,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { packet->y = std::floor((float)knot->yTile * 32); packet->z = std::floor((float)knot->zTile * 32); return packet; - } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { return std::shared_ptr( new AddExperienceOrbPacket( std::dynamic_pointer_cast(e))); diff --git a/targets/minecraft/server/network/PendingConnection.cpp b/targets/minecraft/server/network/PendingConnection.cpp index 830985e49..9b5a10f5c 100644 --- a/targets/minecraft/server/network/PendingConnection.cpp +++ b/targets/minecraft/server/network/PendingConnection.cpp @@ -16,13 +16,13 @@ #include "minecraft/network/packet/DisconnectPacket.h" #include "minecraft/network/packet/LoginPacket.h" #include "minecraft/network/packet/PreLoginPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/util/Log.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" +#include "platform/network/network.h" #include "platform/storage/storage.h" class Packet; diff --git a/targets/minecraft/server/network/PlayerConnection.cpp b/targets/minecraft/server/network/PlayerConnection.cpp index aa9d1132f..e68f39790 100644 --- a/targets/minecraft/server/network/PlayerConnection.cpp +++ b/targets/minecraft/server/network/PlayerConnection.cpp @@ -61,7 +61,6 @@ #include "minecraft/network/packet/TileUpdatePacket.h" #include "minecraft/network/packet/TradeItemPacket.h" #include "minecraft/network/packet/UseItemPacket.h" -#include "platform/network/network.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" @@ -102,6 +101,7 @@ #include "minecraft/world/level/tile/entity/SignTileEntity.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "minecraft/world/phys/AABB.h" +#include "platform/network/network.h" class SavedData; @@ -720,8 +720,8 @@ void PlayerConnection::handlePlayerCommand( } } else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { // also only supported by horses... - if ((player->riding != nullptr) && player->riding->instanceof - (eTYPE_HORSE)) { + if ((player->riding != nullptr) && + player->riding->instanceof(eTYPE_HORSE)) { std::dynamic_pointer_cast(player->riding) ->openInventory(player); } @@ -943,8 +943,8 @@ void PlayerConnection::handleTextureAndGeometryReceived( if (dwTextureBytes != 0) { if (pSkinAsset && (pSkinAsset->getAdditionalBoxesCount() != 0)) { send(std::shared_ptr( - new TextureAndGeometryPacket( - textureName, pbData, dwTextureBytes, pSkinAsset))); + new TextureAndGeometryPacket(textureName, pbData, + dwTextureBytes, pSkinAsset))); } else { // get the data from the app std::uint32_t dwSkinID = diff --git a/targets/minecraft/stats/NumberFormatters.h b/targets/minecraft/stats/NumberFormatters.h index 691bb1105..3547dd13b 100644 --- a/targets/minecraft/stats/NumberFormatters.h +++ b/targets/minecraft/stats/NumberFormatters.h @@ -30,5 +30,5 @@ public: // 4J Stu - The java code took a string format, we take a printf format // string - DecimalFormat(std::string x) : formatString(x){}; + DecimalFormat(std::string x) : formatString(x) {}; }; \ No newline at end of file diff --git a/targets/minecraft/stats/StatsCounter.cpp b/targets/minecraft/stats/StatsCounter.cpp index 17fcd442e..84e291844 100644 --- a/targets/minecraft/stats/StatsCounter.cpp +++ b/targets/minecraft/stats/StatsCounter.cpp @@ -11,7 +11,6 @@ #include "app/common/App_structs.h" #include "app/common/Game.h" -#include "platform/leaderboard/IPlatformLeaderboard.h" #include "minecraft/stats/Achievement.h" #include "minecraft/stats/Achievements.h" #include "minecraft/stats/GenericStats.h" @@ -20,6 +19,7 @@ #include "minecraft/util/Log.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/leaderboard/IPlatformLeaderboard.h" #include "platform/profile/profile.h" Stat** StatsCounter::LARGE_STATS[] = {&Stats::walkOneM, &Stats::swimOneM, diff --git a/targets/minecraft/world/damageSource/CombatEntry.cpp b/targets/minecraft/world/damageSource/CombatEntry.cpp index 68f163edb..ecc3f1f8e 100644 --- a/targets/minecraft/world/damageSource/CombatEntry.cpp +++ b/targets/minecraft/world/damageSource/CombatEntry.cpp @@ -36,8 +36,8 @@ float CombatEntry::getHealthBeforeDamage() { return health; } float CombatEntry::getHealthAfterDamage() { return health - damage; } bool CombatEntry::isCombatRelated() { - return source->getEntity() && source->getEntity()->instanceof - (eTYPE_LIVINGENTITY); + return source->getEntity() && + source->getEntity()->instanceof(eTYPE_LIVINGENTITY); } CombatTracker::eLOCATION CombatEntry::getLocation() { return location; } diff --git a/targets/minecraft/world/damageSource/CombatTracker.cpp b/targets/minecraft/world/damageSource/CombatTracker.cpp index 33cdbdb3e..9970b7c3b 100644 --- a/targets/minecraft/world/damageSource/CombatTracker.cpp +++ b/targets/minecraft/world/damageSource/CombatTracker.cpp @@ -100,8 +100,7 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { (killingEntity == nullptr || attackerEntity != killingEntity)) { std::shared_ptr attackerItem = - attackerEntity->instanceof - (eTYPE_LIVINGENTITY) + attackerEntity->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(attackerEntity) ->getCarriedItem() : nullptr; @@ -119,8 +118,8 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { attackerEntity->getNetworkName()); } } else if (killingEntity != nullptr) { - std::shared_ptr killerItem = killingEntity->instanceof - (eTYPE_LIVINGENTITY) + std::shared_ptr killerItem = + killingEntity->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(killingEntity) ->getCarriedItem() : nullptr; @@ -156,20 +155,18 @@ std::shared_ptr CombatTracker::getKiller() { for (auto it = entries.begin(); it != entries.end(); ++it) { CombatEntry* entry = *it; if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof - (eTYPE_PLAYER) && (bestPlayer == nullptr || - entry->getDamage() > bestPlayerDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && + (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage)) { bestPlayerDamage = entry->getDamage(); bestPlayer = std::dynamic_pointer_cast( entry->getSource()->getEntity()); } if (entry->getSource() != nullptr && - entry->getSource()->getEntity() != nullptr && - entry->getSource()->getEntity()->instanceof - (eTYPE_LIVINGENTITY) && - (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { + entry->getSource()->getEntity() != nullptr && + entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && + (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { bestMobDamage = entry->getDamage(); bestMob = std::dynamic_pointer_cast( entry->getSource()->getEntity()); diff --git a/targets/minecraft/world/damageSource/EntityDamageSource.cpp b/targets/minecraft/world/damageSource/EntityDamageSource.cpp index 8bffcdd24..3c5aab7a5 100644 --- a/targets/minecraft/world/damageSource/EntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/EntityDamageSource.cpp @@ -35,15 +35,14 @@ std::shared_ptr EntityDamageSource::getEntity() { return entity; } std::shared_ptr EntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { std::shared_ptr held = - (entity != nullptr) && entity->instanceof - (eTYPE_LIVINGENTITY) + (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; - if (entity->instanceof (eTYPE_SERVERPLAYER)) { + if (entity->instanceof(eTYPE_SERVERPLAYER)) { additional = std::dynamic_pointer_cast(entity)->name; - } else if (entity->instanceof (eTYPE_MOB)) { + } else if (entity->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); if (mob->hasCustomName()) { additional = mob->getCustomName(); @@ -61,8 +60,8 @@ std::shared_ptr EntityDamageSource::getDeathMessagePacket( } bool EntityDamageSource::scalesWithDifficulty() { - return (entity != nullptr) && entity->instanceof - (eTYPE_LIVINGENTITY) && !entity->instanceof (eTYPE_PLAYER); + return (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) && + !entity->instanceof(eTYPE_PLAYER); } // 4J: Copy function diff --git a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp index 32875f28d..fc5040d68 100644 --- a/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp +++ b/targets/minecraft/world/damageSource/IndirectEntityDamageSource.cpp @@ -42,8 +42,8 @@ std::shared_ptr IndirectEntityDamageSource::getEntity() { std::shared_ptr IndirectEntityDamageSource::getDeathMessagePacket( std::shared_ptr player) { - std::shared_ptr held = entity->instanceof - (eTYPE_LIVINGENTITY) + std::shared_ptr held = + entity->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; std::string additional = ""; diff --git a/targets/minecraft/world/effect/MobEffect.cpp b/targets/minecraft/world/effect/MobEffect.cpp index 9037716fd..755839987 100644 --- a/targets/minecraft/world/effect/MobEffect.cpp +++ b/targets/minecraft/world/effect/MobEffect.cpp @@ -274,12 +274,12 @@ void MobEffect::applyEffectTick(std::shared_ptr mob, } } else if (id == wither->id) { mob->hurt(DamageSource::wither, 1); - } else if ((id == hunger->id) && mob->instanceof (eTYPE_PLAYER)) { + } else if ((id == hunger->id) && mob->instanceof(eTYPE_PLAYER)) { // every tick, cause the same amount of exhaustion as when removing // a block, times amplification std::dynamic_pointer_cast(mob)->causeFoodExhaustion( FoodConstants::EXHAUSTION_MINE * (amplification + 1)); - } else if ((id == saturation->id) && mob->instanceof (eTYPE_PLAYER)) { + } else if ((id == saturation->id) && mob->instanceof(eTYPE_PLAYER)) { if (!mob->level->isClientSide) { std::dynamic_pointer_cast(mob)->getFoodData()->eat( amplification + 1, FoodConstants::FOOD_SATURATION_MAX); diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 670e7459d..e97b7fd72 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -15,6 +15,7 @@ #include "EntityIO.h" #include "EntityPos.h" #include "SyncedEntityData.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -27,7 +28,6 @@ #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" #include "minecraft/server/level/ServerLevel.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -681,8 +681,8 @@ void Entity::move(double xa, double ya, double za, AABB bbOrg = bb; - bool isPlayerSneaking = onGround && isSneaking() && instanceof - (eTYPE_PLAYER); + bool isPlayerSneaking = + onGround && isSneaking() && instanceof(eTYPE_PLAYER); if (isPlayerSneaking) { double d = 0.05; @@ -1784,7 +1784,7 @@ void Entity::changeDimension(int i) { // 4J: Restrictions on what can go through { // 4J: Some things should just be destroyed when they hit a portal - if (instanceof (eTYPE_FALLINGTILE)) { + if (instanceof(eTYPE_FALLINGTILE)) { removed = true; return; } @@ -1794,9 +1794,8 @@ void Entity::changeDimension(int i) { if (newLevel->atEntityLimit(shared_from_this())) return; // 4J: Check level limit on living entities, minecarts and boats - if (! instanceof - (eTYPE_PLAYER) && - !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) + if (!instanceof(eTYPE_PLAYER) && + !newLevel->canCreateMore(GetType(), Level::eSpawnType_Portal)) return; } diff --git a/targets/minecraft/world/entity/Entity.h b/targets/minecraft/world/entity/Entity.h index 0eeb8d12b..726691e50 100644 --- a/targets/minecraft/world/entity/Entity.h +++ b/targets/minecraft/world/entity/Entity.h @@ -53,10 +53,10 @@ public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts virtual eINSTANCEOF GetType() = 0; - inline bool instanceof (eINSTANCEOF super) { + inline bool instanceof(eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, GetType()); } - inline static bool instanceof (eINSTANCEOF type, eINSTANCEOF super) { + inline static bool instanceof(eINSTANCEOF type, eINSTANCEOF super) { return eTYPE_DERIVED_FROM(super, type); } diff --git a/targets/minecraft/world/entity/EntitySelector.cpp b/targets/minecraft/world/entity/EntitySelector.cpp index 66ce2c890..c25227ad5 100644 --- a/targets/minecraft/world/entity/EntitySelector.cpp +++ b/targets/minecraft/world/entity/EntitySelector.cpp @@ -30,7 +30,7 @@ MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector( bool MobCanWearArmourEntitySelector::matches( std::shared_ptr entity) const { if (!entity->isAlive()) return false; - if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; std::shared_ptr mob = std::dynamic_pointer_cast(entity); @@ -38,9 +38,9 @@ bool MobCanWearArmourEntitySelector::matches( if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != nullptr) return false; - if (mob->instanceof (eTYPE_MOB)) { + if (mob->instanceof(eTYPE_MOB)) { return std::dynamic_pointer_cast(mob)->canPickUpLoot(); - } else if (mob->instanceof (eTYPE_PLAYER)) { + } else if (mob->instanceof(eTYPE_PLAYER)) { return true; } diff --git a/targets/minecraft/world/entity/ExperienceOrb.cpp b/targets/minecraft/world/entity/ExperienceOrb.cpp index 02b6ca100..61eb4012c 100644 --- a/targets/minecraft/world/entity/ExperienceOrb.cpp +++ b/targets/minecraft/world/entity/ExperienceOrb.cpp @@ -5,10 +5,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/HangingEntity.cpp b/targets/minecraft/world/entity/HangingEntity.cpp index 7acc18a15..23a7f5545 100644 --- a/targets/minecraft/world/entity/HangingEntity.cpp +++ b/targets/minecraft/world/entity/HangingEntity.cpp @@ -145,7 +145,7 @@ bool HangingEntity::survives() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); - if (e->instanceof (eTYPE_HANGING_ENTITY)) { + if (e->instanceof(eTYPE_HANGING_ENTITY)) { return false; } } @@ -172,10 +172,10 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr sourceEntity = source->getDirectEntity(); - if ((sourceEntity != nullptr) && sourceEntity->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(sourceEntity) - ->isAllowedToHurtEntity(shared_from_this())) { + if ((sourceEntity != nullptr) && + sourceEntity->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(sourceEntity) + ->isAllowedToHurtEntity(shared_from_this())) { return false; } } @@ -185,8 +185,9 @@ bool HangingEntity::hurt(DamageSource* source, float damage) { std::shared_ptr player = nullptr; std::shared_ptr e = source->getEntity(); - if ((e != nullptr) && e->instanceof - (eTYPE_PLAYER)) // check if it's serverplayer or player + if ((e != nullptr) && + e->instanceof( + eTYPE_PLAYER)) // check if it's serverplayer or player { player = std::dynamic_pointer_cast(e); } diff --git a/targets/minecraft/world/entity/ItemFrame.cpp b/targets/minecraft/world/entity/ItemFrame.cpp index 2d7ca7222..3fe0086d3 100644 --- a/targets/minecraft/world/entity/ItemFrame.cpp +++ b/targets/minecraft/world/entity/ItemFrame.cpp @@ -49,7 +49,7 @@ bool ItemFrame::shouldRenderAtSqrDistance(double distance) { void ItemFrame::dropItem(std::shared_ptr causedBy) { std::shared_ptr item = getItem(); - if (causedBy != nullptr && causedBy->instanceof (eTYPE_PLAYER)) { + if (causedBy != nullptr && causedBy->instanceof(eTYPE_PLAYER)) { if (std::dynamic_pointer_cast(causedBy)->abilities.instabuild) { removeFramedMap(item); return; diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 7547d7883..4bc74cb99 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -13,6 +13,7 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -23,7 +24,6 @@ #include "minecraft/network/packet/TakeItemEntityPacket.h" #include "minecraft/server/level/EntityTracker.h" #include "minecraft/server/level/ServerLevel.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" @@ -244,8 +244,8 @@ void LivingEntity::baseTick() { } clearFire(); - if (!level->isClientSide && isRiding() && riding->instanceof - (eTYPE_LIVINGENTITY)) { + if (!level->isClientSide && isRiding() && + riding->instanceof(eTYPE_LIVINGENTITY)) { ride(nullptr); } } else { @@ -335,7 +335,7 @@ int LivingEntity::decreaseAirSupply(int currentSupply) { return currentSupply; } } - if (instanceof (eTYPE_PLAYER)) { + if (instanceof(eTYPE_PLAYER)) { Log::info("++++++++++ %s: Player decreasing air supply to %d\n", level->isClientSide ? "CLIENT" : "SERVER", currentSupply - 1); } @@ -368,7 +368,7 @@ std::shared_ptr LivingEntity::getLastHurtMob() { int LivingEntity::getLastHurtMobTimestamp() { return lastHurtMobTimestamp; } void LivingEntity::setLastHurtMob(std::shared_ptr target) { - if (target->instanceof (eTYPE_LIVINGENTITY)) { + if (target->instanceof(eTYPE_LIVINGENTITY)) { lastHurtMob = std::dynamic_pointer_cast(target); } else { lastHurtMob = nullptr; @@ -723,10 +723,9 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { if (source->isFire() && hasEffect(MobEffect::fireResistance)) { // 4J-JEV, for new achievement Stayin'Frosty, TODO merge with Java // version. - if (this->instanceof - (eTYPE_PLAYER) && - (source == DamageSource::lava)) // Only award when in lava (not - // any fire). + if (this->instanceof(eTYPE_PLAYER) && + (source == DamageSource::lava)) // Only award when in lava (not + // any fire). { std::shared_ptr plr = std::dynamic_pointer_cast(shared_from_this()); @@ -765,15 +764,15 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof (eTYPE_LIVINGENTITY)) { + if (sourceEntity->instanceof(eTYPE_LIVINGENTITY)) { setLastHurtByMob( std::dynamic_pointer_cast(sourceEntity)); } - if (sourceEntity->instanceof (eTYPE_PLAYER)) { + if (sourceEntity->instanceof(eTYPE_PLAYER)) { lastHurtByPlayerTime = PLAYER_HURT_EXPERIENCE_TIME; lastHurtByPlayer = std::dynamic_pointer_cast(sourceEntity); - } else if (sourceEntity->instanceof (eTYPE_WOLF)) { + } else if (sourceEntity->instanceof(eTYPE_WOLF)) { std::shared_ptr w = std::dynamic_pointer_cast(sourceEntity); if (w->isTame()) { @@ -852,8 +851,8 @@ void LivingEntity::die(DamageSource* source) { int playerBonus = 0; std::shared_ptr player = nullptr; - if ((sourceEntity != nullptr) && sourceEntity->instanceof - (eTYPE_PLAYER)) { + if ((sourceEntity != nullptr) && + sourceEntity->instanceof(eTYPE_PLAYER)) { player = std::dynamic_pointer_cast(sourceEntity); playerBonus = EnchantmentHelper::getKillingLootBonus( std::dynamic_pointer_cast(player)); @@ -1004,7 +1003,7 @@ float LivingEntity::getDamageAfterArmorAbsorb(DamageSource* damageSource, float LivingEntity::getDamageAfterMagicAbsorb(DamageSource* damageSource, float damage) { // [EB]: Stupid hack :( - if (this->instanceof (eTYPE_ZOMBIE)) { + if (this->instanceof(eTYPE_ZOMBIE)) { damage = damage; } if (hasEffect(MobEffect::damageResistance) && @@ -1312,8 +1311,8 @@ void LivingEntity::travel(float xa, float ya) { if (zd > max) zd = max; fallDistance = 0; if (yd < -0.15) yd = -0.15; - bool playerSneaking = isSneaking() && this->instanceof - (eTYPE_PLAYER); + bool playerSneaking = + isSneaking() && this->instanceof(eTYPE_PLAYER); if (playerSneaking && yd < 0) yd = 0; } @@ -1643,15 +1642,15 @@ void LivingEntity::setJumping(bool jump) { jumping = jump; } void LivingEntity::take(std::shared_ptr e, int orgCount) { if (!e->removed && !level->isClientSide) { EntityTracker* entityTracker = ((ServerLevel*)level)->getTracker(); - if (e->instanceof (eTYPE_ITEMENTITY)) { + if (e->instanceof(eTYPE_ITEMENTITY)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof (eTYPE_ARROW)) { + } else if (e->instanceof(eTYPE_ARROW)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); - } else if (e->instanceof (eTYPE_EXPERIENCEORB)) { + } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { entityTracker->broadcast( e, std::shared_ptr( new TakeItemEntityPacket(e->entityId, entityId))); diff --git a/targets/minecraft/world/entity/Mob.cpp b/targets/minecraft/world/entity/Mob.cpp index 88565b033..aca62e948 100644 --- a/targets/minecraft/world/entity/Mob.cpp +++ b/targets/minecraft/world/entity/Mob.cpp @@ -254,10 +254,10 @@ void Mob::addAdditonalSaveData(CompoundTag* entityTag) { entityTag->putBoolean("Leashed", _isLeashed); if (leashHolder != nullptr) { CompoundTag* leashTag = new CompoundTag("Leash"); - if (leashHolder->instanceof (eTYPE_LIVINGENTITY)) { + if (leashHolder->instanceof(eTYPE_LIVINGENTITY)) { // a walking, talking, leash holder leashTag->putString("UUID", leashHolder->getUUID()); - } else if (leashHolder->instanceof (eTYPE_HANGING_ENTITY)) { + } else if (leashHolder->instanceof(eTYPE_HANGING_ENTITY)) { // a fixed holder (that doesn't save itself) std::shared_ptr hangInThere = std::dynamic_pointer_cast(leashHolder); @@ -493,7 +493,7 @@ void Mob::lookAt(std::shared_ptr e, float yMax, float xMax) { double yd; double zd = e->z - z; - if (e->instanceof (eTYPE_LIVINGENTITY)) { + if (e->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(e); yd = (mob->y + mob->getHeadHeight()) - (y + getHeadHeight()); @@ -760,14 +760,12 @@ bool Mob::interact(std::shared_ptr player) { if (itemstack->id == Item::lead_Id) { if (canBeLeashed()) { std::shared_ptr tamableAnimal = nullptr; - if (shared_from_this()->instanceof - (eTYPE_TAMABLE_ANIMAL) && - (tamableAnimal = - std::dynamic_pointer_cast( - shared_from_this())) - ->isTame()) // 4J-JEV: excuse the assignment - // operator in here, don't want to - // dyn-cast if it's avoidable. + if (shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) && + (tamableAnimal = std::dynamic_pointer_cast( + shared_from_this())) + ->isTame()) // 4J-JEV: excuse the assignment + // operator in here, don't want to + // dyn-cast if it's avoidable. { if (player->getUUID().compare( tamableAnimal->getOwnerUUID()) == 0) { @@ -826,7 +824,7 @@ void Mob::dropLeash(bool synch, bool createItemDrop) { } bool Mob::canBeLeashed() { - return !isLeashed() && !shared_from_this()->instanceof (eTYPE_ENEMY); + return !isLeashed() && !shared_from_this()->instanceof(eTYPE_ENEMY); } bool Mob::isLeashed() { return _isLeashed; } diff --git a/targets/minecraft/world/entity/Painting.cpp b/targets/minecraft/world/entity/Painting.cpp index 651db9d30..3370caffc 100644 --- a/targets/minecraft/world/entity/Painting.cpp +++ b/targets/minecraft/world/entity/Painting.cpp @@ -138,7 +138,7 @@ int Painting::getWidth() { return motive->w; } int Painting::getHeight() { return motive->h; } void Painting::dropItem(std::shared_ptr causedBy) { - if ((causedBy != nullptr) && causedBy->instanceof (eTYPE_PLAYER)) { + if ((causedBy != nullptr) && causedBy->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(causedBy); if (player->abilities.instabuild) { diff --git a/targets/minecraft/world/entity/Painting.h b/targets/minecraft/world/entity/Painting.h index ba201f3b1..1f94ce25e 100644 --- a/targets/minecraft/world/entity/Painting.h +++ b/targets/minecraft/world/entity/Painting.h @@ -69,7 +69,7 @@ public: // private: Motive(std::string name, int w, int h, int uo, int vo) - : name(name), w(w), h(h), uo(uo), vo(vo){}; + : name(name), w(w), h(h), uo(uo), vo(vo) {}; }; public: diff --git a/targets/minecraft/world/entity/PathfinderMob.cpp b/targets/minecraft/world/entity/PathfinderMob.cpp index 7e079ab9c..e77fdea41 100644 --- a/targets/minecraft/world/entity/PathfinderMob.cpp +++ b/targets/minecraft/world/entity/PathfinderMob.cpp @@ -288,8 +288,7 @@ void PathfinderMob::tickLeash() { float _distanceTo = distanceTo(leashHolder); std::shared_ptr tamabaleAnimal = - shared_from_this()->instanceof - (eTYPE_TAMABLE_ANIMAL) + shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) ? std::dynamic_pointer_cast(shared_from_this()) : nullptr; if ((tamabaleAnimal != nullptr) && tamabaleAnimal->isSitting()) { diff --git a/targets/minecraft/world/entity/ai/control/LookControl.cpp b/targets/minecraft/world/entity/ai/control/LookControl.cpp index f25c65280..cd79a000c 100644 --- a/targets/minecraft/world/entity/ai/control/LookControl.cpp +++ b/targets/minecraft/world/entity/ai/control/LookControl.cpp @@ -23,7 +23,7 @@ LookControl::LookControl(Mob* mob) { void LookControl::setLookAt(std::shared_ptr target, float yMax, float xMax) { wantedX = target->x; - if (target->instanceof (eTYPE_LIVINGENTITY)) + if (target->instanceof(eTYPE_LIVINGENTITY)) wantedY = target->y + std::dynamic_pointer_cast(target)->getHeadHeight(); diff --git a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp index 690890dc6..14bbec987 100644 --- a/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/ControlledByPlayerGoal.cpp @@ -56,8 +56,8 @@ void ControlledByPlayerGoal::stop() { bool ControlledByPlayerGoal::canUse() { return mob->isAlive() && mob->rider.lock() != nullptr && - mob->rider.lock()->instanceof - (eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); + mob->rider.lock()->instanceof(eTYPE_PLAYER) && + (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() { diff --git a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp index 210b60fc7..983edc1fe 100644 --- a/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/MeleeAttackGoal.cpp @@ -45,7 +45,7 @@ bool MeleeAttackGoal::canUse() { std::shared_ptr target = mob->getTarget(); if (target == nullptr) return false; if (!target->isAlive()) return false; - if (attackType != eTYPE_NOTSET && !target->instanceof (attackType)) + if (attackType != eTYPE_NOTSET && !target->instanceof(attackType)) return false; path.reset(mob->getNavigation()->createPath(target)); return path != nullptr; diff --git a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp index 3546061ba..17ec10374 100644 --- a/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/RunAroundLikeCrazyGoal.cpp @@ -46,7 +46,7 @@ bool RunAroundLikeCrazyGoal::canContinueToUse() { void RunAroundLikeCrazyGoal::tick() { if (horse->getRandom()->nextInt(50) == 0) { - if (horse->rider.lock()->instanceof (eTYPE_PLAYER)) { + if (horse->rider.lock()->instanceof(eTYPE_PLAYER)) { int temper = horse->getTemper(); int maxTemper = horse->getMaxTemper(); if (maxTemper > 0 && diff --git a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp index f99285bdf..a608824b8 100644 --- a/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.cpp @@ -22,7 +22,7 @@ SubselectEntitySelector::SubselectEntitySelector( SubselectEntitySelector::~SubselectEntitySelector() { delete m_subselector; } bool SubselectEntitySelector::matches(std::shared_ptr entity) const { - if (!entity->instanceof (eTYPE_LIVINGENTITY)) return false; + if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; return m_parent->canAttack(std::dynamic_pointer_cast(entity), diff --git a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp index 4327a9759..006d06428 100644 --- a/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp +++ b/targets/minecraft/world/entity/ai/goal/target/TargetGoal.cpp @@ -88,7 +88,7 @@ bool TargetGoal::canAttack(std::shared_ptr target, // We're attacking our owner return false; } - } else if (target->instanceof (eTYPE_PLAYER)) { + } else if (target->instanceof(eTYPE_PLAYER)) { if (!allowInvulnerable && (std::dynamic_pointer_cast(target))->abilities.invulnerable) return false; diff --git a/targets/minecraft/world/entity/ambient/Bat.cpp b/targets/minecraft/world/entity/ambient/Bat.cpp index 9c88f578f..d25f52646 100644 --- a/targets/minecraft/world/entity/ambient/Bat.cpp +++ b/targets/minecraft/world/entity/ambient/Bat.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Pos.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/SyncedEntityData.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" diff --git a/targets/minecraft/world/entity/animal/Animal.cpp b/targets/minecraft/world/entity/animal/Animal.cpp index 646bde3f8..8b2626a11 100644 --- a/targets/minecraft/world/entity/animal/Animal.cpp +++ b/targets/minecraft/world/entity/animal/Animal.cpp @@ -77,7 +77,7 @@ void Animal::aiStep() { void Animal::checkHurtTarget(std::shared_ptr target, float d) { // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (target->instanceof (eTYPE_PLAYER)) { + if (target->instanceof(eTYPE_PLAYER)) { if (d < 3) { double xd = target->x - x; double zd = target->z - z; @@ -93,7 +93,7 @@ void Animal::checkHurtTarget(std::shared_ptr target, float d) { } // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - else if (target->instanceof (eTYPE_ANIMAL)) { + else if (target->instanceof(eTYPE_ANIMAL)) { std::shared_ptr a = std::dynamic_pointer_cast(target); if (getAge() > 0 && a->getAge() < 0) { if (d < 2.5) { @@ -179,22 +179,22 @@ bool Animal::hurt(DamageSource* dmgSource, float dmg) { std::shared_ptr source = dmgSource->getDirectEntity(); // 4J-JEV: Changed from dynamic cast to use eINSTANCEOF - if (source->instanceof - (eTYPE_PLAYER) && !std::dynamic_pointer_cast(source) - ->isAllowedToAttackAnimals()) { + if (source->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(source) + ->isAllowedToAttackAnimals()) { return false; } - if ((source != nullptr) && source->instanceof (eTYPE_ARROW)) { + if ((source != nullptr) && source->instanceof(eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(source); // 4J: Check that the arrow's owner can attack animals (dispenser // arrows are not owned) - if (arrow->owner != nullptr && arrow->owner->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(arrow->owner) - ->isAllowedToAttackAnimals()) { + if (arrow->owner != nullptr && + arrow->owner->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(arrow->owner) + ->isAllowedToAttackAnimals()) { return false; } } @@ -352,7 +352,7 @@ bool Animal::mobInteract(std::shared_ptr player) { return false; } - } else if (instanceof (eTYPE_MONSTER)) { + } else if (instanceof(eTYPE_MONSTER)) { } break; } diff --git a/targets/minecraft/world/entity/animal/Chicken.cpp b/targets/minecraft/world/entity/animal/Chicken.cpp index 8e40b8fdb..b35aa70ab 100644 --- a/targets/minecraft/world/entity/animal/Chicken.cpp +++ b/targets/minecraft/world/entity/animal/Chicken.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" #include "minecraft/world/entity/ai/goal/FloatGoal.h" diff --git a/targets/minecraft/world/entity/animal/Cow.cpp b/targets/minecraft/world/entity/animal/Cow.cpp index 681f75c6a..b41aadb83 100644 --- a/targets/minecraft/world/entity/animal/Cow.cpp +++ b/targets/minecraft/world/entity/animal/Cow.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/ai/goal/BreedGoal.h" diff --git a/targets/minecraft/world/entity/animal/EntityHorse.cpp b/targets/minecraft/world/entity/animal/EntityHorse.cpp index 2c7545b65..959475cb6 100644 --- a/targets/minecraft/world/entity/animal/EntityHorse.cpp +++ b/targets/minecraft/world/entity/animal/EntityHorse.cpp @@ -6,10 +6,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/client/renderer/Textures.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -96,9 +96,8 @@ std::string EntityHorse::MARKING_HASHES[EntityHorse::MARKINGS] = { "", "wo_", "wmo", "wdo", "bdo"}; bool HorseEntitySelector::matches(std::shared_ptr entity) const { - return entity->instanceof - (eTYPE_HORSE) && - std::dynamic_pointer_cast(entity)->isBred(); + return entity->instanceof(eTYPE_HORSE) && + std::dynamic_pointer_cast(entity)->isBred(); } EntityHorse::EntityHorse(Level* level) : Animal(level) { @@ -312,7 +311,7 @@ bool EntityHorse::hurt(DamageSource* damagesource, float dmg) { // 4J: Protect owned horses from untrusted players if (isTamed()) { std::shared_ptr entity = damagesource->getDirectEntity(); - if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerName()); @@ -1508,7 +1507,7 @@ void EntityHorse::positionRider() { y + getRideHeight() + rider.lock()->getRidingHeight() + height, z - dist * cos); - if (rider.lock()->instanceof (eTYPE_LIVINGENTITY)) { + if (rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); livingRider->yBodyRot = yBodyRot; diff --git a/targets/minecraft/world/entity/animal/Ocelot.cpp b/targets/minecraft/world/entity/animal/Ocelot.cpp index c7e42f54b..4be10a765 100644 --- a/targets/minecraft/world/entity/animal/Ocelot.cpp +++ b/targets/minecraft/world/entity/animal/Ocelot.cpp @@ -5,12 +5,12 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/animal/Pig.cpp b/targets/minecraft/world/entity/animal/Pig.cpp index 609b6750b..697e0d17f 100644 --- a/targets/minecraft/world/entity/animal/Pig.cpp +++ b/targets/minecraft/world/entity/animal/Pig.cpp @@ -5,8 +5,8 @@ #include #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/SyncedEntityData.h" @@ -150,8 +150,8 @@ void Pig::thunderHit(const LightningBolt* lightningBolt) { void Pig::causeFallDamage(float distance) { Animal::causeFallDamage(distance); - if ((distance > 5) && rider.lock() != nullptr && rider.lock()->instanceof - (eTYPE_PLAYER)) { + if ((distance > 5) && rider.lock() != nullptr && + rider.lock()->instanceof(eTYPE_PLAYER)) { (std::dynamic_pointer_cast(rider.lock())) ->awardStat(GenericStats::flyPig(), GenericStats::param_flyPig()); } diff --git a/targets/minecraft/world/entity/animal/Sheep.cpp b/targets/minecraft/world/entity/animal/Sheep.cpp index e55db0f65..c9504bc9c 100644 --- a/targets/minecraft/world/entity/animal/Sheep.cpp +++ b/targets/minecraft/world/entity/animal/Sheep.cpp @@ -6,8 +6,8 @@ #include #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/AgeableMob.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/animal/SnowMan.cpp b/targets/minecraft/world/entity/animal/SnowMan.cpp index 08ffbdb68..43d9b38ca 100644 --- a/targets/minecraft/world/entity/animal/SnowMan.cpp +++ b/targets/minecraft/world/entity/animal/SnowMan.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/entity/animal/VillagerGolem.cpp b/targets/minecraft/world/entity/animal/VillagerGolem.cpp index 622264846..95e5d3420 100644 --- a/targets/minecraft/world/entity/animal/VillagerGolem.cpp +++ b/targets/minecraft/world/entity/animal/VillagerGolem.cpp @@ -2,10 +2,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Pos.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -110,7 +110,7 @@ int VillagerGolem::decreaseAirSupply(int currentSupply) { } void VillagerGolem::doPush(std::shared_ptr e) { - if (e->instanceof (eTYPE_ENEMY)) { + if (e->instanceof(eTYPE_ENEMY)) { if (getRandom()->nextInt(20) == 0) { setTarget(std::dynamic_pointer_cast(e)); } @@ -239,7 +239,7 @@ bool VillagerGolem::hurt(DamageSource* source, float dmg) { // 4J: Protect owned golem from untrusted players if (isPlayerCreated()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToAttackPlayers()) return false; diff --git a/targets/minecraft/world/entity/animal/Wolf.cpp b/targets/minecraft/world/entity/animal/Wolf.cpp index 4f032a715..0ed85be47 100644 --- a/targets/minecraft/world/entity/animal/Wolf.cpp +++ b/targets/minecraft/world/entity/animal/Wolf.cpp @@ -6,10 +6,10 @@ #include #include "Sheep.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -262,7 +262,7 @@ bool Wolf::hurt(DamageSource* source, float dmg) { // 4J: Protect owned wolves from untrusted players if (isTame()) { std::shared_ptr entity = source->getDirectEntity(); - if (entity != nullptr && entity->instanceof (eTYPE_PLAYER)) { + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr attacker = std::dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerUUID()); @@ -272,9 +272,8 @@ bool Wolf::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; std::shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); - if (sourceEntity != nullptr && - !(sourceEntity->instanceof (eTYPE_PLAYER) || sourceEntity->instanceof - (eTYPE_ARROW))) { + if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || + sourceEntity->instanceof(eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; } @@ -488,7 +487,7 @@ bool Wolf::canMate(std::shared_ptr animal) { if (animal == shared_from_this()) return false; if (!isTame()) return false; - if (!animal->instanceof (eTYPE_WOLF)) return false; + if (!animal->instanceof(eTYPE_WOLF)) return false; std::shared_ptr partner = std::dynamic_pointer_cast(animal); if (partner == nullptr) return false; @@ -521,10 +520,9 @@ bool Wolf::wantsToAttack(std::shared_ptr target, return false; } } - if (target->instanceof (eTYPE_PLAYER) && owner->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - std::dynamic_pointer_cast(target))) { + if (target->instanceof(eTYPE_PLAYER) && owner->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + std::dynamic_pointer_cast(target))) { // pvp is off return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp index 9b8b9874f..5fb271662 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderCrystal.cpp @@ -74,8 +74,8 @@ bool EnderCrystal::hurt(DamageSource* source, float damage) { // 4J-PB - if the owner of the source is the enderdragon, then ignore it // (where the dragon's fireball hits an endercrystal) - if (source->getEntity() != nullptr && source->getEntity()->instanceof - (eTYPE_ENDERDRAGON)) { + if (source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_ENDERDRAGON)) { return false; } diff --git a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp index 89c060c67..d95771a89 100644 --- a/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp +++ b/targets/minecraft/world/entity/boss/enderdragon/EnderDragon.cpp @@ -5,10 +5,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -482,7 +482,7 @@ void EnderDragon::aiStep() { level->getEntities(shared_from_this(), &m_acidArea); for (auto it = targets->begin(); it != targets->end(); ++it) { - if ((*it)->instanceof (eTYPE_LIVINGENTITY)) { + if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { // Log::info("Attacking entity with acid\n"); std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -878,7 +878,7 @@ void EnderDragon::knockBack(std::vector >* entities) { // for (Entity e : entities) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast(*it); @@ -893,7 +893,7 @@ void EnderDragon::knockBack(std::vector >* entities) { void EnderDragon::hurt(std::vector >* entities) { // for (int i = 0; i < entities->size(); i++) for (auto it = entities->begin(); it != entities->end(); ++it) { - if ((*it)->instanceof (eTYPE_LIVINGENTITY)) //(e instanceof Mob) + if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = std::dynamic_pointer_cast( @@ -1147,8 +1147,9 @@ bool EnderDragon::hurt(std::shared_ptr MultiEntityMobPart, // zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2; // attackTarget = nullptr; - if (source->getEntity() != nullptr && source->getEntity()->instanceof - (eTYPE_PLAYER) || source->isExplosion()) { + if (source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_PLAYER) || + source->isExplosion()) { int healthBefore = getHealth(); reallyHurt(source, damage); @@ -1468,8 +1469,8 @@ void EnderDragon::handleCrystalDestroyed(DamageSource* source) { Log::info("Dragon action is now: LandingApproach\n"); #endif } - } else if (source->getEntity() != nullptr && source->getEntity()->instanceof - (eTYPE_PLAYER)) { + } else if (source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_PLAYER)) { if (setSynchedAction(e_EnderdragonAction_StrafePlayer)) { attackTarget = std::dynamic_pointer_cast(source->getEntity()); @@ -1871,7 +1872,9 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, // result = m_headYRot / (7 - partIndex); // } // else - { result = partPos[0] - bodyPos[0]; } + { + result = partPos[0] - bodyPos[0]; + } // Log::info("Part %d is at %f\n", partIndex, result); return result; } diff --git a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp index 142249f77..83f12546d 100644 --- a/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp +++ b/targets/minecraft/world/entity/boss/wither/WitherBoss.cpp @@ -8,9 +8,9 @@ #include #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -43,7 +43,7 @@ #include "nbt/CompoundTag.h" bool LivingEntitySelector::matches(std::shared_ptr entity) const { - if (entity->instanceof (eTYPE_LIVINGENTITY)) { + if (entity->instanceof(eTYPE_LIVINGENTITY)) { return std::dynamic_pointer_cast(entity)->getMobType() != UNDEAD; } else { @@ -261,9 +261,10 @@ void WitherBoss::newServerAiStep() { // 4J: Added check for instance of living entity, had a problem // with IDs being recycled to other entities - if (current == nullptr || !current->instanceof - (eTYPE_LIVINGENTITY) || !current->isAlive() || - distanceToSqr(current) > 30 * 30 || !canSee(current)) { + if (current == nullptr || + !current->instanceof(eTYPE_LIVINGENTITY) || + !current->isAlive() || distanceToSqr(current) > 30 * 30 || + !canSee(current)) { setAlternativeTarget(i, 0); } else { performRangedAttack( @@ -289,16 +290,16 @@ void WitherBoss::newServerAiStep() { if (selected != shared_from_this() && selected->isAlive() && canSee(selected)) { - if (selected->instanceof (eTYPE_PLAYER)) { + if (selected->instanceof(eTYPE_PLAYER)) { if (!std::dynamic_pointer_cast(selected) ->abilities.invulnerable) { - assert(selected->instanceof - (eTYPE_LIVINGENTITY)); + assert( + selected->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); } break; } else { - assert(selected->instanceof (eTYPE_LIVINGENTITY)); + assert(selected->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(i, selected->entityId); break; } @@ -311,7 +312,7 @@ void WitherBoss::newServerAiStep() { } } if (getTarget() != nullptr) { - assert(getTarget()->instanceof (eTYPE_LIVINGENTITY)); + assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); } else { setAlternativeTarget(0, 0); @@ -457,11 +458,10 @@ bool WitherBoss::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof (eTYPE_PLAYER)) { - } else if (sourceEntity->instanceof - (eTYPE_LIVINGENTITY) && - std::dynamic_pointer_cast(sourceEntity) - ->getMobType() == getMobType()) { + if (sourceEntity->instanceof(eTYPE_PLAYER)) { + } else if (sourceEntity->instanceof(eTYPE_LIVINGENTITY) && + std::dynamic_pointer_cast(sourceEntity) + ->getMobType() == getMobType()) { // can't be harmed by other undead return false; } diff --git a/targets/minecraft/world/entity/global/GlobalEntity.h b/targets/minecraft/world/entity/global/GlobalEntity.h index b7c5ae576..2247ce7f6 100644 --- a/targets/minecraft/world/entity/global/GlobalEntity.h +++ b/targets/minecraft/world/entity/global/GlobalEntity.h @@ -6,5 +6,5 @@ class Level; // class GlobalEntity : public Entity class GlobalEntity : public Entity { public: - GlobalEntity(Level* level) : Entity(level){}; + GlobalEntity(Level* level) : Entity(level) {}; }; \ No newline at end of file diff --git a/targets/minecraft/world/entity/global/LightningBolt.cpp b/targets/minecraft/world/entity/global/LightningBolt.cpp index 46f2d7285..2012f473c 100644 --- a/targets/minecraft/world/entity/global/LightningBolt.cpp +++ b/targets/minecraft/world/entity/global/LightningBolt.cpp @@ -5,10 +5,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/global/GlobalEntity.h" diff --git a/targets/minecraft/world/entity/item/Boat.cpp b/targets/minecraft/world/entity/item/Boat.cpp index afa2118f6..9c438d17d 100644 --- a/targets/minecraft/world/entity/item/Boat.cpp +++ b/targets/minecraft/world/entity/item/Boat.cpp @@ -87,10 +87,9 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker) - ->isAllowedToHurtEntity(shared_from_this())) { + if (attacker->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( + shared_from_this())) { return false; } } @@ -112,9 +111,9 @@ bool Boat::hurt(DamageSource* source, float hurtDamage) { // Minecarts and boat requires more hits than one to be destroyed in // creative mode 4J-PB - Fix for XB1 #175735 - [CRASH] [Multi-Plat]: Code: // Gameplay: Placing a boat on harmful surfaces causes the game to crash - bool creativePlayer = - (source->getEntity() != nullptr) && source->getEntity()->instanceof - (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = (source->getEntity() != nullptr) && + source->getEntity()->instanceof(eTYPE_PLAYER) && + std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -254,8 +253,8 @@ void Boat::tick() { yd += 0.007f; } - if (rider.lock() != nullptr && rider.lock()->instanceof - (eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && + rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr livingRider = std::dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; @@ -380,8 +379,8 @@ float Boat::getShadowHeightOffs() { return 0; } std::string Boat::getName() { return "Boat"; } bool Boat::interact(std::shared_ptr player) { - if ((rider.lock() != nullptr) && rider.lock()->instanceof - (eTYPE_PLAYER) && (rider.lock() != player)) + if ((rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && + (rider.lock() != player)) return true; if (!level->isClientSide) { // 4J HEG - Fixed issue with player not being able to dismount boat diff --git a/targets/minecraft/world/entity/item/ItemEntity.cpp b/targets/minecraft/world/entity/item/ItemEntity.cpp index 3101b474a..911bd226b 100644 --- a/targets/minecraft/world/entity/item/ItemEntity.cpp +++ b/targets/minecraft/world/entity/item/ItemEntity.cpp @@ -7,9 +7,9 @@ #include #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" diff --git a/targets/minecraft/world/entity/item/Minecart.cpp b/targets/minecraft/world/entity/item/Minecart.cpp index db3694254..6a732674a 100644 --- a/targets/minecraft/world/entity/item/Minecart.cpp +++ b/targets/minecraft/world/entity/item/Minecart.cpp @@ -153,10 +153,9 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (dynamic_cast(source) != nullptr) { std::shared_ptr attacker = source->getDirectEntity(); - if (attacker->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(attacker) - ->isAllowedToHurtEntity(shared_from_this())) { + if (attacker->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(attacker)->isAllowedToHurtEntity( + shared_from_this())) { return false; } } @@ -173,9 +172,9 @@ bool Minecart::hurt(DamageSource* source, float hurtDamage) { if (rider.lock() != nullptr && rider.lock() == source->getEntity()) hurtDamage += 1; - bool creativePlayer = - source->getEntity() != nullptr && source->getEntity()->instanceof - (eTYPE_PLAYER) && std::dynamic_pointer_cast(source->getEntity()) + bool creativePlayer = source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_PLAYER) && + std::dynamic_pointer_cast(source->getEntity()) ->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { @@ -336,8 +335,8 @@ void Minecart::tick() { auto itEnd = entities->end(); for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); - if (e != rider.lock() && e->isPushable() && e->instanceof - (eTYPE_MINECART)) { + if (e != rider.lock() && e->isPushable() && + e->instanceof(eTYPE_MINECART)) { std::shared_ptr cart = std::dynamic_pointer_cast(e); cart->m_bHasPushedCartThisTick = false; @@ -431,8 +430,8 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, xd = pow * xD / dd; zd = pow * zD / dd; - if (rider.lock() != nullptr && rider.lock()->instanceof - (eTYPE_LIVINGENTITY)) { + if (rider.lock() != nullptr && + rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr living = std::dynamic_pointer_cast(rider.lock()); @@ -719,10 +718,9 @@ void Minecart::push(std::shared_ptr e) { if (level->isClientSide) return; if (e == rider.lock()) return; - if (e->instanceof (eTYPE_LIVINGENTITY) && !e->instanceof - (eTYPE_PLAYER) && !e->instanceof - (eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && - (xd * xd + zd * zd > 0.01)) { + if (e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_PLAYER) && + !e->instanceof(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && + (xd * xd + zd * zd > 0.01)) { if ((rider.lock() == nullptr) && (e->riding == nullptr)) { e->ride(shared_from_this()); } @@ -748,7 +746,7 @@ void Minecart::push(std::shared_ptr e) { xa *= 0.5; za *= 0.5; - if (e->instanceof (eTYPE_MINECART)) { + if (e->instanceof(eTYPE_MINECART)) { double xo = e->x - x; double zo = e->z - z; diff --git a/targets/minecraft/world/entity/item/MinecartRideable.cpp b/targets/minecraft/world/entity/item/MinecartRideable.cpp index 69e58982f..e094947a2 100644 --- a/targets/minecraft/world/entity/item/MinecartRideable.cpp +++ b/targets/minecraft/world/entity/item/MinecartRideable.cpp @@ -21,8 +21,8 @@ MinecartRideable::MinecartRideable(Level* level, double x, double y, double z) } bool MinecartRideable::interact(std::shared_ptr player) { - if (rider.lock() != nullptr && rider.lock()->instanceof - (eTYPE_PLAYER) && rider.lock() != player) + if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_PLAYER) && + rider.lock() != player) return true; if (rider.lock() != nullptr && rider.lock() != player) return false; if (!level->isClientSide) { diff --git a/targets/minecraft/world/entity/item/MinecartTNT.cpp b/targets/minecraft/world/entity/item/MinecartTNT.cpp index a2fb4839e..5ce6305d7 100644 --- a/targets/minecraft/world/entity/item/MinecartTNT.cpp +++ b/targets/minecraft/world/entity/item/MinecartTNT.cpp @@ -5,9 +5,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/item/Minecart.h" #include "minecraft/world/item/ItemInstance.h" diff --git a/targets/minecraft/world/entity/monster/Blaze.cpp b/targets/minecraft/world/entity/monster/Blaze.cpp index acfcf9adc..76648aee0 100644 --- a/targets/minecraft/world/entity/monster/Blaze.cpp +++ b/targets/minecraft/world/entity/monster/Blaze.cpp @@ -6,10 +6,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/Mob.h" diff --git a/targets/minecraft/world/entity/monster/CaveSpider.cpp b/targets/minecraft/world/entity/monster/CaveSpider.cpp index 6e8cf0c2f..7ac2661e6 100644 --- a/targets/minecraft/world/entity/monster/CaveSpider.cpp +++ b/targets/minecraft/world/entity/monster/CaveSpider.cpp @@ -29,7 +29,7 @@ void CaveSpider::registerAttributes() { bool CaveSpider::doHurtTarget(std::shared_ptr target) { if (Spider::doHurtTarget(target)) { - if (target->instanceof (eTYPE_LIVINGENTITY)) { + if (target->instanceof(eTYPE_LIVINGENTITY)) { int poisonTime = 0; if (level->difficulty <= Difficulty::EASY) { // No poison! diff --git a/targets/minecraft/world/entity/monster/Creeper.cpp b/targets/minecraft/world/entity/monster/Creeper.cpp index 51658fbbc..e898c1097 100644 --- a/targets/minecraft/world/entity/monster/Creeper.cpp +++ b/targets/minecraft/world/entity/monster/Creeper.cpp @@ -5,8 +5,8 @@ #include #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -140,8 +140,8 @@ int Creeper::getDeathSound() { return eSoundType_MOB_CREEPER_DEATH; } void Creeper::die(DamageSource* source) { Monster::die(source); - if (source->getEntity() != nullptr && source->getEntity()->instanceof - (eTYPE_SKELETON)) { + if (source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_SKELETON)) { int recordId = Item::record_01_Id + random->nextInt(Item::record_12_Id - Item::record_01_Id + 1); @@ -149,10 +149,9 @@ void Creeper::die(DamageSource* source) { } if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof - (eTYPE_ARROW) && source->getEntity() != nullptr && - source->getEntity()->instanceof - (eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof(eTYPE_ARROW) && + source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); player->awardStat(GenericStats::archer(), GenericStats::param_archer()); diff --git a/targets/minecraft/world/entity/monster/EnderMan.cpp b/targets/minecraft/world/entity/monster/EnderMan.cpp index 63ca47f99..8d7f39f77 100644 --- a/targets/minecraft/world/entity/monster/EnderMan.cpp +++ b/targets/minecraft/world/entity/monster/EnderMan.cpp @@ -7,10 +7,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" @@ -239,10 +239,9 @@ void EnderMan::aiStep() { if (!level->isClientSide && isAlive()) { if (attackTarget != nullptr) { - if (attackTarget->instanceof - (eTYPE_PLAYER) && - isLookingAtMe( - std::dynamic_pointer_cast(attackTarget))) { + if (attackTarget->instanceof(eTYPE_PLAYER) && + isLookingAtMe( + std::dynamic_pointer_cast(attackTarget))) { if (attackTarget->distanceToSqr(shared_from_this()) < 4 * 4) { teleport(); } @@ -381,8 +380,7 @@ bool EnderMan::hurt(DamageSource* source, float damage) { setCreepy(true); if (dynamic_cast(source) != nullptr && - source->getEntity()->instanceof - (eTYPE_PLAYER)) { + source->getEntity()->instanceof(eTYPE_PLAYER)) { aggroedByPlayer = true; } diff --git a/targets/minecraft/world/entity/monster/Enemy.cpp b/targets/minecraft/world/entity/monster/Enemy.cpp index 919b72fb1..2287f73d3 100644 --- a/targets/minecraft/world/entity/monster/Enemy.cpp +++ b/targets/minecraft/world/entity/monster/Enemy.cpp @@ -10,5 +10,5 @@ class EntitySelector; EntitySelector* Enemy::ENEMY_SELECTOR = new Enemy::EnemyEntitySelector(); bool Enemy::EnemyEntitySelector::matches(std::shared_ptr entity) const { - return (entity != nullptr) && entity->instanceof (eTYPE_ENEMY); + return (entity != nullptr) && entity->instanceof(eTYPE_ENEMY); } \ No newline at end of file diff --git a/targets/minecraft/world/entity/monster/Ghast.cpp b/targets/minecraft/world/entity/monster/Ghast.cpp index bf2ed2292..4e1f85260 100644 --- a/targets/minecraft/world/entity/monster/Ghast.cpp +++ b/targets/minecraft/world/entity/monster/Ghast.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/network/packet/ChatPacket.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -61,8 +61,8 @@ bool Ghast::isCharging() { return entityData->getByte(DATA_IS_CHARGING) != 0; } bool Ghast::hurt(DamageSource* source, float dmg) { if (isInvulnerable()) return false; if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) { - if ((source->getEntity() != nullptr) && source->getEntity()->instanceof - (eTYPE_PLAYER)) { + if ((source->getEntity() != nullptr) && + source->getEntity()->instanceof(eTYPE_PLAYER)) { // reflected fireball, kill the ghast FlyingMob::hurt(source, 1000); std::dynamic_pointer_cast(source->getEntity()) diff --git a/targets/minecraft/world/entity/monster/LavaSlime.cpp b/targets/minecraft/world/entity/monster/LavaSlime.cpp index ccd58d6a2..3fa88d67c 100644 --- a/targets/minecraft/world/entity/monster/LavaSlime.cpp +++ b/targets/minecraft/world/entity/monster/LavaSlime.cpp @@ -3,9 +3,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/entity/ai/attributes/AttributeInstance.h" #include "minecraft/world/entity/monster/SharedMonsterAttributes.h" diff --git a/targets/minecraft/world/entity/monster/Monster.cpp b/targets/minecraft/world/entity/monster/Monster.cpp index a474b9934..8926ea2f5 100644 --- a/targets/minecraft/world/entity/monster/Monster.cpp +++ b/targets/minecraft/world/entity/monster/Monster.cpp @@ -84,7 +84,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { (float)getAttribute(SharedMonsterAttributes::ATTACK_DAMAGE)->getValue(); int knockback = 0; - if (target->instanceof (eTYPE_LIVINGENTITY)) { + if (target->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); dmg += EnchantmentHelper::getDamageBonus( @@ -115,7 +115,7 @@ bool Monster::doHurtTarget(std::shared_ptr target) { target->setOnFire(fireAspect * 4); } - if (target->instanceof (eTYPE_LIVINGENTITY)) { + if (target->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr livingTarget = std::dynamic_pointer_cast(target); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), diff --git a/targets/minecraft/world/entity/monster/PigZombie.cpp b/targets/minecraft/world/entity/monster/PigZombie.cpp index 0423eb059..070bbde47 100644 --- a/targets/minecraft/world/entity/monster/PigZombie.cpp +++ b/targets/minecraft/world/entity/monster/PigZombie.cpp @@ -3,9 +3,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" @@ -105,14 +105,14 @@ std::shared_ptr PigZombie::findAttackTarget() { bool PigZombie::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr && sourceEntity->instanceof (eTYPE_PLAYER)) { + if (sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER)) { AABB grown = bb.grow(32, 32, 32); std::vector >* nearby = level->getEntities(shared_from_this(), &grown); auto itEnd = nearby->end(); for (auto it = nearby->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // nearby->at(i); - if (e->instanceof (eTYPE_PIGZOMBIE)) { + if (e->instanceof(eTYPE_PIGZOMBIE)) { std::shared_ptr pigZombie = std::dynamic_pointer_cast(e); pigZombie->alert(sourceEntity); diff --git a/targets/minecraft/world/entity/monster/Silverfish.cpp b/targets/minecraft/world/entity/monster/Silverfish.cpp index 4d4f99306..d7b73dbec 100644 --- a/targets/minecraft/world/entity/monster/Silverfish.cpp +++ b/targets/minecraft/world/entity/monster/Silverfish.cpp @@ -2,10 +2,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/IGameServices.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/damageSource/EntityDamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Skeleton.cpp b/targets/minecraft/world/entity/monster/Skeleton.cpp index c9bec989d..34d8a6122 100644 --- a/targets/minecraft/world/entity/monster/Skeleton.cpp +++ b/targets/minecraft/world/entity/monster/Skeleton.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -106,8 +106,8 @@ void Skeleton::playStepSound(int xt, int yt, int zt, int t) { bool Skeleton::doHurtTarget(std::shared_ptr target) { if (Monster::doHurtTarget(target)) { - if ((getSkeletonType() == TYPE_WITHER) && target->instanceof - (eTYPE_LIVINGENTITY)) { + if ((getSkeletonType() == TYPE_WITHER) && + target->instanceof(eTYPE_LIVINGENTITY)) { std::dynamic_pointer_cast(target)->addEffect( new MobEffectInstance(MobEffect::wither->id, SharedConstants::TICKS_PER_SECOND * 10)); @@ -158,7 +158,7 @@ void Skeleton::aiStep() { void Skeleton::rideTick() { Monster::rideTick(); - if (riding != nullptr && riding->instanceof (eTYPE_PATHFINDER_MOB)) { + if (riding != nullptr && riding->instanceof(eTYPE_PATHFINDER_MOB)) { yBodyRot = std::dynamic_pointer_cast(riding)->yBodyRot; } } @@ -167,10 +167,9 @@ void Skeleton::die(DamageSource* source) { Monster::die(source); if (source->getDirectEntity() != nullptr && - source->getDirectEntity()->instanceof - (eTYPE_ARROW) && source->getEntity() != nullptr && - source->getEntity()->instanceof - (eTYPE_PLAYER)) { + source->getDirectEntity()->instanceof(eTYPE_ARROW) && + source->getEntity() != nullptr && + source->getEntity()->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(source->getEntity()); diff --git a/targets/minecraft/world/entity/monster/Slime.cpp b/targets/minecraft/world/entity/monster/Slime.cpp index 79ddcc2e4..ca7de4e7f 100644 --- a/targets/minecraft/world/entity/monster/Slime.cpp +++ b/targets/minecraft/world/entity/monster/Slime.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/damageSource/DamageSource.h" diff --git a/targets/minecraft/world/entity/monster/Spider.cpp b/targets/minecraft/world/entity/monster/Spider.cpp index 64a8167c0..c195c6b7f 100644 --- a/targets/minecraft/world/entity/monster/Spider.cpp +++ b/targets/minecraft/world/entity/monster/Spider.cpp @@ -6,9 +6,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/Difficulty.h" #include "minecraft/world/effect/MobEffect.h" #include "minecraft/world/effect/MobEffectInstance.h" diff --git a/targets/minecraft/world/entity/monster/Witch.cpp b/targets/minecraft/world/entity/monster/Witch.cpp index 1f0cc9798..ac276a336 100644 --- a/targets/minecraft/world/entity/monster/Witch.cpp +++ b/targets/minecraft/world/entity/monster/Witch.cpp @@ -3,10 +3,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/entity/monster/Zombie.cpp b/targets/minecraft/world/entity/monster/Zombie.cpp index 1176a2c14..73a7c7ea1 100644 --- a/targets/minecraft/world/entity/monster/Zombie.cpp +++ b/targets/minecraft/world/entity/monster/Zombie.cpp @@ -8,8 +8,8 @@ #include #include "SharedConstants.h" -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -179,12 +179,10 @@ bool Zombie::hurt(DamageSource* source, float dmg) { if (Monster::hurt(source, dmg)) { std::shared_ptr target = getTarget(); if ((target == nullptr) && getAttackTarget() != nullptr && - getAttackTarget()->instanceof - (eTYPE_LIVINGENTITY)) + getAttackTarget()->instanceof(eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(getAttackTarget()); if ((target == nullptr) && source->getEntity() != nullptr && - source->getEntity()->instanceof - (eTYPE_LIVINGENTITY)) + source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) target = std::dynamic_pointer_cast(source->getEntity()); diff --git a/targets/minecraft/world/entity/npc/Villager.cpp b/targets/minecraft/world/entity/npc/Villager.cpp index 515828054..96c02961b 100644 --- a/targets/minecraft/world/entity/npc/Villager.cpp +++ b/targets/minecraft/world/entity/npc/Villager.cpp @@ -6,10 +6,10 @@ #include "Pos.h" #include "SharedConstants.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/effect/MobEffect.h" @@ -272,7 +272,7 @@ void Villager::setLastHurtByMob(std::shared_ptr mob) { if (_village != nullptr && mob != nullptr) { _village->addAggressor(mob); - if (mob->instanceof (eTYPE_PLAYER)) { + if (mob->instanceof(eTYPE_PLAYER)) { int amount = -1; if (isBaby()) { amount = -3; @@ -292,11 +292,11 @@ void Villager::die(DamageSource* source) { if (_village != nullptr) { std::shared_ptr sourceEntity = source->getEntity(); if (sourceEntity != nullptr) { - if (sourceEntity->instanceof (eTYPE_PLAYER)) { + if (sourceEntity->instanceof(eTYPE_PLAYER)) { _village->modifyStanding( std::dynamic_pointer_cast(sourceEntity)->getName(), -2); - } else if (sourceEntity->instanceof (eTYPE_ENEMY)) { + } else if (sourceEntity->instanceof(eTYPE_ENEMY)) { _village->resetNoBreedTimer(); } } else if (sourceEntity == nullptr) { diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 18e353701..fcde9eba2 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -21,7 +21,7 @@ #include "Inventory.h" #include "Player.h" -#include "minecraft/client/skins/ISkinAssetData.h" +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Direction.h" @@ -31,8 +31,8 @@ #include "minecraft/SharedConstants.h" #include "minecraft/client/model/HumanoidModel.h" #include "minecraft/client/renderer/Textures.h" +#include "minecraft/client/skins/ISkinAssetData.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Mth.h" #include "minecraft/world/Difficulty.h" @@ -1208,7 +1208,7 @@ bool Player::hurt(DamageSource* source, float dmg) { if (dmg == 0) return false; std::shared_ptr attacker = source->getEntity(); - if (attacker != nullptr && attacker->instanceof (eTYPE_ARROW)) { + if (attacker != nullptr && attacker->instanceof(eTYPE_ARROW)) { std::shared_ptr arrow = std::dynamic_pointer_cast(attacker); if (arrow->owner != nullptr) { @@ -1319,7 +1319,7 @@ bool Player::interact(std::shared_ptr entity) { return true; } - if ((item != nullptr) && entity->instanceof (eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY)) { // 4J - PC Comments // Hack to prevent item stacks from decrementing if the player has // the ability to instabuild @@ -1363,7 +1363,7 @@ void Player::attack(std::shared_ptr entity) { int knockback = 0; float magicBoost = 0; - if (entity->instanceof (eTYPE_LIVINGENTITY)) { + if (entity->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr thisPlayer = std::dynamic_pointer_cast(shared_from_this()); std::shared_ptr mob = @@ -1378,8 +1378,8 @@ void Player::attack(std::shared_ptr entity) { if (dmg > 0 || magicBoost > 0) { bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && - (riding == nullptr) && entity->instanceof - (eTYPE_LIVINGENTITY); + (riding == nullptr) && + entity->instanceof(eTYPE_LIVINGENTITY); if (bCrit && dmg > 0) { dmg *= 1.5f; } @@ -1390,8 +1390,8 @@ void Player::attack(std::shared_ptr entity) { bool setOnFireTemporatily = false; int fireAspect = EnchantmentHelper::getFireAspect( std::dynamic_pointer_cast(shared_from_this())); - if (entity->instanceof - (eTYPE_MOB) && fireAspect > 0 && !entity->isOnFire()) { + if (entity->instanceof(eTYPE_MOB) && fireAspect > 0 && + !entity->isOnFire()) { setOnFireTemporatily = true; entity->setOnFire(1); } @@ -1423,7 +1423,7 @@ void Player::attack(std::shared_ptr entity) { } setLastHurtMob(entity); - if (entity->instanceof (eTYPE_LIVINGENTITY)) { + if (entity->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(entity); ThornsEnchantment::doThornsAfterAttack(shared_from_this(), mob, @@ -1433,17 +1433,17 @@ void Player::attack(std::shared_ptr entity) { std::shared_ptr item = getSelectedItem(); std::shared_ptr hurtTarget = entity; - if (entity->instanceof (eTYPE_MULTIENTITY_MOB_PART)) { + if (entity->instanceof(eTYPE_MULTIENTITY_MOB_PART)) { std::shared_ptr multiMob = std::dynamic_pointer_cast( (std::dynamic_pointer_cast(entity)) ->parentMob.lock()); - if ((multiMob != nullptr) && multiMob->instanceof - (eTYPE_LIVINGENTITY)) { + if ((multiMob != nullptr) && + multiMob->instanceof(eTYPE_LIVINGENTITY)) { hurtTarget = std::dynamic_pointer_cast(multiMob); } } - if ((item != nullptr) && hurtTarget->instanceof (eTYPE_LIVINGENTITY)) { + if ((item != nullptr) && hurtTarget->instanceof(eTYPE_LIVINGENTITY)) { item->hurtEnemy( std::dynamic_pointer_cast(hurtTarget), std::dynamic_pointer_cast(shared_from_this())); @@ -1451,7 +1451,7 @@ void Player::attack(std::shared_ptr entity) { removeSelectedItem(); } } - if (entity->instanceof (eTYPE_LIVINGENTITY)) { + if (entity->instanceof(eTYPE_LIVINGENTITY)) { // awardStat(Stats.damageDealt, (int) Math.round(dmg * 10)); if (fireAspect > 0 && wasHurt) { @@ -1868,7 +1868,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { int distance = (int)Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f); if (distance > 0) { - if (riding->instanceof (eTYPE_MINECART)) { + if (riding->instanceof(eTYPE_MINECART)) { distanceMinecart += distance; if (distanceMinecart >= 100) { int newDistance = @@ -1897,7 +1897,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { } } - } else if (riding->instanceof (eTYPE_BOAT)) { + } else if (riding->instanceof(eTYPE_BOAT)) { distanceBoat += distance; if (distanceBoat >= 100) { int newDistance = distanceBoat - (distanceBoat % 100); @@ -1905,7 +1905,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) { awardStat(GenericStats::boatOneM(), GenericStats::param_boat(newDistance / 100)); } - } else if (riding->instanceof (eTYPE_PIG)) { + } else if (riding->instanceof(eTYPE_PIG)) { distancePig += distance; if (distancePig >= 100) { int newDistance = distancePig - (distancePig % 100); @@ -1937,10 +1937,9 @@ void Player::killed(std::shared_ptr mob) { // 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: // Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster // Hunter" Achievement. - if (mob->instanceof (eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || - mob->GetType() == eTYPE_SLIME || - mob->GetType() == eTYPE_LAVASLIME || - mob->GetType() == eTYPE_ENDERDRAGON) { + if (mob->instanceof(eTYPE_ENEMY) || mob->GetType() == eTYPE_GHAST || + mob->GetType() == eTYPE_SLIME || mob->GetType() == eTYPE_LAVASLIME || + mob->GetType() == eTYPE_ENDERDRAGON) { awardStat(GenericStats::killEnemy(), GenericStats::param_noArgs()); switch (mob->GetType()) { @@ -2509,7 +2508,7 @@ bool Player::isAllowedToUse(std::shared_ptr item) { bool Player::isAllowedToInteract(std::shared_ptr target) { bool allowed = true; if (gameServices().getGameHostOption(eGameHostOption_TrustPlayers) == 0) { - if (target->instanceof (eTYPE_MINECART)) { + if (target->instanceof(eTYPE_MINECART)) { if (getPlayerGamePrivilege( Player::ePlayerGamePrivilege_CanUseContainers) == 0) { std::shared_ptr minecart = diff --git a/targets/minecraft/world/entity/projectile/Arrow.cpp b/targets/minecraft/world/entity/projectile/Arrow.cpp index 681d1c345..d5b7719fc 100644 --- a/targets/minecraft/world/entity/projectile/Arrow.cpp +++ b/targets/minecraft/world/entity/projectile/Arrow.cpp @@ -8,12 +8,12 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/packet/GameEventPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" @@ -75,7 +75,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, viewScale = 10; owner = mob; - if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; y = mob->y + mob->getHeadHeight() - 0.1f; @@ -113,7 +113,7 @@ Arrow::Arrow(Level* level, std::shared_ptr mob, float power) viewScale = 10; owner = mob; - if (mob->instanceof (eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; + if (mob->instanceof(eTYPE_PLAYER)) pickup = PICKUP_ALLOWED; setSize(0.5f, 0.5f); @@ -275,17 +275,16 @@ void Arrow::tick() { res = new HitResult(hitEntity); } - if ((res != nullptr) && (res->entity != nullptr) && res->entity->instanceof - (eTYPE_PLAYER)) { + if ((res != nullptr) && (res->entity != nullptr) && + res->entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(res->entity); // 4J: Check for owner being null if (player->abilities.invulnerable || ((owner != nullptr) && - (owner->instanceof - (eTYPE_PLAYER) && - !std::dynamic_pointer_cast(owner)->canHarmPlayer( - player)))) { + (owner->instanceof(eTYPE_PLAYER) && + !std::dynamic_pointer_cast(owner)->canHarmPlayer( + player)))) { res = nullptr; } } @@ -319,7 +318,7 @@ void Arrow::tick() { res->entity->setOnFire(5); } - if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { std::shared_ptr mob = std::dynamic_pointer_cast(res->entity); @@ -351,11 +350,11 @@ void Arrow::tick() { // 4J : WESTY : For award, need to track if creeper was killed // by arrow from the player. - if (owner != nullptr && owner->instanceof - (eTYPE_PLAYER) // arrow owner is a player - && !res->entity->isAlive() // target is now dead - && (res->entity->GetType() == - eTYPE_CREEPER)) // target is a creeper + if (owner != nullptr && + owner->instanceof(eTYPE_PLAYER) // arrow owner is a player + && !res->entity->isAlive() // target is now dead + && (res->entity->GetType() == + eTYPE_CREEPER)) // target is a creeper { std::dynamic_pointer_cast(owner)->awardStat( diff --git a/targets/minecraft/world/entity/projectile/Fireball.cpp b/targets/minecraft/world/entity/projectile/Fireball.cpp index ed1c7e281..b94a38b61 100644 --- a/targets/minecraft/world/entity/projectile/Fireball.cpp +++ b/targets/minecraft/world/entity/projectile/Fireball.cpp @@ -324,7 +324,7 @@ bool Fireball::hurt(DamageSource* source, float damage) { zPower = zd * 0.1; } - if (source->getEntity()->instanceof (eTYPE_LIVINGENTITY)) { + if (source->getEntity()->instanceof(eTYPE_LIVINGENTITY)) { owner = std::dynamic_pointer_cast(source->getEntity()); } diff --git a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp index e3425b1ad..40f4e332d 100644 --- a/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp +++ b/targets/minecraft/world/entity/projectile/FireworksRocketEntity.cpp @@ -5,10 +5,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/EntityEvent.h" diff --git a/targets/minecraft/world/entity/projectile/FishingHook.cpp b/targets/minecraft/world/entity/projectile/FishingHook.cpp index 15557631f..f86354118 100644 --- a/targets/minecraft/world/entity/projectile/FishingHook.cpp +++ b/targets/minecraft/world/entity/projectile/FishingHook.cpp @@ -7,9 +7,9 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/entity/projectile/Snowball.cpp b/targets/minecraft/world/entity/projectile/Snowball.cpp index 8d6489aba..787846ef3 100644 --- a/targets/minecraft/world/entity/projectile/Snowball.cpp +++ b/targets/minecraft/world/entity/projectile/Snowball.cpp @@ -30,7 +30,7 @@ Snowball::Snowball(Level* level, double x, double y, double z) void Snowball::onHit(HitResult* res) { if (res->entity != nullptr) { int damage = 0; - if (res->entity->instanceof (eTYPE_BLAZE)) { + if (res->entity->instanceof(eTYPE_BLAZE)) { damage = 3; } diff --git a/targets/minecraft/world/entity/projectile/Throwable.cpp b/targets/minecraft/world/entity/projectile/Throwable.cpp index 7cb64e44b..728b15944 100644 --- a/targets/minecraft/world/entity/projectile/Throwable.cpp +++ b/targets/minecraft/world/entity/projectile/Throwable.cpp @@ -249,8 +249,8 @@ void Throwable::addAdditonalSaveData(CompoundTag* tag) { tag->putByte("shake", (uint8_t)shakeTime); tag->putByte("inGround", (uint8_t)(inGround ? 1 : 0)); - if (ownerName.empty() && (owner != nullptr) && owner->instanceof - (eTYPE_PLAYER)) { + if (ownerName.empty() && (owner != nullptr) && + owner->instanceof(eTYPE_PLAYER)) { ownerName = owner->getAName(); } diff --git a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp index abf679bd5..0ada74647 100644 --- a/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp +++ b/targets/minecraft/world/entity/projectile/ThrownEnderpearl.cpp @@ -52,8 +52,8 @@ void ThrownEnderpearl::onHit(HitResult* res) { // the ground. If the owner has been removed, then ignore // 4J-JEV: Cheap type check first. - if ((getOwner() != nullptr) && getOwner()->instanceof - (eTYPE_SERVERPLAYER)) { + if ((getOwner() != nullptr) && + getOwner()->instanceof(eTYPE_SERVERPLAYER)) { std::shared_ptr serverPlayer = std::dynamic_pointer_cast(getOwner()); if (!serverPlayer->removed) { diff --git a/targets/minecraft/world/entity/projectile/WitherSkull.cpp b/targets/minecraft/world/entity/projectile/WitherSkull.cpp index b9b2b4f47..e1646e35e 100644 --- a/targets/minecraft/world/entity/projectile/WitherSkull.cpp +++ b/targets/minecraft/world/entity/projectile/WitherSkull.cpp @@ -74,7 +74,7 @@ void WitherSkull::onHit(HitResult* res) { } else { res->entity->hurt(DamageSource::magic, 5); } - if (res->entity->instanceof (eTYPE_LIVINGENTITY)) { + if (res->entity->instanceof(eTYPE_LIVINGENTITY)) { int witherSeconds = 0; if (level->difficulty <= Difficulty::EASY) { // Nothing diff --git a/targets/minecraft/world/item/ArmorItem.cpp b/targets/minecraft/world/item/ArmorItem.cpp index ba9a78897..f8e1da6b6 100644 --- a/targets/minecraft/world/item/ArmorItem.cpp +++ b/targets/minecraft/world/item/ArmorItem.cpp @@ -53,12 +53,12 @@ std::shared_ptr ArmorItem::ArmorDispenseItemBehavior::execute( if (entities->size() > 0) { std::shared_ptr target = std::dynamic_pointer_cast(entities->at(0)); - int offset = target->instanceof (eTYPE_PLAYER) ? 1 : 0; + int offset = target->instanceof(eTYPE_PLAYER) ? 1 : 0; int slot = Mob::getEquipmentSlotForItem(dispensed); std::shared_ptr equip = dispensed->copy(); equip->count = 1; target->setEquippedSlot(slot - offset, equip); - if (target->instanceof (eTYPE_MOB)) + if (target->instanceof(eTYPE_MOB)) std::dynamic_pointer_cast(target)->setDropChance(slot, 2); dispensed->count--; diff --git a/targets/minecraft/world/item/BowItem.cpp b/targets/minecraft/world/item/BowItem.cpp index ed816e6f0..014d00f91 100644 --- a/targets/minecraft/world/item/BowItem.cpp +++ b/targets/minecraft/world/item/BowItem.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" diff --git a/targets/minecraft/world/item/BucketItem.cpp b/targets/minecraft/world/item/BucketItem.cpp index 6b0a50735..fcf8ae7fd 100644 --- a/targets/minecraft/world/item/BucketItem.cpp +++ b/targets/minecraft/world/item/BucketItem.cpp @@ -3,6 +3,7 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/JavaMath.h" #include "java/Random.h" @@ -10,7 +11,6 @@ #include "minecraft/network/packet/ChatPacket.h" #include "minecraft/server/level/ServerPlayer.h" #include "minecraft/server/network/PlayerConnection.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/world/entity/Entity.h" diff --git a/targets/minecraft/world/item/EggItem.cpp b/targets/minecraft/world/item/EggItem.cpp index a2f4709b2..c19365395 100644 --- a/targets/minecraft/world/item/EggItem.cpp +++ b/targets/minecraft/world/item/EggItem.cpp @@ -3,8 +3,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEgg.h" diff --git a/targets/minecraft/world/item/EnderEyeItem.cpp b/targets/minecraft/world/item/EnderEyeItem.cpp index 2152a8d8a..0306b184c 100644 --- a/targets/minecraft/world/item/EnderEyeItem.cpp +++ b/targets/minecraft/world/item/EnderEyeItem.cpp @@ -2,10 +2,10 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/EnderpearlItem.cpp b/targets/minecraft/world/item/EnderpearlItem.cpp index 36a71a464..91c7557ac 100644 --- a/targets/minecraft/world/item/EnderpearlItem.cpp +++ b/targets/minecraft/world/item/EnderpearlItem.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownEnderpearl.h" diff --git a/targets/minecraft/world/item/ExperienceItem.cpp b/targets/minecraft/world/item/ExperienceItem.cpp index 012abb104..9b8bc55c2 100644 --- a/targets/minecraft/world/item/ExperienceItem.cpp +++ b/targets/minecraft/world/item/ExperienceItem.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/ThrownExpBottle.h" diff --git a/targets/minecraft/world/item/FireChargeItem.cpp b/targets/minecraft/world/item/FireChargeItem.cpp index 6c7f92463..a33e5d6a4 100644 --- a/targets/minecraft/world/item/FireChargeItem.cpp +++ b/targets/minecraft/world/item/FireChargeItem.cpp @@ -3,8 +3,8 @@ #include #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/item/FishingRodItem.cpp b/targets/minecraft/world/item/FishingRodItem.cpp index 17198e4ee..21380eae0 100644 --- a/targets/minecraft/world/item/FishingRodItem.cpp +++ b/targets/minecraft/world/item/FishingRodItem.cpp @@ -3,8 +3,8 @@ #include #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/FishingHook.h" diff --git a/targets/minecraft/world/item/FlintAndSteelItem.cpp b/targets/minecraft/world/item/FlintAndSteelItem.cpp index 765ab961e..735a58b87 100644 --- a/targets/minecraft/world/item/FlintAndSteelItem.cpp +++ b/targets/minecraft/world/item/FlintAndSteelItem.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/item/Item.h" diff --git a/targets/minecraft/world/item/FoodItem.cpp b/targets/minecraft/world/item/FoodItem.cpp index 68c9fca60..c5bd47495 100644 --- a/targets/minecraft/world/item/FoodItem.cpp +++ b/targets/minecraft/world/item/FoodItem.cpp @@ -1,8 +1,8 @@ #include "FoodItem.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/effect/MobEffectInstance.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/food/FoodConstants.h" diff --git a/targets/minecraft/world/item/MapItem.cpp b/targets/minecraft/world/item/MapItem.cpp index 7cd5c8cb4..35d541dc7 100644 --- a/targets/minecraft/world/item/MapItem.cpp +++ b/targets/minecraft/world/item/MapItem.cpp @@ -105,8 +105,8 @@ std::shared_ptr MapItem::getSavedData( void MapItem::update(Level* level, std::shared_ptr player, std::shared_ptr data) { - if ((level->dimension->id != data->dimension) || !player->instanceof - (eTYPE_PLAYER)) { + if ((level->dimension->id != data->dimension) || + !player->instanceof(eTYPE_PLAYER)) { // Wrong dimension, abort return; } @@ -267,7 +267,7 @@ void MapItem::inventoryTick(std::shared_ptr itemInstance, if (level->isClientSide) return; std::shared_ptr data = getSavedData(itemInstance, level); - if (owner->instanceof (eTYPE_PLAYER)) { + if (owner->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(owner); diff --git a/targets/minecraft/world/item/NameTagItem.cpp b/targets/minecraft/world/item/NameTagItem.cpp index a1c7e6148..07912462c 100644 --- a/targets/minecraft/world/item/NameTagItem.cpp +++ b/targets/minecraft/world/item/NameTagItem.cpp @@ -16,7 +16,7 @@ bool NameTagItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr target) { if (!itemInstance->hasCustomHoverName()) return false; - if ((target != nullptr) && target->instanceof (eTYPE_MOB)) { + if ((target != nullptr) && target->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(target); mob->setCustomName(itemInstance->getHoverName()); mob->setPersistenceRequired(); diff --git a/targets/minecraft/world/item/PotionItem.cpp b/targets/minecraft/world/item/PotionItem.cpp index 887160520..4cc05d4f1 100644 --- a/targets/minecraft/world/item/PotionItem.cpp +++ b/targets/minecraft/world/item/PotionItem.cpp @@ -2,11 +2,11 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/HtmlString.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/effect/MobEffect.h" diff --git a/targets/minecraft/world/item/SaddleItem.cpp b/targets/minecraft/world/item/SaddleItem.cpp index b8bfecf95..3e91f56e2 100644 --- a/targets/minecraft/world/item/SaddleItem.cpp +++ b/targets/minecraft/world/item/SaddleItem.cpp @@ -13,7 +13,7 @@ SaddleItem::SaddleItem(int id) : Item(id) { maxStackSize = 1; } bool SaddleItem::interactEnemy(std::shared_ptr itemInstance, std::shared_ptr player, std::shared_ptr mob) { - if ((mob != nullptr) && mob->instanceof (eTYPE_PIG)) { + if ((mob != nullptr) && mob->instanceof(eTYPE_PIG)) { std::shared_ptr pig = std::dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) { pig->setSaddle(true); diff --git a/targets/minecraft/world/item/SkullItem.cpp b/targets/minecraft/world/item/SkullItem.cpp index f61e3ebad..8a711587e 100644 --- a/targets/minecraft/world/item/SkullItem.cpp +++ b/targets/minecraft/world/item/SkullItem.cpp @@ -125,7 +125,9 @@ unsigned int SkullItem::getDescriptionId( std::string SkullItem::getHoverName( std::shared_ptr itemInstance) { - { return Item::getHoverName(itemInstance); } + { + return Item::getHoverName(itemInstance); + } } void SkullItem::registerIcons(IconRegister* iconRegister) { diff --git a/targets/minecraft/world/item/SnowballItem.cpp b/targets/minecraft/world/item/SnowballItem.cpp index d0a35e990..f6f1ceef9 100644 --- a/targets/minecraft/world/item/SnowballItem.cpp +++ b/targets/minecraft/world/item/SnowballItem.cpp @@ -2,8 +2,8 @@ #include -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/entity/projectile/Snowball.h" diff --git a/targets/minecraft/world/item/SpawnEggItem.cpp b/targets/minecraft/world/item/SpawnEggItem.cpp index 629a3d8bd..240b6561b 100644 --- a/targets/minecraft/world/item/SpawnEggItem.cpp +++ b/targets/minecraft/world/item/SpawnEggItem.cpp @@ -140,7 +140,7 @@ std::shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level* level, } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (newEntity->instanceof (eTYPE_ENEMY)) { + else if (newEntity->instanceof(eTYPE_ENEMY)) { // 4J-PB - check if the player is trying to spawn an enemy // in peaceful mode if (level->difficulty == Difficulty::PEACEFUL) { @@ -218,8 +218,8 @@ bool SpawnEggItem::useOn(std::shared_ptr itemInstance, if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; so change // instanceof to check for Mobs. - if (result->instanceof - (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { + if (result->instanceof(eTYPE_MOB) && + itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -263,8 +263,8 @@ std::shared_ptr SpawnEggItem::use( if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; // so change instanceof to check for Mobs. - if (result->instanceof - (eTYPE_MOB) && itemInstance->hasCustomHoverName()) { + if (result->instanceof(eTYPE_MOB) && + itemInstance->hasCustomHoverName()) { std::dynamic_pointer_cast(result)->setCustomName( itemInstance->getHoverName()); } @@ -301,7 +301,7 @@ std::shared_ptr SpawnEggItem::spawnMobAt(Level* level, int auxVal, // 4J-JEV: DynCasting to Mob not LivingEntity; so change instanceof to // check for Mobs. - if (newEntity != nullptr && newEntity->instanceof (eTYPE_MOB)) { + if (newEntity != nullptr && newEntity->instanceof(eTYPE_MOB)) { std::shared_ptr mob = std::dynamic_pointer_cast(newEntity); newEntity->moveTo( diff --git a/targets/minecraft/world/item/crafting/Recipes.h b/targets/minecraft/world/item/crafting/Recipes.h index b119769ad..33f9bc0bc 100644 --- a/targets/minecraft/world/item/crafting/Recipes.h +++ b/targets/minecraft/world/item/crafting/Recipes.h @@ -79,7 +79,7 @@ public: iteminstance = i; } - eINSTANCEOF instanceof () { return eType; } + eINSTANCEOF instanceof() { return eType; } eINSTANCEOF GetType() { return eType; }; private: diff --git a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp index 3a1d78b91..39c08c393 100644 --- a/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp +++ b/targets/minecraft/world/item/enchantment/ThornsEnchantment.cpp @@ -1,7 +1,7 @@ #include "ThornsEnchantment.h" -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/damageSource/DamageSource.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/minecraft/world/level/BaseMobSpawner.cpp b/targets/minecraft/world/level/BaseMobSpawner.cpp index 3356314c8..893085100 100644 --- a/targets/minecraft/world/level/BaseMobSpawner.cpp +++ b/targets/minecraft/world/level/BaseMobSpawner.cpp @@ -114,8 +114,10 @@ void BaseMobSpawner::tick() { double zp = getZ() + (getLevel()->random->nextDouble() - getLevel()->random->nextDouble()) * spawnRange; - std::shared_ptr mob = entity->instanceof - (eTYPE_MOB) ? std::dynamic_pointer_cast(entity) : nullptr; + std::shared_ptr mob = + entity->instanceof(eTYPE_MOB) + ? std::dynamic_pointer_cast(entity) + : nullptr; entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0); @@ -179,8 +181,8 @@ std::shared_ptr BaseMobSpawner::loadDataAndAddEntity( data = ridingTag; } - } else if (entity->instanceof - (eTYPE_LIVINGENTITY) && entity->level != nullptr) { + } else if (entity->instanceof(eTYPE_LIVINGENTITY) && + entity->level != nullptr) { std::dynamic_pointer_cast(entity)->finalizeMobSpawn(nullptr); getLevel()->addEntity(entity); } diff --git a/targets/minecraft/world/level/Coord.h b/targets/minecraft/world/level/Coord.h index f2f94d092..e1add5020 100644 --- a/targets/minecraft/world/level/Coord.h +++ b/targets/minecraft/world/level/Coord.h @@ -5,5 +5,5 @@ public: const int x, y, z; public: - Coord(int x, int y, int z) : x(x), y(y), z(z){}; + Coord(int x, int y, int z) : x(x), y(y), z(z) {}; }; \ No newline at end of file diff --git a/targets/minecraft/world/level/Explosion.cpp b/targets/minecraft/world/level/Explosion.cpp index e6aeaa8af..172957645 100644 --- a/targets/minecraft/world/level/Explosion.cpp +++ b/targets/minecraft/world/level/Explosion.cpp @@ -6,10 +6,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" #include "minecraft/world/damageSource/DamageSource.h" @@ -170,7 +170,7 @@ void Explosion::explode() { e->yd += ya * kbPower; e->zd += za * kbPower; - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); // Log::info("Adding player knockback (%f,%f,%f)\n", xa * @@ -300,9 +300,9 @@ Vec3 Explosion::getHitPlayerKnockback(std::shared_ptr player) { std::shared_ptr Explosion::getSourceMob() { if (source == nullptr) return nullptr; - if (source->instanceof (eTYPE_PRIMEDTNT)) + if (source->instanceof(eTYPE_PRIMEDTNT)) return std::dynamic_pointer_cast(source)->getOwner(); - if (source->instanceof (eTYPE_LIVINGENTITY)) + if (source->instanceof(eTYPE_LIVINGENTITY)) return std::dynamic_pointer_cast(source); return nullptr; } diff --git a/targets/minecraft/world/level/Level.cpp b/targets/minecraft/world/level/Level.cpp index c1a109294..72184ddd9 100644 --- a/targets/minecraft/world/level/Level.cpp +++ b/targets/minecraft/world/level/Level.cpp @@ -14,6 +14,7 @@ #include "Explosion.h" #include "LevelListener.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Console_Debug_enum.h" #include "minecraft/Direction.h" @@ -27,7 +28,6 @@ #include "minecraft/client/resources/Colours/ColourTable.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/network/INetworkService.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/util/Log.h" #include "minecraft/util/Mth.h" @@ -1574,12 +1574,12 @@ bool Level::addEntity(std::shared_ptr e) { } bool forced = e->forcedLoading; - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { forced = true; } if (forced || hasChunk(xc, zc)) { - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(e); @@ -1634,7 +1634,7 @@ void Level::removeEntity(std::shared_ptr e) { e->ride(nullptr); } e->remove(); - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -1653,7 +1653,7 @@ void Level::removeEntity(std::shared_ptr e) { void Level::removeEntityImmediately(std::shared_ptr e) { e->remove(); - if (e->instanceof (eTYPE_PLAYER)) { + if (e->instanceof(eTYPE_PLAYER)) { std::vector >::iterator it = players.begin(); std::vector >::iterator itEnd = players.end(); while (it != itEnd && *it != std::dynamic_pointer_cast(e)) it++; @@ -2113,8 +2113,8 @@ void Level::tickEntities() { if (!e->removed) { #if !defined(_FINAL_BUILD) if (!(gameServices().debugSettingsOn() && - gameServices().debugMobsDontTick() && e->instanceof - (eTYPE_MOB) && !e->instanceof (eTYPE_PLAYER))) + gameServices().debugMobsDontTick() && + e->instanceof(eTYPE_MOB) && !e->instanceof(eTYPE_PLAYER))) #endif { tick(e); @@ -3445,7 +3445,7 @@ unsigned int Level::countInstanceOf( count++; } } else { - if (e->instanceof (clas)) count++; + if (e->instanceof(clas)) count++; } } } @@ -3472,7 +3472,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, count++; } } else { - if (e->instanceof (clas)) count++; + if (e->instanceof(clas)) count++; } } } @@ -4224,7 +4224,7 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { } // 4J: Use eTYPE_ENEMY instead of monster (slimes and ghasts // aren't monsters) - else if (Entity:: instanceof (type, eTYPE_ENEMY)) { + else if (Entity::instanceof(type, eTYPE_ENEMY)) { count = countInstanceOf(eTYPE_ENEMY, false); max = MobCategory::MAX_XBOX_MONSTERS_WITH_SPAWN_EGG; } else if ((type & eTYPE_AMBIENT) == eTYPE_AMBIENT) { @@ -4232,10 +4232,10 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) { max = MobCategory::MAX_AMBIENT_WITH_SPAWN_EGG; } // 4J: Added minecart and boats - else if (Entity:: instanceof (type, eTYPE_MINECART)) { + else if (Entity::instanceof(type, eTYPE_MINECART)) { count = countInstanceOf(eTYPE_MINECART, false); max = Level::MAX_CONSOLE_MINECARTS; - } else if (Entity:: instanceof (type, eTYPE_BOAT)) { + } else if (Entity::instanceof(type, eTYPE_BOAT)) { count = countInstanceOf(eTYPE_BOAT, true); max = Level::MAX_XBOX_BOATS; } diff --git a/targets/minecraft/world/level/Level.h b/targets/minecraft/world/level/Level.h index 741f607b7..3b71af1f6 100644 --- a/targets/minecraft/world/level/Level.h +++ b/targets/minecraft/world/level/Level.h @@ -22,8 +22,8 @@ #include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/saveddata/SavedData.h" #include "minecraft/world/phys/AABB.h" -#include "platform/thread/C4JThread.h" #include "platform/PlatformTypes.h" +#include "platform/thread/C4JThread.h" class CompoundTag; class ItemInstance; diff --git a/targets/minecraft/world/level/biome/IceBiome.cpp b/targets/minecraft/world/level/biome/IceBiome.cpp index 2354d4642..e9e076cb7 100644 --- a/targets/minecraft/world/level/biome/IceBiome.cpp +++ b/targets/minecraft/world/level/biome/IceBiome.cpp @@ -2,4 +2,4 @@ #include "minecraft/world/level/biome/Biome.h" -IceBiome::IceBiome(int id) : Biome(id){}; \ No newline at end of file +IceBiome::IceBiome(int id) : Biome(id) {}; \ No newline at end of file diff --git a/targets/minecraft/world/level/chunk/LevelChunk.cpp b/targets/minecraft/world/level/chunk/LevelChunk.cpp index 40c9779cb..ef39bfa8e 100644 --- a/targets/minecraft/world/level/chunk/LevelChunk.cpp +++ b/targets/minecraft/world/level/chunk/LevelChunk.cpp @@ -1578,21 +1578,21 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb, // that our class may be derived from, otherwise do a direct // comparison of type_info if (ec == typeid(Player)) - isAssignableFrom = e->instanceof (eTYPE_PLAYER); + isAssignableFrom = e->instanceof(eTYPE_PLAYER); else if (ec == typeid(Entity)) - isAssignableFrom = e->instanceof (eTYPE_ENTITY); + isAssignableFrom = e->instanceof(eTYPE_ENTITY); else if (ec == typeid(Mob)) - isAssignableFrom = e->instanceof (eTYPE_MOB); + isAssignableFrom = e->instanceof(eTYPE_MOB); else if (ec == typeid(LivingEntity)) - isAssignableFrom = e->instanceof (eTYPE_LIVINGENTITY); + isAssignableFrom = e->instanceof(eTYPE_LIVINGENTITY); else if (ec == typeid(ItemEntity)) - isAssignableFrom = e->instanceof (eTYPE_ITEMENTITY); + isAssignableFrom = e->instanceof(eTYPE_ITEMENTITY); else if (ec == typeid(Minecart)) - isAssignableFrom = e->instanceof (eTYPE_MINECART); + isAssignableFrom = e->instanceof(eTYPE_MINECART); else if (ec == typeid(Monster)) - isAssignableFrom = e->instanceof (eTYPE_MONSTER); + isAssignableFrom = e->instanceof(eTYPE_MONSTER); else if (ec == typeid(Zombie)) - isAssignableFrom = e->instanceof (eTYPE_ZOMBIE); + isAssignableFrom = e->instanceof(eTYPE_ZOMBIE); else if (Entity* entity = e.get(); entity != nullptr && ec == typeid(*entity)) isAssignableFrom = true; diff --git a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp index ffc746a48..adbce1b5e 100644 --- a/targets/minecraft/world/level/chunk/SparseDataStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseDataStorage.cpp @@ -90,7 +90,9 @@ SparseDataStorage::~SparseDataStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { free(indicesAndData); } + { + free(indicesAndData); + } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -472,7 +474,9 @@ void SparseDataStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { free(toFree); } + { + free(toFree); + } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp index 6c521253d..8d32f546a 100644 --- a/targets/minecraft/world/level/chunk/SparseLightStorage.cpp +++ b/targets/minecraft/world/level/chunk/SparseLightStorage.cpp @@ -91,7 +91,9 @@ SparseLightStorage::~SparseLightStorage() { // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { free(indicesAndData); } + { + free(indicesAndData); + } // printf("Free (in dtor) 0x%x\n", indicesAndData); } @@ -476,7 +478,9 @@ void SparseLightStorage::tick() { // if( toFree ) printf("Deleting 0x%x\n", toFree); // Determine correct means to free this data - could have been allocated // either with XPhysicalAlloc or malloc - { free(toFree); } + { + free(toFree); + } } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; diff --git a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 14b988009..2235e889f 100644 --- a/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -29,8 +29,8 @@ #include "minecraft/world/level/storage/LevelData.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" -#include "platform/thread/C4JThread.h" #include "platform/input/input.h" +#include "platform/thread/C4JThread.h" class DataInput; diff --git a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 4bd51bb3a..560216ac6 100644 --- a/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/targets/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -97,7 +97,7 @@ void to_base36(int value, char* buf) { File OldChunkStorage::getFile(int x, int z) { constexpr int MAX_PATH_SIZE = 256; - + char name[MAX_PATH_SIZE]; char path1[MAX_PATH_SIZE]; char path2[MAX_PATH_SIZE]; diff --git a/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp index a70a8e6f2..33920b03c 100644 --- a/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp +++ b/targets/minecraft/world/level/levelgen/ConsoleSchematicFile.cpp @@ -215,8 +215,8 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, int zEnd = std::min(destinationBox->z1, (double)(zStart & ~15) + 16); #ifdef _DEBUG - Log::info("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, - zStart, xEnd - 1, yEnd - 1, zEnd - 1); + Log::info("Range is (%d,%d,%d) to (%d,%d,%d)\n", xStart, yStart, zStart, + xEnd - 1, yEnd - 1, zEnd - 1); #endif int rowBlocksIncluded = (yEnd - yStart) * (zEnd - zStart); @@ -290,8 +290,7 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, dataP += (rowBlockCount - rowBlocksIncluded) / 2; } } else { - Log::info( - "ERROR: Rotation of block and data not implemented!!\n"); + Log::info("ERROR: Rotation of block and data not implemented!!\n"); } // 4J Stu - Hack for ME pack to replace sand with end stone in schematics @@ -555,8 +554,8 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, e->absMoveTo(targetX, targetY, targetZ, e->yRot, e->xRot); } #ifdef _DEBUG - Log::info("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), - e->x, e->y, e->z); + Log::info("Adding entity type %d at (%f,%f,%f)\n", e->GetType(), e->x, + e->y, e->z); #endif e->setLevel(chunk->level); e->resetSmallId(); @@ -749,9 +748,9 @@ void ConsoleSchematicFile::generateSchematicFile( bool mobCanBeSaved = false; if (bSaveMobs) { - if (e->instanceof (eTYPE_MONSTER) || e->instanceof - (eTYPE_WATERANIMAL) || e->instanceof - (eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) + if (e->instanceof(eTYPE_MONSTER) || + e->instanceof(eTYPE_WATERANIMAL) || + e->instanceof(eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER)) // 4J-JEV: All these are derived from eTYPE_ANIMAL and true // implicitly. @@ -765,9 +764,8 @@ void ConsoleSchematicFile::generateSchematicFile( // 4J-JEV: Changed to check for instances of minecarts and // hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and // eTYPE_MINECART - if (mobCanBeSaved || e->instanceof - (eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof - (eTYPE_HANGING_ENTITY)) { + if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || + e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY)) { CompoundTag* eTag = new CompoundTag(); if (e->save(eTag)) { ListTag* pos = @@ -777,7 +775,7 @@ void ConsoleSchematicFile::generateSchematicFile( pos->get(1)->data -= yStart; pos->get(2)->data -= zStart; - if (e->instanceof (eTYPE_HANGING_ENTITY)) { + if (e->instanceof(eTYPE_HANGING_ENTITY)) { ((IntTag*)eTag->get("TileX"))->data -= xStart; ((IntTag*)eTag->get("TileY"))->data -= yStart; ((IntTag*)eTag->get("TileZ"))->data -= zStart; diff --git a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp index dc881bc4c..b0f4e6237 100644 --- a/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/targets/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -4,17 +4,16 @@ #include #include +#include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" -#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" -#include "minecraft/world/level/biome/Biome.h" -#include "minecraft/world/level/chunk/ChunkSource.h" -#include "platform/fs/fs.h" -#include "java/Random.h" #include "minecraft/world/entity/MobCategory.h" +#include "minecraft/world/level/GameRules/LevelGenerationOptions.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/MobSpawner.h" +#include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/biome/BiomeSource.h" +#include "minecraft/world/level/chunk/ChunkSource.h" #include "minecraft/world/level/chunk/LevelChunk.h" #include "minecraft/world/level/levelgen/CanyonFeature.h" #include "minecraft/world/level/levelgen/LargeCaveFeature.h" @@ -28,6 +27,7 @@ #include "minecraft/world/level/storage/LevelData.h" #include "minecraft/world/level/tile/HeavyTile.h" #include "minecraft/world/level/tile/Tile.h" +#include "platform/fs/fs.h" const double CustomLevelSource::SNOW_SCALE = 0.3; const double CustomLevelSource::SNOW_CUTOFF = 0.5; diff --git a/targets/minecraft/world/level/levelgen/feature/Feature.h b/targets/minecraft/world/level/levelgen/feature/Feature.h index 298b13852..bae9a41ce 100644 --- a/targets/minecraft/world/level/levelgen/feature/Feature.h +++ b/targets/minecraft/world/level/levelgen/feature/Feature.h @@ -10,7 +10,7 @@ private: public: Feature(); Feature(bool doUpdate); - virtual ~Feature(){}; + virtual ~Feature() {}; virtual bool place(Level* level, Random* random, int x, int y, int z) = 0; virtual bool placeWithIndex(Level* level, Random* random, int x, int y, diff --git a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp index c1788941f..814cac593 100644 --- a/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp +++ b/targets/minecraft/world/level/newbiome/layer/BiomeOverrideLayer.cpp @@ -4,9 +4,9 @@ #include "minecraft/IGameServices.h" #include "minecraft/util/Log.h" +#include "minecraft/world/level/biome/Biome.h" #include "minecraft/world/level/newbiome/layer/Layer.h" #include "platform/fs/fs.h" -#include "minecraft/world/level/biome/Biome.h" BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { m_biomeOverride = std::vector(width * height); diff --git a/targets/minecraft/world/level/pathfinder/Path.cpp b/targets/minecraft/world/level/pathfinder/Path.cpp index b8b67529e..f3bfe3e86 100644 --- a/targets/minecraft/world/level/pathfinder/Path.cpp +++ b/targets/minecraft/world/level/pathfinder/Path.cpp @@ -47,8 +47,7 @@ bool Path::sameAs(Path* path) { if (path == nullptr) return false; if (path->nodes.size() != nodes.size()) return false; for (size_t i = 0; i < nodes.size(); ++i) - if (nodes[i].x != path->nodes[i].x || - nodes[i].y != path->nodes[i].y || + if (nodes[i].x != path->nodes[i].x || nodes[i].y != path->nodes[i].y || nodes[i].z != path->nodes[i].z) return false; return true; diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h index 1565a00c4..b58a8dd20 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFile.h @@ -10,7 +10,7 @@ enum class SaveFileSeekOrigin { Begin, Current, End }; class ConsoleSaveFile { public: - virtual ~ConsoleSaveFile(){}; + virtual ~ConsoleSaveFile() {}; virtual FileEntry* createFile(const ConsoleSavePath& fileName) = 0; virtual void deleteFile(FileEntry* file) = 0; diff --git a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp index 05dcb4829..c07809683 100644 --- a/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp +++ b/targets/minecraft/world/level/tile/BasePressurePlateTile.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Facing.h" #include "minecraft/SharedConstants.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/ButtonTile.cpp b/targets/minecraft/world/level/tile/ButtonTile.cpp index 03ac07cd1..a12482146 100644 --- a/targets/minecraft/world/level/tile/ButtonTile.cpp +++ b/targets/minecraft/world/level/tile/ButtonTile.cpp @@ -4,8 +4,8 @@ #include #include -#include "minecraft/Facing.h" #include "app/common/Audio/SoundTypes.h" +#include "minecraft/Facing.h" #include "minecraft/world/entity/projectile/Arrow.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/CauldronTile.cpp b/targets/minecraft/world/level/tile/CauldronTile.cpp index b0285c05f..923512936 100644 --- a/targets/minecraft/world/level/tile/CauldronTile.cpp +++ b/targets/minecraft/world/level/tile/CauldronTile.cpp @@ -122,7 +122,7 @@ bool CauldronTile::use(Level* level, int x, int y, int z, } // 4J Stu - Brought forward change to update inventory when filling // bottles with water - else if (player->instanceof (eTYPE_SERVERPLAYER)) { + else if (player->instanceof(eTYPE_SERVERPLAYER)) { std::dynamic_pointer_cast(player) ->refreshContainer(player->inventoryMenu); } diff --git a/targets/minecraft/world/level/tile/ComparatorTile.cpp b/targets/minecraft/world/level/tile/ComparatorTile.cpp index db1ca0d29..0d8ae7f3d 100644 --- a/targets/minecraft/world/level/tile/ComparatorTile.cpp +++ b/targets/minecraft/world/level/tile/ComparatorTile.cpp @@ -2,9 +2,9 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/item/Item.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/FarmTile.cpp b/targets/minecraft/world/level/tile/FarmTile.cpp index 1e8801522..5aefb4056 100644 --- a/targets/minecraft/world/level/tile/FarmTile.cpp +++ b/targets/minecraft/world/level/tile/FarmTile.cpp @@ -69,7 +69,7 @@ void FarmTile::fallOn(Level* level, int x, int y, int z, // the client based on random values! if (!level->isClientSide && level->random->nextFloat() < (fallDistance - .5f)) { - if (entity->instanceof (eTYPE_PLAYER)) { + if (entity->instanceof(eTYPE_PLAYER)) { std::shared_ptr player = std::dynamic_pointer_cast(entity); if (!player->isAllowedToMine()) { diff --git a/targets/minecraft/world/level/tile/FireTile.cpp b/targets/minecraft/world/level/tile/FireTile.cpp index 2f8baddd6..7e5b387d3 100644 --- a/targets/minecraft/world/level/tile/FireTile.cpp +++ b/targets/minecraft/world/level/tile/FireTile.cpp @@ -4,13 +4,13 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" #include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/server/MinecraftServer.h" #include "minecraft/server/PlayerList.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/GameRules.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/LeverTile.cpp b/targets/minecraft/world/level/tile/LeverTile.cpp index 22c4d5b07..0d5dd81fa 100644 --- a/targets/minecraft/world/level/tile/LeverTile.cpp +++ b/targets/minecraft/world/level/tile/LeverTile.cpp @@ -2,8 +2,8 @@ #include -#include "minecraft/Facing.h" #include "app/common/Audio/SoundTypes.h" +#include "minecraft/Facing.h" #include "minecraft/util/Mth.h" #include "minecraft/world/entity/LivingEntity.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/LiquidTile.cpp b/targets/minecraft/world/level/tile/LiquidTile.cpp index 1c5907f6c..b356250df 100644 --- a/targets/minecraft/world/level/tile/LiquidTile.cpp +++ b/targets/minecraft/world/level/tile/LiquidTile.cpp @@ -6,11 +6,11 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/JavaMath.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/NotGateTile.cpp b/targets/minecraft/world/level/tile/NotGateTile.cpp index db819d4d5..e063bed09 100644 --- a/targets/minecraft/world/level/tile/NotGateTile.cpp +++ b/targets/minecraft/world/level/tile/NotGateTile.cpp @@ -1,8 +1,8 @@ #include "NotGateTile.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" diff --git a/targets/minecraft/world/level/tile/NoteBlockTile.cpp b/targets/minecraft/world/level/tile/NoteBlockTile.cpp index fffbd8816..a3bc08cc3 100644 --- a/targets/minecraft/world/level/tile/NoteBlockTile.cpp +++ b/targets/minecraft/world/level/tile/NoteBlockTile.cpp @@ -3,8 +3,8 @@ #include #include -#include "minecraft/core/particles/ParticleTypes.h" #include "app/common/Audio/SoundTypes.h" +#include "minecraft/core/particles/ParticleTypes.h" #include "minecraft/util/Log.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/PortalTile.cpp b/targets/minecraft/world/level/tile/PortalTile.cpp index 9e0812784..011bcb432 100644 --- a/targets/minecraft/world/level/tile/PortalTile.cpp +++ b/targets/minecraft/world/level/tile/PortalTile.cpp @@ -3,10 +3,10 @@ #include #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/core/particles/ParticleTypes.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/item/SpawnEggItem.h" #include "minecraft/world/level/Level.h" diff --git a/targets/minecraft/world/level/tile/Tile.cpp b/targets/minecraft/world/level/tile/Tile.cpp index 81f514233..195a3f3cb 100644 --- a/targets/minecraft/world/level/tile/Tile.cpp +++ b/targets/minecraft/world/level/tile/Tile.cpp @@ -5,9 +5,9 @@ #include #include "Facing.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/stats/GenericStats.h" #include "minecraft/stats/Stats.h" #include "minecraft/util/Log.h" diff --git a/targets/minecraft/world/level/tile/TntTile.cpp b/targets/minecraft/world/level/tile/TntTile.cpp index 148656845..641839c59 100644 --- a/targets/minecraft/world/level/tile/TntTile.cpp +++ b/targets/minecraft/world/level/tile/TntTile.cpp @@ -2,12 +2,12 @@ #include +#include "app/common/Audio/SoundTypes.h" #include "java/Class.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/GameEnums.h" #include "minecraft/IGameServices.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/Entity.h" #include "minecraft/world/entity/LivingEntity.h" @@ -116,8 +116,8 @@ void TntTile::entityInside(Level* level, int x, int y, int z, if (entity->isOnFire()) { std::shared_ptr arrow = std::dynamic_pointer_cast(entity); - destroy(level, x, y, z, EXPLODE_BIT, arrow->owner->instanceof - (eTYPE_LIVINGENTITY) + destroy(level, x, y, z, EXPLODE_BIT, + arrow->owner->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(arrow->owner) : nullptr); level->removeTile(x, y, z); diff --git a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp index b7fb1f9f5..2ca2b02a9 100644 --- a/targets/minecraft/world/level/tile/TripWireSourceTile.cpp +++ b/targets/minecraft/world/level/tile/TripWireSourceTile.cpp @@ -1,9 +1,9 @@ #include "TripWireSourceTile.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Direction.h" #include "minecraft/Facing.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/LevelSource.h" #include "minecraft/world/level/material/Material.h" diff --git a/targets/minecraft/world/level/tile/WaterLilyTile.cpp b/targets/minecraft/world/level/tile/WaterLilyTile.cpp index e096ba19f..94a56f6a2 100644 --- a/targets/minecraft/world/level/tile/WaterLilyTile.cpp +++ b/targets/minecraft/world/level/tile/WaterLilyTile.cpp @@ -30,7 +30,7 @@ int WaterlilyTile::getRenderShape() { return Tile::SHAPE_LILYPAD; } void WaterlilyTile::addAABBs(Level* level, int x, int y, int z, AABB* box, std::vector* boxes, std::shared_ptr source) { - if (source == nullptr || !source->instanceof (eTYPE_BOAT)) { + if (source == nullptr || !source->instanceof(eTYPE_BOAT)) { Bush::addAABBs(level, x, y, z, box, boxes, source); } } diff --git a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp index 9993aecdd..02b57d53f 100644 --- a/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/ChestTileEntity.cpp @@ -7,10 +7,10 @@ #include "Direction.h" #include "SharedConstants.h" #include "TileEntity.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/IGameServices.h" #include "minecraft/network/packet/ContainerOpenPacket.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/world/CompoundContainer.h" #include "minecraft/world/Container.h" #include "minecraft/world/entity/player/Player.h" diff --git a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp index b8b6a9703..08172d448 100644 --- a/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/EnderChestTileEntity.cpp @@ -1,7 +1,7 @@ #include "EnderChestTileEntity.h" -#include "java/Random.h" #include "app/common/Audio/SoundTypes.h" +#include "java/Random.h" #include "minecraft/world/entity/player/Player.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/ChestTile.h" diff --git a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp index 5b34815b5..3228d298f 100644 --- a/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp +++ b/targets/minecraft/world/level/tile/entity/TheEndPortalTile.cpp @@ -64,7 +64,7 @@ void TheEndPortal::entityInside(Level* level, int x, int y, int z, if (entity->riding == nullptr && entity->rider.lock() == nullptr) { if (!level->isClientSide) { - if (entity->instanceof (eTYPE_PLAYER)) { + if (entity->instanceof(eTYPE_PLAYER)) { // 4J Stu - Update the level data position so that the // stronghold portal can be shown on the maps int x, z; diff --git a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp index 1280d81bd..4a8212e2d 100644 --- a/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp +++ b/targets/minecraft/world/level/tile/piston/PistonBaseTile.cpp @@ -3,11 +3,11 @@ #include #include "PistonExtensionTile.h" +#include "app/common/Audio/SoundTypes.h" #include "java/Random.h" #include "minecraft/Facing.h" #include "minecraft/client/Minecraft.h" #include "minecraft/client/multiplayer/MultiPlayerLevel.h" -#include "app/common/Audio/SoundTypes.h" #include "minecraft/util/Mth.h" #include "minecraft/world/IconRegister.h" #include "minecraft/world/entity/LivingEntity.h" diff --git a/targets/platform/network/IPlatformNetwork.h b/targets/platform/network/IPlatformNetwork.h index 345b8b335..9c240d0ad 100644 --- a/targets/platform/network/IPlatformNetwork.h +++ b/targets/platform/network/IPlatformNetwork.h @@ -5,8 +5,8 @@ #include #include -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" #ifndef VER_NETWORK #define VER_NETWORK 560 diff --git a/targets/platform/network/network.h b/targets/platform/network/network.h index 9cd2be5a0..e953b9093 100644 --- a/targets/platform/network/network.h +++ b/targets/platform/network/network.h @@ -1,7 +1,7 @@ #pragma once -#include "IPlatformNetwork.h" #include "INetworkPlayer.h" +#include "IPlatformNetwork.h" #include "SessionInfo.h" // Function accessor backed by a function-local static (Meyers singleton). diff --git a/targets/platform/network/stub/StubNetworkPlayer.cpp b/targets/platform/network/stub/StubNetworkPlayer.cpp index e1a54a621..295c32d6f 100644 --- a/targets/platform/network/stub/StubNetworkPlayer.cpp +++ b/targets/platform/network/stub/StubNetworkPlayer.cpp @@ -2,8 +2,8 @@ #include "StubPlatformNetwork.h" #include "java/System.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" StubNetworkPlayer::StubNetworkPlayer() { m_pSocket = nullptr; } diff --git a/targets/platform/network/stub/StubNetworkPlayer.h b/targets/platform/network/stub/StubNetworkPlayer.h index 9a26dbf9b..90dced43e 100644 --- a/targets/platform/network/stub/StubNetworkPlayer.h +++ b/targets/platform/network/stub/StubNetworkPlayer.h @@ -4,8 +4,8 @@ #include -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" +#include "platform/network/NetTypes.h" #include "platform/network/network.h" class Socket; diff --git a/targets/platform/network/stub/StubPlatformNetwork.cpp b/targets/platform/network/stub/StubPlatformNetwork.cpp index f7870f4d6..1a0909ef9 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.cpp +++ b/targets/platform/network/stub/StubPlatformNetwork.cpp @@ -8,9 +8,9 @@ #include "StubNetworkPlayer.h" #include "app/common/Network/GameNetworkManager.h" #include "minecraft/network/Socket.h" -#include "platform/thread/C4JThread.h" #include "platform/network/NetTypes.h" #include "platform/network/network.h" +#include "platform/thread/C4JThread.h" namespace platform_internal { IPlatformNetwork& PlatformNetwork_get() { diff --git a/targets/platform/network/stub/StubPlatformNetwork.h b/targets/platform/network/stub/StubPlatformNetwork.h index 142000bf0..9826eda2e 100644 --- a/targets/platform/network/stub/StubPlatformNetwork.h +++ b/targets/platform/network/stub/StubPlatformNetwork.h @@ -6,10 +6,10 @@ #include "StubNetworkPlayer.h" #include "minecraft/client/model/SkinBox.h" -#include "platform/network/NetTypes.h" #include "platform/PlatformTypes.h" #include "platform/XboxStubs.h" #include "platform/network/IPlatformNetwork.h" +#include "platform/network/NetTypes.h" #include "platform/network/network.h" class CGameNetworkManager; diff --git a/targets/platform/thread/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp index 51bf0a84d..b469ee17d 100644 --- a/targets/platform/thread/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -488,7 +488,8 @@ std::uint32_t C4JThread::EventArray::waitForAny(int timeoutMs) { const std::uint32_t cur = m_signaledMask.load(std::memory_order_acquire); const std::uint32_t readyIndex = firstSetBitIndex(cur & bitMask); if (m_mode == Mode::AutoClear) { - m_signaledMask.fetch_and(~(1U << readyIndex), std::memory_order_release); + m_signaledMask.fetch_and(~(1U << readyIndex), + std::memory_order_release); } return WaitResult::Signaled + readyIndex; } diff --git a/targets/platform/thread/C4JThread.h b/targets/platform/thread/C4JThread.h index ee6d3ded8..52eb157ed 100644 --- a/targets/platform/thread/C4JThread.h +++ b/targets/platform/thread/C4JThread.h @@ -51,7 +51,8 @@ public: bool m_signaled; }; - // Lock-free bitmask of up to 32 events; waiters block via std::atomic::wait. + // Lock-free bitmask of up to 32 events; waiters block via + // std::atomic::wait. class EventArray { public: enum class Mode { AutoClear, ManualClear }; From abeead819e9b57462d2349dc1f82759a783ab67c Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 02:49:30 -0500 Subject: [PATCH 081/104] rework build system dependencies --- meson.build | 114 +++++++++-------- ...ets_to_client.py => copy_assets_to_app.py} | 0 scripts/llvm_native.txt | 4 - subprojects/packagefiles/stb/meson.build | 6 +- targets/app/common/DLCController.cpp | 2 +- targets/app/common/UI/ConsoleUIController.cpp | 2 +- targets/app/meson.build | 120 ++++++++---------- targets/minecraft/client/BufferedImage.cpp | 2 +- .../minecraft/client/player/LocalPlayer.cpp | 2 +- targets/minecraft/meson.build | 63 ++++----- .../minecraft/world/entity/player/Player.cpp | 4 +- .../level/tile/entity/SignTileEntity.cpp | 2 +- targets/platform/fs/meson.build | 10 +- targets/platform/game/meson.build | 10 +- targets/platform/input/IPlatformInput.h | 3 +- targets/platform/input/input.h | 1 + targets/platform/input/meson.build | 11 +- targets/platform/input/sdl2/SDL2Input.cpp | 20 +-- targets/platform/input/sdl2/SDL2Input.h | 2 - targets/platform/leaderboard/meson.build | 10 +- targets/platform/meson.build | 78 +----------- targets/platform/network/meson.build | 11 +- targets/platform/profile/IPlatformProfile.h | 2 +- targets/platform/profile/meson.build | 12 +- targets/platform/profile/stub/StubProfile.cpp | 2 +- targets/platform/profile/stub/StubProfile.h | 2 +- targets/platform/renderer/IPlatformRenderer.h | 2 +- targets/platform/renderer/gl/GLRenderer.cpp | 12 +- targets/platform/renderer/gl/GLRenderer.h | 3 +- targets/platform/renderer/gl/gl_compat.h | 4 +- targets/platform/renderer/meson.build | 28 +++- targets/platform/sound/meson.build | 11 +- targets/platform/storage/IPlatformStorage.h | 2 +- targets/platform/storage/meson.build | 10 +- targets/platform/storage/stub/StubStorage.h | 2 +- targets/platform/stubs.h | 2 +- targets/platform/thread/meson.build | 11 +- targets/util/meson.build | 2 +- 38 files changed, 298 insertions(+), 286 deletions(-) rename scripts/{copy_assets_to_client.py => copy_assets_to_app.py} (100%) diff --git a/meson.build b/meson.build index 5fd5574fd..14daf954d 100644 --- a/meson.build +++ b/meson.build @@ -1,17 +1,20 @@ +# MARK: build configuration + project( - '4jcraft', - ['cpp', 'c'], - version: '0.1.0', - meson_version: '>= 1.3', - default_options: [ - 'cpp_std=c++23', - 'warning_level=0', - 'unity=on', # merge source files per target - 'unity_size=8', # TODO: mess around with this - 'b_pch=true', # precompiled headers - 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) - 'b_ndebug=if-release', # drop assert() in --buildtype=release - ], + '4jcraft', + ['cpp', 'c'], + version: '0.1.0', + meson_version: '>= 1.3', + default_options: [ + 'cpp_std=c++23', + 'warning_level=0', + 'unity=on', # merge source files per target + 'unity_size=8', # TODO: mess around with this + 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE + 'b_pch=true', # precompiled headers + 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) + 'b_ndebug=if-release', # drop assert() in --buildtype=release + ], ) pymod = import('python') @@ -19,36 +22,30 @@ python = pymod.find_installation('python3', required: true) cc = meson.get_compiler('cpp') +global_cpp_args = ['-Wshift-count-overflow', '-pipe'] global_cpp_defs = [ - '-DSPLIT_SAVES', - '-D_LARGE_WORLDS', - '-D_EXTENDED_ACHIEVEMENTS', - '-D_FORTIFY_SOURCE=2', - '-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h) + '-DSPLIT_SAVES', + '-D_LARGE_WORLDS', + '-D_EXTENDED_ACHIEVEMENTS', + '-D_FORTIFY_SOURCE=2', + '-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h) ] # Debug-only defines: keep for debug + debugoptimized so iteration is unchanged. # --buildtype=release strips them so shipping builds don't carry debug logging, # debug menu UI, or assert-driven sanity checks. if get_option('buildtype') in ['debug', 'debugoptimized'] - global_cpp_defs += [ - '-D_DEBUG', - '-DDEBUG', - '-D_DEBUG_MENUS_ENABLED', - ] + global_cpp_defs += [ + '-D_DEBUG', + '-DDEBUG', + '-D_DEBUG_MENUS_ENABLED', + ] endif -if get_option('renderer') == 'gles' - global_cpp_defs += ['-DGLES'] - gl_dep = dependency('glesv2', required: true) - glu_dep = dependency('', required: false) -else - gl_dep = dependency('gl', required: true) - glu_dep = dependency('glu', required: true) -endif +# MARK: meson options if get_option('enable_vsync') - global_cpp_defs += ['-DENABLE_VSYNC'] + global_cpp_defs += ['-DENABLE_VSYNC'] endif if get_option('classic_panorama') @@ -56,45 +53,52 @@ if get_option('classic_panorama') endif if get_option('enable_frame_profiler') - global_cpp_defs += ['-DENABLE_FRAME_PROFILER'] + global_cpp_defs += ['-DENABLE_FRAME_PROFILER'] endif if get_option('ui_backend') == 'shiggy' - global_cpp_defs += ['-D_ENABLEIGGY'] + global_cpp_defs += ['-D_ENABLEIGGY'] endif if get_option('ui_backend') == 'java' - global_cpp_defs += '-DENABLE_JAVA_GUIS' + global_cpp_defs += '-DENABLE_JAVA_GUIS' +endif + +if get_option('occlusion_culling') == 'off' + global_cpp_defs += ['-DOCCLUSION_MODE_NONE'] +elif get_option('occlusion_culling') == 'frustum' + global_cpp_defs += ['-DOCCLUSION_MODE_FRUSTUM'] +elif get_option('occlusion_culling') == 'bfs' + global_cpp_defs += ['-DOCCLUSION_MODE_BFS', '-DUSE_OCCLUSION_CULLING'] +elif get_option('occlusion_culling') == 'hardware' + global_cpp_defs += ['-DOCCLUSION_MODE_HARDWARE', '-DUSE_OCCLUSION_CULLING'] endif add_project_arguments(global_cpp_defs, language: ['cpp', 'c']) - -global_cpp_args = [ - '-Wshift-count-overflow', - '-pipe', -] add_project_arguments(global_cpp_args, language: 'cpp') -sdl2_dep = dependency('sdl2') -thread_dep = dependency('threads') -dl_dep = cc.find_library('dl', required: true) -glm_dep = dependency('glm') - -stb = subproject('stb').get_variable('stb_inc') -stb_dep = declare_dependency(include_directories: stb) -simdutf_dep = dependency('simdutf', - fallback: ['simdutf', 'simdutf_dep'], - default_options: ['utf8=true', 'utf16=true', 'utf32=true'] -) -miniaudio_dep = dependency('miniaudio') - -mimalloc_dep = cc.find_library('mimalloc', required: get_option('enable_mimalloc')) - subdir('targets/util') subdir('targets/java') subdir('targets/nbt') subdir('targets/platform') +# MARK: platform configuration + +if host_machine.system() == 'linux' + platform_fs_dep = platform_fs_std_dep + platform_game_dep = platform_game_stub_dep + platform_input_dep = platform_input_sdl2_dep + platform_leaderboard_dep = platform_leaderboard_stub_dep + platform_network_dep = platform_network_stub_dep + platform_profile_dep = platform_profile_stub_dep + platform_renderer_dep = platform_renderer_gl_dep + platform_sound_dep = platform_sound_miniaudio_dep + platform_storage_dep = platform_storage_stub_dep + platform_thread_dep = platform_thread_dep # standardized backend (for now) + + app_platform_sources = files('targets/app/linux/main.cpp') +endif + subdir('targets/resources') subdir('targets/minecraft') subdir('targets/app') diff --git a/scripts/copy_assets_to_client.py b/scripts/copy_assets_to_app.py similarity index 100% rename from scripts/copy_assets_to_client.py rename to scripts/copy_assets_to_app.py diff --git a/scripts/llvm_native.txt b/scripts/llvm_native.txt index 256f052ad..17d5b1824 100644 --- a/scripts/llvm_native.txt +++ b/scripts/llvm_native.txt @@ -3,7 +3,3 @@ c = 'clang' cpp = 'clang++' c_ld = 'lld' cpp_ld = 'lld' - -[built-in options] -cpp_args = ['-stdlib=libc++'] -cpp_link_args = ['-stdlib=libc++'] diff --git a/subprojects/packagefiles/stb/meson.build b/subprojects/packagefiles/stb/meson.build index aad077a49..a1e039357 100644 --- a/subprojects/packagefiles/stb/meson.build +++ b/subprojects/packagefiles/stb/meson.build @@ -1,3 +1,7 @@ project('stb', 'c') -stb_inc = include_directories('.') \ No newline at end of file +stb_dep = declare_dependency( + include_directories: include_directories('.'), +) + +meson.override_dependency('stb', stb_dep) \ No newline at end of file diff --git a/targets/app/common/DLCController.cpp b/targets/app/common/DLCController.cpp index 6e61d5c5e..cb8bbe61f 100644 --- a/targets/app/common/DLCController.cpp +++ b/targets/app/common/DLCController.cpp @@ -240,7 +240,7 @@ int32_t DLCController::registerDLCData(char* pType, char* pBannerName, pDLCData->uiSortIndex = uiSortIndex; pDLCData->iConfig = iConfig; - if (strcmp(!pBannerName, "") != 0) { + if (strcmp(pBannerName, "") != 0) { strncpy(pDLCData->wchBanner, pBannerName, MAX_BANNERNAME_SIZE); } if (pDataFile[0] != 0) { diff --git a/targets/app/common/UI/ConsoleUIController.cpp b/targets/app/common/UI/ConsoleUIController.cpp index 8614b6e68..dd7ab903f 100644 --- a/targets/app/common/UI/ConsoleUIController.cpp +++ b/targets/app/common/UI/ConsoleUIController.cpp @@ -7,7 +7,7 @@ #include "app/common/Iggy/include/iggy.h" #include "app/common/UI/All Platforms/UIStructs.h" #include "platform/renderer/renderer.h" -#include "renderer/gl/gl_compat.h" +#include "platform/stubs.h" #ifndef _ENABLEIGGY #include "app/common/Iggy/iggy_stubs.h" #endif diff --git a/targets/app/meson.build b/targets/app/meson.build index 920f4c386..8a55d979a 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -2,83 +2,73 @@ # regenerated by scripts/list_sources.py whenever files are added or # removed. fs = import('fs') -platform_sources = files(fs.read('common_sources.txt').strip().split('\n')) -if host_machine.system() == 'linux' - platform_sources += files('linux/main.cpp') -endif - -client_dependencies = [] +app_common_sources = files(fs.read('common_sources.txt').strip().split('\n')) +app_dependencies = [] +app_link_args = [] # mimalloc must come first so the linker resolves malloc/free symbols to it # before glibc. --no-as-needed prevents the linker from dropping it as # "unreferenced" (the override happens via weak symbols, not direct calls). -client_link_args = [] +mimalloc_dep = dependency('mimalloc', required: get_option('enable_mimalloc')) if mimalloc_dep.found() - client_dependencies += mimalloc_dep - client_link_args += ['-Wl,--no-as-needed'] + app_dependencies += mimalloc_dep endif -client_dependencies += [ - java_dep, - nbt_dep, - render_dep, - input_dep, - profile_dep, - storage_dep, - fs_dep, - sound_dep, - assets_localisation_dep, - platform_dep, - minecraft_dep, - gl_dep, - glu_dep, - thread_dep, - dl_dep, - dependency('zlib'), - miniaudio_dep, - stb_dep, - simdutf_dep, - util_dep, -] - if get_option('ui_backend') == 'shiggy' - shiggy_dep = dependency( - 'shiggy', - fallback: ['shiggy', 'shiggy_dep'], - ) - client_dependencies += shiggy_dep + app_dependencies += dependency( + 'shiggy', + fallback: ['shiggy', 'shiggy_dep'], + ) endif -client = executable( - 'Minecraft.Client', - platform_sources + localisation[1], - include_directories: include_directories('..'), - dependencies: client_dependencies, - cpp_args: global_cpp_args - + global_cpp_defs - + [ - '-DUNICODE', - '-D_UNICODE', - ], - c_args: global_cpp_defs + ['-DUNICODE', '-D_UNICODE'], - link_args: client_link_args, - install: true, - install_dir: '', +app_dependencies += [ + dependency('dl'), # blame iggy gdraw, nuke this later + dependency('sdl2'), # blame iggy gdraw, nuke this later + dependency('miniaudio'), # todo: remove once PlatformSound is used + dependency('stb'), + dependency('simdutf'), + java_dep, + nbt_dep, + util_dep, + minecraft_dep, + assets_localisation_dep, + platform_fs_dep, + platform_game_dep, + platform_input_dep, + platform_leaderboard_dep, + platform_network_dep, + platform_profile_dep, + platform_renderer_dep, + platform_sound_dep, + platform_storage_dep, + platform_thread_dep, + # technically also GL/EGL, but the GL renderer needs to not leak GL shit to fix that +] + +app = executable( + 'Minecraft.Client', + app_common_sources + app_platform_sources + localisation[1], + include_directories: include_directories('..'), + dependencies: app_dependencies, + cpp_args: global_cpp_args + global_cpp_defs, + link_args: app_link_args, + install: true, + install_dir: '', ) custom_target( - 'copy_assets_to_client', - input: [client, media_archive], - output: 'assets.stamp', - command: [ - python, - meson.project_source_root() / 'scripts/copy_assets_to_client.py', - meson.project_source_root(), - meson.project_build_root(), - meson.current_build_dir(), - '@INPUT1@', - '@OUTPUT@', - ], - build_by_default: true, + 'copy_assets_to_app', + input: [app, media_archive], + output: 'assets.stamp', + command: [ + python, + meson.project_source_root() / 'scripts/copy_assets_to_app.py', + meson.project_source_root(), + meson.project_build_root(), + meson.current_build_dir(), + '@INPUT1@', + '@OUTPUT@', + ], + build_by_default: true, ) diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 59048b4ef..4d71aad6c 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,7 +6,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #include "minecraft/IGameServices.h" #include "platform/fs/fs.h" #include "platform/renderer/renderer.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 17be12f19..4e8c4c701 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -28,7 +28,7 @@ #include "minecraft/world/item/Item.h" #include "minecraft/world/level/tile/Tile.h" // 4J Stu - Added for tutorial callbacks -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #include "Pos.h" #include "app/common/Audio/ConsoleSoundEngine.h" #include "app/common/Audio/SoundTypes.h" diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index dfa8b95b6..1fceddba1 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -2,49 +2,32 @@ # scripts/list_sources.py whenever files are added or removed. Reading # the committed file means meson reconfigures only when the list itself # changes, which is what we want. + fs = import('fs') minecraft_sources = files(fs.read('sources.txt').strip().split('\n')) -occlusion_mode = get_option('occlusion_culling') -if occlusion_mode == 'off' - global_cpp_defs += ['-DOCCLUSION_MODE_NONE'] -elif occlusion_mode == 'frustum' - global_cpp_defs += ['-DOCCLUSION_MODE_FRUSTUM'] -elif occlusion_mode == 'bfs' - global_cpp_defs += ['-DOCCLUSION_MODE_BFS', '-DUSE_OCCLUSION_CULLING'] -elif occlusion_mode == 'hardware' - global_cpp_defs += ['-DOCCLUSION_MODE_HARDWARE', '-DUSE_OCCLUSION_CULLING'] -endif - -if get_option('ui_backend') == 'java' - global_cpp_defs += '-DENABLE_JAVA_GUIS' -endif - -lib_minecraft = static_library('minecraft', - minecraft_sources, - dependencies : [ - sound_dep, - render_dep, - input_dep, - profile_dep, - storage_dep, - fs_dep, - glm_dep, - nbt_dep, - java_dep, - assets_localisation_dep, - platform_dep, - util_dep, - dependency('zlib'), - ], - include_directories : include_directories('..'), - cpp_args : global_cpp_args + global_cpp_defs, -) - -zlib_dep = dependency('zlib') crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux -minecraft_dep = declare_dependency( - link_with : lib_minecraft, - dependencies : [crypto_dep, zlib_dep], +lib_minecraft = static_library('minecraft', + minecraft_sources, + dependencies : [ + dependency('libcrypto'), # for MD5 in Hasher.cpp on Linux + dependency('zlib'), + dependency('glm'), + nbt_dep, + java_dep, + util_dep, + assets_localisation_dep, + platform_sound_dep, + platform_renderer_dep, + platform_input_dep, + platform_profile_dep, + platform_storage_dep, + platform_fs_dep, + platform_thread_dep, + ], + include_directories : include_directories('..'), + cpp_args : global_cpp_args + global_cpp_defs, ) + +minecraft_dep = declare_dependency(link_with : lib_minecraft) diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index fcde9eba2..2c04410a1 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -1522,8 +1522,8 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, // use the bed in daytime from far away and you'll get the message about // only sleeping at night - if (abs(this->x - x) > 3 || abs(this->y - y) > 2 || - abs(this->z - z) > 3) { + if (std::abs(this->x - x) > 3 || std::abs(this->y - y) > 2 || + std::abs(this->z - z) > 3) { // too far away return TOO_FAR_AWAY; } diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index 3ed30663b..9eb7abebe 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -2,7 +2,7 @@ #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/server/level/ServerLevel.h" diff --git a/targets/platform/fs/meson.build b/targets/platform/fs/meson.build index 52f1ce610..1b3593f54 100644 --- a/targets/platform/fs/meson.build +++ b/targets/platform/fs/meson.build @@ -1 +1,9 @@ -platform_fs_sources = files('std/StdFilesystem.cpp') +lib_platform_fs_std = static_library('platform_fs_std', + files('std/StdFilesystem.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_fs_std_dep = declare_dependency( + link_with: lib_platform_fs_std, +) \ No newline at end of file diff --git a/targets/platform/game/meson.build b/targets/platform/game/meson.build index 9b1af37f2..8d3aa3b8d 100644 --- a/targets/platform/game/meson.build +++ b/targets/platform/game/meson.build @@ -1 +1,9 @@ -platform_game_sources = files('stub/StubPlatformGame.cpp') +lib_platform_game_stub = static_library('platform_game_stub', + files('stub/StubPlatformGame.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_game_stub_dep = declare_dependency( + link_with: lib_platform_game_stub, +) \ No newline at end of file diff --git a/targets/platform/input/IPlatformInput.h b/targets/platform/input/IPlatformInput.h index f988975c5..7d0c13167 100644 --- a/targets/platform/input/IPlatformInput.h +++ b/targets/platform/input/IPlatformInput.h @@ -2,8 +2,7 @@ #include -#include "InputConstants.h" -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class IPlatformInput { public: diff --git a/targets/platform/input/input.h b/targets/platform/input/input.h index fbc78a5c8..19369689f 100644 --- a/targets/platform/input/input.h +++ b/targets/platform/input/input.h @@ -1,6 +1,7 @@ #pragma once #include "IPlatformInput.h" +#include "InputConstants.h" // Function accessor backed by a function-local static (Meyers singleton). // Avoids the static-initialization-order fiasco that the previous diff --git a/targets/platform/input/meson.build b/targets/platform/input/meson.build index f5d38f748..5ff09a76e 100644 --- a/targets/platform/input/meson.build +++ b/targets/platform/input/meson.build @@ -1 +1,10 @@ -platform_input_sources = files('sdl2/SDL2Input.cpp') +lib_platform_input_sdl2 = static_library('platform_input_sdl2', + files('sdl2/SDL2Input.cpp'), + dependencies: dependency('sdl2'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_input_sdl2_dep = declare_dependency( + link_with: lib_platform_input_sdl2, +) diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index ba377ec00..212495de5 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -1,15 +1,15 @@ #include "SDL2Input.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "SDL2/SDL.h" +#include "SDL2/SDL_events.h" +#include "SDL2/SDL_gamecontroller.h" +#include "SDL2/SDL_joystick.h" +#include "SDL2/SDL_keyboard.h" +#include "SDL2/SDL_mouse.h" +#include "SDL2/SDL_scancode.h" +#include "SDL2/SDL_stdinc.h" +#include "SDL2/SDL_video.h" +#include "SDL2/begin_code.h" #include #include #include diff --git a/targets/platform/input/sdl2/SDL2Input.h b/targets/platform/input/sdl2/SDL2Input.h index e2be82f51..dc8079c95 100644 --- a/targets/platform/input/sdl2/SDL2Input.h +++ b/targets/platform/input/sdl2/SDL2Input.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "../IPlatformInput.h" class SDL2Input : public IPlatformInput { diff --git a/targets/platform/leaderboard/meson.build b/targets/platform/leaderboard/meson.build index 8e520726b..597a5c41b 100644 --- a/targets/platform/leaderboard/meson.build +++ b/targets/platform/leaderboard/meson.build @@ -1 +1,9 @@ -platform_leaderboard_sources = files('stub/StubLeaderboard.cpp') +lib_platform_leaderboard_stub = static_library('platform_leaderboard_stub', + files('stub/StubLeaderboard.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_leaderboard_stub_dep = declare_dependency( + link_with: lib_platform_leaderboard_stub, +) diff --git a/targets/platform/meson.build b/targets/platform/meson.build index 5224c1502..6abdd4cb6 100644 --- a/targets/platform/meson.build +++ b/targets/platform/meson.build @@ -1,76 +1,10 @@ -platform_inc = include_directories('.') -_threads = dependency('threads') -_sdl2 = dependency('sdl2') - -if get_option('renderer') == 'gles' - _gl = dependency('glesv2', required: true) - _defs = ['-DGLES'] -else - _gl = dependency('gl', required: true) - _defs = [] -endif - -# Per-subsystem source lists. Each subdir owns its own list of backend -# .cpp files via a `platform__sources` variable. The library -# build is centralised so we get one library per platform target rather -# than one per subsystem; subsystems vary together (an SDL2 platform -# wants SDL2 input + GL renderer + miniaudio together) and a per- -# subsystem split inflates link units without buying flexibility. -subdir('input') -subdir('profile') -subdir('storage') subdir('fs') +subdir('game') +subdir('input') +subdir('leaderboard') +subdir('network') +subdir('profile') subdir('renderer') subdir('sound') -subdir('network') -subdir('leaderboard') -subdir('game') +subdir('storage') subdir('thread') - -# Core: thread + shutdown plumbing, no backend. -lib_platform_core = static_library('platform_core', - platform_thread_sources, - include_directories: [platform_inc, include_directories('..')], - dependencies: [_threads], - cpp_args: global_cpp_args + global_cpp_defs, -) - -platform_dep = declare_dependency( - link_with: lib_platform_core, - include_directories: platform_inc, -) - -lib_platform_sdl2 = static_library('platform_sdl2', - platform_input_sources - + platform_profile_sources - + platform_storage_sources - + platform_fs_sources - + platform_renderer_sources - + platform_sound_sources - + platform_network_sources - + platform_leaderboard_sources - + platform_game_sources, - include_directories: [platform_inc, include_directories('..')], - dependencies: [_sdl2, _gl, _threads, glm_dep, stb_dep, java_dep, - miniaudio_dep], - cpp_args: _defs + global_cpp_args + global_cpp_defs, -) - -# Single dep for the whole platform_sdl2 library. Aliased per-subsystem -# so consumer meson files can keep asking for `input_dep` etc. without -# caring that they all resolve to the same library object today. -platform_sdl2_dep = declare_dependency( - link_with: lib_platform_sdl2, - include_directories: [platform_inc], - dependencies: [_sdl2, _gl, _threads, glm_dep, miniaudio_dep], -) - -input_dep = platform_sdl2_dep -profile_dep = platform_sdl2_dep -storage_dep = platform_sdl2_dep -fs_dep = platform_sdl2_dep -render_dep = platform_sdl2_dep -sound_dep = platform_sdl2_dep -network_dep = platform_sdl2_dep -leaderboard_dep = platform_sdl2_dep -game_dep = platform_sdl2_dep diff --git a/targets/platform/network/meson.build b/targets/platform/network/meson.build index dab092568..34a557dac 100644 --- a/targets/platform/network/meson.build +++ b/targets/platform/network/meson.build @@ -1 +1,10 @@ -platform_network_sources = files('stub/StubPlatformNetwork.cpp', 'stub/StubNetworkPlayer.cpp') +lib_platform_network_stub = static_library('platform_network_stub', + files('stub/StubNetworkPlayer.cpp', 'stub/StubPlatformNetwork.cpp'), + include_directories: include_directories('../../'), + dependencies: java_dep, + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_network_stub_dep = declare_dependency( + link_with: lib_platform_network_stub, +) \ No newline at end of file diff --git a/targets/platform/profile/IPlatformProfile.h b/targets/platform/profile/IPlatformProfile.h index fbde8d1fa..38bdbca97 100644 --- a/targets/platform/profile/IPlatformProfile.h +++ b/targets/platform/profile/IPlatformProfile.h @@ -4,7 +4,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class CXuiStringTable; diff --git a/targets/platform/profile/meson.build b/targets/platform/profile/meson.build index 06c9397d4..c8efb5b7c 100644 --- a/targets/platform/profile/meson.build +++ b/targets/platform/profile/meson.build @@ -1 +1,11 @@ -platform_profile_sources = files('stub/StubProfile.cpp') +platform_profile_stub_sources = files('stub/StubProfile.cpp') + +lib_platform_profile_stub = static_library('platform_profile_stub', + files('stub/StubProfile.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_profile_stub_dep = declare_dependency( + link_with: lib_platform_profile_stub, +) \ No newline at end of file diff --git a/targets/platform/profile/stub/StubProfile.cpp b/targets/platform/profile/stub/StubProfile.cpp index 24b660aa2..dcd23a9e5 100644 --- a/targets/platform/profile/stub/StubProfile.cpp +++ b/targets/platform/profile/stub/StubProfile.cpp @@ -5,7 +5,7 @@ #include #include "../ProfileConstants.h" -#include "input/input.h" +#include "platform/input/input.h" namespace platform_internal { IPlatformProfile& PlatformProfile_get() { diff --git a/targets/platform/profile/stub/StubProfile.h b/targets/platform/profile/stub/StubProfile.h index 72d5a865f..3ee620ff0 100644 --- a/targets/platform/profile/stub/StubProfile.h +++ b/targets/platform/profile/stub/StubProfile.h @@ -5,7 +5,7 @@ #include #include "../IPlatformProfile.h" -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class StubProfile : public IPlatformProfile { public: diff --git a/targets/platform/renderer/IPlatformRenderer.h b/targets/platform/renderer/IPlatformRenderer.h index 186843472..32ab3793f 100644 --- a/targets/platform/renderer/IPlatformRenderer.h +++ b/targets/platform/renderer/IPlatformRenderer.h @@ -2,7 +2,7 @@ #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class IPlatformRenderer { public: diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 13e97877a..1eedd9a4e 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,6 +1,6 @@ #include "GLRenderer.h" -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" @@ -9,7 +9,7 @@ #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" #include "java/IntBuffer.h" -#include "renderer/renderer.h" +#include "platform/renderer/renderer.h" // undefine macros from header to avoid argument mismatch #undef glGenTextures @@ -41,15 +41,15 @@ #include "stb_image.h" #define GLM_FORCE_RADIANS +#include "glm/glm.hpp" +#include "glm/gtc/matrix_transform.hpp" +#include "glm/gtc/type_ptr.hpp" + #include #include - #include #include #include -#include -#include -#include #include #include #include diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index 98f395eeb..0ef3e4151 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -6,9 +6,8 @@ #include #include -#include -#include "renderer/IPlatformRenderer.h" +#include "platform/renderer/IPlatformRenderer.h" extern IPlatformRenderer& PlatformRenderer; diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index 280fef444..274fb8342 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -22,8 +22,8 @@ #include #include -#include "renderer/IPlatformRenderer.h" -#include "renderer/renderer.h" +#include "platform/renderer/IPlatformRenderer.h" +#include "platform/renderer/renderer.h" // OpenGL Interception Macros #ifndef GL_MODELVIEW_MATRIX diff --git a/targets/platform/renderer/meson.build b/targets/platform/renderer/meson.build index a000fc34c..0977323a7 100644 --- a/targets/platform/renderer/meson.build +++ b/targets/platform/renderer/meson.build @@ -1 +1,27 @@ -platform_renderer_sources = files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp') +platform_renderer_gl_dependencies = [ + dependency('dl'), + dependency('sdl2'), + dependency('glm'), + dependency('stb'), + java_dep, +] +platform_renderer_gl_defs = [] + +if get_option('renderer') == 'gles' + platform_renderer_gl_dependencies += dependency('glesv2') + platform_renderer_gl_defs = ['-DGLES'] +else + platform_renderer_gl_dependencies += dependency('gl') + platform_renderer_gl_defs = [] +endif + +lib_platform_renderer_gl = static_library('platform_renderer_gl', + files('gl/GLRenderer.cpp', 'gl/render_stubs.cpp'), + include_directories: include_directories('../../'), + dependencies: platform_renderer_gl_dependencies, + cpp_args: platform_renderer_gl_defs + global_cpp_args + global_cpp_defs, +) + +platform_renderer_gl_dep = declare_dependency( + link_with: lib_platform_renderer_gl, +) diff --git a/targets/platform/sound/meson.build b/targets/platform/sound/meson.build index 90a32a5f6..e694b9a4f 100644 --- a/targets/platform/sound/meson.build +++ b/targets/platform/sound/meson.build @@ -1 +1,10 @@ -platform_sound_sources = files('miniaudio/MiniaudioSound.cpp') +lib_platform_sound_miniaudio = static_library('platform_sound_miniaudio', + files('miniaudio/MiniaudioSound.cpp'), + dependencies: dependency('miniaudio'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_sound_miniaudio_dep = declare_dependency( + link_with: lib_platform_sound_miniaudio, +) \ No newline at end of file diff --git a/targets/platform/storage/IPlatformStorage.h b/targets/platform/storage/IPlatformStorage.h index d7de03761..1bbf3aedd 100644 --- a/targets/platform/storage/IPlatformStorage.h +++ b/targets/platform/storage/IPlatformStorage.h @@ -6,7 +6,7 @@ #include #include -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" #define MAX_DISPLAYNAME_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 #define MAX_DETAILS_LENGTH 128 // CELL_SAVEDATA_SYSP_SUBTITLE_SIZE on PS3 diff --git a/targets/platform/storage/meson.build b/targets/platform/storage/meson.build index 3dfd0201f..7fa48cb3d 100644 --- a/targets/platform/storage/meson.build +++ b/targets/platform/storage/meson.build @@ -1 +1,9 @@ -platform_storage_sources = files('stub/StubStorage.cpp') +lib_platform_storage_stub = static_library('platform_storage_stub', + files('stub/StubStorage.cpp'), + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_storage_stub_dep = declare_dependency( + link_with: lib_platform_storage_stub, +) diff --git a/targets/platform/storage/stub/StubStorage.h b/targets/platform/storage/stub/StubStorage.h index 813a4d888..9ccfc51a0 100644 --- a/targets/platform/storage/stub/StubStorage.h +++ b/targets/platform/storage/stub/StubStorage.h @@ -8,7 +8,7 @@ // #include #include "../IPlatformStorage.h" -#include "PlatformTypes.h" +#include "platform/PlatformTypes.h" class C4JStringTable; diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 8d4fd8721..ef34eeed5 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include "java/File.h" #include "renderer/gl/gl_compat.h" diff --git a/targets/platform/thread/meson.build b/targets/platform/thread/meson.build index c42ec30ec..fc616cda0 100644 --- a/targets/platform/thread/meson.build +++ b/targets/platform/thread/meson.build @@ -1 +1,10 @@ -platform_thread_sources = files('C4JThread.cpp', 'ShutdownManager.cpp') +lib_platform_thread = static_library('platform_thread', + files('C4JThread.cpp', 'ShutdownManager.cpp'), + dependencies: [dependency('threads')], + include_directories: include_directories('../../'), + cpp_args: global_cpp_args + global_cpp_defs, +) + +platform_thread_dep = declare_dependency( + link_with: lib_platform_thread, +) \ No newline at end of file diff --git a/targets/util/meson.build b/targets/util/meson.build index 35789f396..4c4439263 100644 --- a/targets/util/meson.build +++ b/targets/util/meson.build @@ -1,6 +1,6 @@ lib_util = static_library('util', files('StringHelpers.cpp', 'FrameProfiler.cpp'), - dependencies: [simdutf_dep], + dependencies: [dependency('simdutf')], include_directories : include_directories('.', '..'), cpp_args : global_cpp_args + global_cpp_defs, ) From 85a4e09e17db32be67f0049f8d94a5d8722bae25 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:55:57 -0500 Subject: [PATCH 082/104] disable LTO for now, entity micro-optimizations --- meson.build | 9 ++++--- targets/minecraft/world/entity/Entity.cpp | 10 ++++--- .../minecraft/world/entity/LivingEntity.cpp | 26 ++++++++++--------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index 14daf954d..9bce9372c 100644 --- a/meson.build +++ b/meson.build @@ -12,8 +12,8 @@ project( 'unity_size=8', # TODO: mess around with this 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE 'b_pch=true', # precompiled headers - 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) - 'b_ndebug=if-release', # drop assert() in --buildtype=release + # 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) + # 'b_ndebug=if-release', # drop assert() in --buildtype=release ], ) @@ -27,7 +27,6 @@ global_cpp_defs = [ '-DSPLIT_SAVES', '-D_LARGE_WORLDS', '-D_EXTENDED_ACHIEVEMENTS', - '-D_FORTIFY_SOURCE=2', '-DMULTITHREAD_ENABLE', # always-on threading flag (formerly in App_Defines.h) ] @@ -42,6 +41,10 @@ if get_option('buildtype') in ['debug', 'debugoptimized'] ] endif +if get_option('buildtype') == 'debugoptimized' + global_cpp_defs += ['-D_FORTIFY_SOURCE=2'] +endif + # MARK: meson options if get_option('enable_vsync') diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index e97b7fd72..7af9d16e4 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -684,12 +684,14 @@ void Entity::move(double xa, double ya, double za, bool isPlayerSneaking = onGround && isSneaking() && instanceof(eTYPE_PLAYER); + auto shared = shared_from_this(); + if (isPlayerSneaking) { double d = 0.05; AABB translated_bb = bb.move(xa, -1.0, 0.0); while (xa != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + level->getCubes(shared, &translated_bb)->empty()) { if (xa < d && xa >= -d) xa = 0; else if (xa > 0) @@ -701,7 +703,7 @@ void Entity::move(double xa, double ya, double za, translated_bb = bb.move(0, -1.0, za); while (za != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + level->getCubes(shared, &translated_bb)->empty()) { if (za < d && za >= -d) za = 0; else if (za > 0) @@ -713,7 +715,7 @@ void Entity::move(double xa, double ya, double za, translated_bb = bb.move(xa, -1.0, za); while (xa != 0 && za != 0 && - level->getCubes(shared_from_this(), &translated_bb)->empty()) { + level->getCubes(shared, &translated_bb)->empty()) { if (xa < d && xa >= -d) xa = 0; else if (xa > 0) @@ -733,7 +735,7 @@ void Entity::move(double xa, double ya, double za, AABB expanded = bb.expand(xa, ya, za); std::vector* aABBs = - level->getCubes(shared_from_this(), &expanded, noEntityCubes, true); + level->getCubes(shared, &expanded, noEntityCubes, true); // LAND FIRST, then x and z auto itEndAABB = aABBs->end(); diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 4bc74cb99..0299b688a 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1244,8 +1244,12 @@ void LivingEntity::jumpFromGround() { } void LivingEntity::travel(float xa, float ya) { - std::shared_ptr thisPlayer = - std::dynamic_pointer_cast(shared_from_this()); + // AP - dynamic_pointer_cast is a non-trivial call, use raw pointer instead + Player* thisPlayer = nullptr; + if (this->instanceof(eTYPE_PLAYER)) { + thisPlayer = (Player*)this; + } + if (isInWater() && !(thisPlayer && thisPlayer->abilities.flying)) { double yo = y; moveRelative(xa, ya, useNewAi() ? 0.04f : 0.02f); @@ -1273,13 +1277,13 @@ void LivingEntity::travel(float xa, float ya) { } } else { float friction = 0.91f; + int frictionTile = 0; if (onGround) { friction = 0.6f * 0.91f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); - if (t > 0) { - friction = Tile::tiles[t]->friction * 0.91f; - } + frictionTile = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, Mth::floor(z)); + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; + } } float friction2 = (0.6f * 0.6f * 0.91f * 0.91f * 0.6f * 0.91f) / @@ -1297,11 +1301,9 @@ void LivingEntity::travel(float xa, float ya) { friction = 0.91f; if (onGround) { friction = 0.6f * 0.91f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); - if (t > 0) { - friction = Tile::tiles[t]->friction * 0.91f; - } + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; + } } if (onLadder()) { float max = 0.15f; From 2fc0095b86e4e7b535cb94414005038c51ad4e96 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:22:58 -0500 Subject: [PATCH 083/104] fix non-unity build --- targets/minecraft/client/renderer/texture/Stitcher.cpp | 1 + targets/minecraft/locale/StringTable.cpp | 1 + targets/minecraft/meson.build | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/minecraft/client/renderer/texture/Stitcher.cpp b/targets/minecraft/client/renderer/texture/Stitcher.cpp index 8a309b338..805caefc2 100644 --- a/targets/minecraft/client/renderer/texture/Stitcher.cpp +++ b/targets/minecraft/client/renderer/texture/Stitcher.cpp @@ -1,6 +1,7 @@ #include "Stitcher.h" #include +#include #include "StitchSlot.h" #include "Texture.h" diff --git a/targets/minecraft/locale/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp index 9bfcffda6..39b0a1a82 100644 --- a/targets/minecraft/locale/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index 1fceddba1..219b9d6db 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -6,8 +6,6 @@ fs = import('fs') minecraft_sources = files(fs.read('sources.txt').strip().split('\n')) -crypto_dep = dependency('libcrypto') # for MD5 in Hasher.cpp on Linux - lib_minecraft = static_library('minecraft', minecraft_sources, dependencies : [ From 64a44b5385e1f6e09ed383ace88886d84e0f01ed Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 11:46:33 -0500 Subject: [PATCH 084/104] format it all --- targets/minecraft/client/BufferedImage.cpp | 2 +- .../minecraft/client/player/LocalPlayer.cpp | 2 +- targets/minecraft/locale/StringTable.cpp | 2 +- targets/minecraft/world/entity/Entity.cpp | 8 +++----- .../minecraft/world/entity/LivingEntity.cpp | 17 +++++++++-------- .../world/level/tile/entity/SignTileEntity.cpp | 2 +- targets/platform/input/sdl2/SDL2Input.cpp | 18 +++++++++--------- targets/platform/renderer/gl/GLRenderer.cpp | 11 ++++++----- targets/platform/stubs.h | 1 - 9 files changed, 31 insertions(+), 32 deletions(-) diff --git a/targets/minecraft/client/BufferedImage.cpp b/targets/minecraft/client/BufferedImage.cpp index 4d71aad6c..22ebdf4a9 100644 --- a/targets/minecraft/client/BufferedImage.cpp +++ b/targets/minecraft/client/BufferedImage.cpp @@ -6,8 +6,8 @@ #include #include -#include "platform/PlatformTypes.h" #include "minecraft/IGameServices.h" +#include "platform/PlatformTypes.h" #include "platform/fs/fs.h" #include "platform/renderer/renderer.h" #include "util/StringHelpers.h" diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 4e8c4c701..45a09d9fb 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/PlatformTypes.h" #include "Pos.h" #include "app/common/Audio/ConsoleSoundEngine.h" #include "app/common/Audio/SoundTypes.h" @@ -79,6 +78,7 @@ #include "minecraft/world/phys/HitResult.h" #include "minecraft/world/phys/Vec3.h" #include "minecraft/world/tutorial/ITutorial.h" +#include "platform/PlatformTypes.h" #include "platform/input/input.h" #include "platform/profile/ProfileConstants.h" #include "platform/profile/profile.h" diff --git a/targets/minecraft/locale/StringTable.cpp b/targets/minecraft/locale/StringTable.cpp index 39b0a1a82..e8cb41a36 100644 --- a/targets/minecraft/locale/StringTable.cpp +++ b/targets/minecraft/locale/StringTable.cpp @@ -1,8 +1,8 @@ #include "minecraft/locale/StringTable.h" +#include #include #include -#include #include "java/InputOutputStream/ByteArrayInputStream.h" #include "java/InputOutputStream/DataInputStream.h" diff --git a/targets/minecraft/world/entity/Entity.cpp b/targets/minecraft/world/entity/Entity.cpp index 7af9d16e4..a74fe68ca 100644 --- a/targets/minecraft/world/entity/Entity.cpp +++ b/targets/minecraft/world/entity/Entity.cpp @@ -685,13 +685,12 @@ void Entity::move(double xa, double ya, double za, onGround && isSneaking() && instanceof(eTYPE_PLAYER); auto shared = shared_from_this(); - + if (isPlayerSneaking) { double d = 0.05; AABB translated_bb = bb.move(xa, -1.0, 0.0); - while (xa != 0 && - level->getCubes(shared, &translated_bb)->empty()) { + while (xa != 0 && level->getCubes(shared, &translated_bb)->empty()) { if (xa < d && xa >= -d) xa = 0; else if (xa > 0) @@ -702,8 +701,7 @@ void Entity::move(double xa, double ya, double za, } translated_bb = bb.move(0, -1.0, za); - while (za != 0 && - level->getCubes(shared, &translated_bb)->empty()) { + while (za != 0 && level->getCubes(shared, &translated_bb)->empty()) { if (za < d && za >= -d) za = 0; else if (za > 0) diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index 0299b688a..e5866814f 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1244,7 +1244,7 @@ void LivingEntity::jumpFromGround() { } void LivingEntity::travel(float xa, float ya) { - // AP - dynamic_pointer_cast is a non-trivial call, use raw pointer instead + // AP - dynamic_pointer_cast is a non-trivial call, use raw pointer instead Player* thisPlayer = nullptr; if (this->instanceof(eTYPE_PLAYER)) { thisPlayer = (Player*)this; @@ -1280,10 +1280,11 @@ void LivingEntity::travel(float xa, float ya) { int frictionTile = 0; if (onGround) { friction = 0.6f * 0.91f; - frictionTile = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, Mth::floor(z)); - if (frictionTile > 0) { - friction = Tile::tiles[frictionTile]->friction * 0.91f; - } + frictionTile = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, + Mth::floor(z)); + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; + } } float friction2 = (0.6f * 0.6f * 0.91f * 0.91f * 0.6f * 0.91f) / @@ -1301,9 +1302,9 @@ void LivingEntity::travel(float xa, float ya) { friction = 0.91f; if (onGround) { friction = 0.6f * 0.91f; - if (frictionTile > 0) { - friction = Tile::tiles[frictionTile]->friction * 0.91f; - } + if (frictionTile > 0) { + friction = Tile::tiles[frictionTile]->friction * 0.91f; + } } if (onLadder()) { float max = 0.15f; diff --git a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp index 9eb7abebe..a57bf4a5a 100644 --- a/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp +++ b/targets/minecraft/world/level/tile/entity/SignTileEntity.cpp @@ -2,13 +2,13 @@ #include -#include "platform/PlatformTypes.h" #include "minecraft/client/Minecraft.h" #include "minecraft/network/packet/SignUpdatePacket.h" #include "minecraft/server/level/ServerLevel.h" #include "minecraft/world/level/Level.h" #include "minecraft/world/level/tile/entity/TileEntity.h" #include "nbt/CompoundTag.h" +#include "platform/PlatformTypes.h" class Player; diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index 212495de5..ba35895a6 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -1,5 +1,14 @@ #include "SDL2Input.h" +#include +#include +#include + +#include +#include + +#include "../../PlatformTypes.h" +#include "../InputConstants.h" #include "SDL2/SDL.h" #include "SDL2/SDL_events.h" #include "SDL2/SDL_gamecontroller.h" @@ -10,15 +19,6 @@ #include "SDL2/SDL_stdinc.h" #include "SDL2/SDL_video.h" #include "SDL2/begin_code.h" -#include -#include -#include - -#include -#include - -#include "../../PlatformTypes.h" -#include "../InputConstants.h" namespace platform_internal { IPlatformInput& PlatformInput_get() { diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 1eedd9a4e..0a9b87b7d 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1,6 +1,5 @@ #include "GLRenderer.h" -#include "platform/PlatformTypes.h" #include "SDL.h" #include "SDL_error.h" #include "SDL_events.h" @@ -9,6 +8,7 @@ #include "java/ByteBuffer.h" #include "java/FloatBuffer.h" #include "java/IntBuffer.h" +#include "platform/PlatformTypes.h" #include "platform/renderer/renderer.h" // undefine macros from header to avoid argument mismatch @@ -41,12 +41,9 @@ #include "stb_image.h" #define GLM_FORCE_RADIANS -#include "glm/glm.hpp" -#include "glm/gtc/matrix_transform.hpp" -#include "glm/gtc/type_ptr.hpp" - #include #include + #include #include #include @@ -54,6 +51,10 @@ #include #include +#include "glm/glm.hpp" +#include "glm/gtc/matrix_transform.hpp" +#include "glm/gtc/type_ptr.hpp" + namespace platform_internal { IPlatformRenderer& PlatformRenderer_get() { static GLRenderer instance; diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index ef34eeed5..65bc7ccfa 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -2,7 +2,6 @@ #include #include - #include #include "java/File.h" From 41437bb999f412c7983c9ca861d1a4f5203387fd Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:22:41 -0500 Subject: [PATCH 085/104] nuke glu dependency, setup sdl2 wrap --- subprojects/sdl2.wrap | 15 +++++++++++++++ targets/platform/renderer/gl/GLRenderer.h | 1 - targets/platform/renderer/gl/gl_compat.h | 1 - targets/platform/stubs.h | 1 - 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 subprojects/sdl2.wrap diff --git a/subprojects/sdl2.wrap b/subprojects/sdl2.wrap new file mode 100644 index 000000000..39031b2de --- /dev/null +++ b/subprojects/sdl2.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = SDL2-2.32.8 +source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.32.8/SDL2-2.32.8.tar.gz +source_filename = SDL2-2.32.8.tar.gz +source_hash = 0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e +patch_filename = sdl2_2.32.8-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.32.8-1/get_patch +patch_hash = 5df17ea39ca418826db20e96bd821fa52b5718dac64b6225119fb6588c2744f0 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/sdl2_2.32.8-1/SDL2-2.32.8.tar.gz +wrapdb_version = 2.32.8-1 + +[provide] +sdl2 = sdl2_dep +sdl2main = sdl2main_dep +sdl2_test = sdl2_test_dep diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index 0ef3e4151..ab32e75b7 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -3,7 +3,6 @@ #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two #include -#include #include diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index 274fb8342..ed9b6f06d 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -17,7 +17,6 @@ #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two #include -#include #include #include diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 65bc7ccfa..b99db20a1 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include "java/File.h" From 1628e08748a065b4d0e7cc5db88f259974612abe Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:40:21 -0500 Subject: [PATCH 086/104] refactor: nuke gl query functions to remove libdl dependence in the renderer --- targets/platform/renderer/gl/GLRenderer.cpp | 83 --------------------- targets/platform/renderer/gl/gl_compat.h | 6 -- targets/platform/renderer/meson.build | 1 - targets/platform/stubs.h | 5 -- 4 files changed, 95 deletions(-) diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 0a9b87b7d..f08174bb8 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1406,44 +1406,6 @@ void glDeleteTextures_4J(int n, const unsigned int* textures) { ::glDeleteTextures(n, textures); } -void glBeginQuery_4J_Helper(unsigned int target, unsigned int id) { - typedef void (*PFNGLBEGINQUERYPROC)(unsigned int, unsigned int); - static PFNGLBEGINQUERYPROC fn = - (PFNGLBEGINQUERYPROC)dlsym(RTLD_DEFAULT, "glBeginQuery"); - if (fn) fn(target, id); -} - -void glEndQuery_4J_Helper(unsigned int target) { - typedef void (*PFNGLENDQUERYPROC)(unsigned int); - static PFNGLENDQUERYPROC fn = - (PFNGLENDQUERYPROC)dlsym(RTLD_DEFAULT, "glEndQuery"); - if (fn) fn(target); -} - -void glGenQueries_4J_Helper(unsigned int* id) { -#ifdef GLES - glGenQueries(1, id); -#else - typedef void (*PFNGLGENQUERIESPROC)(int, unsigned int*); - static PFNGLGENQUERIESPROC fn = - (PFNGLGENQUERIESPROC)dlsym(RTLD_DEFAULT, "glGenQueries"); - if (fn) fn(1, id); -#endif -} - -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val) { -#ifdef GLES - glGetQueryObjectuiv(id, pname, val); -#else - typedef void (*PFNGLGETQUERYOBJECTUIVPROC)(unsigned int, unsigned int, - unsigned int*); - static PFNGLGETQUERYOBJECTUIVPROC fn = - (PFNGLGETQUERYOBJECTUIVPROC)dlsym(RTLD_DEFAULT, "glGetQueryObjectuiv"); - if (fn) fn(id, pname, val); -#endif -} - // c hooks #undef glFogfv #undef glLightfv @@ -1578,54 +1540,9 @@ 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); } diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index ed9b6f06d..df64fed1a 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -574,12 +574,6 @@ inline void glReadPixels_4J(int x, int y, int width, int height, int format, ::glReadPixels(x, y, width, height, (unsigned int)format, (unsigned int)type, pixels->getBuffer()); } -void glBeginQuery_4J_Helper(unsigned int target, unsigned int id); -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/renderer/meson.build b/targets/platform/renderer/meson.build index 0977323a7..cd9998ab1 100644 --- a/targets/platform/renderer/meson.build +++ b/targets/platform/renderer/meson.build @@ -1,5 +1,4 @@ platform_renderer_gl_dependencies = [ - dependency('dl'), dependency('sdl2'), dependency('glm'), dependency('stb'), diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index b99db20a1..114bb6fe3 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -34,11 +34,6 @@ void glEndList_4J(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 glReadPixels(int, int, int, int, int, int, ByteBuffer*); class GL11 { public: From 016041975614bdf1be61f6af93e0aa6d02ace4d9 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:47:28 -0500 Subject: [PATCH 087/104] refactor(gdraw): temporarily revert OpenGL extension loading via dlsym --- targets/app/common/Iggy/gdraw/gdraw.c | 65 ++++++++++----------- targets/app/meson.build | 1 - targets/platform/renderer/gl/GLRenderer.cpp | 1 - 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/targets/app/common/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c index 71c17cf81..add6fd2b4 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -3,7 +3,6 @@ #include "gdraw.h" #include -#include #include #include #include @@ -38,23 +37,23 @@ void IggyDiscardVertexBufferCallback(void* owner, void* buf) { } #endif -static void* get_gl_proc(const char* name) { - void* p = SDL_GL_GetProcAddress(name); - if (!p) p = dlsym(RTLD_DEFAULT, name); - if (!p) { - char buf[256]; - strncpy(buf, name, sizeof(buf) - 1); - buf[255] = '\0'; - char* ext = strstr(buf, "ARB"); - if (!ext) ext = strstr(buf, "EXT"); - if (ext && ext == buf + strlen(buf) - 3) { - *ext = '\0'; - p = SDL_GL_GetProcAddress(buf); - if (!p) p = dlsym(RTLD_DEFAULT, buf); - } - } - return p; -} +// static void* get_gl_proc(const char* name) { +// void* p = SDL_GL_GetProcAddress(name); +// if (!p) p = dlsym(RTLD_DEFAULT, name); +// if (!p) { +// char buf[256]; +// strncpy(buf, name, sizeof(buf) - 1); +// buf[255] = '\0'; +// char* ext = strstr(buf, "ARB"); +// if (!ext) ext = strstr(buf, "EXT"); +// if (ext && ext == buf + strlen(buf) - 3) { +// *ext = '\0'; +// p = SDL_GL_GetProcAddress(buf); +// if (!p) p = dlsym(RTLD_DEFAULT, buf); +// } +// } +// return p; +// } #define GDRAW_GL_EXTENSION_LIST \ /* identifier import procname */ \ @@ -178,15 +177,15 @@ static gdraw_texsubimage2d_fn gdraw_real_texsubimage2d = NULL; #define TRY(ptr, arb, core) \ do { \ - void* _p = get_gl_proc(core); \ - if (!_p) _p = get_gl_proc(arb); \ + void* _p = SDL_GL_GetProcAddress(core); \ + if (!_p) _p = SDL_GL_GetProcAddress(arb); \ *(void**)&(ptr) = _p; \ } while (0) static void load_extensions(void) { // gl_shared requires ts shit ugh #define GLE(id, import, procname) \ - gl##id = (PFNGL##procname##PROC)get_gl_proc("gl" import); + gl##id = (PFNGL##procname##PROC)SDL_GL_GetProcAddress("gl" import); GDRAW_GL_EXTENSION_LIST #undef GLE @@ -248,26 +247,26 @@ static void load_extensions(void) { // Save raw pointers before we #define over the names below gdraw_real_vtxattrib = - (gdraw_vtxattrib_fn)get_gl_proc("glVertexAttribPointer"); + (gdraw_vtxattrib_fn)SDL_GL_GetProcAddress("glVertexAttribPointer"); gdraw_real_createshader = - (gdraw_createshader_fn)get_gl_proc("glCreateShader"); + (gdraw_createshader_fn)SDL_GL_GetProcAddress("glCreateShader"); gdraw_real_shadersource = - (gdraw_shadersource_fn)get_gl_proc("glShaderSource"); + (gdraw_shadersource_fn)SDL_GL_GetProcAddress("glShaderSource"); gdraw_real_compileshader = - (gdraw_compileshader_fn)get_gl_proc("glCompileShader"); - gdraw_real_linkprogram = (gdraw_linkprogram_fn)get_gl_proc("glLinkProgram"); - gdraw_real_teximage2d = (gdraw_teximage2d_fn)get_gl_proc("glTexImage2D"); + (gdraw_compileshader_fn)SDL_GL_GetProcAddress("glCompileShader"); + gdraw_real_linkprogram = (gdraw_linkprogram_fn)SDL_GL_GetProcAddress("glLinkProgram"); + gdraw_real_teximage2d = (gdraw_teximage2d_fn)SDL_GL_GetProcAddress("glTexImage2D"); gdraw_real_texsubimage2d = - (gdraw_texsubimage2d_fn)get_gl_proc("glTexSubImage2D"); - gdraw_real_useprogram = (gdraw_useprogram_fn)get_gl_proc("glUseProgram"); + (gdraw_texsubimage2d_fn)SDL_GL_GetProcAddress("glTexSubImage2D"); + gdraw_real_useprogram = (gdraw_useprogram_fn)SDL_GL_GetProcAddress("glUseProgram"); gdraw_real_drawelements = - (gdraw_drawelements_fn)get_gl_proc("glDrawElements"); + (gdraw_drawelements_fn)SDL_GL_GetProcAddress("glDrawElements"); - gdraw_glGetStringi = (PFNGLGETSTRINGIPROC_)get_gl_proc("glGetStringi"); + gdraw_glGetStringi = (PFNGLGETSTRINGIPROC_)SDL_GL_GetProcAddress("glGetStringi"); gdraw_glGenVertexArrays = - (PFNGLGENVERTEXARRAYSPROC_)get_gl_proc("glGenVertexArrays"); + (PFNGLGENVERTEXARRAYSPROC_)SDL_GL_GetProcAddress("glGenVertexArrays"); gdraw_glBindVertexArray = - (PFNGLBINDVERTEXARRAYPROC_)get_gl_proc("glBindVertexArray"); + (PFNGLBINDVERTEXARRAYPROC_)SDL_GL_GetProcAddress("glBindVertexArray"); if (gdraw_glGenVertexArrays && gdraw_glBindVertexArray && gdraw_vao == 0) { gdraw_glGenVertexArrays(1, &gdraw_vao); diff --git a/targets/app/meson.build b/targets/app/meson.build index 8a55d979a..de62035fc 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -23,7 +23,6 @@ if get_option('ui_backend') == 'shiggy' endif app_dependencies += [ - dependency('dl'), # blame iggy gdraw, nuke this later dependency('sdl2'), # blame iggy gdraw, nuke this later dependency('miniaudio'), # todo: remove once PlatformSound is used dependency('stb'), diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index f08174bb8..0fc9c32a3 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -41,7 +41,6 @@ #include "stb_image.h" #define GLM_FORCE_RADIANS -#include #include #include From 6e0b3f163a08912225ad3e406e02d35860ab3d94 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:50:22 -0700 Subject: [PATCH 088/104] feat(build): add glm wrap --- subprojects/glm.wrap | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 subprojects/glm.wrap diff --git a/subprojects/glm.wrap b/subprojects/glm.wrap new file mode 100644 index 000000000..d75571ec0 --- /dev/null +++ b/subprojects/glm.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = glm-1.0.1 +source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz +source_filename = glm-1.0.1.tar.gz +source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c +patch_filename = glm_1.0.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch +patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz +wrapdb_version = 1.0.1-1 + +[provide] +glm = glm_dep From 027f87f653f3d4fd41537caf7823ce8b24f5a310 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:56:41 -0700 Subject: [PATCH 089/104] feat(build): add openssl wrap --- subprojects/openssl.wrap | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 subprojects/openssl.wrap diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap new file mode 100644 index 000000000..873d55106 --- /dev/null +++ b/subprojects/openssl.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch +patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-3 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep From 5c248704ac9fb40d7e7b0a2db57e2c7739d11691 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:10:53 -0700 Subject: [PATCH 090/104] stub Hasher and remove OpenSSL dependency, add zlib wrap --- subprojects/openssl.wrap | 15 --------------- subprojects/zlib.wrap | 14 ++++++++++++++ targets/minecraft/meson.build | 2 +- targets/minecraft/util/Hasher.cpp | 26 ++++++++++++++++++++------ 4 files changed, 35 insertions(+), 22 deletions(-) delete mode 100644 subprojects/openssl.wrap create mode 100644 subprojects/zlib.wrap diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap deleted file mode 100644 index 873d55106..000000000 --- a/subprojects/openssl.wrap +++ /dev/null @@ -1,15 +0,0 @@ -[wrap-file] -directory = openssl-3.0.8 -source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz -source_filename = openssl-3.0.8.tar.gz -source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e -patch_filename = openssl_3.0.8-3_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch -patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz -wrapdb_version = 3.0.8-3 - -[provide] -libcrypto = libcrypto_dep -libssl = libssl_dep -openssl = openssl_dep diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 000000000..0626401ac --- /dev/null +++ b/subprojects/zlib.wrap @@ -0,0 +1,14 @@ +[wrap-file] +directory = zlib-1.3.2 +source_url = https://zlib.net/zlib-1.3.2.tar.xz +source_fallback_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_source/zlib-1.3.2.tar.xz +source_filename = zlib-1.3.2.tar.xz +source_hash = d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3 +patch_filename = zlib_1.3.2-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.2-1/get_patch +patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.2-1/zlib_1.3.2-1_patch.zip +patch_hash = 5ae7a2e92f823df118cfb8c1b23d94e3117864392b3446581d669049b2fba6dd +wrapdb_version = 1.3.2-1 + +[provide] +dependency_names = zlib diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index 219b9d6db..6c3708106 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -9,7 +9,7 @@ minecraft_sources = files(fs.read('sources.txt').strip().split('\n')) lib_minecraft = static_library('minecraft', minecraft_sources, dependencies : [ - dependency('libcrypto'), # for MD5 in Hasher.cpp on Linux + # dependency('libcrypto'), # for MD5 in Hasher.cpp on Linux dependency('zlib'), dependency('glm'), nbt_dep, diff --git a/targets/minecraft/util/Hasher.cpp b/targets/minecraft/util/Hasher.cpp index feeb01f38..60d8c67f7 100644 --- a/targets/minecraft/util/Hasher.cpp +++ b/targets/minecraft/util/Hasher.cpp @@ -1,17 +1,30 @@ -#if defined(_WIN32) -#include -#else +// #if defined(_WIN32) +// #include +// #else #include #include -#endif // _WIN32 -#include -#include +// #endif // _WIN32 +// #include +// #include #include "Hasher.h" Hasher::Hasher(std::string& salt) { this->salt = salt; } std::string Hasher::getHash(std::string& name) { + // 4jcraft: stubbed for portability reasons. + // + // The OpenSSL meson is broken on windows and expects winsock to + // be statically linked (which is dumb since we only want libcrypto + // for MD5 hashing), and avoiding a dependency on libcrypto here is + // probably a good thing either way for some platforms. + // + // Given that this class isn't used and im lazy, we're just gonna do + // this until it becomes a problem. This class isnt actually used + // anywhere at the moment anyways so it's whatever. + return ""; + +#if 0 #if defined(_WIN32) // 4J Stu - Removed try/catch // try { @@ -46,4 +59,5 @@ std::string Hasher::getHash(std::string& name) { std::string hash_str = ss.str(); return std::string(hash_str.begin(), hash_str.end()); #endif +#endif } From 69b749a844828a308269808609fdf602d9e26ab4 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:42:45 -0700 Subject: [PATCH 091/104] windows stuff --- meson.build | 4 ++-- targets/app/{linux => desktop}/main.cpp | 0 targets/nbt/include/nbt/CompoundTag.h | 12 ++++++------ targets/platform/input/sdl2/SDL2Input.cpp | 20 ++++++++++---------- targets/platform/renderer/gl/gl3_loader.h | 11 +++++++++-- targets/platform/stubs.h | 7 +++++++ 6 files changed, 34 insertions(+), 20 deletions(-) rename targets/app/{linux => desktop}/main.cpp (100%) diff --git a/meson.build b/meson.build index 9bce9372c..5b9c20e9a 100644 --- a/meson.build +++ b/meson.build @@ -87,7 +87,7 @@ subdir('targets/platform') # MARK: platform configuration -if host_machine.system() == 'linux' +if host_machine.system() in ['linux', 'windows'] platform_fs_dep = platform_fs_std_dep platform_game_dep = platform_game_stub_dep platform_input_dep = platform_input_sdl2_dep @@ -99,7 +99,7 @@ if host_machine.system() == 'linux' platform_storage_dep = platform_storage_stub_dep platform_thread_dep = platform_thread_dep # standardized backend (for now) - app_platform_sources = files('targets/app/linux/main.cpp') + app_platform_sources = files('targets/app/desktop/main.cpp') endif subdir('targets/resources') diff --git a/targets/app/linux/main.cpp b/targets/app/desktop/main.cpp similarity index 100% rename from targets/app/linux/main.cpp rename to targets/app/desktop/main.cpp diff --git a/targets/nbt/include/nbt/CompoundTag.h b/targets/nbt/include/nbt/CompoundTag.h index 8169a5cbe..789366680 100644 --- a/targets/nbt/include/nbt/CompoundTag.h +++ b/targets/nbt/include/nbt/CompoundTag.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include "ByteArrayTag.h" @@ -16,14 +16,14 @@ class CompoundTag : public Tag { private: - std::flat_map> tags; + std::unordered_map> tags; public: CompoundTag() : Tag("") {} CompoundTag(const std::string& name) : Tag(name) {} void write(DataOutput* dos) { - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { Tag::writeNamedTag(value.get(), dos); } dos->writeByte(Tag::TAG_End); @@ -49,7 +49,7 @@ public: std::vector getAllTags() { std::vector ret; ret.reserve(tags.size()); - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { ret.push_back(value.get()); } return ret; @@ -228,7 +228,7 @@ public: Tag* copy() { CompoundTag* tag = new CompoundTag(getName()); - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { tag->put(key, value->copy()); } return tag; @@ -239,7 +239,7 @@ public: CompoundTag* o = (CompoundTag*)obj; if (tags.size() == o->tags.size()) { - for (auto&& [key, value] : tags) { + for (auto& [key, value] : tags) { auto itFind = o->tags.find(key); if (itFind == o->tags.end() || !value->equals(itFind->second.get())) { diff --git a/targets/platform/input/sdl2/SDL2Input.cpp b/targets/platform/input/sdl2/SDL2Input.cpp index ba35895a6..d80ae45b6 100644 --- a/targets/platform/input/sdl2/SDL2Input.cpp +++ b/targets/platform/input/sdl2/SDL2Input.cpp @@ -9,16 +9,16 @@ #include "../../PlatformTypes.h" #include "../InputConstants.h" -#include "SDL2/SDL.h" -#include "SDL2/SDL_events.h" -#include "SDL2/SDL_gamecontroller.h" -#include "SDL2/SDL_joystick.h" -#include "SDL2/SDL_keyboard.h" -#include "SDL2/SDL_mouse.h" -#include "SDL2/SDL_scancode.h" -#include "SDL2/SDL_stdinc.h" -#include "SDL2/SDL_video.h" -#include "SDL2/begin_code.h" +#include "SDL.h" +#include "SDL_events.h" +#include "SDL_gamecontroller.h" +#include "SDL_joystick.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_scancode.h" +#include "SDL_stdinc.h" +#include "SDL_video.h" +#include "begin_code.h" namespace platform_internal { IPlatformInput& PlatformInput_get() { diff --git a/targets/platform/renderer/gl/gl3_loader.h b/targets/platform/renderer/gl/gl3_loader.h index 6416a1152..bb03b3aad 100644 --- a/targets/platform/renderer/gl/gl3_loader.h +++ b/targets/platform/renderer/gl/gl3_loader.h @@ -1,10 +1,17 @@ #pragma once + +// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, +// which can only be found in the Windows API +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #ifndef GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES 1 #endif #include -#include -#include +// #include #include #ifndef GL_ARRAY_BUFFER diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 114bb6fe3..49dd2a7e9 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -1,5 +1,12 @@ #pragma once +// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, +// which can only be found in the Windows API +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include #include From 05adecade7c74f84dcab13b6afd34d81455cc602 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:02:24 -0500 Subject: [PATCH 092/104] refactor: replace pthreads in GLRenderer with std::thread --- targets/platform/renderer/gl/GLRenderer.cpp | 98 ++++++++++----------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 0fc9c32a3..3a509de6c 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -41,11 +41,13 @@ #include "stb_image.h" #define GLM_FORCE_RADIANS -#include #include #include #include +#include +#include +#include #include #include #include @@ -98,17 +100,18 @@ static int s_reqWidth = 1920; static int s_reqHeight = 1080; static bool s_fullscreen = false; -static pthread_key_t s_glCtxKey; -static pthread_once_t s_glCtxKeyOnce = PTHREAD_ONCE_INIT; -static void makeGLCtxKey() { pthread_key_create(&s_glCtxKey, nullptr); } +static thread_local SDL_GLContext s_glCtx = nullptr; + +static std::once_flag s_glCtxKeyOnce; + static const int MAX_SHARED_CTXS = 6; static SDL_Window* s_sharedWins[MAX_SHARED_CTXS] = {}; static SDL_GLContext s_sharedCtxs[MAX_SHARED_CTXS] = {}; static int s_sharedCtxCount = 0; static int s_nextSharedCtx = 0; -static pthread_mutex_t s_sharedMtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_glCallMtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_t s_mainThread; +static std::mutex s_sharedMtx; +static std::mutex s_glCallMtx; +static std::thread::id s_mainThreadId; static bool s_mainThreadSet = false; static thread_local unsigned int s_rs_dirty_mask = 0xFFFFFFFF; @@ -686,10 +689,11 @@ void GLRenderer::Initialise() { glViewport(0, 0, s_windowWidth, s_windowHeight); s_shader.build(VERT_SRC, FRAG_SRC); initStreamingVAOs(); - pthread_once(&s_glCtxKeyOnce, makeGLCtxKey); - s_mainThread = pthread_self(); + + s_mainThreadId = std::this_thread::get_id(); s_mainThreadSet = true; - pthread_setspecific(s_glCtxKey, (void*)s_window); + s_glCtx = s_glContext; + SDL_GL_MakeCurrent(s_window, s_glContext); for (int i = 0; i < MAX_SHARED_CTXS; i++) { SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); @@ -718,32 +722,36 @@ void GLRenderer::Initialise() { void GLRenderer::InitialiseContext() { if (!s_window) return; - pthread_once(&s_glCtxKeyOnce, makeGLCtxKey); - if (s_mainThreadSet && pthread_equal(pthread_self(), s_mainThread)) { + + if (s_mainThreadSet && std::this_thread::get_id() == s_mainThreadId) { SDL_GL_MakeCurrent(s_window, s_glContext); - pthread_setspecific(s_glCtxKey, (void*)s_window); + s_glCtx = s_glContext; return; } - void* cp = pthread_getspecific(s_glCtxKey); - if (cp) { - SDL_GLContext ctx = (SDL_GLContext)cp; - for (int i = 0; i < s_sharedCtxCount; i++) - if (s_sharedCtxs[i] == ctx) { - SDL_GL_MakeCurrent(s_sharedWins[i], ctx); + + if (s_glCtx) { + for (int i = 0; i < s_sharedCtxCount; i++) { + if (s_sharedCtxs[i] == s_glCtx) { + SDL_GL_MakeCurrent(s_sharedWins[i], s_glCtx); return; } + } return; } - pthread_mutex_lock(&s_sharedMtx); - SDL_GLContext shared = (s_nextSharedCtx < s_sharedCtxCount) - ? s_sharedCtxs[s_nextSharedCtx++] - : nullptr; - pthread_mutex_unlock(&s_sharedMtx); + + SDL_GLContext shared = nullptr; + { + std::lock_guard lk(s_sharedMtx); + if (s_nextSharedCtx < s_sharedCtxCount) + shared = s_sharedCtxs[s_nextSharedCtx++]; + } if (!shared) return; - for (int i = 0; i < s_sharedCtxCount; i++) + + for (int i = 0; i < s_sharedCtxCount; i++) { if (s_sharedCtxs[i] == shared) SDL_GL_MakeCurrent(s_sharedWins[i], shared); - pthread_setspecific(s_glCtxKey, (void*)shared); + } + s_glCtx = shared; } void GLRenderer::StartFrame() { @@ -789,10 +797,11 @@ void GLRenderer::GetFramebufferSize(int& w, int& h) { void GLRenderer::Close() { s_window = nullptr; } void GLRenderer::Shutdown() { - pthread_mutex_lock(&s_glCallMtx); - for (auto& kv : s_chunkPool) kv.second.destroy(); - s_chunkPool.clear(); - pthread_mutex_unlock(&s_glCallMtx); + { + std::lock_guard lk(s_glCallMtx); + for (auto& kv : s_chunkPool) kv.second.destroy(); + s_chunkPool.clear(); + } glDeleteVertexArrays(1, &s_sVAO_std); glDeleteBuffers(1, &s_sVBO_std); if (s_shader.prog) glDeleteProgram(s_shader.prog); @@ -901,7 +910,7 @@ void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, return; } - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); pushRenderState(); glBindVertexArray(s_sVAO_std); @@ -916,26 +925,23 @@ void GLRenderer::DrawVertices(ePrimitiveType ptype, int count, void* dataIn, glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::ReadPixels(int x, int y, int w, int h, void* buf) { if (!buf) return; - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); - pthread_mutex_unlock(&s_glCallMtx); } int GLRenderer::CBuffCreate(int count) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); int b = s_nextListBase; s_nextListBase += count; - pthread_mutex_unlock(&s_glCallMtx); return b; } void GLRenderer::CBuffDelete(int first, int count) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); for (int i = first; i < first + count; i++) { auto it = s_chunkPool.find(i); if (it != s_chunkPool.end()) { @@ -943,17 +949,15 @@ void GLRenderer::CBuffDelete(int first, int count) { s_chunkPool.erase(it); } } - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::CBuffDeleteAll() { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); for (auto& kv : s_chunkPool) { kv.second.destroy(); } s_chunkPool.clear(); s_nextListBase = 1; - pthread_mutex_unlock(&s_glCallMtx); } void GLRenderer::CBuffStart(int index, bool) { @@ -964,12 +968,11 @@ void GLRenderer::CBuffStart(int index, bool) { void GLRenderer::CBuffEnd() { if (s_recListId < 0) return; - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); ChunkBuffer& cb = s_chunkPool[s_recListId]; cb.destroy(); if (s_recVerts.empty()) { s_chunkPool.erase(s_recListId); - pthread_mutex_unlock(&s_glCallMtx); s_recListId = -1; return; } @@ -977,31 +980,27 @@ void GLRenderer::CBuffEnd() { cb.draws = std::move(s_recDraws); cb.valid = true; cb.vboReady = false; - pthread_mutex_unlock(&s_glCallMtx); s_recListId = -1; } void GLRenderer::CBuffClear(int index) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); auto it = s_chunkPool.find(index); if (it != s_chunkPool.end()) { it->second.destroy(); s_chunkPool.erase(it); } - pthread_mutex_unlock(&s_glCallMtx); } bool GLRenderer::CBuffCall(int index, bool) { - pthread_mutex_lock(&s_glCallMtx); + std::lock_guard lk(s_glCallMtx); auto it = s_chunkPool.find(index); if (it == s_chunkPool.end() || !it->second.valid) { - pthread_mutex_unlock(&s_glCallMtx); return false; } ChunkBuffer& cb = it->second; if (!cb.vboReady) { if (cb.rawVerts.empty()) { - pthread_mutex_unlock(&s_glCallMtx); return false; } @@ -1026,7 +1025,6 @@ bool GLRenderer::CBuffCall(int index, bool) { for (const auto& dc : cb.draws) glDrawArrays(dc.prim, dc.first, dc.count); glBindVertexArray(0); - pthread_mutex_unlock(&s_glCallMtx); return true; } @@ -1544,4 +1542,4 @@ void glTexGen_4J(int, int, FloatBuffer*) {} void glGetFloat(int pname, FloatBuffer* params) { glGetFloat_4J(pname, params); -} +} \ No newline at end of file From ff7baaac3b6ffe763e41c82efddd2ac4eb9afc6f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:04:46 -0500 Subject: [PATCH 093/104] nuke non-portable Windows file operations --- targets/java/src/InputOutputStream/FileInputStream.cpp | 4 ---- targets/java/src/InputOutputStream/FileOutputStream.cpp | 4 ---- .../minecraft/world/level/chunk/storage/NbtSlotFile.cpp | 7 ------- targets/minecraft/world/level/chunk/storage/ZoneFile.cpp | 7 ------- 4 files changed, 22 deletions(-) diff --git a/targets/java/src/InputOutputStream/FileInputStream.cpp b/targets/java/src/InputOutputStream/FileInputStream.cpp index 1522fdb58..a6d8d93a7 100644 --- a/targets/java/src/InputOutputStream/FileInputStream.cpp +++ b/targets/java/src/InputOutputStream/FileInputStream.cpp @@ -49,13 +49,9 @@ bool FileSeek(std::FILE* file, int64_t offset, int origin) { // SecurityException - if a security manager exists and its checkRead method // denies read access to the file. FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) { -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "rb"); -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "rb"); -#endif if (m_fileHandle == nullptr) { assert(0); diff --git a/targets/java/src/InputOutputStream/FileOutputStream.cpp b/targets/java/src/InputOutputStream/FileOutputStream.cpp index 82db3bbac..ae8971a52 100644 --- a/targets/java/src/InputOutputStream/FileOutputStream.cpp +++ b/targets/java/src/InputOutputStream/FileOutputStream.cpp @@ -26,13 +26,9 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) { return; } -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "wb"); -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "wb"); -#endif if (m_fileHandle == nullptr) { // TODO 4J Stu - Any form of error/exception handling diff --git a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp index 325ba6ced..651032e1b 100644 --- a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp @@ -6,19 +6,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } diff --git a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp index cbf5e30ed..43ed2cece 100644 --- a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp @@ -7,19 +7,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } } // namespace From b0fac9fbc68129faf327301e9dc23a9cd4e88c0d Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:12:35 -0500 Subject: [PATCH 094/104] refactor: downgrade to C++20 --- meson.build | 2 +- subprojects/packagefiles/simdutf/meson.build | 2 +- .../Scenes/Help & Options/UIScene_SkinSelectMenu.cpp | 8 ++++---- .../UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h | 2 +- targets/app/common/UI/UIController.cpp | 2 +- targets/minecraft/world/entity/player/Player.cpp | 2 +- targets/platform/thread/C4JThread.cpp | 2 +- targets/util/FrameProfiler.h | 2 +- targets/util/Timer.h | 11 ++++++----- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 5b9c20e9a..620df8762 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( version: '0.1.0', meson_version: '>= 1.3', default_options: [ - 'cpp_std=c++23', + 'cpp_std=c++20', 'warning_level=0', 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this diff --git a/subprojects/packagefiles/simdutf/meson.build b/subprojects/packagefiles/simdutf/meson.build index 573d5d8b7..f4035adeb 100644 --- a/subprojects/packagefiles/simdutf/meson.build +++ b/subprojects/packagefiles/simdutf/meson.build @@ -1,6 +1,6 @@ project('simdutf', 'cpp', - default_options: ['cpp_std=c++23'], + default_options: ['cpp_std=c++20'], version: '8.2.0', meson_version: '>= 1.1', license: ['MIT'], 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 cc4de5bff..16707e95f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -589,7 +589,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { backupTexture = getTextureId(m_skinIndex); if (m_skinIndex == - std::to_underlying(EDefaultSkins::ServerSelected)) { + static_cast(EDefaultSkins::ServerSelected)) { skinName = app.GetString(IDS_DEFAULT_SKINS); } else { skinName = wchDefaultNamesA[m_skinIndex]; @@ -908,8 +908,8 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) { ++nextSkin; if (m_packIndex == SKIN_SELECT_PACK_DEFAULT && - nextSkin >= std::to_underlying(EDefaultSkins::Count)) { - nextSkin = std::to_underlying(EDefaultSkins::ServerSelected); + nextSkin >= static_cast(EDefaultSkins::Count)) { + nextSkin = static_cast(EDefaultSkins::ServerSelected); } else if (m_currentPack != nullptr && nextSkin >= m_currentPack->getSkinCount()) { nextSkin = 0; @@ -933,7 +933,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) { default: if (previousSkin == 0) { if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) { - previousSkin = std::to_underlying(EDefaultSkins::Count) - 1; + previousSkin = static_cast(EDefaultSkins::Count) - 1; } else if (m_currentPack != nullptr) { previousSkin = m_currentPack->getSkinCount() - 1; } 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 b7e9299bf..5e9027f0f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -25,7 +25,7 @@ class UILayer; class UIScene_SkinSelectMenu : public UIScene { private: static const char* - wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; + wchDefaultNamesA[static_cast(EDefaultSkins::Count)]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 21db28c7a..12d91628d 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -1268,7 +1268,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void* initData, setFullscreenMenuDisplayed(true); } - std::println(stderr, "TIMER: Navigate to scene: Elapsed time {:.6f}", + fprintf(stderr, "TIMER: Navigate to scene: Elapsed time %.6f", timer.elapsed_seconds()); return success; diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 2c04410a1..26ec1cb79 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -535,7 +535,7 @@ void Player::ride(std::shared_ptr e) { void Player::setPlayerDefaultSkin(EDefaultSkins skin) { #if !defined(_CONTENT_PACKAGE) printf("Setting default skin to %d for player %s\n", - std::to_underlying(skin), name.c_str()); + static_cast(skin), name.c_str()); #endif m_skinIndex = skin; } diff --git a/targets/platform/thread/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp index b469ee17d..c253cf7c9 100644 --- a/targets/platform/thread/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -140,7 +140,7 @@ void setPriorityPlatform(std::thread& threadHandle, bool isSelf, handle = ::GetCurrentThread(); else return; - (void)::SetThreadPriority(handle, std::to_underlying(priority)); + (void)::SetThreadPriority(handle, static_cast(priority)); #elif defined(__linux__) std::int64_t tid = 0; diff --git a/targets/util/FrameProfiler.h b/targets/util/FrameProfiler.h index 71fa01937..b39edbc6a 100644 --- a/targets/util/FrameProfiler.h +++ b/targets/util/FrameProfiler.h @@ -40,7 +40,7 @@ public: [[nodiscard]] static constexpr std::size_t BucketIndex( Bucket bucket) noexcept { - return static_cast(std::to_underlying(bucket)); + return static_cast(bucket); } [[nodiscard]] static constexpr std::size_t BucketCount() noexcept { diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 5738d0a0c..60aee1338 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -81,11 +81,12 @@ public: std::chrono::duration(elapsed).count(); try { - name_.empty() - ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", ms, file_, - line_) - : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", name_, - ms, file_, line_); + const auto log = + name_.empty() ? std::format("[TIMER] {:.3f} ms ({}:{})\n", ms, + file_, line_) + : std::format("[TIMER] {} - {:.3f} ms ({}:{})\n", + name_, ms, file_, line_); + std::fputs(log.c_str(), stderr); } catch (...) { std::fprintf(stderr, "[TIMER] %.3f ms\n", ms); } From a399023cca818ad58005220a62b7dedf0727b71f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 16:27:00 -0700 Subject: [PATCH 095/104] refactor: switch to glew for OpenGL loading --- meson.build | 2 +- subprojects/glew.wrap | 12 +++ .../UIScene_CreateWorldMenu.cpp | 7 -- targets/platform/renderer/gl/GLRenderer.cpp | 34 -------- targets/platform/renderer/gl/gl3_loader.h | 37 ++++----- targets/platform/renderer/gl/gl_compat.h | 2 +- targets/platform/renderer/meson.build | 2 +- targets/platform/stubs.h | 3 +- targets/platform/thread/C4JThread.cpp | 78 ++++++++++--------- 9 files changed, 73 insertions(+), 104 deletions(-) create mode 100644 subprojects/glew.wrap diff --git a/meson.build b/meson.build index 620df8762..0e9f62b38 100644 --- a/meson.build +++ b/meson.build @@ -22,7 +22,7 @@ python = pymod.find_installation('python3', required: true) cc = meson.get_compiler('cpp') -global_cpp_args = ['-Wshift-count-overflow', '-pipe'] +global_cpp_args = [] global_cpp_defs = [ '-DSPLIT_SAVES', '-D_LARGE_WORLDS', diff --git a/subprojects/glew.wrap b/subprojects/glew.wrap new file mode 100644 index 000000000..390dc9a33 --- /dev/null +++ b/subprojects/glew.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = glew-2.2.0 +source_url = http://downloads.sourceforge.net/glew/glew-2.2.0.tgz +source_filename = glew-2.2.0.tgz +source_hash = d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1 +patch_filename = glew_2.2.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glew_2.2.0-2/get_patch +patch_hash = df7bc80456da53f83e93e89ca5035d04cdff19a836c956887a684b2bee16eb9b +wrapdb_version = 2.2.0-2 + +[provide] +glew = glew_dep 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 6fb96d952..9c2fd82f9 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 @@ -38,13 +38,6 @@ #include "strings.h" #include "util/StringHelpers.h" -#if defined(_WINDOWS64) - -#include - -#include "../../../../../Windows64/Resource.h" -#endif - #define GAME_CREATE_ONLINE_TIMER_ID 0 #define GAME_CREATE_ONLINE_TIMER_TIME 100 diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 3a509de6c..1e1ef038d 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -1403,40 +1403,6 @@ void glDeleteTextures_4J(int n, const unsigned int* textures) { ::glDeleteTextures(n, textures); } -// c hooks -#undef glFogfv -#undef glLightfv -#undef glLightModelfv -#undef glShadeModel -#undef glColorMaterial -#undef glNormal3f - -extern "C" { -void glFogfv(GLenum pname, const GLfloat* params) { - if (pname == 0x0B66) - PlatformRenderer.StateSetFogColour(params[0], params[1], params[2]); -} -void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { - if (pname == 0x1203) - PlatformRenderer.StateSetLightDirection( - light == 0x4000 ? 0 : 1, params[0], params[1], params[2]); - else if (pname == 0x1200) - PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); - else if (pname == 0x1201) - PlatformRenderer.StateSetLightColour(light == 0x4000 ? 0 : 1, params[0], - params[1], params[2]); -} -void glLightModelfv(GLenum pname, const GLfloat* params) { - if (pname == 0x0B53) - PlatformRenderer.StateSetLightAmbientColour(params[0], params[1], - params[2]); -} -void glShadeModel(GLenum) {} -void glColorMaterial(GLenum, GLenum) {} -void glNormal3f(GLfloat, GLfloat, GLfloat) {} -} - // MARK: LinuxStubs #ifdef GLES diff --git a/targets/platform/renderer/gl/gl3_loader.h b/targets/platform/renderer/gl/gl3_loader.h index bb03b3aad..0fcc9d096 100644 --- a/targets/platform/renderer/gl/gl3_loader.h +++ b/targets/platform/renderer/gl/gl3_loader.h @@ -2,18 +2,16 @@ // windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, // which can only be found in the Windows API -#ifdef _WIN32 +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #endif -#ifndef GL_GLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES 1 -#endif -#include -// #include +#include #include + #ifndef GL_ARRAY_BUFFER #define GL_ARRAY_BUFFER 0x8892 #endif @@ -32,24 +30,21 @@ #ifndef GL_QUADS #define GL_QUADS 0x0007 #endif + static inline bool gl3_load() { - const char* ver = (const char*)glGetString(GL_VERSION); - if (!ver) { - fprintf(stderr, "[gl3_loader] ERROR: No active GL context found.\n"); + GLenum err = glewInit(); + if (err != GLEW_OK) { + fprintf(stderr, "[gl_loader] ERROR: glewInit failed: %s\n", + glewGetErrorString(err)); return false; } - int major = 0, minor = 0; - if (sscanf(ver, "%d.%d", &major, &minor) >= 2) { - if (major < 3 || (major == 3 && minor < 3)) { - fprintf(stderr, - "[gl3_loader] ERROR: Need GL 3.3, but system provides %s\n", - ver); - return false; - } + + if (!GLEW_VERSION_3_3) { + fprintf(stderr, "[gl_loader] ERROR: Need GL 3.3, not supported.\n"); + return false; } - fprintf( - stderr, - "[gl3_loader] GL Version: %s, it's all okay!! until android support.\n", - ver); + + fprintf(stderr, "[gl_loader] GL %s loaded successfully.\n", + (const char*)glewGetString(GLEW_VERSION)); return true; } \ No newline at end of file diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index df64fed1a..658c6cd6b 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -14,7 +14,7 @@ // rendering files compiling without dragging the concrete GLRenderer // class into every minecraft TU. -#include "gl3_loader.h" +// #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two #include diff --git a/targets/platform/renderer/meson.build b/targets/platform/renderer/meson.build index cd9998ab1..5622bd7b9 100644 --- a/targets/platform/renderer/meson.build +++ b/targets/platform/renderer/meson.build @@ -10,7 +10,7 @@ if get_option('renderer') == 'gles' platform_renderer_gl_dependencies += dependency('glesv2') platform_renderer_gl_defs = ['-DGLES'] else - platform_renderer_gl_dependencies += dependency('gl') + platform_renderer_gl_dependencies += [dependency('gl'), dependency('glew')] platform_renderer_gl_defs = [] endif diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 49dd2a7e9..0c4c87021 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -2,8 +2,9 @@ // windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations, // which can only be found in the Windows API -#ifdef _WIN32 +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #endif diff --git a/targets/platform/thread/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp index c253cf7c9..36067b5d1 100644 --- a/targets/platform/thread/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -15,7 +15,9 @@ #include #if defined(_WIN32) -#include +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include #endif #if defined(__linux__) @@ -82,46 +84,46 @@ std::int64_t getNativeThreadId() { void setThreadNamePlatform([[maybe_unused]] std::uint32_t threadId, [[maybe_unused]] const char* name) { -#if defined(_WIN32) - // Try modern API first (Windows 10 1607+). - if (threadId == static_cast(-1) || - threadId == ::GetCurrentThreadId()) { - using SetThreadDescriptionFn = int32_t(WINAPI*)(void*, PCWSTR); - const HMODULE kernel = ::GetModuleHandleW("Kernel32.dll"); - if (kernel) { - const auto fn = reinterpret_cast( - ::GetProcAddress(kernel, "SetThreadDescription")); - if (fn) { - char wide[64]; - const auto n = std::strncpy( - wide, name, (sizeof(wide) / sizeof(wide[0])) - 1); - if (n != static_cast(-1)) { - wide[n] = '\0'; - (void)fn(::GetCurrentThread(), wide); - return; - } - } - } - } +// #if defined(_WIN32) +// // Try modern API first (Windows 10 1607+). +// if (threadId == static_cast(-1) || +// threadId == ::GetCurrentThreadId()) { +// using SetThreadDescriptionFn = int32_t(WINAPI*)(void*, PCWSTR); +// const HMODULE kernel = ::GetModuleHandleA("Kernel32.dll"); +// if (kernel) { +// const auto fn = reinterpret_cast( +// ::GetProcAddress(kernel, "SetThreadDescription")); +// if (fn) { +// char wide[64]; +// const auto n = std::strncpy( +// wide, name, (sizeof(wide) / sizeof(wide[0])) - 1); +// if (n != static_cast(-1)) { +// wide[n] = '\0'; +// (void)fn(::GetCurrentThread(), wide); +// return; +// } +// } +// } +// } - // Legacy fallback: raise exception 0x406D1388 for older MSVC debuggers. -#pragma pack(push, 8) - struct THREADNAME_INFO { - std::uint32_t dwType; - const char* szName; - std::uint32_t dwThreadID; - std::uint32_t dwFlags; - }; -#pragma pack(pop) +// // Legacy fallback: raise exception 0x406D1388 for older MSVC debuggers. +// #pragma pack(push, 8) +// struct THREADNAME_INFO { +// std::uint32_t dwType; +// const char* szName; +// std::uint32_t dwThreadID; +// std::uint32_t dwFlags; +// }; +// #pragma pack(pop) - THREADNAME_INFO info{0x1000, name, threadId, 0}; - __try { - ::RaiseException(0x406D1388, 0, sizeof(info) / sizeof(uintptr_t), - reinterpret_cast(&info)); - } __except (EXCEPTION_EXECUTE_HANDLER) { - } +// THREADNAME_INFO info{0x1000, name, threadId, 0}; +// __try { +// ::RaiseException(0x406D1388, 0, sizeof(info) / sizeof(uintptr_t), +// reinterpret_cast(&info)); +// } __except (EXCEPTION_EXECUTE_HANDLER) { +// } -#elif defined(__linux__) +#if defined(__linux__) // pthread_setname_np limit: 16 chars including null terminator. char truncated[16]; std::snprintf(truncated, sizeof(truncated), "%s", name); From c58c1bd9d207b262f48a4db3f578e586b5db7f13 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:09:25 -0700 Subject: [PATCH 096/104] fix: MSVC build fixes --- targets/app/common/UI/UIController.h | 4 +- targets/minecraft/client/Minecraft.cpp | 20 ++++------ .../client/gui/SelectWorldScreen.cpp | 16 ++++---- .../gui/achievement/AchievementPopup.cpp | 1 + .../minecraft/client/model/HumanoidModel.cpp | 40 +++++++++---------- .../ConsoleSaveFileSplit.cpp | 25 ++++++------ targets/platform/renderer/gl/gl_compat.h | 5 +++ targets/util/Timer.h | 1 - 8 files changed, 57 insertions(+), 55 deletions(-) diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index b44e3b873..90b08f3dc 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -36,7 +36,7 @@ class UIScene; // 4jcraft, used to be D3D11_RECT. // This was the only class that used it, so it's here now. -struct RECT { +struct 4J_RECT { long left; long top; long right; @@ -190,7 +190,7 @@ private: int m_accumulatedTicks; uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect - RECT m_customRenderingClearRect; + 4J_RECT m_customRenderingClearRect; std::unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index efecfa163..4f93d8d04 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -1119,21 +1119,15 @@ void Minecraft::run_middle() { #if !defined(_CONTENT_PACKAGE) { // print the time - auto now_tp = std::chrono:: - system_clock::now(); - std::time_t now_tt = std::chrono:: - system_clock::to_time_t(now_tp); - std::tm utcTime{}; -#if defined(_WIN32) - gmtime_s(&utcTime, &now_tt); -#else - gmtime_r(&now_tt, &utcTime); -#endif + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::hh_mm_ss hms{std::chrono::floor(now - dp)}; Log::info("%02d:%02d:%02d\n", - utcTime.tm_hour, - utcTime.tm_min, - utcTime.tm_sec); + (int)hms.hours().count(), + (int)hms.minutes().count(), + (int)hms.seconds().count()); + } #endif } else { diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index cc78b1386..b73c00162 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -268,15 +268,17 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, levelSummary->getLastPlayed() - kFileTimeEpochToUnixEpochMs; const auto tp = std::chrono::system_clock::time_point{ std::chrono::milliseconds{lastPlayedUnixMs}}; - time_t lastPlayedTime = std::chrono::system_clock::to_time_t(tp); - std::tm utc; - gmtime_r(&lastPlayedTime, &utc); + auto dp = std::chrono::floor(tp); + std::chrono::year_month_day ymd{dp}; + std::chrono::hh_mm_ss hms{ + std::chrono::floor(tp - dp)}; - char buffer[20]; // 4J Stu - Currently shows years as 4 digits, where java only showed 2 - snprintf(buffer, 20, "%d/%d/%d %d:%02d", utc.tm_mday, utc.tm_mon + 1, - utc.tm_year + 1900, utc.tm_hour, - utc.tm_min); // 4J - TODO Localise this + // 4J - TODO Localise this + id += std::format(" ({}/{}/{} {}:{:02d}", (unsigned)ymd.day(), + (unsigned)ymd.month(), (int)ymd.year(), + (int)hms.hours().count(), (int)hms.minutes().count()); + id = id + " (" + buffer; int64_t size = levelSummary->getSizeOnDisk(); diff --git a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp index 789c06100..62ac5def1 100644 --- a/targets/minecraft/client/gui/achievement/AchievementPopup.cpp +++ b/targets/minecraft/client/gui/achievement/AchievementPopup.cpp @@ -8,6 +8,7 @@ #include "minecraft/client/renderer/entity/ItemRenderer.h" #include "minecraft/locale/I18n.h" #include "minecraft/stats/Achievement.h" +#include "minecraft/SharedConstants.h" #include "platform/renderer/renderer.h" #include "platform/stubs.h" diff --git a/targets/minecraft/client/model/HumanoidModel.cpp b/targets/minecraft/client/model/HumanoidModel.cpp index 355e0a9b0..f21e2f572 100644 --- a/targets/minecraft/client/model/HumanoidModel.cpp +++ b/targets/minecraft/client/model/HumanoidModel.cpp @@ -218,8 +218,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, arm1->zRot = 0.0f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront)) { - arm0->xRot = -M_PI_2; - arm1->xRot = -M_PI_2; + arm0->xRot = -(std::numbers::pi / 2.0); + arm1->xRot = -(std::numbers::pi / 2.0); arm0->zRot = 0.0f; arm1->zRot = 0.0f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleArms)) { @@ -256,23 +256,23 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, if (riding) { if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) { - arm0->xRot += -M_PI_2 * 0.4f; - arm1->xRot += -M_PI_2 * 0.4f; - leg0->xRot = -M_PI_2 * 0.8f; - leg1->xRot = -M_PI_2 * 0.8f; - leg0->yRot = M_PI_2 * 0.2f; - leg1->yRot = -M_PI_2 * 0.2f; + arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f; + arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f; + leg0->xRot = -(std::numbers::pi / 2.0) * 0.8f; + leg1->xRot = -(std::numbers::pi / 2.0) * 0.8f; + leg0->yRot = (std::numbers::pi / 2.0) * 0.2f; + leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f; } else { - arm0->xRot += -M_PI_2 * 0.4f; - arm1->xRot += -M_PI_2 * 0.4f; - leg0->xRot = -M_PI_2 * 0.4f; - leg1->xRot = -M_PI_2 * 0.4f; + arm0->xRot += -(std::numbers::pi / 2.0) * 0.4f; + arm1->xRot += -(std::numbers::pi / 2.0) * 0.4f; + leg0->xRot = -(std::numbers::pi / 2.0) * 0.4f; + leg1->xRot = -(std::numbers::pi / 2.0) * 0.4f; } } else if (idle && !sneaking) { - leg0->xRot = -M_PI_2; - leg1->xRot = -M_PI_2; - leg0->yRot = M_PI_2 * 0.2f; - leg1->yRot = -M_PI_2 * 0.2f; + leg0->xRot = -(std::numbers::pi / 2.0); + leg1->xRot = -(std::numbers::pi / 2.0); + leg0->yRot = (std::numbers::pi / 2.0) * 0.2f; + leg1->yRot = -(std::numbers::pi / 2.0) * 0.2f; } else if (uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim)) { leg0->xRot = 0.0f; leg0->zRot = 0.0f; @@ -289,10 +289,10 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, } if (holdingLeftHand != 0) { - arm1->xRot = arm1->xRot * 0.5f - M_PI_2 * 0.2f * holdingLeftHand; + arm1->xRot = arm1->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingLeftHand; } if (holdingRightHand != 0) { - arm0->xRot = arm0->xRot * 0.5f - M_PI_2 * 0.2f * holdingRightHand; + arm0->xRot = arm0->xRot * 0.5f - (std::numbers::pi / 2.0) * 0.2f * holdingRightHand; } arm0->yRot = 0.0f; @@ -425,8 +425,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, arm1->zRot = 0.0f; arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot; arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f; - arm0->xRot = -M_PI_2 + head->xRot; - arm1->xRot = -M_PI_2 + head->xRot; + arm0->xRot = -(std::numbers::pi / 2.0) + head->xRot; + arm1->xRot = -(std::numbers::pi / 2.0) + head->xRot; arm0->xRot -= attack2 * 1.2f - attack * 0.4f; arm1->xRot -= attack2 * 1.2f - attack * 0.4f; arm0->zRot += ((float)(cosf(bob * 0.09f)) * 0.05f + 0.05f); diff --git a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 40fcd3baf..ee31dc710 100644 --- a/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/targets/minecraft/world/level/storage/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -1354,14 +1354,11 @@ void ConsoleSaveFileSplit::DebugFlushToFile( char* fileName = new char[XCONTENT_MAX_FILENAME_LENGTH + 1]; - auto now_tp = std::chrono::system_clock::now(); - std::time_t now_tt = std::chrono::system_clock::to_time_t(now_tp); - std::tm t{}; -#if defined(_WIN32) - gmtime_s(&t, &now_tt); -#else - gmtime_r(&now_tt, &t); -#endif + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + std::chrono::hh_mm_ss hms{ + std::chrono::floor(now - dp)}; // 14 chars for the digits // 11 chars for the separators + suffix @@ -1370,10 +1367,14 @@ void ConsoleSaveFileSplit::DebugFlushToFile( if (m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) { cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); } - snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, - "\\v%04d-%s%02d.%02d.%02d.%02d.%02d.mcs", VER_PRODUCTBUILD, - cutFileName.c_str(), t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, - t.tm_sec); + + auto result = + std::format("\\v{:04d}-{}{:02d}.{:02d}.{:02d}.{:02d}.{:02d}.mcs", + VER_PRODUCTBUILD, cutFileName, (unsigned)ymd.month(), + (unsigned)ymd.day(), (int)hms.hours().count(), + (int)hms.minutes().count(), (int)hms.seconds().count()); + + snprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, "%s", result.c_str()); const std::string outputPath = targetFileDir.getPath() + std::string(fileName); diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index 658c6cd6b..296030895 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -257,6 +257,11 @@ #define GL_TRIANGLE_STRIP 0x0005 #endif +#ifndef GL_RESCALE_NORMAL +#define GL_RESCALE_NORMAL 0x803A +#endif + + // glCallList / display list macros #undef glNewList #define glNewList(_list, _mode) PlatformRenderer.CBuffStart(_list) diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 60aee1338..915ae4768 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include From c432e83d18dba4aa4404c4ace4f933e733076c8d Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 19:12:57 -0700 Subject: [PATCH 097/104] fix: make it build on windows --- meson.build | 2 +- targets/app/common/Game_XuiActions.cpp | 1 + targets/app/common/Iggy/gdraw/gdraw.c | 50 +++++++++++-------- targets/app/common/Iggy/include/iggy.h | 13 ++++- targets/app/common/LocalizationManager.cpp | 1 + targets/app/common/MenuController.cpp | 1 + targets/app/common/NetworkController.cpp | 1 + .../UIScene_MainMenu.cpp | 23 +++++---- targets/app/common/UI/UIController.h | 4 +- targets/app/desktop/main.cpp | 1 - targets/app/meson.build | 1 + .../client/gui/SelectWorldScreen.cpp | 2 - .../minecraft/client/player/LocalPlayer.cpp | 1 + .../minecraft/client/title/TitleScreen.cpp | 21 ++++---- targets/minecraft/meson.build | 1 + targets/minecraft/world/Container.h | 1 + targets/platform/renderer/gl/GLRenderer.cpp | 2 - targets/platform/renderer/gl/GLRenderer.h | 1 - targets/platform/renderer/gl/gl_compat.h | 34 ++++--------- targets/platform/stubs.h | 1 - 20 files changed, 85 insertions(+), 77 deletions(-) diff --git a/meson.build b/meson.build index 0e9f62b38..a90574ce0 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project( 'warning_level=0', 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this - 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE + # 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE 'b_pch=true', # precompiled headers # 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) # 'b_ndebug=if-release', # drop assert() in --buildtype=release diff --git a/targets/app/common/Game_XuiActions.cpp b/targets/app/common/Game_XuiActions.cpp index 2e244ea1b..3b100537c 100644 --- a/targets/app/common/Game_XuiActions.cpp +++ b/targets/app/common/Game_XuiActions.cpp @@ -32,6 +32,7 @@ #include "platform/profile/profile.h" #include "platform/storage/storage.h" #include "util/StringHelpers.h" +#include "strings.h" void Game::HandleXuiActions(void) { eXuiAction eAction; diff --git a/targets/app/common/Iggy/gdraw/gdraw.c b/targets/app/common/Iggy/gdraw/gdraw.c index add6fd2b4..45fc181a7 100644 --- a/targets/app/common/Iggy/gdraw/gdraw.c +++ b/targets/app/common/Iggy/gdraw/gdraw.c @@ -1,8 +1,12 @@ #define GDRAW_ASSERTS #include "gdraw.h" - -#include +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif +#include #include #include #include @@ -128,33 +132,33 @@ typedef gdraw_gl_resourcetype gdraw_resourcetype; GDRAW_GL_EXTENSION_LIST #undef GLE -typedef const GLubyte*(APIENTRYP PFNGLGETSTRINGIPROC_)(GLenum name, +typedef const GLubyte*(APIENTRY* PFNGLGETSTRINGIPROC_)(GLenum name, GLuint index); static PFNGLGETSTRINGIPROC_ gdraw_glGetStringi = NULL; -typedef void(APIENTRYP PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays); -typedef void(APIENTRYP PFNGLBINDVERTEXARRAYPROC_)(GLuint array); +typedef void(APIENTRY* PFNGLGENVERTEXARRAYSPROC_)(GLsizei n, GLuint* arrays); +typedef void(APIENTRY* PFNGLBINDVERTEXARRAYPROC_)(GLuint array); static PFNGLGENVERTEXARRAYSPROC_ gdraw_glGenVertexArrays = NULL; static PFNGLBINDVERTEXARRAYPROC_ gdraw_glBindVertexArray = NULL; static GLuint gdraw_vao = 0; -typedef void(APIENTRYP gdraw_vtxattrib_fn)(GLuint, GLint, GLenum, GLboolean, +typedef void(APIENTRY* gdraw_vtxattrib_fn)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void*); static gdraw_vtxattrib_fn gdraw_real_vtxattrib = NULL; static GLuint gdraw_screenvbo = 0; static const void* gdraw_screenvbo_base = NULL; static size_t gdraw_expected_vbo_size = 0; -typedef void(APIENTRYP gdraw_drawelements_fn)(GLenum mode, GLsizei count, +typedef void(APIENTRY* gdraw_drawelements_fn)(GLenum mode, GLsizei count, GLenum type, const void* indices); static gdraw_drawelements_fn gdraw_real_drawelements = NULL; static GLuint gdraw_screenibo = 0; -typedef GLuint(APIENTRYP gdraw_createshader_fn)(GLenum); -typedef void(APIENTRYP gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**, +typedef GLuint(APIENTRY* gdraw_createshader_fn)(GLenum); +typedef void(APIENTRY* gdraw_shadersource_fn)(GLuint, GLsizei, const GLchar**, const GLint*); -typedef void(APIENTRYP gdraw_compileshader_fn)(GLuint); -typedef void(APIENTRYP gdraw_linkprogram_fn)(GLuint); +typedef void(APIENTRY* gdraw_compileshader_fn)(GLuint); +typedef void(APIENTRY* gdraw_linkprogram_fn)(GLuint); static gdraw_createshader_fn gdraw_real_createshader = NULL; static gdraw_shadersource_fn gdraw_real_shadersource = NULL; static gdraw_compileshader_fn gdraw_real_compileshader = NULL; @@ -162,24 +166,24 @@ static gdraw_linkprogram_fn gdraw_real_linkprogram = NULL; // some core reject p0 -typedef void(APIENTRYP gdraw_useprogram_fn)(GLuint); +typedef void(APIENTRY* gdraw_useprogram_fn)(GLuint); static gdraw_useprogram_fn gdraw_real_useprogram = NULL; static GLuint gdraw_null_program = 0; -typedef void(APIENTRYP gdraw_teximage2d_fn)(GLenum, GLint, GLint, GLsizei, +typedef void(APIENTRY* gdraw_teximage2d_fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); -typedef void(APIENTRYP gdraw_texsubimage2d_fn)(GLenum, GLint, GLint, GLint, +typedef void(APIENTRY* gdraw_texsubimage2d_fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); static gdraw_teximage2d_fn gdraw_real_teximage2d = NULL; static gdraw_texsubimage2d_fn gdraw_real_texsubimage2d = NULL; -#define TRY(ptr, arb, core) \ - do { \ +#define TRY(ptr, arb, core) \ + do { \ void* _p = SDL_GL_GetProcAddress(core); \ if (!_p) _p = SDL_GL_GetProcAddress(arb); \ - *(void**)&(ptr) = _p; \ + *(void**)&(ptr) = _p; \ } while (0) static void load_extensions(void) { @@ -254,15 +258,19 @@ static void load_extensions(void) { (gdraw_shadersource_fn)SDL_GL_GetProcAddress("glShaderSource"); gdraw_real_compileshader = (gdraw_compileshader_fn)SDL_GL_GetProcAddress("glCompileShader"); - gdraw_real_linkprogram = (gdraw_linkprogram_fn)SDL_GL_GetProcAddress("glLinkProgram"); - gdraw_real_teximage2d = (gdraw_teximage2d_fn)SDL_GL_GetProcAddress("glTexImage2D"); + gdraw_real_linkprogram = + (gdraw_linkprogram_fn)SDL_GL_GetProcAddress("glLinkProgram"); + gdraw_real_teximage2d = + (gdraw_teximage2d_fn)SDL_GL_GetProcAddress("glTexImage2D"); gdraw_real_texsubimage2d = (gdraw_texsubimage2d_fn)SDL_GL_GetProcAddress("glTexSubImage2D"); - gdraw_real_useprogram = (gdraw_useprogram_fn)SDL_GL_GetProcAddress("glUseProgram"); + gdraw_real_useprogram = + (gdraw_useprogram_fn)SDL_GL_GetProcAddress("glUseProgram"); gdraw_real_drawelements = (gdraw_drawelements_fn)SDL_GL_GetProcAddress("glDrawElements"); - gdraw_glGetStringi = (PFNGLGETSTRINGIPROC_)SDL_GL_GetProcAddress("glGetStringi"); + gdraw_glGetStringi = + (PFNGLGETSTRINGIPROC_)SDL_GL_GetProcAddress("glGetStringi"); gdraw_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC_)SDL_GL_GetProcAddress("glGenVertexArrays"); gdraw_glBindVertexArray = diff --git a/targets/app/common/Iggy/include/iggy.h b/targets/app/common/Iggy/include/iggy.h index 5d4d43027..3af8392d3 100644 --- a/targets/app/common/Iggy/include/iggy.h +++ b/targets/app/common/Iggy/include/iggy.h @@ -10,6 +10,15 @@ #include "rrCore.h" // base data types, macros +// on windows, these will cause MSVC to shit itself due to thinking +// the stubbed iggy symbols are DLL-exported. +#ifndef _ENABLEIGGY +#undef RADEXPFUNC +#undef RADEXPLINK +#define RADEXPFUNC +#define RADEXPLINK +#endif + RADDEFSTART #ifndef IGGY_GDRAW_SHARED_TYPEDEF @@ -123,8 +132,8 @@ typedef enum IggyDatatype { /* Describes an AS3 datatype visible through iggy interface. */ #ifdef __RADWIN__ -#include -IDOCN typedef char IggyUTF16; +#include +IDOCN typedef char16_t IggyUTF16; #else #include typedef const char16_t IggyUTF16; diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index c84713ef4..6bb202513 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -21,6 +21,7 @@ #include "platform/renderer/renderer.h" #include "strings.h" #include "util/StringHelpers.h" +#include "app/common/ui/ConsoleUIController.h" int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {20, 13, 20, 26}; diff --git a/targets/app/common/MenuController.cpp b/targets/app/common/MenuController.cpp index 5b1257e7e..b19059bc9 100644 --- a/targets/app/common/MenuController.cpp +++ b/targets/app/common/MenuController.cpp @@ -24,6 +24,7 @@ #include "minecraft/world/level/tile/entity/HopperTileEntity.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "strings.h" unsigned char MenuController::m_szPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10}; diff --git a/targets/app/common/NetworkController.cpp b/targets/app/common/NetworkController.cpp index e7e309a03..c8936af11 100644 --- a/targets/app/common/NetworkController.cpp +++ b/targets/app/common/NetworkController.cpp @@ -21,6 +21,7 @@ #include "platform/input/input.h" #include "platform/profile/profile.h" #include "platform/storage/storage.h" +#include "strings.h" unsigned int NetworkController::m_uiLastSignInData = 0; 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 a0ea8582f..ef4788ffb 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 @@ -176,21 +176,22 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { random->nextInt((int)m_splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - const std::time_t now = - std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - std::tm localTime; - localtime_r(&now, &localTime); - const int month = localTime.tm_mon + 1; // tm_mon is 0-based - const int day = localTime.tm_mday; - if (month == 11 && day == 9) { + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + const auto month = ymd.month(); + const uint32_t day = static_cast(ymd.day()); + + if (month == std::chrono::November && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (month == 6 && day == 1) { + } else if (month == std::chrono::June && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (month == 12 && day == 24) // the Java game shows this on - // Christmas Eve, so we will too + } else if (month == std::chrono::December && + day == 24) // the Java game shows this on + // Christmas Eve, so we will too { splashIndex = eSplashMerryXmas; - } else if (month == 1 && day == 1) { + } else if (month == std::chrono::January && day == 1) { splashIndex = eSplashHappyNewYear; } // splashIndex = 47; // Very short string diff --git a/targets/app/common/UI/UIController.h b/targets/app/common/UI/UIController.h index 90b08f3dc..3082fe34a 100644 --- a/targets/app/common/UI/UIController.h +++ b/targets/app/common/UI/UIController.h @@ -36,7 +36,7 @@ class UIScene; // 4jcraft, used to be D3D11_RECT. // This was the only class that used it, so it's here now. -struct 4J_RECT { +struct RECT_4J { long left; long top; long right; @@ -190,7 +190,7 @@ private: int m_accumulatedTicks; uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect - 4J_RECT m_customRenderingClearRect; + RECT_4J m_customRenderingClearRect; std::unordered_map m_registeredCallbackScenes; // A collection of scenes and unique id's diff --git a/targets/app/desktop/main.cpp b/targets/app/desktop/main.cpp index 478f68959..5799856be 100644 --- a/targets/app/desktop/main.cpp +++ b/targets/app/desktop/main.cpp @@ -40,7 +40,6 @@ static void sigsegv_handler(int sig) { _exit(139); } #endif -#include #include #include #include diff --git a/targets/app/meson.build b/targets/app/meson.build index de62035fc..ec3a3b41f 100644 --- a/targets/app/meson.build +++ b/targets/app/meson.build @@ -27,6 +27,7 @@ app_dependencies += [ dependency('miniaudio'), # todo: remove once PlatformSound is used dependency('stb'), dependency('simdutf'), + dependency('glew'), # TODO remove java_dep, nbt_dep, util_dep, diff --git a/targets/minecraft/client/gui/SelectWorldScreen.cpp b/targets/minecraft/client/gui/SelectWorldScreen.cpp index b73c00162..310826442 100644 --- a/targets/minecraft/client/gui/SelectWorldScreen.cpp +++ b/targets/minecraft/client/gui/SelectWorldScreen.cpp @@ -279,8 +279,6 @@ void SelectWorldScreen::WorldSelectionList::renderItem(int i, int x, int y, (unsigned)ymd.month(), (int)ymd.year(), (int)hms.hours().count(), (int)hms.minutes().count()); - id = id + " (" + buffer; - int64_t size = levelSummary->getSizeOnDisk(); id = id + ", " + toWString(size / 1024 * 100 / 1024 / 100.0f) + " MB)"; diff --git a/targets/minecraft/client/player/LocalPlayer.cpp b/targets/minecraft/client/player/LocalPlayer.cpp index 45a09d9fb..0febaf741 100644 --- a/targets/minecraft/client/player/LocalPlayer.cpp +++ b/targets/minecraft/client/player/LocalPlayer.cpp @@ -65,6 +65,7 @@ #include "minecraft/world/entity/player/Abilities.h" #include "minecraft/world/entity/player/Inventory.h" #include "minecraft/world/entity/player/Player.h" +#include "minecraft/world/entity/item/MinecartHopper.h" #include "minecraft/world/food/FoodConstants.h" #include "minecraft/world/food/FoodData.h" #include "minecraft/world/item/BowItem.h" diff --git a/targets/minecraft/client/title/TitleScreen.cpp b/targets/minecraft/client/title/TitleScreen.cpp index 43ca00fb9..eaeb70359 100644 --- a/targets/minecraft/client/title/TitleScreen.cpp +++ b/targets/minecraft/client/title/TitleScreen.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "java/InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/ByteArrayInputStream.h" @@ -68,20 +69,20 @@ TitleScreen::TitleScreen() { random->nextInt((int)splashes.size() - (eSplashRandomStart + 1)); // Override splash text on certain dates - const auto now = std::chrono::system_clock::now(); - const auto t = std::chrono::system_clock::to_time_t(now); - std::tm localTime; - localtime_r(&t, &localTime); - const int month = localTime.tm_mon + 1; // tm_mon is 0-based - const int day = localTime.tm_mday; - if (month == 11 && day == 9) { + auto now = std::chrono::system_clock::now(); + auto dp = std::chrono::floor(now); + std::chrono::year_month_day ymd{dp}; + const auto month = ymd.month(); + const uint32_t day = static_cast(ymd.day()); + + if (month == std::chrono::November && day == 9) { splashIndex = eSplashHappyBirthdayEx; - } else if (month == 6 && day == 1) { + } else if (month == std::chrono::June && day == 1) { splashIndex = eSplashHappyBirthdayNotch; - } else if (month == 12 && day == 24) { + } else if (month == std::chrono::December && day == 24) { // the Java game shows this on Christmas Eve, so we will too splashIndex = eSplashMerryXmas; - } else if (month == 1 && day == 1) { + } else if (month == std::chrono::January && day == 1) { splashIndex = eSplashHappyNewYear; } diff --git a/targets/minecraft/meson.build b/targets/minecraft/meson.build index 6c3708106..b8f25499c 100644 --- a/targets/minecraft/meson.build +++ b/targets/minecraft/meson.build @@ -12,6 +12,7 @@ lib_minecraft = static_library('minecraft', # dependency('libcrypto'), # for MD5 in Hasher.cpp on Linux dependency('zlib'), dependency('glm'), + dependency('glew'), # TODO remove nbt_dep, java_dep, util_dep, diff --git a/targets/minecraft/world/Container.h b/targets/minecraft/world/Container.h index b86b9de8e..82ec0632c 100644 --- a/targets/minecraft/world/Container.h +++ b/targets/minecraft/world/Container.h @@ -2,6 +2,7 @@ #include #include +#include class ItemInstance; class Player; diff --git a/targets/platform/renderer/gl/GLRenderer.cpp b/targets/platform/renderer/gl/GLRenderer.cpp index 1e1ef038d..c4c0555be 100644 --- a/targets/platform/renderer/gl/GLRenderer.cpp +++ b/targets/platform/renderer/gl/GLRenderer.cpp @@ -24,8 +24,6 @@ #undef glNormalPointer #undef glColorPointer #undef glVertexPointer -#undef glGenQueriesARB -#undef glGetQueryObjectuARB #undef glEnable #undef glDisable #undef glBlendFunc diff --git a/targets/platform/renderer/gl/GLRenderer.h b/targets/platform/renderer/gl/GLRenderer.h index ab32e75b7..d5084c24b 100644 --- a/targets/platform/renderer/gl/GLRenderer.h +++ b/targets/platform/renderer/gl/GLRenderer.h @@ -2,7 +2,6 @@ #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two -#include #include diff --git a/targets/platform/renderer/gl/gl_compat.h b/targets/platform/renderer/gl/gl_compat.h index 296030895..752151538 100644 --- a/targets/platform/renderer/gl/gl_compat.h +++ b/targets/platform/renderer/gl/gl_compat.h @@ -16,7 +16,7 @@ // #include "gl3_loader.h" // NOTE: gl3_loader.h must be included before these two -#include +#include #include #include @@ -261,6 +261,16 @@ #define GL_RESCALE_NORMAL 0x803A #endif +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_RGBA +#define GL_RGBA 0x1908 +#endif + +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif // glCallList / display list macros #undef glNewList @@ -460,7 +470,6 @@ #define glActiveTexture(tex) \ do { \ PlatformRenderer.StateSetActiveTexture(tex); \ - ::glActiveTexture(tex); \ } while (0) #undef glClientActiveTexture @@ -478,11 +487,6 @@ void glTexImage2D_4J(int target, int level, int internalformat, int width, int height, int border, int format, int type, void* pixels); -// helprs -void glGenQueries_4J_Helper(unsigned int* id); -void glGetQueryObjectu_4J_Helper(unsigned int id, unsigned int pname, - unsigned int* val); - template inline void glGenTextures_4J(T* buf) { unsigned int id = 0; @@ -523,20 +527,6 @@ inline void glCallLists_4J(T* lists) { } } template -inline void glGenQueries_4J(T* buf) { - unsigned int id = 0; - glGenQueries_4J_Helper(&id); - buf->put((int)id); - buf->flip(); -} -template -inline void glGetQueryObjectu_4J(int id, int pname, T* params) { - unsigned int val = 0; - glGetQueryObjectu_4J_Helper((unsigned int)id, (unsigned int)pname, &val); - params->put((int)val); - params->flip(); -} -template inline void glFog_4J(int pname, T* params) { float* p = params->_getDataPointer(); if (pname == 0x0B66 /* GL_FOG_COLOR */) @@ -589,8 +579,6 @@ inline void glReadPixels_4J(int x, int y, int width, int height, int format, #define glTexImage2D(a, b, c, d, e, f, g, h, i) \ glTexImage2D_4J(a, b, c, d, e, f, g, h, i) #define glCallLists(x) glCallLists_4J(x) -#define glGenQueriesARB(x) glGenQueries_4J(x) -#define glGetQueryObjectuARB(a, b, c) glGetQueryObjectu_4J(a, b, c) #define glReadPixels(a, b, c, d, e, f, g) glReadPixels_4J(a, b, c, d, e, f, g) #define glFog(a, b) glFog_4J(a, b) #define glLight(a, b, c) glLight_4J(a, b, c) diff --git a/targets/platform/stubs.h b/targets/platform/stubs.h index 0c4c87021..a84615d90 100644 --- a/targets/platform/stubs.h +++ b/targets/platform/stubs.h @@ -8,7 +8,6 @@ #include #endif -#include #include #include "java/File.h" From 93215033e4e91ff3b4b098dd4c05ed4ee8ac3d9b Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 19:13:44 -0700 Subject: [PATCH 098/104] fix: restore debugoptimized default flag --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a90574ce0..0e9f62b38 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project( 'warning_level=0', 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this - # 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE + 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE 'b_pch=true', # precompiled headers # 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) # 'b_ndebug=if-release', # drop assert() in --buildtype=release From b7ad828882e0731d59f3465b6f5cf27ab9cbdea2 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 20:37:08 -0700 Subject: [PATCH 099/104] fix: Windows archive file discovery --- meson.build | 3 ++- targets/app/common/Game.cpp | 4 ---- targets/app/common/Game.h | 6 ------ targets/app/common/GameSettingsManager.cpp | 7 ------- .../Frontend Menu screens/UIScene_LoadOrJoinMenu.cpp | 2 +- targets/java/include/java/Class.h | 2 +- targets/java/src/File.cpp | 5 ++--- targets/minecraft/client/renderer/LevelRenderer.h | 5 ----- targets/minecraft/client/skins/DLCTexturePack.cpp | 3 --- 9 files changed, 6 insertions(+), 31 deletions(-) diff --git a/meson.build b/meson.build index 0e9f62b38..e98243b34 100644 --- a/meson.build +++ b/meson.build @@ -10,8 +10,9 @@ project( 'warning_level=0', 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this - 'buildtype=debugoptimized', # needed for _FORTIFY_SOURCE + 'buildtype=debug', 'b_pch=true', # precompiled headers + 'default_library=static', # static linkage to subprojects # 'b_lto=true', # link-time optimisation (ThinLTO under clang+lld) # 'b_ndebug=if-release', # drop assert() in --buildtype=release ], diff --git a/targets/app/common/Game.cpp b/targets/app/common/Game.cpp index dd251d5ab..c10d5ed82 100644 --- a/targets/app/common/Game.cpp +++ b/targets/app/common/Game.cpp @@ -259,11 +259,7 @@ int Game::GetLocalPlayerCount(void) { // Installed DLC callback // 4J-JEV: For the sake of clarity in DLCMountedCallback. -#if defined(_WINDOWS64) #define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) -#else -#define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) -#endif #undef CONTENT_DATA_DISPLAY_NAME diff --git a/targets/app/common/Game.h b/targets/app/common/Game.h index 0653257a4..a25cb6f0a 100644 --- a/targets/app/common/Game.h +++ b/targets/app/common/Game.h @@ -1202,12 +1202,6 @@ private: std::string getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder, std::string mountPoint); -public: -#if defined(_WINDOWS64) - // CMinecraftAudio audio; -#else - -#endif }; extern Game app; \ No newline at end of file diff --git a/targets/app/common/GameSettingsManager.cpp b/targets/app/common/GameSettingsManager.cpp index 8eee1fedf..8a4b5ec8c 100644 --- a/targets/app/common/GameSettingsManager.cpp +++ b/targets/app/common/GameSettingsManager.cpp @@ -41,17 +41,10 @@ void GameSettingsManager::initGameSettings() { // clear the flag to say the settings have changed GameSettingsA[i]->bSettingsChanged = false; -#if defined(_WINDOWS64) IPlatformProfile::PROFILESETTINGS* pProfileSettings = PlatformProfile.GetDashboardProfileSettings(i); memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS)); setDefaultOptions(pProfileSettings, i); -#else - IPlatformProfile::PROFILESETTINGS* pProfileSettings = - PlatformProfile.GetDashboardProfileSettings(i); - memset(pProfileSettings, 0, sizeof(IPlatformProfile::PROFILESETTINGS)); - setDefaultOptions(pProfileSettings, i); -#endif } } 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 6575211f8..274f4d487 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 @@ -1119,7 +1119,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { delete m_currentSessions; m_currentSessions = - g_NetworkManager.GetSessionList(m_iPad, 1, m_bShowingPartyGamesOnly); + PlatformNetwork.GetSessionList(m_iPad, 1, m_bShowingPartyGamesOnly); // Update the xui list displayed unsigned int xuiListSize = m_buttonListGames.getItemCount(); diff --git a/targets/java/include/java/Class.h b/targets/java/include/java/Class.h index ce61e1bcf..c0d45ecf0 100644 --- a/targets/java/include/java/Class.h +++ b/targets/java/include/java/Class.h @@ -350,7 +350,7 @@ inline bool eTYPE_FLAGSET(eINSTANCEOF flag, eINSTANCEOF claz) { /// FOR CHECKING /// -#if !(defined _WINDOWS64) +#if 1 class SubClass { static void checkDerivations() {} diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 1e2ce80b5..08786db76 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -122,9 +122,8 @@ File::File(const std::string& pathname) { File::File(const std::string& parent, const std::string& child) //: m_abstractPathName( child ) { - m_abstractPathName = - pathRoot + pathSeparator + parent + pathSeparator + child; - // this->parent = new File( parent ); + // Using std::filesystem::path to join paths properly + m_abstractPathName = (std::filesystem::path(parent) / child).string(); } // Creates a new File instance by converting the given path vector into an diff --git a/targets/minecraft/client/renderer/LevelRenderer.h b/targets/minecraft/client/renderer/LevelRenderer.h index f2b496abb..d948d23a2 100644 --- a/targets/minecraft/client/renderer/LevelRenderer.h +++ b/targets/minecraft/client/renderer/LevelRenderer.h @@ -68,13 +68,8 @@ public: static const int CHUNK_SIZE = 16; #endif static const int CHUNK_Y_COUNT = Level::maxBuildHeight / CHUNK_SIZE; -#if defined(_WINDOWS64) static const int MAX_COMMANDBUFFER_ALLOCATIONS = 512 * 1024 * 1024; // 4J - added -#else - static const int MAX_COMMANDBUFFER_ALLOCATIONS = - 55 * 1024 * 1024; // 4J - added -#endif public: LevelRenderer(Minecraft* mc, Textures* textures); diff --git a/targets/minecraft/client/skins/DLCTexturePack.cpp b/targets/minecraft/client/skins/DLCTexturePack.cpp index 0556f936c..67d849d01 100644 --- a/targets/minecraft/client/skins/DLCTexturePack.cpp +++ b/targets/minecraft/client/skins/DLCTexturePack.cpp @@ -33,9 +33,6 @@ #include "platform/storage/storage.h" #include "util/StringHelpers.h" -#if defined(_WINDOWS64) -#endif - namespace { bool ReadPortableBinaryFile(File& file, std::uint8_t*& data, unsigned int& size) { From d7cc42d40e9ab38b28424983b9ce7c3e4970ac01 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 20:58:48 -0700 Subject: [PATCH 100/104] fix: implement `StdFilesystem::getBasePath` for windows, macos, linux --- targets/platform/fs/std/StdFilesystem.cpp | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/targets/platform/fs/std/StdFilesystem.cpp b/targets/platform/fs/std/StdFilesystem.cpp index 84421efde..945d4b14f 100644 --- a/targets/platform/fs/std/StdFilesystem.cpp +++ b/targets/platform/fs/std/StdFilesystem.cpp @@ -6,6 +6,12 @@ #include #endif +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif + namespace platform_internal { IPlatformFilesystem& PlatformFilesystem_get() { static StdFilesystem instance; @@ -82,15 +88,23 @@ std::size_t StdFilesystem::fileSize(const std::filesystem::path& path) { } std::filesystem::path StdFilesystem::getBasePath() { -#if defined(__linux__) - char buf[4096]; - ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); +#if defined(_WIN32) + wchar_t buf[4096]; + DWORD len = GetModuleFileNameW(nullptr, buf, sizeof(buf) / sizeof(wchar_t)); if (len > 0) { - buf[len] = '\0'; return std::filesystem::path(buf).parent_path(); } -#endif +#elif defined(__APPLE__) + char buf[4096]; + uint32_t size = sizeof(buf); + if (_NSGetExecutablePath(buf, &size) == 0) { + return std::filesystem::path(buf).parent_path(); + } +#elif defined(__linux__) + return std::filesystem::read_symlink("/proc/self/exe").parent_path(); +#else return std::filesystem::current_path(); +#endif } std::filesystem::path StdFilesystem::getUserDataPath() { return getBasePath(); } \ No newline at end of file From 2396e6bb9663e1e5b6981fa3d8598e35e6d69747 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Sat, 11 Apr 2026 00:17:49 -0500 Subject: [PATCH 101/104] fix: pulled a 4J --- targets/app/common/LocalizationManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/app/common/LocalizationManager.cpp b/targets/app/common/LocalizationManager.cpp index 6bb202513..b2c04b28c 100644 --- a/targets/app/common/LocalizationManager.cpp +++ b/targets/app/common/LocalizationManager.cpp @@ -21,7 +21,7 @@ #include "platform/renderer/renderer.h" #include "strings.h" #include "util/StringHelpers.h" -#include "app/common/ui/ConsoleUIController.h" +#include "app/common/UI/ConsoleUIController.h" int LocalizationManager::s_iHTMLFontSizesA[eHTMLSize_COUNT] = {20, 13, 20, 26}; From 76788f1708d6a3791160058cbad9dcce3b25922d Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:44:28 -0700 Subject: [PATCH 102/104] fix: UB when getenv("HOME") returns nullptr --- targets/minecraft/client/Minecraft.cpp | 40 +++++++++++--------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 4f93d8d04..8ad354ac6 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -467,33 +467,27 @@ File Minecraft::getWorkingDirectory() { } File Minecraft::getWorkingDirectory(const std::string& applicationName) { - // 4J - original version - // 4jcraft: ported to C++ - std::string userHome = getenv("HOME"); - File* workingDirectory; -#if defined(_WINDOWS64) - std::string applicationData = getenv("APPDATA"); - if (!applicationData.empty()) { - workingDirectory = - new File(applicationData, '.' + applicationName + '/'); - } else { - workingDirectory = new File(userHome, '.' + applicationName + '/'); - } -// #elif defined(_MACOS) -// workingDirectory = new File(userHome, "Library/Application -// Support/" + applicationName); +#ifndef _WIN32 + const char* homedir = getenv("HOME"); #else - workingDirectory = new File(userHome, applicationName + '/'); + const char* homedir = getenv("USERPROFILE"); #endif - if (!workingDirectory->exists()) { - if (!workingDirectory->mkdirs()) { - Log::info("The working directory could not be created"); - assert(0); - // throw new RuntimeException("The working directory could not be - // created: " + workingDirectory); + + if (homedir != nullptr) { + File workingDirectory(std::string(homedir), '.' + applicationName + '/'); + + if (!workingDirectory.exists()) { + if (!workingDirectory.mkdirs()) { + Log::info("The working directory could not be created"); + assert(0); + } } + + return workingDirectory; + } else { + Log::info("Could not locate user's home directory. This platform is likely missing an implementation of Minecraft::getWorkingDirectory."); + assert(0); } - return *workingDirectory; } LevelStorageSource* Minecraft::getLevelSource() { return levelSource; } From f7e555ea6b11eaf687943f7265dede44538083b8 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:56:20 -0700 Subject: [PATCH 103/104] fix: UB with LivingEntities::pushEntities --- targets/minecraft/client/Minecraft.cpp | 2 +- targets/minecraft/world/entity/LivingEntity.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index 8ad354ac6..e2b603811 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -485,7 +485,7 @@ File Minecraft::getWorkingDirectory(const std::string& applicationName) { return workingDirectory; } else { - Log::info("Could not locate user's home directory. This platform is likely missing an implementation of Minecraft::getWorkingDirectory."); + Log::info("Could not locate user's home directory. This platform is likely missing an implementation of Minecraft::getWorkingDirectory.\n"); assert(0); } } diff --git a/targets/minecraft/world/entity/LivingEntity.cpp b/targets/minecraft/world/entity/LivingEntity.cpp index e5866814f..eed87daa7 100644 --- a/targets/minecraft/world/entity/LivingEntity.cpp +++ b/targets/minecraft/world/entity/LivingEntity.cpp @@ -1604,11 +1604,15 @@ void LivingEntity::pushEntities() { AABB grown = bb.grow(0.2, 0, 0.2); std::vector>* entities = level->getEntities(shared_from_this(), &grown); - if (entities != nullptr && !entities->empty()) { - auto itEnd = entities->end(); - for (auto it = entities->begin(); it != itEnd; it++) { - std::shared_ptr e = *it; // entities->at(i); - if (e and !e->removed and e->isPushable()) push(e); + + if (entities == nullptr || entities->empty()) { + return; + } + + std::vector> prev_entities = *entities; + for (const std::shared_ptr& e : prev_entities) { + if (e && !e->removed && e->isPushable()) { + push(e); } } } From 397ab0a6e5a5d1fbda953502fced6e89c40383f9 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:11:37 -0700 Subject: [PATCH 104/104] fix: more working directory logic bugs --- targets/java/src/File.cpp | 6 ++---- targets/minecraft/client/Minecraft.cpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/targets/java/src/File.cpp b/targets/java/src/File.cpp index 08786db76..48ff31e73 100644 --- a/targets/java/src/File.cpp +++ b/targets/java/src/File.cpp @@ -197,11 +197,9 @@ bool File::mkdirs() const { return fs::is_directory(path, error); } - if (error) { - return false; - } + fs::create_directories(path, error); - return fs::create_directories(path, error); + return error.value() == 0; } /* diff --git a/targets/minecraft/client/Minecraft.cpp b/targets/minecraft/client/Minecraft.cpp index e2b603811..310ab240c 100644 --- a/targets/minecraft/client/Minecraft.cpp +++ b/targets/minecraft/client/Minecraft.cpp @@ -478,7 +478,7 @@ File Minecraft::getWorkingDirectory(const std::string& applicationName) { if (!workingDirectory.exists()) { if (!workingDirectory.mkdirs()) { - Log::info("The working directory could not be created"); + Log::info("The working directory could not be created.\n"); assert(0); } }