From c9b90cae2c7d2bdc04e82d0020be4c97f97d5896 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 30 Mar 2026 02:13:59 -0500 Subject: [PATCH 1/4] chore: format everything --- 4J.Common/4J_Compat.h | 3 +- 4J.Input/4J_Input.cpp | 5 +- 4J.Profile/4J_Profile.cpp | 17 +- 4J.Profile/4J_Profile.h | 19 +- 4J.Render/gl3_loader.h | 23 +- 4J.Storage/4J_Storage.cpp | 18 +- 4J.Storage/4J_Storage.h | 37 +- Minecraft.Client/Commands/TeleportCommand.cpp | 17 +- Minecraft.Client/GameState/StatsCounter.cpp | 5 +- Minecraft.Client/GameState/StatsCounter.h | 1 - Minecraft.Client/Level/MultiPlayerLevel.cpp | 8 +- Minecraft.Client/Level/ServerLevel.cpp | 5 +- Minecraft.Client/Minecraft.cpp | 86 +- Minecraft.Client/Minecraft.h | 3 +- Minecraft.Client/MinecraftServer.cpp | 13 +- Minecraft.Client/MinecraftServer.h | 1 - Minecraft.Client/Network/ClientConnection.cpp | 48 +- .../Network/MultiPlayerChunkCache.cpp | 4 +- .../Network/PendingConnection.cpp | 10 +- Minecraft.Client/Network/PlayerChunkMap.cpp | 9 +- Minecraft.Client/Network/PlayerConnection.cpp | 34 +- Minecraft.Client/Network/PlayerList.cpp | 34 +- Minecraft.Client/Network/ServerChunkCache.cpp | 12 +- .../Network/ServerCommandDispatcher.cpp | 4 +- Minecraft.Client/Network/ServerConnection.cpp | 6 +- Minecraft.Client/Platform/Common/App_enums.h | 2 - .../Common/Audio/Consoles_SoundEngine.h | 2 - .../Platform/Common/Audio/SoundEngine.cpp | 10 +- .../Platform/Common/Audio/SoundEngine.h | 1 - .../Platform/Common/Audio/SoundNames.cpp | 116 +- Minecraft.Client/Platform/Common/BuildVer.h | 74 +- .../Platform/Common/C4JMemoryPool.h | 275 +- .../Platform/Common/C4JMemoryPoolAllocator.h | 150 +- .../Platform/Common/Colours/ColourTable.h | 26 +- .../Platform/Common/ConsoleGameMode.cpp | 8 +- .../Platform/Common/ConsoleGameMode.h | 10 +- .../Platform/Common/Console_Awards_enum.h | 121 +- .../Platform/Common/Console_Utils.cpp | 28 +- .../Platform/Common/Consoles_App.cpp | 110 +- .../Platform/Common/Consoles_App.h | 23 +- .../Common/DLC/DLCGameRulesHeader.cpp | 1 - .../Platform/Common/DLC/DLCManager.cpp | 1 - .../Platform/Common/DLC/DLCPack.cpp | 8 +- .../Platform/Common/DLC/DLCSkinFile.cpp | 8 +- .../GameRules/CollectItemRuleDefinition.cpp | 4 +- .../GameRules/CompleteAllRuleDefinition.cpp | 4 +- .../GameRules/CompoundGameRuleDefinition.cpp | 8 +- .../Common/GameRules/ConsoleSchematicFile.cpp | 13 +- .../Common/GameRules/GameRuleDefinition.h | 3 +- .../Common/GameRules/GameRuleManager.cpp | 28 +- .../Common/GameRules/GameRuleManager.h | 2 +- .../GameRules/LevelGenerationOptions.cpp | 61 +- .../XboxStructureActionPlaceContainer.h | 3 +- .../Leaderboards/LeaderboardManager.cpp | 148 +- .../Common/Leaderboards/LeaderboardManager.h | 383 +- .../Leaderboards/SonyLeaderboardManager.cpp | 112 +- .../Leaderboards/SonyLeaderboardManager.h | 1 - .../Platform/Common/Leaderboards/base64.cpp | 270 +- .../Platform/Common/Leaderboards/base64.h | 8 +- .../Platform/Common/Minecraft_Macros.h | 64 +- .../Common/Network/GameNetworkManager.cpp | 74 +- .../Common/Network/GameNetworkManager.h | 14 +- .../Network/PlatformNetworkManagerInterface.h | 1 - .../Network/PlatformNetworkManagerStub.cpp | 4 +- .../Platform/Common/Network/SessionInfo.h | 1 - .../Platform/Common/Potion_Macros.h | 85 +- .../Platform/Common/ShutdownManager.h | 4 +- .../Common/Telemetry/TelemetryManager.cpp | 575 ++- .../Common/Telemetry/TelemetryManager.h | 124 +- .../Platform/Common/Trial/TrialMode.cpp | 8 +- .../Platform/Common/Trial/TrialMode.h | 9 +- .../Platform/Common/Tutorial/AreaTask.cpp | 3 +- .../Platform/Common/Tutorial/ChoiceTask.cpp | 3 +- .../Platform/Common/Tutorial/ControllerTask.h | 3 +- .../Platform/Common/Tutorial/CraftTask.cpp | 23 +- .../Platform/Common/Tutorial/InfoTask.cpp | 15 +- .../Common/Tutorial/ProcedureCompoundTask.cpp | 3 +- .../Platform/Common/Tutorial/Tutorial.cpp | 38 +- .../Platform/Common/Tutorial/Tutorial.h | 3 +- .../Platform/Common/Tutorial/TutorialMode.h | 3 +- .../Platform/Common/Tutorial/TutorialTask.h | 4 +- .../UI/IUIScene_AbstractContainerMenu.cpp | 196 +- .../UI/IUIScene_AbstractContainerMenu.h | 1 - .../Common/UI/IUIScene_BeaconMenu.cpp | 6 +- .../Common/UI/IUIScene_CraftingMenu.cpp | 5 +- .../Common/UI/IUIScene_CreativeMenu.cpp | 11 +- .../Platform/Common/UI/IUIScene_HUD.cpp | 3 +- .../Platform/Common/UI/IUIScene_PauseMenu.cpp | 6 - .../Platform/Common/UI/IUIScene_StartGame.cpp | 3 +- .../Common/UI/IUIScene_TradingMenu.cpp | 4 +- Minecraft.Client/Platform/Common/UI/UI.h | 1 - .../Platform/Common/UI/UIBitmapFont.cpp | 9 +- .../Platform/Common/UI/UIBitmapFont.h | 8 +- .../Common/UI/UIComponent_Tooltips.cpp | 5 - .../Platform/Common/UI/UIComponent_Tooltips.h | 2 - .../Common/UI/UIComponent_TutorialPopup.cpp | 3 +- .../Common/UI/UIComponent_TutorialPopup.h | 3 +- .../Platform/Common/UI/UIControl.cpp | 4 +- .../Platform/Common/UI/UIControl_Button.cpp | 1 - .../Common/UI/UIControl_ButtonList.cpp | 2 - .../Platform/Common/UI/UIControl_ButtonList.h | 1 - .../Platform/Common/UI/UIControl_CheckBox.cpp | 1 - .../Common/UI/UIControl_DynamicLabel.cpp | 9 +- .../Common/UI/UIControl_HTMLLabel.cpp | 9 +- .../Platform/Common/UI/UIControl_Label.cpp | 3 +- .../Common/UI/UIControl_LeaderboardList.cpp | 2 - .../Common/UI/UIControl_LeaderboardList.h | 2 +- .../Platform/Common/UI/UIControl_Slider.cpp | 7 +- .../Common/UI/UIControl_SpaceIndicatorBar.cpp | 2 +- .../Common/UI/UIControl_TextInput.cpp | 1 - .../Common/UI/UIControl_TexturePackList.cpp | 7 +- .../Platform/Common/UI/UIController.cpp | 28 +- .../Platform/Common/UI/UIController.h | 15 +- Minecraft.Client/Platform/Common/UI/UIEnums.h | 17 +- .../Platform/Common/UI/UIGroup.cpp | 5 +- Minecraft.Client/Platform/Common/UI/UIGroup.h | 1 - .../Platform/Common/UI/UILayer.cpp | 17 +- Minecraft.Client/Platform/Common/UI/UILayer.h | 1 - .../Platform/Common/UI/UIScene.cpp | 21 +- Minecraft.Client/Platform/Common/UI/UIScene.h | 3 +- .../UI/UIScene_AbstractContainerMenu.cpp | 1 - .../Platform/Common/UI/UIScene_AnvilMenu.cpp | 1 - .../Common/UI/UIScene_ConnectingProgress.cpp | 2 - .../Common/UI/UIScene_ConnectingProgress.h | 1 - .../Common/UI/UIScene_ControlsMenu.cpp | 3 +- .../Platform/Common/UI/UIScene_ControlsMenu.h | 172 +- .../Common/UI/UIScene_CraftingMenu.cpp | 3 - .../Platform/Common/UI/UIScene_CraftingMenu.h | 3 - .../Common/UI/UIScene_CreateWorldMenu.cpp | 28 +- .../Common/UI/UIScene_CreateWorldMenu.h | 5 +- .../Common/UI/UIScene_CreativeMenu.cpp | 3 - .../Platform/Common/UI/UIScene_CreativeMenu.h | 1 - .../Platform/Common/UI/UIScene_Credits.cpp | 5 +- .../Common/UI/UIScene_DLCMainMenu.cpp | 14 +- .../Platform/Common/UI/UIScene_DLCMainMenu.h | 1 - .../Common/UI/UIScene_DLCOffersMenu.cpp | 19 +- .../Common/UI/UIScene_DLCOffersMenu.h | 2 - .../Platform/Common/UI/UIScene_DeathMenu.cpp | 3 +- .../Platform/Common/UI/UIScene_DeathMenu.h | 1 - .../Common/UI/UIScene_DebugOverlay.cpp | 3 +- .../Platform/Common/UI/UIScene_EULA.cpp | 2 - .../Common/UI/UIScene_EnchantingMenu.cpp | 2 - .../Platform/Common/UI/UIScene_EndPoem.cpp | 2 +- .../Common/UI/UIScene_FullscreenProgress.cpp | 5 +- .../Platform/Common/UI/UIScene_HUD.cpp | 6 +- .../Platform/Common/UI/UIScene_HUD.h | 1 - .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 1 - .../Platform/Common/UI/UIScene_HowToPlay.cpp | 3 +- .../Common/UI/UIScene_HowToPlayMenu.cpp | 6 +- .../Common/UI/UIScene_InGameInfoMenu.cpp | 14 +- .../Common/UI/UIScene_InGameInfoMenu.h | 1 - .../UI/UIScene_InGamePlayerOptionsMenu.cpp | 14 +- .../UI/UIScene_InGameSaveManagementMenu.cpp | 3 - .../Platform/Common/UI/UIScene_Intro.cpp | 2 - .../Platform/Common/UI/UIScene_Intro.h | 2 - .../Common/UI/UIScene_InventoryMenu.cpp | 3 +- .../Platform/Common/UI/UIScene_JoinMenu.cpp | 3 - .../Platform/Common/UI/UIScene_JoinMenu.h | 1 - .../Platform/Common/UI/UIScene_Keyboard.cpp | 12 +- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 3 - .../Common/UI/UIScene_LaunchMoreOptionsMenu.h | 1 - .../Common/UI/UIScene_LeaderboardsMenu.cpp | 9 +- .../Platform/Common/UI/UIScene_LoadMenu.cpp | 19 +- .../Platform/Common/UI/UIScene_LoadMenu.h | 5 +- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 30 +- .../Common/UI/UIScene_LoadOrJoinMenu.h | 5 +- .../Platform/Common/UI/UIScene_MainMenu.cpp | 51 +- .../Platform/Common/UI/UIScene_MainMenu.h | 1 - .../Common/UI/UIScene_NewUpdateMessage.cpp | 2 - .../Platform/Common/UI/UIScene_PauseMenu.cpp | 50 +- .../Platform/Common/UI/UIScene_PauseMenu.h | 2 - .../Common/UI/UIScene_QuadrantSignin.cpp | 21 +- .../Common/UI/UIScene_QuadrantSignin.h | 1 - .../Common/UI/UIScene_SaveMessage.cpp | 1 - .../Platform/Common/UI/UIScene_SaveMessage.h | 1 - .../Common/UI/UIScene_SettingsOptionsMenu.cpp | 3 - .../Common/UI/UIScene_SignEntryMenu.cpp | 1 - .../Common/UI/UIScene_SkinSelectMenu.cpp | 72 +- .../Common/UI/UIScene_SkinSelectMenu.h | 4 - .../Platform/Common/UI/UIString.cpp | 4 +- .../Platform/Common/UI/UIString.h | 2 - .../Platform/Common/XML/ATGXmlParser.cpp | 995 ++--- .../Platform/Common/XML/ATGXmlParser.h | 179 +- .../Platform/Common/XML/xmlFilesCallback.h | 525 ++- Minecraft.Client/Platform/Extrax64Stubs.cpp | 1008 +++-- .../Platform/Linux/Iggy/gdraw/gdraw.h | 53 +- .../Platform/Linux/Iggy/include/gdraw.h | 843 ++-- .../Platform/Linux/Iggy/include/iggy.h | 2059 ++++++---- Minecraft.Client/Platform/Linux/Linux_App.cpp | 6 +- .../Platform/Linux/Linux_Minecraft.cpp | 10 +- .../Platform/Linux/Sentient/SentientManager.h | 22 +- .../Platform/Linux/Sentient/SentientStats.h | 146 +- .../Platform/Linux/Social/SocialManager.h | 8 +- .../Stubs/DirectXMath/DirectXCollision.h | 2 +- .../Linux/Stubs/DirectXMath/DirectXMath.h | 32 +- .../Platform/Linux/Stubs/iggy_stubs.h | 7 +- .../Platform/Linux/Stubs/winapi_stubs.h | 4 +- .../Platform/Linux/Stubs/xbox_stubs.h | 6 +- .../Windows64/GameConfig/Minecraft.spa.h | 900 ++--- .../Windows64/Iggy/gdraw/gdraw_d3d.cpp | 3595 +++++++++-------- .../Platform/Windows64/Iggy/gdraw/gdraw_d3d.h | 137 +- .../Windows64/Iggy/gdraw/gdraw_d3d10.cpp | 176 +- .../Windows64/Iggy/gdraw/gdraw_d3d10.h | 165 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.cpp | 191 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.h | 175 +- .../Platform/Windows64/Iggy/gdraw/gdraw_wgl.c | 288 +- .../Platform/Windows64/Iggy/gdraw/gdraw_wgl.h | 42 +- .../Platform/Windows64/Iggy/include/gdraw.h | 843 ++-- .../Platform/Windows64/Iggy/include/iggy.h | 2059 ++++++---- .../Windows64/Iggy/include/iggyexpruntime.h | 32 +- .../Windows64/Iggy/include/iggyperfmon.h | 109 +- .../WindowsLeaderboardManager.cpp | 4 +- .../Leaderboards/WindowsLeaderboardManager.h | 57 +- .../Platform/Windows64/Miles/include/tmapi.h | 7 +- .../Platform/Windows64/Minecraft_Macros.h | 63 +- .../Platform/Windows64/Resource.h | 32 +- .../Sentient/DynamicConfigurations.h | 6 +- .../Windows64/Sentient/SentientManager.h | 22 +- .../Windows64/Sentient/SentientStats.h | 146 +- .../Platform/Windows64/Social/SocialManager.h | 170 +- .../Platform/Windows64/Windows64_App.cpp | 215 +- .../Platform/Windows64/Windows64_App.h | 44 +- .../Windows64/Windows64_Minecraft.cpp | 16 +- .../Windows64/Windows64_UIController.cpp | 259 +- .../Windows64/Windows64_UIController.h | 40 +- .../Platform/Windows64/XML/ATGXmlParser.h | 178 +- .../Platform/Windows64/Xbox_BuildVer.h | 69 +- Minecraft.Client/Platform/extraX64client.h | 111 +- Minecraft.Client/Platform/stdafx.h | 1 - Minecraft.Client/Platform/stubs.cpp | 99 +- Minecraft.Client/Player/EntityTracker.cpp | 6 +- Minecraft.Client/Player/LocalPlayer.cpp | 15 +- .../Player/MultiPlayerGameMode.cpp | 4 +- Minecraft.Client/Player/MultiPlayerGameMode.h | 3 +- .../Player/MultiPlayerLocalPlayer.cpp | 1 - Minecraft.Client/Player/ServerPlayer.cpp | 34 +- .../Player/ServerPlayerGameMode.cpp | 7 +- Minecraft.Client/Player/TrackedEntity.cpp | 20 +- Minecraft.Client/Rendering/Chunk.cpp | 91 +- Minecraft.Client/Rendering/Chunk.h | 3 +- .../EntityRenderers/EnchantTableRenderer.cpp | 1 - .../EntityRenderDispatcher.cpp | 2 +- .../EntityRenderers/ItemInHandRenderer.cpp | 4 +- .../EntityRenderers/ItemRenderer.cpp | 1 - .../EntityRenderers/PlayerRenderer.cpp | 1 - .../EntityRenderers/ProgressRenderer.cpp | 2 - .../TileEntityRenderDispatcher.cpp | 2 +- .../EntityRenderers/TileRenderer.cpp | 12 +- .../Rendering/EntityRenderers/TileRenderer.h | 3 +- Minecraft.Client/Rendering/GameRenderer.cpp | 1 - Minecraft.Client/Rendering/LevelRenderer.cpp | 53 +- Minecraft.Client/Rendering/Minimap.cpp | 10 +- Minecraft.Client/Rendering/Minimap.h | 6 +- .../Rendering/Models/ModelPart.cpp | 4 +- .../Rendering/Particles/ParticleEngine.cpp | 2 +- Minecraft.Client/Rendering/Tesselator.cpp | 29 +- Minecraft.Client/Rendering/Tesselator.h | 1 - Minecraft.Client/Rendering/glWrapper.cpp | 8 +- Minecraft.Client/Textures/BufferedImage.cpp | 1 - .../Textures/Packs/AbstractTexturePack.cpp | 16 +- .../Textures/Packs/DLCTexturePack.cpp | 7 +- .../Textures/Packs/DefaultTexturePack.cpp | 7 +- .../Textures/Packs/FileTexturePack.cpp | 14 +- .../Textures/Packs/FolderTexturePack.cpp | 14 +- .../Textures/Packs/TexturePack.cpp | 5 +- .../Textures/Packs/TexturePackRepository.cpp | 3 +- .../Textures/Packs/TexturePackRepository.h | 2 +- .../Stitching/PreStitchedTextureMap.cpp | 12 +- .../Textures/Stitching/StitchSlot.cpp | 3 +- .../Textures/Stitching/TextureMap.cpp | 11 +- Minecraft.Client/Textures/Texture.cpp | 11 +- Minecraft.Client/Textures/Texture.h | 1 - Minecraft.Client/Textures/TextureManager.cpp | 3 +- Minecraft.Client/Textures/Textures.cpp | 12 +- Minecraft.Client/UI/Gui.cpp | 1 - .../UI/Screens/ContainerScreen.cpp | 3 +- .../UI/Screens/SelectWorldScreen.cpp | 4 +- Minecraft.Client/UI/Screens/StatsScreen.cpp | 2 +- Minecraft.Client/Utils/FrameProfiler.cpp | 29 +- Minecraft.Client/Utils/FrameProfiler.h | 8 +- .../AI/Attributes/BaseAttributeMap.cpp | 6 +- .../ModifiableAttributeInstance.cpp | 9 +- Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp | 4 +- Minecraft.World/AI/Goals/BreedGoal.cpp | 6 +- .../AI/Goals/ControlledByPlayerGoal.cpp | 3 +- Minecraft.World/AI/Goals/HurtByTargetGoal.cpp | 7 +- .../AI/Goals/NearestAttackableTargetGoal.cpp | 3 +- Minecraft.World/AI/Goals/TargetGoal.cpp | 5 +- Minecraft.World/AI/Navigation/PathFinder.cpp | 9 +- .../AI/Navigation/PathNavigation.cpp | 3 +- Minecraft.World/Blocks/AnvilTile.cpp | 3 +- Minecraft.World/Blocks/BaseRailTile.cpp | 4 +- Minecraft.World/Blocks/BeaconTile.cpp | 3 +- Minecraft.World/Blocks/BedTile.cpp | 3 +- Minecraft.World/Blocks/ButtonTile.cpp | 4 +- Minecraft.World/Blocks/CactusTile.cpp | 3 +- Minecraft.World/Blocks/CakeTile.cpp | 3 +- Minecraft.World/Blocks/CauldronTile.cpp | 3 +- Minecraft.World/Blocks/CocoaTile.cpp | 3 +- Minecraft.World/Blocks/DoorTile.cpp | 3 +- Minecraft.World/Blocks/DropperTile.cpp | 3 +- Minecraft.World/Blocks/FallingTile.cpp | 3 +- Minecraft.World/Blocks/FireTile.cpp | 9 +- Minecraft.World/Blocks/FlowerPotTile.cpp | 3 +- Minecraft.World/Blocks/GrassTile.cpp | 1 - Minecraft.World/Blocks/HopperTile.cpp | 3 +- Minecraft.World/Blocks/JukeboxTile.cpp | 2 +- Minecraft.World/Blocks/LadderTile.cpp | 3 +- Minecraft.World/Blocks/LeverTile.cpp | 7 +- Minecraft.World/Blocks/MelonTile.cpp | 4 +- Minecraft.World/Blocks/MobSpawner.cpp | 1 - .../Blocks/PistonMovingTileEntity.h | 4 +- Minecraft.World/Blocks/PlantTile.cpp | 8 +- Minecraft.World/Blocks/PortalTile.cpp | 4 +- Minecraft.World/Blocks/PoweredRailTile.cpp | 8 +- Minecraft.World/Blocks/PoweredRailTile.h | 6 +- Minecraft.World/Blocks/RedStoneDustTile.cpp | 1 - Minecraft.World/Blocks/ReedTile.cpp | 4 +- Minecraft.World/Blocks/SignTile.cpp | 4 +- Minecraft.World/Blocks/SkullTile.cpp | 3 +- Minecraft.World/Blocks/Tile.cpp | 6 +- Minecraft.World/Blocks/Tile.h | 1 + .../TileEntities/BrewingStandTileEntity.cpp | 3 +- .../Blocks/TileEntities/ChestTileEntity.cpp | 15 +- .../DaylightDetectorTileEntity.cpp | 3 +- .../Blocks/TileEntities/FurnaceTileEntity.cpp | 7 +- .../Blocks/TileEntities/HopperTileEntity.cpp | 3 +- .../TileEntities/PistonPieceTileEntity.cpp | 4 +- Minecraft.World/Blocks/TopSnowTile.cpp | 2 +- Minecraft.World/Blocks/TorchTile.cpp | 4 +- Minecraft.World/Blocks/TripWireSourceTile.cpp | 3 +- Minecraft.World/Blocks/TripWireTile.cpp | 4 +- Minecraft.World/Blocks/VineTile.cpp | 7 +- Minecraft.World/Blocks/WaterLilyTile.cpp | 2 +- Minecraft.World/Blocks/WebTile.cpp | 4 +- .../Blocks/WeightedPressurePlateTile.cpp | 3 +- Minecraft.World/Blocks/WoolCarpetTile.cpp | 2 +- .../Containers/AbstractContainerMenu.cpp | 9 +- Minecraft.World/Containers/AnvilMenu.cpp | 3 +- .../Containers/BrewingStandMenu.cpp | 4 +- Minecraft.World/Containers/ContainerMenu.cpp | 3 +- Minecraft.World/Containers/Inventory.cpp | 6 +- Minecraft.World/Containers/MerchantRecipe.cpp | 3 +- .../Containers/RepairResultSlot.cpp | 3 +- Minecraft.World/Containers/Slot.cpp | 3 +- .../Enchantments/EnchantmentHelper.cpp | 4 +- Minecraft.World/Entities/Entity.cpp | 4 +- Minecraft.World/Entities/ItemEntity.cpp | 4 +- Minecraft.World/Entities/LivingEntity.cpp | 28 +- Minecraft.World/Entities/MinecartHopper.cpp | 5 +- Minecraft.World/Entities/Mob.cpp | 11 +- Minecraft.World/Entities/MobEffect.cpp | 8 +- Minecraft.World/Entities/Mobs/Animal.cpp | 3 +- Minecraft.World/Entities/Mobs/Blaze.cpp | 3 +- Minecraft.World/Entities/Mobs/Boat.cpp | 3 +- Minecraft.World/Entities/Mobs/EnderDragon.cpp | 9 +- Minecraft.World/Entities/Mobs/EntityHorse.cpp | 10 +- .../Entities/Mobs/ExperienceOrb.cpp | 4 +- Minecraft.World/Entities/Mobs/FishingHook.cpp | 8 +- Minecraft.World/Entities/Mobs/Minecart.cpp | 9 +- Minecraft.World/Entities/Mobs/Villager.cpp | 9 +- Minecraft.World/Entities/Mobs/Witch.cpp | 4 +- Minecraft.World/Entities/Mobs/Wolf.cpp | 2 +- Minecraft.World/Entities/PathfinderMob.cpp | 7 +- Minecraft.World/Entities/SyncedEntityData.cpp | 3 +- Minecraft.World/IO/Files/ConsoleSaveFile.h | 1 - .../IO/Files/ConsoleSaveFileConverter.cpp | 3 +- .../IO/Files/ConsoleSaveFileOriginal.cpp | 31 +- .../IO/Files/ConsoleSaveFileOriginal.h | 4 +- .../IO/Files/ConsoleSaveFileSplit.cpp | 35 +- .../IO/Files/ConsoleSaveFileSplit.h | 6 +- Minecraft.World/IO/Files/FileHeader.cpp | 23 +- Minecraft.World/IO/Files/FileHeader.h | 1 - Minecraft.World/IO/NBT/CompoundTag.h | 4 +- Minecraft.World/IO/NBT/ListTag.h | 4 +- .../IO/Streams/ByteArrayInputStream.h | 2 +- Minecraft.World/IO/Streams/ByteBuffer.cpp | 1 - Minecraft.World/IO/Streams/ByteBuffer.h | 1 - Minecraft.World/IO/Streams/Compression.cpp | 4 +- .../IO/Streams/DataInputStream.cpp | 12 +- .../IO/Streams/DataOutputStream.cpp | 10 +- Minecraft.World/IO/Streams/Reader.h | 2 +- Minecraft.World/Items/DyePowderItem.cpp | 3 +- Minecraft.World/Items/HatchetItem.cpp | 4 +- Minecraft.World/Items/Item.cpp | 7 +- Minecraft.World/Items/ItemInstance.cpp | 4 +- Minecraft.World/Items/PickaxeItem.cpp | 4 +- Minecraft.World/Items/PotionItem.cpp | 10 +- .../Items/TileItems/ColoredTileItem.cpp | 3 +- Minecraft.World/Level/BaseMobSpawner.cpp | 4 +- Minecraft.World/Level/ChunkSource.h | 2 +- Minecraft.World/Level/CustomLevelSource.cpp | 8 +- .../Level/Dimensions/SkyIslandDimension.cpp | 4 +- Minecraft.World/Level/Events/VillageSiege.cpp | 3 +- Minecraft.World/Level/Explosion.cpp | 10 +- Minecraft.World/Level/Level.cpp | 61 +- Minecraft.World/Level/Level.h | 3 +- Minecraft.World/Level/LevelChunk.cpp | 17 +- Minecraft.World/Level/LevelChunk.h | 1 - Minecraft.World/Level/LevelData.cpp | 3 +- Minecraft.World/Level/RandomLevelSource.cpp | 5 +- .../Level/Storage/CompressedTileStorage.cpp | 7 +- .../Level/Storage/DirectoryLevelStorage.cpp | 27 +- Minecraft.World/Level/Storage/EntityIO.cpp | 3 +- Minecraft.World/Level/Storage/LevelType.cpp | 3 +- .../Level/Storage/MapItemSavedData.cpp | 10 +- .../Level/Storage/McRegionChunkStorage.cpp | 4 +- .../Level/Storage/McRegionLevelStorage.cpp | 11 +- .../Storage/McRegionLevelStorageSource.cpp | 3 - .../Level/Storage/OldChunkStorage.cpp | 1 - Minecraft.World/Level/Storage/Region.cpp | 1 - .../Level/Storage/SparseDataStorage.cpp | 14 +- .../Level/Storage/SparseLightStorage.cpp | 14 +- .../Level/Storage/SparseLightStorage.h | 1 + .../Level/Storage/ZonedChunkStorage.cpp | 4 +- Minecraft.World/Level/TickNextTickData.cpp | 7 +- .../Network/Packets/AddPlayerPacket.cpp | 2 +- .../Network/Packets/AwardStatPacket.cpp | 4 +- .../Network/Packets/ChatAutoCompletePacket.h | 3 +- .../Network/Packets/ClientInformationPacket.h | 3 +- .../Network/Packets/ClientProtocolPacket.h | 3 +- Minecraft.World/Network/Packets/Packet.cpp | 6 +- .../Network/Packets/RemoveEntitiesPacket.cpp | 3 +- .../Network/Packets/ServerAuthDataPacket.h | 3 +- .../Network/Packets/SharedKeyPacket.h | 3 +- .../Packets/TextureAndGeometryPacket.cpp | 3 +- .../Packets/UpdateAttributesPacket.cpp | 3 +- Minecraft.World/Network/Socket.cpp | 10 +- Minecraft.World/Platform/System.cpp | 4 +- Minecraft.World/Platform/System.h | 6 +- .../Platform/x64headers/extraX64.h | 2 +- Minecraft.World/Player/Player.cpp | 24 +- Minecraft.World/Player/Player.h | 1 - Minecraft.World/Recipes/ArmorDyeRecipe.cpp | 1 - Minecraft.World/Recipes/ArmorDyeRecipe.h | 6 +- Minecraft.World/Recipes/ClothDyeRecipes.cpp | 1 - Minecraft.World/Recipes/Recipy.h | 8 +- Minecraft.World/Recipes/ShapedRecipy.cpp | 3 +- Minecraft.World/Recipes/ShapedRecipy.h | 6 +- Minecraft.World/Recipes/ShapelessRecipy.cpp | 7 +- Minecraft.World/Recipes/ShapelessRecipy.h | 6 +- Minecraft.World/Stats/Achievement.cpp | 10 +- Minecraft.World/Stats/Achievement.h | 3 +- Minecraft.World/Stats/GenericStats.cpp | 8 +- Minecraft.World/Stats/Stats.cpp | 9 +- Minecraft.World/Util/C4JThread.cpp | 113 +- Minecraft.World/Util/C4JThread.h | 4 +- Minecraft.World/Util/CombatTracker.cpp | 24 +- Minecraft.World/Util/Icon.h | 1 - Minecraft.World/Util/Pos.cpp | 4 +- Minecraft.World/Util/libdivide.h | 1602 +++++--- .../WorldGen/Biomes/BiomeSource.cpp | 5 +- .../Features/RandomScatteredLargeFeature.cpp | 6 +- .../WorldGen/Features/StructureFeature.cpp | 3 +- .../WorldGen/Flat/FlatGeneratorInfo.cpp | 5 +- .../WorldGen/Layers/BiomeOverrideLayer.cpp | 12 +- Minecraft.World/WorldGen/Layers/Layer.cpp | 2 - .../WorldGen/Structures/MineShaftPieces.cpp | 12 +- .../Structures/NetherBridgePieces.cpp | 3 +- .../WorldGen/Structures/StrongholdPieces.cpp | 8 +- .../WorldGen/Structures/Village.cpp | 22 +- Minecraft.World/WorldGen/Structures/Village.h | 3 +- .../WorldGen/Structures/VillagePieces.cpp | 7 +- 463 files changed, 12748 insertions(+), 11285 deletions(-) diff --git a/4J.Common/4J_Compat.h b/4J.Common/4J_Compat.h index 6cda066de..e776a6cf9 100644 --- a/4J.Common/4J_Compat.h +++ b/4J.Common/4J_Compat.h @@ -87,8 +87,7 @@ using PXMARKETPLACE_CONTENTOFFER_INFO = XMARKETPLACE_CONTENTOFFER_INFO*; #endif #ifndef XMARKETPLACE_OFFERING_TYPE_CONTENT -inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = - 0x00000002; +inline constexpr std::uint32_t XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002; #endif #ifndef XMARKETPLACE_OFFERING_TYPE_GAME_DEMO diff --git a/4J.Input/4J_Input.cpp b/4J.Input/4J_Input.cpp index d1911f737..ae44f7f38 100644 --- a/4J.Input/4J_Input.cpp +++ b/4J.Input/4J_Input.cpp @@ -264,7 +264,6 @@ static void utf8_pop_back(std::string& str) { str.erase(i); } - // Each tick we update the input state by polling SDL, this is where we get the // kbd and mouse state. void C_4JInput::Tick() { @@ -650,9 +649,7 @@ bool C_4JInput::GetMenuDisplayed(int iPad) { if (iPad >= 0 && iPad < 4) return s_menuDisplayed[iPad]; return false; } -const char* C_4JInput::GetText() { - return s_textInputBuf.c_str(); -} +const char* C_4JInput::GetText() { return s_textInputBuf.c_str(); } bool C_4JInput::VerifyStrings(wchar_t**, int, int (*)(void*, STRING_VERIFY_RESPONSE*), void*) { return true; diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index a31b6393a..827f05cde 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -102,8 +102,7 @@ void initialiseDefaultGameSettings(ProfileGameSettings* gameSettings) { } } // namespace -void C_4JProfile::Initialise(std::uint32_t dwTitleID, - std::uint32_t dwOfferID, +void C_4JProfile::Initialise(std::uint32_t dwTitleID, std::uint32_t dwOfferID, unsigned short usProfileVersion, unsigned int uiProfileValuesC, unsigned int uiProfileSettingsC, @@ -139,9 +138,9 @@ unsigned int C_4JProfile::RequestSignInUI( int iQuadrant) { return 0; } -unsigned int C_4JProfile::DisplayOfflineProfile( - int (*Func)(void*, const bool, const int iPad), void* lpParam, - int iQuadrant) { +unsigned int C_4JProfile::DisplayOfflineProfile(int (*Func)(void*, const bool, + const int iPad), + void* lpParam, int iQuadrant) { return 0; } unsigned int C_4JProfile::RequestConvertOfflineToGuestUI( @@ -152,7 +151,9 @@ unsigned int C_4JProfile::RequestConvertOfflineToGuestUI( void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID* pXuid, bool bOnlineXuid) { - if (pXuid) *pXuid = kFakeXuidBase + static_cast(isValidPad(iPad) ? iPad : 0); + if (pXuid) + *pXuid = + kFakeXuidBase + static_cast(isValidPad(iPad) ? iPad : 0); } bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { return xuid1 == xuid2; @@ -267,4 +268,6 @@ void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam, eUpsellResponse response, int iUserData), void* lpParam) {} -void C_4JProfile::SetDebugFullOverride(bool bVal) { s_profileIsFullVersion = bVal; } +void C_4JProfile::SetDebugFullOverride(bool bVal) { + s_profileIsFullVersion = bVal; +} diff --git a/4J.Profile/4J_Profile.h b/4J.Profile/4J_Profile.h index bd8ba69ce..6686a9e99 100644 --- a/4J.Profile/4J_Profile.h +++ b/4J.Profile/4J_Profile.h @@ -56,14 +56,15 @@ public: bool IsSignedInLive(int iProf); bool IsGuest(int iQuadrant); unsigned int RequestSignInUI(bool bFromInvite, bool bLocalGame, - bool bNoGuestsAllowed, - bool bMultiplayerSignIn, bool bAddUser, + bool bNoGuestsAllowed, bool bMultiplayerSignIn, + bool bAddUser, int (*Func)(void*, const bool, const int iPad), void* lpParam, int iQuadrant = XUSER_INDEX_ANY); - unsigned int DisplayOfflineProfile( - int (*Func)(void*, const bool, const int iPad), void* lpParam, - int iQuadrant = XUSER_INDEX_ANY); + unsigned int DisplayOfflineProfile(int (*Func)(void*, const bool, + const int iPad), + void* lpParam, + int iQuadrant = XUSER_INDEX_ANY); unsigned int RequestConvertOfflineToGuestUI( int (*Func)(void*, const bool, const int iPad), void* lpParam, int iQuadrant = XUSER_INDEX_ANY); @@ -80,8 +81,7 @@ public: void AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool* allAllowed, bool* friendsAllowed); bool CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, - PlayerUID* pXuids, - unsigned int xuidCount); + PlayerUID* pXuids, unsigned int xuidCount); void ShowProfileCard(int iPad, PlayerUID targetUid); bool GetProfileAvatar(int iPad, int (*Func)(void* lpParam, @@ -129,9 +129,8 @@ public: void RegisterAward(int iAwardNumber, int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected = false, CXuiStringTable* pStringTable = nullptr, - int iTitleStr = -1, - int iTextStr = -1, int iAcceptStr = -1, - char* pszThemeName = nullptr, + int iTitleStr = -1, int iTextStr = -1, + int iAcceptStr = -1, char* pszThemeName = nullptr, unsigned int uiThemeSize = 0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); diff --git a/4J.Render/gl3_loader.h b/4J.Render/gl3_loader.h index 516b3c4de..55991d6be 100644 --- a/4J.Render/gl3_loader.h +++ b/4J.Render/gl3_loader.h @@ -1,28 +1,28 @@ #pragma once #ifndef GL_GLEXT_PROTOTYPES -# define GL_GLEXT_PROTOTYPES 1 +#define GL_GLEXT_PROTOTYPES 1 #endif #include #include #include #include #ifndef GL_ARRAY_BUFFER -# define GL_ARRAY_BUFFER 0x8892 +#define GL_ARRAY_BUFFER 0x8892 #endif #ifndef GL_ELEMENT_ARRAY_BUFFER -# define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 #endif #ifndef GL_STATIC_DRAW -# define GL_STATIC_DRAW 0x88B4 +#define GL_STATIC_DRAW 0x88B4 #endif #ifndef GL_VERTEX_SHADER -# define GL_VERTEX_SHADER 0x8B31 +#define GL_VERTEX_SHADER 0x8B31 #endif #ifndef GL_FRAGMENT_SHADER -# define GL_FRAGMENT_SHADER 0x8B30 +#define GL_FRAGMENT_SHADER 0x8B30 #endif #ifndef GL_QUADS -# define GL_QUADS 0x0007 +#define GL_QUADS 0x0007 #endif static inline bool gl3_load() { const char* ver = (const char*)glGetString(GL_VERSION); @@ -33,10 +33,15 @@ static inline bool gl3_load() { 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); + fprintf(stderr, + "[gl3_loader] ERROR: Need GL 3.3, but system provides %s\n", + ver); return false; } } - fprintf(stderr, "[gl3_loader] GL Version: %s, it's all okay!! until android support.\n", ver); + fprintf( + stderr, + "[gl3_loader] GL Version: %s, it's all okay!! until android support.\n", + ver); return true; } \ No newline at end of file diff --git a/4J.Storage/4J_Storage.cpp b/4J.Storage/4J_Storage.cpp index cf9cca645..4d0f52962 100644 --- a/4J.Storage/4J_Storage.cpp +++ b/4J.Storage/4J_Storage.cpp @@ -31,8 +31,8 @@ bool C4JStorage::SetSaveDevice(int (*Func)(void*, const bool), void* lpParam, } void C4JStorage::Init(unsigned int uiSaveVersion, - const wchar_t* pwchDefaultSaveName, - char* pszSavePackName, int iMinimumSaveSize, + const wchar_t* pwchDefaultSaveName, char* pszSavePackName, + int iMinimumSaveSize, int (*Func)(void*, const ESavingMessage, int), void* lpParam, const char* szGroupID) {} void C4JStorage::ResetSaveData() {} @@ -61,8 +61,7 @@ void* C4JStorage::AllocateSaveData(unsigned int uiBytes) { } void C4JStorage::SetSaveImages(std::uint8_t* pbThumbnail, unsigned int thumbnailBytes, - std::uint8_t* pbImage, - unsigned int imageBytes, + std::uint8_t* pbImage, unsigned int imageBytes, std::uint8_t* pbTextData, unsigned int textDataBytes) {} C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(void*, @@ -130,7 +129,9 @@ C4JStorage::EDLCStatus C4JStorage::GetDLCOffers( } unsigned int C4JStorage::CancelGetDLCOffers() { return 0; } void C4JStorage::ClearDLCOffers() {} -XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { return s_dummyOffer; } +XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { + return s_dummyOffer; +} int C4JStorage::GetOfferCount() { return 0; } unsigned int C4JStorage::InstallOffer(int iOfferIDC, std::uint64_t* ullOfferIDA, int (*Func)(void*, int, int), @@ -146,7 +147,9 @@ C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, } return EDLC_NoInstalledDLC; } -XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { return s_dummyContentData; } +XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { + return s_dummyContentData; +} std::uint32_t C4JStorage::MountInstalledDLC( int iPad, std::uint32_t dwDLC, int (*Func)(void*, int, std::uint32_t, std::uint32_t), void* lpParam, @@ -165,8 +168,7 @@ C4JStorage::ETMSStatus C4JStorage::ReadTMSFile( int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, std::uint8_t** ppBuffer, unsigned int* pBufferSize, - int (*Func)(void*, wchar_t*, int, bool, int), void* lpParam, - int iAction) { + int (*Func)(void*, wchar_t*, int, bool, int), void* lpParam, int iAction) { return ETMSStatus_Fail; } bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, diff --git a/4J.Storage/4J_Storage.h b/4J.Storage/4J_Storage.h index 28ffcde4d..ea72d3b01 100644 --- a/4J.Storage/4J_Storage.h +++ b/4J.Storage/4J_Storage.h @@ -42,18 +42,18 @@ typedef std::vector XContentDataArray; class C4JStorage { public: // Structs defined in the DLC_Creator, but added here to be used in the app -typedef struct { - unsigned int uiFileSize; - std::uint32_t dwType; - std::uint32_t dwWchCount; // count of wchar_t in next array - wchar_t wchFile[1]; -} DLC_FILE_DETAILS, *PDLC_FILE_DETAILS; + typedef struct { + unsigned int uiFileSize; + std::uint32_t dwType; + std::uint32_t dwWchCount; // count of wchar_t in next array + wchar_t wchFile[1]; + } DLC_FILE_DETAILS, *PDLC_FILE_DETAILS; -typedef struct { - std::uint32_t dwType; - std::uint32_t dwWchCount; // count of wchar_t in next array; - wchar_t wchData[1]; // will be an array of size dwBytes -} DLC_FILE_PARAM, *PDLC_FILE_PARAM; + typedef struct { + std::uint32_t dwType; + std::uint32_t dwWchCount; // count of wchar_t in next array; + wchar_t wchData[1]; // will be an array of size dwBytes + } DLC_FILE_PARAM, *PDLC_FILE_PARAM; // End of DLC_Creator structs typedef struct { @@ -240,8 +240,8 @@ typedef struct { std::uint8_t* pbImage, unsigned int imageBytes, std::uint8_t* pbTextData, unsigned int textDataBytes); // Sets the thumbnail & image for the - // save, optionally setting the - // metadata in the png + // save, optionally setting the + // metadata in the png C4JStorage::ESaveGameState SaveSaveData(int (*Func)(void*, const bool), void* lpParam); void CopySaveDataToNewSave(std::uint8_t* pbThumbnail, @@ -269,7 +269,8 @@ typedef struct { void* lpParam); // Get the thumbnail for an individual save referenced // by pSaveInfo - void GetSaveCacheFileInfo(unsigned int fileIndex, XCONTENT_DATA& xContentData); + void GetSaveCacheFileInfo(unsigned int fileIndex, + XCONTENT_DATA& xContentData); void GetSaveCacheFileInfo(unsigned int fileIndex, std::uint8_t** ppbImageData, unsigned int* pImageBytes); @@ -291,8 +292,7 @@ typedef struct { void SetDLCPackageRoot(char* pszDLCRoot); C4JStorage::EDLCStatus GetDLCOffers( int iPad, int (*Func)(void*, int, std::uint32_t, int), void* lpParam, - std::uint32_t dwOfferTypesBitmask = - XMARKETPLACE_OFFERING_TYPE_CONTENT); + std::uint32_t dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT); unsigned int CancelGetDLCOffers(); void ClearDLCOffers(); XMARKETPLACE_CONTENTOFFER_INFO& GetOffer(unsigned int dw); @@ -334,9 +334,8 @@ typedef struct { #ifdef _XBOX C4JStorage::ETMSStatus WriteTMSFile( int iPad, C4JStorage::eGlobalStorage eStorageFacility, - C4JStorage::eTMS_FileType eFileType, char* pchFilePath, - char* pchBuffer, unsigned int bufferSize, TMSCLIENT_CALLBACK Func, - void* lpParam); + C4JStorage::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/Minecraft.Client/Commands/TeleportCommand.cpp b/Minecraft.Client/Commands/TeleportCommand.cpp index 15a3dd445..dab978392 100644 --- a/Minecraft.Client/Commands/TeleportCommand.cpp +++ b/Minecraft.Client/Commands/TeleportCommand.cpp @@ -65,22 +65,23 @@ void TeleportCommand::execute(std::shared_ptr source, // int pos = args.length - 3; // int maxPos = Level.MAX_LEVEL_SIZE; // int x = convertArgToInt(source, args[pos++], -maxPos, - //maxPos); int y = convertArgToInt(source, args[pos++], - //Level.minBuildHeight, Level.maxBuildHeight); int z = - //convertArgToInt(source, args[pos++], -maxPos, maxPos); + // maxPos); int y = convertArgToInt(source, + // args[pos++], Level.minBuildHeight, Level.maxBuildHeight); + // int z = convertArgToInt(source, args[pos++], -maxPos, maxPos); // victim.teleportTo(x + 0.5f, y, z + 0.5f); // logAdminAction(source, "commands.tp.coordinates", - //victim.getAName(), x, y, z); + // victim.getAName(), x, y, z); // } // } else if (args.length == 1 || args.length == 2) { // ServerPlayer destination = - //server.getPlayers().getPlayer(args[args.length - 1]); if (destination == - //null) throw new PlayerNotFoundException(); + // server.getPlayers().getPlayer(args[args.length - 1]); if + // (destination == null) throw new PlayerNotFoundException(); // victim.connection.teleport(destination.x, destination.y, - //destination.z, destination.yRot, destination.xRot); logAdminAction(source, - //"commands.tp.success", victim.getAName(), destination.getAName()); + // destination.z, destination.yRot, destination.xRot); + // logAdminAction(source, "commands.tp.success", victim.getAName(), + //destination.getAName()); // } //} } diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index 5a39b30a9..a64af092b 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -254,7 +254,6 @@ void StatsCounter::save(int player, bool force) { saveCounter = SAVE_DELAY; } - void StatsCounter::flushLeaderboards() { if (LeaderboardManager::Instance()->OpenSession()) { writeStats(); @@ -301,7 +300,6 @@ void StatsCounter::writeStats() { int viewCount = 0; int iPad = ProfileManager.GetLockedProfile(); - } void StatsCounter::setupStatBoards() { @@ -390,6 +388,5 @@ void StatsCounter::dumpStatsToTTY() { #define DEBUG_CLEAR_LEADERBOARDS (0xFFFFFFFF) #define DEBUG_ENABLE_CLEAR_LEADERBOARDS -void StatsCounter::WipeLeaderboards() { -} +void StatsCounter::WipeLeaderboards() {} #endif diff --git a/Minecraft.Client/GameState/StatsCounter.h b/Minecraft.Client/GameState/StatsCounter.h index bc34d7980..69c449751 100644 --- a/Minecraft.Client/GameState/StatsCounter.h +++ b/Minecraft.Client/GameState/StatsCounter.h @@ -90,6 +90,5 @@ private: bool isLargeStat(Stat* stat); void dumpStatsToTTY(); - void writeStats(); }; diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index a34ba8ec5..c687ed7dd 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -626,8 +626,8 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) { Tickable* MultiPlayerLevel::makeSoundUpdater( std::shared_ptr minecart) { - return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine, minecart, - // minecraft->player); + return nullptr; // new MinecartSoundUpdater(minecraft->soundEngine, + // minecart, minecraft->player); } void MultiPlayerLevel::tickWeather() { @@ -811,8 +811,8 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { EnterCriticalSection(&m_entitiesCS); for (auto it = entities.begin(); it != entities.end();) { bool found = false; - for (auto it2 = entitiesToRemove.begin(); - it2 != entitiesToRemove.end(); it2++) { + for (auto it2 = entitiesToRemove.begin(); it2 != entitiesToRemove.end(); + it2++) { if ((*it) == (*it2)) { found = true; break; diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 3fae07502..bda69f486 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -1384,8 +1384,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); - auto it = - find(m_hangingEntities.begin(), m_hangingEntities.end(), e); + auto it = find(m_hangingEntities.begin(), m_hangingEntities.end(), e); if (it != m_hangingEntities.end()) { // printf("Item to remove found\n"); m_hangingEntities.erase(it); @@ -1410,7 +1409,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); auto it = find(m_experienceOrbEntities.begin(), - m_experienceOrbEntities.end(), e); + m_experienceOrbEntities.end(), e); if (it != m_experienceOrbEntities.end()) { // printf("Item to remove found\n"); m_experienceOrbEntities.erase(it); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 1d97f3e47..9a6da86f1 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -91,7 +91,6 @@ int Minecraft::frameTimePos = 0; int64_t Minecraft::warezTime = 0; File Minecraft::workDir = File(L""); - ResourceLocation Minecraft::DEFAULT_FONT_LOCATION = ResourceLocation(TN_DEFAULT_FONT); ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); @@ -198,8 +197,8 @@ Minecraft::Minecraft(Component* mouseComponent, Canvas* parent, localgameModes[i] = nullptr; } - animateTickLevel = nullptr; // 4J added - m_inFullTutorialBits = 0; // 4J Added + animateTickLevel = nullptr; // 4J added + m_inFullTutorialBits = 0; // 4J Added reloadTextures = false; // initialise the audio before any textures are loaded - to avoid the @@ -233,7 +232,6 @@ void Minecraft::connectTo(const std::wstring& server, int port) { } void Minecraft::init() { - // glClearColor(0.2f, 0.2f, 0.2f, 1); workingDirectory = getWorkingDirectory(); @@ -468,7 +466,8 @@ void Minecraft::setScreen(Screen* screen) { this->screen = screen; if (screen == nullptr && level == nullptr) { screen = new TitleScreen(); - } else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) && + } else if (player != nullptr && + !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { #if defined(ENABLE_JAVA_GUIS) screen = new DeathScreen(); @@ -480,7 +479,8 @@ void Minecraft::setScreen(Screen* screen) { if (ticks == 0) { player->respawn(); } else { - ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, nullptr); + ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, + nullptr); } #endif } @@ -541,7 +541,8 @@ void Minecraft::destroy() { if (screen == nullptr && level == nullptr) { screen = new TitleScreen(); - } else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) && + } else if (player != nullptr && + !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { #if defined(ENABLE_JAVA_GUIS) screen = new DeathScreen(); @@ -553,7 +554,8 @@ void Minecraft::destroy() { if (ticks == 0) { player->respawn(); } else { - ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, nullptr); + ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, + nullptr); } #endif } @@ -605,7 +607,6 @@ void Minecraft::destroy() { // 4J-PB - splitting this function into 3 parts, so we can call the middle part // from our xbox game loop - void Minecraft::run() { running = true; // try { // 4J - removed try/catch @@ -624,7 +625,8 @@ bool Minecraft::setLocalPlayerIdx(int idx) { localPlayerIdx = idx; // If the player is not null, but the game mode is then this is just a temp // player whose only real purpose is to hold the viewport position - if (localplayers[idx] == nullptr || localgameModes[idx] == nullptr) return false; + if (localplayers[idx] == nullptr || localgameModes[idx] == nullptr) + return false; gameMode = localgameModes[idx]; player = localplayers[idx]; @@ -854,7 +856,8 @@ std::shared_ptr Minecraft::createExtraLocalPlayer( localplayers[idx]->SetXboxPad(iPad); - if (localplayers[idx]->input != nullptr) delete localplayers[idx]->input; + if (localplayers[idx]->input != nullptr) + delete localplayers[idx]->input; localplayers[idx]->input = new Input(); localplayers[idx]->resetPos(); @@ -907,7 +910,6 @@ void Minecraft::removeLocalPlayerIdx(int idx) { } getLevel(localplayers[idx]->dimension)->removeEntity(localplayers[idx]); - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title crashed after // exiting the tutorial It doesn't matter if they were in the tutorial // already @@ -1322,8 +1324,7 @@ void Minecraft::run_middle() { // did we just get input from a player who doesn't // exist? They'll be wanting to join the game then if (InputManager.ButtonPressed( - i, MINECRAFT_ACTION_PAUSEMENU)) - { + i, MINECRAFT_ACTION_PAUSEMENU)) { // Let them join // are they signed in? @@ -1430,7 +1431,6 @@ void Minecraft::run_middle() { } } - if (pause && level != nullptr) { float lastA = timer->a; timer->advanceTime(); @@ -2349,8 +2349,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { case Tile::chest_Id: *piAction = IDS_TOOLTIPS_MINE; - *piUse = (Tile::chest->getContainer(level, x, y, - z) != nullptr) + *piUse = (Tile::chest->getContainer( + level, x, y, z) != nullptr) ? IDS_TOOLTIPS_OPEN : -1; break; @@ -3402,14 +3402,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { #endif } - if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_PAUSEMENU)) - ) { + if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_PAUSEMENU))) { app.DebugPrintf( "PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n", player->GetXboxPad()); ui.PlayUISFX(eSFX_Press); #if !defined(ENABLE_JAVA_GUIS) - ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, + eUILayer_Scene); #endif } @@ -3439,8 +3439,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (selectedItem != nullptr) iCount = selectedItem->GetCount(); if (selectedItem != nullptr && !((player->ullButtonsPressed & - (1LL << MINECRAFT_ACTION_DROP)) && - selectedItem->GetCount() == 1)) { + (1LL << MINECRAFT_ACTION_DROP)) && + selectedItem->GetCount() == 1)) { itemName = selectedItem->getHoverName(); } if (!(player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_DROP)) || @@ -3473,7 +3473,6 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // } // #endif - if (level != nullptr) { if (player != nullptr) { recheckPlayerIn++; @@ -3598,7 +3597,9 @@ void Minecraft::reloadSound() { bgLoader->forceReload(); } -bool Minecraft::isClientSide() { return level != nullptr && level->isClientSide; } +bool Minecraft::isClientSide() { + return level != nullptr && level->isClientSide; +} void Minecraft::selectLevel(ConsoleSaveFile* saveFile, const std::wstring& levelId, @@ -3698,9 +3699,9 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/, forceStatsSave(player->GetXboxPad()); // 4J Stu - Added these for the case when we exit a level so we are - // setting the level to nullptr The level renderer needs to have it's - // stored level set to nullptr so that it doesn't break next time we - // set one + // setting the level to nullptr The level renderer needs to have + // it's stored level set to nullptr so that it doesn't break next + // time we set one if (levelRenderer != nullptr) { for (unsigned int p = 0; p < XUSER_MAX_COUNT; ++p) { levelRenderer->setLevel(p, nullptr); @@ -3709,8 +3710,8 @@ void Minecraft::setLevel(MultiPlayerLevel* level, int message /*=-1*/, if (particleEngine != nullptr) particleEngine->setLevel(nullptr); } } - // 4J If we are setting the level to nullptr then we are exiting, so delete the - // levels + // 4J If we are setting the level to nullptr then we are exiting, so delete + // the levels if (level == nullptr) { if (levels[0] != nullptr) { delete levels[0]; @@ -3863,7 +3864,6 @@ void Minecraft::prepareLevel(int title) { spawnPos->z = (int)player->z; } - for (int x = -r; x <= r; x += 16) { for (int z = -r; z <= r; z += 16) { if (progressRenderer != nullptr) @@ -4078,8 +4078,8 @@ void Minecraft::startAndConnectTo(const std::wstring& name, // if (ProfileManager.IsFullVersion()) { if (userName != L"" && - sid != L"") // 4J - username & side were compared with nullptr rather - // than empty strings + sid != L"") // 4J - username & side were compared with nullptr + // rather than empty strings { minecraft->user = new User(userName, sid); } else { @@ -4226,8 +4226,8 @@ if (gameMode->instaBuild) return; if (!down) missTime = 0; if (button == 0 && missTime > 0) return; -if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button == -0) +if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button +== 0) { int x = hitResult->x; int y = hitResult->y; @@ -4260,7 +4260,8 @@ bool mayUse = true; // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button -if(button==1 && (player->isSleeping() && level != nullptr && level->isClientSide)) +if(button==1 && (player->isSleeping() && level != nullptr && +level->isClientSide)) { shared_ptr mplp = std::dynamic_pointer_cast( player ); @@ -4279,8 +4280,8 @@ PlayerCommandPacket.STOP_SLEEPING)); if (hitResult == nullptr) { -if (button == 0 && !(dynamic_cast(gameMode) != nullptr)) missTime = -10; +if (button == 0 && !(dynamic_cast(gameMode) != nullptr)) +missTime = 10; } else if (hitResult->type == HitResult::ENTITY) { @@ -4402,9 +4403,7 @@ void Minecraft::playerLeftTutorial(int iPad) { } } - -int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) -{ +int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) { Minecraft* pMinecraftClass = (Minecraft*)pParam; if (g_NetworkManager.IsInSession()) { @@ -4424,7 +4423,7 @@ int Minecraft::InGame_SignInReturned(void* pParam, bool bContinue, int iPad) // It's possible that the player has not signed in - they can back out // or choose no for the converttoguest if (ProfileManager.IsSignedIn(iPad)) { - if (!g_NetworkManager.SessionHasSpace()) { + if (!g_NetworkManager.SessionHasSpace()) { unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; ui.RequestErrorMessage(IDS_MULTIPLAYER_FULL_TITLE, @@ -4485,7 +4484,7 @@ void Minecraft::tickAllConnections() { bool Minecraft::addPendingClientTextureRequest( const std::wstring& textureName) { auto it = find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName); + m_pendingTextureRequests.end(), textureName); if (it == m_pendingTextureRequests.end()) { m_pendingTextureRequests.push_back(textureName); return true; @@ -4495,7 +4494,7 @@ bool Minecraft::addPendingClientTextureRequest( void Minecraft::handleClientTextureReceived(const std::wstring& textureName) { auto it = find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName); + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } @@ -4516,4 +4515,3 @@ ColourTable* Minecraft::getColourTable() { return colours; } - diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index b496e1c5b..ae1992ba3 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -277,7 +277,7 @@ public: // bool isRaining ; // 4J - Moved to per player - //int64_t lastTickTime; + // int64_t lastTickTime; private: // 4J- per player? @@ -386,5 +386,4 @@ public: unsigned int getCurrentTexturePackId(); ColourTable* getColourTable(); - }; diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 39f47ac36..f9839d3fd 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -889,8 +889,7 @@ void MinecraftServer::stopServer(bool didInit) { // also need to check for a profile switch here - primary player signs out, // and another player signs in before dismissing the dash if ((m_bPrimaryPlayerSignedOut == false) && - ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) - { + ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) { // if trial version or saving is disabled, then don't save anything. // Also don't save anything if we didn't actually get through the server // initialisation. @@ -916,7 +915,7 @@ void MinecraftServer::stopServer(bool didInit) { saveGameRules(); app.m_gameRules.unloadCurrentGameRules(); if (levels[0] != nullptr) // This can be null if stopServer happens - // very quickly due to network error + // very quickly due to network error { levels[0]->saveToDisc( Minecraft::GetInstance()->progressRenderer, false); @@ -942,7 +941,6 @@ void MinecraftServer::stopServer(bool didInit) { } } - delete connection; connection = nullptr; delete players; @@ -1613,8 +1611,7 @@ void MinecraftServer::chunkPacketManagement_PreTick() { do { int longestTime = 0; auto playerConnectionBest = playersOrig.begin(); - for (auto it = playersOrig.begin(); it != playersOrig.end(); - it++) { + for (auto it = playersOrig.begin(); it != playersOrig.end(); it++) { int thisTime = 0; INetworkPlayer* np = (*it)->getNetworkPlayer(); if (np) { @@ -1700,8 +1697,8 @@ void MinecraftServer::cycleSlowQueueIndex() { s_slowQueuePlayerIndex = 0; } } while (g_NetworkManager.IsInSession() && currentPlayerCount > 0 && - s_slowQueuePlayerIndex != startingIndex && currentPlayer != nullptr && - currentPlayer->IsLocal()); + s_slowQueuePlayerIndex != startingIndex && + currentPlayer != nullptr && currentPlayer->IsLocal()); // app.DebugPrintf("Cycled slow queue index to %d\n", // s_slowQueuePlayerIndex); } diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 737f49fd2..b8c4ab837 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -22,7 +22,6 @@ class CommandDispatcher; #define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 250 - typedef struct _LoadSaveDataThreadParam { void* data; int64_t fileSize; diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index df4e34bfb..bbb0adc98 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -50,7 +50,6 @@ #include "../Platform/Common/UI/UI.h" #include "../Textures/Packs/DLCTexturePack.h" - ClientConnection::ClientConnection(Minecraft* minecraft, const std::wstring& ip, int port) { // 4J Stu - No longer used as we use the socket version below. @@ -1256,7 +1255,8 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, uiIDA[0] = IDS_CONFIRM_OK; ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(), - &ClientConnection::HostDisconnectReturned, nullptr); + &ClientConnection::HostDisconnectReturned, + nullptr); } else { app.SetAction(m_userIndex, eAppAction_ExitWorld, (void*)true); } @@ -1839,9 +1839,6 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { isAtLeastOneFriend = true; cantPlayContentRestricted = false; - - - if (!canPlay || !canPlayLocal || !isAtLeastOneFriend || cantPlayContentRestricted) { DisconnectPacket::eDisconnectReason reason = @@ -1943,8 +1940,7 @@ void ClientConnection::handlePreLogin(std::shared_ptr packet) { // On PS3, all non-signed in players (even guests) can get a useful // offlineXUID - if (!ProfileManager.IsGuest(m_userIndex)) - { + if (!ProfileManager.IsGuest(m_userIndex)) { // All other players we use their offline XUID so that they can play // the game offline ProfileManager.GetXUID(m_userIndex, &offlineXUID, false); @@ -2003,8 +1999,7 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) { if (subEntities != nullptr) { int offs = packet->id - mob->entityId; // for (int i = 0; i < subEntities.length; i++) - for (auto it = subEntities->begin(); it != subEntities->end(); - ++it) { + for (auto it = subEntities->begin(); it != subEntities->end(); ++it) { // subEntities[i].entityId += offs; (*it)->entityId += offs; } @@ -2078,7 +2073,8 @@ void ClientConnection::handleEntityLinkPacket( 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); } @@ -2416,7 +2412,6 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { minecraft->setScreen(new ReceivingLevelScreen(this)); // minecraft->addPendingLocalConnection(m_userIndex, this); - if (minecraft->localgameModes[m_userIndex] != nullptr) { TutorialMode* gameMode = (TutorialMode*)minecraft->localgameModes[m_userIndex]; @@ -2816,7 +2811,8 @@ void ClientConnection::handleTileEntityData( if (te != nullptr) { if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && - std::dynamic_pointer_cast(te) != nullptr) { + std::dynamic_pointer_cast(te) != + nullptr) { std::dynamic_pointer_cast(te)->load( packet->tag); } else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && @@ -2830,7 +2826,8 @@ void ClientConnection::handleTileEntityData( std::dynamic_pointer_cast(te)->load( packet->tag); } else if (packet->type == TileEntityDataPacket::TYPE_SKULL && - std::dynamic_pointer_cast(te) != nullptr) { + std::dynamic_pointer_cast(te) != + nullptr) { std::dynamic_pointer_cast(te)->load( packet->tag); } @@ -2912,7 +2909,8 @@ void ClientConnection::handleGameEvent( app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown - if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) + if (minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != + nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()] ->getTutorial() ->showTutorialPopup(false); @@ -3362,8 +3360,7 @@ int ClientConnection::HostDisconnectReturned( uiIDA, 2, ProfileManager.GetPrimaryPad(), &ClientConnection::ExitGameAndSaveReturned, nullptr); - } else - { + } else { MinecraftServer::getInstance()->setSaveOnExit(true); // flag a app action of exit game app.SetAction(iPad, eAppAction_ExitWorld); @@ -3396,19 +3393,15 @@ std::wstring ClientConnection::GetDisplayNameByGamertag(std::wstring gamertag) { } void ClientConnection::handleAddObjective( - std::shared_ptr packet) { -} + std::shared_ptr packet) {} -void ClientConnection::handleSetScore(std::shared_ptr packet) { -} +void ClientConnection::handleSetScore(std::shared_ptr packet) {} void ClientConnection::handleSetDisplayObjective( - std::shared_ptr packet) { -} + std::shared_ptr packet) {} void ClientConnection::handleSetPlayerTeamPacket( - std::shared_ptr packet) { -} + std::shared_ptr packet) {} void ClientConnection::handleParticleEvent( std::shared_ptr packet) { @@ -3444,8 +3437,8 @@ void ClientConnection::handleUpdateAttributes( (std::dynamic_pointer_cast(entity))->getAttributes(); std::unordered_set attributeSnapshots = packet->getValues(); - for (auto it = attributeSnapshots.begin(); - it != attributeSnapshots.end(); ++it) { + for (auto it = attributeSnapshots.begin(); it != attributeSnapshots.end(); + ++it) { UpdateAttributesPacket::AttributeSnapshot* attribute = *it; AttributeInstance* instance = attributes->getInstance(attribute->getId()); @@ -3465,8 +3458,7 @@ void ClientConnection::handleUpdateAttributes( std::unordered_set* modifiers = attribute->getModifiers(); - for (auto it2 = modifiers->begin(); it2 != modifiers->end(); - ++it2) { + for (auto it2 = modifiers->begin(); it2 != modifiers->end(); ++it2) { AttributeModifier* modifier = *it2; instance->addModifier( new AttributeModifier(modifier->getId(), modifier->getAmount(), diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index c8537b5aa..128f33cfc 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -207,8 +207,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) { (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) == + if (InterlockedCompareExchangeRelease( + (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == (int32_t)lastChunk) #endif // 0 { diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index b9046375d..c58099822 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -93,8 +93,8 @@ void PendingConnection::sendPreLoginResponse() { StorageManager.GetSaveUniqueFilename(szUniqueMapName); PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); - for (auto it = playerList->players.begin(); - it != playerList->players.end(); ++it) { + for (auto it = playerList->players.begin(); it != playerList->players.end(); + ++it) { std::shared_ptr player = *it; // If the offline Xuid is invalid but the online one is not then that's // guest which we should ignore If the online Xuid is invalid but the @@ -180,9 +180,9 @@ void PendingConnection::handleAcceptedLogin( packet->m_onlineXuid); if (playerEntity != nullptr) { server->getPlayers()->placeNewPlayer(connection, playerEntity, packet); - connection = nullptr; // We've moved responsibility for this over to the - // new PlayerConnection, nullptr so we don't delete our - // reference to it here in our dtor + connection = nullptr; // We've moved responsibility for this over to + // the new PlayerConnection, nullptr so we don't + // delete our reference to it here in our dtor } done = true; } diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index 0608cc5a5..ddcbdd577 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -105,7 +105,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { LevelChunk* chunk = parent->level->getChunk(pos.x, pos.z); updateInhabitedTime(chunk); auto it = find(parent->knownChunks.begin(), - parent->knownChunks.end(), this); + parent->knownChunks.end(), this); if (it != parent->knownChunks.end()) parent->knownChunks.erase(it); } int64_t id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32); @@ -117,7 +117,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { } if (changes > 0) { auto it = find(parent->changedChunks.begin(), - parent->changedChunks.end(), this); + parent->changedChunks.end(), this); parent->changedChunks.erase(it); } parent->getLevel()->cache->drop(pos.x, pos.z); @@ -764,10 +764,9 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr player, if (chunk == nullptr) { return false; } else { - auto it1 = - find(chunk->players.begin(), chunk->players.end(), player); + auto it1 = find(chunk->players.begin(), chunk->players.end(), player); auto it2 = find(player->chunksToSend.begin(), - player->chunksToSend.end(), chunk->pos); + player->chunksToSend.end(), chunk->pos); return it1 != chunk->players.end() && it2 == player->chunksToSend.end(); } diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index f4f1cab17..04285addf 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -273,9 +273,7 @@ void PlayerConnection::handleMovePlayer( float r = 1 / 16.0f; AABB shrunk = player->bb.shrink(r, r, r); - bool oldOk = - level->getCubes(player, &shrunk) - ->empty(); + bool oldOk = level->getCubes(player, &shrunk)->empty(); if (player->onGround && !packet->onGround && yDist > 0) { // assume the player made a jump @@ -327,9 +325,7 @@ void PlayerConnection::handleMovePlayer( // TODO: check if this can be elided shrunk = player->bb.shrink(r, r, r); - bool newOk = - level->getCubes(player, &shrunk) - ->empty(); + bool newOk = level->getCubes(player, &shrunk)->empty(); if (oldOk && (fail || !newOk) && !player->isSleeping()) { teleport(xLastOk, yLastOk, zLastOk, yRotT, xRotT); return; @@ -712,7 +708,7 @@ void PlayerConnection::handleInteract(std::shared_ptr packet) { // a ray from head->head, but we may actually be looking at a different part // of the entity that can be seen even though the ray is blocked. if (target != nullptr) // && player->canSee(target) && - // player->distanceToSqr(target) < 6 * 6) + // player->distanceToSqr(target) < 6 * 6) { // boole canSee = player->canSee(target); // double maxDist = 6 * 6; @@ -852,7 +848,7 @@ void PlayerConnection::handleTextureReceived(const std::wstring& textureName) { // This sends the server received texture out to any other players waiting // for the data auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), - textureName); + textureName); if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwBytes = 0; @@ -871,7 +867,7 @@ void PlayerConnection::handleTextureAndGeometryReceived( // This sends the server received texture out to any other players waiting // for the data auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), - textureName); + textureName); if (it != m_texturesRequested.end()) { std::uint8_t* pbData = nullptr; unsigned int dwTextureBytes = 0; @@ -1112,7 +1108,8 @@ void PlayerConnection::handleContainerSetSlot( std::shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); if (packet->item != nullptr) { - if (lastItem == nullptr || lastItem->count < packet->item->count) { + if (lastItem == nullptr || + lastItem->count < packet->item->count) { packet->item->popTime = Inventory::POP_TIME_DURATION; } } @@ -1226,11 +1223,12 @@ void PlayerConnection::handleSetCreativeModeSlot( bool validSlot = (packet->slotNum >= InventoryMenu::CRAFT_SLOT_START && packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START + Inventory::getSelectionSize())); - bool validItem = - item == nullptr || (item->id < Item::items.length && item->id >= 0 && - Item::items[item->id] != nullptr); - bool validData = item == nullptr || (item->getAuxValue() >= 0 && - item->count > 0 && item->count <= 64); + bool validItem = item == nullptr || + (item->id < Item::items.length && item->id >= 0 && + Item::items[item->id] != nullptr); + bool validData = + item == nullptr || + (item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64); if (validSlot && validItem && validData) { if (item == nullptr) { @@ -1795,8 +1793,10 @@ void PlayerConnection::handleTradeItem( int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); - if ((buyAItem != nullptr && buyAMatches >= buyAItem->count) && - (buyBItem == nullptr || buyBMatches >= buyBItem->count)) { + if ((buyAItem != nullptr && + buyAMatches >= buyAItem->count) && + (buyBItem == nullptr || + buyBMatches >= buyBItem->count)) { menu->getMerchant()->notifyTrade(activeRecipe); // Remove the items we are purchasing with diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 9d9eda446..271547e33 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -83,7 +83,6 @@ void PlayerList::placeNewPlayer(Connection* connection, player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST, 1); } - // 4J Stu - TU-1 hotfix // Fix for #13150 - When a player loads/joins a game after saving/leaving in // the nether, sometimes they are spawned on top of the nether and cannot @@ -268,8 +267,7 @@ void PlayerList::placeNewPlayer(Connection* connection, level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); auto activeEffects = player->getActiveEffects(); - for (auto it = activeEffects->begin(); it != activeEffects->end(); - ++it) { + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; playerConnection->send(std::shared_ptr( new UpdateMobEffectPacket(player->entityId, effect))); @@ -602,7 +600,8 @@ std::shared_ptr PlayerList::respawn( if (ep->dimension != oldDimension) continue; INetworkPlayer* otherPlayer = ep->connection->getNetworkPlayer(); - if (otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer)) { + if (otherPlayer != nullptr && + thisPlayer->IsSameSystem(otherPlayer)) { // There's another player here in the same dimension - we're not // the last one out isEmptying = false; @@ -614,9 +613,9 @@ std::shared_ptr PlayerList::respawn( // (1) if this isn't the primary player, then we just need to remove it from // the entity tracker (2) if this Is the primary player then: // (a) if isEmptying is true, then remove the player from the - //tracker, and send "remove entity" packets for anything seen (this is the - //original behaviour of the code) (b) if isEmptying is false, then we'll be - //transferring control of entity tracking to another player + // tracker, and send "remove entity" packets for anything seen (this is the + // original behaviour of the code) (b) if isEmptying is false, then + // we'll be transferring control of entity tracking to another player if (isPrimary) { if (isEmptying) { @@ -893,8 +892,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, // 4J Stu - Fix for #64683 - Customer Encountered: TU7: Content: Gameplay: // Potion effects are removed after using the Nether Portal std::vector* activeEffects = player->getActiveEffects(); - for (auto it = activeEffects->begin(); it != activeEffects->end(); - ++it) { + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; player->connection->send(std::shared_ptr( @@ -1130,9 +1128,9 @@ bool PlayerList::isOp(std::shared_ptr player) { cheatsEnabled = cheatsEnabled || app.GetUseDPadForDebug(); #endif INetworkPlayer* networkPlayer = player->connection->getNetworkPlayer(); - bool isOp = - cheatsEnabled && (player->isModerator() || - (networkPlayer != nullptr && networkPlayer->IsHost())); + bool isOp = cheatsEnabled && + (player->isModerator() || + (networkPlayer != nullptr && networkPlayer->IsHost())); return isOp; } @@ -1345,8 +1343,8 @@ void PlayerList::saveAll(ProgressListener* progressListener, bool bDeleteGuestMaps /*= false*/) { if (progressListener != nullptr) progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS); - // 4J - playerIo can be nullptr if we have have to exit a game really early on - // due to network failure + // 4J - playerIo can be nullptr if we have have to exit a game really early + // on due to network failure if (playerIo) { playerIo->saveAllCachedData(); for (unsigned int i = 0; i < players.size(); i++) { @@ -1489,7 +1487,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, bool playerRemoved = false; auto it = find(receiveAllPlayers[dimIndex].begin(), - receiveAllPlayers[dimIndex].end(), player); + receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) app.DebugPrintf( @@ -1509,7 +1507,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, newPlayer->connection->getNetworkPlayer(); if (newPlayer != player && newPlayer->dimension == playerDim && - otherPlayer != nullptr && otherPlayer->IsSameSystem(thisPlayer)) { + otherPlayer != nullptr && + otherPlayer->IsSameSystem(thisPlayer)) { #if !defined(_CONTENT_PACKAGE) app.DebugPrintf( "Remove: Adding player %ls as primary in dimension %d\n", @@ -1522,7 +1521,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, } else if (thisPlayer == nullptr) { #if !defined(_CONTENT_PACKAGE) app.DebugPrintf( - "Remove: Qnet player for %ls was nullptr so re-checking all players\n", + "Remove: Qnet player for %ls was nullptr so re-checking all " + "players\n", player->name.c_str()); #endif // 4J Stu - Something went wrong, or possibly the QNet player left diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 685133744..b01132973 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -46,7 +46,7 @@ ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage, ServerChunkCache::~ServerChunkCache() { storage->WaitForAll(); // MGH - added to fix crash bug 175183 delete emptyChunk; - delete[] cache; // 4jcraft changed to delete[] + delete[] cache; // 4jcraft changed to delete[] delete source; #if defined(_LARGE_WORLDS) @@ -166,8 +166,8 @@ LevelChunk* ServerChunkCache::create( (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) == + if (InterlockedCompareExchangeRelease( + (int32_t*)&cache[idx], (int32_t)chunk, (int32_t)lastChunk) == (int32_t)lastChunk) #endif { @@ -715,8 +715,8 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) { } } } else { - // 4J Stu - We have multiple for threads for all saving as part of the - // storage, so use that rather than new threads here + // 4J Stu - We have multiple for threads for all saving as part of the + // storage, so use that rather than new threads here // Created a roughly sorted list to match the order that the files were // created in McRegionChunkStorage::McRegionChunkStorage. This is to @@ -814,7 +814,7 @@ bool ServerChunkCache::tick() { // loadedChunks.remove(cp); // loadedChunkList.remove(chunk); auto it = find(m_loadedChunkList.begin(), - m_loadedChunkList.end(), chunk); + m_loadedChunkList.end(), chunk); if (it != m_loadedChunkList.end()) m_loadedChunkList.erase(it); diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.cpp b/Minecraft.Client/Network/ServerCommandDispatcher.cpp index c363df0d7..e427d3222 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/Network/ServerCommandDispatcher.cpp @@ -57,8 +57,8 @@ void ServerCommandDispatcher::logAdminCommand( int customData, const std::wstring& additionalMessage) { PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); // for (Player player : MinecraftServer.getInstance().getPlayers().players) - for (auto it = playerList->players.begin(); - it != playerList->players.end(); ++it) { + for (auto it = playerList->players.begin(); it != playerList->players.end(); + ++it) { std::shared_ptr player = *it; if (player != source && playerList->isOp(player)) { // TODO: Change chat packet to be able to send more bits of data diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 04285c507..79b779aba 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -103,7 +103,7 @@ void ServerConnection::tick() { bool ServerConnection::addPendingTextureRequest( const std::wstring& textureName) { auto it = find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName); + m_pendingTextureRequests.end(), textureName); if (it == m_pendingTextureRequests.end()) { m_pendingTextureRequests.push_back(textureName); return true; @@ -120,7 +120,7 @@ bool ServerConnection::addPendingTextureRequest( void ServerConnection::handleTextureReceived(const std::wstring& textureName) { auto it = find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName); + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } @@ -135,7 +135,7 @@ void ServerConnection::handleTextureReceived(const std::wstring& textureName) { void ServerConnection::handleTextureAndGeometryReceived( const std::wstring& textureName) { auto it = find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName); + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } diff --git a/Minecraft.Client/Platform/Common/App_enums.h b/Minecraft.Client/Platform/Common/App_enums.h index 1b6c2240c..68d2f1af8 100644 --- a/Minecraft.Client/Platform/Common/App_enums.h +++ b/Minecraft.Client/Platform/Common/App_enums.h @@ -658,8 +658,6 @@ enum EControllerActions { ACTION_MENU_OTHER_STICK_RIGHT, ACTION_MENU_PAUSEMENU, - - ACTION_MENU_OK, ACTION_MENU_CANCEL, // 4jcraft added, off by one diff --git a/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h b/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h index 192e904f7..6d25da9b5 100644 --- a/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h +++ b/Minecraft.Client/Platform/Common/Audio/Consoles_SoundEngine.h @@ -87,5 +87,3 @@ private: bool m_bIsPlayingEndMusic; bool m_bIsPlayingNetherMusic; }; - - diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp index 8d40e3a8b..12376e5c1 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp @@ -794,7 +794,6 @@ void SoundEngine::init(Options* pOptions) { } app.DebugPrintf("---SoundEngine::init - driver opened\n"); - AIL_set_event_error_callback(ErrorCallback); AIL_set_3D_rolloff_factor(m_hDriver, 1.0); @@ -853,14 +852,11 @@ void SoundEngine::init(Options* pOptions) { 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 @@ -1093,13 +1089,11 @@ static float fVal = 0.0f; // ///////////////////////////////////////////// - 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) @@ -1175,7 +1169,6 @@ SoundEngine::SoundEngine() { memset(CurrentSoundsPlaying, 0, sizeof(int) * (eSoundType_MAX + eSFX_MAX)); memset(m_ListenerA, 0, sizeof(AUDIO_LISTENER) * XUSER_MAX_COUNT); - } void SoundEngine::destroy() {} @@ -1389,7 +1382,7 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) { // ///////////////////////////////////////////// void SoundEngine::playMusicTick() { -// AP - vita will update the music during the mixer callback + // AP - vita will update the music during the mixer callback playMusicUpdate(); } @@ -1487,7 +1480,6 @@ void SoundEngine::playMusicUpdate() { } strcat((char*)m_szStreamName, m_szStreamFileA[m_musicID]); strcat((char*)m_szStreamName, ".binka"); - } // std::wstring name = diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h index 07d22668d..558131447 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.h @@ -170,5 +170,4 @@ private: int m_iStream_End_Min, m_iStream_End_Max; int m_iStream_CD_1; bool* m_bHeardTrackA; - }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp b/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp index 1e7b13674..867716afb 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp +++ b/Minecraft.Client/Platform/Common/Audio/SoundNames.cpp @@ -3,64 +3,64 @@ #include "Consoles_SoundEngine.h" const wchar_t* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { - L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT - L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT - L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP - L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT - L"mob/cow/hurt", // eSoundType_MOB_COW_HURT - L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT - L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH - L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT - L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL - L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE - L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING - L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK - L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT - L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH - L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE - L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE - L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT - L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH - L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN - L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM - L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH - L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL - L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE - L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE - L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT - L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH - L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL - L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT - L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT - L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH - L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY - L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT, - L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT - L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH, - L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP, - L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT, - L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT, - L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT, - L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH, - L"mob/slime/slime", // eSoundType_MOB_SLIME, - L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK, - L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT, - L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH, - L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT, - L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT, - L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH, - L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD, - L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK, - L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL, - L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG, - L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL, - L"mob/cat/purr", // eSoundType_MOB_CAT_PURR - L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW - L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW + L"mob/chicken/chicken", // eSoundType_MOB_CHICKEN_AMBIENT + L"mob/chicken/chickenhurt", // eSoundType_MOB_CHICKEN_HURT + L"mob/chicken/chickenplop", // eSoundType_MOB_CHICKENPLOP + L"mob/cow/say", // eSoundType_MOB_COW_AMBIENT + L"mob/cow/hurt", // eSoundType_MOB_COW_HURT + L"mob/pig/pig", // eSoundType_MOB_PIG_AMBIENT + L"mob/pig/pigdeath", // eSoundType_MOB_PIG_DEATH + L"mob/sheep/sheep", // eSoundType_MOB_SHEEP_AMBIENT + L"mob/wolf/growl", // eSoundType_MOB_WOLF_GROWL + L"mob/wolf/whine", // eSoundType_MOB_WOLF_WHINE + L"mob/wolf/panting", // eSoundType_MOB_WOLF_PANTING + L"mob/wolf/bark", // eSoundType_MOB_WOLF_BARK + L"mob/wolf/hurt", // eSoundType_MOB_WOLF_HURT + L"mob/wolf/death", // eSoundType_MOB_WOLF_DEATH + L"mob/wolf/shake", // eSoundType_MOB_WOLF_SHAKE + L"mob/blaze/breathe", // eSoundType_MOB_BLAZE_BREATHE + L"mob/blaze/hit", // eSoundType_MOB_BLAZE_HURT + L"mob/blaze/death", // eSoundType_MOB_BLAZE_DEATH + L"mob/ghast/moan", // eSoundType_MOB_GHAST_MOAN + L"mob/ghast/scream", // eSoundType_MOB_GHAST_SCREAM + L"mob/ghast/death", // eSoundType_MOB_GHAST_DEATH + L"mob/ghast/fireball", // eSoundType_MOB_GHAST_FIREBALL + L"mob/ghast/charge", // eSoundType_MOB_GHAST_CHARGE + L"mob/endermen/idle", // eSoundType_MOB_ENDERMEN_IDLE + L"mob/endermen/hit", // eSoundType_MOB_ENDERMEN_HIT + L"mob/endermen/death", // eSoundType_MOB_ENDERMEN_DEATH + L"mob/endermen/portal", // eSoundType_MOB_ENDERMEN_PORTAL + L"mob/zombiepig/zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT + L"mob/zombiepig/zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT + L"mob/zombiepig/zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH + L"mob/zombiepig/zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY + L"mob/silverfish/say", // eSoundType_MOB_SILVERFISH_AMBIENT, + L"mob/silverfish/hit", // eSoundType_MOB_SILVERFISH_HURT + L"mob/silverfish/kill", // eSoundType_MOB_SILVERFISH_DEATH, + L"mob/silverfish/step", // eSoundType_MOB_SILVERFISH_STEP, + L"mob/skeleton/skeleton", // eSoundType_MOB_SKELETON_AMBIENT, + L"mob/skeleton/skeletonhurt", // eSoundType_MOB_SKELETON_HURT, + L"mob/spider/spider", // eSoundType_MOB_SPIDER_AMBIENT, + L"mob/spider/spiderdeath", // eSoundType_MOB_SPIDER_DEATH, + L"mob/slime/slime", // eSoundType_MOB_SLIME, + L"mob/slime/slimeattack", // eSoundType_MOB_SLIME_ATTACK, + L"mob/creeper/creeper", // eSoundType_MOB_CREEPER_HURT, + L"mob/creeper/creeperdeath", // eSoundType_MOB_CREEPER_DEATH, + L"mob/zombie/zombie", // eSoundType_MOB_ZOMBIE_AMBIENT, + L"mob/zombie/zombiehurt", // eSoundType_MOB_ZOMBIE_HURT, + L"mob/zombie/zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH, + L"mob/zombie/wood", // eSoundType_MOB_ZOMBIE_WOOD, + L"mob/zombie/woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK, + L"mob/zombie/metal", // eSoundType_MOB_ZOMBIE_METAL, + L"mob/magmacube/big", // eSoundType_MOB_MAGMACUBE_BIG, + L"mob/magmacube/small", // eSoundType_MOB_MAGMACUBE_SMALL, + L"mob/cat/purr", // eSoundType_MOB_CAT_PURR + L"mob/cat/purreow", // eSoundType_MOB_CAT_PURREOW + L"mob/cat/meow", // eSoundType_MOB_CAT_MEOW // 4J-PB - correct the name of the event for hitting ocelots L"mob/cat/hitt", // eSoundType_MOB_CAT_HITT - // L"mob.irongolem.throw", // - //eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit", + // L"mob.irongolem.throw", // + // eSoundType_MOB_IRONGOLEM_THROW L"mob.irongolem.hit", //// eSoundType_MOB_IRONGOLEM_HIT L"mob.irongolem.death", //// eSoundType_MOB_IRONGOLEM_DEATH L"mob.irongolem.walk", //// eSoundType_MOB_IRONGOLEM_WALK @@ -85,14 +85,14 @@ const wchar_t* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = { L"ambient/weather/rain", // eSoundType_AMBIENT_WEATHER_RAIN, L"ambient/weather/thunder", // eSoundType_AMBIENT_WEATHER_THUNDER, L"ambient/cave/cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!! - L"portal/portal", // eSoundType_PORTAL_PORTAL, + L"portal/portal", // eSoundType_PORTAL_PORTAL, // 4J-PB - added a couple that were still using std::wstring L"portal/trigger", // eSoundType_PORTAL_TRIGGER L"portal/travel", // eSoundType_PORTAL_TRAVEL L"fire/ignite", // eSoundType_FIRE_IGNITE, L"fire/fire", // eSoundType_FIRE_FIRE, - L"damage/hit", // eSoundType_DAMAGE_HURT, + L"damage/hit", // eSoundType_DAMAGE_HURT, L"damage/fallsmall", // eSoundType_DAMAGE_FALL_SMALL, L"damage/fallbig", // eSoundType_DAMAGE_FALL_BIG, L"note/harp", // eSoundType_NOTE_HARP, diff --git a/Minecraft.Client/Platform/Common/BuildVer.h b/Minecraft.Client/Platform/Common/BuildVer.h index 9248a8eba..546350dc5 100644 --- a/Minecraft.Client/Platform/Common/BuildVer.h +++ b/Minecraft.Client/Platform/Common/BuildVer.h @@ -1,34 +1,38 @@ #pragma once - -#define VER_PRODUCTMAJORVERSION 0 -#define VER_PRODUCTMINORVERSION 0 +#define VER_PRODUCTMAJORVERSION 0 +#define VER_PRODUCTMINORVERSION 0 // This goes up with each build -// 4J-JEV: This value is extracted with a regex so it can be placed as the version in the AppX manifest on Durango. -#define VER_PRODUCTBUILD 560 +// 4J-JEV: This value is extracted with a regex so it can be placed as the +// version in the AppX manifest on Durango. +#define VER_PRODUCTBUILD 560 // This goes up if there is any change to network traffic or code in a build -#define VER_NETWORK 560 -#define VER_PRODUCTBUILD_QFE 0 +#define VER_NETWORK 560 +#define VER_PRODUCTBUILD_QFE 0 -#define VER_FILEVERSION_STRING "1.6" -#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING -#define VER_FILEVERSION_STRING_W L"1.6" -#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W -#define VER_FILEBETA_STR "" +#define VER_FILEVERSION_STRING "1.6" +#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING +#define VER_FILEVERSION_STRING_W L"1.6" +#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W +#define VER_FILEBETA_STR "" #undef VER_FILEVERSION -#define VER_FILEVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE -#define VER_PRODUCTVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE +#define VER_FILEVERSION \ + VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \ + VER_PRODUCTBUILD_QFE +#define VER_PRODUCTVERSION \ + VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \ + VER_PRODUCTBUILD_QFE -#if (VER_PRODUCTBUILD < 10) -#define VER_FILEBPAD "000" +#if (VER_PRODUCTBUILD < 10) +#define VER_FILEBPAD "000" #define VER_FILEBPAD_W L"000" -#elif (VER_PRODUCTBUILD < 100) -#define VER_FILEBPAD "00" +#elif (VER_PRODUCTBUILD < 100) +#define VER_FILEBPAD "00" #define VER_FILEBPAD_W L"00" -#elif (VER_PRODUCTBUILD < 1000) -#define VER_FILEBPAD "0" +#elif (VER_PRODUCTBUILD < 1000) +#define VER_FILEBPAD "0" #define VER_FILEBPAD_W L"0" #else #define VER_FILEBPAD @@ -37,21 +41,25 @@ #define VER_WIDE_PREFIX(x) L##x -#define VER_FILEVERSION_STR2(x,y) VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y -#define VER_FILEVERSION_STR2_W(x,y) VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) L"." 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) +#define VER_FILEVERSION_STR2(x, y) \ + VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y +#define VER_FILEVERSION_STR2_W(x, y) \ + VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX( \ + #x) L"." 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) #undef VER_FILEVERSION_STR -#define VER_FILEVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_FILEVERSION_STR \ + VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_PRODUCTVERSION_STR \ + VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_FILEVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_PRODUCTVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_FILEVERSION_STR_W \ + VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_PRODUCTVERSION_STR_W \ + VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#if (VER_PRODUCTBUILD_QFE >= 256) -#error "QFE number cannot exceed 255" +#if (VER_PRODUCTBUILD_QFE >= 256) +#error "QFE number cannot exceed 255" #endif - - - diff --git a/Minecraft.Client/Platform/Common/C4JMemoryPool.h b/Minecraft.Client/Platform/Common/C4JMemoryPool.h index 9e9b4db95..39a6b14f7 100644 --- a/Minecraft.Client/Platform/Common/C4JMemoryPool.h +++ b/Minecraft.Client/Platform/Common/C4JMemoryPool.h @@ -1,176 +1,147 @@ #pragma once - #include -class C4JMemoryPool -{ +class C4JMemoryPool { public: - unsigned int Align(unsigned int val, unsigned int align) { return int((val+(align-1))/align) * align; } - virtual void* Alloc(size_t size) = 0; - virtual void Free(void* ptr) = 0; + unsigned int Align(unsigned int val, unsigned int align) { + return int((val + (align - 1)) / align) * align; + } + virtual void* Alloc(size_t size) = 0; + virtual void Free(void* ptr) = 0; }; - - // Fast Efficient Fixed-Size Memory Pool : No Loops and No Overhead // http://www.alogicalmind.com/memory_pools/index.htm -class C4JMemoryPoolFixed : public C4JMemoryPool -{ - // Basic type define - typedef unsigned int uint; - typedef unsigned char uchar; - uint m_numOfBlocks; // Num of blocks - uint m_sizeOfEachBlock; // Size of each block - uint m_numFreeBlocks; // Num of remaining blocks - uint m_numInitialized; // Num of initialized blocks - uchar* m_memStart; // Beginning of memory pool - uchar* m_memEnd; // End of memory pool - uchar* m_next; // Num of next free block -// CRITICAL_SECTION m_CS; +class C4JMemoryPoolFixed : public C4JMemoryPool { + // Basic type define + typedef unsigned int uint; + typedef unsigned char uchar; + uint m_numOfBlocks; // Num of blocks + uint m_sizeOfEachBlock; // Size of each block + uint m_numFreeBlocks; // Num of remaining blocks + uint m_numInitialized; // Num of initialized blocks + uchar* m_memStart; // Beginning of memory pool + uchar* m_memEnd; // End of memory pool + uchar* m_next; // Num of next free block + // CRITICAL_SECTION m_CS; public: - C4JMemoryPoolFixed() - { - m_numOfBlocks = 0; - m_sizeOfEachBlock = 0; - m_numFreeBlocks = 0; - m_numInitialized = 0; - m_memStart = nullptr; - m_memEnd = nullptr; - m_next = 0; - } + C4JMemoryPoolFixed() { + m_numOfBlocks = 0; + m_sizeOfEachBlock = 0; + m_numFreeBlocks = 0; + m_numInitialized = 0; + m_memStart = nullptr; + m_memEnd = nullptr; + m_next = 0; + } - C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks) - { - CreatePool(sizeOfEachBlock, numOfBlocks); - } + C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks) { + CreatePool(sizeOfEachBlock, numOfBlocks); + } - ~C4JMemoryPoolFixed() { DestroyPool(); } + ~C4JMemoryPoolFixed() { DestroyPool(); } - void CreatePool(uint sizeOfEachBlock, uint numOfBlocks) - { - assert(sizeOfEachBlock >= 4); // has to be at least the size of an int, for book keeping - m_numOfBlocks = numOfBlocks; - m_sizeOfEachBlock = sizeOfEachBlock; - m_numFreeBlocks = numOfBlocks; - m_numInitialized = 0; - m_memStart = new uchar[ m_sizeOfEachBlock * - m_numOfBlocks ]; - m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks); - m_next = m_memStart; -// InitializeCriticalSection(&m_CS); - } + void CreatePool(uint sizeOfEachBlock, uint numOfBlocks) { + assert(sizeOfEachBlock >= + 4); // has to be at least the size of an int, for book keeping + m_numOfBlocks = numOfBlocks; + m_sizeOfEachBlock = sizeOfEachBlock; + m_numFreeBlocks = numOfBlocks; + m_numInitialized = 0; + m_memStart = new uchar[m_sizeOfEachBlock * m_numOfBlocks]; + m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks); + m_next = m_memStart; + // InitializeCriticalSection(&m_CS); + } - void DestroyPool() - { - delete[] m_memStart; - m_memStart = nullptr; - } + void DestroyPool() { + delete[] m_memStart; + m_memStart = nullptr; + } - uchar* AddrFromIndex(uint i) const - { - return m_memStart + ( i * m_sizeOfEachBlock ); - } + uchar* AddrFromIndex(uint i) const { + return m_memStart + (i * m_sizeOfEachBlock); + } - uint IndexFromAddr(const uchar* p) const - { - return (((uint)(p - m_memStart)) / m_sizeOfEachBlock); - } + uint IndexFromAddr(const uchar* p) const { + return (((uint)(p - m_memStart)) / m_sizeOfEachBlock); + } - virtual void* Alloc(size_t size) - { - if(size > m_sizeOfEachBlock) - return ::malloc(size); -// EnterCriticalSection(&m_CS); - if (m_numInitialized < m_numOfBlocks ) - { - uint* p = (uint*)AddrFromIndex( m_numInitialized ); - *p = m_numInitialized + 1; - m_numInitialized++; - } - void* ret = nullptr; - if ( m_numFreeBlocks > 0 ) - { - ret = (void*)m_next; - --m_numFreeBlocks; - if (m_numFreeBlocks!=0) - { - m_next = AddrFromIndex( *((uint*)m_next) ); - } - else - { - m_next = nullptr; - } - } -// LeaveCriticalSection(&m_CS); - return ret; - } + virtual void* Alloc(size_t size) { + if (size > m_sizeOfEachBlock) return ::malloc(size); + // EnterCriticalSection(&m_CS); + if (m_numInitialized < m_numOfBlocks) { + uint* p = (uint*)AddrFromIndex(m_numInitialized); + *p = m_numInitialized + 1; + m_numInitialized++; + } + void* ret = nullptr; + if (m_numFreeBlocks > 0) { + ret = (void*)m_next; + --m_numFreeBlocks; + if (m_numFreeBlocks != 0) { + m_next = AddrFromIndex(*((uint*)m_next)); + } else { + m_next = nullptr; + } + } + // LeaveCriticalSection(&m_CS); + return ret; + } - virtual void Free(void* ptr) - { - if(ptr < m_memStart || ptr > m_memEnd) - { - ::free(ptr); - return; - } -// EnterCriticalSection(&m_CS); - if (m_next != nullptr) - { - (*(uint*)ptr) = IndexFromAddr( m_next ); - m_next = (uchar*)ptr; - } - else - { - *((uint*)ptr) = m_numOfBlocks; - m_next = (uchar*)ptr; - } - ++m_numFreeBlocks; -// LeaveCriticalSection(&m_CS); - } -}; // End pool class + virtual void Free(void* ptr) { + if (ptr < m_memStart || ptr > m_memEnd) { + ::free(ptr); + return; + } + // EnterCriticalSection(&m_CS); + if (m_next != nullptr) { + (*(uint*)ptr) = IndexFromAddr(m_next); + m_next = (uchar*)ptr; + } else { + *((uint*)ptr) = m_numOfBlocks; + m_next = (uchar*)ptr; + } + ++m_numFreeBlocks; + // LeaveCriticalSection(&m_CS); + } +}; // End pool class - -// this pool will constantly grow until it is reset (automatically when all allocs have been "freed") -class C4JMemoryPoolGrow : public C4JMemoryPool -{ - uint32_t m_totalSize; - uint32_t m_memUsed; - uint32_t m_numAllocations; - uint8_t* m_pMemory; - uint32_t m_currentOffset; +// this pool will constantly grow until it is reset (automatically when all +// allocs have been "freed") +class C4JMemoryPoolGrow : public C4JMemoryPool { + uint32_t m_totalSize; + uint32_t m_memUsed; + uint32_t m_numAllocations; + uint8_t* m_pMemory; + uint32_t m_currentOffset; public: - C4JMemoryPoolGrow(uint32_t size = 64*1024) - { - size = Align(size, 4); - m_totalSize = size; - m_pMemory = new uint8_t[size]; - m_currentOffset = 0; - m_memUsed = 0; - m_numAllocations = 0; - } + C4JMemoryPoolGrow(uint32_t size = 64 * 1024) { + size = Align(size, 4); + m_totalSize = size; + m_pMemory = new uint8_t[size]; + m_currentOffset = 0; + m_memUsed = 0; + m_numAllocations = 0; + } - virtual void* Alloc(size_t size) - { - size = Align(size, 4); // 4 byte align the memory - assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space - void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory - m_currentOffset += size; - m_numAllocations++; - return returnMem; - } - virtual void Free(void* ptr) - { - m_numAllocations--; - if(m_numAllocations == 0) - m_currentOffset = 0; // reset the pool when we reach zero allocations - } + virtual void* Alloc(size_t size) { + size = Align(size, 4); // 4 byte align the memory + assert((m_currentOffset + size) < + m_totalSize); // make sure we haven't ran out of space + void* returnMem = + &m_pMemory[m_currentOffset]; // grab the return memory + m_currentOffset += size; + m_numAllocations++; + return returnMem; + } + virtual void Free(void* ptr) { + m_numAllocations--; + if (m_numAllocations == 0) + m_currentOffset = + 0; // reset the pool when we reach zero allocations + } }; - - - - - - - diff --git a/Minecraft.Client/Platform/Common/C4JMemoryPoolAllocator.h b/Minecraft.Client/Platform/Common/C4JMemoryPoolAllocator.h index f6b7c8c02..76809ff04 100644 --- a/Minecraft.Client/Platform/Common/C4JMemoryPoolAllocator.h +++ b/Minecraft.Client/Platform/Common/C4JMemoryPoolAllocator.h @@ -1,113 +1,87 @@ #pragma once -#include "C4JMemoryPool.h" +#include "C4JMemoryPool.h" -// Custom allocator, takes a C4JMemoryPool class, which can be one of a number of pool implementations. +// Custom allocator, takes a C4JMemoryPool class, which can be one of a number +// of pool implementations. template -class C4JPoolAllocator -{ +class C4JPoolAllocator { public: - typedef T value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - typedef T* pointer; - typedef const T* const_pointer; - - typedef T& reference; - typedef const T& const_reference; - - //! A struct to construct an allocator for a different type. - template - struct rebind { typedef C4JPoolAllocator other; }; + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; - C4JMemoryPool* m_pPool; - bool m_selfAllocated; + typedef T& reference; + typedef const T& const_reference; - C4JPoolAllocator( C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096 )) : m_pPool( pool ), m_selfAllocated(true) - { - printf("allocated mempool\n"); - } + //! A struct to construct an allocator for a different type. + template + struct rebind { + typedef C4JPoolAllocator other; + }; - template - C4JPoolAllocator(C4JPoolAllocator const& obj) : m_pPool( obj.m_pPool ), m_selfAllocated(false) // copy constructor - { - printf("C4JPoolAllocator constructed from 0x%08x\n", &obj); - assert(obj.m_pPool); + C4JMemoryPool* m_pPool; + bool m_selfAllocated; + + C4JPoolAllocator(C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096)) + : m_pPool(pool), m_selfAllocated(true) { + printf("allocated mempool\n"); } + + template + C4JPoolAllocator(C4JPoolAllocator const& obj) + : m_pPool(obj.m_pPool), + m_selfAllocated(false) // copy constructor + { + printf("C4JPoolAllocator constructed from 0x%08x\n", &obj); + assert(obj.m_pPool); + } + private: - public: - - ~C4JPoolAllocator() - { - if(m_selfAllocated) - delete m_pPool; + ~C4JPoolAllocator() { + if (m_selfAllocated) delete m_pPool; } - - pointer address( reference r ) const { return &r; } - const_pointer address( const_reference r ) const { return &r; } - - pointer allocate( size_type n, const void* /*hint*/=0 ) - { - assert(m_pPool); + + pointer address(reference r) const { return &r; } + const_pointer address(const_reference r) const { return &r; } + + pointer allocate(size_type n, const void* /*hint*/ = 0) { + assert(m_pPool); return (pointer)m_pPool->Alloc(n * sizeof(T)); } - - void deallocate( pointer p, size_type /*n*/ ) - { - assert(m_pPool); - m_pPool->Free(p); + + void deallocate(pointer p, size_type /*n*/) { + assert(m_pPool); + m_pPool->Free(p); } - - void construct( pointer p, const T& val ) - { - new (p) T(val); - } - - void destroy( pointer p ) - { - p->~T(); - } - - size_type max_size() const - { - return ULONG_MAX / sizeof(T); - } - + + void construct(pointer p, const T& val) { new (p) T(val); } + + void destroy(pointer p) { p->~T(); } + + size_type max_size() const { return ULONG_MAX / sizeof(T); } }; - - + template -bool -operator==( const C4JPoolAllocator& left, const C4JPoolAllocator& right ) -{ - if (left.m_pPool == right.m_pPool) - { +bool operator==(const C4JPoolAllocator& left, + const C4JPoolAllocator& right) { + if (left.m_pPool == right.m_pPool) { return true; } - return false; -} - -template -bool -operator!=( const C4JPoolAllocator& left, const C4JPoolAllocator& right) -{ - if (left.m_pPool != right.m_pPool) - { - return true; - } return false; } - - - - - - - - +template +bool operator!=(const C4JPoolAllocator& left, + const C4JPoolAllocator& right) { + if (left.m_pPool != right.m_pPool) { + return true; + } + return false; +} diff --git a/Minecraft.Client/Platform/Common/Colours/ColourTable.h b/Minecraft.Client/Platform/Common/Colours/ColourTable.h index 8a467e6cd..efcf46546 100644 --- a/Minecraft.Client/Platform/Common/Colours/ColourTable.h +++ b/Minecraft.Client/Platform/Common/Colours/ColourTable.h @@ -1,24 +1,24 @@ #pragma once #include -class ColourTable -{ +class ColourTable { private: - unsigned int m_colourValues[eMinecraftColour_COUNT]; + unsigned int m_colourValues[eMinecraftColour_COUNT]; - static const wchar_t *ColourTableElements[eMinecraftColour_COUNT]; - static std::unordered_map s_colourNamesMap; + static const wchar_t* ColourTableElements[eMinecraftColour_COUNT]; + static std::unordered_map s_colourNamesMap; public: - static void staticCtor(); + static void staticCtor(); - ColourTable(std::uint8_t *pbData, std::uint32_t dataLength); - ColourTable(ColourTable *defaultColours, std::uint8_t *pbData, std::uint32_t dataLength); + ColourTable(std::uint8_t* pbData, std::uint32_t dataLength); + ColourTable(ColourTable* defaultColours, std::uint8_t* pbData, + std::uint32_t dataLength); - unsigned int getColour(eMinecraftColour id); - unsigned int getColor(eMinecraftColour id) { return getColour(id); } + unsigned int getColour(eMinecraftColour id); + unsigned int getColor(eMinecraftColour id) { return getColour(id); } - void loadColoursFromData(std::uint8_t *pbData, std::uint32_t dataLength); - void setColour(const std::wstring &colourName, int value); - void setColour(const std::wstring &colourName, const std::wstring &value); + void loadColoursFromData(std::uint8_t* pbData, std::uint32_t dataLength); + void setColour(const std::wstring& colourName, int value); + void setColour(const std::wstring& colourName, const std::wstring& value); }; diff --git a/Minecraft.Client/Platform/Common/ConsoleGameMode.cpp b/Minecraft.Client/Platform/Common/ConsoleGameMode.cpp index b64c57053..d4c2c7f3c 100644 --- a/Minecraft.Client/Platform/Common/ConsoleGameMode.cpp +++ b/Minecraft.Client/Platform/Common/ConsoleGameMode.cpp @@ -2,8 +2,8 @@ #include "ConsoleGameMode.h" #include "Tutorial/Tutorial.h" -ConsoleGameMode::ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection) - : TutorialMode(iPad, minecraft, connection) -{ - tutorial = new Tutorial(iPad); +ConsoleGameMode::ConsoleGameMode(int iPad, Minecraft* minecraft, + ClientConnection* connection) + : TutorialMode(iPad, minecraft, connection) { + tutorial = new Tutorial(iPad); } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/ConsoleGameMode.h b/Minecraft.Client/Platform/Common/ConsoleGameMode.h index 821debcee..20ad57cf8 100644 --- a/Minecraft.Client/Platform/Common/ConsoleGameMode.h +++ b/Minecraft.Client/Platform/Common/ConsoleGameMode.h @@ -1,10 +1,10 @@ #pragma once #include "Tutorial/TutorialMode.h" -class ConsoleGameMode : public TutorialMode -{ -public: - ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection); +class ConsoleGameMode : public TutorialMode { +public: + ConsoleGameMode(int iPad, Minecraft* minecraft, + ClientConnection* connection); - virtual bool isImplemented() { return true; } + virtual bool isImplemented() { return true; } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Console_Awards_enum.h b/Minecraft.Client/Platform/Common/Console_Awards_enum.h index a8003a310..55a7570cc 100644 --- a/Minecraft.Client/Platform/Common/Console_Awards_enum.h +++ b/Minecraft.Client/Platform/Common/Console_Awards_enum.h @@ -1,70 +1,69 @@ #pragma once -enum eAward -{ - eAward_TakingInventory=0, - eAward_GettingWood, - eAward_Benchmarking, - eAward_TimeToMine, - eAward_HotTopic, - eAward_AquireHardware, - eAward_TimeToFarm, - eAward_BakeBread, - eAward_TheLie, - eAward_GettingAnUpgrade, - eAward_DeliciousFish, - eAward_OnARail, - eAward_TimeToStrike, - eAward_MonsterHunter, - eAward_CowTipper, - eAward_WhenPigsFly, - eAward_LeaderOfThePack, - eAward_MOARTools, - eAward_DispenseWithThis, - eAward_InToTheNether, +enum eAward { + eAward_TakingInventory = 0, + eAward_GettingWood, + eAward_Benchmarking, + eAward_TimeToMine, + eAward_HotTopic, + eAward_AquireHardware, + eAward_TimeToFarm, + eAward_BakeBread, + eAward_TheLie, + eAward_GettingAnUpgrade, + eAward_DeliciousFish, + eAward_OnARail, + eAward_TimeToStrike, + eAward_MonsterHunter, + eAward_CowTipper, + eAward_WhenPigsFly, + eAward_LeaderOfThePack, + eAward_MOARTools, + eAward_DispenseWithThis, + eAward_InToTheNether, - eAward_mine100Blocks, - eAward_kill10Creepers, - eAward_eatPorkChop, - eAward_play100Days, - eAward_arrowKillCreeper, - eAward_socialPost, + eAward_mine100Blocks, + eAward_kill10Creepers, + eAward_eatPorkChop, + eAward_play100Days, + eAward_arrowKillCreeper, + eAward_socialPost, - // 4J Stu - Does not map to any Xbox achievements - eAward_snipeSkeleton, - eAward_diamonds, - eAward_portal, - eAward_ghast, - eAward_blazeRod, - eAward_potion, - eAward_theEnd, - eAward_winGame, - eAward_enchantments, - eAward_overkill, - eAward_bookcase, + // 4J Stu - Does not map to any Xbox achievements + eAward_snipeSkeleton, + eAward_diamonds, + eAward_portal, + eAward_ghast, + eAward_blazeRod, + eAward_potion, + eAward_theEnd, + eAward_winGame, + eAward_enchantments, + eAward_overkill, + eAward_bookcase, #if defined(_EXTENDED_ACHIEVEMENTS) - eAward_adventuringTime, - eAward_repopulation, - //eAward_porkChop, - eAward_diamondsToYou, - //eAward_passingTheTime, - //eAward_archer, - eAward_theHaggler, - eAward_potPlanter, - eAward_itsASign, - eAward_ironBelly, - eAward_haveAShearfulDay, - eAward_rainbowCollection, - eAward_stayinFrosty, - eAward_chestfulOfCobblestone, - eAward_renewableEnergy, - eAward_musicToMyEars, - eAward_bodyGuard, - eAward_ironMan, - eAward_zombieDoctor, - eAward_lionTamer, + eAward_adventuringTime, + eAward_repopulation, + // eAward_porkChop, + eAward_diamondsToYou, + // eAward_passingTheTime, + // eAward_archer, + eAward_theHaggler, + eAward_potPlanter, + eAward_itsASign, + eAward_ironBelly, + eAward_haveAShearfulDay, + eAward_rainbowCollection, + eAward_stayinFrosty, + eAward_chestfulOfCobblestone, + eAward_renewableEnergy, + eAward_musicToMyEars, + eAward_bodyGuard, + eAward_ironMan, + eAward_zombieDoctor, + eAward_lionTamer, #endif - eAward_Max, + eAward_Max, }; diff --git a/Minecraft.Client/Platform/Common/Console_Utils.cpp b/Minecraft.Client/Platform/Common/Console_Utils.cpp index a934bed4b..715a2fd2b 100644 --- a/Minecraft.Client/Platform/Common/Console_Utils.cpp +++ b/Minecraft.Client/Platform/Common/Console_Utils.cpp @@ -7,17 +7,16 @@ // Desc: Internal helper function //-------------------------------------------------------------------------------------- #if !defined(_CONTENT_PACKAGE) -static void DebugSpewV(const char* strFormat, va_list pArgList) -{ +static void DebugSpewV(const char* strFormat, va_list pArgList) { #if defined(__linux__) - assert(0); + assert(0); #else - char str[2048]; - // Use the secure CRT to avoid buffer overruns. Specify a count of - // _TRUNCATE so that too long strings will be silently truncated - // rather than triggering an error. - _vsnprintf_s( str, _TRUNCATE, strFormat, pArgList ); - OutputDebugStringA( str ); + char str[2048]; + // Use the secure CRT to avoid buffer overruns. Specify a count of + // _TRUNCATE so that too long strings will be silently truncated + // rather than triggering an error. + _vsnprintf_s(str, _TRUNCATE, strFormat, pArgList); + OutputDebugStringA(str); #endif } #endif @@ -26,12 +25,11 @@ static void DebugSpewV(const char* strFormat, va_list pArgList) // Name: DebugPrintf() // Desc: Prints formatted debug spew //-------------------------------------------------------------------------------------- -void CDECL DebugPrintf(const char* strFormat, ...) -{ +void CDECL DebugPrintf(const char* strFormat, ...) { #if !defined(_CONTENT_PACKAGE) - va_list pArgList; - va_start( pArgList, strFormat ); - DebugSpewV( strFormat, pArgList ); - va_end( pArgList ); + va_list pArgList; + va_start(pArgList, strFormat); + DebugSpewV(strFormat, pArgList); + va_end(pArgList); #endif } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 1c9fbfbbc..dd18e7db4 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -71,8 +71,7 @@ const float CMinecraftApp::fSafeZoneY = 36.0f; // 5% of 720 int CMinecraftApp::s_iHTMLFontSizesA[eHTMLSize_COUNT] = { // 20,15,20,24 - 20, 13, 20, 26 -}; + 20, 13, 20, 26}; CMinecraftApp::CMinecraftApp() { if (GAME_SETTINGS_PROFILE_DATA_BYTES != sizeof(GAME_SETTINGS)) { @@ -195,20 +194,17 @@ CMinecraftApp::CMinecraftApp() { m_bResetNether = false; - #if defined(_CONTENT_PACAKGE) m_bUseDPadForDebug = false; #else m_bUseDPadForDebug = true; #endif - for (int i = 0; i < XUSER_MAX_COUNT; i++) { m_vBannedListA[i] = new std::vector; } LocaleAndLanguageInit(); - } void CMinecraftApp::DebugPrintf(const char* szFormat, ...) { @@ -267,9 +263,7 @@ void CMinecraftApp::SetAction(int iPad, eXuiAction action, void* param) { } } -bool CMinecraftApp::IsAppPaused() { - return m_bIsAppPaused; -} +bool CMinecraftApp::IsAppPaused() { return m_bIsAppPaused; } void CMinecraftApp::SetAppPaused(bool val) { m_bIsAppPaused = val; } @@ -701,8 +695,7 @@ void CMinecraftApp::InitGameSettings() { } int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, - const int iPad) -{ + const int iPad) { SetGameSettings(iPad, eGameSetting_MusicVolume, DEFAULT_VOLUME_LEVEL); SetGameSettings(iPad, eGameSetting_SoundFXVolume, DEFAULT_VOLUME_LEVEL); SetGameSettings(iPad, eGameSetting_Gamma, 50); @@ -796,13 +789,11 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS* pSettings, // #endif - return 0; } int CMinecraftApp::DefaultOptionsCallback( - void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) -{ + void* pParam, C_4JProfile::PROFILESETTINGS* pSettings, const int iPad) { CMinecraftApp* pApp = (CMinecraftApp*)pParam; // flag the default options to be set @@ -819,7 +810,6 @@ int CMinecraftApp::DefaultOptionsCallback( return 0; } - int CMinecraftApp::OldProfileVersionCallback(void* pParam, unsigned char* pucData, const unsigned short usVersion, @@ -2452,7 +2442,6 @@ void CMinecraftApp::HandleXuiActions(void) { ProfileManager.GetPrimaryPad()); pMinecraft->removeLocalPlayerIdx(i); - // Wipe out the tooltips ui.SetTooltips(i, -1); @@ -2500,7 +2489,6 @@ void CMinecraftApp::HandleXuiActions(void) { } } - SetAction(i, eAppAction_Idle); } break; @@ -2519,7 +2507,6 @@ void CMinecraftApp::HandleXuiActions(void) { ProfileManager.GetPrimaryPad()); pMinecraft->removeLocalPlayerIdx(i); - // Wipe out the tooltips ui.SetTooltips(i, -1); @@ -2566,7 +2553,6 @@ void CMinecraftApp::HandleXuiActions(void) { SetAction(i, eAppAction_Idle); } break; - case eAppAction_ExitWorld: pMinecraft->exitingWorldRightNow = true; @@ -2679,7 +2665,6 @@ void CMinecraftApp::HandleXuiActions(void) { // 4J Stu - Fix for #12368 - Crash: Game crashes when saving // then exiting and selecting to save for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title // crashed after exiting the tutorial It doesn't matter // if they were in the tutorial already @@ -2700,7 +2685,8 @@ void CMinecraftApp::HandleXuiActions(void) { // action, use a dialog instead completionData->bRequiresUserAction = false; //(param != nullptr) ? true : false; - completionData->bShowTips = (param != nullptr) ? false : true; + completionData->bShowTips = + (param != nullptr) ? false : true; completionData->bShowBackground = true; completionData->bShowLogo = true; completionData->type = @@ -2729,7 +2715,6 @@ void CMinecraftApp::HandleXuiActions(void) { // 4J Stu - Fix for #12368 - Crash: Game crashes when saving // then exiting and selecting to save for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title // crashed after exiting the tutorial It doesn't matter // if they were in the tutorial already @@ -3034,7 +3019,6 @@ void CMinecraftApp::HandleXuiActions(void) { // saving then exiting and selecting to save for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title // crashed after exiting the tutorial It doesn't // matter if they were in the tutorial already @@ -3131,8 +3115,7 @@ void CMinecraftApp::HandleXuiActions(void) { &CMinecraftApp:: ExitAndJoinFromInviteSaveDialogReturned, this); - } else - { + } else { if (!ProfileManager.IsFullVersion()) { TelemetryManager->RecordUpsellPresented( i, eSen_UpsellID_Full_Version_Of_Game, @@ -3172,7 +3155,6 @@ void CMinecraftApp::HandleXuiActions(void) { // 4J Stu - Fix for #12368 - Crash: Game crashes when saving // then exiting and selecting to save for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - // 4J Stu - Fix for #13257 - CRASH: Gameplay: Title // crashed after exiting the tutorial It doesn't matter // if they were in the tutorial already @@ -3214,7 +3196,6 @@ void CMinecraftApp::HandleXuiActions(void) { app.DebugPrintf("Unmount result is %d\n", result); } - LoadingInputParams* loadingParams = new LoadingInputParams(); loadingParams->func = @@ -3259,7 +3240,6 @@ void CMinecraftApp::HandleXuiActions(void) { ProfileManager.SetLockedProfile(inviteData->dwUserIndex); ProfileManager.SetPrimaryPad(inviteData->dwUserIndex); - // change the minecraft player name Minecraft::GetInstance()->user->name = convStringToWstring(ProfileManager.GetGamertag( @@ -3706,7 +3686,6 @@ void CMinecraftApp::loadMediaArchive() { } void CMinecraftApp::loadStringTable() { - if (m_stringTable != nullptr) { // we need to unload the current std::string table, this is a reload delete m_stringTable; @@ -4008,7 +3987,6 @@ void CMinecraftApp::ClearSignInChangeUsersMask() { void CMinecraftApp::SignInChangeCallback(void* pParam, bool bPrimaryPlayerChanged, unsigned int uiSignInData) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; // check if the primary player signed out int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); @@ -4083,7 +4061,8 @@ void CMinecraftApp::SignInChangeCallback(void* pParam, // invalidates all the guest players we have in the game if (hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && - g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr) { + g_NetworkManager.GetLocalPlayerByUserIndex(i) != + nullptr) { pApp->DebugPrintf( "Recommending removal of player at index %d " "because their guest id changed\n", @@ -4153,7 +4132,6 @@ void CMinecraftApp::SignInChangeCallback(void* pParam, eAppAction_EthernetDisconnected); } } - } m_uiLastSignInData = uiSignInData; } else if (iPrimaryPlayer != -1) { @@ -4392,7 +4370,6 @@ void CMinecraftApp::MountNextDLC(int iPad) { m_bDLCInstallProcessCompleted = true; ui.HandleDLCMountingComplete(); - } } @@ -4565,7 +4542,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) { auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors - // insert elements if they don't exist + // insert elements if they don't exist if (it != MojangData.end()) { MOJANG_DATA* pMojangData = MojangData[xuid]; if (pMojangData && pMojangData->eXuid == eXUID_Deadmau5) { @@ -4815,7 +4792,6 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned( // upsell // get the dlc texture pack - unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_OK; uiIDA[1] = IDS_CONFIRM_CANCEL; @@ -4847,8 +4823,7 @@ int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned( &CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned, pClass); return 0; - } else - { + } else { MinecraftServer::getInstance()->setSaveOnExit(true); } } else { @@ -4898,7 +4873,6 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned( // upsell // get the dlc texture pack - unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_OK; uiIDA[1] = IDS_CONFIRM_CANCEL; @@ -5251,7 +5225,6 @@ std::wstring CMinecraftApp::FormatHTMLString( text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", GetActionReplacement(iPad, MINECRAFT_ACTION_DPAD_LEFT)); - // Fix for #8903 - UI: Localization: KOR/JPN/CHT: Button Icons are rendered // with padding space, which looks no good std::uint32_t dwLanguage = XGetLanguage(); @@ -5655,8 +5628,7 @@ DLC_INFO* CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { return it->second; } DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { - std::unordered_map::iterator it = - DLCInfo_Full.begin(); + std::unordered_map::iterator it = DLCInfo_Full.begin(); for (int i = 0; i < iIndex; i++) { ++it; @@ -5665,8 +5637,7 @@ DLC_INFO* CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { return it->second; } uint64_t CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { - std::unordered_map::iterator it = - DLCTextures_PackID.begin(); + std::unordered_map::iterator it = DLCTextures_PackID.begin(); for (int i = 0; i < iIndex; i++) { ++it; @@ -5675,7 +5646,6 @@ uint64_t CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { return it->second; } - DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) { if (DLCInfo_Full.size() > 0) { auto it = DLCInfo_Full.find(ullOfferID_Full); @@ -5802,8 +5772,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned( UIScene_FullscreenProgress* pScene = (UIScene_FullscreenProgress*)ui.FindScene( eUIScene_FullscreenProgress); - if (pScene != nullptr) - { + if (pScene != nullptr) { pScene->SetWasCancelled(false); } } @@ -5837,7 +5806,6 @@ void CMinecraftApp::InvalidateBannedList(int iPad) { } } - void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName, bool bWriteToTMS) { @@ -5880,8 +5848,7 @@ bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, it != m_vBannedListA[iPad]->end(); ++it) { PBANNEDLISTDATA pData = *it; if (IsEqualXUID(pData->xuid, xuid) && - (strcmp(pData->pszLevelName, pszLevelName) == 0)) - { + (strcmp(pData->pszLevelName, pszLevelName) == 0)) { return true; } } @@ -5902,8 +5869,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, if (pBannedListData != nullptr) { if (IsEqualXUID(pBannedListData->xuid, xuid) && - (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) - { + (strcmp(pBannedListData->pszLevelName, pszLevelName) == 0)) { TelemetryManager->RecordUnBanLevel(iPad); // match found, so remove this entry @@ -6507,8 +6473,8 @@ unsigned int CMinecraftApp::CreateImageTextData(std::uint8_t* textMetadata, void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, int x, int z) { // check we don't already have this in - for (auto it = m_vTerrainFeatures.begin(); - it < m_vTerrainFeatures.end(); ++it) { + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { FEATURE_DATA* pFeatureData = *it; if ((pFeatureData->eTerrainFeature == eFeatureType) && @@ -6525,8 +6491,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, } _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) { - for (auto it = m_vTerrainFeatures.begin(); - it < m_vTerrainFeatures.end(); ++it) { + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { FEATURE_DATA* pFeatureData = *it; if ((pFeatureData->x == x) && (pFeatureData->z == z)) @@ -6538,8 +6504,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) { bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType, int* pX, int* pZ) { - for (auto it = m_vTerrainFeatures.begin(); - it < m_vTerrainFeatures.end(); ++it) { + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); + ++it) { FEATURE_DATA* pFeatureData = *it; if (pFeatureData->eTerrainFeature == eType) { @@ -6654,7 +6620,7 @@ std::wstring CMinecraftApp::getEntityName(eINSTANCEOF type) { std::uint32_t CMinecraftApp::m_dwContentTypeA[e_Marketplace_MAX] = { XMARKETPLACE_OFFERING_TYPE_CONTENT, // e_DLC_SkinPack, e_DLC_TexturePacks, // e_DLC_MashupPacks - XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes + XMARKETPLACE_OFFERING_TYPE_THEME, // e_DLC_Themes XMARKETPLACE_OFFERING_TYPE_AVATARITEM, // e_DLC_AvatarItems XMARKETPLACE_OFFERING_TYPE_TILE, // e_DLC_Gamerpics }; @@ -6666,8 +6632,8 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, // If it's already in there, promote it to the top of the list int iPosition = 0; - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { DLCRequest* pCurrent = *it; if (pCurrent->dwType == m_dwContentTypeA[eType]) { @@ -6921,8 +6887,8 @@ bool CMinecraftApp::RetrieveNextDLCContent() { } EnterCriticalSection(&csDLCDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { DLCRequest* pCurrent = *it; if (pCurrent->eState == e_DLC_ContentState_Retrieving) { @@ -6932,8 +6898,8 @@ bool CMinecraftApp::RetrieveNextDLCContent() { } // Now look for the next retrieval - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { DLCRequest* pCurrent = *it; if (pCurrent->eState == e_DLC_ContentState_Idle) { @@ -6965,7 +6931,6 @@ bool CMinecraftApp::RetrieveNextDLCContent() { int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData, C4JStorage::PTMSPP_FILEDATA pFileData, const char* szFilename) { - CMinecraftApp* pClass = (CMinecraftApp*)pParam; // find the right one in the vector @@ -7013,9 +6978,7 @@ int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData, return 0; } -bool CMinecraftApp::RetrieveNextTMSPPContent() { - return false; -} +bool CMinecraftApp::RetrieveNextTMSPPContent() { return false; } void CMinecraftApp::TickDLCOffersRetrieved() { if (!m_bAllDLCContentRetrieved) { @@ -7030,8 +6993,8 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue() { int iPosition = 0; EnterCriticalSection(&csTMSPPDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { DLCRequest* pCurrent = *it; delete pCurrent; @@ -7102,8 +7065,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) { // If there's already a retrieve in progress, quit // we may have re-ordered the list, so need to check every item EnterCriticalSection(&csDLCDownloadQueue); - for (auto it = m_DLCDownloadQueue.begin(); - it != m_DLCDownloadQueue.end(); ++it) { + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); + ++it) { DLCRequest* pCurrent = *it; if ((pCurrent->dwType == m_dwContentTypeA[eType]) && @@ -7300,7 +7263,6 @@ std::wstring CMinecraftApp::getSkinPathFromId(std::uint32_t skinId) { int CMinecraftApp::TexturePackDialogReturned( void* pParam, int iPad, C4JStorage::EMessageResult result) { - return 0; } @@ -7388,7 +7350,6 @@ bool CMinecraftApp::IsLocalMultiplayerAvailable() { bool available = RenderManager.IsHiDef() && connectedControllers > 1; - return available; // Found this in GameNetworkManager? @@ -7561,7 +7522,6 @@ void CMinecraftApp::getLocale(std::vector& vecWstrLocales) { locales.push_back(eMCLang_csCS); locales.push_back(eMCLang_zhCN); break; - } locales.push_back(eMCLang_enUS); @@ -7824,7 +7784,6 @@ std::wstring titleUpdateTexturePackRoot = L"Windows64\\DLC\\"; std::wstring titleUpdateTexturePackRoot = L"CU\\DLC\\"; #endif - std::wstring CMinecraftApp::getRootPath(std::uint32_t packId, bool allowOverride, bool bAddDataFolder, std::wstring mountPoint) { @@ -7847,4 +7806,3 @@ std::wstring CMinecraftApp::getRootPath(std::uint32_t packId, return path + L"\\"; } } - diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index b293dc8d5..214bc0683 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -25,7 +25,6 @@ #include "../Minecraft.Client/Utils/ArchiveFile.h" #include "../Minecraft.World/Entities/MinecartHopper.h" - typedef struct _JoinFromInviteData { std::uint32_t dwUserIndex; // dwUserIndex std::uint32_t dwLocalUsersMask; // dwUserMask @@ -56,8 +55,7 @@ class Merchant; class CMinecraftAudio; -class CMinecraftApp -{ +class CMinecraftApp { private: static int s_iHTMLFontSizesA[eHTMLSize_COUNT]; @@ -268,8 +266,7 @@ public: void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; } // debug -0 show safe area - void ShowSafeArea(bool show) { - } + void ShowSafeArea(bool show) {} // 4J-PB - to capture the social post screenshot virtual void CaptureScreenshot(int iPad) {}; // void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE @@ -371,7 +368,6 @@ public: static void UpsellReturnedCallback(void* pParam, eUpsellType type, eUpsellResponse result, int iUserData); - #if defined(_DEBUG_MENUS_ENABLED) bool DebugSettingsOn() { return m_bDebugOptions; } bool DebugArtToolsOn(); @@ -677,7 +673,8 @@ public: static int32_t RegisterConfigValues(wchar_t* pType, int iValue); static int32_t RegisterDLCData(wchar_t*, wchar_t*, int, uint64_t, uint64_t, - wchar_t*, unsigned int, int, wchar_t* pDataFile); + wchar_t*, unsigned int, int, + wchar_t* pDataFile); bool GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, uint64_t* pullVal); DLC_INFO* GetDLCInfoForTrialOfferID(uint64_t ullOfferID_Trial); @@ -839,7 +836,8 @@ private: unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS]; public: - void UpdatePlayerInfo(std::uint8_t networkSmallId, int16_t playerColourIndex, + void UpdatePlayerInfo(std::uint8_t networkSmallId, + int16_t playerColourIndex, unsigned int playerGamePrivileges); short GetPlayerColour(std::uint8_t networkSmallId); unsigned int GetPlayerPrivileges(std::uint8_t networkSmallId); @@ -915,9 +913,10 @@ public: // static int CallbackReadXuidsFileFromTMS(void* lpParam, wchar_t // *wchFilename, int iPad, bool bResult, int iAction); static int - // CallbackDLCFileFromTMS(void* lpParam, wchar_t *wchFilename, int iPad, bool - // bResult, int iAction); static int CallbackBannedListFileFromTMS(void* - // lpParam, wchar_t *wchFilename, int iPad, bool bResult, int iAction); + // CallbackDLCFileFromTMS(void* lpParam, wchar_t *wchFilename, int iPad, + // bool bResult, int iAction); static int + // CallbackBannedListFileFromTMS(void* lpParam, wchar_t *wchFilename, int + // iPad, bool bResult, int iAction); // Storing additional model parts per skin texture void SetAdditionalSkinBoxes(std::uint32_t dwSkinID, SKIN_BOX* SkinBoxA, @@ -982,7 +981,6 @@ private: bool m_bResetNether; std::uint32_t m_dwRequiredTexturePackID; - // 4J-PB - language and locale functions public: void LocaleAndLanguageInit(); @@ -1009,7 +1007,6 @@ public: #else #endif - }; // singleton diff --git a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp index 566e6f204..9fdf31ff0 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCGameRulesHeader.cpp @@ -25,7 +25,6 @@ void DLCGameRulesHeader::addData(std::uint8_t* pbData, std::uint32_t dataBytes) { m_pbData = pbData; m_dataBytes = dataBytes; - } std::uint8_t* DLCGameRulesHeader::getData(std::uint32_t& dataBytes) { diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index 178e75952..00b7e0c7b 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -229,7 +229,6 @@ DLCPack* DLCManager::getPack(const std::wstring& name) { return pack; } - DLCPack* DLCManager::getPack(unsigned int index, EDLCType type /*= e_DLCType_All*/) { DLCPack* pack = nullptr; diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index dc56fb04f..790eddab8 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -27,7 +27,6 @@ DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) { m_data = nullptr; } - DLCPack::~DLCPack() { for (auto it = m_childPacks.begin(); it != m_childPacks.end(); ++it) { delete *it; @@ -213,8 +212,8 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, } } else { g_pathCmpString = &path; - auto it = std::find_if(m_files[type].begin(), m_files[type].end(), - pathCmp); + auto it = + std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp); hasFile = it != m_files[type].end(); if (!hasFile && m_parentPack) { hasFile = m_parentPack->doesPackContainFile(type, path); @@ -252,7 +251,8 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) { } } else { g_pathCmpString = &path; - auto it = std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp); + auto it = + std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp); if (it == m_files[type].end()) { // Not found diff --git a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp index 067a68399..1f55c3357 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCSkinFile.cpp @@ -107,10 +107,10 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, SKIN_BOX* pSkinBox = new SKIN_BOX; ZeroMemory(pSkinBox, sizeof(SKIN_BOX)); - swscanf_s( - value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, - &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, &pSkinBox->fW, - &pSkinBox->fH, &pSkinBox->fD, &pSkinBox->fU, &pSkinBox->fV); + swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart, 10, + &pSkinBox->fX, &pSkinBox->fY, &pSkinBox->fZ, + &pSkinBox->fW, &pSkinBox->fH, &pSkinBox->fD, + &pSkinBox->fU, &pSkinBox->fV); if (wcscmp(wchBodyPart, L"HEAD") == 0) { pSkinBox->ePart = eBodyPart_Head; diff --git a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp index 89c778954..7360dcf33 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CollectItemRuleDefinition.cpp @@ -88,8 +88,8 @@ bool CollectItemRuleDefinition::onCollectItem( std::shared_ptr( new UpdateGameRuleProgressPacket( getActionType(), this->m_descriptionId, - m_itemId, m_auxValue, this->m_4JDataValue, nullptr, - 0))); + m_itemId, m_auxValue, this->m_4JDataValue, + nullptr, 0))); } } } diff --git a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp index 5936ac788..82baa6c60 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -28,8 +28,8 @@ bool CompleteAllRuleDefinition::onCollectItem( void CompleteAllRuleDefinition::updateStatus(GameRule* rule) { int goal = 0; int progress = 0; - for (auto it = rule->m_parameters.begin(); - it != rule->m_parameters.end(); ++it) { + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); + ++it) { if (it->second.isPointer) { goal += it->second.gr->getGameRuleDefinition()->getGoal(); progress += it->second.gr->getGameRuleDefinition()->getProgress( diff --git a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp index 945dcd068..3b8913f89 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -66,8 +66,8 @@ void CompoundGameRuleDefinition::populateGameRule( bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, int y, int z) { bool statusChanged = false; - for (auto it = rule->m_parameters.begin(); - it != rule->m_parameters.end(); ++it) { + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); + ++it) { if (it->second.isPointer) { bool changed = it->second.gr->getGameRuleDefinition()->onUseTile( it->second.gr, tileId, x, y, z); @@ -84,8 +84,8 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, bool CompoundGameRuleDefinition::onCollectItem( GameRule* rule, std::shared_ptr item) { bool statusChanged = false; - for (auto it = rule->m_parameters.begin(); - it != rule->m_parameters.end(); ++it) { + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); + ++it) { if (it->second.isPointer) { bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem( diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp index d3a929943..9614fcfca 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp @@ -122,7 +122,8 @@ void ConsoleSchematicFile::load(DataInputStream* dis) { if (te == nullptr) { #ifndef _CONTENT_PACKAGE app.DebugPrintf( - "ConsoleSchematicFile has read a nullptr tile entity\n"); + "ConsoleSchematicFile has read a nullptr tile " + "entity\n"); __debugbreak(); #endif } else { @@ -169,8 +170,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) { ListTag* tileEntityTags = new ListTag(); tag->put(L"TileEntities", tileEntityTags); - for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); - it++) { + for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); it++) { CompoundTag* cTag = new CompoundTag(); (*it)->save(cTag); tileEntityTags->add(cTag); @@ -452,8 +452,7 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord( void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, AABB* destinationBox, ESchematicRotation rot) { - for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); - ++it) { + for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); ++it) { std::shared_ptr te = *it; double targetX = te->x; @@ -1070,8 +1069,8 @@ ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk* chunk, int x0, int y0, int z0, int x1, int y1, int z1) { std::vector >* result = new std::vector >; - for (auto it = chunk->tileEntities.begin(); - it != chunk->tileEntities.end(); ++it) { + for (auto it = chunk->tileEntities.begin(); it != chunk->tileEntities.end(); + ++it) { std::shared_ptr te = it->second; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h index 1459a9c62..bf5967365 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.h @@ -77,5 +77,6 @@ public: Connection* connection); static std::wstring generateDescriptionString( ConsoleGameRules::EGameRuleType defType, - const std::wstring& description, void* data = nullptr, int dataLength = 0); + const std::wstring& description, void* data = nullptr, + int dataLength = 0); }; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index 38feb4c7b..fd3f79820 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -627,7 +627,6 @@ void GameRuleManager::processSchematicsLighting(LevelChunk* levelChunk) { } void GameRuleManager::loadDefaultGameRules() { - #if !defined(__linux__) #if defined(_WINDOWS64) File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck"); @@ -644,19 +643,20 @@ void GameRuleManager::loadDefaultGameRules() { app.GetString(IDS_TUTORIALSAVENAME)); } #else - std::wstring fpTutorial = L"Tutorial.pck"; - if(app.getArchiveFileSize(fpTutorial) >= 0) - { - DLCPack *pack = new DLCPack(L"",0xffffffff); - uint32_t dwFilesProcessed = 0; - if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) ) - { - app.m_dlcManager.addPack(pack); - m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL)); - m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); - } - else delete pack; - } + std::wstring fpTutorial = L"Tutorial.pck"; + if (app.getArchiveFileSize(fpTutorial) >= 0) { + DLCPack* pack = new DLCPack(L"", 0xffffffff); + uint32_t dwFilesProcessed = 0; + if (app.m_dlcManager.readDLCDataFile(dwFilesProcessed, fpTutorial, pack, + true)) { + app.m_dlcManager.addPack(pack); + m_levelGenerators.getLevelGenerators()->at(0)->setWorldName( + app.GetString(IDS_PLAY_TUTORIAL)); + m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName( + app.GetString(IDS_TUTORIALSAVENAME)); + } else + delete pack; + } #endif } diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h index bb6f038ef..ae4a28ad4 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.h @@ -56,7 +56,7 @@ public: bool readRuleFile(LevelGenerationOptions* lgo, uint8_t* dIn, unsigned int dSize, StringTable* strings); //(DLCGameRulesFile *dlcFile, - //StringTable *strings); + // StringTable *strings); private: void readAttributes(DataInputStream* dis, diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index cbac82819..105267e8d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -124,18 +124,14 @@ void LevelGenerationOptions::getChildren( GameRuleDefinition::getChildren(children); std::vector used_schematics; - for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); - it++) + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++) if (!(*it)->isComplete()) used_schematics.push_back(*it); - for (auto it = m_structureRules.begin(); it != m_structureRules.end(); - it++) + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++) children->push_back(*it); - for (auto it = used_schematics.begin(); it != used_schematics.end(); - it++) + for (auto it = used_schematics.begin(); it != used_schematics.end(); it++) children->push_back(*it); - for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end(); - ++it) + for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end(); ++it) children->push_back(*it); for (auto it = m_features.begin(); it != m_features.end(); ++it) children->push_back(*it); @@ -300,15 +296,15 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, // ground/sea level and b) tutorial world additions generally being above // ground/sea level if (!m_bHaveMinY) { - for (auto it = m_schematicRules.begin(); - it != m_schematicRules.end(); ++it) { + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); + ++it) { ApplySchematicRuleDefinition* rule = *it; int minY = rule->getMinY(); if (minY < m_minY) m_minY = minY; } - for (auto it = m_structureRules.begin(); - it != m_structureRules.end(); it++) { + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); + it++) { ConsoleGenerateStructure* structureStart = *it; int minY = structureStart->getMinY(); if (minY < m_minY) m_minY = minY; @@ -330,8 +326,8 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, } if (!intersects) { - for (auto it = m_structureRules.begin(); - it != m_structureRules.end(); it++) { + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); + it++) { ConsoleGenerateStructure* structureStart = *it; intersects = structureStart->checkIntersects(x0, y0, z0, x1, y1, z1); @@ -446,8 +442,7 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() { // Clean schematic rules. std::unordered_set usedFiles = std::unordered_set(); - for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); - it++) + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++) if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName()); // Clean schematic files. @@ -469,8 +464,7 @@ void LevelGenerationOptions::loadBaseSaveData() { if (StorageManager.MountInstalledDLC( ProfileManager.GetPrimaryPad(), mountIndex, &LevelGenerationOptions::packMounted, this, - "WPACK") != ERROR_IO_PENDING) - { + "WPACK") != ERROR_IO_PENDING) { // corrupt DLC setLoadedData(); app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n", @@ -518,12 +512,12 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr, GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share // file? Probably not but... - nullptr, // Unused + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu - // Assuming that the file already exists // if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #else const char* pchFilename = wstringtofilename(grf.getPath()); @@ -532,19 +526,19 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr, GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share // file? Probably not but... - nullptr, // Unused + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu - // Assuming that the file already exists // if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #endif if (fileHandle != INVALID_HANDLE_VALUE) { uint32_t dwFileSize = grf.length(); uint32_t bytesRead; - uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize]; + uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize, &bytesRead, nullptr); if (bSuccess == false) { @@ -574,34 +568,35 @@ int LevelGenerationOptions::packMounted(void* pParam, int iPad, uint32_t dwErr, void* fileHandle = CreateFile( pchFilename, // file name GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share - // file? Probably not but... - nullptr, // Unused + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming // that the file already exists if we are // opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #else const char* pchFilename = wstringtofilename(save.getPath()); void* fileHandle = CreateFile( pchFilename, // file name GENERIC_READ, // access mode - 0, // share mode // TODO 4J Stu - Will we need to share - // file? Probably not but... - nullptr, // Unused + 0, // share mode // TODO 4J Stu - Will we need to share + // file? Probably not but... + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu - Assuming // that the file already exists if we are // opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #endif if (fileHandle != INVALID_HANDLE_VALUE) { - uint32_t bytesRead, dwFileSize = GetFileSize(fileHandle, nullptr); - uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize]; + uint32_t bytesRead, + dwFileSize = GetFileSize(fileHandle, nullptr); + uint8_t* pbData = (uint8_t*)new uint8_t[dwFileSize]; bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize, &bytesRead, nullptr); if (bSuccess == false) { diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h index ec59f9a70..fbb462da5 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.h @@ -24,7 +24,8 @@ public: ConsoleGameRules::EGameRuleType ruleType); // 4J-JEV: Super class handles attr-facing fine. - // virtual void writeAttributes(DataOutputStream *dos, uint32_t numAttributes); + // virtual void writeAttributes(DataOutputStream *dos, uint32_t + // numAttributes); virtual void addAttribute(const std::wstring& attributeName, const std::wstring& attributeValue); diff --git a/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardManager.cpp index 5b0560c19..454559503 100644 --- a/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Common/Leaderboards/LeaderboardManager.cpp @@ -4,101 +4,105 @@ #include "LeaderboardManager.h" -const std::wstring LeaderboardManager::filterNames[eNumFilterModes] = - { - L"Friends", L"MyScore", L"TopRank" - }; +const std::wstring LeaderboardManager::filterNames[eNumFilterModes] = { + L"Friends", L"MyScore", L"TopRank"}; -void LeaderboardManager::DeleteInstance() -{ - delete m_instance; - m_instance = nullptr; +void LeaderboardManager::DeleteInstance() { + delete m_instance; + m_instance = nullptr; } -LeaderboardManager::LeaderboardManager() -{ - zeroReadParameters(); +LeaderboardManager::LeaderboardManager() { + zeroReadParameters(); - m_myXUID = INVALID_XUID; + 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; +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(); +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; + 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(); +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; + 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(); +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_readListener = listener; + m_difficulty = difficulty; + m_statsType = type; - m_startIndex = startIndex; - m_readCount = readCount; + m_startIndex = startIndex; + m_readCount = readCount; - m_eFilterMode = eFM_TopRank; - return true; + m_eFilterMode = eFM_TopRank; + return true; } -void LeaderboardManager::printStats(ReadView &view) -{ - app.DebugPrintf("[LeaderboardManager] Printing stats:\n" - "\tnumQueries=%i\n", view.m_numQueries); +void LeaderboardManager::printStats(ReadView& view) { + app.DebugPrintf( + "[LeaderboardManager] Printing stats:\n" + "\tnumQueries=%i\n", + view.m_numQueries); - for (int i=0; i #include - // - // Depending on the url parameter in base64_chars, one of - // two sets of base64 characters needs to be chosen. - // They differ in their last two characters. - // +// +// Depending on the url parameter in base64_chars, one of +// two sets of base64 characters needs to be chosen. +// They differ in their last two characters. +// static const char* base64_chars[2] = { - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - "+/", + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/", - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - "-_"}; + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "-_"}; static unsigned int pos_of_char(const unsigned char chr) { - // - // Return the position of chr within base64_encode() - // + // + // Return the position of chr within base64_encode() + // - if (chr >= 'A' && chr <= 'Z') return chr - 'A'; - else if (chr >= 'a' && chr <= 'z') return chr - 'a' + ('Z' - 'A') + 1; - else if (chr >= '0' && chr <= '9') return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2; - else if (chr == '+' || chr == '-') return 62; // Be liberal with input and accept both url ('-') and non-url ('+') base 64 characters ( - else if (chr == '/' || chr == '_') return 63; // Ditto for '/' and '_' + if (chr >= 'A' && chr <= 'Z') + return chr - 'A'; + else if (chr >= 'a' && chr <= 'z') + return chr - 'a' + ('Z' - 'A') + 1; + else if (chr >= '0' && chr <= '9') + return chr - '0' + ('Z' - 'A') + ('z' - 'a') + 2; + else if (chr == '+' || chr == '-') + return 62; // Be liberal with input and accept both url ('-') and + // non-url ('+') base 64 characters ( + else if (chr == '/' || chr == '_') + return 63; // Ditto for '/' and '_' else - // - // 2020-10-23: Throw std::exception rather than const char* - //(Pablo Martin-Gomez, https://github.com/Bouska) - // - throw std::runtime_error("Input is not valid base64-encoded data."); + // + // 2020-10-23: Throw std::exception rather than const char* + //(Pablo Martin-Gomez, https://github.com/Bouska) + // + throw std::runtime_error("Input is not valid base64-encoded data."); } static std::string insert_linebreaks(std::string str, size_t distance) { - // - // Provided by https://github.com/JomaCorpFX, adapted by me. - // + // + // Provided by https://github.com/JomaCorpFX, adapted by me. + // if (!str.length()) { return ""; } @@ -91,39 +97,40 @@ static std::string insert_linebreaks(std::string str, size_t distance) { template static std::string encode_with_line_breaks(String s) { - return insert_linebreaks(base64_encode(s, false), line_length); + return insert_linebreaks(base64_encode(s, false), line_length); } template static std::string encode_pem(String s) { - return encode_with_line_breaks(s); + return encode_with_line_breaks(s); } template static std::string encode_mime(String s) { - return encode_with_line_breaks(s); + return encode_with_line_breaks(s); } template static std::string encode(String s, bool url) { - return base64_encode(reinterpret_cast(s.data()), s.length(), url); + return base64_encode(reinterpret_cast(s.data()), + s.length(), url); } -std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, bool url) { - - size_t len_encoded = (in_len +2) / 3 * 4; +std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, + bool url) { + size_t len_encoded = (in_len + 2) / 3 * 4; unsigned char trailing_char = url ? '.' : '='; - // - // Choose set of base64 characters. They differ - // for the last two positions, depending on the url - // parameter. - // A bool (as is the parameter url) is guaranteed - // to evaluate to either 0 or 1 in C++ therefore, - // the correct character set is chosen by subscripting - // base64_chars with url. - // + // + // Choose set of base64 characters. They differ + // for the last two positions, depending on the url + // parameter. + // A bool (as is the parameter url) is guaranteed + // to evaluate to either 0 or 1 in C++ therefore, + // the correct character set is chosen by subscripting + // base64_chars with url. + // const char* base64_chars_ = base64_chars[url]; std::string ret; @@ -134,21 +141,24 @@ std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, b while (pos < in_len) { ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0xfc) >> 2]); - if (pos+1 < in_len) { - ret.push_back(base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]); + if (pos + 1 < in_len) { + ret.push_back( + base64_chars_[((bytes_to_encode[pos + 0] & 0x03) << 4) + + ((bytes_to_encode[pos + 1] & 0xf0) >> 4)]); - if (pos+2 < in_len) { - ret.push_back(base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]); - ret.push_back(base64_chars_[ bytes_to_encode[pos + 2] & 0x3f]); - } - else { - ret.push_back(base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]); - ret.push_back(trailing_char); - } - } - else { - - ret.push_back(base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]); + if (pos + 2 < in_len) { + ret.push_back( + base64_chars_[((bytes_to_encode[pos + 1] & 0x0f) << 2) + + ((bytes_to_encode[pos + 2] & 0xc0) >> 6)]); + ret.push_back(base64_chars_[bytes_to_encode[pos + 2] & 0x3f]); + } else { + ret.push_back( + base64_chars_[(bytes_to_encode[pos + 1] & 0x0f) << 2]); + ret.push_back(trailing_char); + } + } else { + ret.push_back( + base64_chars_[(bytes_to_encode[pos + 0] & 0x03) << 4]); ret.push_back(trailing_char); ret.push_back(trailing_char); } @@ -156,106 +166,110 @@ std::string base64_encode(unsigned char const* bytes_to_encode, size_t in_len, b pos += 3; } - return ret; } template -static std::string decode(String const& encoded_string, bool remove_linebreaks) { - // - // decode(…) is templated so that it can be used with String = const std::string& - // or std::string_view (requires at least C++17) - // +static std::string decode(String const& encoded_string, + bool remove_linebreaks) { + // + // decode(…) is templated so that it can be used with String = const + // std::string& or std::string_view (requires at least C++17) + // if (encoded_string.empty()) return std::string(); if (remove_linebreaks) { + std::string copy(encoded_string); - std::string copy(encoded_string); + copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end()); - copy.erase(std::remove(copy.begin(), copy.end(), '\n'), copy.end()); - - return base64_decode(copy, false); + return base64_decode(copy, false); } size_t length_of_string = encoded_string.length(); size_t pos = 0; - // - // The approximate length (bytes) of the decoded string might be one or - // two bytes smaller, depending on the amount of trailing equal signs - // in the encoded string. This approximation is needed to reserve - // enough space in the string to be returned. - // + // + // The approximate length (bytes) of the decoded string might be one or + // two bytes smaller, depending on the amount of trailing equal signs + // in the encoded string. This approximation is needed to reserve + // enough space in the string to be returned. + // size_t approx_length_of_decoded_string = length_of_string / 4 * 3; std::string ret; ret.reserve(approx_length_of_decoded_string); while (pos < length_of_string) { - // - // Iterate over encoded input string in chunks. The size of all - // chunks except the last one is 4 bytes. - // - // The last chunk might be padded with equal signs or dots - // in order to make it 4 bytes in size as well, but this - // is not required as per RFC 2045. - // - // All chunks except the last one produce three output bytes. - // - // The last chunk produces at least one and up to three bytes. - // + // + // Iterate over encoded input string in chunks. The size of all + // chunks except the last one is 4 bytes. + // + // The last chunk might be padded with equal signs or dots + // in order to make it 4 bytes in size as well, but this + // is not required as per RFC 2045. + // + // All chunks except the last one produce three output bytes. + // + // The last chunk produces at least one and up to three bytes. + // - size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos+1) ); + size_t pos_of_char_1 = pos_of_char(encoded_string.at(pos + 1)); - // - // Emit the first output byte that is produced in each chunk: - // - ret.push_back(static_cast( ( (pos_of_char(encoded_string.at(pos+0)) ) << 2 ) + ( (pos_of_char_1 & 0x30 ) >> 4))); + // + // Emit the first output byte that is produced in each chunk: + // + ret.push_back(static_cast( + ((pos_of_char(encoded_string.at(pos + 0))) << 2) + + ((pos_of_char_1 & 0x30) >> 4))); - if ( ( pos + 2 < length_of_string ) && // Check for data that is not padded with equal signs (which is allowed by RFC 2045) - encoded_string.at(pos+2) != '=' && - encoded_string.at(pos+2) != '.' // accept URL-safe base 64 strings, too, so check for '.' also. - ) - { - // - // Emit a chunk's second byte (which might not be produced in the last chunk). - // - unsigned int pos_of_char_2 = pos_of_char(encoded_string.at(pos+2) ); - ret.push_back(static_cast( (( pos_of_char_1 & 0x0f) << 4) + (( pos_of_char_2 & 0x3c) >> 2))); + if ((pos + 2 < + length_of_string) && // Check for data that is not padded with + // equal signs (which is allowed by RFC 2045) + encoded_string.at(pos + 2) != '=' && + encoded_string.at(pos + 2) != + '.' // accept URL-safe base 64 strings, too, so check for '.' + // also. + ) { + // + // Emit a chunk's second byte (which might not be produced in the + // last chunk). + // + unsigned int pos_of_char_2 = + pos_of_char(encoded_string.at(pos + 2)); + ret.push_back(static_cast( + ((pos_of_char_1 & 0x0f) << 4) + ((pos_of_char_2 & 0x3c) >> 2))); - if ( ( pos + 3 < length_of_string ) && - encoded_string.at(pos+3) != '=' && - encoded_string.at(pos+3) != '.' - ) - { - // - // Emit a chunk's third byte (which might not be produced in the last chunk). - // - ret.push_back(static_cast( ( (pos_of_char_2 & 0x03 ) << 6 ) + pos_of_char(encoded_string.at(pos+3)) )); - } - } + if ((pos + 3 < length_of_string) && + encoded_string.at(pos + 3) != '=' && + encoded_string.at(pos + 3) != '.') { + // + // Emit a chunk's third byte (which might not be produced in the + // last chunk). + // + ret.push_back(static_cast( + ((pos_of_char_2 & 0x03) << 6) + + pos_of_char(encoded_string.at(pos + 3)))); + } + } - pos += 4; + pos += 4; } return ret; } std::string base64_decode(std::string const& s, bool remove_linebreaks) { - return decode(s, remove_linebreaks); + return decode(s, remove_linebreaks); } std::string base64_encode(std::string const& s, bool url) { - return encode(s, url); + return encode(s, url); } -std::string base64_encode_pem (std::string const& s) { - return encode_pem(s); -} +std::string base64_encode_pem(std::string const& s) { return encode_pem(s); } -std::string base64_encode_mime(std::string const& s) { - return encode_mime(s); -} +std::string base64_encode_mime(std::string const& s) { return encode_mime(s); } #if __cplusplus >= 201703L // @@ -265,19 +279,15 @@ std::string base64_encode_mime(std::string const& s) { // std::string base64_encode(std::string_view s, bool url) { - return encode(s, url); + return encode(s, url); } -std::string base64_encode_pem(std::string_view s) { - return encode_pem(s); -} +std::string base64_encode_pem(std::string_view s) { return encode_pem(s); } -std::string base64_encode_mime(std::string_view s) { - return encode_mime(s); -} +std::string base64_encode_mime(std::string_view s) { return encode_mime(s); } std::string base64_decode(std::string_view s, bool remove_linebreaks) { - return decode(s, remove_linebreaks); + return decode(s, remove_linebreaks); } #endif // __cplusplus >= 201703L diff --git a/Minecraft.Client/Platform/Common/Leaderboards/base64.h b/Minecraft.Client/Platform/Common/Leaderboards/base64.h index 052cea5a3..00a85e5ae 100644 --- a/Minecraft.Client/Platform/Common/Leaderboards/base64.h +++ b/Minecraft.Client/Platform/Common/Leaderboards/base64.h @@ -12,8 +12,8 @@ #include #endif // __cplusplus >= 201703L -std::string base64_encode (std::string const& s, bool url = false); -std::string base64_encode_pem (std::string const& s); +std::string base64_encode(std::string const& s, bool url = false); +std::string base64_encode_pem(std::string const& s); std::string base64_encode_mime(std::string const& s); std::string base64_decode(std::string const& s, bool remove_linebreaks = false); @@ -25,8 +25,8 @@ std::string base64_encode(unsigned char const*, size_t len, bool url = false); // Requires C++17 // Provided by Yannic Bonenberger (https://github.com/Yannic) // -std::string base64_encode (std::string_view s, bool url = false); -std::string base64_encode_pem (std::string_view s); +std::string base64_encode(std::string_view s, bool url = false); +std::string base64_encode_pem(std::string_view s); std::string base64_encode_mime(std::string_view s); std::string base64_decode(std::string_view s, bool remove_linebreaks = false); diff --git a/Minecraft.Client/Platform/Common/Minecraft_Macros.h b/Minecraft.Client/Platform/Common/Minecraft_Macros.h index 1c5b83e76..4642d9781 100644 --- a/Minecraft.Client/Platform/Common/Minecraft_Macros.h +++ b/Minecraft.Client/Platform/Common/Minecraft_Macros.h @@ -7,38 +7,56 @@ // 5 bits alpha // 1 bit decoration // 3 bits poptime -// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved to item bitmask -// 6 bits count -// 6 bits scale +// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved +// to item bitmask 6 bits count 6 bits scale -// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one from the packing, and add one on the unpacking -#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex,uiAlpha,bDecorations,uiCount,uiScale,uiPopTime) ((((uiUserIndex&0x7)<<29) | (uiAlpha&0x1F)<<24) | (bDecorations?0x800000:0) | ((uiPopTime&0x7)<<20) | ((uiCount-1)<<6) | (uiScale&0x3F)) +// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one +// from the packing, and add one on the unpacking +#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex, uiAlpha, bDecorations, \ + uiCount, uiScale, uiPopTime) \ + ((((uiUserIndex & 0x7) << 29) | (uiAlpha & 0x1F) << 24) | \ + (bDecorations ? 0x800000 : 0) | ((uiPopTime & 0x7) << 20) | \ + ((uiCount - 1) << 6) | (uiScale & 0x3F)) -#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>29)&0x7) -#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>24)&0x1F) -#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x800000)?true:false) -//#define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask) ((((unsigned long)uiBitmask)>>12)&0x7FF) -#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) (((((unsigned int)uiBitmask)>>6)&0x3F)+1) -#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0x3F) -#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>20)&0x7) +#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 29) & 0x7) +#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 24) & 0x1F) +#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) & 0x800000) ? true : false) +// #define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask) +// ((((unsigned long)uiBitmask)>>12)&0x7FF) +#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) \ + (((((unsigned int)uiBitmask) >> 6) & 0x3F) + 1) +#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) \ + (((unsigned int)uiBitmask) & 0x3F) +#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 20) & 0x7) // 16 bits for id (either item id or xzp icon id) // 15 bits for aux value // 1 bit for foil -#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId,uiAuxValue,bFoil) ( (uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil?0x80000000:0) ) - -#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0xFFFF) -#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>16) & 0x7FFF) -#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x80000000)?true:false) +#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId, uiAuxValue, bFoil) \ + ((uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil ? 0x80000000 : 0)) +#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) \ + (((unsigned int)uiBitmask) & 0xFFFF) +#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 16) & 0x7FFF) +#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) & 0x80000000) ? true : false) // For encoding the players skin selection in their profile // bDlcSkin = false is a players skin, bDlcSkin = true is a DLC skin -#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) ) +#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) \ + ((bDlcSkin ? 0x80000000 : 0) | (dwSkinId & 0x7FFFFFFF)) #define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF) -#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x7FFFFFFF) -#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x7FFFFFE0) -#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (static_cast(uiBitmask) & 0x0000001F) -#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((static_cast(uiBitmask) & 0x80000000) ? true : false) - +#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (static_cast(uiBitmask) & 0x7FFFFFFF) +#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (static_cast(uiBitmask) & 0x7FFFFFE0) +#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (static_cast(uiBitmask) & 0x0000001F) +#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) \ + ((static_cast(uiBitmask) & 0x80000000) ? true : false) diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 492488cb3..feb99fb17 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -34,7 +34,6 @@ #include "../UI/UI.h" #include "../UI/UIScene_PauseMenu.h" - // Global instance CGameNetworkManager g_NetworkManager; CPlatformNetworkManager* CGameNetworkManager::s_pPlatformNetworkManager; @@ -47,7 +46,6 @@ CGameNetworkManager::CGameNetworkManager() { m_bInitialised = false; m_bLastDisconnectWasLostRoomOnly = false; m_bFullSessionMessageOnNextSessionChange = false; - } void CGameNetworkManager::Initialise() { @@ -69,10 +67,7 @@ void CGameNetworkManager::Terminate() { } } -void CGameNetworkManager::DoWork() { - s_pPlatformNetworkManager->DoWork(); - -} +void CGameNetworkManager::DoWork() { s_pPlatformNetworkManager->DoWork(); } bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) { bool success = true; @@ -113,7 +108,6 @@ bool CGameNetworkManager::_RunNetworkGame(void* lpParameter) { bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, void* lpParameter) { - int64_t seed = 0; if (lpParameter != nullptr) { NetworkGameInitData* param = (NetworkGameInitData*)lpParameter; @@ -156,13 +150,13 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need // to share file? Probably not but... - nullptr, // Unused + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu // - Assuming that the file // already exists if we are // opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #else const char* pchFilename = @@ -172,20 +166,21 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need // to share file? Probably not but... - nullptr, // Unused + nullptr, // Unused OPEN_EXISTING, // how to create // TODO 4J Stu // - Assuming that the file // already exists if we are // opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - nullptr // Unsupported + nullptr // Unsupported ); #endif if (fileHandle != INVALID_HANDLE_VALUE) { - uint32_t bytesRead, - dwFileSize = GetFileSize(fileHandle, nullptr); - uint8_t* pbData = (uint8_t*) new uint8_t[dwFileSize]; + uint32_t bytesRead, dwFileSize = GetFileSize( + fileHandle, nullptr); + uint8_t* pbData = + (uint8_t*)new uint8_t[dwFileSize]; bool bSuccess = ReadFile(fileHandle, pbData, dwFileSize, &bytesRead, nullptr); @@ -483,7 +478,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, } else { connection->close(); auto it = find(createdConnections.begin(), - createdConnections.end(), connection); + createdConnections.end(), connection); if (it != createdConnections.end()) createdConnections.erase(it); } @@ -552,7 +547,6 @@ INetworkPlayer* CGameNetworkManager::GetPlayerBySmallId(unsigned char smallId) { return s_pPlatformNetworkManager->GetPlayerBySmallId(smallId); } - INetworkPlayer* CGameNetworkManager::GetHostPlayer() { return s_pPlatformNetworkManager->GetHostPlayer(); } @@ -689,8 +683,7 @@ CGameNetworkManager::eJoinGameResult CGameNetworkManager::JoinGame( searchResult, localUsersMask, primaryUserIndex)); } -void CGameNetworkManager::CancelJoinGame(void* lpParam) { -} +void CGameNetworkManager::CancelJoinGame(void* lpParam) {} bool CGameNetworkManager::LeaveGame(bool bMigrateHost) { Minecraft::GetInstance()->gui->clearMessages(); @@ -703,7 +696,6 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void* pParam, INVITE_INFO* pInviteInfo = (INVITE_INFO*)pParam; if (bContinue == true) { - app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n", iPad); // It's possible that the player has not signed in - they can back out if (ProfileManager.IsSignedIn(iPad) && @@ -833,7 +825,6 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) { return -1; } - Tile::ReleaseThreadStorage(); return 0; } @@ -899,7 +890,6 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) { return S_OK; } - void CGameNetworkManager::_LeaveGame() { s_pPlatformNetworkManager->_LeaveGame(false, true); } @@ -912,10 +902,10 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { Minecraft* pMinecraft = Minecraft::GetInstance(); MinecraftServer* pServer = MinecraftServer::getInstance(); - pMinecraft->progressRenderer->progressStartNoAbort( - g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); - pMinecraft->progressRenderer->progressStage( - IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) != eXuiServerAction_Idle && @@ -928,20 +918,19 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // wait for the server to be in a non-ticking state pServer->m_serverPausedEvent->WaitForSignal(INFINITE); - pMinecraft->progressRenderer->progressStartNoAbort( - g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); - pMinecraft->progressRenderer->progressStage( - IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); + pMinecraft->progressRenderer->progressStartNoAbort( + g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT)); + pMinecraft->progressRenderer->progressStage( + IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME); pMinecraft->progressRenderer->progressStagePercentage(25); - // Null the network player of all the server players that are local, to stop // them being removed from the server when removed from the session if (pServer != nullptr) { PlayerList* players = pServer->getPlayers(); - for (auto it = players->players.begin(); - it < players->players.end(); ++it) { + for (auto it = players->players.begin(); it < players->players.end(); + ++it) { std::shared_ptr servPlayer = *it; if (servPlayer->connection->isLocal() && !servPlayer->connection->isGuest()) { @@ -1073,8 +1062,7 @@ std::wstring CGameNetworkManager::GatherStats() { return s_pPlatformNetworkManager->GatherStats(); } -void CGameNetworkManager::renderQueueMeter() { -} +void CGameNetworkManager::renderQueueMeter() {} std::wstring CGameNetworkManager::GatherRTTStats() { return s_pPlatformNetworkManager->GatherRTTStats(); @@ -1125,7 +1113,6 @@ void CGameNetworkManager::StateChange_JoiningToIdle( } void CGameNetworkManager::StateChange_AnyToStarting() { - if (!g_NetworkManager.IsHost()) { LoadingInputParams* loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; @@ -1321,7 +1308,8 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, // except for the invited player (who may be an inactive player) 4J // Stu - If we are not in a game, then bring in all players signed // in - if (index == userIndex || pMinecraft->localplayers[index] != nullptr) { + if (index == userIndex || + pMinecraft->localplayers[index] != nullptr) { ++joiningUsers; if (!ProfileManager.AllowedToPlayMultiplayer(index)) noPrivileges = true; @@ -1340,16 +1328,14 @@ void CGameNetworkManager::GameInviteReceived(int userIndex, ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; - - if (noUGC) { + if (noUGC) { int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; if (joiningUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText, XUSER_INDEX_ANY); - } - else if (noPrivileges) { + } else if (noPrivileges) { unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; @@ -1389,7 +1375,6 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_INFO* pInviteInfo) { // We are in the root menus somewhere - // if this is the trial game, then we need the user to unlock the full game if (!ProfileManager.IsFullVersion()) { // The marketplace will fail with the primary player set to -1 @@ -1411,8 +1396,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( // as the main player might sign out in the sign-in ui // ProfileManager.SetLockedProfile(-1); - if (!app.IsLocalMultiplayerAvailable()) - { + if (!app.IsLocalMultiplayerAvailable()) { bool noPrivileges = !ProfileManager.AllowedToPlayMultiplayer(userIndex); @@ -1473,8 +1457,7 @@ void CGameNetworkManager::AddLocalPlayerFailed(int idx, : DisconnectPacket::eDisconnect_ConnectionCreationFailed); } -void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) -{ +void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly) { int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); if ((g_NetworkManager.GetLockedProfile() != -1) && iPrimaryPlayer != -1 && @@ -1600,4 +1583,3 @@ int CGameNetworkManager::GetJoiningReadyPercentage() { void CGameNetworkManager::FakeLocalPlayerJoined() { s_pPlatformNetworkManager->FakeLocalPlayerJoined(); } - diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h index 656a1584a..f81e22f32 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.h @@ -22,6 +22,7 @@ const int NON_QNET_SENDDATA_ACK_REQUIRED = 1; class CGameNetworkManager { friend class CPlatformNetworkManagerStub; + public: CGameNetworkManager(); // Misc high level flow @@ -122,7 +123,6 @@ public: static int ServerThreadProc(void* lpParameter); static int ExitAndJoinFromInviteThreadProc(void* lpParam); - static void _LeaveGame(); static int ChangeSessionTypeThreadProc(void* lpParam); @@ -133,11 +133,12 @@ public: // Events - void ServerReadyCreate(bool create); // Create the signal (or set to nullptr) - void ServerReady(); // Signal that we are ready - void ServerReadyWait(); // Wait for the signal - void ServerReadyDestroy(); // Destroy signal - bool ServerReadyValid(); // Is non-nullptr + void ServerReadyCreate( + bool create); // Create the signal (or set to nullptr) + void ServerReady(); // Signal that we are ready + void ServerReadyWait(); // Wait for the signal + void ServerReadyDestroy(); // Destroy signal + bool ServerReadyValid(); // Is non-nullptr void ServerStoppedCreate(bool create); // Create the signal void ServerStopped(); // Signal that we are ready @@ -204,4 +205,3 @@ public: }; extern CGameNetworkManager g_NetworkManager; - diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h index 9c6252775..bd0d40b8a 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerInterface.h @@ -141,5 +141,4 @@ public: virtual void FakeLocalPlayerJoined() { }; // Temporary method whilst we don't have real networking to make this // happen - }; diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp index aca433d9a..446d7a81e 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp @@ -292,8 +292,8 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData( // 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 ) + // point the player is still considered in the session + // if( pNetworkPlayer != pNetworkPlayerLeaving ) // { // m_hostGameSessionData.players[i] = // ((NetworkPlayerXbox *)pNetworkPlayer)->GetUID(); diff --git a/Minecraft.Client/Platform/Common/Network/SessionInfo.h b/Minecraft.Client/Platform/Common/Network/SessionInfo.h index cf8fa2d64..22f55e495 100644 --- a/Minecraft.Client/Platform/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Platform/Common/Network/SessionInfo.h @@ -1,6 +1,5 @@ #pragma once - // A struct that we store in the QoS data when we are hosting the session. Max // size 1020 bytes. typedef struct _GameSessionData { diff --git a/Minecraft.Client/Platform/Common/Potion_Macros.h b/Minecraft.Client/Platform/Common/Potion_Macros.h index 29f3e03a3..61ef7f35b 100644 --- a/Minecraft.Client/Platform/Common/Potion_Macros.h +++ b/Minecraft.Client/Platform/Common/Potion_Macros.h @@ -3,52 +3,59 @@ // 4J-JEV: // All functional potions need bit-13 set. -#define MASK_REGENERATION 0x2001 -#define MASK_SPEED 0x2002 -#define MASK_FIRE_RESISTANCE 0x2003 -#define MASK_POISON 0x2004 -#define MASK_INSTANTHEALTH 0x2005 -#define MASK_NIGHTVISION 0x2006 -#define MASK_INVISIBILITY 0x200E -#define MASK_WEAKNESS 0x2008 -#define MASK_STRENGTH 0x2009 -#define MASK_SLOWNESS 0x200A -#define MASK_INSTANTDAMAGE 0x200C +#define MASK_REGENERATION 0x2001 +#define MASK_SPEED 0x2002 +#define MASK_FIRE_RESISTANCE 0x2003 +#define MASK_POISON 0x2004 +#define MASK_INSTANTHEALTH 0x2005 +#define MASK_NIGHTVISION 0x2006 +#define MASK_INVISIBILITY 0x200E +#define MASK_WEAKNESS 0x2008 +#define MASK_STRENGTH 0x2009 +#define MASK_SLOWNESS 0x200A +#define MASK_INSTANTDAMAGE 0x200C -#define MASK_TYPE_AWKWARD 0x0010 +#define MASK_TYPE_AWKWARD 0x0010 -#define MASK_SPLASH 0x4000 -#define MASK_BIT13 0x2000 +#define MASK_SPLASH 0x4000 +#define MASK_BIT13 0x2000 -#define MASK_LEVEL2 0x0020 -#define MASK_EXTENDED 0x0040 -#define MASK_LEVEL2EXTENDED 0x0060 +#define MASK_LEVEL2 0x0020 +#define MASK_EXTENDED 0x0040 +#define MASK_LEVEL2EXTENDED 0x0060 -#define MACRO_POTION_IS_REGENERATION(aux) ((aux & 0x200F) == MASK_REGENERATION) -#define MACRO_POTION_IS_SPEED(aux) ((aux & 0x200F) == MASK_SPEED) -#define MACRO_POTION_IS_FIRE_RESISTANCE(aux) ((aux & 0x200F) == MASK_FIRE_RESISTANCE) -#define MACRO_POTION_IS_INSTANTHEALTH(aux) ((aux & 0x200F) == MASK_INSTANTHEALTH) -#define MACRO_POTION_IS_NIGHTVISION(aux) ((aux & 0x200F) == MASK_NIGHTVISION) -#define MACRO_POTION_IS_INVISIBILITY(aux) ((aux & 0x200F) == MASK_INVISIBILITY) -#define MACRO_POTION_IS_WEAKNESS(aux) ((aux & 0x200F) == MASK_WEAKNESS) -#define MACRO_POTION_IS_STRENGTH(aux) ((aux & 0x200F) == MASK_STRENGTH) -#define MACRO_POTION_IS_SLOWNESS(aux) ((aux & 0x200F) == MASK_SLOWNESS) -#define MACRO_POTION_IS_POISON(aux) ((aux & 0x200F) == MASK_POISON) -#define MACRO_POTION_IS_INSTANTDAMAGE(aux) ((aux & 0x200F) == MASK_INSTANTDAMAGE) +#define MACRO_POTION_IS_REGENERATION(aux) ((aux & 0x200F) == MASK_REGENERATION) +#define MACRO_POTION_IS_SPEED(aux) ((aux & 0x200F) == MASK_SPEED) +#define MACRO_POTION_IS_FIRE_RESISTANCE(aux) \ + ((aux & 0x200F) == MASK_FIRE_RESISTANCE) +#define MACRO_POTION_IS_INSTANTHEALTH(aux) \ + ((aux & 0x200F) == MASK_INSTANTHEALTH) +#define MACRO_POTION_IS_NIGHTVISION(aux) ((aux & 0x200F) == MASK_NIGHTVISION) +#define MACRO_POTION_IS_INVISIBILITY(aux) ((aux & 0x200F) == MASK_INVISIBILITY) +#define MACRO_POTION_IS_WEAKNESS(aux) ((aux & 0x200F) == MASK_WEAKNESS) +#define MACRO_POTION_IS_STRENGTH(aux) ((aux & 0x200F) == MASK_STRENGTH) +#define MACRO_POTION_IS_SLOWNESS(aux) ((aux & 0x200F) == MASK_SLOWNESS) +#define MACRO_POTION_IS_POISON(aux) ((aux & 0x200F) == MASK_POISON) +#define MACRO_POTION_IS_INSTANTDAMAGE(aux) \ + ((aux & 0x200F) == MASK_INSTANTDAMAGE) -#define MACRO_POTION_IS_SPLASH(aux) ((aux & MASK_SPLASH) == MASK_SPLASH) -#define MACRO_POTION_IS_BOTTLE(aux) ((aux & MASK_SPLASH) == 0) +#define MACRO_POTION_IS_SPLASH(aux) ((aux & MASK_SPLASH) == MASK_SPLASH) +#define MACRO_POTION_IS_BOTTLE(aux) ((aux & MASK_SPLASH) == 0) -#define MACRO_POTION_IS_AKWARD(aux) ((aux & MASK_TYPE_AWKWARD) == MASK_TYPE_AWKWARD) +#define MACRO_POTION_IS_AKWARD(aux) \ + ((aux & MASK_TYPE_AWKWARD) == MASK_TYPE_AWKWARD) -#define MACRO_POTION_IS_REGULAR(aux) ((aux & (MASK_LEVEL2EXTENDED)) == 0) -#define MACRO_POTION_IS_LEVEL2(aux) ((aux & (MASK_LEVEL2 )) == MASK_LEVEL2) -#define MACRO_POTION_IS_EXTENDED(aux) ((aux & (MASK_EXTENDED)) == (MASK_EXTENDED)) -#define MACRO_POTION_IS_LEVEL2EXTENDED(aux) ((aux & (MASK_LEVEL2EXTENDED)) == (MASK_LEVEL2EXTENDED)) +#define MACRO_POTION_IS_REGULAR(aux) ((aux & (MASK_LEVEL2EXTENDED)) == 0) +#define MACRO_POTION_IS_LEVEL2(aux) ((aux & (MASK_LEVEL2)) == MASK_LEVEL2) +#define MACRO_POTION_IS_EXTENDED(aux) \ + ((aux & (MASK_EXTENDED)) == (MASK_EXTENDED)) +#define MACRO_POTION_IS_LEVEL2EXTENDED(aux) \ + ((aux & (MASK_LEVEL2EXTENDED)) == (MASK_LEVEL2EXTENDED)) +#define MACRO_MAKEPOTION_AUXVAL(potion_type, potion_strength, potion_effect) \ + (potion_type | potion_strength | potion_effect) -#define MACRO_MAKEPOTION_AUXVAL(potion_type, potion_strength, potion_effect) (potion_type | potion_strength | potion_effect) - -// The potion brewing creates high aux values with redundant high bits, so use this to bring the aux val into ranges that match our macros -// 4J-JEV: 0x2000 == bit-13; Used to stop netherwart "resetting" functional potions. +// The potion brewing creates high aux values with redundant high bits, so use +// this to bring the aux val into ranges that match our macros 4J-JEV: 0x2000 == +// bit-13; Used to stop netherwart "resetting" functional potions. #define NORMALISE_POTION_AUXVAL(aux) (aux & (MASK_BIT13 | MASK_SPLASH | 0xFF)) \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/ShutdownManager.h b/Minecraft.Client/Platform/Common/ShutdownManager.h index e6c0f8b4f..3e672c037 100644 --- a/Minecraft.Client/Platform/Common/ShutdownManager.h +++ b/Minecraft.Client/Platform/Common/ShutdownManager.h @@ -9,7 +9,7 @@ #include "../../../Minecraft.World/Util/C4JThread.h" class ShutdownManager { - public: +public: enum EThreadId { eMainThread, eLeaderboardThread, @@ -36,7 +36,7 @@ class ShutdownManager { static bool ShouldRun(EThreadId threadId); static void HasFinished(EThreadId threadId); - private: +private: struct GroupState { std::size_t started = 0; std::size_t running = 0; diff --git a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.cpp b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.cpp index 5235ba38e..8526b0fe7 100644 --- a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.cpp +++ b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.cpp @@ -8,435 +8,396 @@ #include "TelemetryManager.h" +CTelemetryManager* TelemetryManager = new CTelemetryManager(); -CTelemetryManager *TelemetryManager = new CTelemetryManager(); +int32_t CTelemetryManager::Init() { return 0; } +int32_t CTelemetryManager::Tick() { return 0; } -int32_t CTelemetryManager::Init() -{ - return 0; +int32_t CTelemetryManager::Flush() { return 0; } + +bool CTelemetryManager::RecordPlayerSessionStart(int iPad) { return true; } + +bool CTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) { + return true; } -int32_t CTelemetryManager::Tick() -{ - return 0; +bool CTelemetryManager::RecordHeartBeat(int iPad) { return true; } + +bool CTelemetryManager::RecordLevelStart(int iPad, + ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, + int difficulty, + int numberOfLocalPlayers, + int numberOfOnlinePlayers) { + if (iPad == ProfileManager.GetPrimaryPad()) m_bFirstFlush = true; + + ++m_levelInstanceID; + m_fLevelStartTime[iPad] = app.getAppTime(); + + return true; } -int32_t CTelemetryManager::Flush() -{ - return 0; +bool CTelemetryManager::RecordLevelExit(int iPad, + ESen_LevelExitStatus levelExitStatus) { + return true; } -bool CTelemetryManager::RecordPlayerSessionStart(int iPad) -{ - return true; +bool CTelemetryManager::RecordLevelSaveOrCheckpoint(int iPad, + int saveOrCheckPointID, + int saveSizeInBytes) { + return true; } -bool CTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) -{ - return true; +bool CTelemetryManager::RecordLevelResume( + int iPad, ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, + int numberOfOnlinePlayers, int saveOrCheckPointID) { + return true; } -bool CTelemetryManager::RecordHeartBeat(int iPad) -{ - return true; +bool CTelemetryManager::RecordPauseOrInactive(int iPad) { return true; } + +bool CTelemetryManager::RecordUnpauseOrActive(int iPad) { return true; } + +bool CTelemetryManager::RecordMenuShown(int iPad, EUIScene menuID, + int optionalMenuSubID) { + return true; } -bool CTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers) -{ - if(iPad == ProfileManager.GetPrimaryPad() ) m_bFirstFlush = true; - - ++m_levelInstanceID; - m_fLevelStartTime[iPad] = app.getAppTime(); - - return true; +bool CTelemetryManager::RecordAchievementUnlocked(int iPad, int achievementID, + int achievementGamerscore) { + return true; } -bool CTelemetryManager::RecordLevelExit(int iPad, ESen_LevelExitStatus levelExitStatus) -{ - return true; +bool CTelemetryManager::RecordMediaShareUpload( + int iPad, ESen_MediaDestination mediaDestination, + ESen_MediaType mediaType) { + return true; } -bool CTelemetryManager::RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID, int saveSizeInBytes) -{ - return true; +bool CTelemetryManager::RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, + int marketplaceOfferID) { + return true; } -bool CTelemetryManager::RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers, int saveOrCheckPointID) -{ - return true; +bool CTelemetryManager::RecordUpsellResponded( + int iPad, ESen_UpsellID upsellId, int marketplaceOfferID, + ESen_UpsellOutcome upsellOutcome) { + return true; } -bool CTelemetryManager::RecordPauseOrInactive(int iPad) -{ - return true; +bool CTelemetryManager::RecordPlayerDiedOrFailed( + int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, + int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) { + return true; } -bool CTelemetryManager::RecordUnpauseOrActive(int iPad) -{ - return true; +bool CTelemetryManager::RecordEnemyKilledOrOvercome( + int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, + int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) { + return true; } -bool CTelemetryManager::RecordMenuShown(int iPad, EUIScene menuID, int optionalMenuSubID) -{ - return true; +bool CTelemetryManager::RecordTexturePackLoaded(int iPad, int texturePackId, + bool purchased) { + return true; } -bool CTelemetryManager::RecordAchievementUnlocked(int iPad, int achievementID, int achievementGamerscore) -{ - return true; +bool CTelemetryManager::RecordSkinChanged(int iPad, int dwSkinId) { + return true; } -bool CTelemetryManager::RecordMediaShareUpload(int iPad, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType) -{ - return true; -} +bool CTelemetryManager::RecordBanLevel(int iPad) { return true; } -bool CTelemetryManager::RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID) -{ - return true; -} - -bool CTelemetryManager::RecordUpsellResponded(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID, ESen_UpsellOutcome upsellOutcome) -{ - return true; -} - -bool CTelemetryManager::RecordPlayerDiedOrFailed(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) -{ - return true; -} - -bool CTelemetryManager::RecordEnemyKilledOrOvercome(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID) -{ - return true; -} - -bool CTelemetryManager::RecordTexturePackLoaded(int iPad, int texturePackId, bool purchased) -{ - return true; -} - -bool CTelemetryManager::RecordSkinChanged(int iPad, int dwSkinId) -{ - return true; -} - -bool CTelemetryManager::RecordBanLevel(int iPad) -{ - return true; -} - -bool CTelemetryManager::RecordUnBanLevel(int iPad) -{ - return true; -} - - - /////////////////////////////////////////////////////////////////// - // 4J-JEV: FOLLOWING LOGIC TAKEN FROM XBOX 'SentientManager.cpp' // - /////////////////////////////////////////////////////////////////// +bool CTelemetryManager::RecordUnBanLevel(int iPad) { return true; } +/////////////////////////////////////////////////////////////////// +// 4J-JEV: FOLLOWING LOGIC TAKEN FROM XBOX 'SentientManager.cpp' // +/////////////////////////////////////////////////////////////////// /* Number of seconds elapsed since Sentient initialize. Title needs to track this and report it as a property. -These times will be used to create timelines and understand durations. -This should be tracked independently of saved games (restoring a save should not reset the seconds since initialize) +These times will be used to create timelines and understand durations. +This should be tracked independently of saved games (restoring a save should not +reset the seconds since initialize) */ -int CTelemetryManager::GetSecondsSinceInitialize() -{ - return static_cast(app.getAppTime() - m_initialiseTime); +int CTelemetryManager::GetSecondsSinceInitialize() { + return static_cast(app.getAppTime() - m_initialiseTime); } /* An in-game setting that significantly differentiates the play style of the game. -(This should be captured as an integer and correspond to mode specific to the game.) -Teams will have to provide the game mappings that correspond to the integers. -The intent is to allow teams to capture data on the highest level categories of gameplay in their game. -For example, a game mode could be the name of the specific mini game (eg: golf vs darts) or a specific multiplayer mode (eg: hoard vs beast.) ModeID = 0 means undefined or unknown. -The intent is to answer the question "How are players playing your game?" +(This should be captured as an integer and correspond to mode specific to the +game.) Teams will have to provide the game mappings that correspond to the +integers. The intent is to allow teams to capture data on the highest level +categories of gameplay in their game. For example, a game mode could be the name +of the specific mini game (eg: golf vs darts) or a specific multiplayer mode +(eg: hoard vs beast.) ModeID = 0 means undefined or unknown. The intent is to +answer the question "How are players playing your game?" */ -int CTelemetryManager::GetMode(int userId) -{ - int mode = static_cast(eTelem_ModeId_Undefined); - - Minecraft *pMinecraft = Minecraft::GetInstance(); +int CTelemetryManager::GetMode(int userId) { + int mode = static_cast(eTelem_ModeId_Undefined); - if( pMinecraft->localplayers[userId] != nullptr && pMinecraft->localplayers[userId]->level != nullptr && pMinecraft->localplayers[userId]->level->getLevelData() != nullptr ) - { - GameType *gameType = pMinecraft->localplayers[userId]->level->getLevelData()->getGameType(); + Minecraft* pMinecraft = Minecraft::GetInstance(); - if (gameType->isSurvival()) - { - mode = static_cast(eTelem_ModeId_Survival); - } - else if (gameType->isCreative()) - { - mode = static_cast(eTelem_ModeId_Creative); - } - else - { - mode = static_cast(eTelem_ModeId_Undefined); - } - } - return mode; + if (pMinecraft->localplayers[userId] != nullptr && + pMinecraft->localplayers[userId]->level != nullptr && + pMinecraft->localplayers[userId]->level->getLevelData() != nullptr) { + GameType* gameType = pMinecraft->localplayers[userId] + ->level->getLevelData() + ->getGameType(); + + if (gameType->isSurvival()) { + mode = static_cast(eTelem_ModeId_Survival); + } else if (gameType->isCreative()) { + mode = static_cast(eTelem_ModeId_Creative); + } else { + mode = static_cast(eTelem_ModeId_Undefined); + } + } + return mode; } /* Used when a title has more heirarchy required. OptionalSubMode ID = 0 means undefined or unknown. For titles that have sub-modes (Sports/Football). -Mode is always an indicator of "How is the player choosing to play my game?" so these do not have to be consecutive. -LevelIDs and SubLevelIDs can be reused as they will always be paired with a Mode/SubModeID, Mode should be unique - SubMode can be shared between modes. +Mode is always an indicator of "How is the player choosing to play my game?" so +these do not have to be consecutive. LevelIDs and SubLevelIDs can be reused as +they will always be paired with a Mode/SubModeID, Mode should be unique - +SubMode can be shared between modes. */ -int CTelemetryManager::GetSubMode(int userId) -{ - int subMode = static_cast(eTelem_SubModeId_Undefined); +int CTelemetryManager::GetSubMode(int userId) { + int subMode = static_cast(eTelem_SubModeId_Undefined); - if(Minecraft::GetInstance()->isTutorial()) - { - subMode = static_cast(eTelem_SubModeId_Tutorial); - } - else - { - subMode = static_cast(eTelem_SubModeId_Normal); - } + if (Minecraft::GetInstance()->isTutorial()) { + subMode = static_cast(eTelem_SubModeId_Tutorial); + } else { + subMode = static_cast(eTelem_SubModeId_Normal); + } - return subMode; + return subMode; } /* -This is a more granular view of mode, allowing teams to get a sense of the levels or maps players are playing and providing some insight into how players progress through a game. -Teams will have to provide the game mappings that correspond to the integers. -The intent is that a level is highest level at which modes can be dissected and provides an indication of player progression in a game. -The intent is that level start and ends do not occur more than every 2 minutes or so, otherwise the data reported will be difficult to understand. -Levels are unique only within a given modeID - so you can have a ModeID =1, LevelID =1 and a different ModeID=2, LevelID = 1 indicate two completely different levels. -LevelID = 0 means undefined or unknown. +This is a more granular view of mode, allowing teams to get a sense of the +levels or maps players are playing and providing some insight into how players +progress through a game. Teams will have to provide the game mappings that +correspond to the integers. The intent is that a level is highest level at which +modes can be dissected and provides an indication of player progression in a +game. The intent is that level start and ends do not occur more than every 2 +minutes or so, otherwise the data reported will be difficult to understand. +Levels are unique only within a given modeID - so you can have a ModeID =1, +LevelID =1 and a different ModeID=2, LevelID = 1 indicate two completely +different levels. LevelID = 0 means undefined or unknown. */ -int CTelemetryManager::GetLevelId(int userId) -{ - int levelId = static_cast(eTelem_LevelId_Undefined); +int CTelemetryManager::GetLevelId(int userId) { + int levelId = static_cast(eTelem_LevelId_Undefined); - levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); + levelId = static_cast(eTelem_LevelId_PlayerGeneratedLevel); - return levelId; + return levelId; } /* -Used when a title has more heirarchy required. OptionalSubLevel ID = 0 means undefined or unknown. -For titles that have sub-levels. -Level is always an indicator of "How far has the player progressed." so when possible these should be consecutive or at least monotonically increasing. -LevelIDs and SubLevelIDs can be reused as they will always be paired with a Mode/SubModeID +Used when a title has more heirarchy required. OptionalSubLevel ID = 0 means +undefined or unknown. For titles that have sub-levels. Level is always an +indicator of "How far has the player progressed." so when possible these should +be consecutive or at least monotonically increasing. LevelIDs and SubLevelIDs +can be reused as they will always be paired with a Mode/SubModeID */ -int CTelemetryManager::GetSubLevelId(int userId) -{ - int subLevelId = static_cast(eTelem_SubLevelId_Undefined); +int CTelemetryManager::GetSubLevelId(int userId) { + int subLevelId = static_cast(eTelem_SubLevelId_Undefined); - Minecraft *pMinecraft = Minecraft::GetInstance(); + Minecraft* pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[userId] != nullptr) - { - switch(pMinecraft->localplayers[userId]->dimension) - { - case 0: - subLevelId = static_cast(eTelem_SubLevelId_Overworld); - break; - case -1: - subLevelId = static_cast(eTelem_SubLevelId_Nether); - break; - case 1: - subLevelId = static_cast(eTelem_SubLevelId_End); - break; - }; - } + if (pMinecraft->localplayers[userId] != nullptr) { + switch (pMinecraft->localplayers[userId]->dimension) { + case 0: + subLevelId = static_cast(eTelem_SubLevelId_Overworld); + break; + case -1: + subLevelId = static_cast(eTelem_SubLevelId_Nether); + break; + case 1: + subLevelId = static_cast(eTelem_SubLevelId_End); + break; + }; + } - return subLevelId; + return subLevelId; } /* -Build version of the title, used to track changes in development as well as patches/title updates -Allows developer to separate out stats from different builds +Build version of the title, used to track changes in development as well as +patches/title updates Allows developer to separate out stats from different +builds */ -int CTelemetryManager::GetTitleBuildId() -{ - return static_cast(VER_PRODUCTBUILD); +int CTelemetryManager::GetTitleBuildId() { + return static_cast(VER_PRODUCTBUILD); } /* Generated by the game every time LevelStart or LevelResume is called. This should be a unique ID (can be sequential) within a session. -Helps differentiate level attempts when a play plays the same mode/level - especially with aggregated stats +Helps differentiate level attempts when a play plays the same mode/level - +especially with aggregated stats */ -int CTelemetryManager::GetLevelInstanceID() -{ - return m_levelInstanceID; +int CTelemetryManager::GetLevelInstanceID() { return m_levelInstanceID; } + +/* +MultiplayerinstanceID is a title-generated value that is the same for all +players in the same multiplayer session. Link up players into a single +multiplayer session ID. +*/ +int CTelemetryManager::GetMultiplayerInstanceID() { + return m_multiplayerInstanceID; +} + +int CTelemetryManager::GenerateMultiplayerInstanceId() { return 0; } + +void CTelemetryManager::SetMultiplayerInstanceId(int value) { + m_multiplayerInstanceID = value; } /* -MultiplayerinstanceID is a title-generated value that is the same for all players in the same multiplayer session. -Link up players into a single multiplayer session ID. +Indicates whether the game is being played in single or multiplayer mode and +whether multiplayer is being played locally or over live. How social is your +game? How do people play it? */ -int CTelemetryManager::GetMultiplayerInstanceID() -{ - return m_multiplayerInstanceID; -} +int CTelemetryManager::GetSingleOrMultiplayer() { + int singleOrMultiplayer = + static_cast(eSen_SingleOrMultiplayer_Undefined); -int CTelemetryManager::GenerateMultiplayerInstanceId() -{ - return 0; -} + // Unused + // eSen_SingleOrMultiplayer_Single_Player + // eSen_SingleOrMultiplayer_Multiplayer_Live -void CTelemetryManager::SetMultiplayerInstanceId(int value) -{ - m_multiplayerInstanceID = value; -} + if (app.GetLocalPlayerCount() == 1 && + g_NetworkManager.GetOnlinePlayerCount() == 0) { + singleOrMultiplayer = + static_cast(eSen_SingleOrMultiplayer_Single_Player); + } else if (app.GetLocalPlayerCount() > 1 && + g_NetworkManager.GetOnlinePlayerCount() == 0) { + singleOrMultiplayer = + static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); + } else if (app.GetLocalPlayerCount() == 1 && + g_NetworkManager.GetOnlinePlayerCount() > 0) { + singleOrMultiplayer = + static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); + } else if (app.GetLocalPlayerCount() > 1 && + g_NetworkManager.GetOnlinePlayerCount() > 0) { + singleOrMultiplayer = static_cast( + eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); + } -/* -Indicates whether the game is being played in single or multiplayer mode and whether multiplayer is being played locally or over live. -How social is your game? How do people play it? -*/ -int CTelemetryManager::GetSingleOrMultiplayer() -{ - int singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Undefined); - - // Unused - //eSen_SingleOrMultiplayer_Single_Player - //eSen_SingleOrMultiplayer_Multiplayer_Live - - if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) - { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Single_Player); - } - else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() == 0) - { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Local); - } - else if(app.GetLocalPlayerCount() == 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) - { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Live); - } - else if(app.GetLocalPlayerCount() > 1 && g_NetworkManager.GetOnlinePlayerCount() > 0) - { - singleOrMultiplayer = static_cast(eSen_SingleOrMultiplayer_Multiplayer_Both_Local_and_Live); - } - - return singleOrMultiplayer; + return singleOrMultiplayer; } /* An in-game setting that differentiates the challenge imposed on the user. Normalized to a standard 5-point scale. Are players changing the difficulty? */ -int CTelemetryManager::GetDifficultyLevel(int diff) -{ - int difficultyLevel = static_cast(eSen_DifficultyLevel_Undefined); +int CTelemetryManager::GetDifficultyLevel(int diff) { + int difficultyLevel = static_cast(eSen_DifficultyLevel_Undefined); - switch(diff) - { - case 0: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); - break; - case 1: - difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); - break; - case 2: - difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); - break; - case 3: - difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); - break; - } + switch (diff) { + case 0: + difficultyLevel = static_cast(eSen_DifficultyLevel_Easiest); + break; + case 1: + difficultyLevel = static_cast(eSen_DifficultyLevel_Easier); + break; + case 2: + difficultyLevel = static_cast(eSen_DifficultyLevel_Normal); + break; + case 3: + difficultyLevel = static_cast(eSen_DifficultyLevel_Harder); + break; + } - // Unused - //eSen_DifficultyLevel_Hardest = 5, + // Unused + // eSen_DifficultyLevel_Hardest = 5, - return difficultyLevel; + return difficultyLevel; } /* Differentiates trial/demo from full purchased titles Is this a full title or demo? */ -int CTelemetryManager::GetLicense() -{ - int license = eSen_License_Undefined; +int CTelemetryManager::GetLicense() { + int license = eSen_License_Undefined; - if(ProfileManager.IsFullVersion()) - { - license = static_cast(eSen_License_Full_Purchased_Title); - } - else - { - license = static_cast(eSen_License_Trial_or_Demo); - } - return license; + if (ProfileManager.IsFullVersion()) { + license = static_cast(eSen_License_Full_Purchased_Title); + } else { + license = static_cast(eSen_License_Trial_or_Demo); + } + return license; } /* -This is intended to capture whether players played using default control scheme or customized the control scheme. -Are players customizing your controls? +This is intended to capture whether players played using default control scheme +or customized the control scheme. Are players customizing your controls? */ -int CTelemetryManager::GetDefaultGameControls() -{ - int defaultGameControls = eSen_DefaultGameControls_Undefined; +int CTelemetryManager::GetDefaultGameControls() { + int defaultGameControls = eSen_DefaultGameControls_Undefined; - // Unused - //eSen_DefaultGameControls_Custom_controls + // Unused + // eSen_DefaultGameControls_Custom_controls - defaultGameControls = eSen_DefaultGameControls_Default_controls; + defaultGameControls = eSen_DefaultGameControls_Default_controls; - return defaultGameControls; + return defaultGameControls; } /* Are players changing default audio settings? -This is intended to capture whether players are playing with or without volume and whether they make changes from the default audio settings. +This is intended to capture whether players are playing with or without volume +and whether they make changes from the default audio settings. */ -int CTelemetryManager::GetAudioSettings(int userId) -{ - int audioSettings = static_cast(eSen_AudioSettings_Undefined); +int CTelemetryManager::GetAudioSettings(int userId) { + int audioSettings = static_cast(eSen_AudioSettings_Undefined); - if(userId == ProfileManager.GetPrimaryPad()) - { - unsigned char volume = app.GetGameSettings(userId, eGameSetting_SoundFXVolume); + if (userId == ProfileManager.GetPrimaryPad()) { + unsigned char volume = + app.GetGameSettings(userId, eGameSetting_SoundFXVolume); - if(volume == 0) - { - audioSettings = static_cast(eSen_AudioSettings_Off); - } - else if(volume == DEFAULT_VOLUME_LEVEL) - { - audioSettings = static_cast(eSen_AudioSettings_On_Default); - } - else - { - audioSettings = static_cast(eSen_AudioSettings_On_CustomSetting); - } - } - return audioSettings; + if (volume == 0) { + audioSettings = static_cast(eSen_AudioSettings_Off); + } else if (volume == DEFAULT_VOLUME_LEVEL) { + audioSettings = static_cast(eSen_AudioSettings_On_Default); + } else { + audioSettings = + static_cast(eSen_AudioSettings_On_CustomSetting); + } + } + return audioSettings; } /* Refers to the highest level performance metric for your game. -For example, a performance metric could points earned, race time, total kills, etc. -This is entirely up to you and will help us understand how well the player performed, or how far the player progressed  in the level before exiting. -How far did users progress before failing/exiting the level? +For example, a performance metric could points earned, race time, total kills, +etc. This is entirely up to you and will help us understand how well the player +performed, or how far the player progressed  in the level before exiting. How +far did users progress before failing/exiting the level? */ -int CTelemetryManager::GetLevelExitProgressStat1() -{ - // 4J Stu - Unused - return 0; +int CTelemetryManager::GetLevelExitProgressStat1() { + // 4J Stu - Unused + return 0; } /* Refers to the highest level performance metric for your game. -For example, a performance metric could points earned, race time, total kills, etc. -This is entirely up to you and will help us understand how well the player performed, or how far the player progressed  in the level before exiting. -How far did users progress before failing/exiting the level? +For example, a performance metric could points earned, race time, total kills, +etc. This is entirely up to you and will help us understand how well the player +performed, or how far the player progressed  in the level before exiting. How +far did users progress before failing/exiting the level? */ -int CTelemetryManager::GetLevelExitProgressStat2() -{ - // 4J Stu - Unused - return 0; +int CTelemetryManager::GetLevelExitProgressStat2() { + // 4J Stu - Unused + return 0; } diff --git a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h index bcb55f413..8803034c1 100644 --- a/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h +++ b/Minecraft.Client/Platform/Common/Telemetry/TelemetryManager.h @@ -10,64 +10,88 @@ #endif #include "../UI/UIEnums.h" -class CTelemetryManager -{ +class CTelemetryManager { public: - virtual int32_t Init(); - virtual int32_t Tick(); - virtual int32_t Flush(); + virtual int32_t Init(); + virtual int32_t Tick(); + virtual int32_t Flush(); - virtual bool RecordPlayerSessionStart(int iPad); - virtual bool RecordPlayerSessionExit(int iPad, int exitStatus); - virtual bool RecordHeartBeat(int iPad); - virtual bool RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers); - virtual bool RecordLevelExit(int iPad, ESen_LevelExitStatus levelExitStatus); - virtual bool RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID, int saveSizeInBytes); - virtual bool RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, int numberOfLocalPlayers, int numberOfOnlinePlayers, int saveOrCheckPointID); - virtual bool RecordPauseOrInactive(int iPad); - virtual bool RecordUnpauseOrActive(int iPad); - virtual bool RecordMenuShown(int iPad, EUIScene menuID, int optionalMenuSubID); - virtual bool RecordAchievementUnlocked(int iPad, int achievementID, int achievementGamerscore); - virtual bool RecordMediaShareUpload(int iPad, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType); - virtual bool RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID); - virtual bool RecordUpsellResponded(int iPad, ESen_UpsellID upsellId, int marketplaceOfferID, ESen_UpsellOutcome upsellOutcome); - virtual bool RecordPlayerDiedOrFailed(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID); - virtual bool RecordEnemyKilledOrOvercome(int iPad, int lowResMapX, int lowResMapY, int lowResMapZ, int mapID, int playerWeaponID, int enemyWeaponID, ETelemetryChallenges enemyTypeID); - virtual bool RecordTexturePackLoaded(int iPad, int texturePackId, bool purchased); + virtual bool RecordPlayerSessionStart(int iPad); + virtual bool RecordPlayerSessionExit(int iPad, int exitStatus); + virtual bool RecordHeartBeat(int iPad); + virtual bool RecordLevelStart(int iPad, ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, + int difficulty, int numberOfLocalPlayers, + int numberOfOnlinePlayers); + virtual bool RecordLevelExit(int iPad, + ESen_LevelExitStatus levelExitStatus); + virtual bool RecordLevelSaveOrCheckpoint(int iPad, int saveOrCheckPointID, + int saveSizeInBytes); + virtual bool RecordLevelResume(int iPad, ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, + int difficulty, int numberOfLocalPlayers, + int numberOfOnlinePlayers, + int saveOrCheckPointID); + virtual bool RecordPauseOrInactive(int iPad); + virtual bool RecordUnpauseOrActive(int iPad); + virtual bool RecordMenuShown(int iPad, EUIScene menuID, + int optionalMenuSubID); + virtual bool RecordAchievementUnlocked(int iPad, int achievementID, + int achievementGamerscore); + virtual bool RecordMediaShareUpload(int iPad, + ESen_MediaDestination mediaDestination, + ESen_MediaType mediaType); + virtual bool RecordUpsellPresented(int iPad, ESen_UpsellID upsellId, + int marketplaceOfferID); + virtual bool RecordUpsellResponded(int iPad, ESen_UpsellID upsellId, + int marketplaceOfferID, + ESen_UpsellOutcome upsellOutcome); + virtual bool RecordPlayerDiedOrFailed(int iPad, int lowResMapX, + int lowResMapY, int lowResMapZ, + int mapID, int playerWeaponID, + int enemyWeaponID, + ETelemetryChallenges enemyTypeID); + virtual bool RecordEnemyKilledOrOvercome(int iPad, int lowResMapX, + int lowResMapY, int lowResMapZ, + int mapID, int playerWeaponID, + int enemyWeaponID, + ETelemetryChallenges enemyTypeID); + virtual bool RecordTexturePackLoaded(int iPad, int texturePackId, + bool purchased); - virtual bool RecordSkinChanged(int iPad, int dwSkinId); - virtual bool RecordBanLevel(int iPad); - virtual bool RecordUnBanLevel(int iPad); + virtual bool RecordSkinChanged(int iPad, int dwSkinId); + virtual bool RecordBanLevel(int iPad); + virtual bool RecordUnBanLevel(int iPad); - virtual int GetMultiplayerInstanceID(); - virtual int GenerateMultiplayerInstanceId(); - virtual void SetMultiplayerInstanceId(int value); + virtual int GetMultiplayerInstanceID(); + virtual int GenerateMultiplayerInstanceId(); + virtual void SetMultiplayerInstanceId(int value); protected: - float m_initialiseTime; - float m_lastHeartbeat; - bool m_bFirstFlush; + float m_initialiseTime; + float m_lastHeartbeat; + bool m_bFirstFlush; - float m_fLevelStartTime[XUSER_MAX_COUNT]; + float m_fLevelStartTime[XUSER_MAX_COUNT]; - int m_multiplayerInstanceID; - int m_levelInstanceID; + int m_multiplayerInstanceID; + int m_levelInstanceID; - // Helper functions to get the various common settings - int GetSecondsSinceInitialize(); - int GetMode(int userId); - int GetSubMode(int userId); - int GetLevelId(int userId); - int GetSubLevelId(int userId); - int GetTitleBuildId(); - int GetLevelInstanceID(); - int GetSingleOrMultiplayer(); - int GetDifficultyLevel(int diff); - int GetLicense(); - int GetDefaultGameControls(); - int GetAudioSettings(int userId); - int GetLevelExitProgressStat1(); - int GetLevelExitProgressStat2(); + // Helper functions to get the various common settings + int GetSecondsSinceInitialize(); + int GetMode(int userId); + int GetSubMode(int userId); + int GetLevelId(int userId); + int GetSubLevelId(int userId); + int GetTitleBuildId(); + int GetLevelInstanceID(); + int GetSingleOrMultiplayer(); + int GetDifficultyLevel(int diff); + int GetLicense(); + int GetDefaultGameControls(); + int GetAudioSettings(int userId); + int GetLevelExitProgressStat1(); + int GetLevelExitProgressStat2(); }; -extern CTelemetryManager *TelemetryManager; +extern CTelemetryManager* TelemetryManager; diff --git a/Minecraft.Client/Platform/Common/Trial/TrialMode.cpp b/Minecraft.Client/Platform/Common/Trial/TrialMode.cpp index 5b075bcbb..fa0b37847 100644 --- a/Minecraft.Client/Platform/Common/Trial/TrialMode.cpp +++ b/Minecraft.Client/Platform/Common/Trial/TrialMode.cpp @@ -2,8 +2,8 @@ #include "TrialMode.h" #include "../Tutorial/FullTutorial.h" -TrialMode::TrialMode(int iPad, Minecraft *minecraft, ClientConnection *connection) - : FullTutorialMode(iPad, minecraft, connection) -{ - tutorial = new FullTutorial(iPad, true); +TrialMode::TrialMode(int iPad, Minecraft* minecraft, + ClientConnection* connection) + : FullTutorialMode(iPad, minecraft, connection) { + tutorial = new FullTutorial(iPad, true); } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Trial/TrialMode.h b/Minecraft.Client/Platform/Common/Trial/TrialMode.h index 2feed67b4..78120e485 100644 --- a/Minecraft.Client/Platform/Common/Trial/TrialMode.h +++ b/Minecraft.Client/Platform/Common/Trial/TrialMode.h @@ -1,10 +1,9 @@ #pragma once #include "../Tutorial/FullTutorialMode.h" -class TrialMode : public FullTutorialMode -{ -public: - TrialMode(int iPad, Minecraft *minecraft, ClientConnection *connection); +class TrialMode : public FullTutorialMode { +public: + TrialMode(int iPad, Minecraft* minecraft, ClientConnection* connection); - virtual bool isImplemented() { return true; } + virtual bool isImplemented() { return true; } }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp index 440bfa90c..14ed6b0a6 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp @@ -21,8 +21,7 @@ bool AreaTask::isCompleted() { switch (m_completionState) { case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: { bool allSatisfied = true; - for (auto it = constraints.begin(); it != constraints.end(); - ++it) { + for (auto it = constraints.begin(); it != constraints.end(); ++it) { TutorialConstraint* constraint = *it; if (!constraint->isConstraintSatisfied(tutorial->getPad())) { allSatisfied = false; diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp index 7a2bd4eb2..985be9647 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ChoiceTask.cpp @@ -14,7 +14,8 @@ ChoiceTask::ChoiceTask( int iCancelMapping /*= 0*/, eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) { + : TutorialTask(tutorial, descriptionId, false, nullptr, true, false, + false) { if (requiresUserInput == true) { constraints.push_back(new InputConstraint(iConfirmMapping)); constraints.push_back(new InputConstraint(iCancelMapping)); diff --git a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h index 2fd63e751..7851db37c 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/ControllerTask.h @@ -23,7 +23,8 @@ public: ControllerTask(Tutorial* tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, int mappings[], unsigned int mappingsLength, - int iCompletionMaskA[] = nullptr, int iCompletionMaskACount = 0, + int iCompletionMaskA[] = nullptr, + int iCompletionMaskACount = 0, int iSouthpawMappings[] = nullptr, unsigned int uiSouthpawMappingsCount = 0); ~ControllerTask(); diff --git a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp index d3bc59fc7..5d8532e0f 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/CraftTask.cpp @@ -2,11 +2,12 @@ #include "CraftTask.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" -CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial, - int descriptionId, bool enablePreCompletion /*= true*/, - std::vector* inConstraints /*= nullptr*/, - bool bShowMinimumTime /*=false*/, - bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/) +CraftTask::CraftTask( + int itemId, int auxValue, int quantity, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion /*= true*/, + std::vector* inConstraints /*= nullptr*/, + bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, + bool m_bTaskReminders /*=true*/) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders), m_quantity(quantity), @@ -18,12 +19,12 @@ CraftTask::CraftTask(int itemId, int auxValue, int quantity, Tutorial* tutorial, m_auxValues[0] = auxValue; } -CraftTask::CraftTask(int* items, int* auxValues, int numItems, int quantity, - Tutorial* tutorial, int descriptionId, - bool enablePreCompletion /*= true*/, - std::vector* inConstraints /*= nullptr*/, - bool bShowMinimumTime /*=false*/, - bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/) +CraftTask::CraftTask( + int* items, int* auxValues, int numItems, int quantity, Tutorial* tutorial, + int descriptionId, bool enablePreCompletion /*= true*/, + std::vector* inConstraints /*= nullptr*/, + bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, + bool m_bTaskReminders /*=true*/) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders), m_quantity(quantity), diff --git a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp index af7f0da78..3d7b9c3bc 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp @@ -12,7 +12,8 @@ InfoTask::InfoTask( Tutorial* tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask(tutorial, descriptionId, false, nullptr, true, false, false) { + : TutorialTask(tutorial, descriptionId, false, nullptr, true, false, + false) { if (requiresUserInput == true) { constraints.push_back(new InputConstraint(iMapping)); } @@ -45,8 +46,8 @@ bool InfoTask::isCompleted() { // If a menu is displayed, then we use the handleUIInput to complete the // task bAllComplete = true; - for (auto it = completedMappings.begin(); - it != completedMappings.end(); ++it) { + for (auto it = completedMappings.begin(); it != completedMappings.end(); + ++it) { bool current = (*it).second; if (!current) { bAllComplete = false; @@ -56,8 +57,8 @@ bool InfoTask::isCompleted() { } else { int iCurrent = 0; - for (auto it = completedMappings.begin(); - it != completedMappings.end(); ++it) { + for (auto it = completedMappings.begin(); it != completedMappings.end(); + ++it) { bool current = (*it).second; if (!current) { if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), @@ -94,8 +95,8 @@ void InfoTask::setAsCurrentTask(bool active /*= true*/) { void InfoTask::handleUIInput(int iAction) { if (bHasBeenActivated) { - for (auto it = completedMappings.begin(); - it != completedMappings.end(); ++it) { + for (auto it = completedMappings.begin(); it != completedMappings.end(); + ++it) { if (iAction == (*it).first) { (*it).second = true; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp index cdc40871d..0f90c261b 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp @@ -2,8 +2,7 @@ #include "ProcedureCompoundTask.h" ProcedureCompoundTask::~ProcedureCompoundTask() { - for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); - ++it) { + for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) { delete (*it); } } diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp index a383972f3..7ac952962 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp @@ -1683,8 +1683,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, - IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr, - false, false, false)); + IDS_TUTORIAL_TASK_HORSE_RIDE, true, + nullptr, false, false, false)); else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, @@ -1929,8 +1929,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { } Tutorial::~Tutorial() { - for (auto it = m_globalConstraints.begin(); - it != m_globalConstraints.end(); ++it) { + for (auto it = m_globalConstraints.begin(); it != m_globalConstraints.end(); + ++it) { delete (*it); } for (std::unordered_map::iterator it = @@ -1968,8 +1968,8 @@ void Tutorial::setCompleted(int completableId) { // } int completableIndex = -1; - for (auto it = s_completableTasks.begin(); - it < s_completableTasks.end(); ++it) { + for (auto it = s_completableTasks.begin(); it < s_completableTasks.end(); + ++it) { ++completableIndex; if (*it == completableId) { break; @@ -1996,8 +1996,8 @@ bool Tutorial::getCompleted(int completableId) { // } int completableIndex = -1; - for (auto it = s_completableTasks.begin(); - it < s_completableTasks.end(); ++it) { + for (auto it = s_completableTasks.begin(); it < s_completableTasks.end(); + ++it) { ++completableIndex; if (*it == completableId) { break; @@ -2152,8 +2152,8 @@ void Tutorial::tick() { } // Check constraints - for (auto it = m_globalConstraints.begin(); - it < m_globalConstraints.end(); ++it) { + for (auto it = m_globalConstraints.begin(); it < m_globalConstraints.end(); + ++it) { TutorialConstraint* constraint = *it; constraint->tick(m_iPad); } @@ -2234,8 +2234,7 @@ void Tutorial::tick() { // gameplay state so that they are in effect for // a bit longer auto itCon = - constraintsToRemove[m_CurrentState] - .begin(); + constraintsToRemove[m_CurrentState].begin(); while ( itCon != constraintsToRemove[m_CurrentState].end()) { @@ -2259,8 +2258,7 @@ void Tutorial::tick() { } // Fall through the the normal complete state case e_Tutorial_Completion_Complete_State: - for (auto - itRem = + for (auto itRem = activeTasks[m_CurrentState].begin(); itRem < activeTasks[m_CurrentState].end(); ++itRem) { @@ -2273,8 +2271,7 @@ void Tutorial::tick() { activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1); activeTasks[m_CurrentState].pop_back(); - for (auto - itRem = + for (auto itRem = activeTasks[m_CurrentState].begin(); itRem < activeTasks[m_CurrentState].end(); ++itRem) { @@ -2773,8 +2770,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); } @@ -2898,7 +2895,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint* c, } auto it = find(constraints[m_CurrentState].begin(), - constraints[m_CurrentState].end(), c); + constraints[m_CurrentState].end(), c); if (it != constraints[m_CurrentState].end()) constraints[m_CurrentState].erase( find(constraints[m_CurrentState].begin(), @@ -2934,8 +2931,7 @@ void Tutorial::addMessage( } void Tutorial::changeTutorialState(eTutorial_State newState, - UIScene* scene /*= nullptr*/) -{ + UIScene* scene /*= nullptr*/) { if (newState == m_CurrentState) { // If clearing the scene, make sure that the tutorial popup has its // reference to this scene removed diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h index a7bb5177c..17cdac680 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.h @@ -135,7 +135,8 @@ public: void setCompleted(int completableId); bool getCompleted(int completableId); - void changeTutorialState(eTutorial_State newState, UIScene* scene = nullptr); + void changeTutorialState(eTutorial_State newState, + UIScene* scene = nullptr); bool isSelectedItemState(); bool setMessage(PopupMessageDetails* message); diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h index 6ddad5d79..be3c0bd7e 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialMode.h @@ -22,7 +22,8 @@ public: 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); + bool bTestUseOnly = false, + bool* pbUsedItem = nullptr); virtual void attack(std::shared_ptr player, std::shared_ptr entity); diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h index 7d7c1b6ae..4eabc3d44 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.h @@ -13,11 +13,11 @@ class MobEffect; // enablePreCompletion - If this is true, then the player can complete this // task out of sequence. // This stops us asking them to do -//things they have already done +// things they have already done // constraints - A list of constraints which can be activated // (as a whole). // If they are active, then the -//constraints are removed when the task is completed +// constraints are removed when the task is completed // areConstraintsEnabled- A flag which records whether or not we have added the // constraints to the tutorial class TutorialTask { diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp index 3fd825ec2..eef48ca56 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -9,7 +9,6 @@ #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.Client/Minecraft.h" - IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { m_menu = nullptr; m_autoDeleteMenu = false; @@ -68,12 +67,11 @@ void IUIScene_AbstractContainerMenu::Initialize( m_iCurrSlotX = 0; m_iCurrSlotY = 0; #endif - // - // for(int i=0;i= 0.01f) || (fabs(fInputY) >= 0.01f)) { - fInputDirX = (fInputX > 0.0f) ? 1.0f - : (fInputX < 0.0f) ? -1.0f - : 0.0f; - fInputDirY = (fInputY > 0.0f) ? 1.0f - : (fInputY < 0.0f) ? -1.0f - : 0.0f; + // If there is any input on sticks, move the pointer. + if ((fabs(fInputX) >= 0.01f) || (fabs(fInputY) >= 0.01f)) { + fInputDirX = (fInputX > 0.0f) ? 1.0f : (fInputX < 0.0f) ? -1.0f : 0.0f; + fInputDirY = (fInputY > 0.0f) ? 1.0f : (fInputY < 0.0f) ? -1.0f : 0.0f; #if defined(TAP_DETECTION) - // Check for potential tap input to jump slot. - ETapState eNewTapInput = GetTapInputType(fInputX, fInputY); + // Check for potential tap input to jump slot. + ETapState eNewTapInput = GetTapInputType(fInputX, fInputY); - switch (m_eCurrTapState) { - case eTapStateNoInput: - m_eCurrTapState = eNewTapInput; - break; + switch (m_eCurrTapState) { + case eTapStateNoInput: + m_eCurrTapState = eNewTapInput; + break; - case eTapStateUp: - case eTapStateDown: - case eTapStateLeft: - case eTapStateRight: - if ((eNewTapInput != m_eCurrTapState) && - (eNewTapInput != eTapStateNoInput)) { - // Input is no longer suitable for tap. - m_eCurrTapState = eTapNone; - } - break; + case eTapStateUp: + case eTapStateDown: + case eTapStateLeft: + case eTapStateRight: + if ((eNewTapInput != m_eCurrTapState) && + (eNewTapInput != eTapStateNoInput)) { + // Input is no longer suitable for tap. + m_eCurrTapState = eTapNone; + } + break; - case eTapNone: - /// Nothing to do, input is not a tap. - break; - default: - break; - } + case eTapNone: + /// Nothing to do, input is not a tap. + break; + default: + break; + } #endif - // Square it so we get more precision for small inputs. - fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR; - fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR; - // fInputX = fInputX * POINTER_SPEED_FACTOR; - // fInputY = fInputY * POINTER_SPEED_FACTOR; - float fInputScale = 1.0f; + // Square it so we get more precision for small inputs. + fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR; + fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR; + // fInputX = fInputX * POINTER_SPEED_FACTOR; + // fInputY = fInputY * POINTER_SPEED_FACTOR; + float fInputScale = 1.0f; - // Ramp up input from zero when new input is recieved over - // INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping - // stick to move 1 box. - if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING) { - ++m_iConsectiveInputTicks; - fInputScale = ((float)(m_iConsectiveInputTicks) / - (float)(MAX_INPUT_TICKS_FOR_SCALING)); - } + // Ramp up input from zero when new input is recieved over + // INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping + // stick to move 1 box. + if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING) { + ++m_iConsectiveInputTicks; + fInputScale = ((float)(m_iConsectiveInputTicks) / + (float)(MAX_INPUT_TICKS_FOR_SCALING)); + } #if defined(TAP_DETECTION) - else if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING) { - ++m_iConsectiveInputTicks; - } else { - m_eCurrTapState = eTapNone; - } + else if (m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING) { + ++m_iConsectiveInputTicks; + } else { + m_eCurrTapState = eTapNone; + } #endif - // 4J Stu - The cursor moves too fast in SD mode - // The SD/splitscreen scenes are approximately 0.6 times the size of - // the fullscreen on - if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) - fInputScale *= 0.6f; + // 4J Stu - The cursor moves too fast in SD mode + // The SD/splitscreen scenes are approximately 0.6 times the size of + // the fullscreen on + if (!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) + fInputScale *= 0.6f; - fInputX *= fInputScale; - fInputY *= fInputScale; + fInputX *= fInputScale; + fInputY *= fInputScale; #if defined(USE_POINTER_ACCEL) - m_fPointerAccelX += fInputX / 50.0f; - m_fPointerAccelY += fInputY / 50.0f; + m_fPointerAccelX += fInputX / 50.0f; + m_fPointerAccelY += fInputY / 50.0f; - if (fabsf(fInputX) > fabsf(m_fPointerVelX + m_fPointerAccelX)) { - m_fPointerVelX += m_fPointerAccelX; - } else { - m_fPointerAccelX = fInputX - m_fPointerVelX; - m_fPointerVelX = fInputX; - } + if (fabsf(fInputX) > fabsf(m_fPointerVelX + m_fPointerAccelX)) { + m_fPointerVelX += m_fPointerAccelX; + } else { + m_fPointerAccelX = fInputX - m_fPointerVelX; + m_fPointerVelX = fInputX; + } - if (fabsf(fInputY) > fabsf(m_fPointerVelY + m_fPointerAccelY)) { - m_fPointerVelY += m_fPointerAccelY; - } else { - m_fPointerAccelY = fInputY - m_fPointerVelY; - m_fPointerVelY = fInputY; - } - // printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, - // m_fPointerAccelY ); + if (fabsf(fInputY) > fabsf(m_fPointerVelY + m_fPointerAccelY)) { + m_fPointerVelY += m_fPointerAccelY; + } else { + m_fPointerAccelY = fInputY - m_fPointerVelY; + m_fPointerVelY = fInputY; + } + // printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, + // m_fPointerAccelY ); - vPointerPos.x += m_fPointerVelX; - vPointerPos.y -= m_fPointerVelY; + vPointerPos.x += m_fPointerVelX; + vPointerPos.y -= m_fPointerVelY; #else // Add input to pointer position. vPointerPos.x += fInputX; vPointerPos.y -= fInputY; #endif - // Clamp to pointer extents. - if (vPointerPos.x < m_fPointerMinX) - vPointerPos.x = m_fPointerMinX; - else if (vPointerPos.x > m_fPointerMaxX) - vPointerPos.x = m_fPointerMaxX; - if (vPointerPos.y < m_fPointerMinY) - vPointerPos.y = m_fPointerMinY; - else if (vPointerPos.y > m_fPointerMaxY) - vPointerPos.y = m_fPointerMaxY; + // Clamp to pointer extents. + if (vPointerPos.x < m_fPointerMinX) + vPointerPos.x = m_fPointerMinX; + else if (vPointerPos.x > m_fPointerMaxX) + vPointerPos.x = m_fPointerMaxX; + if (vPointerPos.y < m_fPointerMinY) + vPointerPos.y = m_fPointerMinY; + else if (vPointerPos.y > m_fPointerMaxY) + vPointerPos.y = m_fPointerMaxY; - bStickInput = true; - } else { - m_iConsectiveInputTicks = 0; + bStickInput = true; + } else { + m_iConsectiveInputTicks = 0; #if defined(USE_POINTER_ACCEL) - m_fPointerVelX = 0.0f; - m_fPointerVelY = 0.0f; - m_fPointerAccelX = 0.0f; - m_fPointerAccelY = 0.0f; + m_fPointerVelX = 0.0f; + m_fPointerVelY = 0.0f; + m_fPointerAccelX = 0.0f; + m_fPointerAccelY = 0.0f; #endif - } - + } // Determine which slot the pointer is currently over. ESceneSection eSectionUnderPointer = eSectionNone; @@ -480,8 +472,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { m_iCurrSlotX = iNewSlotX; m_iCurrSlotY = iNewSlotY; #endif - // No need to check any further slots, the pointer can only ever be over - // one. + // No need to check any further slots, the pointer can + // only ever be over one. break; } } diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h index 030aa1755..d1191a45b 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_AbstractContainerMenu.h @@ -164,7 +164,6 @@ protected: int m_iCurrSlotX; int m_iCurrSlotY; - // ENum indexes of the first section for this scene, and 1+the last section ESceneSection m_eFirstSection, m_eMaxSection; diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp index 58276e3d9..960d24046 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp @@ -271,7 +271,8 @@ void IUIScene_BeaconMenu::handleTick() { int totalWidth = count * 22 + (count - 1) * 2; for (int c = 0; c < count; c++) { - if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; + if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) + continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); @@ -298,7 +299,8 @@ void IUIScene_BeaconMenu::handleTick() { int totalWidth = count * 22 + (count - 1) * 2; for (int c = 0; c < count - 1; c++) { - if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; + if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) + continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp index 2fde1368c..c34ebf7a1 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp @@ -651,8 +651,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { // if(pTempItemInst->id<256) // { // Tile - // *pTile=Tile::tiles[pTempItemInst->id]; printf("[TILE] ID\t%d\tAux - // val\t%d\tBase type\t%d\tMaterial\t%d\t Count=%d\n",pTempItemInst->id, + // *pTile=Tile::tiles[pTempItemInst->id]; + // printf("[TILE] ID\t%d\tAux val\t%d\tBase type\t%d\tMaterial\t%d\t + // Count=%d\n",pTempItemInst->id, // pTempItemInst->getAuxValue(),pTile->getBaseItemType(),pTile->getMaterial(),pTempItemInst->GetCount()); // } // else diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp index 507ef4cd1..563bfdf27 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp @@ -211,7 +211,6 @@ void IUIScene_CreativeMenu::staticCtor() { ITEM_AUX(Tile::woolCarpet_Id, 13) // Green ITEM_AUX(Tile::woolCarpet_Id, 12) // Brown - #if !defined(_CONTENT_PACKAGE) DEF(eCreativeInventory_ArtToolsDecorations) if (app.DebugSettingsOn()) { @@ -508,7 +507,8 @@ void IUIScene_CreativeMenu::staticCtor() { for (unsigned int i = 0; i < Enchantment::enchantments.length; ++i) { Enchantment* enchantment = Enchantment::enchantments[i]; - if (enchantment == nullptr || enchantment->category == nullptr) continue; + if (enchantment == nullptr || enchantment->category == nullptr) + continue; list->push_back(Item::enchantedBook->createForEnchantment( new EnchantmentInstance(enchantment, enchantment->getMaxLevel()))); } @@ -862,8 +862,8 @@ void IUIScene_CreativeMenu::staticCtor() { ECreative_Inventory_Groups debugMiscGroup[] = { eCreativeInventory_ArtToolsMisc}; specs[eCreativeInventoryTab_Misc] = - new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, nullptr, - 1, debugMiscGroup); + new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, + nullptr, 1, debugMiscGroup); #else ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc}; specs[eCreativeInventoryTab_Misc] = @@ -982,8 +982,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu* menu, // Fill the dynamic group if (m_dynamicGroupsCount > 0 && m_dynamicGroupsA != nullptr) { - for (auto it= - categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); + for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) { diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp index 61109d231..d6efeca88 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp @@ -205,7 +205,8 @@ void IUIScene_HUD::renderPlayerHealth() { std::shared_ptr riding = pMinecraft->localplayers[iPad]->riding; - if (riding == nullptr || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) { + if (riding == nullptr || + riding && !riding->instanceof(eTYPE_LIVINGENTITY)) { SetRidingHorse(false, false, 0); ShowFood(true); diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp index cad535222..6ede8262e 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_PauseMenu.cpp @@ -51,7 +51,6 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned( ->getDLCInfoParentPack(); // tPack->getDLCPack(); if (!pDLCPack->hasPurchasedFile(DLCManager::e_DLCType_Texture, L"")) { - unsigned int uiIDA[2]; uiIDA[0] = IDS_CONFIRM_OK; uiIDA[1] = IDS_CONFIRM_CANCEL; @@ -192,9 +191,6 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned( int IUIScene_PauseMenu::WarningTrialTexturePackReturned( void* pParam, int iPad, C4JStorage::EMessageResult result) { - - - return 0; } @@ -227,7 +223,6 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) { if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType()) app.SetGameStarted(true); - } int32_t hr = S_OK; @@ -443,7 +438,6 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) { app.SetChangingSessionType(false); app.SetReallyChangingSessionType(false); pMinecraft->exitingWorldRightNow = false; - } int IUIScene_PauseMenu::SaveGameDialogReturned( diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp index b59cbbda7..391bc67ae 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_StartGame.cpp @@ -166,7 +166,7 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { // if(imageBytes > 0 && imageData) //{ // registerSubstitutionTexture(L"texturePackIcon", imageData, - //imageBytes); + // imageBytes); // m_bitmapTexturePackIcon.setTextureName(L"texturePackIcon"); // } @@ -249,7 +249,6 @@ int IUIScene_StartGame::UnlockTexturePackReturned( if (result == C4JStorage::EMessage_ResultAccept) { if (ProfileManager.IsSignedIn(iPad)) { - // the license change coming in when the offer has been installed // will cause this scene to refresh } diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp index d9b891408..7ed495e3d 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp @@ -180,8 +180,8 @@ void IUIScene_TradingMenu::updateDisplay() { m_activeOffers.clear(); int unfilteredIndex = 0; int firstValidTrade = INT_MAX; - for (auto it = unfilteredOffers->begin(); - it != unfilteredOffers->end(); ++it) { + for (auto it = unfilteredOffers->begin(); it != unfilteredOffers->end(); + ++it) { MerchantRecipe* recipe = *it; if (!recipe->isDeprecated()) { m_activeOffers.push_back( diff --git a/Minecraft.Client/Platform/Common/UI/UI.h b/Minecraft.Client/Platform/Common/UI/UI.h index 528c9342d..80adb1f43 100644 --- a/Minecraft.Client/Platform/Common/UI/UI.h +++ b/Minecraft.Client/Platform/Common/UI/UI.h @@ -38,7 +38,6 @@ #include "UIControl_SpaceIndicatorBar.h" #include "UIControl_BeaconEffectButton.h" - #include "UIScene_HUD.h" #include "UIComponent_Panorama.h" #include "UIComponent_Logo.h" diff --git a/Minecraft.Client/Platform/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Platform/Common/UI/UIBitmapFont.cpp index 056408e94..f6c0d0603 100644 --- a/Minecraft.Client/Platform/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIBitmapFont.cpp @@ -240,8 +240,8 @@ rrbool UIBitmapFont::CanProvideBitmap(S32 glyph, F32 pixel_scale) { // Parameters // glyph The glyph to compute/get the bitmap for // pixel_scale The scale factor (pseudo point size) requested by the -//textfield,adjusted for display resolution bitmap The structure to store the -//bitmap into +// textfield,adjusted for display resolution bitmap The structure to store +// the bitmap into rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitmapCharacter* bitmap) { // Description @@ -326,8 +326,9 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, #endif // app.DebugPrintf("Request glyph_%d (U+%.4X) at %f, converted to %f - // (%f)\n", glyph, GetUnicode(glyph), pixel_scale, targetPixelScale, - //glyphScale); + // (%f)\n", glyph, GetUnicode(glyph), + // pixel_scale, targetPixelScale, + // glyphScale); // It is not necessary to shrink the glyph width here // as its already been done in 'GetGlyphMetrics' by: diff --git a/Minecraft.Client/Platform/Common/UI/UIBitmapFont.h b/Minecraft.Client/Platform/Common/UI/UIBitmapFont.h index bdef9cfee..ce6ef481b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIBitmapFont.h +++ b/Minecraft.Client/Platform/Common/UI/UIBitmapFont.h @@ -7,8 +7,12 @@ class CFontData; // const int BITMAP_FONT_LANGUAGES = XC_LANGUAGE_ENGLISH // | -// XC_LANGUAGE_GERMAN | XC_LANGUAGE_FRENCH | XC_LANGUAGE_SPANISH | -// XC_LANGUAGE_ITALIAN | XC_LANGUAGE_PORTUGUESE | XC_LANGUAGE_BRAZILIAN; +// XC_LANGUAGE_GERMAN +// | XC_LANGUAGE_FRENCH +// | XC_LANGUAGE_SPANISH +// | XC_LANGUAGE_ITALIAN +// | XC_LANGUAGE_PORTUGUESE +// | XC_LANGUAGE_BRAZILIAN; // using namespace std; diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.cpp index 356f2b9a3..c12ff2083 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.cpp @@ -12,8 +12,6 @@ UIComponent_Tooltips::UIComponent_Tooltips(int iPad, void* initData, } // Setup all the Iggy references we need for this scene initialiseMovie(); - - } std::wstring UIComponent_Tooltips::getMoviePath() { @@ -311,14 +309,11 @@ void UIComponent_Tooltips::_Relayout() { IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcUpdateLayout, 0, nullptr); - } - void UIComponent_Tooltips::handleReload() { app.DebugPrintf("UIComponent_Tooltips::handleReload\n"); - for (unsigned int i = 0; i < eToolTipNumButtons; ++i) { _SetTooltip(i, m_tooltipValues[i].iString, m_tooltipValues[i].show, true); diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.h b/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.h index d8b134ac1..c98e847a4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.h +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_Tooltips.h @@ -24,7 +24,6 @@ protected: IggyName m_funcSetTooltip, m_funcSetOpacity, m_funcSetABSwap, m_funcUpdateLayout; - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_NAME(m_funcSetTooltip, L"SetToolTip") UI_MAP_NAME(m_funcSetOpacity, L"SetOpacity") @@ -81,5 +80,4 @@ private: void _Relayout(); bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU]; - }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp index 6ba5e9c97..caae72b52 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.cpp @@ -335,7 +335,8 @@ std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, m_iconItem = nullptr; } } - if (!isFixedIcon && m_iconItem != nullptr) setupIconHolder(e_ICON_TYPE_IGGY); + if (!isFixedIcon && m_iconItem != nullptr) + setupIconHolder(e_ICON_TYPE_IGGY); m_controlIconHolder.setVisible(isFixedIcon || m_iconItem != nullptr); return temp; diff --git a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h index be4d6a970..a1fec6513 100644 --- a/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h +++ b/Minecraft.Client/Platform/Common/UI/UIComponent_TutorialPopup.h @@ -98,7 +98,8 @@ private: void _SetDescription(UIScene* interactScene, const std::wstring& desc, const std::wstring& title, bool allowFade, bool isReminder); - std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, const wchar_t* desc); + std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, + const wchar_t* desc); std::wstring _SetImage(std::wstring& desc); std::wstring ParseDescription(int iPad, std::wstring& text); void UpdateInteractScenePosition(bool visible); diff --git a/Minecraft.Client/Platform/Common/UI/UIControl.cpp b/Minecraft.Client/Platform/Common/UI/UIControl.cpp index e45d57bcd..efe5988ef 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl.cpp @@ -64,7 +64,6 @@ bool UIControl::setupControl(UIScene* scene, IggyValuePath* parent, return res; } - void UIControl::ReInit() { if (!m_isValid) return; @@ -86,7 +85,8 @@ void UIControl::ReInit() { m_funcSetAlpha, 2, value); } - IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible, nullptr, m_isVisible); + IggyValueSetBooleanRS(getIggyValuePath(), m_nameVisible, nullptr, + m_isVisible); } IggyValuePath* UIControl::getIggyValuePath() { return &m_iggyPath; } diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_Button.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_Button.cpp index 0ea1ad14d..10799e520 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_Button.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_Button.cpp @@ -35,7 +35,6 @@ void UIControl_Button::init(UIString label, int id) { IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 2, value); - } void UIControl_Button::ReInit() { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.cpp index 889cd8413..d4f9b2def 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.cpp @@ -34,7 +34,6 @@ void UIControl_ButtonList::init(int id) { IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 1, value); - } void UIControl_ButtonList::ReInit() { @@ -151,7 +150,6 @@ void UIControl_ButtonList::setButtonLabel(int iButtonId, m_funcSetButtonLabel, 2, value); } - void UIControl_DynamicButtonList::tick() { UIControl_ButtonList::tick(); diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.h b/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.h index 9372eba33..f6666cb82 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.h +++ b/Minecraft.Client/Platform/Common/UI/UIControl_ButtonList.h @@ -38,7 +38,6 @@ public: void updateChildFocus(int iChild); void setButtonLabel(int iButtonId, const std::wstring& label); - }; class UIControl_DynamicButtonList : public UIControl_ButtonList { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_CheckBox.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_CheckBox.cpp index 8f15cbbb6..518da6b89 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_CheckBox.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_CheckBox.cpp @@ -43,7 +43,6 @@ void UIControl_CheckBox::init(UIString label, int id, bool checked) { IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 3, value); - } bool UIControl_CheckBox::IsChecked() { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_DynamicLabel.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_DynamicLabel.cpp index d65bd9c48..7b8d6605f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_DynamicLabel.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_DynamicLabel.cpp @@ -41,8 +41,7 @@ void UIControl_DynamicLabel::addText(const std::wstring& text, void UIControl_DynamicLabel::ReInit() { UIControl_Base::ReInit(); } -void UIControl_DynamicLabel::SetupTouch() { -} +void UIControl_DynamicLabel::SetupTouch() {} void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive) { IggyDataValue result; @@ -60,9 +59,9 @@ void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive) { S32 UIControl_DynamicLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = - IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, - getIggyValuePath(), m_funcGetRealWidth, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, + getIggyValuePath(), + m_funcGetRealWidth, 0, nullptr); S32 iRealWidth = m_width; if (result.type == IGGY_DATATYPE_number) { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_HTMLLabel.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_HTMLLabel.cpp index 8be9c4c49..b9ca898f8 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_HTMLLabel.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_HTMLLabel.cpp @@ -47,8 +47,7 @@ void UIControl_HTMLLabel::setLabel(const std::string& label) { getIggyValuePath(), m_setLabelFunc, 1, value); } -void UIControl_HTMLLabel::SetupTouch() { -} +void UIControl_HTMLLabel::SetupTouch() {} void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive) { IggyDataValue result; @@ -66,9 +65,9 @@ void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive) { S32 UIControl_HTMLLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = - IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, - getIggyValuePath(), m_funcGetRealWidth, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, + getIggyValuePath(), + m_funcGetRealWidth, 0, nullptr); S32 iRealWidth = m_width; if (result.type == IGGY_DATATYPE_number) { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_Label.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_Label.cpp index 314abacdc..11079d42a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_Label.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_Label.cpp @@ -18,8 +18,7 @@ bool UIControl_Label::setupControl(UIScene* scene, IggyValuePath* parent, void UIControl_Label::init(UIString label) { m_label = label; - const std::u16string convLabel = - wstring_to_u16string(label.getString()); + const std::u16string convLabel = wstring_to_u16string(label.getString()); IggyDataValue result; IggyDataValue value[1]; diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.cpp index 273d72452..daa8233dc 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.cpp @@ -86,7 +86,6 @@ void UIControl_LeaderboardList::initLeaderboard(int iFirstFocus, IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcInitLeaderboard, 3, value); - } void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) { @@ -215,4 +214,3 @@ void UIControl_LeaderboardList::addDataSet( IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddDataSet, 12, value); } - diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.h b/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.h index 3b9444c5e..b7e4483ef 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.h +++ b/Minecraft.Client/Platform/Common/UI/UIControl_LeaderboardList.h @@ -7,6 +7,7 @@ private: IggyName m_funcInitLeaderboard, m_funcAddDataSet; IggyName m_funcResetLeaderboard; IggyName m_funcSetupTitles, m_funcSetColumnIcon; + public: enum ELeaderboardIcons { e_ICON_TYPE_IGGY = 0, @@ -43,5 +44,4 @@ public: const std::wstring& col2, const std::wstring& col3, const std::wstring& col4, const std::wstring& col5, const std::wstring& col6); - }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_Slider.cpp index b584ca53b..ca8e9d5ed 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_Slider.cpp @@ -54,7 +54,6 @@ void UIControl_Slider::init(UIString label, int id, int min, int max, IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 5, value); - } void UIControl_Slider::handleSliderMove(int newValue) { @@ -80,9 +79,9 @@ void UIControl_Slider::SetSliderTouchPos(float fTouchPos) { S32 UIControl_Slider::GetRealWidth() { IggyDataValue result; - IggyResult out = - IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, - getIggyValuePath(), m_funcGetRealWidth, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, + getIggyValuePath(), + m_funcGetRealWidth, 0, nullptr); S32 iRealWidth = m_width; if (result.type == IGGY_DATATYPE_number) { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_SpaceIndicatorBar.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_SpaceIndicatorBar.cpp index e643f7112..d5c269f72 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_SpaceIndicatorBar.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_SpaceIndicatorBar.cpp @@ -32,7 +32,7 @@ void UIControl_SpaceIndicatorBar::init(UIString label, int id, int64_t min, m_max = max; const std::u16string convLabel = wstring_to_u16string(label.getString()); - + IggyDataValue result; IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_string_UTF16; diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_TextInput.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_TextInput.cpp index f047f96ed..04aa07fd2 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_TextInput.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_TextInput.cpp @@ -38,7 +38,6 @@ void UIControl_TextInput::init(UIString label, int id) { IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 2, value); - } void UIControl_TextInput::ReInit() { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_TexturePackList.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_TexturePackList.cpp index 1d1d5e7fb..a6ae9d3d0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_TexturePackList.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_TexturePackList.cpp @@ -42,7 +42,6 @@ void UIControl_TexturePackList::init(const std::wstring& label, int id) { IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 2, value); - } void UIControl_TexturePackList::addPack(int id, @@ -77,9 +76,9 @@ void UIControl_TexturePackList::selectSlot(int id) { void UIControl_TexturePackList::clearSlots() { IggyDataValue result; - IggyResult out = - IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, - getIggyValuePath(), m_clearSlotsFunc, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, + getIggyValuePath(), + m_clearSlotsFunc, 0, nullptr); } void UIControl_TexturePackList::setEnabled(bool enable) { diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index 5e77f549d..9c7ba786f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -68,7 +68,8 @@ static void RADLINK WarningCallback(void* user_callback_data, Iggy* player, // hooks/controls. We guard the call sites, so drop the residual Iggy // warning noise. if (strstr(message, "LabelGamertag") != nullptr || - strstr(message, "Method SetSafeZone was not a function") != nullptr) { + strstr(message, "Method SetSafeZone was not a function") != + nullptr) { return; } } @@ -371,7 +372,8 @@ void UIController::SetupFont() { if (m_eTargetFont == eFont_Bitmap) { // these may have been set up by a previous language being chosen - if (m_moj7 == nullptr) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); + if (m_moj7 == nullptr) + m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); if (m_moj11 == nullptr) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11); @@ -452,8 +454,7 @@ void UIController::tick() { // Clear out the cached movie file data int64_t currentTime = System::currentTimeMillis(); - for (auto it = m_cachedMovieData.begin(); - it != m_cachedMovieData.end();) { + for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();) { if (it->second.m_expiry < currentTime) { delete[] it->second.m_ba.data; it = m_cachedMovieData.erase(it); @@ -482,7 +483,6 @@ void UIController::loadSkins() { loadSkin(platformSkinPath, L"platformskin.swf"); } - #if defined(_WINDOWS64) || defined(__linux__) #if defined(_WINDOWS64) @@ -722,9 +722,7 @@ void UIController::handleInput() { for (unsigned int key = 0; key <= ACTION_MAX_MENU; ++key) { handleKeyPress(iPad, key); } - } - } void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { @@ -733,7 +731,6 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) { bool released = false; // Toggle bool repeat = false; - down = InputManager.ButtonDown(iPad, key); pressed = InputManager.ButtonPressed(iPad, key); // Toggle released = InputManager.ButtonReleased(iPad, key); // Toggle @@ -1082,9 +1079,9 @@ UIController::CustomDrawCallback(void* user_callback_data, Iggy* player, // value you can set; the value will be passed along to the corresponding // Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to // your own internal structure here). return - A platform-independent wrapped -// texture handle provided by GDraw, or nullptr (nullptr with throw an ActionScript 3 -// ArgumentError that the Flash developer can catch) Use by calling -// IggySetTextureSubstitutionCallbacks. +// texture handle provided by GDraw, or nullptr (nullptr with throw an +// ActionScript 3 ArgumentError that the Flash developer can catch) Use by +// calling IggySetTextureSubstitutionCallbacks. // // Discussion // @@ -1095,8 +1092,7 @@ GDrawTexture* RADLINK UIController::TextureSubstitutionCreateCallback( void* user_callback_data, IggyUTF16* texture_name, S32* width, S32* height, void** destroy_callback_data) { UIController* uiController = (UIController*)user_callback_data; - auto it = - uiController->m_substitutionTextures.find((wchar_t*)texture_name); + auto it = uiController->m_substitutionTextures.find((wchar_t*)texture_name); if (it != uiController->m_substitutionTextures.end()) { app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", @@ -1588,7 +1584,6 @@ void UIController::SetMenuDisplayed(int iPad, bool bVal) { } else { m_bMenuToBeClosed[iPad] = true; m_iCountDown[iPad] = 10; - } } } @@ -1666,7 +1661,6 @@ void UIController::SetTooltips(unsigned int iPad, int iA, int iB, int iX, if (iX == IDS_TOOLTIPS_SELECTDEVICE) iX = -1; if (iX == IDS_TOOLTIPS_CHANGEDEVICE) iX = -1; - if (app.GetGameStarted()) { // If the game isn't running treat as user 0, otherwise map index // directly from pad @@ -1818,7 +1812,6 @@ void UIController::HandleDLCInstalled(int iPad) { } } - void UIController::HandleTMSDLCFileRetrieved(int iPad) { app.DebugPrintf( app.USER_SR, @@ -2019,7 +2012,8 @@ void UIController::UpdateTrialTimer(unsigned int iPad) { // bring up the pause menu to stop the trial over message box being // called again? if (!ui.GetMenuDisplayed(iPad)) { - ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, + eUILayer_Scene); app.SetAction(iPad, eAppAction_TrialOver); } diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index 3eb04a6d4..a57b40f5c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -283,7 +283,9 @@ protected: void* user_callback_data, void* destroy_callback_data, GDrawTexture* handle); - virtual GDrawTexture* getSubstitutionTexture(int textureId) { return nullptr; } + virtual GDrawTexture* getSubstitutionTexture(int textureId) { + return nullptr; + } virtual void destroySubstitutionTexture(void* destroyCallBackData, GDrawTexture* handle) {} @@ -388,19 +390,20 @@ public: void ClearPressStart(); virtual C4JStorage::EMessageResult RequestAlertMessage( - uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, - uint32_t dwPad = XUSER_INDEX_ANY, + uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, + uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); virtual C4JStorage::EMessageResult RequestErrorMessage( - uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, - uint32_t dwPad = XUSER_INDEX_ANY, + uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, + uint32_t uiOptionC, uint32_t dwPad = XUSER_INDEX_ANY, int (*Func)(void*, int, const C4JStorage::EMessageResult) = nullptr, void* lpParam = nullptr, wchar_t* pwchFormatString = nullptr); private: virtual C4JStorage::EMessageResult RequestMessageBox( - uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, uint32_t uiOptionC, uint32_t dwPad, + uint32_t uiTitle, uint32_t uiText, uint32_t* uiOptionA, + uint32_t uiOptionC, uint32_t dwPad, int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, wchar_t* pwchFormatString, uint32_t dwFocusButton, bool bIsError); diff --git a/Minecraft.Client/Platform/Common/UI/UIEnums.h b/Minecraft.Client/Platform/Common/UI/UIEnums.h index 7ddb081e2..22ee72f8b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIEnums.h +++ b/Minecraft.Client/Platform/Common/UI/UIEnums.h @@ -101,15 +101,14 @@ enum EUIScene { eUIScene_HorseMenu, eUIScene_FireworksMenu, - -// **************************************** -// **************************************** -// ********** IMPORTANT ****************** -// **************************************** -// **************************************** -// When adding new scenes here, you must also update the switches in -// CConsoleMinecraftApp::NavigateToScene There are quite a few so you need to -// check them all Also update UILayer::updateFocusState + // **************************************** + // **************************************** + // ********** IMPORTANT ****************** + // **************************************** + // **************************************** + // When adding new scenes here, you must also update the switches in + // CConsoleMinecraftApp::NavigateToScene There are quite a few so you need + // to check them all Also update UILayer::updateFocusState // Anything non-xbox should be added here. The ordering of scenes above is // required for sentient reporting on xbox 360 to continue to be accurate diff --git a/Minecraft.Client/Platform/Common/UI/UIGroup.cpp b/Minecraft.Client/Platform/Common/UI/UIGroup.cpp index cf9bf1656..03efb921c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIGroup.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIGroup.cpp @@ -141,7 +141,8 @@ bool UIGroup::NavigateBack(int iPad, EUIScene eScene, EUILayer eLayer) { void UIGroup::closeAllScenes() { Minecraft* pMinecraft = Minecraft::GetInstance(); if (m_iPad >= 0) { - if (pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { + if (pMinecraft != nullptr && + pMinecraft->localgameModes[m_iPad] != nullptr) { TutorialMode* gameMode = (TutorialMode*)pMinecraft->localgameModes[m_iPad]; @@ -185,7 +186,6 @@ bool UIGroup::HasFocus(int iPad) { return hasFocus; } - // INPUT void UIGroup::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { @@ -258,7 +258,6 @@ void UIGroup::HandleDLCInstalled() { } } - void UIGroup::HandleMessage(EUIMessage message, void* data) { // Ignore this group if the player isn't signed in if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return; diff --git a/Minecraft.Client/Platform/Common/UI/UIGroup.h b/Minecraft.Client/Platform/Common/UI/UIGroup.h index e0c46fdc5..7057b8d12 100644 --- a/Minecraft.Client/Platform/Common/UI/UIGroup.h +++ b/Minecraft.Client/Platform/Common/UI/UIGroup.h @@ -80,7 +80,6 @@ public: void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled); - // FOCUS bool getFocusState(); diff --git a/Minecraft.Client/Platform/Common/UI/UILayer.cpp b/Minecraft.Client/Platform/Common/UI/UILayer.cpp index 85e03cb12..9be214373 100644 --- a/Minecraft.Client/Platform/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Platform/Common/UI/UILayer.cpp @@ -28,8 +28,8 @@ void UILayer::tick() { // Delete the scenes in our copy if they are ready to delete, otherwise add // back to the ones that are still to be deleted. Actually deleting a scene // might also add something back into m_scenesToDelete. - for (auto it = scenesToDeleteCopy.begin(); - it != scenesToDeleteCopy.end(); it++) { + for (auto it = scenesToDeleteCopy.begin(); it != scenesToDeleteCopy.end(); + it++) { UIScene* scene = (*it); if (scene->isReadyToDelete()) { delete scene; @@ -63,8 +63,7 @@ void UILayer::tick() { void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { if (!ui.IsExpectingOrReloadingSkin()) { - for (auto it = m_components.begin(); it != m_components.end(); - ++it) { + for (auto it = m_components.begin(); it != m_components.end(); ++it) { auto itRef = m_componentRefCount.find((*it)->getSceneType()); if (itRef != m_componentRefCount.end() && itRef->second.second) { if ((*it)->isVisible()) { @@ -459,8 +458,8 @@ UIScene* UILayer::addComponent(int iPad, EUIScene scene, void* initData) { if (it != m_componentRefCount.end()) { ++it->second.first; - for (auto itComp = m_components.begin(); - itComp != m_components.end(); ++itComp) { + for (auto itComp = m_components.begin(); itComp != m_components.end(); + ++itComp) { if ((*itComp)->getSceneType() == scene) { return *itComp; } @@ -547,9 +546,7 @@ void UILayer::removeComponent(EUIScene scene) { } void UILayer::removeScene(UIScene* scene) { - - auto newEnd = - std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene); + auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene); m_sceneStack.erase(newEnd, m_sceneStack.end()); m_scenesToDelete.push_back(scene); @@ -691,7 +688,6 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) { return m_hasFocus; } - void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { // Note: reverse iterator, the last element is the top of the stack @@ -733,7 +729,6 @@ void UILayer::HandleDLCInstalled() { } } - void UILayer::HandleMessage(EUIMessage message, void* data) { for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) { UIScene* topScene = *it; diff --git a/Minecraft.Client/Platform/Common/UI/UILayer.h b/Minecraft.Client/Platform/Common/UI/UILayer.h index daeef7c87..831b34b66 100644 --- a/Minecraft.Client/Platform/Common/UI/UILayer.h +++ b/Minecraft.Client/Platform/Common/UI/UILayer.h @@ -28,7 +28,6 @@ public: bool m_bIgnoreAutosaveMenuDisplayed; bool m_bIgnorePlayerJoinMenuDisplayed; - UIGroup* m_parentGroup; public: diff --git a/Minecraft.Client/Platform/Common/UI/UIScene.cpp b/Minecraft.Client/Platform/Common/UI/UIScene.cpp index f033acdb8..a84ed8743 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene.cpp @@ -224,7 +224,6 @@ void UIScene::initialiseMovie() { m_bUpdateOpacity = true; } - bool UIScene::mapElementsAndNames() { m_rootPath = IggyPlayerRootPath(swf); @@ -239,9 +238,8 @@ bool UIScene::mapElementsAndNames() { IggyDatatype safeZoneType = IGGY_DATATYPE__invalid_request; IggyResult safeZoneResult = IggyValueGetTypeRS( m_rootPath, m_funcSetSafeZone, nullptr, &safeZoneType); - m_hasSetSafeZoneMethod = - safeZoneResult == IGGY_RESULT_SUCCESS && - safeZoneType == IGGY_DATATYPE_function; + m_hasSetSafeZoneMethod = safeZoneResult == IGGY_RESULT_SUCCESS && + safeZoneType == IGGY_DATATYPE_function; return true; } @@ -319,7 +317,7 @@ void UIScene::loadMovie() { IggyPlayerSetUserdata(swf, this); -// #ifdef _DEBUG + // #ifdef _DEBUG LeaveCriticalSection(&UIController::ms_reloadSkinCS); } @@ -452,7 +450,6 @@ void UIScene::removeControl(UIControl_Base* control, bool centreScene) { IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcRemoveObject, 2, value); - } void UIScene::slideLeft() { @@ -728,7 +725,6 @@ void UIScene::navigateBack() { #endif } else { // m_parentLayer->removeScene(this); - } } @@ -787,8 +783,7 @@ void UIScene::loseFocus() { } } -void UIScene::handleGainFocus(bool navBack) { -} +void UIScene::handleGainFocus(bool navBack) {} void UIScene::updateTooltips() { if (!ui.IsReloadingSkin()) ui.SetTooltips(m_iPad, -1); @@ -852,11 +847,9 @@ int UIScene::convertGameActionToIggyKeycode(int action) { case ACTION_MENU_PAGEUP: keycode = IGGY_KEYCODE_PAGE_UP; break; - case ACTION_MENU_PAGEDOWN: - { - keycode = IGGY_KEYCODE_PAGE_DOWN; - } - break; + case ACTION_MENU_PAGEDOWN: { + keycode = IGGY_KEYCODE_PAGE_DOWN; + } break; case ACTION_MENU_RIGHT_SCROLL: keycode = IGGY_KEYCODE_F3; break; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene.h b/Minecraft.Client/Platform/Common/UI/UIScene.h index c402672e2..c7a0edfea 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene.h @@ -113,7 +113,6 @@ public: int getRenderWidth() { return m_renderWidth; } int getRenderHeight() { return m_renderHeight; } - protected: virtual F64 getSafeZoneHalfHeight(); virtual F64 getSafeZoneHalfWidth(); @@ -142,6 +141,7 @@ public: virtual void tick(); IggyName registerFastName(const std::wstring& name); + protected: void addTimer(int id, int ms); void killTimer(int id); @@ -279,7 +279,6 @@ public: } protected: - size_t GetCallbackUniqueId(); virtual bool isReadyToDelete(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AbstractContainerMenu.cpp index 7953c41df..8bd607c8e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -107,7 +107,6 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, m_fPanelMinY = fPanelY; m_fPanelMaxY = fPanelY + fPanelHeight; - // 4J-PB - need to limit this in splitscreen if (app.GetLocalPlayerCount() > 1) { // don't let the pointer go into someone's screen diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp index e4dfa177f..429630a1a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_AnvilMenu.cpp @@ -356,7 +356,6 @@ void UIScene_AnvilMenu::showCross(bool show) { } void UIScene_AnvilMenu::handleDestroy() { - // another player destroyed the anvil, so shut down the keyboard if it is // displayed UIScene_AbstractContainerMenu::handleDestroy(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp index 03d0e437e..c3d9c9a39 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.cpp @@ -28,7 +28,6 @@ UIScene_ConnectingProgress::UIScene_ConnectingProgress(int iPad, m_buttonConfirm.init(app.GetString(IDS_CONFIRM_OK), eControl_Confirm); m_buttonConfirm.setVisible(false); - m_showTooltips = param->showTooltips; m_runFailTimer = param->setFailTimer; m_timerTime = param->timerTime; @@ -98,7 +97,6 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id) { if (pMinecraft->m_connectionFailed[m_iPad] || !g_NetworkManager.IsInSession()) { - int exitReasonStringId; switch (pMinecraft->m_connectionFailedReason[m_iPad]) { case DisconnectPacket::eDisconnect_LoginTooLong: diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h index f31d7a6be..9491b7a34 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ConnectingProgress.h @@ -44,7 +44,6 @@ protected: // TODO: This should be pure virtual in this class virtual std::wstring getMoviePath(); - public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp index d846aae3c..dfb3e01d4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.cpp @@ -74,7 +74,6 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData, m_funcSetControllerLayout, 1, value); } - for (unsigned int i = 0; i < e_PadCOUNT; ++i) { m_labelsPad[i].init(L""); m_controlLines[i].setVisible(false); @@ -85,7 +84,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData, } std::wstring UIScene_ControlsMenu::getMoviePath() { - if (app.GetLocalPlayerCount() > 1) { + if (app.GetLocalPlayerCount() > 1) { return L"ControlsSplit"; } else { return L"Controls"; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h index 49e782e3c..9bdb85118 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h @@ -49,65 +49,131 @@ private: UIControl_Button m_buttonLayouts[3]; UIControl_CheckBox m_checkboxInvert, m_checkboxSouthpaw; IggyName m_funcSetPlatform, m_funcSetControllerLayout; - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) +UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - { - UI_MAP_ELEMENT(m_labelCurrentLayout, "CurrentLayout") + {UI_MAP_ELEMENT(m_labelCurrentLayout, "CurrentLayout") - UI_MAP_ELEMENT(m_buttonLayouts[0], "Button1") - UI_MAP_ELEMENT(m_buttonLayouts[1], "Button2") - UI_MAP_ELEMENT(m_buttonLayouts[2], "Button3") - } + UI_MAP_ELEMENT(m_buttonLayouts[0], "Button1") + UI_MAP_ELEMENT(m_buttonLayouts[1], "Button2") + UI_MAP_ELEMENT(m_buttonLayouts[2], "Button3")} - UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") - UI_MAP_ELEMENT(m_labelsPad[e_PadLT], "LabelLT") - UI_MAP_ELEMENT(m_labelsPad[e_PadLB], "LabelLB") - UI_MAP_ELEMENT(m_labelsPad[e_PadDPadLeft], "LabelDPadLeft") - UI_MAP_ELEMENT(m_labelsPad[e_PadDPadRight], "LabelDPadRight") - UI_MAP_ELEMENT(m_labelsPad[e_PadDPadUp], "LabelDPadUp") - UI_MAP_ELEMENT(m_labelsPad[e_PadDPadDown], "LabelDPadDown") - UI_MAP_ELEMENT(m_labelsPad[e_PadLS_1], "LabelLS_1") - UI_MAP_ELEMENT(m_labelsPad[e_PadLS_2], "LabelLS_2") - UI_MAP_ELEMENT(m_labelsPad[e_PadStart], "LabelStart") - UI_MAP_ELEMENT(m_labelsPad[e_PadRT], "LabelRT") - UI_MAP_ELEMENT(m_labelsPad[e_PadRB], "LabelRB") - UI_MAP_ELEMENT(m_labelsPad[e_PadY], "LabelY") - UI_MAP_ELEMENT(m_labelsPad[e_PadB], "LabelB") - UI_MAP_ELEMENT(m_labelsPad[e_PadA], "LabelA") - UI_MAP_ELEMENT(m_labelsPad[e_PadX], "LabelX") - UI_MAP_ELEMENT(m_labelsPad[e_PadRS_1], "LabelRS_1") - UI_MAP_ELEMENT(m_labelsPad[e_PadRS_2], "LabelRS_2") - UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], "LabelTouch") +UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") UI_MAP_ELEMENT( + m_labelsPad[e_PadLT], + "LabelLT") UI_MAP_ELEMENT(m_labelsPad[e_PadLB], + "LabelLB") UI_MAP_ELEMENT(m_labelsPad + [e_PadDPadLeft], + "LabelDPadLeft") + UI_MAP_ELEMENT(m_labelsPad[e_PadDPadRight], "LabelDPadRight") UI_MAP_ELEMENT( + m_labelsPad[e_PadDPadUp], + "LabelDPadUp") UI_MAP_ELEMENT(m_labelsPad[e_PadDPadDown], + "LabelDPadDown") UI_MAP_ELEMENT(m_labelsPad + [e_PadLS_1], + "LabelLS_" + "1") + UI_MAP_ELEMENT(m_labelsPad[e_PadLS_2], "LabelLS_2") UI_MAP_ELEMENT( + m_labelsPad[e_PadStart], + "LabelStart") UI_MAP_ELEMENT(m_labelsPad[e_PadRT], + "LabelRT") UI_MAP_ELEMENT(m_labelsPad + [e_PadRB], + "LabelRB") + UI_MAP_ELEMENT(m_labelsPad[e_PadY], "LabelY") UI_MAP_ELEMENT( + m_labelsPad[e_PadB], + "LabelB") UI_MAP_ELEMENT(m_labelsPad[e_PadA], + "LabelA") UI_MAP_ELEMENT(m_labelsPad + [e_PadX], + "LabelX") + UI_MAP_ELEMENT(m_labelsPad[e_PadRS_1], "LabelRS_1") UI_MAP_ELEMENT( + m_labelsPad[e_PadRS_2], + "LabelRS_2") UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], + "LabelTouch") - UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") - UI_MAP_ELEMENT(m_controlLines[e_PadLT], "LineLT") - UI_MAP_ELEMENT(m_controlLines[e_PadLB], "LineLB") - UI_MAP_ELEMENT(m_controlLines[e_PadDPadLeft], "LineDpadLeft") - UI_MAP_ELEMENT(m_controlLines[e_PadDPadRight], "LineDpadRight") - UI_MAP_ELEMENT(m_controlLines[e_PadDPadUp], "LineDpadUp") - UI_MAP_ELEMENT(m_controlLines[e_PadDPadDown], "LineDpadDown") - UI_MAP_ELEMENT(m_controlLines[e_PadLS_1], "LineL3") - UI_MAP_ELEMENT(m_controlLines[e_PadLS_2], "LineLeftStick") - UI_MAP_ELEMENT(m_controlLines[e_PadStart], "LineStart") - UI_MAP_ELEMENT(m_controlLines[e_PadRT], "LineRT") - UI_MAP_ELEMENT(m_controlLines[e_PadRB], "LineRB") - UI_MAP_ELEMENT(m_controlLines[e_PadY], "LineY") - UI_MAP_ELEMENT(m_controlLines[e_PadB], "LineB") - UI_MAP_ELEMENT(m_controlLines[e_PadA], "LineA") - UI_MAP_ELEMENT(m_controlLines[e_PadX], "LineX") - UI_MAP_ELEMENT(m_controlLines[e_PadRS_1], "LineR3") - UI_MAP_ELEMENT(m_controlLines[e_PadRS_2], "LineRightStick") - UI_MAP_ELEMENT(m_controlLines[e_PadTouch], "LineTouch") + UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") UI_MAP_ELEMENT( + m_controlLines[e_PadLT], + "LineLT") UI_MAP_ELEMENT(m_controlLines[e_PadLB], + "LineLB") UI_MAP_ELEMENT(m_controlLines + [e_PadDPadLeft], + "Line" + "Dpad" + "Lef" + "t") + UI_MAP_ELEMENT( + m_controlLines[e_PadDPadRight], + "LineDpadRight") UI_MAP_ELEMENT(m_controlLines + [e_PadDPadUp], + "LineDpadUp") + UI_MAP_ELEMENT( + m_controlLines[e_PadDPadDown], + "LineDpadDown") UI_MAP_ELEMENT(m_controlLines + [e_PadLS_1], + "LineL3") + UI_MAP_ELEMENT( + m_controlLines[e_PadLS_2], + "LineLeftStick") UI_MAP_ELEMENT(m_controlLines + [e_PadStart], + "LineStart") + UI_MAP_ELEMENT( + m_controlLines[e_PadRT], + "LineRT") UI_MAP_ELEMENT(m_controlLines + [e_PadRB], + "LineRB") + UI_MAP_ELEMENT( + m_controlLines[e_PadY], + "LineY") UI_MAP_ELEMENT(m_controlLines + [e_PadB], + "LineB") + UI_MAP_ELEMENT( + m_controlLines[e_PadA], + "LineA") UI_MAP_ELEMENT(m_controlLines + [e_PadX], + "LineX") + UI_MAP_ELEMENT( + m_controlLines[e_PadRS_1], + "LineR3") UI_MAP_ELEMENT(m_controlLines + [e_PadRS_2], + "L" + "i" + "n" + "e" + "R" + "i" + "g" + "h" + "t" + "S" + "t" + "i" + "c" + "k") + UI_MAP_ELEMENT( + m_controlLines + [e_PadTouch], + "LineTouch") - UI_MAP_ELEMENT(m_checkboxInvert, "InvertLook") - UI_MAP_ELEMENT(m_checkboxSouthpaw, "SouthPaw") + UI_MAP_ELEMENT( + m_checkboxInvert, + "InvertLook") + UI_MAP_ELEMENT( + m_checkboxSouthpaw, + "SouthPaw") - UI_MAP_NAME(m_funcSetPlatform, L"SetPlatform") - UI_MAP_NAME(m_funcSetControllerLayout, L"SetControllerLayout") - UI_MAP_ELEMENT(m_labelVersion, "Version") - UI_END_MAP_ELEMENTS_AND_NAMES() -public: - UIScene_ControlsMenu(int iPad, void* initData, UILayer* parentLayer); + UI_MAP_NAME( + m_funcSetPlatform, + L"SetPlatfo" + L"rm") + UI_MAP_NAME( + m_funcSetControllerLayout, + L"SetCo" + L"ntrol" + L"lerLa" + L"yout") + UI_MAP_ELEMENT( + m_labelVersion, + "Ve" + "rs" + "io" + "n") + UI_END_MAP_ELEMENTS_AND_NAMES() public + : UIScene_ControlsMenu(int iPad, void* initData, UILayer* parentLayer); virtual EUIScene getSceneType() { return eUIScene_ControlsMenu; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp index 1a2e78304..45e31d4f3 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.cpp @@ -5,7 +5,6 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" #include "UIScene_CraftingMenu.h" - UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) { @@ -170,7 +169,6 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void* _initData, // 4J-PB - Must be after the CanBeMade list has been set up with // CheckRecipesAvailable UpdateTooltips(); - } void UIScene_CraftingMenu::handleDestroy() { @@ -229,7 +227,6 @@ std::wstring UIScene_CraftingMenu::getMoviePath() { } } - void UIScene_CraftingMenu::handleReload() { m_slotListInventory.addSlots( CRAFTING_INVENTORY_SLOT_START, diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h index 1383312c1..aa2fd54fe 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CraftingMenu.h @@ -63,7 +63,6 @@ public: virtual void customDraw(IggyCustomDrawCallbackRegion* region); - protected: UIControl m_controlMainPanel; UIControl m_control1Selector, m_control2Selector, m_control3Selector; @@ -81,7 +80,6 @@ protected: IggyName m_funcMoveSelector, m_funcSelectVerticalItem, m_funcSetActiveTab; IggyName m_funcShowPanelDisplay, m_funcShowIngredientSlot; - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT(m_controlMainPanel, "MainPanel") UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel) @@ -135,7 +133,6 @@ protected: UI_MAP_NAME(m_funcShowPanelDisplay, L"showPanelDisplay") UI_MAP_NAME(m_funcShowIngredientSlot, L"ShowIngredient") - UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp index 79f2f1a2b..693870700 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp @@ -12,7 +12,6 @@ #include "../../Minecraft.World/Level/Storage/LevelType.h" #include "../../Minecraft.Client/Textures/Packs/DLCTexturePack.h" - #if defined(_WINDOWS64) #include @@ -261,7 +260,6 @@ UIControl* UIScene_CreateWorldMenu::GetMainPanel() { } void UIScene_CreateWorldMenu::handleDestroy() { - // shut down the keyboard if it is displayed } @@ -278,10 +276,8 @@ void UIScene_CreateWorldMenu::tick() { m_bShowTexturePackDescription = false; } - } - void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { @@ -370,7 +366,6 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { } } - void UIScene_CreateWorldMenu::StartSharedLaunchFlow() { Minecraft* pMinecraft = Minecraft::GetInstance(); // Check if we need to upsell the texture pack @@ -498,7 +493,6 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) { } void UIScene_CreateWorldMenu::handleTimerComplete(int id) { - switch (id) { case GAME_CREATE_ONLINE_TIMER_ID: { bool bMultiplayerAllowed = @@ -533,7 +527,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) { m_bMultiplayerAllowed = bMultiplayerAllowed; } } break; - // 4J-PB - Only Xbox will not have trial DLC patched into the game + // 4J-PB - Only Xbox will not have trial DLC patched into the game }; } @@ -590,7 +584,6 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { return; } - unsigned int uiIDA[2]; if (m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == true) { @@ -625,9 +618,9 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { bool pccFriendsAllowed = true; bool bContentRestricted = false; - ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(), - false, &pccAllowed, - &pccFriendsAllowed); + ProfileManager.AllowedPlayerCreatedContent( + ProfileManager.GetPrimaryPad(), false, &pccAllowed, + &pccFriendsAllowed); noUGC = !pccAllowed && !pccFriendsAllowed; @@ -642,8 +635,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { } else if (bContentRestricted) { m_bIgnoreInput = false; ui.RequestContentRestrictedMessageBox(); - } - else { + } else { // ProfileManager.RequestSignInUI(false, false, false, true, // false,&CScene_MultiGameCreate::StartGame_SignInReturned, // this,ProfileManager.GetPrimaryPad()); @@ -663,8 +655,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() { } else if (isOnlineGame && isSignedInLive && bContentRestricted) { m_bIgnoreInput = false; ui.RequestContentRestrictedMessageBox(); - } - else { + } else { CreateGame(this, 0); } } @@ -931,9 +922,9 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam, bool pccAllowed = true; bool pccFriendsAllowed = true; - ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(), - false, &pccAllowed, - &pccFriendsAllowed); + ProfileManager.AllowedPlayerCreatedContent( + ProfileManager.GetPrimaryPad(), false, &pccAllowed, + &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; if (isOnlineGame && (noPrivileges || noUGC)) { @@ -1026,7 +1017,6 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned( return 0; } - void UIScene_CreateWorldMenu::handleTouchBoxRebuild() { m_bRebuildTouchBoxes = true; } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h index a6c0de2c5..87312680d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.h @@ -80,20 +80,19 @@ private: void StartSharedLaunchFlow(); bool IsLocalMultiplayerAvailable(); - protected: static int KeyboardCompleteWorldNameCallback(void* lpParam, const bool bRes); void handlePress(F64 controlId, F64 childId); void handleSliderMove(F64 sliderId, F64 currentValue); - static void CreateGame(UIScene_CreateWorldMenu* pClass, int32_t LocalUsersMask); + static void CreateGame(UIScene_CreateWorldMenu* pClass, + int32_t LocalUsersMask); static int ConfirmCreateReturned(void* pParam, int iPad, C4JStorage::EMessageResult result); static int StartGame_SignInReturned(void* pParam, bool bContinue, int iPad); static int MustSignInReturnedPSN(void* pParam, int iPad, C4JStorage::EMessageResult result); - virtual void checkStateAndStartGame(); }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.cpp index a26f08466..6ea862e8e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.cpp @@ -9,7 +9,6 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" - UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) { @@ -54,7 +53,6 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void* _initData, m_curTab = eCreativeInventoryTab_COUNT; switchTab(eCreativeInventoryTab_BuildingBlocks); - } std::wstring UIScene_CreativeMenu::getMoviePath() { @@ -65,7 +63,6 @@ std::wstring UIScene_CreativeMenu::getMoviePath() { } } - void UIScene_CreativeMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey) { switch (eSection) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.h index f355a124e..6dc6174a4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_CreativeMenu.h @@ -72,7 +72,6 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled); - private: // IUIScene_CreativeMenu void updateTabHighlightAndText(ECreativeInventoryTabs tab); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_Credits.cpp index c251577de..9b87a1588 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_Credits.cpp @@ -86,7 +86,6 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = { {L"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, - {L"%ls", IDS_CREDITS_ART, NO_TRANSLATED_STRING, eLargeText}, {L"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText}, @@ -215,8 +214,8 @@ void UIScene_Credits::tick() { } // Set up the new text element. - if (pDef->m_Text != nullptr) // 4J-PB - think the RAD logo ones aren't set - // up yet and are coming is as null + if (pDef->m_Text != nullptr) // 4J-PB - think the RAD logo ones aren't + // set up yet and are coming is as null { if (pDef->m_iStringID[0] == CREDIT_ICON) { addImage((ECreditIcons)pDef->m_iStringID[1]); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.cpp index 0266d3e9d..a247ddd5a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.cpp @@ -16,23 +16,17 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData, m_labelOffers.init(IDS_DOWNLOADABLE_CONTENT_OFFERS); m_buttonListOffers.init(eControl_OffersList); - - if (m_loadedResolution == eSceneResolution_1080) { m_labelXboxStore.init(L""); } - TelemetryManager->RecordMenuShown(iPad, eUIScene_DLCMainMenu, 0); - - } UIScene_DLCMainMenu::~UIScene_DLCMainMenu() { // Alert the app the we no longer want to be informed of ethernet // connections app.SetLiveLinkRequired(false); - } std::wstring UIScene_DLCMainMenu::getMoviePath() { return L"DLCMainMenu"; } @@ -89,8 +83,7 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) { }; } -void UIScene_DLCMainMenu::handleTimerComplete(int id) { -} +void UIScene_DLCMainMenu::handleTimerComplete(int id) {} int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad, C4JStorage::EMessageResult result) { @@ -111,7 +104,4 @@ void UIScene_DLCMainMenu::handleGainFocus(bool navBack) { } } -void UIScene_DLCMainMenu::tick() { - UIScene::tick(); - -} +void UIScene_DLCMainMenu::tick() { UIScene::tick(); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.h index 1dac3ff48..028e8bc77 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCMainMenu.h @@ -23,7 +23,6 @@ private: static int ExitDLCMainMenu(void* pParam, int iPad, C4JStorage::EMessageResult result); - public: UIScene_DLCMainMenu(int iPad, void* initData, UILayer* parentLayer); ~UIScene_DLCMainMenu(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp index 5caf71393..f9152b84e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.cpp @@ -3,7 +3,6 @@ #include "UIScene_DLCOffersMenu.h" #include "../../../../Minecraft.World/Util/StringHelpers.h" - #define PLAYER_ONLINE_TIMER_ID 0 #define PLAYER_ONLINE_TIMER_TIME 100 @@ -36,10 +35,6 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void* initData, if (m_loadedResolution == eSceneResolution_1080) { m_labelXboxStore.init(L""); } - - - - } UIScene_DLCOffersMenu::~UIScene_DLCOffersMenu() { @@ -48,8 +43,7 @@ UIScene_DLCOffersMenu::~UIScene_DLCOffersMenu() { app.SetLiveLinkRequired(false); } -void UIScene_DLCOffersMenu::handleTimerComplete(int id) { -} +void UIScene_DLCOffersMenu::handleTimerComplete(int id) {} int UIScene_DLCOffersMenu::ExitDLCOffersMenu( void* pParam, int iPad, C4JStorage::EMessageResult result) { @@ -190,15 +184,6 @@ void UIScene_DLCOffersMenu::handleSelectionChanged(F64 selectedId) {} void UIScene_DLCOffersMenu::handleFocusChange(F64 controlId, F64 childId) { app.DebugPrintf("UIScene_DLCOffersMenu::handleFocusChange\n"); - - - } -void UIScene_DLCOffersMenu::tick() { - UIScene::tick(); - -} - - - +void UIScene_DLCOffersMenu::tick() { UIScene::tick(); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.h index 6c53da943..48047e0b1 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DLCOffersMenu.h @@ -53,9 +53,7 @@ public: virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleTimerComplete(int id); - private: - bool m_bProductInfoShown; int m_iProductInfoIndex; int m_iCurrentDLC; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.cpp index 9002b3ba8..d459788e6 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.cpp @@ -30,7 +30,8 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void* initData, UIScene_DeathMenu::~UIScene_DeathMenu() { Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { + if (pMinecraft != nullptr && + pMinecraft->localgameModes[m_iPad] != nullptr) { TutorialMode* gameMode = (TutorialMode*)pMinecraft->localgameModes[m_iPad]; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.h index 9e3e115f5..8abba0428 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DeathMenu.h @@ -33,5 +33,4 @@ public: protected: void handlePress(F64 controlId, F64 childId); - }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp index ce9fd03a2..c5ff4f767 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_DebugOverlay.cpp @@ -209,7 +209,8 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) { case eControl_SetCamera: { #ifndef _CONTENT_PACKAGE ui.NavigateToScene(ProfileManager.GetPrimaryPad(), - eUIScene_DebugSetCamera, nullptr, eUILayer_Debug); + eUIScene_DebugSetCamera, nullptr, + eUILayer_Debug); #endif } break; case eControl_Rain: { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_EULA.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_EULA.cpp index abafb30e7..dac3ec507 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_EULA.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_EULA.cpp @@ -42,7 +42,6 @@ UIScene_EULA::UIScene_EULA(int iPad, void* initData, UILayer* parentLayer) m_bIgnoreInput = false; // ui.setFontCachingCalculationBuffer(20000); - } UIScene_EULA::~UIScene_EULA() { @@ -60,7 +59,6 @@ void UIScene_EULA::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { if (m_bIgnoreInput) return; - ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); switch (key) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_EnchantingMenu.cpp index 1582d2965..2d6120943 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_EnchantingMenu.cpp @@ -5,7 +5,6 @@ #include "../../Minecraft.Client/Minecraft.h" #include "UIScene_EnchantingMenu.h" - UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) { @@ -290,4 +289,3 @@ void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion* region) { } } } - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp index acbf98976..921441038 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp @@ -247,7 +247,7 @@ void UIScene_EndPoem::updateNoise() { // int pos = 0; // do { // pos = - //random->nextInt(SharedConstants::acceptableLetters.length()); } while + // random->nextInt(SharedConstants::acceptableLetters.length()); } while // (pMinecraft->font->charWidths[ch + 32] != // pMinecraft->font->charWidths[pos + 32]); ib.put(listPos + 256 + // random->nextInt(2) + 8 + (darken ? 16 : 0)); ib.put(listPos + pos + diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp index a72e4555d..edb108e6c 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_FullscreenProgress.cpp @@ -69,8 +69,6 @@ UIScene_FullscreenProgress::UIScene_FullscreenProgress(int iPad, void* initData, m_threadCompleted = false; thread->Run(); threadStarted = true; - - } UIScene_FullscreenProgress::~UIScene_FullscreenProgress() { @@ -99,7 +97,8 @@ void UIScene_FullscreenProgress::handleDestroy() { // If we're active, have a cancel func, and haven't already cancelled, call // cancel func - if (exitcode == STILL_ACTIVE && m_cancelFunc != nullptr && !m_bWasCancelled) { + if (exitcode == STILL_ACTIVE && m_cancelFunc != nullptr && + !m_bWasCancelled) { m_bWasCancelled = true; m_cancelFunc(m_cancelFuncParam); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_HUD.cpp index 56a280e94..af297d586 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_HUD.cpp @@ -578,9 +578,9 @@ void UIScene_HUD::SetSelectedLabel(const std::wstring& label) { void UIScene_HUD::HideSelectedLabel() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, - IggyPlayerRootPath(getMovie()), - m_funcHideSelectedLabel, 0, nullptr); + IggyResult out = IggyPlayerCallMethodRS( + getMovie(), &result, IggyPlayerRootPath(getMovie()), + m_funcHideSelectedLabel, 0, nullptr); } void UIScene_HUD::SetRidingHorse(bool ridingHorse, bool bIsJumpable, diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_HUD.h b/Minecraft.Client/Platform/Common/UI/UIScene_HUD.h index a008880c8..08757fd17 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_HUD.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_HUD.h @@ -178,7 +178,6 @@ public: protected: void handleTimerComplete(int id); - private: void repositionHud(); }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 4b5b5d4b7..92ed5f199 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -33,7 +33,6 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void* initData, removeControl(&m_buttons[BUTTON_HAO_DEBUG], false); #endif - // 4J-PB - do not need a storage device to see this menu - just need one // when you choose to re-install them bool bNotInGame = (Minecraft::GetInstance()->level == nullptr); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlay.cpp index e36862e38..d28faf138 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlay.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlay.cpp @@ -49,7 +49,7 @@ static UIScene_HowToPlay::SHowToPlayPageDef gs_aPageDefs[eHowToPlay_NumPages] = {IDS_HOW_TO_PLAY_DROPPERS, 0, 0}, // eHowToPlay_Droppers {IDS_HOW_TO_PLAY_NETHERPORTAL, 0, 0}, // eHowToPlay_NetherPortal {IDS_HOW_TO_PLAY_THEEND, 0, 0}, // eHowToPlay_NetherPortal - {IDS_HOW_TO_PLAY_HOSTOPTIONS, 0, 0}, // eHowToPlay_HostOptions + {IDS_HOW_TO_PLAY_HOSTOPTIONS, 0, 0}, // eHowToPlay_HostOptions }; int gs_pageToFlashMapping[eHowToPlay_NumPages] = { @@ -328,5 +328,4 @@ void UIScene_HowToPlay::StartPage(EHowToPlayPage ePage) { TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)ePage); - } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlayMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlayMenu.cpp index 8fe2d3d79..59afe3a72 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_HowToPlayMenu.cpp @@ -28,7 +28,7 @@ unsigned int UIScene_HowToPlayMenu::m_uiHTPButtonNameA[] = { IDS_HOW_TO_PLAY_MENU_NETHERPORTAL, // eHTPButton_NetherPortal, IDS_HOW_TO_PLAY_MENU_THEEND, // eHTPButton_TheEnd, - IDS_HOW_TO_PLAY_MENU_HOSTOPTIONS, // eHTPButton_HostOptions, + IDS_HOW_TO_PLAY_MENU_HOSTOPTIONS, // eHTPButton_HostOptions, }; // mapping the buttons to a scene value @@ -100,7 +100,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/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp index de9c64185..68989df18 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.cpp @@ -108,7 +108,8 @@ void UIScene_InGameInfoMenu::updateTooltips() { bool editingHost = selectedPlayer->IsHost(); if ((cheats && (m_isHostPlayer || !editingHost)) || (!trust && (m_isHostPlayer || !editingHost)) -#if !defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && defined(_DEBUG_MENUS_ENABLED) +#if !defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && \ + defined(_DEBUG_MENUS_ENABLED) || (m_isHostPlayer && editingHost) #endif ) { @@ -295,16 +296,18 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) { bool editingHost = selectedPlayer->IsHost(); if ((cheats && (m_isHostPlayer || !editingHost)) || (!trust && (m_isHostPlayer || !editingHost)) -#if !defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && defined(_DEBUG_MENUS_ENABLED) +#if !defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && \ + defined(_DEBUG_MENUS_ENABLED) || (m_isHostPlayer && editingHost) #endif ) { InGamePlayerOptionsInitData* pInitData = new InGamePlayerOptionsInitData(); pInitData->iPad = m_iPad; - pInitData->networkSmallId = m_players[currentSelection]->m_smallId; - pInitData->playerPrivileges = - app.GetPlayerPrivileges(m_players[currentSelection]->m_smallId); + pInitData->networkSmallId = + m_players[currentSelection]->m_smallId; + pInitData->playerPrivileges = app.GetPlayerPrivileges( + m_players[currentSelection]->m_smallId); pInitData->playerPrivileges = app.GetPlayerPrivileges( m_players[currentSelection]->m_smallId); ui.NavigateToScene(m_iPad, eUIScene_InGamePlayerOptionsMenu, @@ -463,4 +466,3 @@ UIScene_InGameInfoMenu::PlayerInfo* UIScene_InGameInfoMenu::BuildPlayerInfo( return info; } - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h index a607efb09..e4141d4b0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameInfoMenu.h @@ -68,5 +68,4 @@ public: private: PlayerInfo* BuildPlayerInfo(INetworkPlayer* player); - }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index da0e67e95..389cb711d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -84,7 +84,8 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu( } if (m_editingSelf) { -#if defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) +#if defined(_CONTENT_PACKAGE) || \ + defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) removeControl(&m_checkboxes[eControl_Op], true); #else m_checkboxes[eControl_Op].init( @@ -278,7 +279,6 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu( g_NetworkManager.RegisterPlayerChangedCallback( m_iPad, &UIScene_InGamePlayerOptionsMenu::OnPlayerChanged, this); - } std::wstring UIScene_InGamePlayerOptionsMenu::getMoviePath() { @@ -315,7 +315,8 @@ void UIScene_InGamePlayerOptionsMenu::handleReload() { } if (m_editingSelf) { -#if defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) +#if defined(_CONTENT_PACKAGE) || \ + defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) removeControl(&m_checkboxes[eControl_Op], true); #endif @@ -406,7 +407,8 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; if (m_editingSelf) { -#if defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) +#if defined(_CONTENT_PACKAGE) || \ + defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED) #else Player::setPlayerGamePrivilege( m_playerPrivileges, @@ -462,8 +464,8 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, } else { INetworkPlayer* editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if (!trustPlayers && - (editingPlayer != nullptr && !editingPlayer->IsHost())) { + if (!trustPlayers && (editingPlayer != nullptr && + !editingPlayer->IsHost())) { Player::setPlayerGamePrivilege( m_playerPrivileges, Player::ePlayerGamePrivilege_CannotMine, diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 877ae0933..5aceeb6c1 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -2,7 +2,6 @@ #include "UI.h" #include "UIScene_InGameSaveManagementMenu.h" - namespace { int InGameSaveManagementThumbnailReturnedThunk(void* lpParam, std::uint8_t* thumbnailData, @@ -67,7 +66,6 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu( m_saveDetails = nullptr; m_iSaveDetailsCount = 0; - // block input if we're waiting for DLC to install, and wipe the saves list. // The end of dlc mounting custom message will fill the list again if (app.StartInstallDLCProcess(m_iPad) == true || app.DLCInstallPending()) { @@ -78,7 +76,6 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu( Initialise(); } - // If we're not ignoring input, then we aren't still waiting for the DLC to // mount, and can now check for corrupt dlc. Otherwise this will happen when // the dlc has finished mounting. diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_Intro.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_Intro.cpp index 40eb8388c..8b60bc8ce 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_Intro.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_Intro.cpp @@ -38,7 +38,6 @@ UIScene_Intro::UIScene_Intro(int iPad, void* initData, UILayer* parentLayer) IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetIntroPlatform, 3, value); - } std::wstring UIScene_Intro::getMoviePath() { return L"Intro"; } @@ -58,7 +57,6 @@ void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, } } - void UIScene_Intro::handleAnimationEnd() { if (!m_bIgnoreNavigate) { m_bIgnoreNavigate = true; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_Intro.h b/Minecraft.Client/Platform/Common/UI/UIScene_Intro.h index 44c614b0a..457d783f9 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_Intro.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_Intro.h @@ -23,7 +23,6 @@ public: protected: virtual std::wstring getMoviePath(); - public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, @@ -32,7 +31,6 @@ public: virtual void handleAnimationEnd(); virtual void handleGainFocus(bool navBack); - #if !defined(_ENABLEIGGY) virtual void tick(); #endif diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp index 8d32f3498..adb0f25ff 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp @@ -260,8 +260,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay() { int iValue = 0; IggyDataValue* UpdateValue = new IggyDataValue[activeEffects->size() * 2]; - for (auto it = activeEffects->begin(); it != activeEffects->end(); - ++it) { + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; if (effect->getDuration() >= m_bEffectTime[effect->getId()]) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp index c09513c5c..75cee2880 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.cpp @@ -50,7 +50,6 @@ void UIScene_JoinMenu::tick() { m_buttonListPlayers.init(eControl_GamePlayers); - m_labelLabels[eLabel_Difficulty].init( app.GetString(IDS_LABEL_DIFFICULTY)); m_labelLabels[eLabel_GameType].init(app.GetString(IDS_LABEL_GAME_TYPE)); @@ -274,7 +273,6 @@ void UIScene_JoinMenu::handleFocusChange(F64 controlId, F64 childId) { updateTooltips(); } - void UIScene_JoinMenu::StartSharedLaunchFlow() { if (!app.IsLocalMultiplayerAvailable()) { JoinGame(this); @@ -377,7 +375,6 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { ProfileManager.GetPrimaryPad(), false, &pccAllowed, &pccFriendsAllowed); if (!pccAllowed && !pccFriendsAllowed) noUGC = true; - if (noUGC) { pClass->setVisible(true); pClass->m_bIgnoreInput = false; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h index 14d32eba4..f45aafc6f 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_JoinMenu.h @@ -84,7 +84,6 @@ protected: void StartSharedLaunchFlow(); - static int StartGame_SignInReturned(void* pParam, bool, int); static void JoinGame(UIScene_JoinMenu* pClass); }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_Keyboard.cpp index bacec1e67..1bc3f9730 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_Keyboard.cpp @@ -103,15 +103,15 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, handled = true; break; case ACTION_MENU_Y: // Y - out = IggyPlayerCallMethodRS(getMovie(), &result, - IggyPlayerRootPath(getMovie()), - m_funcSpaceButtonPressed, 0, nullptr); + out = IggyPlayerCallMethodRS( + getMovie(), &result, IggyPlayerRootPath(getMovie()), + m_funcSpaceButtonPressed, 0, nullptr); handled = true; break; case ACTION_MENU_STICK_PRESS: // LS - out = IggyPlayerCallMethodRS(getMovie(), &result, - IggyPlayerRootPath(getMovie()), - m_funcCapsButtonPressed, 0, nullptr); + out = IggyPlayerCallMethodRS( + getMovie(), &result, IggyPlayerRootPath(getMovie()), + m_funcCapsButtonPressed, 0, nullptr); handled = true; break; case ACTION_MENU_LEFT_SCROLL: // LB diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index e620f6d24..ce1554059 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -205,7 +205,6 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu( addTimer(GAME_CREATE_ONLINE_TIMER_ID, GAME_CREATE_ONLINE_TIMER_TIME); - m_bIgnoreInput = false; } @@ -273,7 +272,6 @@ void UIScene_LaunchMoreOptionsMenu::tick() { } void UIScene_LaunchMoreOptionsMenu::handleDestroy() { - // so shut down the keyboard if it is displayed } @@ -323,7 +321,6 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, } } - void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { // CD - Added for audio diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h index f0f487fe8..a65ecc7f1 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -157,5 +157,4 @@ private: bool m_bUpdateOnline; // If true, update online settings on next tick void UpdateOnline(); - }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp index 4743fefdf..5a6cc07c0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -112,7 +112,6 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void* initData, m_labelEntries.init(entriesBuffer); ReadStats(-1); - } UIScene_LeaderboardsMenu::~UIScene_LeaderboardsMenu() { @@ -125,7 +124,6 @@ void UIScene_LeaderboardsMenu::updateTooltips() { int iTooltipFriendRequest = -1; int iTooltipGamerCardOrProfile = -1; - ui.SetTooltips(m_iPad, iTooltipFriendRequest, IDS_TOOLTIPS_BACK, IDS_TOOLTIPS_CHANGE_FILTER, iTooltipGamerCardOrProfile); } @@ -262,7 +260,6 @@ void UIScene_LeaderboardsMenu::handleInput(int iPad, int key, bool repeat, if (m_leaderboard.m_totalEntryCount <= 10) break; sendInputToMovie(key, repeat, pressed, released); - } handled = true; } break; @@ -688,7 +685,6 @@ void UIScene_LeaderboardsMenu::CopyLeaderboardEntry( } } } - } void UIScene_LeaderboardsMenu::PopulateLeaderboard( @@ -772,7 +768,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard( // Show the no results message #if !defined(_WINDOWS64) - // so we check this for other platforms + // so we check this for other platforms if (ret == LeaderboardManager::eStatsReturn_NetworkError) m_labelInfo.setLabel(app.GetString(IDS_ERROR_NETWORK)); else @@ -849,8 +845,7 @@ void UIScene_LeaderboardsMenu::handleRequestMoreData(F64 startIndex, bool up) { } } -void UIScene_LeaderboardsMenu::handleTimerComplete(int id) { -} +void UIScene_LeaderboardsMenu::handleTimerComplete(int id) {} int UIScene_LeaderboardsMenu::ExitLeaderboards( void* pParam, int iPad, C4JStorage::EMessageResult result) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp index f957867be..f9a2e53ab 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.cpp @@ -223,7 +223,6 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void* initData, // 4J-PB - Only Xbox will not have trial DLC patched into the game } - if (params) delete params; addTimer(GAME_CREATE_ONLINE_TIMER_ID, GAME_CREATE_ONLINE_TIMER_TIME); } @@ -276,7 +275,6 @@ void UIScene_LoadMenu::tick() { m_pbThumbnailData, m_uiThumbnailSize, (unsigned char*)&szSeed, uiHostOptions, bHostOptionsRead, m_MoreOptionsParams.dwTexturePack); - // #ifdef _DEBUG // // dump out the thumbnail // void* hThumbnail = @@ -437,11 +435,9 @@ void UIScene_LoadMenu::tick() { eUIScene_QuadrantSignin, &info); } - UIScene::tick(); } - void UIScene_LoadMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { if (m_bIgnoreInput) return; @@ -529,7 +525,6 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) { }; } - void UIScene_LoadMenu::StartSharedLaunchFlow() { Minecraft* pMinecraft = Minecraft::GetInstance(); // Check if we need to upsell the texture pack @@ -639,7 +634,6 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() { } app.SetGameHostOption(eGameHostOption_WasntSaveOwner, (!m_bIsSaveOwner)); - #if TO_BE_IMPLEMENTED // Reset the background downloading, in case we changed it by attempting to // download a texture pack @@ -680,7 +674,6 @@ void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) { void UIScene_LoadMenu::handleTouchBoxRebuild() { m_bRebuildTouchBoxes = true; } void UIScene_LoadMenu::handleTimerComplete(int id) { - switch (id) { case GAME_CREATE_ONLINE_TIMER_ID: { bool bMultiplayerAllowed = @@ -720,7 +713,7 @@ void UIScene_LoadMenu::handleTimerComplete(int id) { m_bMultiplayerAllowed = bMultiplayerAllowed; } } break; - // 4J-PB - Only Xbox will not have trial DLC patched into the game + // 4J-PB - Only Xbox will not have trial DLC patched into the game } } @@ -961,9 +954,7 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { ui.RequestContentRestrictedMessageBox(); pClass->m_bIgnoreInput = false; - } - else { - + } else { int localUsersMask = CGameNetworkManager::GetLocalPlayerMask( ProfileManager.GetPrimaryPad()); @@ -983,8 +974,7 @@ int UIScene_LoadMenu::LoadDataComplete(void* pParam) { pClass->setVisible(true); ui.RequestContentRestrictedMessageBox(); pClass->m_bIgnoreInput = false; - } - else { + } else { pClass->m_bRequestQuadrantSignin = true; } } @@ -1011,13 +1001,11 @@ int UIScene_LoadMenu::LoadSaveDataReturned(void* pParam, bool bIsCorrupt, pClass->m_bIsCorrupt = bIsCorrupt; - if (bIsOwner) { LoadDataComplete(pClass); } else { // messagebox pClass->m_bIgnoreInput = false; - } return 0; @@ -1293,4 +1281,3 @@ void UIScene_LoadMenu::handleGainFocus(bool navBack) { m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame == true); } } - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h index 0cc2d8cb8..248ecd396 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadMenu.h @@ -102,7 +102,6 @@ private: virtual void checkStateAndStartGame(); void LaunchGame(void); - static int ConfirmLoadReturned(void* pParam, int iPad, C4JStorage::EMessageResult result); static void StartGameFromSave(UIScene_LoadMenu* pClass, int localUsersMask); @@ -120,8 +119,8 @@ private: C4JStorage::EMessageResult result); public: - // 4jcraft: made public for the thunk system we have for thumbnail loading, probably a FIXME for - // when this gets cleaned up + // 4jcraft: made public for the thunk system we have for thumbnail loading, + // probably a FIXME for when this gets cleaned up static int LoadSaveDataThumbnailReturned(void* lpParam, std::uint8_t* pbThumbnail, unsigned int thumbnailBytes); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 3dc367bcc..e8ddcbce4 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -28,8 +28,6 @@ bool UIScene_LoadOrJoinMenu::m_bSaveTransferRunning = false; #define JOIN_LOAD_ONLINE_TIMER_ID 0 #define JOIN_LOAD_ONLINE_TIMER_TIME 100 - - namespace { int LoadOrJoinThumbnailReturnedThunk(void* lpParam, std::uint8_t* thumbnailData, unsigned int thumbnailBytes) { @@ -120,11 +118,8 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void* initData, m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); - int iLB = -1; - - // block input if we're waiting for DLC to install, and wipe the saves list. // The end of dlc mounting custom message will fill the list again if (app.StartInstallDLCProcess(m_iPad) == true || app.DLCInstallPending()) { @@ -135,7 +130,6 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void* initData, Initialise(); } - UpdateGamesList(); g_NetworkManager.SetSessionsUpdatedCallback(&UpdateGamesListCallback, this); @@ -187,7 +181,6 @@ UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() { } void UIScene_LoadOrJoinMenu::updateTooltips() { - // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard @@ -223,7 +216,6 @@ void UIScene_LoadOrJoinMenu::updateTooltips() { iLB = IDS_TOOLTIPS_PARTY_GAMES; } - if (ProfileManager.IsFullVersion() == false) { iRB = -1; } else if (StorageManager.GetSaveDisabled()) { @@ -265,7 +257,6 @@ void UIScene_LoadOrJoinMenu::Initialise() { m_pSavesList->SetCurSelVisible(0); #endif } else if (StorageManager.GetSaveDisabled()) { - #if TO_BE_IMPLEMENTED if (StorageManager.GetSaveDeviceSelected(m_iPad)) #endif @@ -299,7 +290,6 @@ void UIScene_LoadOrJoinMenu::updateComponents() { } void UIScene_LoadOrJoinMenu::handleDestroy() { - // shut down the keyboard if it is displayed } @@ -568,7 +558,6 @@ void UIScene_LoadOrJoinMenu::tick() { } #endif - // SAVE TRANSFERS } @@ -578,7 +567,6 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { // This will return with the number retrieved in uiSaveC if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { - uiSaveC = 0; File savesDir(L"Saves"); if (savesDir.exists()) { @@ -615,8 +603,8 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() { m_pSaveDetails = StorageManager.ReturnSavesInfo(); if (m_pSaveDetails == nullptr) { - C4JStorage::ESaveGameState eSGIStatus = - StorageManager.GetSavesInfo(m_iPad, nullptr, this, (char*)"save"); + C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( + m_iPad, nullptr, this, (char*)"save"); } #if TO_BE_IMPLEMENTED @@ -983,7 +971,6 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { if (m_buttonListGames.getItemCount() > 0 && gameIndex < m_currentSessions->size()) { - // CScene_MultiGameInfo::JoinMenuInitData *initData = new // CScene_MultiGameInfo::JoinMenuInitData(); m_initData->iPad = 0; @@ -1025,11 +1012,9 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { return; } - } m_controlJoinTimer.setVisible(false); - m_bIgnoreInput = true; ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_JoinMenu, m_initData); @@ -1283,7 +1268,6 @@ bool UIScene_LoadOrJoinMenu::DoesGamesListHaveFocus() { void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { switch (id) { case JOIN_LOAD_ONLINE_TIMER_ID: { - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); @@ -1301,7 +1285,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { m_bMultiplayerAllowed = bMultiplayerAllowed; } } break; - // 4J-PB - Only Xbox will not have trial DLC patched into the game + // 4J-PB - Only Xbox will not have trial DLC patched into the game } } @@ -1488,7 +1472,6 @@ int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(void* lpParam, bool bRes) { return 0; } - int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( void* pParam, int iPad, C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; @@ -1554,7 +1537,6 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned( return 0; } - int UIScene_LoadOrJoinMenu::TexturePackDialogReturned( void* pParam, int iPad, C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; @@ -1563,13 +1545,11 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned( if (result == C4JStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - } pClass->m_bIgnoreInput = false; return 0; } - #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() { @@ -2142,7 +2122,9 @@ void UIScene_LoadOrJoinMenu::SaveTransferReturned(void* lpParam, error_code); } } -ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() { return nullptr; } +ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() { + return nullptr; +} void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(void* lpParam) { UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)lpParam; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h index 76da3865c..acbfde22d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.h @@ -4,7 +4,6 @@ class LevelGenerationOptions; - class UIScene_LoadOrJoinMenu : public UIScene { private: enum EControls { @@ -138,14 +137,13 @@ protected: void LoadLevelGen(LevelGenerationOptions* levelGen); void LoadSaveFromDisk( File* saveFile, ESavePlatform savePlatform = SAVE_FILE_PLATFORM_LOCAL); + public: virtual void HandleDLCMountingComplete(); - private: void CheckAndJoinGame(int gameIndex); - #if defined(SONY_REMOTE_STORAGE_DOWNLOAD) enum eSaveTransferState { eSaveTransfer_Idle, @@ -230,5 +228,4 @@ private: static int CrossSaveUploadFinishedCallback( void* pParam, int iPad, C4JStorage::EMessageResult result); #endif - }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp index 712c1f3c1..16f493c47 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp @@ -28,7 +28,6 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void* initData, m_buttons[(int)eControl_PlayGame].init(IDS_PLAY_GAME, eControl_PlayGame); - m_buttons[(int)eControl_Leaderboards].init(IDS_LEADERBOARDS, eControl_Leaderboards); m_buttons[(int)eControl_Achievements].init((UIString)IDS_ACHIEVEMENTS, @@ -48,7 +47,6 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void* initData, m_buttons[(int)eControl_Exit].init(app.GetString(IDS_EXIT_GAME), eControl_Exit); - doHorizontalResizeCheck(); m_splash = L""; @@ -98,7 +96,6 @@ void UIScene_MainMenu::updateTooltips() { int iA = -1; if (!m_bIgnorePress) { iA = IDS_TOOLTIPS_SELECT; - } ui.SetTooltips(DEFAULT_XUI_MENU_USER, iA, -1, iX); } @@ -133,7 +130,6 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { m_bIgnorePress = false; updateTooltips(); - if (navBack && ProfileManager.IsFullVersion()) { // Replace the Unlock Full Game with Downloadable Content m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT); @@ -177,8 +173,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) { std::wstring UIScene_MainMenu::getMoviePath() { return L"MainMenu"; } -void UIScene_MainMenu::handleReload() { -} +void UIScene_MainMenu::handleReload() {} void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) { @@ -188,7 +183,6 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, if (m_bIgnorePress || (eNavigateWhenReady >= 0)) return; - ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); switch (key) { @@ -219,7 +213,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { ui.PlayUISFX(eSFX_Press); signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned; - break; + break; case eControl_Leaderboards: // CD - Added for audio ui.PlayUISFX(eSFX_Press); @@ -428,10 +422,8 @@ int UIScene_MainMenu::MustSignInReturned(void* pParam, int iPad, return 0; } - int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, - bool bContinue, int iPad) -{ + bool bContinue, int iPad) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -482,10 +474,8 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void* pParam, return 0; } - int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, - int iPad) -{ + int iPad) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -597,7 +587,6 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, // ensure we've applied this player's settings // app.ApplyGameSettingsChanged(iPad); - { // go straight in to the trial level LoadTrial(); @@ -621,8 +610,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void* pParam, bool bContinue, } int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, - int iPad) -{ + int iPad) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -648,7 +636,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, if (bContentRestricted) { pClass->m_bIgnorePress = false; #if !defined(_WINDOWS64) - // we check this for other platforms + // we check this for other platforms // you can't see leaderboards unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; @@ -678,8 +666,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void* pParam, bool bContinue, } int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, - int iPad) -{ + int iPad) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -706,8 +693,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void* pParam, bool bContinue, } int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, - bool bContinue, int iPad) -{ + bool bContinue, int iPad) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; if (bContinue) { @@ -733,7 +719,6 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void* pParam, return 0; } - int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) { // UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; @@ -747,7 +732,6 @@ int UIScene_MainMenu::ExitGameReturned(void* pParam, int iPad, return 0; } - void UIScene_MainMenu::RunPlayGame(int iPad) { Minecraft* pMinecraft = Minecraft::GetInstance(); @@ -849,7 +833,6 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { // this player's settings // app.ApplyGameSettingsChanged(iPad); - { LoadTrial(); } @@ -866,8 +849,8 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else if (!ProfileManager.IsSignedInLive(iPad)) { - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, - IDS_PRO_NOTONLINE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, + uiIDA, 1); } else { // we're supposed to check for parental control restrictions before // showing leaderboards The title enforces the user's NP parental @@ -882,13 +865,13 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { bool bContentRestricted = false; if (bContentRestricted) { #if !defined(_WINDOWS64) - // we check this for other platforms + // we check this for other platforms // you can't see leaderboards unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, - IDS_CONTENT_RESTRICTION, uiIDA, 1, - ProfileManager.GetPrimaryPad(), nullptr, this); + ui.RequestErrorMessage( + IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, + ProfileManager.GetPrimaryPad(), nullptr, this); #endif } else { ProfileManager.SetLockedProfile(iPad); @@ -924,7 +907,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { if (bContentRestricted) { m_bIgnorePress = false; #if !defined(_WINDOWS64) - // we check this for other platforms + // we check this for other platforms // you can't see the store unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; @@ -1016,9 +999,6 @@ void UIScene_MainMenu::tick() { eNavigateWhenReady = -1; } } - - - } void UIScene_MainMenu::RunAchievements(int iPad) { @@ -1138,4 +1118,3 @@ void UIScene_MainMenu::handleUnlockFullVersion() { m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT, true); } - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.h index 23daa2d7b..fc0030506 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.h @@ -40,7 +40,6 @@ private: bool m_bTrialVersion; bool m_bLoadTrialOnNetworkManagerReady; - float m_fScreenWidth, m_fScreenHeight; float m_fRawWidth, m_fRawHeight; std::vector m_splashes; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_NewUpdateMessage.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_NewUpdateMessage.cpp index 81b65b7ac..2db3ae1f9 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_NewUpdateMessage.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_NewUpdateMessage.cpp @@ -35,7 +35,6 @@ UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void* initData, } m_bIgnoreInput = false; - } UIScene_NewUpdateMessage::~UIScene_NewUpdateMessage() { @@ -54,7 +53,6 @@ void UIScene_NewUpdateMessage::handleInput(int iPad, int key, bool repeat, bool& handled) { if (m_bIgnoreInput) return; - ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); switch (key) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.cpp index 4cf38478a..72079ed0a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.cpp @@ -8,7 +8,6 @@ #include "../../Minecraft.Client/Textures/Packs/DLCTexturePack.h" #include "../../Minecraft.World/Util/StringHelpers.h" - UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) { @@ -71,7 +70,8 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void* initData, UIScene_PauseMenu::~UIScene_PauseMenu() { Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr) { + if (pMinecraft != nullptr && + pMinecraft->localgameModes[m_iPad] != nullptr) { TutorialMode* gameMode = (TutorialMode*)pMinecraft->localgameModes[m_iPad]; @@ -92,19 +92,13 @@ std::wstring UIScene_PauseMenu::getMoviePath() { } } -void UIScene_PauseMenu::tick() { - UIScene::tick(); - - - -} +void UIScene_PauseMenu::tick() { UIScene::tick(); } void UIScene_PauseMenu::updateTooltips() { bool bUserisClientSide = ProfileManager.IsSignedInLive(m_iPad); bool bIsisPrimaryHost = g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad() == m_iPad); - int iY = -1; int iRB = -1; int iX = -1; @@ -140,14 +134,12 @@ void UIScene_PauseMenu::updateComponents() { m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); } -void UIScene_PauseMenu::handlePreReload() { -} +void UIScene_PauseMenu::handlePreReload() {} void UIScene_PauseMenu::handleReload() { updateTooltips(); updateControlsVisibility(); - doHorizontalResizeCheck(); } @@ -184,7 +176,6 @@ void UIScene_PauseMenu::updateControlsVisibility() { // is saving disabled? if (StorageManager.GetSaveDisabled()) { } - } void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, @@ -199,7 +190,6 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, // pressed?"true":"false", released?"true":"false"); ui.AnimateKeyPress(iPad, key, repeat, pressed, released); - switch (key) { case ACTION_MENU_CANCEL: if (pressed) { @@ -298,7 +288,6 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else if (!ProfileManager.IsSignedInLive(m_iPad)) { - unsigned int uiIDA[1] = {IDS_OK}; ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, @@ -307,7 +296,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { bool bContentRestricted = false; if (bContentRestricted) { #if !defined(_WINDOWS64) - // we check this for other platforms + // we check this for other platforms // you can't see leaderboards unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; @@ -450,7 +439,6 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { void UIScene_PauseMenu::PerformActionSaveGame() { // is the player trying to save in the trial version? if (!ProfileManager.IsFullVersion()) { - // Unlock the full version? if (!ProfileManager.IsSignedInLive(m_iPad)) { } else { @@ -503,20 +491,20 @@ void UIScene_PauseMenu::PerformActionSaveGame() { StorageManager.DoesSaveExist(&bSaveExists); { - // we need to ask if they are sure they want to overwrite the - // existing game - if (bSaveExists) { - unsigned int uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestAlertMessage( - IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, - m_iPad, &IUIScene_PauseMenu::SaveGameDialogReturned, - (void*)GetCallbackUniqueId()); - } else { + // we need to ask if they are sure they want to overwrite the + // existing game + if (bSaveExists) { + unsigned int uiIDA[2]; + uiIDA[0] = IDS_CONFIRM_CANCEL; + uiIDA[1] = IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, + uiIDA, 2, m_iPad, + &IUIScene_PauseMenu::SaveGameDialogReturned, + (void*)GetCallbackUniqueId()); + } else { // flag a app action of save game app.SetAction(m_iPad, eAppAction_SaveGame); - } + } } } @@ -596,10 +584,6 @@ int UIScene_PauseMenu::SaveGame_SignInReturned(void* pParam, bool bContinue, return 0; } - - void UIScene_PauseMenu::SetIgnoreInput(bool ignoreInput) { m_bIgnoreInput = ignoreInput; } - - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.h index c5d18081f..56677c284 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_PauseMenu.h @@ -73,7 +73,5 @@ protected: private: void PerformActionSaveGame(); - protected: - }; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp index c7e132b03..1ce080998 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.cpp @@ -17,7 +17,6 @@ UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void* _initData, _initQuadrants(); - parentLayer->addComponent(iPad, eUIComponent_MenuBackground); } @@ -67,21 +66,19 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, switch (key) { case ACTION_MENU_CANCEL: { if (pressed) { - { - m_bIgnoreInput = true; - m_signInInfo.Func(m_signInInfo.lpParam, false, - iPad); - ProfileManager.CancelProfileAvatarRequest(); + { + m_bIgnoreInput = true; + m_signInInfo.Func(m_signInInfo.lpParam, false, iPad); + ProfileManager.CancelProfileAvatarRequest(); - navigateBack(); - } + navigateBack(); } + } } break; case ACTION_MENU_OK: if (pressed) { m_bIgnoreInput = true; - if (ProfileManager.IsSignedIn(iPad)) - { + if (ProfileManager.IsSignedIn(iPad)) { app.DebugPrintf("Signed in pad pressed\n"); ProfileManager.CancelProfileAvatarRequest(); @@ -111,8 +108,7 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, } int UIScene_QuadrantSignin::SignInReturned(void* pParam, bool bContinue, - int iPad) -{ + int iPad) { app.DebugPrintf("SignInReturned for pad %d\n", iPad); UIScene_QuadrantSignin* pClass = (UIScene_QuadrantSignin*)pParam; @@ -125,7 +121,6 @@ int UIScene_QuadrantSignin::SignInReturned(void* pParam, bool bContinue, return 0; } - namespace { int AvatarReturnedThunk(void* lpParam, std::uint8_t* thumbnailData, unsigned int thumbnailBytes) { diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h index 635077ba7..8e3b2aa32 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_QuadrantSignin.h @@ -112,7 +112,6 @@ private: void updateState(); void setControllerState(int iPad, EControllerStatus state); - protected: void _initQuadrants(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp index e534def3a..dfc01b3c6 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.cpp @@ -106,4 +106,3 @@ void UIScene_SaveMessage::handleTimerComplete(int id) { break; } } - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.h b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.h index 61eef4d1e..2512a08ec 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SaveMessage.h @@ -19,7 +19,6 @@ private: UI_MAP_NAME(m_funcAutoResize, L"AutoResize") UI_END_MAP_ELEMENTS_AND_NAMES() - public: UIScene_SaveMessage(int iPad, void* initData, UILayer* parentLayer); ~UIScene_SaveMessage(); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp index 553435c72..a9cb67994 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -2,7 +2,6 @@ #include "UI.h" #include "UIScene_SettingsOptionsMenu.h" - int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4] = { IDS_DIFFICULTY_PEACEFUL, IDS_DIFFICULTY_EASY, IDS_DIFFICULTY_NORMAL, IDS_DIFFICULTY_HARD}; @@ -64,7 +63,6 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, m_sliderAutosave.init(autosaveLabels[ucValue], eControl_Autosave, 0, 8, ucValue); - ucValue = app.GetGameSettings(m_iPad, eGameSetting_Difficulty); wchar_t difficultyLabels[4][256]; for (unsigned int i = 0; i < 4; ++i) { @@ -268,7 +266,6 @@ void UIScene_SettingsOptionsMenu::handleReload() { m_sliderAutosave.init(autosaveLabels[ucValue], eControl_Autosave, 0, 8, ucValue); - ucValue = app.GetGameSettings(m_iPad, eGameSetting_Difficulty); wchar_t difficultyLabels[4][256]; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp index 9547588fa..17c04b3aa 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SignEntryMenu.cpp @@ -168,7 +168,6 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { } void UIScene_SignEntryMenu::handleDestroy() { - // another player destroyed the anvil, so shut down the keyboard if it is // displayed } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp index cd521339b..d9ac7d17e 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.cpp @@ -28,7 +28,6 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void* initData, m_labelSelected.init(app.GetString(IDS_SELECTED)); - m_bIgnoreInput = false; m_bNoSkinsToShow = false; @@ -78,7 +77,6 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void* initData, m_centreLabel = L""; m_rightLabel = L""; - // block input if we're waiting for DLC to install. The end of dlc mounting // custom message will fill the save list if (app.StartInstallDLCProcess(m_iPad)) { @@ -121,7 +119,6 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void* initData, } // Display the tooltips - } void UIScene_SkinSelectMenu::updateTooltips() { @@ -399,48 +396,46 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) { // if(true) if (!m_currentPack->hasPurchasedFile( DLCManager::e_DLCType_Skin, skinFile->getPath())) { - // no unsigned int uiIDA[1]; uiIDA[0] = IDS_OK; - // We need to upsell the full version - if (ProfileManager.IsGuest(iPad)) { - // can't buy - ui.RequestAlertMessage( - IDS_PRO_GUESTPROFILE_TITLE, - IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, iPad); - } - else { - // upsell - bool bContentRestricted = false; - if (bContentRestricted) { + // We need to upsell the full version + if (ProfileManager.IsGuest(iPad)) { + // can't buy + ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, + IDS_PRO_GUESTPROFILE_TEXT, + uiIDA, 1, iPad); + } else { + // upsell + bool bContentRestricted = false; + if (bContentRestricted) { #if !defined(_WIN64) - // check this for other platforms you can't see the store - unsigned int uiIDA[1]; - uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestAlertMessage( - IDS_ONLINE_SERVICE_TITLE, - IDS_CONTENT_RESTRICTION, uiIDA, 1, - iPad); + // check this for other platforms you can't see + // the store + unsigned int uiIDA[1]; + uiIDA[0] = IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, + IDS_CONTENT_RESTRICTION, + uiIDA, 1, iPad); #endif - } else { - // 4J-PB - need to check for an empty store - { - m_bIgnoreInput = true; - renableInputAfterOperation = false; + } else { + // 4J-PB - need to check for an empty store + { + m_bIgnoreInput = true; + renableInputAfterOperation = false; - unsigned int uiIDA[2] = { - IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL}; - ui.RequestAlertMessage( - IDS_UNLOCK_DLC_TITLE, - IDS_UNLOCK_DLC_SKIN, uiIDA, 2, iPad, - &UIScene_SkinSelectMenu:: - UnlockSkinReturned, - this); - } + unsigned int uiIDA[2] = { + IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL}; + ui.RequestAlertMessage( + IDS_UNLOCK_DLC_TITLE, + IDS_UNLOCK_DLC_SKIN, uiIDA, 2, iPad, + &UIScene_SkinSelectMenu:: + UnlockSkinReturned, + this); } } + } } else { app.SetPlayerSkin(iPad, skinFile->getPath()); app.SetPlayerCape(iPad, @@ -1145,9 +1140,7 @@ void UIScene_SkinSelectMenu::setRightLabel(const std::wstring& label) { } } - void UIScene_SkinSelectMenu::HandleDLCInstalled() { - app.DebugPrintf(4, "UIScene_SkinSelectMenu::HandleDLCInstalled\n"); // mounted DLC may have changed if (app.StartInstallDLCProcess(m_iPad) == false) { @@ -1164,7 +1157,6 @@ void UIScene_SkinSelectMenu::HandleDLCInstalled() { } // this will send a CustomMessage_DLCMountingComplete when done - } void UIScene_SkinSelectMenu::HandleDLCMountingComplete() { @@ -1278,5 +1270,3 @@ void UIScene_SkinSelectMenu::handleReload() { handlePackIndexChanged(); } - - diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h index 6675048f8..fe73e686b 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_SkinSelectMenu.h @@ -12,7 +12,6 @@ private: // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; - enum ESkinSelectNavigation { eSkinNavigation_Pack, eSkinNavigation_Skin, @@ -152,7 +151,4 @@ private: void InputActionOK(unsigned int iPad); virtual void handleReload(); - - - }; \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/UI/UIString.cpp b/Minecraft.Client/Platform/Common/UI/UIString.cpp index ac5b40975..07afa1eb0 100644 --- a/Minecraft.Client/Platform/Common/UI/UIString.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIString.cpp @@ -109,9 +109,7 @@ UIString::UIString(const wchar_t* constant) { m_core = std::shared_ptr(core); } -UIString::~UIString() { - m_core = nullptr; -} +UIString::~UIString() { m_core = nullptr; } bool UIString::empty() { return m_core.get() == nullptr; } diff --git a/Minecraft.Client/Platform/Common/UI/UIString.h b/Minecraft.Client/Platform/Common/UI/UIString.h index d9f2de635..4b6d4289d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIString.h +++ b/Minecraft.Client/Platform/Common/UI/UIString.h @@ -3,10 +3,8 @@ #include #include - typedef std::function StringBuilder; - class UIString { protected: static int s_currentLanguage; diff --git a/Minecraft.Client/Platform/Common/XML/ATGXmlParser.cpp b/Minecraft.Client/Platform/Common/XML/ATGXmlParser.cpp index d0216db44..6ee5dc9f1 100644 --- a/Minecraft.Client/Platform/Common/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Platform/Common/XML/ATGXmlParser.cpp @@ -1,13 +1,15 @@ -// 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. - +// 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. @@ -19,14 +21,12 @@ #include -namespace ATG -{ +namespace ATG { //------------------------------------------------------------------------------------- // Name: XMLParser::XMLParser //------------------------------------------------------------------------------------- -XMLParser::XMLParser() -{ +XMLParser::XMLParser() { m_pWritePtr = m_pWriteBuf; m_pReadPtr = m_pReadBuf; m_pISAXCallback = nullptr; @@ -36,152 +36,121 @@ XMLParser::XMLParser() //------------------------------------------------------------------------------------- // Name: XMLParser::~XMLParser //------------------------------------------------------------------------------------- -XMLParser::~XMLParser() -{ -} - +XMLParser::~XMLParser() {} //------------------------------------------------------------------------------------- // Name: XMLParser::FillBuffer // Desc: Reads a block from the current open file //------------------------------------------------------------------------------------- -void XMLParser::FillBuffer() -{ +void XMLParser::FillBuffer() { uint32_t NChars; m_pReadPtr = m_pReadBuf; - if( m_hFile == nullptr ) - { - if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) + 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 )) - { + } 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 ); + 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'; + 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; -} - +void XMLParser::SkipNextAdvance() { m_bSkipNextAdvance = true; } //------------------------------------------------------------------------------------- // Name: XMLParser::ConsumeSpace -// Desc: Skips spaces in the current stream +// Desc: Skips spaces in the current stream //------------------------------------------------------------------------------------- -int32_t XMLParser::ConsumeSpace() -{ +int32_t XMLParser::ConsumeSpace() { int32_t hr; // Skip spaces - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; + 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(); + while ((m_Ch == ' ') || (m_Ch == '\t') || (m_Ch == '\n') || + (m_Ch == '\r')) { + if (FAILED(hr = AdvanceCharacter())) return hr; + } + SkipNextAdvance(); return S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::ConvertEscape -// Desc: Copies and converts an escape sequence into m_pWriteBuf +// Desc: Copies and converts an escape sequence into m_pWriteBuf //------------------------------------------------------------------------------------- -int32_t XMLParser::ConvertEscape() -{ +int32_t XMLParser::ConvertEscape() { int32_t hr; wchar_t 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; + + // 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; + if (m_Ch == 'x') // hex number { - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; - - while ( m_Ch != ';' ) - { + if (FAILED(hr = AdvanceCharacter())) return hr; + + while (m_Ch != ';') { wVal *= 16; - if ( ( m_Ch >= '0' ) && ( m_Ch <= '9' ) ) - { + if ((m_Ch >= '0') && (m_Ch <= '9')) { wVal += m_Ch - '0'; - } - else if ( ( m_Ch >= 'a' ) && ( m_Ch <= 'f' ) ) - { + } else if ((m_Ch >= 'a') && (m_Ch <= 'f')) { wVal += m_Ch - 'a' + 10; - } - else if ( ( m_Ch >= 'A' ) && ( m_Ch <= 'F' ) ) - { + } 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" ); + } 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; + 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; } } @@ -189,440 +158,370 @@ int32_t XMLParser::ConvertEscape() m_Ch = wVal; return S_OK; - } + } // must be an entity reference - wchar_t *pEntityRefVal = m_pWritePtr; + wchar_t* pEntityRefVal = m_pWritePtr; uint32_t EntityRefLen; SkipNextAdvance(); - if( FAILED( hr = AdvanceName() ) ) - return hr; - - EntityRefLen = (uint32_t)( m_pWritePtr - pEntityRefVal ); + 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 &" ); + if (EntityRefLen == 0) { + Error(E_INVALID_XML_SYNTAX, "Expecting entity name after &"); return E_INVALID_XML_SYNTAX; } - if( !wcsncmp( pEntityRefVal, L"lt", EntityRefLen ) ) + if (!wcsncmp(pEntityRefVal, L"lt", EntityRefLen)) wVal = '<'; - else if( !wcsncmp( pEntityRefVal, L"gt", EntityRefLen ) ) + else if (!wcsncmp(pEntityRefVal, L"gt", EntityRefLen)) wVal = '>'; - else if( !wcsncmp( pEntityRefVal, L"amp", EntityRefLen ) ) + else if (!wcsncmp(pEntityRefVal, L"amp", EntityRefLen)) wVal = '&'; - else if( !wcsncmp( pEntityRefVal, L"apos", EntityRefLen ) ) + else if (!wcsncmp(pEntityRefVal, L"apos", EntityRefLen)) wVal = '\''; - else if( !wcsncmp( pEntityRefVal, L"quot", EntityRefLen ) ) + else if (!wcsncmp(pEntityRefVal, L"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 + 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 (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 ; + 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 S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::AdvanceAttrVal -// Desc: Copies an attribute value into m_pWrite buf, skipping surrounding quotes +// Desc: Copies an attribute value into m_pWrite buf, skipping surrounding +// quotes //------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceAttrVal() -{ +int32_t XMLParser::AdvanceAttrVal() { int32_t hr; wchar_t wQuoteChar; - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; + if (FAILED(hr = AdvanceCharacter())) return hr; - if( ( m_Ch != '"' ) && ( m_Ch != '\'' ) ) - { - Error( E_INVALID_XML_SYNTAX, "Attribute values must be enclosed in quotes" ); + 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 == '&' ) - { + + for (;;) { + if (FAILED(hr = AdvanceCharacter())) + return hr; + else if (m_Ch == wQuoteChar) + break; + else if (m_Ch == '&') { SkipNextAdvance(); - if( FAILED( hr = ConvertEscape() ) ) - return hr; + 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; } - 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; + + 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++; + m_pWritePtr++; } return S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::AdvanceName -// Desc: Copies a name into the m_pWriteBuf - returns true on success, false on failure +// 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 XMLParser::AdvanceName() { int32_t hr; - if( FAILED( hr = AdvanceCharacter() ) ) - return 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; + 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 ); + 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; + if (FAILED(hr = AdvanceCharacter())) return hr; } - + SkipNextAdvance(); return S_OK; } - //------------------------------------------------------------------------------------- // 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 +// Returns S_OK if there are more characters, E_ABORT for no characters to +// read //------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCharacter( bool bOkToFail ) -{ - if( m_bSkipNextAdvance ) - { +int32_t XMLParser::AdvanceCharacter(bool bOkToFail) { + if (m_bSkipNextAdvance) { m_bSkipNextAdvance = false; return S_OK; } // If we hit EOF in the middle of a character, - // it's ok-- we'll just have a corrupt last 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' ) ) - { + if ((m_pReadPtr[0] == '\0') && (m_pReadPtr[1] == '\0')) { // Read more from the file - FillBuffer(); + 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" ); + 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 - { + } else { return E_FAIL; } } - } + } - if( m_bUnicode == false ) - { - m_Ch = *((char *)m_pReadPtr); + if (m_bUnicode == false) { + m_Ch = *((char*)m_pReadPtr); m_pReadPtr++; - } - else // if( m_bUnicode == true ) + } else // if( m_bUnicode == true ) { - m_Ch = *((wchar_t *)m_pReadPtr); - - if( m_bReverseBytes ) - { - m_Ch = ( m_Ch << 8 ) + ( m_Ch >> 8 ); + m_Ch = *((wchar_t*)m_pReadPtr); + + if (m_bReverseBytes) { + m_Ch = (m_Ch << 8) + (m_Ch >> 8); } - - m_pReadPtr += 2; + + m_pReadPtr += 2; } - if( m_Ch == '\n' ) - { + if (m_Ch == '\n') { m_pISAXCallback->m_LineNum++; m_pISAXCallback->m_LinePos = 0; - } - else if( m_Ch != '\r' ) + } else if (m_Ch != '\r') m_pISAXCallback->m_LinePos++; - + return S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::AdvanceElement -// Desc: Builds data, calls callback +// Desc: Builds data, calls callback //------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceElement() -{ +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 ) ) ) ) + if (m_Ch != '[') { + Error(E_INVALID_XML_SYNTAX, "Expecting 'ElementEnd( + pEntityRefVal, (uint32_t)(m_pWritePtr - pEntityRefVal)))) return E_ABORT; - - if( FAILED( hr = ConsumeSpace() ) ) - return hr; - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; + if (FAILED(hr = ConsumeSpace())) return hr; - if( m_Ch != '>' ) - { - Error( E_INVALID_XML_SYNTAX, "Expecting '>' after name for closing entity reference" ); + 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 S_OK; - } - } - else - { - XMLAttribute Attributes[ XML_MAX_ATTRIBUTES_PER_ELEMENT ]; - uint32_t NumAttrs; + } 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; - wchar_t *pEntityRefVal = m_pWritePtr; - uint32_t EntityRefLen; + if (m_Ch == '>') return S_OK; + } + } else { + XMLAttribute Attributes[XML_MAX_ATTRIBUTES_PER_ELEMENT]; + uint32_t NumAttrs; + + wchar_t* pEntityRefVal = m_pWritePtr; + uint32_t EntityRefLen; NumAttrs = 0; - + SkipNextAdvance(); // Entity tag - if( FAILED( hr = AdvanceName() ) ) - return hr; + if (FAILED(hr = AdvanceName())) return hr; - EntityRefLen = (uint32_t)( m_pWritePtr - pEntityRefVal ); + EntityRefLen = (uint32_t)(m_pWritePtr - pEntityRefVal); + + if (FAILED(hr = ConsumeSpace())) return hr; + + if (FAILED(hr = AdvanceCharacter())) return hr; - if( FAILED( hr = ConsumeSpace() ) ) - return hr; - - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; - // read attributes - while( ( m_Ch != '>' ) && ( m_Ch != '/' ) ) - { + 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" ); + 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; } - - if( FAILED( hr = ConsumeSpace() ) ) - return hr; - Attributes[ NumAttrs ].strValue = m_pWritePtr; + Attributes[NumAttrs].strName = m_pWritePtr; - if( FAILED( hr = AdvanceAttrVal() ) ) - return hr; + // Attribute name + if (FAILED(hr = AdvanceName())) return hr; - Attributes[ NumAttrs ].ValueLen = (uint32_t)( m_pWritePtr - - Attributes[ NumAttrs ].strValue ); + 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 (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" ); + 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 ) ) ) + if (FAILED(m_pISAXCallback->ElementBegin( + pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) return E_ABORT; - if( FAILED( m_pISAXCallback->ElementEnd( pEntityRefVal, EntityRefLen ) ) ) + if (FAILED( + m_pISAXCallback->ElementEnd(pEntityRefVal, EntityRefLen))) return E_ABORT; - } - else - { - if( FAILED( m_pISAXCallback->ElementBegin( pEntityRefVal, EntityRefLen, - Attributes, NumAttrs ) ) ) + } else { + if (FAILED(m_pISAXCallback->ElementBegin( + pEntityRefVal, EntityRefLen, Attributes, NumAttrs))) return E_ABORT; } } @@ -630,55 +529,48 @@ int32_t XMLParser::AdvanceElement() return S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::AdvanceCDATA // Desc: Read a CDATA section //------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceCDATA() -{ +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; - + 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 ) ) + + if ((m_Ch == ']') && (wStage == 0)) wStage = 1; - else if( ( m_Ch == ']' ) && ( wStage == 1 ) ) + else if ((m_Ch == ']') && (wStage == 1)) wStage = 2; - else if( ( m_Ch == '>' ) && ( wStage == 2 ) ) - { + else if ((m_Ch == '>') && (wStage == 2)) { m_pWritePtr -= 3; break; - } - else + } 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 ) ) ) + 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 ) ) ) + + 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; - + if (FAILED(m_pISAXCallback->CDATAEnd())) return E_ABORT; + return S_OK; } @@ -686,124 +578,103 @@ int32_t XMLParser::AdvanceCDATA() // Name: XMLParser::AdvanceComment // Desk: Skips over a comment //------------------------------------------------------------------------------------- -int32_t XMLParser::AdvanceComment() -{ +int32_t XMLParser::AdvanceComment() { int32_t hr; uint16_t wStage; wStage = 0; - for( ;; ) - { - if( FAILED( hr = AdvanceCharacter() ) ) - return hr; - - if (( m_Ch == '-' ) && ( wStage == 0 )) + for (;;) { + if (FAILED(hr = AdvanceCharacter())) return hr; + + if ((m_Ch == '-') && (wStage == 0)) wStage = 1; - else if (( m_Ch == '-' ) && ( wStage == 1 )) + else if ((m_Ch == '-') && (wStage == 1)) wStage = 2; - else if (( m_Ch == '>' ) && ( wStage == 2 )) - break; + else if ((m_Ch == '>') && (wStage == 2)) + break; else - wStage = 0; + wStage = 0; } - + return S_OK; } - //------------------------------------------------------------------------------------- // Name: XMLParser::RegisterSAXCallbackInterface -// Desc: Registers callback interface +// Desc: Registers callback interface //------------------------------------------------------------------------------------- -void XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ) -{ +void XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) { m_pISAXCallback = pISAXCallback; } - //------------------------------------------------------------------------------------- // Name: XMLParser::GetSAXCallbackInterface -// Desc: Returns current callback interface +// Desc: Returns current callback interface //------------------------------------------------------------------------------------- -ISAXCallback* XMLParser::GetSAXCallbackInterface() -{ - return m_pISAXCallback; -} - +ISAXCallback* XMLParser::GetSAXCallbackInterface() { return m_pISAXCallback; } //------------------------------------------------------------------------------------- // Name: XMLParser::MainParseLoop // Desc: Main Loop to Parse Data - source agnostic //------------------------------------------------------------------------------------- -int32_t XMLParser::MainParseLoop() -{ +int32_t XMLParser::MainParseLoop() { bool bWhiteSpaceOnly = true; int32_t hr = S_OK; - if( FAILED( m_pISAXCallback->StartDocument() ) ) - return E_ABORT; - + if (FAILED(m_pISAXCallback->StartDocument())) return E_ABORT; + m_pWritePtr = m_pWriteBuf; FillBuffer(); - if ( *((wchar_t *) m_pReadBuf ) == 0xFEFF ) - { + if (*((wchar_t*)m_pReadBuf) == 0xFEFF) { m_bUnicode = true; m_bReverseBytes = false; m_pReadPtr += 2; - } - else if ( *((wchar_t *) m_pReadBuf ) == 0xFFFE ) - { + } else if (*((wchar_t*)m_pReadBuf) == 0xFFFE) { m_bUnicode = true; m_bReverseBytes = true; - m_pReadPtr += 2; - } - else if ( *((wchar_t *) m_pReadBuf ) == 0x003C ) - { - m_bUnicode = true; - m_bReverseBytes = false; - } - else if ( *((wchar_t *) m_pReadBuf ) == 0x3C00 ) - { + m_pReadPtr += 2; + } else if (*((wchar_t*)m_pReadBuf) == 0x003C) { m_bUnicode = true; - m_bReverseBytes = true; + m_bReverseBytes = false; + } else if (*((wchar_t*)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; } - 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; + + 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 S_OK; + + if (FAILED(m_pISAXCallback->EndDocument())) return E_ABORT; + + return S_OK; } - 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; + 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; } @@ -812,96 +683,82 @@ int32_t XMLParser::MainParseLoop() m_pWritePtr = m_pWriteBuf; - if( FAILED( hr = AdvanceElement() ) ) - return hr; + if (FAILED(hr = AdvanceElement())) return hr; m_pWritePtr = m_pWriteBuf; - } - else - { - if( m_Ch == '&' ) - { + } else { + if (m_Ch == '&') { SkipNextAdvance(); - if( FAILED( hr = ConvertEscape() ) ) - return hr; + if (FAILED(hr = ConvertEscape())) return hr; } - if( bWhiteSpaceOnly && ( m_Ch != ' ' ) && ( m_Ch != '\n' ) && ( m_Ch != '\r' ) && - ( m_Ch != '\t' ) ) - { + 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; + + 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 XMLParser::ParseXMLFile(const char* strFilename) { int32_t hr; - if( m_pISAXCallback == nullptr ) - return E_NOINTERFACE; + if (m_pISAXCallback == nullptr) return E_NOINTERFACE; - m_pISAXCallback->m_LineNum = 1; + 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_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_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 ); + 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" ); + if (m_hFile == INVALID_HANDLE_VALUE) { + Error(E_COULD_NOT_OPEN_FILE, "Error opening file"); hr = E_COULD_NOT_OPEN_FILE; - - } - else - { + + } else { LARGE_INTEGER iFileSize; - GetFileSizeEx( m_hFile, &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 ); + 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; + m_pISAXCallback->m_strFilename = nullptr; return hr; } @@ -910,56 +767,56 @@ int32_t XMLParser::ParseXMLFile( const char *strFilename ) // Name: XMLParser::ParseXMLFile // Desc: Builds element data //------------------------------------------------------------------------------------- -int32_t XMLParser::ParseXMLBuffer( const char *strBuffer, uint32_t uBufferSize ) -{ +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; + 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_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_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; + m_pISAXCallback->m_strFilename = nullptr; return hr; } //------------------------------------------------------------------------------------- -// XMLParser::Error() +// 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, ... ) +#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, ... ) +void XMLParser::Error(int32_t hErr, const char* strFormat, ...) #endif { const int32_t MAX_OUTPUT_STR = 160; - char strBuffer[ MAX_OUTPUT_STR ]; + char strBuffer[MAX_OUTPUT_STR]; va_list pArglist; - va_start( pArglist, strFormat ); + va_start(pArglist, strFormat); - vsprintf( strBuffer, strFormat, pArglist ); - - m_pISAXCallback->Error( hErr, strBuffer ); - va_end( pArglist ); + vsprintf(strBuffer, strFormat, pArglist); + + m_pISAXCallback->Error(hErr, strBuffer); + va_end(pArglist); } -} // namespace ATG +} // namespace ATG diff --git a/Minecraft.Client/Platform/Common/XML/ATGXmlParser.h b/Minecraft.Client/Platform/Common/XML/ATGXmlParser.h index 5f7178ecd..ab5b6bd48 100644 --- a/Minecraft.Client/Platform/Common/XML/ATGXmlParser.h +++ b/Minecraft.Client/Platform/Common/XML/ATGXmlParser.h @@ -1,8 +1,11 @@ // 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. +// 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 @@ -17,138 +20,138 @@ #ifndef ATGXMLPARSER_H #define ATGXMLPARSER_H -namespace ATG -{ +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 ) +#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; -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 +// No tag can be longer than XML_WRITE_BUFFER_SIZE - an error will be returned +// if it is //------------------------------------------------------------------------------------- -struct XMLAttribute -{ - wchar_t* strName; - uint32_t NameLen; - wchar_t* strValue; - uint32_t ValueLen; +struct XMLAttribute { + wchar_t* strName; + uint32_t NameLen; + wchar_t* strValue; + uint32_t ValueLen; }; //------------------------------------------------------------------------------------- -class ISAXCallback -{ -friend class XMLParser; +class ISAXCallback { + friend class XMLParser; + public: ISAXCallback() {}; virtual ~ISAXCallback() {}; - virtual int32_t StartDocument() = 0; - virtual int32_t EndDocument() = 0; + virtual int32_t StartDocument() = 0; + virtual int32_t EndDocument() = 0; - virtual int32_t ElementBegin( const wchar_t* strName, uint32_t NameLen, - const XMLAttribute *pAttributes, uint32_t NumAttributes ) = 0; - virtual int32_t ElementContent( const wchar_t *strData, uint32_t DataLen, bool More ) = 0; - virtual int32_t ElementEnd( const wchar_t *strName, uint32_t NameLen ) = 0; + virtual int32_t ElementBegin(const wchar_t* strName, uint32_t NameLen, + const XMLAttribute* pAttributes, + uint32_t NumAttributes) = 0; + virtual int32_t ElementContent(const wchar_t* strData, uint32_t DataLen, + bool More) = 0; + virtual int32_t ElementEnd(const wchar_t* strName, uint32_t NameLen) = 0; - virtual int32_t CDATABegin( ) = 0; - virtual int32_t CDATAData( const wchar_t *strCDATA, uint32_t CDATALen, bool bMore ) = 0; - virtual int32_t CDATAEnd( ) = 0; + virtual int32_t CDATABegin() = 0; + virtual int32_t CDATAData(const wchar_t* strCDATA, uint32_t CDATALen, + bool bMore) = 0; + virtual int32_t CDATAEnd() = 0; - virtual void Error( int32_t hError, const char *strMessage ) = 0; + virtual void Error(int32_t hError, const char* strMessage) = 0; - virtual void SetParseProgress( uint32_t dwProgress ) { } + virtual void SetParseProgress(uint32_t dwProgress) {} - const char* GetFilename() { return m_strFilename; } - uint32_t GetLineNumber() { return m_LineNum; } - uint32_t GetLinePosition() { return m_LinePos; } + 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; + const char* m_strFilename; + uint32_t m_LineNum; + uint32_t m_LinePos; }; - //------------------------------------------------------------------------------------- -class XMLParser -{ -public: +class XMLParser { +public: XMLParser(); ~XMLParser(); - + // Register an interface inheiriting from ISAXCallback - void RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ); - + void RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback); + // Get the registered interface - ISAXCallback* GetSAXCallbackInterface(); + ISAXCallback* GetSAXCallbackInterface(); // ParseXMLFile returns one of the following: - // E_COULD_NOT_OPEN_FILE - couldn't open the file + // 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 + // S_OK - file parsed and completed - int32_t ParseXMLFile( const char *strFilename ); - - // Parses from a buffer- if you pass a wchar_t buffer (and cast it), it will - // correctly detect it and use unicode instead. Return codes are the - // same as for ParseXMLFile + int32_t ParseXMLFile(const char* strFilename); - int32_t ParseXMLBuffer( const char* strBuffer, uint32_t uBufferSize ); + // Parses from a buffer- if you pass a wchar_t buffer (and cast it), it + // will + // correctly detect it and use unicode instead. Return codes are + // the same as for ParseXMLFile -private: - int32_t MainParseLoop(); + int32_t ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize); - int32_t AdvanceCharacter( bool bOkToFail = false ); - void SkipNextAdvance(); +private: + int32_t MainParseLoop(); - int32_t ConsumeSpace(); - int32_t ConvertEscape(); - int32_t AdvanceElement(); - int32_t AdvanceName(); - int32_t AdvanceAttrVal(); - int32_t AdvanceCDATA(); - int32_t AdvanceComment(); + int32_t AdvanceCharacter(bool bOkToFail = false); + void SkipNextAdvance(); - 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, ... ); + 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, ... ); + void Error(int32_t hRet, const char* strFormat, ...); #endif - ISAXCallback* m_pISAXCallback; + ISAXCallback* m_pISAXCallback; - void* m_hFile; - const char* m_pInXMLBuffer; - uint32_t m_uInXMLBufferCharsLeft; - uint32_t m_dwCharsTotal; - uint32_t m_dwCharsConsumed; + 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 - wchar_t m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; + uint8_t m_pReadBuf[XML_READ_BUFFER_SIZE + 2]; // room for a trailing NULL + wchar_t m_pWriteBuf[XML_WRITE_BUFFER_SIZE]; - uint8_t* m_pReadPtr; - wchar_t* m_pWritePtr; // write pointer within m_pBuf + uint8_t* m_pReadPtr; + wchar_t* 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; - wchar_t m_Ch; // Current character being parsed + bool m_bUnicode; // true = 16-bits, false = 8-bits + bool m_bReverseBytes; // true = reverse bytes, false = don't reverse + + bool m_bSkipNextAdvance; + wchar_t m_Ch; // Current character being parsed }; } // namespace ATG diff --git a/Minecraft.Client/Platform/Common/XML/xmlFilesCallback.h b/Minecraft.Client/Platform/Common/XML/xmlFilesCallback.h index 7784d676f..54b2c9e7f 100644 --- a/Minecraft.Client/Platform/Common/XML/xmlFilesCallback.h +++ b/Minecraft.Client/Platform/Common/XML/xmlFilesCallback.h @@ -6,326 +6,299 @@ using namespace ATG; -class xmlMojangCallback : public ATG::ISAXCallback -{ +class xmlMojangCallback : public ATG::ISAXCallback { public: - virtual int32_t StartDocument() { return S_OK; }; - virtual int32_t EndDocument() { return S_OK; }; + virtual int32_t StartDocument() { return S_OK; }; + virtual int32_t EndDocument() { return S_OK; }; - virtual int32_t ElementBegin( const wchar_t* strName, uint32_t NameLen, const XMLAttribute *pAttributes, uint32_t NumAttributes ) - { - wchar_t wTemp[35] = L""; - wchar_t wAttName[32] = L""; - wchar_t wNameXUID[32] = L""; - wchar_t wNameSkin[32] = L""; - wchar_t wNameCloak[32] = L""; - PlayerUID xuid=0LL; + virtual int32_t ElementBegin(const wchar_t* strName, uint32_t NameLen, + const XMLAttribute* pAttributes, + uint32_t NumAttributes) { + wchar_t wTemp[35] = L""; + wchar_t wAttName[32] = L""; + wchar_t wNameXUID[32] = L""; + wchar_t wNameSkin[32] = L""; + wchar_t wNameCloak[32] = L""; + PlayerUID xuid = 0LL; + if (NameLen > 31) + return S_FALSE; + else + wcsncpy(wAttName, strName, NameLen); - if (NameLen >31) - return S_FALSE; - else - wcsncpy( wAttName, strName, NameLen); + if (_wcsicmp(wAttName, L"root") == 0) { + return S_OK; + } else if (_wcsicmp(wAttName, L"data") == 0) { + for (uint32_t i = 0; i < NumAttributes; i++) { + wcsncpy_s(wAttName, pAttributes[i].strName, + pAttributes[i].NameLen); + if (_wcsicmp(wAttName, L"name") == 0) { + if (pAttributes[i].ValueLen <= 32) + wcsncpy_s(wNameXUID, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } else if (_wcsicmp(wAttName, L"xuid") == 0) { + if (pAttributes[i].ValueLen <= 32) { + ZeroMemory(wTemp, sizeof(wchar_t) * 35); + wcsncpy_s(wTemp, pAttributes[i].strValue, + pAttributes[i].ValueLen); + xuid = _wcstoui64(wTemp, nullptr, 10); + } + } else if (_wcsicmp(wAttName, L"cape") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wNameCloak, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } else if (_wcsicmp(wAttName, L"skin") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wNameSkin, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } + } - if ( _wcsicmp(wAttName,L"root") == 0) - { - return S_OK; - } - else if ( _wcsicmp(wAttName,L"data") == 0) - { - for(uint32_t i = 0; i < NumAttributes; i++) - { - wcsncpy_s( wAttName, pAttributes[i].strName, pAttributes[i].NameLen); - if (_wcsicmp(wAttName,L"name")==0) - { - if (pAttributes[i].ValueLen <= 32) - wcsncpy_s( wNameXUID, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - else if (_wcsicmp(wAttName,L"xuid")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - ZeroMemory(wTemp,sizeof(wchar_t)*35); - wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - xuid=_wcstoui64(wTemp,nullptr,10); - } - } - else if (_wcsicmp(wAttName,L"cape")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wNameCloak, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } - else if (_wcsicmp(wAttName,L"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 CConsoleMinecraftApp::RegisterMojangData( + wNameXUID, xuid, wNameSkin, wNameCloak); + } else + return S_FALSE; + } else { + return S_FALSE; + } + }; - } + virtual int32_t ElementContent(const wchar_t* strData, uint32_t DataLen, + bool More) { + return S_OK; + }; - // if the xuid hasn't been defined, then we can't use the data - if(xuid!=0LL) - { - return CConsoleMinecraftApp::RegisterMojangData(wNameXUID , xuid, wNameSkin, wNameCloak ); - } - else return S_FALSE; - } - else - { - return S_FALSE; - } - }; + virtual int32_t ElementEnd(const wchar_t* strName, uint32_t NameLen) { + return S_OK; + }; - virtual int32_t ElementContent( const wchar_t *strData, uint32_t DataLen, bool More ) { return S_OK; }; + virtual int32_t CDATABegin() { return S_OK; }; - virtual int32_t ElementEnd( const wchar_t *strName, uint32_t NameLen ){ return S_OK; }; + virtual int32_t CDATAData(const wchar_t* strCDATA, uint32_t CDATALen, + bool bMore) { + return S_OK; + }; - virtual int32_t CDATABegin( ) { return S_OK; }; - - virtual int32_t CDATAData( const wchar_t *strCDATA, uint32_t CDATALen, bool bMore ){ return S_OK; }; - - virtual int32_t CDATAEnd( ){ return S_OK; }; - - virtual void Error( int32_t hError, const char *strMessage ) { app.DebugPrintf("Error when Parsing xuids.XML\n"); }; + virtual int32_t CDATAEnd() { return S_OK; }; + virtual void Error(int32_t hError, const char* strMessage) { + app.DebugPrintf("Error when Parsing xuids.XML\n"); + }; }; -class xmlConfigCallback : public ATG::ISAXCallback -{ +class xmlConfigCallback : public ATG::ISAXCallback { public: - virtual int32_t StartDocument() { return S_OK; }; - virtual int32_t EndDocument() { return S_OK; }; + virtual int32_t StartDocument() { return S_OK; }; + virtual int32_t EndDocument() { return S_OK; }; - virtual int32_t ElementBegin( const wchar_t* strName, uint32_t NameLen, const XMLAttribute *pAttributes, uint32_t NumAttributes ) - { - wchar_t wTemp[35] = L""; - wchar_t wType[32] = L""; - wchar_t wAttName[32] = L""; - wchar_t wValue[32] = L""; - int iValue=-1; + virtual int32_t ElementBegin(const wchar_t* strName, uint32_t NameLen, + const XMLAttribute* pAttributes, + uint32_t NumAttributes) { + wchar_t wTemp[35] = L""; + wchar_t wType[32] = L""; + wchar_t wAttName[32] = L""; + wchar_t wValue[32] = L""; + int iValue = -1; - if (NameLen >31) - return S_FALSE; - else - wcsncpy_s( wAttName, strName, NameLen); + if (NameLen > 31) + return S_FALSE; + else + wcsncpy_s(wAttName, strName, NameLen); - if ( _wcsicmp(wAttName,L"root") == 0) - { - return S_OK; - } - else if ( _wcsicmp(wAttName,L"data") == 0) - { - for(uint32_t i = 0; i < NumAttributes; i++) - { - wcsncpy_s( wAttName, pAttributes[i].strName, pAttributes[i].NameLen); - if (_wcsicmp(wAttName,L"Type")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wType, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } - else if(_wcsicmp(wAttName,L"Value")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wValue, pAttributes[i].strValue, pAttributes[i].ValueLen); + if (_wcsicmp(wAttName, L"root") == 0) { + return S_OK; + } else if (_wcsicmp(wAttName, L"data") == 0) { + for (uint32_t i = 0; i < NumAttributes; i++) { + wcsncpy_s(wAttName, pAttributes[i].strName, + pAttributes[i].NameLen); + if (_wcsicmp(wAttName, L"Type") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wType, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } else if (_wcsicmp(wAttName, L"Value") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wValue, pAttributes[i].strValue, + pAttributes[i].ValueLen); - iValue=wcstol(wValue, nullptr, 10); - } - } - } - - // if the xuid hasn't been defined, then we can't use the data - if(iValue!=-1) - { + iValue = wcstol(wValue, nullptr, 10); + } + } + } + + // if the xuid hasn't been defined, then we can't use the data + if (iValue != -1) { #if defined(_DEBUG) - wprintf(L"Type - %s, Value - %d, ",wType, iValue); + wprintf(L"Type - %s, Value - %d, ", wType, iValue); #endif - return CConsoleMinecraftApp::RegisterConfigValues(wType, iValue ); - } - else - { - return S_FALSE; - } - } - else - { - return S_FALSE; - } - } + return CConsoleMinecraftApp::RegisterConfigValues(wType, + iValue); + } else { + return S_FALSE; + } + } else { + return S_FALSE; + } + } + virtual int32_t ElementContent(const wchar_t* strData, uint32_t DataLen, + bool More) { + return S_OK; + }; - virtual int32_t ElementContent( const wchar_t *strData, uint32_t DataLen, bool More ) { return S_OK; }; + virtual int32_t ElementEnd(const wchar_t* strName, uint32_t NameLen) { + return S_OK; + }; - virtual int32_t ElementEnd( const wchar_t *strName, uint32_t NameLen ){ return S_OK; }; + virtual int32_t CDATABegin() { return S_OK; }; - virtual int32_t CDATABegin( ) { return S_OK; }; + virtual int32_t CDATAData(const wchar_t* strCDATA, uint32_t CDATALen, + bool bMore) { + return S_OK; + }; - virtual int32_t CDATAData( const wchar_t *strCDATA, uint32_t CDATALen, bool bMore ){ return S_OK; }; - - virtual int32_t CDATAEnd( ){ return S_OK; }; - - virtual void Error( int32_t hError, const char *strMessage ) { app.DebugPrintf("Error when Parsing xuids.XML\n"); }; + virtual int32_t CDATAEnd() { return S_OK; }; + virtual void Error(int32_t hError, const char* strMessage) { + app.DebugPrintf("Error when Parsing xuids.XML\n"); + }; }; -class xmlDLCInfoCallback : public ATG::ISAXCallback -{ +class xmlDLCInfoCallback : public ATG::ISAXCallback { public: - virtual int32_t StartDocument() { return S_OK; }; - virtual int32_t EndDocument() { return S_OK; }; + virtual int32_t StartDocument() { return S_OK; }; + virtual int32_t EndDocument() { return S_OK; }; - virtual int32_t ElementBegin( const wchar_t* strName, uint32_t NameLen, const XMLAttribute *pAttributes, uint32_t NumAttributes ) - { - wchar_t wTemp[35] = L""; - wchar_t wAttName[32] = L""; - wchar_t wNameBanner[32] = L""; - wchar_t wDataFile[32] = L""; - wchar_t wType[32] = L""; - wchar_t wFirstSkin[32] = L""; - wchar_t wConfig[32] = L""; - uint64_t ullFull=0ll; - uint64_t ullTrial=0ll; - unsigned int uiSortIndex=0L; - int iGender=0; - int iConfig=0; + virtual int32_t ElementBegin(const wchar_t* strName, uint32_t NameLen, + const XMLAttribute* pAttributes, + uint32_t NumAttributes) { + wchar_t wTemp[35] = L""; + wchar_t wAttName[32] = L""; + wchar_t wNameBanner[32] = L""; + wchar_t wDataFile[32] = L""; + wchar_t wType[32] = L""; + wchar_t wFirstSkin[32] = L""; + wchar_t wConfig[32] = L""; + uint64_t ullFull = 0ll; + uint64_t ullTrial = 0ll; + unsigned int uiSortIndex = 0L; + int iGender = 0; + int iConfig = 0; - if (NameLen >31) - return S_FALSE; - else - wcsncpy_s( wAttName, strName, NameLen); + if (NameLen > 31) + return S_FALSE; + else + wcsncpy_s(wAttName, strName, NameLen); - if ( _wcsicmp(wAttName,L"root") == 0) - { - return S_OK; - } - else if ( _wcsicmp(wAttName,L"data") == 0) - { - for(uint32_t i = 0; i < NumAttributes; i++) - { - wcsncpy_s( wAttName, pAttributes[i].strName, pAttributes[i].NameLen); - if (_wcsicmp(wAttName,L"SortIndex")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - ZeroMemory(wTemp,sizeof(wchar_t)*35); - wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - uiSortIndex=wcstoul(wTemp,nullptr,16); - } - } - else if (_wcsicmp(wAttName,L"Banner")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wNameBanner, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } - else if (_wcsicmp(wAttName,L"Full")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - ZeroMemory(wTemp,sizeof(wchar_t)*35); - wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullFull=_wcstoui64(wTemp,nullptr,16); - } - } - else if (_wcsicmp(wAttName,L"Trial")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - ZeroMemory(wTemp,sizeof(wchar_t)*35); - wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullTrial=_wcstoui64(wTemp,nullptr,16); - } - } - else if (_wcsicmp(wAttName,L"FirstSkin")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wFirstSkin, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } - else if (_wcsicmp(wAttName,L"Type")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wType, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } - else if (_wcsicmp(wAttName,L"Gender")==0) - { - if (_wcsicmp(wAttName,L"Male")==0) - { - iGender=1; - } - else if (_wcsicmp(wAttName,L"Female")==0) - { - iGender=2; - } - else - { - iGender=0; - } - } - else if(_wcsicmp(wAttName,L"Config")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wConfig, pAttributes[i].strValue, pAttributes[i].ValueLen); + if (_wcsicmp(wAttName, L"root") == 0) { + return S_OK; + } else if (_wcsicmp(wAttName, L"data") == 0) { + for (uint32_t i = 0; i < NumAttributes; i++) { + wcsncpy_s(wAttName, pAttributes[i].strName, + pAttributes[i].NameLen); + if (_wcsicmp(wAttName, L"SortIndex") == 0) { + if (pAttributes[i].ValueLen <= 32) { + ZeroMemory(wTemp, sizeof(wchar_t) * 35); + wcsncpy_s(wTemp, pAttributes[i].strValue, + pAttributes[i].ValueLen); + uiSortIndex = wcstoul(wTemp, nullptr, 16); + } + } else if (_wcsicmp(wAttName, L"Banner") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wNameBanner, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } else if (_wcsicmp(wAttName, L"Full") == 0) { + if (pAttributes[i].ValueLen <= 32) { + ZeroMemory(wTemp, sizeof(wchar_t) * 35); + wcsncpy_s(wTemp, pAttributes[i].strValue, + pAttributes[i].ValueLen); + ullFull = _wcstoui64(wTemp, nullptr, 16); + } + } else if (_wcsicmp(wAttName, L"Trial") == 0) { + if (pAttributes[i].ValueLen <= 32) { + ZeroMemory(wTemp, sizeof(wchar_t) * 35); + wcsncpy_s(wTemp, pAttributes[i].strValue, + pAttributes[i].ValueLen); + ullTrial = _wcstoui64(wTemp, nullptr, 16); + } + } else if (_wcsicmp(wAttName, L"FirstSkin") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wFirstSkin, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } else if (_wcsicmp(wAttName, L"Type") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wType, pAttributes[i].strValue, + pAttributes[i].ValueLen); + } + } else if (_wcsicmp(wAttName, L"Gender") == 0) { + if (_wcsicmp(wAttName, L"Male") == 0) { + iGender = 1; + } else if (_wcsicmp(wAttName, L"Female") == 0) { + iGender = 2; + } else { + iGender = 0; + } + } else if (_wcsicmp(wAttName, L"Config") == 0) { + if (pAttributes[i].ValueLen <= 32) { + wcsncpy_s(wConfig, pAttributes[i].strValue, + pAttributes[i].ValueLen); - iConfig=wcstol(wConfig, nullptr, 10); - } - } - else if (_wcsicmp(wAttName,L"DataFile")==0) - { - if (pAttributes[i].ValueLen <= 32) - { - wcsncpy_s( wDataFile, pAttributes[i].strValue, pAttributes[i].ValueLen); - } - } + iConfig = wcstol(wConfig, nullptr, 10); + } + } else if (_wcsicmp(wAttName, L"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 the xuid hasn't been defined, then we can't use the data + if (ullFull != 0LL) { #if defined(_DEBUG) - wprintf(L"Type - %ls, Name - %ls, ",wType, wNameBanner); + wprintf(L"Type - %ls, Name - %ls, ", wType, wNameBanner); #endif - app.DebugPrintf("Full = %lld, Trial %lld\n",ullFull,ullTrial); + app.DebugPrintf("Full = %lld, Trial %lld\n", ullFull, ullTrial); - return CConsoleMinecraftApp::RegisterDLCData(wType, wNameBanner , iGender, ullFull, ullTrial, wFirstSkin, uiSortIndex, iConfig, wDataFile ); - } - else - { - return S_FALSE; - } - } - else - { - return S_FALSE; - } - }; + return CConsoleMinecraftApp::RegisterDLCData( + wType, wNameBanner, iGender, ullFull, ullTrial, wFirstSkin, + uiSortIndex, iConfig, wDataFile); + } else { + return S_FALSE; + } + } else { + return S_FALSE; + } + }; - virtual int32_t ElementContent( const wchar_t *strData, uint32_t DataLen, bool More ) { return S_OK; }; + virtual int32_t ElementContent(const wchar_t* strData, uint32_t DataLen, + bool More) { + return S_OK; + }; - virtual int32_t ElementEnd( const wchar_t *strName, uint32_t NameLen ){ return S_OK; }; + virtual int32_t ElementEnd(const wchar_t* strName, uint32_t NameLen) { + return S_OK; + }; - virtual int32_t CDATABegin( ) { return S_OK; }; + virtual int32_t CDATABegin() { return S_OK; }; - virtual int32_t CDATAData( const wchar_t *strCDATA, uint32_t CDATALen, bool bMore ){ return S_OK; }; + virtual int32_t CDATAData(const wchar_t* strCDATA, uint32_t CDATALen, + bool bMore) { + return S_OK; + }; - virtual int32_t CDATAEnd( ){ return S_OK; }; - - virtual void Error( int32_t hError, const char *strMessage ) { app.DebugPrintf("Error when Parsing DLC.XML\n"); }; + virtual int32_t CDATAEnd() { return S_OK; }; + virtual void Error(int32_t hError, const char* strMessage) { + app.DebugPrintf("Error when Parsing DLC.XML\n"); + }; }; - #endif diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 9401c9969..958d7ad7a 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -//#include +// #include #if defined(_WINDOWS64) #include "../Platform/Windows64/Sentient/SentientManager.h" @@ -8,8 +8,9 @@ #include "../Platform/Windows64/Sentient/DynamicConfigurations.h" #elif defined(__linux__) // On Linux, stdafx.h already provides Orbis-compatible Sentient/Dynamic headers -// via #pragma once. Pull in SentientManager for CSentientManager class declaration -// and StatsCounter; CSocialManager is provided as inline stubs via Platform/Linux/Social/SocialManager.h. +// via #pragma once. Pull in SentientManager for CSentientManager class +// declaration and StatsCounter; CSocialManager is provided as inline stubs via +// Platform/Linux/Social/SocialManager.h. #include "../Platform/Linux/Sentient/SentientManager.h" #include "../GameState/StatsCounter.h" #else @@ -17,80 +18,99 @@ #endif #if defined(_WINDOWS64) -//C4JStorage StorageManager; +// C4JStorage StorageManager; C_4JProfile ProfileManager; #endif CSentientManager SentientManager; #if !defined(__linux__) -// On Linux this global shadows the project's StringTable class name in unity builds +// On Linux this global shadows the project's StringTable class name in unity +// builds CXuiStringTable StringTable; #endif #if !defined(__linux__) ATG::XMLParser::XMLParser() {} ATG::XMLParser::~XMLParser() {} -int32_t ATG::XMLParser::ParseXMLBuffer( const char* strBuffer, uint32_t uBufferSize ) { return S_OK; } -void ATG::XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ) {} +int32_t ATG::XMLParser::ParseXMLBuffer(const char* strBuffer, + uint32_t uBufferSize) { + return S_OK; +} +void ATG::XMLParser::RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback) { +} #endif #if !defined(__linux__) -bool CSocialManager::IsTitleAllowedToPostAnything() { return false; } -bool CSocialManager::AreAllUsersAllowedToPostImages() { return false; } -bool CSocialManager::IsTitleAllowedToPostImages() { return false; } +bool CSocialManager::IsTitleAllowedToPostAnything() { return false; } +bool CSocialManager::AreAllUsersAllowedToPostImages() { return false; } +bool CSocialManager::IsTitleAllowedToPostImages() { return false; } -bool CSocialManager::PostLinkToSocialNetwork( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ) { return false; } -bool CSocialManager::PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ) { return false; } +bool CSocialManager::PostLinkToSocialNetwork(ESocialNetwork eSocialNetwork, + uint32_t dwUserIndex, + bool bUsingKinect) { + return false; +} +bool CSocialManager::PostImageToSocialNetwork(ESocialNetwork eSocialNetwork, + uint32_t dwUserIndex, + bool bUsingKinect) { + return false; +} -CSocialManager *CSocialManager::Instance() { return nullptr; } -void CSocialManager::SetSocialPostText(const wchar_t* Title, const wchar_t* Caption, const wchar_t* Desc) {}; +CSocialManager* CSocialManager::Instance() { return nullptr; } +void CSocialManager::SetSocialPostText(const wchar_t* Title, + const wchar_t* Caption, + const wchar_t* Desc) {}; #endif uint32_t XShowPartyUI(uint32_t dwUserIndex) { return 0; } uint32_t XShowFriendsUI(uint32_t dwUserIndex) { return 0; } -int32_t XPartyGetUserList(XPARTY_USER_LIST *pUserList) { return S_OK; } -uint32_t XContentGetThumbnail(uint32_t dwUserIndex, const XCONTENT_DATA *pContentData, uint8_t* pbThumbnail, uint32_t* pcbThumbnail, PXOVERLAPPED *pOverlapped) { return 0; } +int32_t XPartyGetUserList(XPARTY_USER_LIST* pUserList) { return S_OK; } +uint32_t XContentGetThumbnail(uint32_t dwUserIndex, + const XCONTENT_DATA* pContentData, + uint8_t* pbThumbnail, uint32_t* pcbThumbnail, + PXOVERLAPPED* pOverlapped) { + return 0; +} void XShowAchievementsUI(int i) {} -uint32_t XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } +uint32_t XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { + return 0; +} -void PIXAddNamedCounter(int a, const char *b, ...) {} -//#define PS3_USE_PIX_EVENTS -//#define PS4_USE_PIX_EVENTS -void PIXBeginNamedEvent(int a, const char *b, ...) -{ +void PIXAddNamedCounter(int a, const char* b, ...) {} +// #define PS3_USE_PIX_EVENTS +// #define PS4_USE_PIX_EVENTS +void PIXBeginNamedEvent(int a, const char* b, ...) { #if defined(PS4_USE_PIX_EVENTS) - char buf[512]; + char buf[512]; va_list args; - va_start(args,b); - vsprintf(buf,b,args); - sceRazorCpuPushMarker(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD); + va_start(args, b); + vsprintf(buf, b, args); + sceRazorCpuPushMarker(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD); #endif #if defined(PS3_USE_PIX_EVENTS) - char buf[256]; - wchar_t wbuf[256]; + char buf[256]; + wchar_t wbuf[256]; va_list args; - va_start(args,b); - vsprintf(buf,b,args); - snPushMarker(buf); + va_start(args, b); + vsprintf(buf, b, args); + snPushMarker(buf); -// mbstowcs(wbuf,buf,256); -// RenderManager.BeginEvent(wbuf); + // mbstowcs(wbuf,buf,256); + // RenderManager.BeginEvent(wbuf); va_end(args); #endif } - -void PIXEndNamedEvent() -{ +void PIXEndNamedEvent() { #if defined(PS4_USE_PIX_EVENTS) - sceRazorCpuPopMarker(); + sceRazorCpuPopMarker(); #endif #if defined(PS3_USE_PIX_EVENTS) - snPopMarker(); + snPopMarker(); // RenderManager.EndEvent(); #endif } -void PIXSetMarkerDeprecated(int a, char *b, ...) {} +void PIXSetMarkerDeprecated(int a, char* b, ...) {} // void *D3DXBUFFER::GetBufferPointer() { return nullptr; } // int D3DXBUFFER::GetBufferSize() { return 0; } @@ -100,37 +120,46 @@ void PIXSetMarkerDeprecated(int a, char *b, ...) {} // void GetLocalTime(SYSTEMTIME *time) {} // #endif +bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; } -bool IsEqualXUID(PlayerUID a, PlayerUID b) -{ - return false; +void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); } +void XMemSet(void* a, int t, size_t s) { memset(a, t, s); } +void XMemSet128(void* a, int t, size_t s) { memset(a, t, s); } +void* XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d) { + return malloc(a); } - -void XMemCpy(void *a, const void *b, size_t s) { memcpy(a, b, s); } -void XMemSet(void *a, int t, size_t s) { memset(a, t, s); } -void XMemSet128(void *a, int t, size_t s) { memset(a, t, s); } -void *XPhysicalAlloc(size_t a, uintptr_t b, uintptr_t c, uint32_t d) { return malloc(a); } -void XPhysicalFree(void *a) { free(a); } +void XPhysicalFree(void* a) { free(a); } D3DXVECTOR3::D3DXVECTOR3() {} -D3DXVECTOR3::D3DXVECTOR3(float x,float y,float z) : x(x), y(y), z(z) {} -D3DXVECTOR3& D3DXVECTOR3::operator += ( const D3DXVECTOR3& add ) { x += add.x; y += add.y; z += add.z; return *this; } +D3DXVECTOR3::D3DXVECTOR3(float x, float y, float z) : x(x), y(y), z(z) {} +D3DXVECTOR3& D3DXVECTOR3::operator+=(const D3DXVECTOR3& add) { + x += add.x; + y += add.y; + z += add.z; + return *this; +} uint8_t IQNetPlayer::GetSmallId() { return 0; } -void IQNetPlayer::SendData(IQNetPlayer *player, const void *pvData, uint32_t dwDataSize, uint32_t dwFlags) -{ +void IQNetPlayer::SendData(IQNetPlayer* player, const void* pvData, + uint32_t dwDataSize, uint32_t dwFlags) { #if !defined(__linux__) - app.DebugPrintf("Sending from 0x%x to 0x%x %d bytes\n",this,player,dwDataSize); + app.DebugPrintf("Sending from 0x%x to 0x%x %d bytes\n", this, player, + dwDataSize); #endif } -bool IQNetPlayer::IsSameSystem(IQNetPlayer *player) { return true; } -uint32_t IQNetPlayer::GetSendQueueSize( IQNetPlayer *player, uint32_t dwFlags ) { return 0; } +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 wchar_t* IQNetPlayer::GetGamertag() { static const wchar_t *test = L"stub"; return test; } +const wchar_t* IQNetPlayer::GetGamertag() { + static const wchar_t* test = L"stub"; + return test; +} int IQNetPlayer::GetSessionIndex() { return 0; } bool IQNetPlayer::IsTalking() { return false; } bool IQNetPlayer::IsMutedByLocalUser(uint32_t dwUserIndex) { return false; } @@ -138,43 +167,48 @@ 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; + m_customData = ulpCustomDataValue; } +uintptr_t IQNetPlayer::GetCustomDataValue() { return m_customData; } IQNetPlayer IQNet::m_player[4]; bool _bQNetStubGameRunning = false; -int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex){ return S_OK; } -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]; } +int32_t IQNet::AddLocalPlayerByUserIndex(uint32_t dwUserIndex) { return S_OK; } +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 _bQNetStubGameRunning ? QNET_STATE_GAME_PLAY : QNET_STATE_IDLE; } +QNET_STATE IQNet::GetState() { + return _bQNetStubGameRunning ? 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 S_OK; } +int32_t IQNet::JoinGameFromInviteInfo(uint32_t dwUserIndex, uint32_t dwUserMask, + const INVITE_INFO* pInviteInfo) { + return S_OK; +} void IQNet::HostGame() { _bQNetStubGameRunning = true; } void IQNet::EndGame() { _bQNetStubGameRunning = false; } -uint32_t MinecraftDynamicConfigurations::GetTrialTime() { return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; } +uint32_t MinecraftDynamicConfigurations::GetTrialTime() { + return DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; +} void XSetThreadProcessor(void* a, int b) {} // #if !(0) && !(0) // bool XCloseHandle(void* a) { return CloseHandle(a); } // #endif // 0 -uint32_t XUserGetSigninInfo( - uint32_t dwUserIndex, - uint32_t dwFlags, - PXUSER_SIGNIN_INFO pSigninInfo -) -{ - return 0; +uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, + PXUSER_SIGNIN_INFO pSigninInfo) { + return 0; } const wchar_t* CXuiStringTable::Lookup(const wchar_t* szId) { return szId; } @@ -182,337 +216,491 @@ const wchar_t* CXuiStringTable::Lookup(uint32_t nIndex) { return L"String"; } void CXuiStringTable::Clear() {} int32_t CXuiStringTable::Load(const wchar_t* szId) { return S_OK; } -uint32_t XUserAreUsersFriends( uint32_t dwUserIndex, PPlayerUID pXuids, uint32_t dwXuidCount, bool* pfResult, void *pOverlapped) { return 0; } - -int32_t XMemDecompress( - XMEMDECOMPRESSION_CONTEXT Context, - void *pDestination, - size_t *pDestSize, - void *pSource, - size_t SrcSize -) -{ - memcpy(pDestination, pSource, SrcSize); - *pDestSize = SrcSize; - return S_OK; - - /* - DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; - if( Decompress( - Decompressor, // Decompressor handle - (void *)pSource, // Compressed data - SrcSize, // Compressed data size - pDestination, // Decompressed buffer - *pDestSize, // Decompressed buffer size - pDestSize) ) // Decompressed data size - { - return S_OK; - } - else - */ - { - return E_FAIL; - } +uint32_t XUserAreUsersFriends(uint32_t dwUserIndex, PPlayerUID pXuids, + uint32_t dwXuidCount, bool* pfResult, + void* pOverlapped) { + return 0; } -int32_t XMemCompress( - XMEMCOMPRESSION_CONTEXT Context, - void *pDestination, - size_t *pDestSize, - void *pSource, - size_t SrcSize -) -{ - memcpy(pDestination, pSource, SrcSize); - *pDestSize = SrcSize; - return S_OK; +int32_t XMemDecompress(XMEMDECOMPRESSION_CONTEXT Context, void* pDestination, + size_t* pDestSize, void* pSource, size_t SrcSize) { + memcpy(pDestination, pSource, SrcSize); + *pDestSize = SrcSize; + return S_OK; - /* - COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; - if( Compress( - Compressor, // Compressor Handle - (void *)pSource, // Input buffer, Uncompressed data - SrcSize, // Uncompressed data size - pDestination, // Compressed Buffer - *pDestSize, // Compressed Buffer size - pDestSize) ) // Compressed Data size - { - return S_OK; - } - else - */ - { - return E_FAIL; - } + /* + DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; + if( Decompress( + Decompressor, // Decompressor handle + (void *)pSource, // Compressed data + SrcSize, // Compressed data size + pDestination, // Decompressed buffer + *pDestSize, // Decompressed buffer size + pDestSize) ) // Decompressed data size + { + return S_OK; + } + else + */ + { + return E_FAIL; + } } -int32_t XMemCreateCompressionContext( - XMEMCODEC_TYPE CodecType, - const void *pCodecParams, - uint32_t Flags, - XMEMCOMPRESSION_CONTEXT *pContext -) -{ - /* - COMPRESSOR_HANDLE Compressor = nullptr; +int32_t XMemCompress(XMEMCOMPRESSION_CONTEXT Context, void* pDestination, + size_t* pDestSize, void* pSource, size_t SrcSize) { + memcpy(pDestination, pSource, SrcSize); + *pDestSize = SrcSize; + return S_OK; - int32_t hr = CreateCompressor( - COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - nullptr, // Optional allocation routine - &Compressor); // Handle - - pContext = (XMEMDECOMPRESSION_CONTEXT *)Compressor; - return hr; - */ - return 0; + /* + COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; + if( Compress( + Compressor, // Compressor Handle + (void *)pSource, // Input buffer, Uncompressed + data SrcSize, // Uncompressed data + size pDestination, // Compressed Buffer *pDestSize, // + Compressed Buffer size pDestSize) ) // + Compressed Data size + { + return S_OK; + } + else + */ + { + return E_FAIL; + } } -int32_t XMemCreateDecompressionContext( - XMEMCODEC_TYPE CodecType, - const void *pCodecParams, - uint32_t Flags, - XMEMDECOMPRESSION_CONTEXT *pContext -) -{ - /* - DECOMPRESSOR_HANDLE Decompressor = nullptr; +int32_t XMemCreateCompressionContext(XMEMCODEC_TYPE CodecType, + const void* pCodecParams, uint32_t Flags, + XMEMCOMPRESSION_CONTEXT* pContext) { + /* + COMPRESSOR_HANDLE Compressor = nullptr; - int32_t hr = CreateDecompressor( - COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - nullptr, // Optional allocation routine - &Decompressor); // Handle + int32_t hr = CreateCompressor( + COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm + nullptr, // Optional allocation routine + &Compressor); // Handle - pContext = (XMEMDECOMPRESSION_CONTEXT *)Decompressor; - return hr; - */ - return 0; + pContext = (XMEMDECOMPRESSION_CONTEXT *)Compressor; + return hr; + */ + return 0; } -void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context) -{ -// COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; -// CloseCompressor(Compressor); +int32_t XMemCreateDecompressionContext(XMEMCODEC_TYPE CodecType, + const void* pCodecParams, uint32_t Flags, + XMEMDECOMPRESSION_CONTEXT* pContext) { + /* + DECOMPRESSOR_HANDLE Decompressor = nullptr; + + int32_t hr = CreateDecompressor( + COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm + nullptr, // Optional allocation routine + &Decompressor); // Handle + + pContext = (XMEMDECOMPRESSION_CONTEXT *)Decompressor; + return hr; + */ + return 0; } -void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context) -{ -// DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; -// CloseDecompressor(Decompressor); +void XMemDestroyCompressionContext(XMEMCOMPRESSION_CONTEXT Context) { + // COMPRESSOR_HANDLE Compressor = (COMPRESSOR_HANDLE)Context; + // CloseCompressor(Compressor); } -//#if 1 +void XMemDestroyDecompressionContext(XMEMDECOMPRESSION_CONTEXT Context) { + // DECOMPRESSOR_HANDLE Decompressor = (DECOMPRESSOR_HANDLE)Context; + // CloseDecompressor(Decompressor); +} + +// #if 1 uint32_t XGetLanguage() { return 1; } uint32_t XGetLocale() { return 0; } uint32_t XEnableGuestSignin(bool fEnable) { return 0; } - - /////////////////////////////////////////////// Profile library #if defined(_WINDOWS64) -static void *profileData[4]; +static void* profileData[4]; static bool s_bProfileIsFullVersion; -void C_4JProfile::Initialise( std::uint32_t dwTitleID, - std::uint32_t dwOfferID, - unsigned short usProfileVersion, - unsigned int uiProfileValuesC, - unsigned int uiProfileSettingsC, - std::uint32_t *pdwProfileSettingsA, - int iGameDefinedDataSizeX4, - unsigned int *puiGameDefinedDataChangedBitmask) -{ - for( int i = 0; i < 4; i++ ) - { - profileData[i] = new uint8_t[iGameDefinedDataSizeX4/4]; - ZeroMemory(profileData[i],sizeof(uint8_t)*iGameDefinedDataSizeX4/4); +void C_4JProfile::Initialise(std::uint32_t dwTitleID, std::uint32_t dwOfferID, + unsigned short usProfileVersion, + unsigned int uiProfileValuesC, + unsigned int uiProfileSettingsC, + std::uint32_t* pdwProfileSettingsA, + int iGameDefinedDataSizeX4, + unsigned int* puiGameDefinedDataChangedBitmask) { + for (int i = 0; i < 4; i++) { + profileData[i] = new uint8_t[iGameDefinedDataSizeX4 / 4]; + ZeroMemory(profileData[i], + sizeof(uint8_t) * iGameDefinedDataSizeX4 / 4); - // Set some sane initial values! - GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)profileData[i]; - pGameSettings->ucMenuSensitivity=100; //eGameSetting_Sensitivity_InMenu - pGameSettings->ucInterfaceOpacity=80; //eGameSetting_Sensitivity_InMenu - pGameSettings->usBitmaskValues|=0x0200; //eGameSetting_DisplaySplitscreenGamertags - on - pGameSettings->usBitmaskValues|=0x0400; //eGameSetting_Hints - on - pGameSettings->usBitmaskValues|=0x1000; //eGameSetting_Autosave - 2 - pGameSettings->usBitmaskValues|=0x8000; //eGameSetting_Tooltips - on - pGameSettings->uiBitmaskValues=0L; // reset - pGameSettings->uiBitmaskValues|=GAMESETTING_CLOUDS; //eGameSetting_Clouds - on - pGameSettings->uiBitmaskValues|=GAMESETTING_ONLINE; //eGameSetting_GameSetting_Online - on - pGameSettings->uiBitmaskValues|=GAMESETTING_FRIENDSOFFRIENDS; //eGameSetting_GameSetting_FriendsOfFriends - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYUPDATEMSG; //eGameSetting_DisplayUpdateMessage (counter) - pGameSettings->uiBitmaskValues&=~GAMESETTING_BEDROCKFOG; //eGameSetting_BedrockFog - off - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHUD; //eGameSetting_DisplayHUD - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DISPLAYHAND; //eGameSetting_DisplayHand - on - pGameSettings->uiBitmaskValues|=GAMESETTING_CUSTOMSKINANIM; //eGameSetting_CustomSkinAnim - on - pGameSettings->uiBitmaskValues|=GAMESETTING_DEATHMESSAGES; //eGameSetting_DeathMessages - on - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2 - pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3 - pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on + // Set some sane initial values! + GAME_SETTINGS* pGameSettings = (GAME_SETTINGS*)profileData[i]; + pGameSettings->ucMenuSensitivity = + 100; // eGameSetting_Sensitivity_InMenu + pGameSettings->ucInterfaceOpacity = + 80; // eGameSetting_Sensitivity_InMenu + pGameSettings->usBitmaskValues |= + 0x0200; // eGameSetting_DisplaySplitscreenGamertags - on + pGameSettings->usBitmaskValues |= 0x0400; // eGameSetting_Hints - on + pGameSettings->usBitmaskValues |= 0x1000; // eGameSetting_Autosave - 2 + pGameSettings->usBitmaskValues |= 0x8000; // eGameSetting_Tooltips - on + pGameSettings->uiBitmaskValues = 0L; // reset + pGameSettings->uiBitmaskValues |= + GAMESETTING_CLOUDS; // eGameSetting_Clouds - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on + pGameSettings->uiBitmaskValues |= GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends + // - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage + // (counter) + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_BEDROCKFOG; // eGameSetting_BedrockFog - off + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHUD; // eGameSetting_DisplayHUD - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DISPLAYHAND; // eGameSetting_DisplayHand - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_CUSTOMSKINANIM; // eGameSetting_CustomSkinAnim - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_DEATHMESSAGES; // eGameSetting_DeathMessages - on + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE & 0x00000800); // uisize 2 + pGameSettings->uiBitmaskValues |= + (GAMESETTING_UISIZE_SPLITSCREEN & + 0x00004000); // splitscreen ui size 3 + pGameSettings->uiBitmaskValues |= + GAMESETTING_ANIMATEDCHARACTER; // eGameSetting_AnimatedCharacter - + // on - // TU12 - // favorite skins added, but only set in TU12 - set to FFs - for(int i=0;iuiFavoriteSkinA[i]=0xFFFFFFFF; - } - pGameSettings->ucCurrentFavoriteSkinPos=0; - // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list - pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; + // TU12 + // favorite skins added, but only set in TU12 - set to FFs + for (int i = 0; i < MAX_FAVORITE_SKINS; i++) { + pGameSettings->uiFavoriteSkinA[i] = 0xFFFFFFFF; + } + pGameSettings->ucCurrentFavoriteSkinPos = 0; + // Added a bitmask in TU13 to enable/disable display of the Mash-up pack + // worlds in the saves list + pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // PS3DEC13 - pGameSettings->uiBitmaskValues&=~GAMESETTING_PS3EULAREAD; //eGameSetting_PS3_EULA_Read - off + // PS3DEC13 + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_PS3EULAREAD; // eGameSetting_PS3_EULA_Read - off - // PS3 1.05 - added Greek - pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language + // PS3 1.05 - added Greek + pGameSettings->ucLanguage = + MINECRAFT_LANGUAGE_DEFAULT; // use the system language - // PS Vita - network mode added - pGameSettings->uiBitmaskValues&=~GAMESETTING_PSVITANETWORKMODEADHOC; //eGameSetting_PSVita_NetworkModeAdhoc - off + // PS Vita - network mode added + pGameSettings->uiBitmaskValues &= + ~GAMESETTING_PSVITANETWORKMODEADHOC; // eGameSetting_PSVita_NetworkModeAdhoc + // - off + // Tutorials for most menus, and a few other things + pGameSettings->ucTutorialCompletion[0] = 0xFF; + pGameSettings->ucTutorialCompletion[1] = 0xFF; + pGameSettings->ucTutorialCompletion[2] = 0xF; - // Tutorials for most menus, and a few other things - pGameSettings->ucTutorialCompletion[0] = 0xFF; - pGameSettings->ucTutorialCompletion[1] = 0xFF; - pGameSettings->ucTutorialCompletion[2] = 0xF; - - // Has gone halfway through the tutorial - pGameSettings->ucTutorialCompletion[28] |= 1<<0; - } + // Has gone halfway through the tutorial + pGameSettings->ucTutorialCompletion[28] |= 1 << 0; + } } -void C_4JProfile::SetTrialTextStringTable(CXuiStringTable *pStringTable,int iAccept,int iReject) {} -void C_4JProfile::SetTrialAwardText(eAwardType AwardType,int iTitle,int iText) {} -int C_4JProfile::GetLockedProfile() { return 0; } -void C_4JProfile::SetLockedProfile(int iProf) {} -bool C_4JProfile::IsSignedIn(int iQuadrant) { return ( iQuadrant == 0); } -bool C_4JProfile::IsSignedInLive(int iProf) { return true; } -bool C_4JProfile::IsGuest(int iQuadrant) { return false; } -unsigned int C_4JProfile::RequestSignInUI(bool bFromInvite,bool bLocalGame,bool bNoGuestsAllowed,bool bMultiplayerSignIn,bool bAddUser, int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } -unsigned int C_4JProfile::DisplayOfflineProfile(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } -unsigned int C_4JProfile::RequestConvertOfflineToGuestUI(int( *Func)(void *,const bool, const int iPad),void *lpParam,int iQuadrant) { return 0; } -void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} -bool C_4JProfile::QuerySigninStatus(void) { return true; } -void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid) {*pXuid = 0xe000d45248242f2e; } -bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2) { return false; } -bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } -bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } - - -void C_4JProfile::StartTrialGame() {} -void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, bool *allAllowed, bool *friendsAllowed) {} -bool C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, PPlayerUID pXuids, unsigned int xuidCount) { return true; } -bool C_4JProfile::GetProfileAvatar(int iPad,int( *Func)(void *lpParam,std::uint8_t *thumbnailData,unsigned int thumbnailBytes), void *lpParam) { return false; } -void C_4JProfile::CancelProfileAvatarRequest() {} -int C_4JProfile::GetPrimaryPad() { return 0; } -void C_4JProfile::SetPrimaryPad(int iPad) {} -char* C_4JProfile::GetGamertag(int iPad){ return "PlayerName"; } -std::wstring C_4JProfile::GetDisplayName(int iPad){ return L"PlayerName"; } -bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } -void C_4JProfile::SetSignInChangeCallback(void ( *Func)(void *, bool, unsigned int),void *lpParam) {} -void C_4JProfile::SetNotificationsCallback(void ( *Func)(void *, std::uint32_t, unsigned int),void *lpParam) {} -bool C_4JProfile::RegionIsNorthAmerica(void) { return false; } -bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } -int32_t C_4JProfile::GetLiveConnectionStatus() { return S_OK; } -bool C_4JProfile::IsSystemUIDisplayed() { return false; } -void C_4JProfile::SetProfileReadErrorCallback(void ( *Func)(void *), void *lpParam) {} -int( *defaultOptionsCallback)(void *,C_4JProfile::PROFILESETTINGS *, const int iPad) = nullptr; -void *lpProfileParam = nullptr; -int C_4JProfile::SetDefaultOptionsCallback(int( *Func)(void *,PROFILESETTINGS *, const int iPad),void *lpParam) -{ - defaultOptionsCallback = Func; - lpProfileParam = lpParam; - return 0; +void C_4JProfile::SetTrialTextStringTable(CXuiStringTable* pStringTable, + int iAccept, int iReject) {} +void C_4JProfile::SetTrialAwardText(eAwardType AwardType, int iTitle, + int iText) {} +int C_4JProfile::GetLockedProfile() { return 0; } +void C_4JProfile::SetLockedProfile(int iProf) {} +bool C_4JProfile::IsSignedIn(int iQuadrant) { return (iQuadrant == 0); } +bool C_4JProfile::IsSignedInLive(int iProf) { return true; } +bool C_4JProfile::IsGuest(int iQuadrant) { return false; } +unsigned int C_4JProfile::RequestSignInUI( + bool bFromInvite, bool bLocalGame, bool bNoGuestsAllowed, + bool bMultiplayerSignIn, bool bAddUser, + int (*Func)(void*, const bool, const int iPad), void* lpParam, + int iQuadrant) { + return 0; +} +unsigned int C_4JProfile::DisplayOfflineProfile(int (*Func)(void*, const bool, + const int iPad), + void* lpParam, int iQuadrant) { + return 0; +} +unsigned int C_4JProfile::RequestConvertOfflineToGuestUI( + int (*Func)(void*, const bool, const int iPad), void* lpParam, + int iQuadrant) { + return 0; +} +void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} +bool C_4JProfile::QuerySigninStatus(void) { return true; } +void C_4JProfile::GetXUID(int iPad, PlayerUID* pXuid, bool bOnlineXuid) { + *pXuid = 0xe000d45248242f2e; +} +bool C_4JProfile::AreXUIDSEqual(PlayerUID xuid1, PlayerUID xuid2) { + return false; +} +bool C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; } +bool C_4JProfile::AllowedToPlayMultiplayer(int iProf) { return true; } + +void C_4JProfile::StartTrialGame() {} +void C_4JProfile::AllowedPlayerCreatedContent(int iPad, bool thisQuadrantOnly, + bool* allAllowed, + bool* friendsAllowed) {} +bool C_4JProfile::CanViewPlayerCreatedContent(int iPad, bool thisQuadrantOnly, + PPlayerUID pXuids, + unsigned int xuidCount) { + return true; +} +bool C_4JProfile::GetProfileAvatar(int iPad, + int (*Func)(void* lpParam, + std::uint8_t* thumbnailData, + unsigned int thumbnailBytes), + void* lpParam) { + return false; +} +void C_4JProfile::CancelProfileAvatarRequest() {} +int C_4JProfile::GetPrimaryPad() { return 0; } +void C_4JProfile::SetPrimaryPad(int iPad) {} +char* C_4JProfile::GetGamertag(int iPad) { return "PlayerName"; } +std::wstring C_4JProfile::GetDisplayName(int iPad) { return L"PlayerName"; } +bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } +void C_4JProfile::SetSignInChangeCallback(void (*Func)(void*, bool, + unsigned int), + void* lpParam) {} +void C_4JProfile::SetNotificationsCallback(void (*Func)(void*, std::uint32_t, + unsigned int), + void* lpParam) {} +bool C_4JProfile::RegionIsNorthAmerica(void) { return false; } +bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } +int32_t C_4JProfile::GetLiveConnectionStatus() { return S_OK; } +bool C_4JProfile::IsSystemUIDisplayed() { return false; } +void C_4JProfile::SetProfileReadErrorCallback(void (*Func)(void*), + void* lpParam) {} +int (*defaultOptionsCallback)(void*, C_4JProfile::PROFILESETTINGS*, + const int iPad) = nullptr; +void* lpProfileParam = nullptr; +int C_4JProfile::SetDefaultOptionsCallback(int (*Func)(void*, PROFILESETTINGS*, + const int iPad), + void* lpParam) { + defaultOptionsCallback = Func; + lpProfileParam = lpParam; + return 0; +} +int C_4JProfile::SetOldProfileVersionCallback(int (*Func)(void*, unsigned char*, + const unsigned short, + const int), + void* lpParam) { + return 0; } -int C_4JProfile::SetOldProfileVersionCallback(int( *Func)(void *,unsigned char *, const unsigned short,const int),void *lpParam) { return 0; } // To store the dashboard preferences for controller flipped, etc. C_4JProfile::PROFILESETTINGS ProfileSettingsA[XUSER_MAX_COUNT]; -C_4JProfile::PROFILESETTINGS * C_4JProfile::GetDashboardProfileSettings(int iPad) { return &ProfileSettingsA[iPad]; } -void C_4JProfile::WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged, bool bOverride5MinuteLimitOnProfileWrites) {} -void C_4JProfile::ForceQueuedProfileWrites(int iPad) {} -void *C_4JProfile::GetGameDefinedProfileData(int iQuadrant) -{ - // 4J Stu - Don't reset the options when we call this!! - //defaultOptionsCallback(lpProfileParam, (C_4JProfile::PROFILESETTINGS *)profileData[iQuadrant], iQuadrant); - //pApp->SetDefaultOptions(pSettings,iPad); - - return profileData[iQuadrant]; +C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings( + int iPad) { + return &ProfileSettingsA[iPad]; } -void C_4JProfile::ResetProfileProcessState() {} -void C_4JProfile::Tick( void ) {} -void C_4JProfile::RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected, - CXuiStringTable*pStringTable, int iTitleStr, int iTextStr, int iAcceptStr, char *pszThemeName, unsigned int ulThemeSize) {} -int C_4JProfile::GetAwardId(int iAwardNumber) { return 0; } -eAwardType C_4JProfile::GetAwardType(int iAwardNumber) { return eAwardType_Achievement; } -bool C_4JProfile::CanBeAwarded(int iQuadrant, int iAwardNumber) { return false; } -void C_4JProfile::Award(int iQuadrant, int iAwardNumber, bool bForce) {} -bool C_4JProfile::IsAwardsFlagSet(int iQuadrant, int iAward) { return false; } -void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {} -void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} -void C_4JProfile::SetRichPresenceContextValue(int iPad,int iContextID, int iVal) {} -void C_4JProfile::SetCurrentGameActivity(int iPad,int iNewPresence, bool bSetOthersToIdle) {} -void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, int iUpsellParam) {} -void C_4JProfile::SetUpsellCallback(void ( *Func)(void *lpParam, eUpsellType type, eUpsellResponse response, int iUserData),void *lpParam) {} -void C_4JProfile::SetDebugFullOverride(bool bVal) {s_bProfileIsFullVersion = bVal;} -void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {} +void C_4JProfile::WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged, + bool bOverride5MinuteLimitOnProfileWrites) {} +void C_4JProfile::ForceQueuedProfileWrites(int iPad) {} +void* C_4JProfile::GetGameDefinedProfileData(int iQuadrant) { + // 4J Stu - Don't reset the options when we call this!! + // defaultOptionsCallback(lpProfileParam, (C_4JProfile::PROFILESETTINGS + // *)profileData[iQuadrant], iQuadrant); + // pApp->SetDefaultOptions(pSettings,iPad); + + return profileData[iQuadrant]; +} +void C_4JProfile::ResetProfileProcessState() {} +void C_4JProfile::Tick(void) {} +void C_4JProfile::RegisterAward(int iAwardNumber, int iGamerconfigID, + eAwardType eType, bool bLeaderboardAffected, + CXuiStringTable* pStringTable, int iTitleStr, + int iTextStr, int iAcceptStr, + char* pszThemeName, unsigned int ulThemeSize) {} +int C_4JProfile::GetAwardId(int iAwardNumber) { return 0; } +eAwardType C_4JProfile::GetAwardType(int iAwardNumber) { + return eAwardType_Achievement; +} +bool C_4JProfile::CanBeAwarded(int iQuadrant, int iAwardNumber) { + return false; +} +void C_4JProfile::Award(int iQuadrant, int iAwardNumber, bool bForce) {} +bool C_4JProfile::IsAwardsFlagSet(int iQuadrant, int iAward) { return false; } +void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {} +void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} +void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, + int iVal) {} +void C_4JProfile::SetCurrentGameActivity(int iPad, int iNewPresence, + bool bSetOthersToIdle) {} +void C_4JProfile::DisplayFullVersionPurchase(bool bRequired, int iQuadrant, + int iUpsellParam) {} +void C_4JProfile::SetUpsellCallback(void (*Func)(void* lpParam, + eUpsellType type, + eUpsellResponse response, + int iUserData), + void* lpParam) {} +void C_4JProfile::SetDebugFullOverride(bool bVal) { + s_bProfileIsFullVersion = bVal; +} +void C_4JProfile::ShowProfileCard(int iPad, PlayerUID targetUid) {} /////////////////////////////////////////////// Storage library -//#ifdef _WINDOWS64 -// TODO??? +// #ifdef _WINDOWS64 +// TODO??? #if defined(__linux__) C4JStorage::C4JStorage() {} -void C4JStorage::Tick() {} -C4JStorage::EMessageResult C4JStorage::RequestMessageBox(unsigned int uiTitle, unsigned int uiText, unsigned int *uiOptionA,unsigned int uiOptionC, unsigned int pad, int( *Func)(void*,int,const C4JStorage::EMessageResult),void* lpParam, C4JStringTable *pStringTable, wchar_t *pwchFormatString,unsigned int focusButton) { return C4JStorage::EMessage_Undefined; } -C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { return C4JStorage::EMessage_Undefined; } -bool C4JStorage::SetSaveDevice(int( *Func)(void*,const bool),void* lpParam, bool bForceResetOfSaveDevice) { return true; } -void C4JStorage::Init(const wchar_t* pwchDefaultSaveName,char *pszSavePackName,int iMinimumSaveSize, int( *Func)(void*, const ESavingMessage, int),void* lpParam) {} -void C4JStorage::ResetSaveData() {} -void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(const wchar_t* pwchDefaultSaveName) {} -void C4JStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} -const wchar_t* C4JStorage::GetSaveTitle() { return L""; } -bool C4JStorage::GetSaveUniqueNumber(int32_t *piVal) { return true; } -bool C4JStorage::GetSaveUniqueFilename(char *pszName) { return true; } -void C4JStorage::SetSaveUniqueFilename(char *szFilename) { } -void C4JStorage::SetState(ESaveGameControlState eControlState,int( *Func)(void*,const bool),void* lpParam) {} -void C4JStorage::SetSaveDisabled(bool bDisable) {} -bool C4JStorage::GetSaveDisabled(void) { return false; } -unsigned int C4JStorage::GetSaveSize() { return 0; } -void C4JStorage::GetSaveData(void *pvData,unsigned int *pulBytes) {} -void* C4JStorage::AllocateSaveData(unsigned int ulBytes) { return new char[ulBytes]; } -void C4JStorage::SaveSaveData(unsigned int ulBytes,uint8_t* pbThumbnail,uint32_t cbThumbnail,uint8_t* pbTextData, uint32_t dwTextLen) {} -void C4JStorage::CopySaveDataToNewSave(std::uint8_t *pbThumbnail,unsigned int cbThumbnail,wchar_t *wchNewName,int ( *Func)(void* lpParam, bool), void* lpParam) {} -void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad,bool bSelected) {} -bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } -C4JStorage::ELoadGameStatus C4JStorage::DoesSaveExist(bool *pbExists) { return C4JStorage::ELoadGame_Idle; } -bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } -void C4JStorage::SetSaveMessageVPosition(float fY) {} -//C4JStorage::ESGIStatus C4JStorage::GetSavesInfo(int iPad,bool ( *Func)(void*, int, CACHEINFOSTRUCT *, int, int32_t),void* lpParam,char *pszSavePackName) { return C4JStorage::ESGIStatus_Idle; } -C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad,int ( *Func)(void* lpParam,SAVE_DETAILS *pSaveDetails,const bool),void* lpParam,char *pszSavePackName) { return C4JStorage::ESaveGame_Idle; } +void C4JStorage::Tick() {} +C4JStorage::EMessageResult C4JStorage::RequestMessageBox( + unsigned int uiTitle, unsigned int uiText, unsigned int* uiOptionA, + unsigned int uiOptionC, unsigned int pad, + int (*Func)(void*, int, const C4JStorage::EMessageResult), void* lpParam, + C4JStringTable* pStringTable, wchar_t* pwchFormatString, + unsigned int focusButton) { + return C4JStorage::EMessage_Undefined; +} +C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult() { + return C4JStorage::EMessage_Undefined; +} +bool C4JStorage::SetSaveDevice(int (*Func)(void*, const bool), void* lpParam, + bool bForceResetOfSaveDevice) { + return true; +} +void C4JStorage::Init(const wchar_t* pwchDefaultSaveName, char* pszSavePackName, + int iMinimumSaveSize, + int (*Func)(void*, const ESavingMessage, int), + void* lpParam) {} +void C4JStorage::ResetSaveData() {} +void C4JStorage::SetDefaultSaveNameForKeyboardDisplay( + const wchar_t* pwchDefaultSaveName) {} +void C4JStorage::SetSaveTitle(const wchar_t* pwchDefaultSaveName) {} +const wchar_t* C4JStorage::GetSaveTitle() { return L""; } +bool C4JStorage::GetSaveUniqueNumber(int32_t* piVal) { return true; } +bool C4JStorage::GetSaveUniqueFilename(char* pszName) { return true; } +void C4JStorage::SetSaveUniqueFilename(char* szFilename) {} +void C4JStorage::SetState(ESaveGameControlState eControlState, + int (*Func)(void*, const bool), void* lpParam) {} +void C4JStorage::SetSaveDisabled(bool bDisable) {} +bool C4JStorage::GetSaveDisabled(void) { return false; } +unsigned int C4JStorage::GetSaveSize() { return 0; } +void C4JStorage::GetSaveData(void* pvData, unsigned int* pulBytes) {} +void* C4JStorage::AllocateSaveData(unsigned int ulBytes) { + return new char[ulBytes]; +} +void C4JStorage::SaveSaveData(unsigned int ulBytes, uint8_t* pbThumbnail, + uint32_t cbThumbnail, uint8_t* pbTextData, + uint32_t dwTextLen) {} +void C4JStorage::CopySaveDataToNewSave(std::uint8_t* pbThumbnail, + unsigned int cbThumbnail, + wchar_t* wchNewName, + int (*Func)(void* lpParam, bool), + void* lpParam) {} +void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected) {} +bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad) { return true; } +C4JStorage::ELoadGameStatus C4JStorage::DoesSaveExist(bool* pbExists) { + return C4JStorage::ELoadGame_Idle; +} +bool C4JStorage::EnoughSpaceForAMinSaveGame() { return true; } +void C4JStorage::SetSaveMessageVPosition(float fY) {} +// C4JStorage::ESGIStatus +// C4JStorage::GetSavesInfo(int iPad,bool ( *Func)(void*, int, CACHEINFOSTRUCT +// *, int, int32_t),void* lpParam,char *pszSavePackName) { return +// C4JStorage::ESGIStatus_Idle; } +C4JStorage::ESaveGameState C4JStorage::GetSavesInfo( + int iPad, + int (*Func)(void* lpParam, SAVE_DETAILS* pSaveDetails, const bool), + void* lpParam, char* pszSavePackName) { + return C4JStorage::ESaveGame_Idle; +} -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex,XCONTENT_DATA &xContentData) {} -void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, std::uint8_t * *ppbImageData, unsigned int *pImageBytes) {} -C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void* lpParam,const bool, const bool), void* lpParam) {return C4JStorage::ESaveGame_Idle;} -C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo,int( *Func)(void* lpParam,const bool), void* lpParam) { return C4JStorage::EDeleteGame_Idle; } -PSAVE_DETAILS C4JStorage::ReturnSavesInfo() {return nullptr;} +void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, + XCONTENT_DATA& xContentData) {} +void C4JStorage::GetSaveCacheFileInfo(unsigned int fileIndex, + std::uint8_t** ppbImageData, + unsigned int* pImageBytes) {} +C4JStorage::ESaveGameState C4JStorage::LoadSaveData( + PSAVE_INFO pSaveInfo, int (*Func)(void* lpParam, const bool, const bool), + void* lpParam) { + return C4JStorage::ESaveGame_Idle; +} +C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData( + PSAVE_INFO pSaveInfo, int (*Func)(void* lpParam, const bool), + void* lpParam) { + return C4JStorage::EDeleteGame_Idle; +} +PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } -void C4JStorage::RegisterMarketplaceCountsCallback(int ( *Func)(void* lpParam, C4JStorage::DLC_TMS_DETAILS *, int), void* lpParam ) {} -void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot) {} -C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad,int( *Func)(void *, int, std::uint32_t, int),void *lpParam, std::uint32_t dwOfferTypesBitmaskT) { return C4JStorage::EDLC_Idle; } -unsigned int C4JStorage::CancelGetDLCOffers() { return 0; } -void C4JStorage::ClearDLCOffers() {} -XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { static XMARKETPLACE_CONTENTOFFER_INFO retval = {0}; return retval; } -int C4JStorage::GetOfferCount() { return 0; } -unsigned int C4JStorage::InstallOffer(int iOfferIDC,uint64_t *ullOfferIDA,int( *Func)(void*, int, int),void* lpParam, bool bTrial) { return 0; } -unsigned int C4JStorage::GetAvailableDLCCount( int iPad) { return 0; } -XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { static XCONTENT_DATA retval = {0}; return retval; } -C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad,int( *Func)(void*, int, int),void* lpParam) { return C4JStorage::EDLC_Idle; } -std::uint32_t C4JStorage::MountInstalledDLC(int iPad,std::uint32_t dwDLC,int( *Func)(void *, int, std::uint32_t, std::uint32_t),void *lpParam,const char* szMountDrive) { return 0; } -unsigned int C4JStorage::UnmountInstalledDLC(const char* szMountDrive) { return 0; } -C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, wchar_t *pwchFilename,std::uint8_t **ppBuffer,unsigned int *pBufferSize,int( *Func)(void*, wchar_t *,int, bool, int),void* lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; } -bool C4JStorage::WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,wchar_t *pwchFilename,std::uint8_t *pBuffer,unsigned int bufferSize) { return true; } -bool C4JStorage::DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,wchar_t *pwchFilename) { return true; } -void C4JStorage::StoreTMSPathName(wchar_t *pwchName) {} -unsigned int C4JStorage::CRC(unsigned char *buf, int len) { return 0; } +void C4JStorage::RegisterMarketplaceCountsCallback( + int (*Func)(void* lpParam, C4JStorage::DLC_TMS_DETAILS*, int), + void* lpParam) {} +void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} +C4JStorage::EDLCStatus C4JStorage::GetDLCOffers( + int iPad, int (*Func)(void*, int, std::uint32_t, int), void* lpParam, + std::uint32_t dwOfferTypesBitmaskT) { + return C4JStorage::EDLC_Idle; +} +unsigned int C4JStorage::CancelGetDLCOffers() { return 0; } +void C4JStorage::ClearDLCOffers() {} +XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(unsigned int dw) { + static XMARKETPLACE_CONTENTOFFER_INFO retval = {0}; + return retval; +} +int C4JStorage::GetOfferCount() { return 0; } +unsigned int C4JStorage::InstallOffer(int iOfferIDC, uint64_t* ullOfferIDA, + int (*Func)(void*, int, int), + void* lpParam, bool bTrial) { + return 0; +} +unsigned int C4JStorage::GetAvailableDLCCount(int iPad) { return 0; } +XCONTENT_DATA& C4JStorage::GetDLC(unsigned int dw) { + static XCONTENT_DATA retval = {0}; + return retval; +} +C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, + int (*Func)(void*, int, int), + void* lpParam) { + return C4JStorage::EDLC_Idle; +} +std::uint32_t C4JStorage::MountInstalledDLC( + int iPad, std::uint32_t dwDLC, + int (*Func)(void*, int, std::uint32_t, std::uint32_t), void* lpParam, + const char* szMountDrive) { + return 0; +} +unsigned int C4JStorage::UnmountInstalledDLC(const char* szMountDrive) { + return 0; +} +C4JStorage::ETMSStatus C4JStorage::ReadTMSFile( + int iQuadrant, eGlobalStorage eStorageFacility, + C4JStorage::eTMS_FileType eFileType, wchar_t* pwchFilename, + std::uint8_t** ppBuffer, unsigned int* pBufferSize, + int (*Func)(void*, wchar_t*, int, bool, int), void* lpParam, int iAction) { + return C4JStorage::ETMSStatus_Idle; +} +bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, + wchar_t* pwchFilename, std::uint8_t* pBuffer, + unsigned int bufferSize) { + return true; +} +bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, + wchar_t* pwchFilename) { + return true; +} +void C4JStorage::StoreTMSPathName(wchar_t* pwchName) {} +unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return 0; } struct PTMSPP_FILEDATA; -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,const char* szFilename,int( *Func)(void*,int,int,PTMSPP_FILEDATA, const char*)/*=nullptr*/,void* lpParam/*=nullptr*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} +C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile( + int iPad, C4JStorage::eGlobalStorage eStorageFacility, + C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, const char* szFilename, + int (*Func)(void*, int, int, PTMSPP_FILEDATA, const char*) /*=nullptr*/, + void* lpParam /*=nullptr*/, int iUserData /*=0*/) { + return C4JStorage::ETMSStatus_Idle; +} #endif #endif @@ -522,23 +710,81 @@ C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad,C4JStorage::eGloba int32_t CSentientManager::Init() { return S_OK; } int32_t CSentientManager::Tick() { return S_OK; } int32_t CSentientManager::Flush() { return S_OK; } -bool CSentientManager::RecordPlayerSessionStart(uint32_t dwUserId) { return true; } -bool CSentientManager::RecordPlayerSessionExit(uint32_t dwUserId, int exitStatus) { return true; } +bool CSentientManager::RecordPlayerSessionStart(uint32_t dwUserId) { + return true; +} +bool CSentientManager::RecordPlayerSessionExit(uint32_t dwUserId, + int exitStatus) { + return true; +} bool CSentientManager::RecordHeartBeat(uint32_t dwUserId) { return true; } -bool CSentientManager::RecordLevelStart(uint32_t dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, uint32_t numberOfOnlinePlayers) { return true; } -bool CSentientManager::RecordLevelExit(uint32_t dwUserId, ESen_LevelExitStatus levelExitStatus) { return true; } -bool CSentientManager::RecordLevelSaveOrCheckpoint(uint32_t dwUserId, int32_t saveOrCheckPointID, int32_t saveSizeInBytes) { return true; } -bool CSentientManager::RecordLevelResume(uint32_t dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, uint32_t numberOfOnlinePlayers, int32_t saveOrCheckPointID) { return true; } -bool CSentientManager::RecordPauseOrInactive(uint32_t dwUserId) { return true; } +bool CSentientManager::RecordLevelStart(uint32_t dwUserId, + ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, + int difficulty, + uint32_t numberOfLocalPlayers, + uint32_t numberOfOnlinePlayers) { + return true; +} +bool CSentientManager::RecordLevelExit(uint32_t dwUserId, + ESen_LevelExitStatus levelExitStatus) { + return true; +} +bool CSentientManager::RecordLevelSaveOrCheckpoint(uint32_t dwUserId, + int32_t saveOrCheckPointID, + int32_t saveSizeInBytes) { + return true; +} +bool CSentientManager::RecordLevelResume(uint32_t dwUserId, + ESen_FriendOrMatch friendsOrMatch, + ESen_CompeteOrCoop competeOrCoop, + int difficulty, + uint32_t numberOfLocalPlayers, + uint32_t numberOfOnlinePlayers, + int32_t saveOrCheckPointID) { + return true; +} +bool CSentientManager::RecordPauseOrInactive(uint32_t dwUserId) { return true; } bool CSentientManager::RecordUnpauseOrActive(uint32_t dwUserId) { return true; } -bool CSentientManager::RecordMenuShown(uint32_t dwUserId, int32_t menuID, int32_t optionalMenuSubID) { return true; } -bool CSentientManager::RecordAchievementUnlocked(uint32_t dwUserId, int32_t achievementID, int32_t achievementGamerscore) { return true; } -bool CSentientManager::RecordMediaShareUpload(uint32_t dwUserId, ESen_MediaDestination mediaDestination, ESen_MediaType mediaType) { return true; } -bool CSentientManager::RecordUpsellPresented(uint32_t dwUserId, ESen_UpsellID upsellId, int32_t marketplaceOfferID) { return true; } -bool CSentientManager::RecordUpsellResponded(uint32_t dwUserId, ESen_UpsellID upsellId, int32_t marketplaceOfferID, ESen_UpsellOutcome upsellOutcome) { return true; } -bool CSentientManager::RecordPlayerDiedOrFailed(uint32_t dwUserId, int32_t lowResMapX, int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, int32_t playerWeaponID, int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID) { return true; } -bool CSentientManager::RecordEnemyKilledOrOvercome(uint32_t dwUserId, int32_t lowResMapX, int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, int32_t playerWeaponID, int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID) { return true; } -bool CSentientManager::RecordSkinChanged(uint32_t dwUserId, uint32_t dwSkinId) { return true; } +bool CSentientManager::RecordMenuShown(uint32_t dwUserId, int32_t menuID, + int32_t optionalMenuSubID) { + return true; +} +bool CSentientManager::RecordAchievementUnlocked( + uint32_t dwUserId, int32_t achievementID, int32_t achievementGamerscore) { + return true; +} +bool CSentientManager::RecordMediaShareUpload( + uint32_t dwUserId, ESen_MediaDestination mediaDestination, + ESen_MediaType mediaType) { + return true; +} +bool CSentientManager::RecordUpsellPresented(uint32_t dwUserId, + ESen_UpsellID upsellId, + int32_t marketplaceOfferID) { + return true; +} +bool CSentientManager::RecordUpsellResponded(uint32_t dwUserId, + ESen_UpsellID upsellId, + int32_t marketplaceOfferID, + ESen_UpsellOutcome upsellOutcome) { + return true; +} +bool CSentientManager::RecordPlayerDiedOrFailed( + uint32_t dwUserId, int32_t lowResMapX, int32_t lowResMapY, + int32_t lowResMapZ, int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID) { + return true; +} +bool CSentientManager::RecordEnemyKilledOrOvercome( + uint32_t dwUserId, int32_t lowResMapX, int32_t lowResMapY, + int32_t lowResMapZ, int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID) { + return true; +} +bool CSentientManager::RecordSkinChanged(uint32_t dwUserId, uint32_t dwSkinId) { + return true; +} bool CSentientManager::RecordBanLevel(uint32_t dwUserId) { return true; } bool CSentientManager::RecordUnBanLevel(uint32_t dwUserId) { return true; } int32_t CSentientManager::GetMultiplayerInstanceID() { return 0; } @@ -549,10 +795,10 @@ void CSentientManager::SetMultiplayerInstanceId(int32_t value) {} /* StatsCounter::StatsCounter() {} -void StatsCounter::award(Stat *stat, unsigned int difficulty, unsigned int count) {} -bool StatsCounter::hasTaken(Achievement *ach) { return true; } -bool StatsCounter::canTake(Achievement *ach) { return true; } -unsigned int StatsCounter::getValue(Stat *stat, unsigned int difficulty) { return 0; } +void StatsCounter::award(Stat *stat, unsigned int difficulty, unsigned int +count) {} bool StatsCounter::hasTaken(Achievement *ach) { return true; } bool +StatsCounter::canTake(Achievement *ach) { return true; } unsigned int +StatsCounter::getValue(Stat *stat, unsigned int difficulty) { return 0; } unsigned int StatsCounter::getTotalValue(Stat *stat) { return 0; } void StatsCounter::tick(int player) {} void StatsCounter::parse(void* data) {} diff --git a/Minecraft.Client/Platform/Linux/Iggy/gdraw/gdraw.h b/Minecraft.Client/Platform/Linux/Iggy/gdraw/gdraw.h index 326d5c5a5..8e0b3aa17 100644 --- a/Minecraft.Client/Platform/Linux/Iggy/gdraw/gdraw.h +++ b/Minecraft.Client/Platform/Linux/Iggy/gdraw/gdraw.h @@ -8,33 +8,44 @@ extern "C" { #endif -typedef enum gdraw_gl_resourcetype -{ - GDRAW_GL_RESOURCE_rendertarget, - GDRAW_GL_RESOURCE_texture, - GDRAW_GL_RESOURCE_vertexbuffer, - GDRAW_GL_RESOURCE__count, +typedef enum gdraw_gl_resourcetype { + GDRAW_GL_RESOURCE_rendertarget, + GDRAW_GL_RESOURCE_texture, + GDRAW_GL_RESOURCE_vertexbuffer, + GDRAW_GL_RESOURCE__count, } gdraw_gl_resourcetype; struct IggyCustomDrawCallbackRegion; -extern int gdraw_GL_SetResourceLimits(gdraw_gl_resourcetype type, S32 num_handles, S32 num_bytes); -extern GDrawFunctions *gdraw_GL_CreateContext(S32 min_w, S32 min_h, S32 msaa_samples); -extern void gdraw_GL_DestroyContext(void); -extern void gdraw_GL_SetTileOrigin(S32 vx, S32 vy, unsigned int framebuffer); -extern void gdraw_GL_NoMoreGDrawThisFrame(void); -extern GDrawTexture *gdraw_GL_WrappedTextureCreate(S32 gl_texture_handle, S32 width, S32 height, int has_mipmaps); -extern void gdraw_GL_WrappedTextureChange(GDrawTexture *tex, S32 new_gl_texture_handle, S32 new_width, S32 new_height, int new_has_mipmaps); -extern void gdraw_GL_WrappedTextureDestroy(GDrawTexture *tex); -extern void gdraw_GL_BeginCustomDraw(struct IggyCustomDrawCallbackRegion *region, float *matrix); -extern void gdraw_GL_EndCustomDraw(struct IggyCustomDrawCallbackRegion *region); -extern void gdraw_GL_CalculateCustomDraw_4J(struct IggyCustomDrawCallbackRegion *region, float *matrix); -extern void gdraw_GL_BeginCustomDraw_4J(struct IggyCustomDrawCallbackRegion *region, float *matrix); -extern GDrawTexture *gdraw_GL_MakeTextureFromResource(unsigned char *resource_file, S32 resource_len, IggyFileTextureRaw *texture); -extern void gdraw_GL_DestroyTextureFromResource(GDrawTexture *tex); +extern int gdraw_GL_SetResourceLimits(gdraw_gl_resourcetype type, + S32 num_handles, S32 num_bytes); +extern GDrawFunctions* gdraw_GL_CreateContext(S32 min_w, S32 min_h, + S32 msaa_samples); +extern void gdraw_GL_DestroyContext(void); +extern void gdraw_GL_SetTileOrigin(S32 vx, S32 vy, unsigned int framebuffer); +extern void gdraw_GL_NoMoreGDrawThisFrame(void); +extern GDrawTexture* gdraw_GL_WrappedTextureCreate(S32 gl_texture_handle, + S32 width, S32 height, + int has_mipmaps); +extern void gdraw_GL_WrappedTextureChange(GDrawTexture* tex, + S32 new_gl_texture_handle, + S32 new_width, S32 new_height, + int new_has_mipmaps); +extern void gdraw_GL_WrappedTextureDestroy(GDrawTexture* tex); +extern void gdraw_GL_BeginCustomDraw( + struct IggyCustomDrawCallbackRegion* region, float* matrix); +extern void gdraw_GL_EndCustomDraw(struct IggyCustomDrawCallbackRegion* region); +extern void gdraw_GL_CalculateCustomDraw_4J( + struct IggyCustomDrawCallbackRegion* region, float* matrix); +extern void gdraw_GL_BeginCustomDraw_4J( + struct IggyCustomDrawCallbackRegion* region, float* matrix); +extern GDrawTexture* gdraw_GL_MakeTextureFromResource( + unsigned char* resource_file, S32 resource_len, + IggyFileTextureRaw* texture); +extern void gdraw_GL_DestroyTextureFromResource(GDrawTexture* tex); #ifdef __cplusplus } #endif -#endif // __LINUX_IGGY_GDRAW_H__ \ No newline at end of file +#endif // __LINUX_IGGY_GDRAW_H__ \ No newline at end of file diff --git a/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h b/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h index 60c34ca87..fce9065cf 100644 --- a/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h +++ b/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h @@ -12,122 +12,127 @@ RADDEFSTART -//idoc(parent,GDrawAPI_Buffers) +// 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 +#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(parent,GDrawAPI_Base) -IDOC typedef struct gswf_recti -{ - S32 x0,y0; // Minimum corner of the rectangle - S32 x1,y1; // Maximum corner of the rectangle +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. */ +/* 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 +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. */ +/* 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) +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 +#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 + 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 + 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 */ +/* A structure with statistics information to show in resource browser/Telemetry + */ //////////////////////////////////////////////////////////// // // Queries // -//idoc(parent,GDrawAPI_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 +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__count, } gdraw_bformat; -/* Specifies what data format GDraw expects in MakeVertexBuffer_* and DrawIndexedTriangles. +/* 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. */ + 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 +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); +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. */ @@ -135,41 +140,44 @@ IDOC typedef void RADLINK gdraw_get_info(GDrawInfo *d); // // Drawing State // -//idoc(parent,GDrawAPI_DrawingState) +// 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 +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_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__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)) +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 + // 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__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. @@ -192,14 +200,13 @@ IDOC typedef enum gdraw_blendspecial // (@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 +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__count, } gdraw_filter; /* Specifies a type of post-processing graphics filter. @@ -209,103 +216,124 @@ IDOC typedef enum gdraw_filter 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 +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__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 +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__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 +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 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 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 + 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!) + 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 + 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 + // --- Everything below this point must be manually initialized - //0 mod 8 - F32 color[4]; // Color of the object + // 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 + // 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) + 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. */ +/* 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); +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] */ +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); +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); +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); @@ -314,20 +342,22 @@ IDOC typedef void RADLINK gdraw_rendering_begin(void); IDOC typedef void RADLINK gdraw_rendering_end(void); /* Ends rendering; gives up control of the graphics API. */ - //////////////////////////////////////////////////////////// // // Drawing // -//idoc(parent,GDrawAPI_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. */ +/* 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. */ +/* 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); +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, @@ -336,30 +366,37 @@ IDOC typedef void RADLINK gdraw_filter_quad(GDrawRenderState *r, S32 x0, S32 y0, 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) +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 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) + S32 vertex_format; // One of $gdraw_vformat, specifying the type of element + // in $(GDrawPrimitive::vertices) - U32 uniform_count; - F32 *uniforms; + U32 uniform_count; + F32* uniforms; - U8 drawprim_mode; + U8 drawprim_mode; } GDrawPrimitive; -/* Specifies the vertex and index data necessary to draw a batch of graphics primitives. */ +/* 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. +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; @@ -368,224 +405,281 @@ IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDra for the vertices and a 0 offset for the indices) */ -IDOC typedef void RADLINK gdraw_set_antialias_texture(S32 width, U8 *rgba); +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. */ + '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(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. +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, + // 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. + // 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 +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__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 +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) + 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 + 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 +#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); +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); +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 + $: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); +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 + $: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); +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); +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 + $: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); +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. + + $: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); +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) + $: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); +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); +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); +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 +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 +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; + 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. */ +/* 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 +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_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) +typedef int gdraw_verify_size_xyst[sizeof(gswf_vertex_xyst) == 16 ? 1 : -1]; - GDRAW_vformat__basic_count, - GDRAW_vformat_ihud1 = GDRAW_vformat__basic_count, // primary format for ihud, currently v2tc2mat4 (20 bytes per vertex) +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__count, - GDRAW_vformat_mixed, // Special value that denotes a VB containing data in multiple vertex formats. Never used when drawing! + 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 +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 + 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) + 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. */ +/* $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 + S32 size_in_bytes; // Size of the vertex buffer in bytes } GDraw_VertexBuffer_Description; -/* $GDraw_VertexBuffer_Description contains information about a vertex buffer. */ +/* $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); +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 + $: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); +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 -*/ + $: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); +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); +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); +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 + $: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); +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 + $: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. +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 @@ -594,40 +688,57 @@ IDOC typedef void RADLINK gdraw_unlock_handles(GDrawStats *stats); 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); +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 + $: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); +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 + $: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(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 +#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); +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 + 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); +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. @@ -637,77 +748,81 @@ IDOC typedef GDrawTexture * RADLINK gdraw_texture_draw_buffer_end(GDrawStats *st // // Masking // -//idoc(parent,GDrawAPI_Masking) +// idoc(parent,GDrawAPI_Masking) -IDOC typedef void RADLINK gdraw_draw_mask_begin(gswf_recti *region, S32 mask_bit, GDrawStats *stats); +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. + 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); +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. + 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(parent,GDrawAPI_Base) -IDOC struct GDrawFunctions -{ +IDOC struct GDrawFunctions { // queries - gdraw_get_info *GetInfo; + 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; + 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; + 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_texture_draw_buffer_begin* TextureDrawBufferBegin; + gdraw_texture_draw_buffer_end* TextureDrawBufferEnd; - gdraw_describe_texture * DescribeTexture; - gdraw_describe_vertex_buffer * DescribeVertexBuffer; + 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_set_texture_unique_id* SetTextureUniqueID; - gdraw_draw_mask_begin * DrawMaskBegin; - gdraw_draw_mask_end * DrawMaskEnd; + gdraw_draw_mask_begin* DrawMaskBegin; + gdraw_draw_mask_end* DrawMaskEnd; - gdraw_rendering_begin * RenderingBegin; - gdraw_rendering_end * RenderingEnd; + gdraw_rendering_begin* RenderingBegin; + gdraw_rendering_end* RenderingEnd; - gdraw_make_texture_from_resource * MakeTextureFromResource; - gdraw_free_texture_from_resource * FreeTextureFromResource; + gdraw_make_texture_from_resource* MakeTextureFromResource; + gdraw_free_texture_from_resource* FreeTextureFromResource; - gdraw_set_3d_transform * Set3DTransform; + gdraw_set_3d_transform* Set3DTransform; }; /* The function interface called by Iggy to render graphics on all platforms. diff --git a/Minecraft.Client/Platform/Linux/Iggy/include/iggy.h b/Minecraft.Client/Platform/Linux/Iggy/include/iggy.h index e253f59ae..46e75ea41 100644 --- a/Minecraft.Client/Platform/Linux/Iggy/include/iggy.h +++ b/Minecraft.Client/Platform/Linux/Iggy/include/iggy.h @@ -3,104 +3,122 @@ #ifndef __RAD_INCLUDE_IGGY_H__ #define __RAD_INCLUDE_IGGY_H__ -#include // size_t +#include // size_t #define IggyVersion "1.2.30" #define IggyFlashVersion "9,1,2,30" -#include "../../../Windows64/Miles/include/rrcore.h" // base data types, macros +#include "../../../Windows64/Miles/include/rrcore.h" // base data types, macros RADDEFSTART #ifndef IGGY_GDRAW_SHARED_TYPEDEF - #define IGGY_GDRAW_SHARED_TYPEDEF +#define IGGY_GDRAW_SHARED_TYPEDEF - typedef struct GDrawFunctions GDrawFunctions; - typedef struct GDrawTexture GDrawTexture; +typedef struct GDrawFunctions GDrawFunctions; +typedef struct GDrawTexture GDrawTexture; -#endif//IGGY_GDRAW_SHARED_TYPEDEF +#endif // IGGY_GDRAW_SHARED_TYPEDEF -#define IDOCN // Used by documentation generation system +#define IDOCN // Used by documentation generation system //////////////////////////////////////////////////////////// // // Basic Operations // -typedef enum IggyResult -{ - IGGY_RESULT_SUCCESS = 0, +typedef enum IggyResult { + IGGY_RESULT_SUCCESS = 0, - IGGY_RESULT_Warning_None = 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_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_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_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_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_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_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. + 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 +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_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 + 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 + // 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_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) + 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) + // 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. */ @@ -111,150 +129,216 @@ IDOCN typedef wchar_t IggyUTF16; typedef const char16_t 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 +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 +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 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 - }; +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 +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 +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 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 +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 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, +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); +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 +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 +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); +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 +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); +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 */ +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); +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); +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 +typedef enum { + IGGY_LANG_default, + IGGY_LANG_ja, + IGGY_LANG_ja_flash, // more strictly matches Flash } IggyLanguageCode; RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); @@ -267,290 +351,366 @@ RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); 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 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; +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; +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 IggyPlayerCreateFromFileAndPlay( + char const* filename, IggyPlayerConfig const* config); -RADEXPFUNC Iggy * RADEXPLINK IggyPlayerCreateFromMemory( - void const * data, - U32 data_size_in_bytes, - IggyPlayerConfig *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 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 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 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); +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 +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 + 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 + 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 + 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); +RADEXPFUNC IggyProperties* RADEXPLINK IggyPlayerProperties(Iggy* player); -typedef enum -{ - IGGY_PAUSE_continue_audio, - IGGY_PAUSE_pause_audio, - IGGY_PAUSE_stop_audio +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 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); +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; +typedef void* HIGGYEXP; /* An IggyExplorer context, it represents a connection to Iggy Explorer. */ #endif #ifndef __RAD_HIGGYPERFMON_ #define __RAD_HIGGYPERFMON_ -typedef void * HIGGYPERFMON; +typedef void* HIGGYPERFMON; /* An IggyPerfMon context */ #endif +IDOCN typedef void RADLINK iggyexp_detach_callback(void* ptr); -IDOCN typedef void RADLINK iggyexp_detach_callback(void *ptr); - -IDOCN typedef struct -{ - U64 tick_ticks; - U64 draw_ticks; +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); +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 +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 IggyInstallPerfmon(void* perfmon_context); -RADEXPFUNC void RADEXPLINK IggyUseExplorer(Iggy *swf, void *context); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSendFrameToExplorer(Iggy *f); +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; +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 +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, + 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 +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 + 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 +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 +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); +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); +#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 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 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; -typedef struct -{ - IggyFontGetFontMetrics *get_font_metrics; + IggyFontGetCodepointGlyph* get_glyph_for_codepoint; + IggyFontGetGlyphMetrics* get_glyph_metrics; + IggyFontIsGlyphEmpty* is_empty; + IggyFontGetKerningForGlyphPair* get_kerning; - IggyFontGetCodepointGlyph *get_glyph_for_codepoint; - IggyFontGetGlyphMetrics *get_glyph_metrics; - IggyFontIsGlyphEmpty *is_empty; - IggyFontGetKerningForGlyphPair *get_kerning; + IggyVectorFontGetGlyphShape* get_shape; + IggyVectorFontFreeGlyphShape* free_shape; - IggyVectorFontGetGlyphShape *get_shape; - IggyVectorFontFreeGlyphShape *free_shape; + S32 num_glyphs; - S32 num_glyphs; - - void *userdata; + void* userdata; } IggyVectorFontProvider; -typedef struct -{ - IggyFontGetFontMetrics *get_font_metrics; +typedef struct { + IggyFontGetFontMetrics* get_font_metrics; - IggyFontGetCodepointGlyph *get_glyph_for_codepoint; - IggyFontGetGlyphMetrics *get_glyph_metrics; - IggyFontIsGlyphEmpty *is_empty; - IggyFontGetKerningForGlyphPair *get_kerning; + IggyFontGetCodepointGlyph* get_glyph_for_codepoint; + IggyFontGetGlyphMetrics* get_glyph_metrics; + IggyFontIsGlyphEmpty* is_empty; + IggyFontGetKerningForGlyphPair* get_kerning; - IggyBitmapFontCanProvideBitmap *can_bitmap; - IggyBitmapFontGetGlyphBitmap *get_bitmap; - IggyBitmapFontFreeGlyphBitmap *free_bitmap; + IggyBitmapFontCanProvideBitmap* can_bitmap; + IggyBitmapFontGetGlyphBitmap* get_bitmap; + IggyBitmapFontFreeGlyphBitmap* free_bitmap; - S32 num_glyphs; + S32 num_glyphs; - void *userdata; + void* userdata; } IggyBitmapFontProvider; -typedef struct -{ - IggyBitmapFontCanProvideBitmap *can_bitmap; - IggyBitmapFontGetGlyphBitmap *get_bitmap; - IggyBitmapFontFreeGlyphBitmap *free_bitmap; - void *userdata; +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_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 +#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 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 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 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); +RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF8(const char* fontname, + S32 fontname_len, + U32 fontflags); +RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16* fontname, + S32 fontname_len, + U32 fontflags); //////////////////////////////////////////////////////////// // @@ -558,9 +718,13 @@ RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16 *fontname, S32 // 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 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); +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 @@ -578,226 +742,259 @@ RADEXPFUNC void RADEXPLINK IggyAudioUseDefault(void); #ifndef __RAD_DEFINE_IGGYMP3__ #define __RAD_DEFINE_IGGYMP3__ IDOCN typedef struct IggyMP3Interface IggyMP3Interface; -IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface *decoder); +IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface* decoder); #endif #ifdef __RADNT__ - RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); - RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char *path); - RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(wchar_t *path); +RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); +RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char* path); +RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(wchar_t* 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); +// 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 +#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); +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); +#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 +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) + 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); +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); +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 + 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 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]); +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, +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 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 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) +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 +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 +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); +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); +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; +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); +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, +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; +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; +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; +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; +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; +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; +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; //////////////////////////////////////////////////////////// @@ -805,358 +1002,478 @@ IDOCN typedef struct // 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); +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); +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 +#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 +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). +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 +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; + char* name; - IggyGarbageCollectionEvent event; // the type of garbage collection event that was just performed + 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 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 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 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 + 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); +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); +RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetValid(Iggy* f); -IDOCN struct IggyValuePath -{ - Iggy *f; - IggyValuePath *parent; - //align 0 mod 8 +IDOCN struct IggyValuePath { + Iggy* f; + IggyValuePath* parent; + // align 0 mod 8 IggyName name; IggyValueRef ref; - //align 0 mod 8 + // align 0 mod 8 S32 index; S32 type; - //align 0 mod 8 + // align 0 mod 8 }; -typedef enum -{ - IGGY_ValueRef, - IGGY_ValueRef_Weak, +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 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 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 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 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 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 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); +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, +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? +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, +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, +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, +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, +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_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_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_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, + 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 -{ +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 +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 +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 -{ +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; // + 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 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 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); +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); //////////////////////////////////////////////////////////// // @@ -1167,12 +1484,17 @@ RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF8(Iggy *f, char *buffer, S32 bufferle #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); +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. +#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, @@ -1187,25 +1509,33 @@ IDOCN typedef enum { IGGY_IME_COMPOSITION_CLAUSE_START, } IggyIMECompositionClauseState; -IDOCN typedef struct -{ +IDOCN typedef struct { IggyUTF16 str[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionDrawStyle char_style[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 + int candicate_clause_end_pos; // inclusive } IggyIMECompostitionStringState; -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32SetCompositionState(Iggy* f, IggyIMECompostitionStringState* s); +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 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 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]); +IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, + const U8 rgb[3]); #endif @@ -1214,35 +1544,41 @@ IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, // Input focus handling // -typedef void *IggyFocusHandle; +typedef void* IggyFocusHandle; -#define IGGY_FOCUS_NULL 0 +#define IGGY_FOCUS_NULL 0 -typedef struct -{ - IggyFocusHandle object; // unique identifier of Iggy object - F32 x0, y0, x1, y1; // bounding box of displayed shape +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); +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 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); +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); @@ -1255,40 +1591,47 @@ IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchChooseEnd(S32 end); // debugging // -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugUpdateReadyToTickWithFakeRender(Iggy *f); +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; +typedef struct { + S32 size; + char* source_file; + S32 source_line; + char* iggy_file; + char* info; } IggyLeakResultData; -typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData *data); +typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData* data); -typedef struct -{ - char *subcategory; - S32 subcategory_stringlen; +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 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 + 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); +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_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 +#define IGGY_SYNCCHECK_readytotick 1U IDOCN RADDEFEND diff --git a/Minecraft.Client/Platform/Linux/Linux_App.cpp b/Minecraft.Client/Platform/Linux/Linux_App.cpp index 82d0d6563..6e519a20a 100644 --- a/Minecraft.Client/Platform/Linux/Linux_App.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_App.cpp @@ -44,7 +44,7 @@ void CConsoleMinecraftApp::GetScreenshot(int iPad, void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_Main::OnInit + /// From CScene_Main::OnInit app.setLevelGenerationOptions(nullptr); @@ -56,7 +56,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { app.ApplyGameSettingsChanged(0); ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_MultiGameJoinLoad::OnInit + /// From CScene_MultiGameJoinLoad::OnInit MinecraftServer::resetFlags(); // From CScene_MultiGameJoinLoad::OnNotifyPressEx @@ -64,7 +64,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { app.SetCorruptSaveDeleted(false); ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_MultiGameCreate::CreateGame + /// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 608c6b1b7..6c86937b9 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -86,9 +86,7 @@ static void sigsegv_handler(int sig) { // #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 -}; +uint32_t dwProfileSettingsA[NUM_PROFILE_VALUES] = {0, 0, 0, 0, 0}; //------------------------------------------------------------------------------------- // Time Since fAppTime is a float, we need to keep the quadword app @@ -600,8 +598,8 @@ int32_t InitDevice() { descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = - g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, + &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; @@ -691,7 +689,6 @@ int main(int argc, const char* argv[]) { if (fs) RenderManager.SetFullscreen(true); } - static bool bTrialTimerDisplayed = true; #if defined(MEMORY_TRACKING) @@ -702,7 +699,6 @@ int main(int argc, const char* argv[]) { memStat.dwAvailPhys / (1024 * 1024)); #endif - RenderManager.Initialise(); // Read the file containing the product codes diff --git a/Minecraft.Client/Platform/Linux/Sentient/SentientManager.h b/Minecraft.Client/Platform/Linux/Sentient/SentientManager.h index 065b2a995..8101745af 100644 --- a/Minecraft.Client/Platform/Linux/Sentient/SentientManager.h +++ b/Minecraft.Client/Platform/Linux/Sentient/SentientManager.h @@ -33,16 +33,20 @@ public: ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, uint32_t numberOfOnlinePlayers); - bool RecordLevelExit(uint32_t dwUserId, ESen_LevelExitStatus levelExitStatus); - bool RecordLevelSaveOrCheckpoint(uint32_t dwUserId, int32_t saveOrCheckPointID, + bool RecordLevelExit(uint32_t dwUserId, + ESen_LevelExitStatus levelExitStatus); + bool RecordLevelSaveOrCheckpoint(uint32_t dwUserId, + int32_t saveOrCheckPointID, int32_t saveSizeInBytes); bool RecordLevelResume(uint32_t dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, - uint32_t numberOfOnlinePlayers, int32_t saveOrCheckPointID); + uint32_t numberOfOnlinePlayers, + int32_t saveOrCheckPointID); bool RecordPauseOrInactive(uint32_t dwUserId); bool RecordUnpauseOrActive(uint32_t dwUserId); - bool RecordMenuShown(uint32_t dwUserId, int32_t menuID, int32_t optionalMenuSubID); + bool RecordMenuShown(uint32_t dwUserId, int32_t menuID, + int32_t optionalMenuSubID); bool RecordAchievementUnlocked(uint32_t dwUserId, int32_t achievementID, int32_t achievementGamerscore); bool RecordMediaShareUpload(uint32_t dwUserId, @@ -54,12 +58,14 @@ public: int32_t marketplaceOfferID, ESen_UpsellOutcome upsellOutcome); bool RecordPlayerDiedOrFailed(uint32_t dwUserId, int32_t lowResMapX, - int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, - int32_t playerWeaponID, int32_t enemyWeaponID, + int32_t lowResMapY, int32_t lowResMapZ, + int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID); bool RecordEnemyKilledOrOvercome(uint32_t dwUserId, int32_t lowResMapX, - int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, - int32_t playerWeaponID, int32_t enemyWeaponID, + int32_t lowResMapY, int32_t lowResMapZ, + int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID); bool RecordSkinChanged(uint32_t dwUserId, uint32_t dwSkinId); diff --git a/Minecraft.Client/Platform/Linux/Sentient/SentientStats.h b/Minecraft.Client/Platform/Linux/Sentient/SentientStats.h index d82d13978..6f7321bab 100644 --- a/Minecraft.Client/Platform/Linux/Sentient/SentientStats.h +++ b/Minecraft.Client/Platform/Linux/Sentient/SentientStats.h @@ -12,77 +12,173 @@ // PlayerSessionStart // Player signed in or joined -bool SenStatPlayerSessionStart ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t TitleBuildID, int32_t SkeletonDistanceInInches, int32_t EnrollmentType, int32_t NumberOfSkeletonsInView ); +bool SenStatPlayerSessionStart(uint32_t dwUserID, + int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, + int32_t OptionalSubLevelID, int32_t TitleBuildID, + int32_t SkeletonDistanceInInches, + int32_t EnrollmentType, + int32_t NumberOfSkeletonsInView); // PlayerSessionExit // Player signed out or left -bool SenStatPlayerSessionExit ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID ); +bool SenStatPlayerSessionExit(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID); // HeartBeat // Sent every 60 seconds by title -bool SenStatHeartBeat ( uint32_t dwUserID, int32_t SecondsSinceInitialize ); +bool SenStatHeartBeat(uint32_t dwUserID, int32_t SecondsSinceInitialize); // LevelStart // Level started -bool SenStatLevelStart ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, int32_t CompeteOrCoop, int32_t DifficultyLevel, int32_t NumberOfLocalPlayers, int32_t NumberOfOnlinePlayers, int32_t License, int32_t DefaultGameControls, int32_t AudioSettings, int32_t SkeletonDistanceInInches, int32_t NumberOfSkeletonsInView ); +bool SenStatLevelStart(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, + int32_t CompeteOrCoop, int32_t DifficultyLevel, + int32_t NumberOfLocalPlayers, + int32_t NumberOfOnlinePlayers, int32_t License, + int32_t DefaultGameControls, int32_t AudioSettings, + int32_t SkeletonDistanceInInches, + int32_t NumberOfSkeletonsInView); // LevelExit // Level exited -bool SenStatLevelExit ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LevelExitStatus, int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, int32_t LevelDurationInSeconds ); +bool SenStatLevelExit(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t LevelExitStatus, int32_t LevelExitProgressStat1, + int32_t LevelExitProgressStat2, + int32_t LevelDurationInSeconds); // LevelSaveOrCheckpoint // Level saved explicitly or implicitly -bool SenStatLevelSaveOrCheckpoint ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, int32_t LevelDurationInSeconds, int32_t SaveOrCheckPointID ); +bool SenStatLevelSaveOrCheckpoint( + uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, + int32_t LevelDurationInSeconds, int32_t SaveOrCheckPointID); // LevelResume // Level resumed from a save or restarted at a checkpoint -bool SenStatLevelResume ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, int32_t CompeteOrCoop, int32_t DifficultyLevel, int32_t NumberOfLocalPlayers, int32_t NumberOfOnlinePlayers, int32_t License, int32_t DefaultGameControls, int32_t SaveOrCheckPointID, int32_t AudioSettings, int32_t SkeletonDistanceInInches, int32_t NumberOfSkeletonsInView ); +bool SenStatLevelResume(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, + int32_t CompeteOrCoop, int32_t DifficultyLevel, + int32_t NumberOfLocalPlayers, + int32_t NumberOfOnlinePlayers, int32_t License, + int32_t DefaultGameControls, int32_t SaveOrCheckPointID, + int32_t AudioSettings, int32_t SkeletonDistanceInInches, + int32_t NumberOfSkeletonsInView); // PauseOrInactive -// Player paused game or has become inactive, level and mode are for what the player is leaving -bool SenStatPauseOrInactive ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// Player paused game or has become inactive, level and mode are for what the +// player is leaving +bool SenStatPauseOrInactive(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // UnpauseOrActive -// Player unpaused game or has become active, level and mode are for what the player is entering into -bool SenStatUnpauseOrActive ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// Player unpaused game or has become active, level and mode are for what the +// player is entering into +bool SenStatUnpauseOrActive(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // MenuShown // A menu screen or major menu area has been shown -bool SenStatMenuShown ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t MenuID, int32_t OptionalMenuSubID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +bool SenStatMenuShown(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t MenuID, int32_t OptionalMenuSubID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID); // AchievementUnlocked // An achievement was unlocked -bool SenStatAchievementUnlocked ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t AchievementID, int32_t AchievementGamerscore ); +bool SenStatAchievementUnlocked( + uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t AchievementID, int32_t AchievementGamerscore); // MediaShareUpload // The user uploaded something to Kinect Share -bool SenStatMediaShareUpload ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t MediaDestination, int32_t MediaType ); +bool SenStatMediaShareUpload(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, + int32_t MediaDestination, int32_t MediaType); // UpsellPresented // The user is shown an upsell to purchase something -bool SenStatUpsellPresented ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t UpsellID, int32_t MarketplaceOfferID ); +bool SenStatUpsellPresented(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t UpsellID, + int32_t MarketplaceOfferID); // UpsellResponded // The user responded to the upsell -bool SenStatUpsellResponded ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t UpsellID, int32_t MarketplaceOfferID, int32_t UpsellOutcome ); +bool SenStatUpsellResponded(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t UpsellID, + int32_t MarketplaceOfferID, int32_t UpsellOutcome); // PlayerDiedOrFailed // The player died or failed a challenge - can be used for many types of failure -bool SenStatPlayerDiedOrFailed ( uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, int32_t CopyOfSecondsSinceInitialize ); +bool SenStatPlayerDiedOrFailed( + uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, + int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, + int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, + int32_t CopyOfSecondsSinceInitialize); // EnemyKilledOrOvercome // The player killed an enemy or overcame or solved a major challenge -bool SenStatEnemyKilledOrOvercome ( uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, int32_t CopyOfSecondsSinceInitialize ); +bool SenStatEnemyKilledOrOvercome( + uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, + int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, + int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, + int32_t CopyOfSecondsSinceInitialize); // SkinChanged -// The player has changed their skin, level and mode are for what the player is currently in -bool SenStatSkinChanged ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SkinID ); +// The player has changed their skin, level and mode are for what the player is +// currently in +bool SenStatSkinChanged(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SkinID); // BanLevel -// The player has banned a level, level and mode are for what the player is currently in and banning -bool SenStatBanLevel ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// The player has banned a level, level and mode are for what the player is +// currently in and banning +bool SenStatBanLevel(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, + int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // UnBanLevel -// The player has ubbanned a level, level and mode are for what the player is currently in and unbanning -bool SenStatUnBanLevel ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); - +// The player has ubbanned a level, level and mode are for what the player is +// currently in and unbanning +bool SenStatUnBanLevel(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID); diff --git a/Minecraft.Client/Platform/Linux/Social/SocialManager.h b/Minecraft.Client/Platform/Linux/Social/SocialManager.h index 4ca04253c..e3ae30431 100644 --- a/Minecraft.Client/Platform/Linux/Social/SocialManager.h +++ b/Minecraft.Client/Platform/Linux/Social/SocialManager.h @@ -23,8 +23,12 @@ public: bool IsTitleAllowedToPostLinks() { return false; } bool AreAllUsersAllowedToPostImages() { return false; } - bool PostLinkToSocialNetwork(ESocialNetwork, uint32_t, bool) { return false; } - bool PostImageToSocialNetwork(ESocialNetwork, uint32_t, bool) { return false; } + bool PostLinkToSocialNetwork(ESocialNetwork, uint32_t, bool) { + return false; + } + bool PostImageToSocialNetwork(ESocialNetwork, uint32_t, bool) { + return false; + } void SetSocialPostText(const wchar_t*, const wchar_t*, const wchar_t*) {} diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.h b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.h index f70026843..b1d24621a 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.h +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.h @@ -199,7 +199,7 @@ struct BoundingOrientedBox { XMFLOAT3 Center; // Center of the box. XMFLOAT3 Extents; // Distance from the center to each side. XMFLOAT4 - Orientation; // Unit quaternion representing rotation (box -> world). + Orientation; // Unit quaternion representing rotation (box -> world). // Creators BoundingOrientedBox() noexcept diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h index 3ec021bd0..68711f406 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXMath.h @@ -935,10 +935,10 @@ struct XMFLOAT3X3 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT3X3&) const = delete; - auto operator<=>(const XMFLOAT3X3&) const = delete; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT3X3&) const = delete; + auto operator<=>(const XMFLOAT3X3&) const = delete; +#endif }; //------------------------------------------------------------------------------ @@ -987,10 +987,10 @@ struct XMFLOAT4X3 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT4X3&) const = delete; - auto operator<=>(const XMFLOAT4X3&) const = delete; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT4X3&) const = delete; + auto operator<=>(const XMFLOAT4X3&) const = delete; +#endif }; // 4x3 Row-major Matrix: 32 bit floating point components aligned on a 16 byte @@ -1044,10 +1044,10 @@ struct XMFLOAT3X4 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT3X4&) const = delete; - auto operator<=>(const XMFLOAT3X4&) const = delete; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT3X4&) const = delete; + auto operator<=>(const XMFLOAT3X4&) const = delete; +#endif }; // 3x4 Column-major Matrix: 32 bit floating point components aligned on a 16 @@ -1106,10 +1106,10 @@ struct XMFLOAT4X4 { return m[Row][Column]; } -#if (__cplusplus >= 202002L) - bool operator==(const XMFLOAT4X4&) const = delete; - auto operator<=>(const XMFLOAT4X4&) const = delete; -#endif +#if (__cplusplus >= 202002L) + bool operator==(const XMFLOAT4X4&) const = delete; + auto operator<=>(const XMFLOAT4X4&) const = delete; +#endif }; // 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary diff --git a/Minecraft.Client/Platform/Linux/Stubs/iggy_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/iggy_stubs.h index ca0c47ff1..fdd493302 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/iggy_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/iggy_stubs.h @@ -254,10 +254,9 @@ RADEXPFUNC inline void* RADEXPLINK IggyPerfmonCreate( } RADEXPFUNC inline void RADEXPLINK IggyInstallPerfmon(void* perfmon) { STUBBED; } -RADEXPFUNC inline IggyResult RADEXPLINK IggyValueGetTypeRS(IggyValuePath* var, - IggyName sub_name, - char const* sub_name_utf8, - IggyDatatype* result) { +RADEXPFUNC inline IggyResult RADEXPLINK +IggyValueGetTypeRS(IggyValuePath* var, IggyName sub_name, + char const* sub_name_utf8, IggyDatatype* result) { STUBBED; return IGGY_RESULT_SUCCESS; } diff --git a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h index 1cd6dc5c8..d512e41d0 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h @@ -717,7 +717,7 @@ static inline bool SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, static inline bool FileTimeToSystemTime(const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime) { uint64_t ft = ((uint64_t)lpFileTime->dwHighDateTime << 32) | - lpFileTime->dwLowDateTime; + lpFileTime->dwLowDateTime; time_t t = _FileTimeToTimeT(*lpFileTime); long remainder_ns = (long)((ft % 10000000ULL) * 100); @@ -1049,7 +1049,7 @@ static inline int swprintf_s(wchar_t* buf, size_t sz, const wchar_t* fmt, ...) { static inline HMODULE GetModuleHandle(const char* lpModuleName) { return 0; } static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, - DWORD flAllocationType, DWORD flProtect) { + DWORD flAllocationType, DWORD flProtect) { // MEM_COMMIT | MEM_RESERVE → mmap anonymous int prot = 0; if (flProtect == 0x04 /*PAGE_READWRITE*/) diff --git a/Minecraft.Client/Platform/Linux/Stubs/xbox_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/xbox_stubs.h index 6b4901e9d..bb8b29915 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/xbox_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/xbox_stubs.h @@ -101,9 +101,9 @@ typedef DWORD COLORREF; // typedef struct { // IN_ADDR ina; // IP address (zero if not -// static/DHCP) IN_ADDR inaOnline; // Online IP address -// (zero if not online) WORD wPortOnline; // Online -// port BYTE abEnet[6]; // Ethernet MAC address BYTE +// static/DHCP) IN_ADDR inaOnline; // Online IP +// address (zero if not online) WORD wPortOnline; // Online port +// BYTE abEnet[6]; // Ethernet MAC address BYTE // abOnline[20]; // Online identification } XNADDR; typedef int XNADDR; diff --git a/Minecraft.Client/Platform/Windows64/GameConfig/Minecraft.spa.h b/Minecraft.Client/Platform/Windows64/GameConfig/Minecraft.spa.h index a7c262c86..5cf3d63c2 100644 --- a/Minecraft.Client/Platform/Windows64/GameConfig/Minecraft.spa.h +++ b/Minecraft.Client/Platform/Windows64/GameConfig/Minecraft.spa.h @@ -19,7 +19,7 @@ extern "C" { // Title info // -#define TITLEID_MINECRAFT 0x584111F7 +#define TITLEID_MINECRAFT 0x584111F7 // // Context ids @@ -27,7 +27,7 @@ extern "C" { // These values are passed as the dwContextId to XUserSetContext. // -#define CONTEXT_GAME_STATE 0 +#define CONTEXT_GAME_STATE 0 // // Context values @@ -37,34 +37,34 @@ extern "C" { // Values for CONTEXT_GAME_STATE -#define CONTEXT_GAME_STATE_BLANK 0 -#define CONTEXT_GAME_STATE_RIDING_PIG 1 -#define CONTEXT_GAME_STATE_RIDING_MINECART 2 -#define CONTEXT_GAME_STATE_BOATING 3 -#define CONTEXT_GAME_STATE_FISHING 4 -#define CONTEXT_GAME_STATE_CRAFTING 5 -#define CONTEXT_GAME_STATE_FORGING 6 -#define CONTEXT_GAME_STATE_NETHER 7 -#define CONTEXT_GAME_STATE_CD 8 -#define CONTEXT_GAME_STATE_MAP 9 -#define CONTEXT_GAME_STATE_ENCHANTING 5 //TODO 10 -#define CONTEXT_GAME_STATE_BREWING 5 //TODO 11 -#define CONTEXT_GAME_STATE_ANVIL 6 //TODO 12 -#define CONTEXT_GAME_STATE_TRADING 0 //TODO 13 +#define CONTEXT_GAME_STATE_BLANK 0 +#define CONTEXT_GAME_STATE_RIDING_PIG 1 +#define CONTEXT_GAME_STATE_RIDING_MINECART 2 +#define CONTEXT_GAME_STATE_BOATING 3 +#define CONTEXT_GAME_STATE_FISHING 4 +#define CONTEXT_GAME_STATE_CRAFTING 5 +#define CONTEXT_GAME_STATE_FORGING 6 +#define CONTEXT_GAME_STATE_NETHER 7 +#define CONTEXT_GAME_STATE_CD 8 +#define CONTEXT_GAME_STATE_MAP 9 +#define CONTEXT_GAME_STATE_ENCHANTING 5 // TODO 10 +#define CONTEXT_GAME_STATE_BREWING 5 // TODO 11 +#define CONTEXT_GAME_STATE_ANVIL 6 // TODO 12 +#define CONTEXT_GAME_STATE_TRADING 0 // TODO 13 // Values for X_CONTEXT_PRESENCE -#define CONTEXT_PRESENCE_IDLE 0 -#define CONTEXT_PRESENCE_MENUS 1 -#define CONTEXT_PRESENCE_MULTIPLAYER 2 -#define CONTEXT_PRESENCE_MULTIPLAYEROFFLINE 3 -#define CONTEXT_PRESENCE_MULTIPLAYER_1P 4 -#define CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE 5 +#define CONTEXT_PRESENCE_IDLE 0 +#define CONTEXT_PRESENCE_MENUS 1 +#define CONTEXT_PRESENCE_MULTIPLAYER 2 +#define CONTEXT_PRESENCE_MULTIPLAYEROFFLINE 3 +#define CONTEXT_PRESENCE_MULTIPLAYER_1P 4 +#define CONTEXT_PRESENCE_MULTIPLAYER_1POFFLINE 5 // Values for X_CONTEXT_GAME_MODE -#define CONTEXT_GAME_MODE_GAMEMODE 0 -#define CONTEXT_GAME_MODE_MULTIPLAYER 1 +#define CONTEXT_GAME_MODE_GAMEMODE 0 +#define CONTEXT_GAME_MODE_MULTIPLAYER 1 // // Property ids @@ -73,46 +73,46 @@ extern "C" { // and as the dwPropertyId value in the XUSER_PROPERTY structure. // -#define PROPERTY_LOCALE 0x10000008 -#define PROPERTY_KILLS_ZOMBIE 0x1000000A -#define PROPERTY_KILLS_SKELETON 0x1000000B -#define PROPERTY_KILLS_CREEPER 0x1000000C -#define PROPERTY_KILLS_SPIDER 0x1000000D -#define PROPERTY_KILLS_SPIDERJOCKEY 0x1000000E -#define PROPERTY_KILLS_ZOMBIEPIGMAN 0x1000000F -#define PROPERTY_KILLS_SLIME 0x10000010 -#define PROPERTY_KILLS_GHAST 0x10000011 -#define PROPERTY_MINED_DIRT 0x10000012 -#define PROPERTY_MINED_STONE 0x10000013 -#define PROPERTY_MINED_SAND 0x10000014 -#define PROPERTY_MINED_COBBLESTONE 0x10000015 -#define PROPERTY_MINED_GRAVEL 0x10000016 -#define PROPERTY_MINED_CLAY 0x10000017 -#define PROPERTY_MINED_OBSIDIAN 0x10000018 -#define PROPERTY_MINED_COAL 0x10000019 -#define PROPERTY_MINED_IRON 0x1000001A -#define PROPERTY_MINED_GOLD 0x1000001B -#define PROPERTY_MINED_DIAMOND 0x1000001C -#define PROPERTY_MINED_REDSTONE 0x1000001D -#define PROPERTY_MINED_LAPISLAZULI 0x1000001E -#define PROPERTY_MINED_NETHERRACK 0x1000001F -#define PROPERTY_MINED_SOULSAND 0x10000020 -#define PROPERTY_MINED_GLOWSTONE 0x10000021 -#define PROPERTY_COLLECTED_EGG 0x10000022 -#define PROPERTY_COLLECTED_WHEAT 0x10000023 -#define PROPERTY_COLLECTED_MUSHROOM 0x10000024 -#define PROPERTY_COLLECTED_SUGARCANE 0x10000025 -#define PROPERTY_COLLECTED_MILK 0x10000026 -#define PROPERTY_COLLECTED_PUMPKIN 0x10000027 -#define PROPERTY_TRAVEL_WALK 0x10000028 -#define PROPERTY_TRAVEL_SWIM 0x10000029 -#define PROPERTY_TRAVEL_FALL 0x1000002A -#define PROPERTY_TRAVEL_CLIMB 0x1000002B -#define PROPERTY_TRAVEL_MINECART 0x1000002C -#define PROPERTY_TRAVEL_BOAT 0x1000002D -#define PROPERTY_PORTALS_CREATED 0x1000002F -#define PROPERTY_COLLECTED_NETHERLAVA 0x10000030 -#define PROPERTY_RATING 0x20000009 +#define PROPERTY_LOCALE 0x10000008 +#define PROPERTY_KILLS_ZOMBIE 0x1000000A +#define PROPERTY_KILLS_SKELETON 0x1000000B +#define PROPERTY_KILLS_CREEPER 0x1000000C +#define PROPERTY_KILLS_SPIDER 0x1000000D +#define PROPERTY_KILLS_SPIDERJOCKEY 0x1000000E +#define PROPERTY_KILLS_ZOMBIEPIGMAN 0x1000000F +#define PROPERTY_KILLS_SLIME 0x10000010 +#define PROPERTY_KILLS_GHAST 0x10000011 +#define PROPERTY_MINED_DIRT 0x10000012 +#define PROPERTY_MINED_STONE 0x10000013 +#define PROPERTY_MINED_SAND 0x10000014 +#define PROPERTY_MINED_COBBLESTONE 0x10000015 +#define PROPERTY_MINED_GRAVEL 0x10000016 +#define PROPERTY_MINED_CLAY 0x10000017 +#define PROPERTY_MINED_OBSIDIAN 0x10000018 +#define PROPERTY_MINED_COAL 0x10000019 +#define PROPERTY_MINED_IRON 0x1000001A +#define PROPERTY_MINED_GOLD 0x1000001B +#define PROPERTY_MINED_DIAMOND 0x1000001C +#define PROPERTY_MINED_REDSTONE 0x1000001D +#define PROPERTY_MINED_LAPISLAZULI 0x1000001E +#define PROPERTY_MINED_NETHERRACK 0x1000001F +#define PROPERTY_MINED_SOULSAND 0x10000020 +#define PROPERTY_MINED_GLOWSTONE 0x10000021 +#define PROPERTY_COLLECTED_EGG 0x10000022 +#define PROPERTY_COLLECTED_WHEAT 0x10000023 +#define PROPERTY_COLLECTED_MUSHROOM 0x10000024 +#define PROPERTY_COLLECTED_SUGARCANE 0x10000025 +#define PROPERTY_COLLECTED_MILK 0x10000026 +#define PROPERTY_COLLECTED_PUMPKIN 0x10000027 +#define PROPERTY_TRAVEL_WALK 0x10000028 +#define PROPERTY_TRAVEL_SWIM 0x10000029 +#define PROPERTY_TRAVEL_FALL 0x1000002A +#define PROPERTY_TRAVEL_CLIMB 0x1000002B +#define PROPERTY_TRAVEL_MINECART 0x1000002C +#define PROPERTY_TRAVEL_BOAT 0x1000002D +#define PROPERTY_PORTALS_CREATED 0x1000002F +#define PROPERTY_COLLECTED_NETHERLAVA 0x10000030 +#define PROPERTY_RATING 0x20000009 // // Achievement ids @@ -122,34 +122,34 @@ extern "C" { // XUserWriteAchievements and XUserCreateAchievementEnumerator. // -#define ACHIEVEMENT_01 1 -#define ACHIEVEMENT_02 2 -#define ACHIEVEMENT_03 3 -#define ACHIEVEMENT_04 4 -#define ACHIEVEMENT_05 5 -#define ACHIEVEMENT_06 6 -#define ACHIEVEMENT_07 7 -#define ACHIEVEMENT_08 8 -#define ACHIEVEMENT_09 9 -#define ACHIEVEMENT_10 10 -#define ACHIEVEMENT_11 11 -#define ACHIEVEMENT_12 12 -#define ACHIEVEMENT_13 14 -#define ACHIEVEMENT_14 15 -#define ACHIEVEMENT_15 16 -#define ACHIEVEMENT_16 17 -#define ACHIEVEMENT_17 18 -#define ACHIEVEMENT_18 19 -#define ACHIEVEMENT_19 20 -#define ACHIEVEMENT_20 21 +#define ACHIEVEMENT_01 1 +#define ACHIEVEMENT_02 2 +#define ACHIEVEMENT_03 3 +#define ACHIEVEMENT_04 4 +#define ACHIEVEMENT_05 5 +#define ACHIEVEMENT_06 6 +#define ACHIEVEMENT_07 7 +#define ACHIEVEMENT_08 8 +#define ACHIEVEMENT_09 9 +#define ACHIEVEMENT_10 10 +#define ACHIEVEMENT_11 11 +#define ACHIEVEMENT_12 12 +#define ACHIEVEMENT_13 14 +#define ACHIEVEMENT_14 15 +#define ACHIEVEMENT_15 16 +#define ACHIEVEMENT_16 17 +#define ACHIEVEMENT_17 18 +#define ACHIEVEMENT_18 19 +#define ACHIEVEMENT_19 20 +#define ACHIEVEMENT_20 21 // // AvatarAssetAward ids // -#define AVATARASSETAWARD_PORKCHOP_TSHIRT 1 -#define AVATARASSETAWARD_WATCH 2 -#define AVATARASSETAWARD_CAP 5 +#define AVATARASSETAWARD_PORKCHOP_TSHIRT 1 +#define AVATARASSETAWARD_WATCH 2 +#define AVATARASSETAWARD_CAP 5 // // Stats view ids @@ -160,32 +160,32 @@ extern "C" { // Skill leaderboards for ranked game modes -#define STATS_VIEW_SKILL_RANKED_GAMEMODE 0xFFFF0000 -#define STATS_VIEW_SKILL_RANKED_MULTIPLAYER 0xFFFF0001 +#define STATS_VIEW_SKILL_RANKED_GAMEMODE 0xFFFF0000 +#define STATS_VIEW_SKILL_RANKED_MULTIPLAYER 0xFFFF0001 // Skill leaderboards for unranked (standard) game modes -#define STATS_VIEW_SKILL_STANDARD_GAMEMODE 0xFFFE0000 -#define STATS_VIEW_SKILL_STANDARD_MULTIPLAYER 0xFFFE0001 +#define STATS_VIEW_SKILL_STANDARD_GAMEMODE 0xFFFE0000 +#define STATS_VIEW_SKILL_STANDARD_MULTIPLAYER 0xFFFE0001 // Title defined leaderboards -#define STATS_VIEW_KILLS_EASY 4 -#define STATS_VIEW_KILLS_NORMAL 5 -#define STATS_VIEW_KILLS_HARD 6 -#define STATS_VIEW_MINING_BLOCKS_PEACEFUL 7 -#define STATS_VIEW_MINING_BLOCKS_EASY 8 -#define STATS_VIEW_MINING_BLOCKS_NORMAL 9 -#define STATS_VIEW_MINING_BLOCKS_HARD 10 -#define STATS_VIEW_FARMING_PEACEFUL 15 -#define STATS_VIEW_FARMING_EASY 16 -#define STATS_VIEW_FARMING_NORMAL 17 -#define STATS_VIEW_FARMING_HARD 18 -#define STATS_VIEW_TRAVELLING_PEACEFUL 19 -#define STATS_VIEW_TRAVELLING_EASY 20 -#define STATS_VIEW_TRAVELLING_NORMAL 21 -#define STATS_VIEW_TRAVELLING_HARD 22 -#define STATS_VIEW_TRAVELLING_TOTAL 27 +#define STATS_VIEW_KILLS_EASY 4 +#define STATS_VIEW_KILLS_NORMAL 5 +#define STATS_VIEW_KILLS_HARD 6 +#define STATS_VIEW_MINING_BLOCKS_PEACEFUL 7 +#define STATS_VIEW_MINING_BLOCKS_EASY 8 +#define STATS_VIEW_MINING_BLOCKS_NORMAL 9 +#define STATS_VIEW_MINING_BLOCKS_HARD 10 +#define STATS_VIEW_FARMING_PEACEFUL 15 +#define STATS_VIEW_FARMING_EASY 16 +#define STATS_VIEW_FARMING_NORMAL 17 +#define STATS_VIEW_FARMING_HARD 18 +#define STATS_VIEW_TRAVELLING_PEACEFUL 19 +#define STATS_VIEW_TRAVELLING_EASY 20 +#define STATS_VIEW_TRAVELLING_NORMAL 21 +#define STATS_VIEW_TRAVELLING_HARD 22 +#define STATS_VIEW_TRAVELLING_TOTAL 27 // // Stats view column ids @@ -199,164 +199,163 @@ extern "C" { // Column ids for KILLS_EASY -#define STATS_COLUMN_KILLS_EASY_LOCALE 9 -#define STATS_COLUMN_KILLS_EASY_ZOMBIES 1 -#define STATS_COLUMN_KILLS_EASY_SKELETONS 2 -#define STATS_COLUMN_KILLS_EASY_CREEPERS 3 -#define STATS_COLUMN_KILLS_EASY_SPIDERS 4 -#define STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS 5 -#define STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN 6 -#define STATS_COLUMN_KILLS_EASY_SLIME 7 +#define STATS_COLUMN_KILLS_EASY_LOCALE 9 +#define STATS_COLUMN_KILLS_EASY_ZOMBIES 1 +#define STATS_COLUMN_KILLS_EASY_SKELETONS 2 +#define STATS_COLUMN_KILLS_EASY_CREEPERS 3 +#define STATS_COLUMN_KILLS_EASY_SPIDERS 4 +#define STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS 5 +#define STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN 6 +#define STATS_COLUMN_KILLS_EASY_SLIME 7 // Column ids for KILLS_NORMAL -#define STATS_COLUMN_KILLS_NORMAL_LOCALE 9 -#define STATS_COLUMN_KILLS_NORMAL_ZOMBIES 1 -#define STATS_COLUMN_KILLS_NORMAL_SKELETONS 2 -#define STATS_COLUMN_KILLS_NORMAL_CREEPERS 3 -#define STATS_COLUMN_KILLS_NORMAL_SPIDERS 4 -#define STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS 5 -#define STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN 6 -#define STATS_COLUMN_KILLS_NORMAL_SLIME 7 +#define STATS_COLUMN_KILLS_NORMAL_LOCALE 9 +#define STATS_COLUMN_KILLS_NORMAL_ZOMBIES 1 +#define STATS_COLUMN_KILLS_NORMAL_SKELETONS 2 +#define STATS_COLUMN_KILLS_NORMAL_CREEPERS 3 +#define STATS_COLUMN_KILLS_NORMAL_SPIDERS 4 +#define STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS 5 +#define STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN 6 +#define STATS_COLUMN_KILLS_NORMAL_SLIME 7 // Column ids for KILLS_HARD -#define STATS_COLUMN_KILLS_HARD_LOCALE 9 -#define STATS_COLUMN_KILLS_HARD_ZOMBIES 1 -#define STATS_COLUMN_KILLS_HARD_SKELETONS 2 -#define STATS_COLUMN_KILLS_HARD_CREEPERS 3 -#define STATS_COLUMN_KILLS_HARD_SPIDERS 4 -#define STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS 5 -#define STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN 6 -#define STATS_COLUMN_KILLS_HARD_SLIME 7 +#define STATS_COLUMN_KILLS_HARD_LOCALE 9 +#define STATS_COLUMN_KILLS_HARD_ZOMBIES 1 +#define STATS_COLUMN_KILLS_HARD_SKELETONS 2 +#define STATS_COLUMN_KILLS_HARD_CREEPERS 3 +#define STATS_COLUMN_KILLS_HARD_SPIDERS 4 +#define STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS 5 +#define STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN 6 +#define STATS_COLUMN_KILLS_HARD_SLIME 7 // Column ids for MINING_BLOCKS_PEACEFUL -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_LOCALE 1 -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT 2 -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE 3 -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND 4 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_LOCALE 1 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT 2 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE 3 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND 4 #define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE 5 -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL 6 -#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY 7 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL 6 +#define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY 7 #define STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN 8 // Column ids for MINING_BLOCKS_EASY -#define STATS_COLUMN_MINING_BLOCKS_EASY_LOCALE 1 -#define STATS_COLUMN_MINING_BLOCKS_EASY_DIRT 2 -#define STATS_COLUMN_MINING_BLOCKS_EASY_STONE 3 -#define STATS_COLUMN_MINING_BLOCKS_EASY_SAND 4 +#define STATS_COLUMN_MINING_BLOCKS_EASY_LOCALE 1 +#define STATS_COLUMN_MINING_BLOCKS_EASY_DIRT 2 +#define STATS_COLUMN_MINING_BLOCKS_EASY_STONE 3 +#define STATS_COLUMN_MINING_BLOCKS_EASY_SAND 4 #define STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE 5 -#define STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL 6 -#define STATS_COLUMN_MINING_BLOCKS_EASY_CLAY 7 -#define STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN 8 +#define STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL 6 +#define STATS_COLUMN_MINING_BLOCKS_EASY_CLAY 7 +#define STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN 8 // Column ids for MINING_BLOCKS_NORMAL -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_LOCALE 1 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT 2 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE 3 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND 4 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_LOCALE 1 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT 2 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE 3 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND 4 #define STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE 5 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL 6 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY 7 -#define STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN 8 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL 6 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY 7 +#define STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN 8 // Column ids for MINING_BLOCKS_HARD -#define STATS_COLUMN_MINING_BLOCKS_HARD_LOCALE 1 -#define STATS_COLUMN_MINING_BLOCKS_HARD_DIRT 2 -#define STATS_COLUMN_MINING_BLOCKS_HARD_STONE 3 -#define STATS_COLUMN_MINING_BLOCKS_HARD_SAND 4 +#define STATS_COLUMN_MINING_BLOCKS_HARD_LOCALE 1 +#define STATS_COLUMN_MINING_BLOCKS_HARD_DIRT 2 +#define STATS_COLUMN_MINING_BLOCKS_HARD_STONE 3 +#define STATS_COLUMN_MINING_BLOCKS_HARD_SAND 4 #define STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE 5 -#define STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL 6 -#define STATS_COLUMN_MINING_BLOCKS_HARD_CLAY 7 -#define STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN 8 +#define STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL 6 +#define STATS_COLUMN_MINING_BLOCKS_HARD_CLAY 7 +#define STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN 8 // Column ids for FARMING_PEACEFUL -#define STATS_COLUMN_FARMING_PEACEFUL_LOCALE 1 -#define STATS_COLUMN_FARMING_PEACEFUL_EGGS 2 -#define STATS_COLUMN_FARMING_PEACEFUL_WHEAT 3 -#define STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS 4 -#define STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE 5 -#define STATS_COLUMN_FARMING_PEACEFUL_MILK 6 -#define STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS 7 +#define STATS_COLUMN_FARMING_PEACEFUL_LOCALE 1 +#define STATS_COLUMN_FARMING_PEACEFUL_EGGS 2 +#define STATS_COLUMN_FARMING_PEACEFUL_WHEAT 3 +#define STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS 4 +#define STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE 5 +#define STATS_COLUMN_FARMING_PEACEFUL_MILK 6 +#define STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS 7 // Column ids for FARMING_EASY -#define STATS_COLUMN_FARMING_EASY_LOCALE 1 -#define STATS_COLUMN_FARMING_EASY_EGGS 2 -#define STATS_COLUMN_FARMING_EASY_WHEAT 3 -#define STATS_COLUMN_FARMING_EASY_MUSHROOMS 4 -#define STATS_COLUMN_FARMING_EASY_SUGARCANE 5 -#define STATS_COLUMN_FARMING_EASY_MILK 6 -#define STATS_COLUMN_FARMING_EASY_PUMPKINS 7 +#define STATS_COLUMN_FARMING_EASY_LOCALE 1 +#define STATS_COLUMN_FARMING_EASY_EGGS 2 +#define STATS_COLUMN_FARMING_EASY_WHEAT 3 +#define STATS_COLUMN_FARMING_EASY_MUSHROOMS 4 +#define STATS_COLUMN_FARMING_EASY_SUGARCANE 5 +#define STATS_COLUMN_FARMING_EASY_MILK 6 +#define STATS_COLUMN_FARMING_EASY_PUMPKINS 7 // Column ids for FARMING_NORMAL -#define STATS_COLUMN_FARMING_NORMAL_LOCALE 1 -#define STATS_COLUMN_FARMING_NORMAL_EGGS 2 -#define STATS_COLUMN_FARMING_NORMAL_WHEAT 3 -#define STATS_COLUMN_FARMING_NORMAL_MUSHROOMS 4 -#define STATS_COLUMN_FARMING_NORMAL_SUGARCANE 5 -#define STATS_COLUMN_FARMING_NORMAL_MILK 6 -#define STATS_COLUMN_FARMING_NORMAL_PUMPKINS 7 +#define STATS_COLUMN_FARMING_NORMAL_LOCALE 1 +#define STATS_COLUMN_FARMING_NORMAL_EGGS 2 +#define STATS_COLUMN_FARMING_NORMAL_WHEAT 3 +#define STATS_COLUMN_FARMING_NORMAL_MUSHROOMS 4 +#define STATS_COLUMN_FARMING_NORMAL_SUGARCANE 5 +#define STATS_COLUMN_FARMING_NORMAL_MILK 6 +#define STATS_COLUMN_FARMING_NORMAL_PUMPKINS 7 // Column ids for FARMING_HARD -#define STATS_COLUMN_FARMING_HARD_LOCALE 1 -#define STATS_COLUMN_FARMING_HARD_EGGS 2 -#define STATS_COLUMN_FARMING_HARD_WHEAT 3 -#define STATS_COLUMN_FARMING_HARD_MUSHROOMS 4 -#define STATS_COLUMN_FARMING_HARD_SUGARCANE 5 -#define STATS_COLUMN_FARMING_HARD_MILK 6 -#define STATS_COLUMN_FARMING_HARD_PUMPKINS 7 +#define STATS_COLUMN_FARMING_HARD_LOCALE 1 +#define STATS_COLUMN_FARMING_HARD_EGGS 2 +#define STATS_COLUMN_FARMING_HARD_WHEAT 3 +#define STATS_COLUMN_FARMING_HARD_MUSHROOMS 4 +#define STATS_COLUMN_FARMING_HARD_SUGARCANE 5 +#define STATS_COLUMN_FARMING_HARD_MILK 6 +#define STATS_COLUMN_FARMING_HARD_PUMPKINS 7 // Column ids for TRAVELLING_PEACEFUL -#define STATS_COLUMN_TRAVELLING_PEACEFUL_LOCALE 1 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED 2 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_SWAM 3 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN 4 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_CLIMBED 5 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART 6 -#define STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT 7 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_LOCALE 1 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED 2 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_SWAM 3 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN 4 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_CLIMBED 5 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART 6 +#define STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT 7 // Column ids for TRAVELLING_EASY -#define STATS_COLUMN_TRAVELLING_EASY_LOCALE 1 -#define STATS_COLUMN_TRAVELLING_EASY_WALKED 2 -#define STATS_COLUMN_TRAVELLING_EASY_SWAM 3 -#define STATS_COLUMN_TRAVELLING_EASY_FALLEN 4 -#define STATS_COLUMN_TRAVELLING_EASY_CLIMBED 5 -#define STATS_COLUMN_TRAVELLING_EASY_MINECART 6 -#define STATS_COLUMN_TRAVELLING_EASY_BOAT 7 +#define STATS_COLUMN_TRAVELLING_EASY_LOCALE 1 +#define STATS_COLUMN_TRAVELLING_EASY_WALKED 2 +#define STATS_COLUMN_TRAVELLING_EASY_SWAM 3 +#define STATS_COLUMN_TRAVELLING_EASY_FALLEN 4 +#define STATS_COLUMN_TRAVELLING_EASY_CLIMBED 5 +#define STATS_COLUMN_TRAVELLING_EASY_MINECART 6 +#define STATS_COLUMN_TRAVELLING_EASY_BOAT 7 // Column ids for TRAVELLING_NORMAL -#define STATS_COLUMN_TRAVELLING_NORMAL_LOCALE 1 -#define STATS_COLUMN_TRAVELLING_NORMAL_WALKED 2 -#define STATS_COLUMN_TRAVELLING_NORMAL_SWAM 3 -#define STATS_COLUMN_TRAVELLING_NORMAL_FALLEN 4 -#define STATS_COLUMN_TRAVELLING_NORMAL_CLIMBED 5 -#define STATS_COLUMN_TRAVELLING_NORMAL_MINECART 6 -#define STATS_COLUMN_TRAVELLING_NORMAL_BOAT 7 +#define STATS_COLUMN_TRAVELLING_NORMAL_LOCALE 1 +#define STATS_COLUMN_TRAVELLING_NORMAL_WALKED 2 +#define STATS_COLUMN_TRAVELLING_NORMAL_SWAM 3 +#define STATS_COLUMN_TRAVELLING_NORMAL_FALLEN 4 +#define STATS_COLUMN_TRAVELLING_NORMAL_CLIMBED 5 +#define STATS_COLUMN_TRAVELLING_NORMAL_MINECART 6 +#define STATS_COLUMN_TRAVELLING_NORMAL_BOAT 7 // Column ids for TRAVELLING_HARD -#define STATS_COLUMN_TRAVELLING_HARD_LOCALE 1 -#define STATS_COLUMN_TRAVELLING_HARD_WALKED 2 -#define STATS_COLUMN_TRAVELLING_HARD_SWAM 3 -#define STATS_COLUMN_TRAVELLING_HARD_FALLEN 4 -#define STATS_COLUMN_TRAVELLING_HARD_CLIMBED 5 -#define STATS_COLUMN_TRAVELLING_HARD_MINECART 6 -#define STATS_COLUMN_TRAVELLING_HARD_BOAT 7 +#define STATS_COLUMN_TRAVELLING_HARD_LOCALE 1 +#define STATS_COLUMN_TRAVELLING_HARD_WALKED 2 +#define STATS_COLUMN_TRAVELLING_HARD_SWAM 3 +#define STATS_COLUMN_TRAVELLING_HARD_FALLEN 4 +#define STATS_COLUMN_TRAVELLING_HARD_CLIMBED 5 +#define STATS_COLUMN_TRAVELLING_HARD_MINECART 6 +#define STATS_COLUMN_TRAVELLING_HARD_BOAT 7 // Column ids for TRAVELLING_TOTAL - // // Matchmaking queries // @@ -364,7 +363,7 @@ extern "C" { // XSessionSearch to indicate which matchmaking query to run. // -#define SESSION_MATCH_QUERY_FRIENDS 0 +#define SESSION_MATCH_QUERY_FRIENDS 0 // // Gamer pictures @@ -372,8 +371,8 @@ extern "C" { // These ids are passed as the dwPictureId parameter to XUserAwardGamerTile. // -#define GAMER_PICTURE_GAMERPIC1 12 -#define GAMER_PICTURE_GAMERPIC2 13 +#define GAMER_PICTURE_GAMERPIC1 12 +#define GAMER_PICTURE_GAMERPIC2 13 // // Strings @@ -381,135 +380,135 @@ extern "C" { // These ids are passed as the dwStringId parameter to XReadStringsFromSpaFile. // -#define SPASTRING_PRESENCE_IDLE_NAME 4 -#define SPASTRING_PRESENCE_MENUS_NAME 10 -#define SPASTRING_ACH_01_NAME 376 -#define SPASTRING_ACH_02_NAME 377 -#define SPASTRING_ACH_03_NAME 378 -#define SPASTRING_ACH_07_NAME 379 -#define SPASTRING_ACH_08_NAME 380 -#define SPASTRING_ACH_09_NAME 381 -#define SPASTRING_ACH_13_NAME 382 -#define SPASTRING_ACH_14_NAME 383 -#define SPASTRING_ACH_15_NAME 384 -#define SPASTRING_ACH_16_NAME 385 -#define SPASTRING_ACH_04_NAME 386 -#define SPASTRING_ACH_10_NAME 387 -#define SPASTRING_ACH_01_DESC 388 -#define SPASTRING_ACH_02_DESC 389 -#define SPASTRING_ACH_03_DESC 390 -#define SPASTRING_ACH_07_DESC 391 -#define SPASTRING_ACH_08_DESC 392 -#define SPASTRING_ACH_09_DESC 393 -#define SPASTRING_ACH_13_DESC 394 -#define SPASTRING_ACH_14_DESC 395 -#define SPASTRING_ACH_15_DESC 396 -#define SPASTRING_ACH_16_DESC 397 -#define SPASTRING_ACH_04_DESC 398 -#define SPASTRING_ACH_10_DESC 399 -#define SPASTRING_ACH_01_HOWTO 400 -#define SPASTRING_ACH_02_HOWTO 401 -#define SPASTRING_ACH_03_HOWTO 402 -#define SPASTRING_ACH_07_HOWTO 403 -#define SPASTRING_ACH_08_HOWTO 404 -#define SPASTRING_ACH_09_HOWTO 405 -#define SPASTRING_ACH_13_HOWTO 406 -#define SPASTRING_ACH_14_HOWTO 407 -#define SPASTRING_ACH_15_HOWTO 408 -#define SPASTRING_ACH_16_HOWTO 409 -#define SPASTRING_ACH_04_HOWTO 410 -#define SPASTRING_ACH_10_HOWTO 411 -#define SPASTRING_STR_GAMEMODE_SINGLEPLAYER 420 -#define SPASTRING_ACH_05_HOWTO 429 -#define SPASTRING_ACH_05_NAME 430 -#define SPASTRING_ACH_05_DESC 431 -#define SPASTRING_ACH_11_HOWTO 432 -#define SPASTRING_ACH_11_NAME 433 -#define SPASTRING_ACH_11_DESC 434 -#define SPASTRING_ACH_06_HOWTO 435 -#define SPASTRING_ACH_06_NAME 436 -#define SPASTRING_ACH_06_DESC 437 -#define SPASTRING_ACH_12_HOWTO 438 -#define SPASTRING_ACH_12_NAME 439 -#define SPASTRING_ACH_12_DESC 440 -#define SPASTRING_ACH_17_HOWTO 441 -#define SPASTRING_ACH_17_NAME 442 -#define SPASTRING_ACH_17_DESC 443 -#define SPASTRING_ACH_18_HOWTO 444 -#define SPASTRING_ACH_18_NAME 445 -#define SPASTRING_ACH_18_DESC 446 -#define SPASTRING_ACH_19_HOWTO 447 -#define SPASTRING_ACH_19_NAME 448 -#define SPASTRING_ACH_19_DESC 449 -#define SPASTRING_ACH_20_HOWTO 450 -#define SPASTRING_ACH_20_NAME 451 -#define SPASTRING_ACH_20_DESC 452 -#define SPASTRING_AV_PORKCHOP_TSHIRT_HOWTO 473 -#define SPASTRING_AV_PORKCHOP_TSHIRT_TITLE1 474 -#define SPASTRING_AV_PORKCHOP_TSHIRT_TITLE2 475 -#define SPASTRING_AV_PORKCHOP_TSHIRT_DESC 476 -#define SPASTRING_AV_WATCH_HOWTO 477 -#define SPASTRING_AV_WATCH_TITLE1 478 -#define SPASTRING_AV_WATCH_TITLE2 479 -#define SPASTRING_AV_WATCH_DESC 480 -#define SPASTRING_PRESENCE_MULTIPLAYER_NAME 490 -#define SPASTRING_CT_GAME_STATE_NAME 492 -#define SPASTRING_CV_GAME_STATE_BLANK_NAME 496 -#define SPASTRING_CV_GAME_STATE_RIDING_PIG_NAME 497 +#define SPASTRING_PRESENCE_IDLE_NAME 4 +#define SPASTRING_PRESENCE_MENUS_NAME 10 +#define SPASTRING_ACH_01_NAME 376 +#define SPASTRING_ACH_02_NAME 377 +#define SPASTRING_ACH_03_NAME 378 +#define SPASTRING_ACH_07_NAME 379 +#define SPASTRING_ACH_08_NAME 380 +#define SPASTRING_ACH_09_NAME 381 +#define SPASTRING_ACH_13_NAME 382 +#define SPASTRING_ACH_14_NAME 383 +#define SPASTRING_ACH_15_NAME 384 +#define SPASTRING_ACH_16_NAME 385 +#define SPASTRING_ACH_04_NAME 386 +#define SPASTRING_ACH_10_NAME 387 +#define SPASTRING_ACH_01_DESC 388 +#define SPASTRING_ACH_02_DESC 389 +#define SPASTRING_ACH_03_DESC 390 +#define SPASTRING_ACH_07_DESC 391 +#define SPASTRING_ACH_08_DESC 392 +#define SPASTRING_ACH_09_DESC 393 +#define SPASTRING_ACH_13_DESC 394 +#define SPASTRING_ACH_14_DESC 395 +#define SPASTRING_ACH_15_DESC 396 +#define SPASTRING_ACH_16_DESC 397 +#define SPASTRING_ACH_04_DESC 398 +#define SPASTRING_ACH_10_DESC 399 +#define SPASTRING_ACH_01_HOWTO 400 +#define SPASTRING_ACH_02_HOWTO 401 +#define SPASTRING_ACH_03_HOWTO 402 +#define SPASTRING_ACH_07_HOWTO 403 +#define SPASTRING_ACH_08_HOWTO 404 +#define SPASTRING_ACH_09_HOWTO 405 +#define SPASTRING_ACH_13_HOWTO 406 +#define SPASTRING_ACH_14_HOWTO 407 +#define SPASTRING_ACH_15_HOWTO 408 +#define SPASTRING_ACH_16_HOWTO 409 +#define SPASTRING_ACH_04_HOWTO 410 +#define SPASTRING_ACH_10_HOWTO 411 +#define SPASTRING_STR_GAMEMODE_SINGLEPLAYER 420 +#define SPASTRING_ACH_05_HOWTO 429 +#define SPASTRING_ACH_05_NAME 430 +#define SPASTRING_ACH_05_DESC 431 +#define SPASTRING_ACH_11_HOWTO 432 +#define SPASTRING_ACH_11_NAME 433 +#define SPASTRING_ACH_11_DESC 434 +#define SPASTRING_ACH_06_HOWTO 435 +#define SPASTRING_ACH_06_NAME 436 +#define SPASTRING_ACH_06_DESC 437 +#define SPASTRING_ACH_12_HOWTO 438 +#define SPASTRING_ACH_12_NAME 439 +#define SPASTRING_ACH_12_DESC 440 +#define SPASTRING_ACH_17_HOWTO 441 +#define SPASTRING_ACH_17_NAME 442 +#define SPASTRING_ACH_17_DESC 443 +#define SPASTRING_ACH_18_HOWTO 444 +#define SPASTRING_ACH_18_NAME 445 +#define SPASTRING_ACH_18_DESC 446 +#define SPASTRING_ACH_19_HOWTO 447 +#define SPASTRING_ACH_19_NAME 448 +#define SPASTRING_ACH_19_DESC 449 +#define SPASTRING_ACH_20_HOWTO 450 +#define SPASTRING_ACH_20_NAME 451 +#define SPASTRING_ACH_20_DESC 452 +#define SPASTRING_AV_PORKCHOP_TSHIRT_HOWTO 473 +#define SPASTRING_AV_PORKCHOP_TSHIRT_TITLE1 474 +#define SPASTRING_AV_PORKCHOP_TSHIRT_TITLE2 475 +#define SPASTRING_AV_PORKCHOP_TSHIRT_DESC 476 +#define SPASTRING_AV_WATCH_HOWTO 477 +#define SPASTRING_AV_WATCH_TITLE1 478 +#define SPASTRING_AV_WATCH_TITLE2 479 +#define SPASTRING_AV_WATCH_DESC 480 +#define SPASTRING_PRESENCE_MULTIPLAYER_NAME 490 +#define SPASTRING_CT_GAME_STATE_NAME 492 +#define SPASTRING_CV_GAME_STATE_BLANK_NAME 496 +#define SPASTRING_CV_GAME_STATE_RIDING_PIG_NAME 497 #define SPASTRING_CV_GAME_STATE_RIDING_MINECART_NAME 498 -#define SPASTRING_CV_GAME_STATE_BOATING_NAME 499 -#define SPASTRING_CV_GAME_STATE_FISHING_NAME 500 -#define SPASTRING_CV_GAME_STATE_CRAFTING_NAME 501 -#define SPASTRING_CV_GAME_STATE_FORGING_NAME 502 -#define SPASTRING_CV_GAME_STATE_NETHER_NAME 503 -#define SPASTRING_CV_GAME_STATE_CD_NAME 504 -#define SPASTRING_CV_GAME_STATE_MAP_NAME 505 -#define SPASTRING_AV_CAP_HOWTO 506 -#define SPASTRING_AV_CAP_TITLE1 507 -#define SPASTRING_AV_CAP_TITLE2 508 -#define SPASTRING_AV_CAP_DESC 509 -#define SPASTRING_GM_MULTIPLAYER_NAME 517 -#define SPASTRING_PROPERTY_LOCALE_NAME 520 -#define SPASTRING_LB_KILLS_EASY_NAME 523 -#define SPASTRING_LB_KILLS_EASY_ZOMBIES_NAME 524 -#define SPASTRING_LB_KILLS_EASY_SKELETONS_NAME 525 -#define SPASTRING_LB_KILLS_EASY_CREEPERS_NAME 526 -#define SPASTRING_LB_KILLS_EASY_SPIDERS_NAME 527 -#define SPASTRING_LB_KILLS_EASY_SPIDERJOCKEYS_NAME 528 -#define SPASTRING_LB_KILLS_EASY_ZOMBIEPIGMEN_NAME 529 -#define SPASTRING_LB_KILLS_EASY_SLIME_NAME 530 -#define SPASTRING_LB_KILLS_EASY_RATING_NAME 531 -#define SPASTRING_PROPERTY_RATING_NAME 532 -#define SPASTRING_LB_KILLS_EASY_LOCALE_NAME 533 -#define SPASTRING_PROPERTY_KILLS_ZOMBIE_NAME 534 -#define SPASTRING_PROPERTY_KILLS_SKELETON_NAME 535 -#define SPASTRING_PROPERTY_KILLS_CREEPER_NAME 536 -#define SPASTRING_PROPERTY_KILLS_SPIDER_NAME 537 -#define SPASTRING_PROPERTY_KILLS_SPIDERJOCKEY_NAME 538 -#define SPASTRING_PROPERTY_KILLS_ZOMBIEPIGMAN_NAME 539 -#define SPASTRING_PROPERTY_KILLS_SLIME_NAME 540 -#define SPASTRING_PROPERTY_KILLS_GHAST_NAME 541 -#define SPASTRING_LB_KILLS_NORMAL_NAME 543 -#define SPASTRING_LB_KILLS_NORMAL_LOCALE_NAME 544 -#define SPASTRING_LB_KILLS_NORMAL_ZOMBIES_NAME 545 -#define SPASTRING_LB_KILLS_NORMAL_SKELETONS_NAME 546 -#define SPASTRING_LB_KILLS_NORMAL_CREEPERS_NAME 547 -#define SPASTRING_LB_KILLS_NORMAL_SPIDERS_NAME 548 +#define SPASTRING_CV_GAME_STATE_BOATING_NAME 499 +#define SPASTRING_CV_GAME_STATE_FISHING_NAME 500 +#define SPASTRING_CV_GAME_STATE_CRAFTING_NAME 501 +#define SPASTRING_CV_GAME_STATE_FORGING_NAME 502 +#define SPASTRING_CV_GAME_STATE_NETHER_NAME 503 +#define SPASTRING_CV_GAME_STATE_CD_NAME 504 +#define SPASTRING_CV_GAME_STATE_MAP_NAME 505 +#define SPASTRING_AV_CAP_HOWTO 506 +#define SPASTRING_AV_CAP_TITLE1 507 +#define SPASTRING_AV_CAP_TITLE2 508 +#define SPASTRING_AV_CAP_DESC 509 +#define SPASTRING_GM_MULTIPLAYER_NAME 517 +#define SPASTRING_PROPERTY_LOCALE_NAME 520 +#define SPASTRING_LB_KILLS_EASY_NAME 523 +#define SPASTRING_LB_KILLS_EASY_ZOMBIES_NAME 524 +#define SPASTRING_LB_KILLS_EASY_SKELETONS_NAME 525 +#define SPASTRING_LB_KILLS_EASY_CREEPERS_NAME 526 +#define SPASTRING_LB_KILLS_EASY_SPIDERS_NAME 527 +#define SPASTRING_LB_KILLS_EASY_SPIDERJOCKEYS_NAME 528 +#define SPASTRING_LB_KILLS_EASY_ZOMBIEPIGMEN_NAME 529 +#define SPASTRING_LB_KILLS_EASY_SLIME_NAME 530 +#define SPASTRING_LB_KILLS_EASY_RATING_NAME 531 +#define SPASTRING_PROPERTY_RATING_NAME 532 +#define SPASTRING_LB_KILLS_EASY_LOCALE_NAME 533 +#define SPASTRING_PROPERTY_KILLS_ZOMBIE_NAME 534 +#define SPASTRING_PROPERTY_KILLS_SKELETON_NAME 535 +#define SPASTRING_PROPERTY_KILLS_CREEPER_NAME 536 +#define SPASTRING_PROPERTY_KILLS_SPIDER_NAME 537 +#define SPASTRING_PROPERTY_KILLS_SPIDERJOCKEY_NAME 538 +#define SPASTRING_PROPERTY_KILLS_ZOMBIEPIGMAN_NAME 539 +#define SPASTRING_PROPERTY_KILLS_SLIME_NAME 540 +#define SPASTRING_PROPERTY_KILLS_GHAST_NAME 541 +#define SPASTRING_LB_KILLS_NORMAL_NAME 543 +#define SPASTRING_LB_KILLS_NORMAL_LOCALE_NAME 544 +#define SPASTRING_LB_KILLS_NORMAL_ZOMBIES_NAME 545 +#define SPASTRING_LB_KILLS_NORMAL_SKELETONS_NAME 546 +#define SPASTRING_LB_KILLS_NORMAL_CREEPERS_NAME 547 +#define SPASTRING_LB_KILLS_NORMAL_SPIDERS_NAME 548 #define SPASTRING_LB_KILLS_NORMAL_SPIDERJOCKEYS_NAME 549 #define SPASTRING_LB_KILLS_NORMAL_ZOMBIEPIGMEN_NAME 550 -#define SPASTRING_LB_KILLS_NORMAL_SLIME_NAME 551 -#define SPASTRING_LB_KILLS_NORMAL_RATING_NAME 552 -#define SPASTRING_LB_KILLS_HARD_NAME 554 -#define SPASTRING_LB_KILLS_HARD_LOCALE_NAME 555 -#define SPASTRING_LB_KILLS_HARD_ZOMBIES_NAME 556 -#define SPASTRING_LB_KILLS_HARD_SKELETONS_NAME 557 -#define SPASTRING_LB_KILLS_HARD_CREEPERS_NAME 558 -#define SPASTRING_LB_KILLS_HARD_SPIDERS_NAME 559 -#define SPASTRING_LB_KILLS_HARD_SPIDERJOCKEYS_NAME 560 -#define SPASTRING_LB_KILLS_HARD_ZOMBIEPIGMEN_NAME 561 -#define SPASTRING_LB_KILLS_HARD_SLIME_NAME 562 -#define SPASTRING_LB_KILLS_HARD_RATING_NAME 563 -#define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_NAME 564 +#define SPASTRING_LB_KILLS_NORMAL_SLIME_NAME 551 +#define SPASTRING_LB_KILLS_NORMAL_RATING_NAME 552 +#define SPASTRING_LB_KILLS_HARD_NAME 554 +#define SPASTRING_LB_KILLS_HARD_LOCALE_NAME 555 +#define SPASTRING_LB_KILLS_HARD_ZOMBIES_NAME 556 +#define SPASTRING_LB_KILLS_HARD_SKELETONS_NAME 557 +#define SPASTRING_LB_KILLS_HARD_CREEPERS_NAME 558 +#define SPASTRING_LB_KILLS_HARD_SPIDERS_NAME 559 +#define SPASTRING_LB_KILLS_HARD_SPIDERJOCKEYS_NAME 560 +#define SPASTRING_LB_KILLS_HARD_ZOMBIEPIGMEN_NAME 561 +#define SPASTRING_LB_KILLS_HARD_SLIME_NAME 562 +#define SPASTRING_LB_KILLS_HARD_RATING_NAME 563 +#define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_NAME 564 #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_LOCALE_NAME 565 #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_DIRT_NAME 566 #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_STONE_NAME 567 @@ -519,46 +518,46 @@ extern "C" { #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_CLAY_NAME 571 #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_OBSIDIAN_NAME 572 #define SPASTRING_LB_MINING_BLOCKS_PEACEFUL_RATING_NAME 573 -#define SPASTRING_PROPERTY_MINED_DIRT_NAME 574 -#define SPASTRING_PROPERTY_MINED_STONE_NAME 575 -#define SPASTRING_PROPERTY_MINED_SAND_NAME 576 -#define SPASTRING_PROPERTY_MINED_COBBLESTONE_NAME 577 -#define SPASTRING_PROPERTY_MINED_GRAVEL_NAME 578 -#define SPASTRING_PROPERTY_MINED_CLAY_NAME 579 -#define SPASTRING_PROPERTY_MINED_OBSIDIAN_NAME 580 -#define SPASTRING_PROPERTY_MINED_COAL_NAME 581 -#define SPASTRING_PROPERTY_MINED_IRON_NAME 582 -#define SPASTRING_PROPERTY_MINED_GOLD_NAME 583 -#define SPASTRING_PROPERTY_MINED_DIAMOND_NAME 584 -#define SPASTRING_PROPERTY_MINED_REDSTONE_NAME 585 -#define SPASTRING_PROPERTY_MINED_LAPISLAZULI_NAME 586 -#define SPASTRING_PROPERTY_MINED_NETHERRACK_NAME 587 -#define SPASTRING_PROPERTY_MINED_SOULSAND_NAME 588 -#define SPASTRING_PROPERTY_MINED_GLOWSTONE_NAME 589 -#define SPASTRING_PROPERTY_COLLECTED_EGG_NAME 590 -#define SPASTRING_PROPERTY_COLLECTED_WHEAT_NAME 591 -#define SPASTRING_PROPERTY_COLLECTED_MUSHROOM_NAME 592 +#define SPASTRING_PROPERTY_MINED_DIRT_NAME 574 +#define SPASTRING_PROPERTY_MINED_STONE_NAME 575 +#define SPASTRING_PROPERTY_MINED_SAND_NAME 576 +#define SPASTRING_PROPERTY_MINED_COBBLESTONE_NAME 577 +#define SPASTRING_PROPERTY_MINED_GRAVEL_NAME 578 +#define SPASTRING_PROPERTY_MINED_CLAY_NAME 579 +#define SPASTRING_PROPERTY_MINED_OBSIDIAN_NAME 580 +#define SPASTRING_PROPERTY_MINED_COAL_NAME 581 +#define SPASTRING_PROPERTY_MINED_IRON_NAME 582 +#define SPASTRING_PROPERTY_MINED_GOLD_NAME 583 +#define SPASTRING_PROPERTY_MINED_DIAMOND_NAME 584 +#define SPASTRING_PROPERTY_MINED_REDSTONE_NAME 585 +#define SPASTRING_PROPERTY_MINED_LAPISLAZULI_NAME 586 +#define SPASTRING_PROPERTY_MINED_NETHERRACK_NAME 587 +#define SPASTRING_PROPERTY_MINED_SOULSAND_NAME 588 +#define SPASTRING_PROPERTY_MINED_GLOWSTONE_NAME 589 +#define SPASTRING_PROPERTY_COLLECTED_EGG_NAME 590 +#define SPASTRING_PROPERTY_COLLECTED_WHEAT_NAME 591 +#define SPASTRING_PROPERTY_COLLECTED_MUSHROOM_NAME 592 #define SPASTRING_PROPERTY_COLLECTED_SUGARCANE_NAME 593 -#define SPASTRING_PROPERTY_COLLECTED_MILK_NAME 594 -#define SPASTRING_PROPERTY_COLLECTED_PUMPKIN_NAME 595 -#define SPASTRING_PROPERTY_TRAVEL_WALK_NAME 596 -#define SPASTRING_PROPERTY_TRAVEL_SWIM_NAME 597 -#define SPASTRING_PROPERTY_TRAVEL_FALL_NAME 598 -#define SPASTRING_PROPERTY_TRAVEL_CLIMB_NAME 599 -#define SPASTRING_PROPERTY_TRAVEL_MINECART_NAME 600 -#define SPASTRING_PROPERTY_TRAVEL_BOAT_NAME 601 -#define SPASTRING_PROPERTY_PORTALS_CREATED_NAME 603 -#define SPASTRING_LB_MINING_BLOCKS_EASY_NAME 605 +#define SPASTRING_PROPERTY_COLLECTED_MILK_NAME 594 +#define SPASTRING_PROPERTY_COLLECTED_PUMPKIN_NAME 595 +#define SPASTRING_PROPERTY_TRAVEL_WALK_NAME 596 +#define SPASTRING_PROPERTY_TRAVEL_SWIM_NAME 597 +#define SPASTRING_PROPERTY_TRAVEL_FALL_NAME 598 +#define SPASTRING_PROPERTY_TRAVEL_CLIMB_NAME 599 +#define SPASTRING_PROPERTY_TRAVEL_MINECART_NAME 600 +#define SPASTRING_PROPERTY_TRAVEL_BOAT_NAME 601 +#define SPASTRING_PROPERTY_PORTALS_CREATED_NAME 603 +#define SPASTRING_LB_MINING_BLOCKS_EASY_NAME 605 #define SPASTRING_LB_MINING_BLOCKS_EASY_LOCALE_NAME 606 -#define SPASTRING_LB_MINING_BLOCKS_EASY_DIRT_NAME 607 -#define SPASTRING_LB_MINING_BLOCKS_EASY_STONE_NAME 608 -#define SPASTRING_LB_MINING_BLOCKS_EASY_SAND_NAME 609 +#define SPASTRING_LB_MINING_BLOCKS_EASY_DIRT_NAME 607 +#define SPASTRING_LB_MINING_BLOCKS_EASY_STONE_NAME 608 +#define SPASTRING_LB_MINING_BLOCKS_EASY_SAND_NAME 609 #define SPASTRING_LB_MINING_BLOCKS_EASY_COBBLESTONE_NAME 610 #define SPASTRING_LB_MINING_BLOCKS_EASY_GRAVEL_NAME 611 -#define SPASTRING_LB_MINING_BLOCKS_EASY_CLAY_NAME 612 +#define SPASTRING_LB_MINING_BLOCKS_EASY_CLAY_NAME 612 #define SPASTRING_LB_MINING_BLOCKS_EASY_OBSIDIAN_NAME 613 #define SPASTRING_LB_MINING_BLOCKS_EASY_RATING_NAME 614 -#define SPASTRING_LB_MINING_BLOCKS_NORMAL_NAME 616 +#define SPASTRING_LB_MINING_BLOCKS_NORMAL_NAME 616 #define SPASTRING_LB_MINING_BLOCKS_NORMAL_LOCALE_NAME 617 #define SPASTRING_LB_MINING_BLOCKS_NORMAL_DIRT_NAME 618 #define SPASTRING_LB_MINING_BLOCKS_NORMAL_STONE_NAME 619 @@ -568,101 +567,98 @@ extern "C" { #define SPASTRING_LB_MINING_BLOCKS_NORMAL_CLAY_NAME 623 #define SPASTRING_LB_MINING_BLOCKS_NORMAL_OBSIDIAN_NAME 624 #define SPASTRING_LB_MINING_BLOCKS_NORMAL_RATING_NAME 625 -#define SPASTRING_LB_MINING_BLOCKS_HARD_NAME 627 +#define SPASTRING_LB_MINING_BLOCKS_HARD_NAME 627 #define SPASTRING_LB_MINING_BLOCKS_HARD_LOCALE_NAME 628 -#define SPASTRING_LB_MINING_BLOCKS_HARD_DIRT_NAME 629 -#define SPASTRING_LB_MINING_BLOCKS_HARD_STONE_NAME 630 -#define SPASTRING_LB_MINING_BLOCKS_HARD_SAND_NAME 631 +#define SPASTRING_LB_MINING_BLOCKS_HARD_DIRT_NAME 629 +#define SPASTRING_LB_MINING_BLOCKS_HARD_STONE_NAME 630 +#define SPASTRING_LB_MINING_BLOCKS_HARD_SAND_NAME 631 #define SPASTRING_LB_MINING_BLOCKS_HARD_COBBLESTONE_NAME 632 #define SPASTRING_LB_MINING_BLOCKS_HARD_GRAVEL_NAME 633 -#define SPASTRING_LB_MINING_BLOCKS_HARD_CLAY_NAME 634 +#define SPASTRING_LB_MINING_BLOCKS_HARD_CLAY_NAME 634 #define SPASTRING_LB_MINING_BLOCKS_HARD_OBSIDIAN_NAME 635 #define SPASTRING_LB_MINING_BLOCKS_HARD_RATING_NAME 636 -#define SPASTRING_LB_FARMING_PEACEFUL_NAME 676 -#define SPASTRING_LB_FARMING_PEACEFUL_LOCALE_NAME 677 -#define SPASTRING_LB_FARMING_PEACEFUL_EGGS_NAME 678 -#define SPASTRING_LB_FARMING_PEACEFUL_WHEAT_NAME 679 +#define SPASTRING_LB_FARMING_PEACEFUL_NAME 676 +#define SPASTRING_LB_FARMING_PEACEFUL_LOCALE_NAME 677 +#define SPASTRING_LB_FARMING_PEACEFUL_EGGS_NAME 678 +#define SPASTRING_LB_FARMING_PEACEFUL_WHEAT_NAME 679 #define SPASTRING_LB_FARMING_PEACEFUL_MUSHROOMS_NAME 680 #define SPASTRING_LB_FARMING_PEACEFUL_SUGARCANE_NAME 681 -#define SPASTRING_LB_FARMING_PEACEFUL_MILK_NAME 682 +#define SPASTRING_LB_FARMING_PEACEFUL_MILK_NAME 682 #define SPASTRING_LB_FARMING_PEACEFUL_PUMPKINS_NAME 683 -#define SPASTRING_LB_FARMING_PEACEFUL_RATING_NAME 684 -#define SPASTRING_LB_FARMING_EASY_NAME 686 -#define SPASTRING_LB_FARMING_EASY_LOCALE_NAME 687 -#define SPASTRING_LB_FARMING_EASY_EGGS_NAME 688 -#define SPASTRING_LB_FARMING_EASY_WHEAT_NAME 689 -#define SPASTRING_LB_FARMING_EASY_MUSHROOMS_NAME 690 -#define SPASTRING_LB_FARMING_EASY_SUGARCANE_NAME 691 -#define SPASTRING_LB_FARMING_EASY_MILK_NAME 692 -#define SPASTRING_LB_FARMING_EASY_PUMPKINS_NAME 693 -#define SPASTRING_LB_FARMING_EASY_RATING_NAME 694 -#define SPASTRING_LB_FARMING_NORMAL_NAME 696 -#define SPASTRING_LB_FARMING_NORMAL_LOCALE_NAME 697 -#define SPASTRING_LB_FARMING_NORMAL_EGGS_NAME 698 -#define SPASTRING_LB_FARMING_NORMAL_WHEAT_NAME 699 -#define SPASTRING_LB_FARMING_NORMAL_MUSHROOMS_NAME 700 -#define SPASTRING_LB_FARMING_NORMAL_SUGARCANE_NAME 701 -#define SPASTRING_LB_FARMING_NORMAL_MILK_NAME 702 -#define SPASTRING_LB_FARMING_NORMAL_PUMPKINS_NAME 703 -#define SPASTRING_LB_FARMING_NORMAL_RATING_NAME 704 -#define SPASTRING_LB_FARMING_HARD_NAME 706 -#define SPASTRING_LB_FARMING_HARD_LOCALE_NAME 707 -#define SPASTRING_LB_FARMING_HARD_EGGS_NAME 708 -#define SPASTRING_LB_FARMING_HARD_WHEAT_NAME 709 -#define SPASTRING_LB_FARMING_HARD_MUSHROOMS_NAME 710 -#define SPASTRING_LB_FARMING_HARD_SUGARCANE_NAME 711 -#define SPASTRING_LB_FARMING_HARD_MILK_NAME 712 -#define SPASTRING_LB_FARMING_HARD_PUMPKINS_NAME 713 -#define SPASTRING_LB_FARMING_HARD_RATING_NAME 714 -#define SPASTRING_LB_TRAVELLING_PEACEFUL_NAME 715 +#define SPASTRING_LB_FARMING_PEACEFUL_RATING_NAME 684 +#define SPASTRING_LB_FARMING_EASY_NAME 686 +#define SPASTRING_LB_FARMING_EASY_LOCALE_NAME 687 +#define SPASTRING_LB_FARMING_EASY_EGGS_NAME 688 +#define SPASTRING_LB_FARMING_EASY_WHEAT_NAME 689 +#define SPASTRING_LB_FARMING_EASY_MUSHROOMS_NAME 690 +#define SPASTRING_LB_FARMING_EASY_SUGARCANE_NAME 691 +#define SPASTRING_LB_FARMING_EASY_MILK_NAME 692 +#define SPASTRING_LB_FARMING_EASY_PUMPKINS_NAME 693 +#define SPASTRING_LB_FARMING_EASY_RATING_NAME 694 +#define SPASTRING_LB_FARMING_NORMAL_NAME 696 +#define SPASTRING_LB_FARMING_NORMAL_LOCALE_NAME 697 +#define SPASTRING_LB_FARMING_NORMAL_EGGS_NAME 698 +#define SPASTRING_LB_FARMING_NORMAL_WHEAT_NAME 699 +#define SPASTRING_LB_FARMING_NORMAL_MUSHROOMS_NAME 700 +#define SPASTRING_LB_FARMING_NORMAL_SUGARCANE_NAME 701 +#define SPASTRING_LB_FARMING_NORMAL_MILK_NAME 702 +#define SPASTRING_LB_FARMING_NORMAL_PUMPKINS_NAME 703 +#define SPASTRING_LB_FARMING_NORMAL_RATING_NAME 704 +#define SPASTRING_LB_FARMING_HARD_NAME 706 +#define SPASTRING_LB_FARMING_HARD_LOCALE_NAME 707 +#define SPASTRING_LB_FARMING_HARD_EGGS_NAME 708 +#define SPASTRING_LB_FARMING_HARD_WHEAT_NAME 709 +#define SPASTRING_LB_FARMING_HARD_MUSHROOMS_NAME 710 +#define SPASTRING_LB_FARMING_HARD_SUGARCANE_NAME 711 +#define SPASTRING_LB_FARMING_HARD_MILK_NAME 712 +#define SPASTRING_LB_FARMING_HARD_PUMPKINS_NAME 713 +#define SPASTRING_LB_FARMING_HARD_RATING_NAME 714 +#define SPASTRING_LB_TRAVELLING_PEACEFUL_NAME 715 #define SPASTRING_LB_TRAVELLING_PEACEFUL_LOCALE_NAME 716 #define SPASTRING_LB_TRAVELLING_PEACEFUL_WALKED_NAME 717 -#define SPASTRING_LB_TRAVELLING_PEACEFUL_SWAM_NAME 718 +#define SPASTRING_LB_TRAVELLING_PEACEFUL_SWAM_NAME 718 #define SPASTRING_LB_TRAVELLING_PEACEFUL_FALLEN_NAME 719 #define SPASTRING_LB_TRAVELLING_PEACEFUL_CLIMBED_NAME 720 #define SPASTRING_LB_TRAVELLING_PEACEFUL_MINECART_NAME 721 -#define SPASTRING_LB_TRAVELLING_PEACEFUL_BOAT_NAME 722 +#define SPASTRING_LB_TRAVELLING_PEACEFUL_BOAT_NAME 722 #define SPASTRING_LB_TRAVELLING_PEACEFUL_RATING_NAME 724 -#define SPASTRING_LB_TRAVELLING_EASY_NAME 726 -#define SPASTRING_LB_TRAVELLING_EASY_LOCALE_NAME 727 -#define SPASTRING_LB_TRAVELLING_EASY_WALKED_NAME 728 -#define SPASTRING_LB_TRAVELLING_EASY_SWAM_NAME 729 -#define SPASTRING_LB_TRAVELLING_EASY_FALLEN_NAME 730 -#define SPASTRING_LB_TRAVELLING_EASY_CLIMBED_NAME 731 -#define SPASTRING_LB_TRAVELLING_EASY_MINECART_NAME 732 -#define SPASTRING_LB_TRAVELLING_EASY_BOAT_NAME 733 -#define SPASTRING_LB_TRAVELLING_EASY_RATING_NAME 735 -#define SPASTRING_LB_TRAVELLING_NORMAL_NAME 737 -#define SPASTRING_LB_TRAVELLING_NORMAL_LOCALE_NAME 738 -#define SPASTRING_LB_TRAVELLING_NORMAL_WALKED_NAME 739 -#define SPASTRING_LB_TRAVELLING_NORMAL_SWAM_NAME 740 -#define SPASTRING_LB_TRAVELLING_NORMAL_FALLEN_NAME 741 +#define SPASTRING_LB_TRAVELLING_EASY_NAME 726 +#define SPASTRING_LB_TRAVELLING_EASY_LOCALE_NAME 727 +#define SPASTRING_LB_TRAVELLING_EASY_WALKED_NAME 728 +#define SPASTRING_LB_TRAVELLING_EASY_SWAM_NAME 729 +#define SPASTRING_LB_TRAVELLING_EASY_FALLEN_NAME 730 +#define SPASTRING_LB_TRAVELLING_EASY_CLIMBED_NAME 731 +#define SPASTRING_LB_TRAVELLING_EASY_MINECART_NAME 732 +#define SPASTRING_LB_TRAVELLING_EASY_BOAT_NAME 733 +#define SPASTRING_LB_TRAVELLING_EASY_RATING_NAME 735 +#define SPASTRING_LB_TRAVELLING_NORMAL_NAME 737 +#define SPASTRING_LB_TRAVELLING_NORMAL_LOCALE_NAME 738 +#define SPASTRING_LB_TRAVELLING_NORMAL_WALKED_NAME 739 +#define SPASTRING_LB_TRAVELLING_NORMAL_SWAM_NAME 740 +#define SPASTRING_LB_TRAVELLING_NORMAL_FALLEN_NAME 741 #define SPASTRING_LB_TRAVELLING_NORMAL_CLIMBED_NAME 742 #define SPASTRING_LB_TRAVELLING_NORMAL_MINECART_NAME 743 -#define SPASTRING_LB_TRAVELLING_NORMAL_BOAT_NAME 744 -#define SPASTRING_LB_TRAVELLING_NORMAL_RATING_NAME 746 -#define SPASTRING_LB_TRAVELLING_HARD_NAME 748 -#define SPASTRING_LB_TRAVELLING_HARD_LOCALE_NAME 749 -#define SPASTRING_LB_TRAVELLING_HARD_WALKED_NAME 750 -#define SPASTRING_LB_TRAVELLING_HARD_SWAM_NAME 751 -#define SPASTRING_LB_TRAVELLING_HARD_FALLEN_NAME 752 -#define SPASTRING_LB_TRAVELLING_HARD_CLIMBED_NAME 753 -#define SPASTRING_LB_TRAVELLING_HARD_MINECART_NAME 754 -#define SPASTRING_LB_TRAVELLING_HARD_BOAT_NAME 755 -#define SPASTRING_LB_TRAVELLING_HARD_RATING_NAME 757 -#define SPASTRING_LB_TRAVELLING_TOTAL_NAME 795 -#define SPASTRING_LB_TRAVELLING_TOTAL_RATING_NAME 796 +#define SPASTRING_LB_TRAVELLING_NORMAL_BOAT_NAME 744 +#define SPASTRING_LB_TRAVELLING_NORMAL_RATING_NAME 746 +#define SPASTRING_LB_TRAVELLING_HARD_NAME 748 +#define SPASTRING_LB_TRAVELLING_HARD_LOCALE_NAME 749 +#define SPASTRING_LB_TRAVELLING_HARD_WALKED_NAME 750 +#define SPASTRING_LB_TRAVELLING_HARD_SWAM_NAME 751 +#define SPASTRING_LB_TRAVELLING_HARD_FALLEN_NAME 752 +#define SPASTRING_LB_TRAVELLING_HARD_CLIMBED_NAME 753 +#define SPASTRING_LB_TRAVELLING_HARD_MINECART_NAME 754 +#define SPASTRING_LB_TRAVELLING_HARD_BOAT_NAME 755 +#define SPASTRING_LB_TRAVELLING_HARD_RATING_NAME 757 +#define SPASTRING_LB_TRAVELLING_TOTAL_NAME 795 +#define SPASTRING_LB_TRAVELLING_TOTAL_RATING_NAME 796 #define SPASTRING_LB_ARCADE_TRAVELLING_TOTAL_RATING_NAME 797 #define SPASTRING_PROPERTY_COLLECTED_NETHERLAVA_NAME 799 -#define SPASTRING_PRESENCE_MULTIPLAYEROFFLINE_NAME 803 -#define SPASTRING_PRESENCE_MULTIPLAYER_1P_NAME 804 +#define SPASTRING_PRESENCE_MULTIPLAYEROFFLINE_NAME 803 +#define SPASTRING_PRESENCE_MULTIPLAYER_1P_NAME 804 #define SPASTRING_PRESENCE_MULTIPLAYER_1POFFLINE_NAME 805 - #ifdef __cplusplus } #endif -#endif // __MINECRAFT_SPA_H__ - - +#endif // __MINECRAFT_SPA_H__ diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.cpp b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.cpp index 0fb20b8a3..d8727b35c 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.cpp +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.cpp @@ -2,24 +2,30 @@ // // This implements the Iggy graphics driver layer for Direct3D 9. -// 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. +// 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, +// 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 D3D_NoMoreGDrawThisFrame and set_render_target // - set_texture -// - set_renderstate and set_renderstate_full. These are the main places where render state changes occur; +// - 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 +// - 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 WIN32_LEAN_AND_MEAN @@ -29,8 +35,9 @@ #include // 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(push) +#pragma warning(disable \ + : 4201) // nonstandard extension used : nameless struct/union #include "../include/gdraw.h" #include "../include/iggy.h" @@ -38,52 +45,53 @@ // The native handle type holds resource handles and a coarse description. typedef union { - // handle that is a texture - struct { - IDirect3DTexture9 *d3d; - IDirect3DTexture9 *d3d_msaa; - U32 w, h; - } tex; + // handle that is a texture + struct { + IDirect3DTexture9* d3d; + IDirect3DTexture9* d3d_msaa; + U32 w, h; + } tex; - // handle that is a vertex buffer - struct { - IDirect3DVertexBuffer9 *base; - IDirect3DIndexBuffer9 *indices; - } vbuf; + // handle that is a vertex buffer + struct { + IDirect3DVertexBuffer9* base; + IDirect3DIndexBuffer9* indices; + } vbuf; } GDrawNativeHandle; -#define GDRAW_D3D // this controls the next include so the cache gets declared with the correct types, which makes it typesafe +#define GDRAW_D3D // this controls the next include so the cache gets declared + // with the correct types, which makes it typesafe #include "gdraw_shared.inl" -#pragma warning (pop) +#pragma warning(pop) // 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 QUAD_IB_COUNT 2048 // quad index buffer has indices for this many quads +#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 QUAD_IB_COUNT 2048 // quad index buffer has indices for this many quads -#define ASSERT_COUNT(a,b) ((a) == (b) ? (b) : -1) +#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; +typedef struct { + GDrawHandle* color_buffer; + S32 base_x, base_y, width, height; + U32 flags; + rrbool cached; } GDrawFramebufferState; -struct ProgramWithCachedVariableLocations -{ - DWORD *bytecode; - union { - IDirect3DPixelShader9 *pshader; - IDirect3DVertexShader9 *vshader; - }; - int vars[MAX_VARS]; // it's unsigned in d3d, but we want an 'undefined' value +struct ProgramWithCachedVariableLocations { + DWORD* bytecode; + union { + IDirect3DPixelShader9* pshader; + IDirect3DVertexShader9* vshader; + }; + int vars[MAX_VARS]; // it's unsigned in d3d, but we want an 'undefined' + // value }; /////////////////////////////////////////////////////////////////////////////// @@ -97,149 +105,148 @@ struct ProgramWithCachedVariableLocations // graphics state so that it doesn't have to callback into Iggy // to get at that graphics state. -typedef struct -{ - IDirect3DDevice9 *d3d_device; +typedef struct { + IDirect3DDevice9* d3d_device; - // 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 manual_clear; + // 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 manual_clear; - // vertex declarations - IDirect3DVertexDeclaration9 *vdec[GDRAW_vformat__count]; + // vertex declarations + IDirect3DVertexDeclaration9* vdec[GDRAW_vformat__count]; - // vertex shaders - ProgramWithCachedVariableLocations vert[GDRAW_vformat__count]; // [format] + // 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 + // 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 + gswf_recti rt_valid[MAX_RENDER_STACK_DEPTH + + 1]; // valid rect for texture clamping - // size of our render targets - S32 frametex_width, frametex_height; + // size of our render targets + 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 + // 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; + S32 tx0, ty0; + S32 tx0p, ty0p; + rrbool in_blur; - F32 projection[4]; // scalex,scaley,transx,transy - rrbool use_3d; - F32 xform_3d[3][4]; + F32 projection[4]; // scalex,scaley,transx,transy + rrbool use_3d; + F32 xform_3d[3][4]; - IDirect3DSurface9 *main_framebuffer; - IDirect3DSurface9 *main_depthbuffer; - IDirect3DSurface9 *rt_depthbuffer; // non-multisampled rendertarget depth buffer. only used when MSAA is on! - rrbool main_msaa; // does main framebuffer have MSAA enabled? + IDirect3DSurface9* main_framebuffer; + IDirect3DSurface9* main_depthbuffer; + IDirect3DSurface9* rt_depthbuffer; // non-multisampled rendertarget depth + // buffer. only used when MSAA is on! + rrbool main_msaa; // does main framebuffer have MSAA enabled? - IDirect3DTexture9 *aa_tex; + IDirect3DTexture9* aa_tex; - // scale factors converting worldspace to viewspace <0,0>.. - F32 world_to_pixel[2]; + // scale factors converting worldspace to viewspace <0,0>.. + F32 world_to_pixel[2]; - // cached state - U32 scissor_state; // ~0 if unknown, otherwise 0 or 1 - int blend_mode; // -1 if unknown, otherwise GDRAW_BLEND_* - U32 stencil_key; // field built from stencil test flags. 0=no stencil, ~0 is used for "unknown state" - U32 z_key; // same for z-writes/z-test - rrbool last_was_3d; + // cached state + U32 scissor_state; // ~0 if unknown, otherwise 0 or 1 + int blend_mode; // -1 if unknown, otherwise GDRAW_BLEND_* + U32 stencil_key; // field built from stencil test flags. 0=no stencil, ~0 + // is used for "unknown state" + U32 z_key; // same for z-writes/z-test + rrbool last_was_3d; - // render-state stack described above for 'temporary' rendering - GDrawFramebufferState frame[MAX_RENDER_STACK_DEPTH]; - GDrawFramebufferState *cur; + // 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; + // texture and vertex buffer pools + GDrawHandleCache* texturecache; + GDrawHandleCache* vbufcache; - // mipmapping - GDrawMipmapContext mipmap; - rrbool conditional_nonpow2; + // mipmapping + GDrawMipmapContext mipmap; + rrbool conditional_nonpow2; - // stat tracking - rrbool frame_done; - U64 frame_counter; + // stat tracking + rrbool frame_done; + U64 frame_counter; - // error reporting - void (__cdecl *error_handler)(HRESULT hr); + // error reporting + void(__cdecl* error_handler)(HRESULT hr); } GDraw; -static GDraw *gdraw; +static GDraw* gdraw; // not a real index buffer because we only get quads via user pointer -static U16 quad_ib[QUAD_IB_COUNT*6]; - +static U16 quad_ib[QUAD_IB_COUNT * 6]; //////////////////////////////////////////////////////////////////////// // // Error handling // -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 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); } - //////////////////////////////////////////////////////////////////////// // // General resource management for both textures and vertex buffers // -template -static void safe_release(T *&p) -{ - if (p) { - p->Release(); - p = NULL; - } +template +static void safe_release(T*& p) { + if (p) { + p->Release(); + p = NULL; + } } -static void unbind_resources(void) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - S32 i; +static void unbind_resources(void) { + IDirect3DDevice9* d3d = gdraw->d3d_device; + S32 i; - // unset active textures and vertex/index buffers, - // to make sure there are no dangling refs - for (i=0; i < 3; ++i) - d3d->SetTexture(i, NULL); + // unset active textures and vertex/index buffers, + // to make sure there are no dangling refs + for (i = 0; i < 3; ++i) d3d->SetTexture(i, NULL); - d3d->SetStreamSource(0, NULL, 0, 0); - d3d->SetIndices(NULL); + d3d->SetStreamSource(0, NULL, 0, 0); + d3d->SetIndices(NULL); } -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); - } else { - safe_release(r->handle.vbuf.base); - safe_release(r->handle.vbuf.indices); - } - } +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); + } else { + safe_release(r->handle.vbuf.base); + safe_release(r->handle.vbuf.indices); + } + } } -static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) -{ - gdraw_HandleCacheUnlockAll(gdraw->texturecache); - gdraw_HandleCacheUnlockAll(gdraw->vbufcache); +static void RADLINK gdraw_UnlockHandles(GDrawStats* /*stats*/) { + gdraw_HandleCacheUnlockAll(gdraw->texturecache); + gdraw_HandleCacheUnlockAll(gdraw->vbufcache); } //////////////////////////////////////////////////////////////////////// @@ -247,259 +254,278 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) // Texture creation/updating/deletion // -extern GDrawTexture *gdraw_D3D_WrappedTextureCreate(IDirect3DTexture9 *texhandle) -{ - 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 = texhandle; - p->handle.tex.w = 1; - p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); - return (GDrawTexture *) p; +extern GDrawTexture* gdraw_D3D_WrappedTextureCreate( + IDirect3DTexture9* texhandle) { + 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 = texhandle; + 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_D3D_WrappedTextureChange(GDrawTexture *tex, IDirect3DTexture9 *texhandle) -{ - GDrawHandle *p = (GDrawHandle *) tex; - p->handle.tex.d3d = texhandle; +extern void gdraw_D3D_WrappedTextureChange(GDrawTexture* tex, + IDirect3DTexture9* texhandle) { + GDrawHandle* p = (GDrawHandle*)tex; + p->handle.tex.d3d = texhandle; } -extern void gdraw_D3D_WrappedTextureDestroy(GDrawTexture *tex) -{ - GDrawStats stats={0}; - gdraw_res_free((GDrawHandle *) tex, &stats); +extern void gdraw_D3D_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 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; + D3DFORMAT d3dfmt; + S32 bpp; -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; - D3DFORMAT d3dfmt; - S32 bpp; + if (format == GDRAW_TEXTURE_FORMAT_rgba32) { + d3dfmt = D3DFMT_A8R8G8B8; + bpp = 4; + } else { + d3dfmt = D3DFMT_A8; + bpp = 1; + } - if (format == GDRAW_TEXTURE_FORMAT_rgba32) { - d3dfmt = D3DFMT_A8R8G8B8; - bpp = 4; - } else { - d3dfmt = D3DFMT_A8; - bpp = 1; - } + // compute estimated size of texture in video memory + S32 size = width * height * bpp; + if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) + size = size * 4 / 3; // not correct for non-square - // compute estimated size of texture in video memory - S32 size = width*height*bpp; - if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) - size = size*4/3; // not correct for non-square + // allocate a handle and make room in the cache for this much data + t = gdraw_res_alloc_begin(gdraw->texturecache, size, stats); + if (!t) return NULL; - // allocate a handle and make room in the cache for this much data - t = gdraw_res_alloc_begin(gdraw->texturecache, size, stats); - if (!t) - return NULL; + HRESULT hr = gdraw->d3d_device->CreateTexture( + width, height, (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) ? 0 : 1, 0, + d3dfmt, D3DPOOL_MANAGED, &t->handle.tex.d3d, NULL); - HRESULT hr = gdraw->d3d_device->CreateTexture(width, height, (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) ? 0 : 1, - 0, d3dfmt, D3DPOOL_MANAGED, &t->handle.tex.d3d, NULL); + if (FAILED(hr)) { + gdraw_HandleCacheAllocateFail(t); + IggyGDrawSendWarning( + NULL, "GDraw CreateTexture() call failed with error code 0x%08x", + hr); + return false; + } - if (FAILED(hr)) { - gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw CreateTexture() call failed with error code 0x%08x", hr); - return false; - } + t->handle.tex.w = width; + t->handle.tex.h = height; - t->handle.tex.w = width; - t->handle.tex.h = height; + gdraw_HandleCacheAllocateEnd(t, size, owner, + (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 += size; - gdraw_HandleCacheAllocateEnd(t, size, owner, (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 += size; + p->texture_type = GDRAW_TEXTURE_TYPE_bgra; + p->p0 = t; - p->texture_type = GDRAW_TEXTURE_TYPE_bgra; - p->p0 = t; + if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) { + rrbool ok; + assert(p->temp_buffer != NULL); + ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, + t->handle.tex.d3d->GetLevelCount(), bpp, + p->temp_buffer, p->temp_buffer_bytes); + assert(ok); // this should never trigger unless the temp_buffer is way + // too small - if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) { - rrbool ok; - assert(p->temp_buffer != NULL); - ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, t->handle.tex.d3d->GetLevelCount(), bpp, p->temp_buffer, p->temp_buffer_bytes); - assert(ok); // this should never trigger unless the temp_buffer is way too small + p->p1 = &gdraw->mipmap; + p->texture_data = gdraw->mipmap.pixels[0]; + p->num_rows = gdraw->mipmap.bheight; + p->stride_in_bytes = gdraw->mipmap.pitch[0]; + p->i0 = 0; // current output y + p->i1 = bpp; + } else { + D3DLOCKED_RECT z; + hr = t->handle.tex.d3d->LockRect(0, &z, NULL, 0); + if (FAILED(hr)) { + t->handle.tex.d3d->Release(); + gdraw_HandleCacheAllocateFail(t); - p->p1 = &gdraw->mipmap; - p->texture_data = gdraw->mipmap.pixels[0]; - p->num_rows = gdraw->mipmap.bheight; - p->stride_in_bytes = gdraw->mipmap.pitch[0]; - p->i0 = 0; // current output y - p->i1 = bpp; - } else { - D3DLOCKED_RECT z; - hr = t->handle.tex.d3d->LockRect(0, &z, NULL, 0); - if (FAILED(hr)) { - t->handle.tex.d3d->Release(); - gdraw_HandleCacheAllocateFail(t); + if (hr == E_OUTOFMEMORY) { + IggyGDrawSendWarning(NULL, + "GDraw out of texture memory allocating " + "%dx%d (%dbpp) texture", + width, height, 8 * bpp); + return false; + } else { + IggyGDrawSendWarning(NULL, + "GDraw LockRect for texture allocation " + "failed, D3D error 0x%08x\n", + hr); + return false; + } + } - if (hr == E_OUTOFMEMORY) { - IggyGDrawSendWarning(NULL, "GDraw out of texture memory allocating %dx%d (%dbpp) texture", width, height, 8*bpp); - return false; - } else { - IggyGDrawSendWarning(NULL, "GDraw LockRect for texture allocation failed, D3D error 0x%08x\n", hr); - return false; - } - } - - p->p1 = NULL; - p->texture_data = (U8 *) z.pBits; - p->num_rows = height; - p->stride_in_bytes = z.Pitch; - } + p->p1 = NULL; + p->texture_data = (U8*)z.pBits; + p->num_rows = height; + p->stride_in_bytes = z.Pitch; + } - return true; + return true; } -static rrbool RADLINK gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo *p) -{ - GDrawHandle *t = (GDrawHandle *) p->p0; - - if (p->p1) { - GDrawMipmapContext *c = (GDrawMipmapContext *) p->p1; - U32 outy = p->i0; - U32 bpp = p->i1; - U32 width = c->width; - U32 height = c->height; - U32 bheight = c->bheight; - U32 level = 0; +static rrbool RADLINK +gdraw_MakeTextureMore(GDraw_MakeTexture_ProcessingInfo* p) { + GDrawHandle* t = (GDrawHandle*)p->p0; - if (outy >= c->height) - return false; + if (p->p1) { + GDrawMipmapContext* c = (GDrawMipmapContext*)p->p1; + U32 outy = p->i0; + U32 bpp = p->i1; + U32 width = c->width; + U32 height = c->height; + U32 bheight = c->bheight; + U32 level = 0; - do { - // upload data for this miplevel - D3DLOCKED_RECT z; - HRESULT hr = t->handle.tex.d3d->LockRect(level, &z, NULL, 0); - if (FAILED(hr)) - return false; + if (outy >= c->height) return false; - for (U32 y=0; y < bheight; ++y) - memcpy((U8 *) z.pBits + ((outy >> level) + y) * z.Pitch, c->pixels[level] + y * c->pitch[level], width * bpp); - t->handle.tex.d3d->UnlockRect(level); + do { + // upload data for this miplevel + D3DLOCKED_RECT z; + HRESULT hr = t->handle.tex.d3d->LockRect(level, &z, NULL, 0); + if (FAILED(hr)) return false; - // prepare next miplevel - width = RR_MAX(width >> 1, 1); - height = RR_MAX(height >> 1, 1); - bheight = RR_MAX(bheight >> 1, 1); - } while (gdraw_MipmapAddLines(c, ++level)); + for (U32 y = 0; y < bheight; ++y) + memcpy((U8*)z.pBits + ((outy >> level) + y) * z.Pitch, + c->pixels[level] + y * c->pitch[level], width * bpp); + t->handle.tex.d3d->UnlockRect(level); - // prepare next chunk - p->i0 += p->num_rows; - p->texture_data = c->pixels[0]; - p->num_rows = c->bheight = RR_MIN(c->bheight, c->height - p->i0); - return true; - } else - return false; + // prepare next miplevel + width = RR_MAX(width >> 1, 1); + height = RR_MAX(height >> 1, 1); + bheight = RR_MAX(bheight >> 1, 1); + } while (gdraw_MipmapAddLines(c, ++level)); + + // prepare next chunk + p->i0 += p->num_rows; + p->texture_data = c->pixels[0]; + p->num_rows = c->bheight = RR_MIN(c->bheight, c->height - p->i0); + return true; + } else + return false; } -static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingInfo *p, GDrawStats * /*stats*/) -{ - GDrawHandle *t = (GDrawHandle *) p->p0; - if (p->p1) - gdraw_MakeTextureMore(p); // use more to upload the last batch of data - else - t->handle.tex.d3d->UnlockRect(0); +static GDrawTexture* RADLINK gdraw_MakeTextureEnd( + GDraw_MakeTexture_ProcessingInfo* p, GDrawStats* /*stats*/) { + GDrawHandle* t = (GDrawHandle*)p->p0; + if (p->p1) + gdraw_MakeTextureMore(p); // use more to upload the last batch of data + else + t->handle.tex.d3d->UnlockRect(0); - return (GDrawTexture *) t; + return (GDrawTexture*)t; } - -static rrbool RADLINK gdraw_UpdateTextureBegin(GDrawTexture *t, void *unique_id, GDrawStats * /*stats*/) -{ - return gdraw_HandleCacheLock((GDrawHandle *) t, unique_id); +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; - RECT rdest = { x, y, x+w, y+h }; - S32 i, bpl = (format == GDRAW_TEXTURE_FORMAT_font ? 1 : 4) * w; - D3DLOCKED_RECT lr; +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; + RECT rdest = {x, y, x + w, y + h}; + S32 i, bpl = (format == GDRAW_TEXTURE_FORMAT_font ? 1 : 4) * w; + D3DLOCKED_RECT lr; - HRESULT hr = s->handle.tex.d3d->LockRect(0, &lr, &rdest, 0); - if (FAILED(hr)) { - IggyGDrawSendWarning(0, "GDraw LockRect() for texture update failed; D3D error 0x%08x", hr); - return; - } + HRESULT hr = s->handle.tex.d3d->LockRect(0, &lr, &rdest, 0); + if (FAILED(hr)) { + IggyGDrawSendWarning( + 0, "GDraw LockRect() for texture update failed; D3D error 0x%08x", + hr); + return; + } - for (i=0; i < h; i++) - memcpy((U8 *) lr.pBits + i * lr.Pitch, samples + i*stride, bpl); + for (i = 0; i < h; i++) + memcpy((U8*)lr.pBits + i * lr.Pitch, samples + i * stride, bpl); - s->handle.tex.d3d->UnlockRect(0); + s->handle.tex.d3d->UnlockRect(0); } -static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/, GDrawStats * /*stats*/) -{ - gdraw_HandleCacheUnlock((GDrawHandle *) t); +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; - } +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); - } + 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 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_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; - D3DLOCKED_RECT lr; - S32 i; - U8 *d; +static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8* rgba) { + HRESULT hr; + D3DLOCKED_RECT lr; + S32 i; + U8* d; - safe_release(gdraw->aa_tex); // release the old texture, if any. + safe_release(gdraw->aa_tex); // release the old texture, if any. - hr = gdraw->d3d_device->CreateTexture(width, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &gdraw->aa_tex, NULL); - if (FAILED(hr)) { - IggyGDrawSendWarning(0, "GDraw D3D error in CreateTexture 0x%08x", hr); - return; - } + hr = gdraw->d3d_device->CreateTexture( + width, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &gdraw->aa_tex, NULL); + if (FAILED(hr)) { + IggyGDrawSendWarning(0, "GDraw D3D error in CreateTexture 0x%08x", hr); + return; + } - hr = gdraw->aa_tex->LockRect(0, &lr, NULL, 0); - if (!FAILED(hr)) { - d = (U8 *) lr.pBits; - for (i=0; i < width; i++) { - d[i*4+0] = rgba[i*4+2]; - d[i*4+1] = rgba[i*4+1]; - d[i*4+2] = rgba[i*4+0]; - d[i*4+3] = rgba[i*4+3]; - } + hr = gdraw->aa_tex->LockRect(0, &lr, NULL, 0); + if (!FAILED(hr)) { + d = (U8*)lr.pBits; + for (i = 0; i < width; i++) { + d[i * 4 + 0] = rgba[i * 4 + 2]; + d[i * 4 + 1] = rgba[i * 4 + 1]; + d[i * 4 + 2] = rgba[i * 4 + 0]; + d[i * 4 + 3] = rgba[i * 4 + 3]; + } - gdraw->aa_tex->UnlockRect(0); - } else - IggyGDrawSendWarning(0, "GDraw D3D error in LockRect for texture creation: 0x%08x", hr); + gdraw->aa_tex->UnlockRect(0); + } else + IggyGDrawSendWarning( + 0, "GDraw D3D error in LockRect for texture creation: 0x%08x", hr); } //////////////////////////////////////////////////////////////////////// @@ -507,82 +533,91 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) // 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) -{ - char *failed_call; - GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); - if (!vb) - return false; +static rrbool RADLINK gdraw_MakeVertexBufferBegin( + void* unique_id, gdraw_vformat /*vformat*/, S32 vbuf_size, S32 ibuf_size, + GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* stats) { + char* failed_call; + GDrawHandle* vb = + gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); + if (!vb) return false; - vb->handle.vbuf.base = NULL; - vb->handle.vbuf.indices = NULL; + vb->handle.vbuf.base = NULL; + vb->handle.vbuf.indices = NULL; - HRESULT hr; - hr = gdraw->d3d_device->CreateVertexBuffer(vbuf_size, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &vb->handle.vbuf.base, NULL); - failed_call = "CreateVertexBuffer"; - if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateIndexBuffer(ibuf_size, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &vb->handle.vbuf.indices, NULL); - failed_call = "CreateIndexBuffer"; - } - if (!FAILED(hr)) { - hr = vb->handle.vbuf.base->Lock(0, vbuf_size, (void **) &p->vertex_data, 0); - failed_call = "Lock"; - } - if (!FAILED(hr)) - hr = vb->handle.vbuf.indices->Lock(0, ibuf_size, (void **) &p->index_data, 0); + HRESULT hr; + hr = gdraw->d3d_device->CreateVertexBuffer(vbuf_size, D3DUSAGE_WRITEONLY, 0, + D3DPOOL_MANAGED, + &vb->handle.vbuf.base, NULL); + failed_call = "CreateVertexBuffer"; + if (!FAILED(hr)) { + hr = gdraw->d3d_device->CreateIndexBuffer( + ibuf_size, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, + &vb->handle.vbuf.indices, NULL); + failed_call = "CreateIndexBuffer"; + } + if (!FAILED(hr)) { + hr = vb->handle.vbuf.base->Lock(0, vbuf_size, (void**)&p->vertex_data, + 0); + failed_call = "Lock"; + } + if (!FAILED(hr)) + hr = vb->handle.vbuf.indices->Lock(0, ibuf_size, (void**)&p->index_data, + 0); - if (FAILED(hr)) { - if (vb->handle.vbuf.base) - vb->handle.vbuf.base->Unlock(); // does nothing if we didn't actually lock + if (FAILED(hr)) { + if (vb->handle.vbuf.base) + vb->handle.vbuf.base + ->Unlock(); // does nothing if we didn't actually lock - safe_release(vb->handle.vbuf.base); - safe_release(vb->handle.vbuf.indices); + safe_release(vb->handle.vbuf.base); + safe_release(vb->handle.vbuf.indices); - gdraw_HandleCacheAllocateFail(vb); + gdraw_HandleCacheAllocateFail(vb); - report_d3d_error(hr, failed_call, " creating vertex buffer"); - return false; - } + report_d3d_error(hr, failed_call, " creating vertex buffer"); + return false; + } - p->vertex_data_length = vbuf_size; - p->index_data_length = ibuf_size; - p->p0 = vb; + p->vertex_data_length = vbuf_size; + p->index_data_length = ibuf_size; + p->p0 = vb; - gdraw_HandleCacheAllocateEnd(vb, vbuf_size + ibuf_size, unique_id, GDRAW_HANDLE_STATE_locked); - return true; + gdraw_HandleCacheAllocateEnd(vb, vbuf_size + ibuf_size, unique_id, + GDRAW_HANDLE_STATE_locked); + return true; } -static rrbool RADLINK gdraw_MakeVertexBufferMore(GDraw_MakeVertexBuffer_ProcessingInfo * /*p*/) -{ - assert(0); - 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; - vb->handle.vbuf.base->Unlock(); - vb->handle.vbuf.indices->Unlock(); - return (GDrawVertexBuffer *) vb; +static GDrawVertexBuffer* RADLINK gdraw_MakeVertexBufferEnd( + GDraw_MakeVertexBuffer_ProcessingInfo* p, GDrawStats* /*stats*/) { + GDrawHandle* vb = (GDrawHandle*)p->p0; + vb->handle.vbuf.base->Unlock(); + vb->handle.vbuf.indices->Unlock(); + return (GDrawVertexBuffer*)vb; } -static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats * /*stats*/) -{ - return gdraw_HandleCacheLock((GDrawHandle *) vb, unique_id); +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_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; +static void RADLINK gdraw_DescribeVertexBuffer( + GDrawVertexBuffer* vbuf, GDraw_VertexBuffer_Description* desc) { + GDrawHandle* p = (GDrawHandle*)vbuf; + desc->size_in_bytes = p->bytes; } //////////////////////////////////////////////////////////////////////// @@ -590,64 +625,71 @@ static void RADLINK gdraw_DescribeVertexBuffer(GDrawVertexBuffer *vbuf, GDraw_Ve // Create/free (or cache) render targets // -static GDrawHandle *get_color_rendertarget(GDrawStats *stats) -{ - // try to recycle LRU rendertarget - GDrawHandle *t = gdraw_HandleCacheGetLRU(&gdraw->rendertargets); - if (t) { - gdraw_HandleCacheLock(t, (void *) 1); - return t; - } +static GDrawHandle* get_color_rendertarget(GDrawStats* stats) { + // 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; - } + // 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; - } + t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); + if (!t) { + IggyGDrawSendWarning( + NULL, "GDraw rendertarget allocation failed: hit handle limit"); + return t; + } - HRESULT hr = gdraw->d3d_device->CreateTexture(gdraw->frametex_width, gdraw->frametex_height, 1, D3DUSAGE_RENDERTARGET, - D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &t->handle.tex.d3d, NULL); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateTexture", " creating rendertarget"); - gdraw_HandleCacheAllocateFail(t); - return NULL; - } + HRESULT hr = gdraw->d3d_device->CreateTexture( + gdraw->frametex_width, gdraw->frametex_height, 1, D3DUSAGE_RENDERTARGET, + D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &t->handle.tex.d3d, NULL); + if (FAILED(hr)) { + report_d3d_error(hr, "CreateTexture", " creating rendertarget"); + gdraw_HandleCacheAllocateFail(t); + 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; + 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; + return t; } -static IDirect3DSurface9 *get_rendertarget_depthbuffer(GDrawStats *stats) -{ - if (!gdraw->rt_depthbuffer) { - HRESULT hr = gdraw->d3d_device->CreateDepthStencilSurface(gdraw->frametex_width, gdraw->frametex_height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, TRUE, &gdraw->rt_depthbuffer, NULL); - if (FAILED(hr)) - IggyGDrawSendWarning(NULL, "GDraw D3D error in CreateDepthStencilSurface: 0x%08x", hr); - else { - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += gdraw->frametex_width * gdraw->frametex_height * 4; - } - } +static IDirect3DSurface9* get_rendertarget_depthbuffer(GDrawStats* stats) { + if (!gdraw->rt_depthbuffer) { + HRESULT hr = gdraw->d3d_device->CreateDepthStencilSurface( + gdraw->frametex_width, gdraw->frametex_height, D3DFMT_D24S8, + D3DMULTISAMPLE_NONE, 0, TRUE, &gdraw->rt_depthbuffer, NULL); + if (FAILED(hr)) + IggyGDrawSendWarning( + NULL, "GDraw D3D error in CreateDepthStencilSurface: 0x%08x", + hr); + else { + stats->nonzero_flags |= GDRAW_STATS_alloc_tex; + stats->alloc_tex += 1; + stats->alloc_tex_bytes += + gdraw->frametex_width * gdraw->frametex_height * 4; + } + } - return gdraw->rt_depthbuffer; + return gdraw->rt_depthbuffer; } -static void flush_rendertargets(GDrawStats *stats) -{ - gdraw_res_flush(&gdraw->rendertargets, stats); - safe_release(gdraw->rt_depthbuffer); +static void flush_rendertargets(GDrawStats* stats) { + gdraw_res_flush(&gdraw->rendertargets, stats); + safe_release(gdraw->rt_depthbuffer); } //////////////////////////////////////////////////////////////////////// @@ -655,35 +697,37 @@ static void flush_rendertargets(GDrawStats *stats) // Vertex shader constants // -#define VVAR_world0 0 -#define VVAR_world1 1 -#define VVAR_count_worldonly 2 // number of constants to send if you only changed world matrix +#define VVAR_world0 0 +#define VVAR_world1 1 +#define VVAR_count_worldonly \ + 2 // number of constants to send if you only changed world matrix -#define VVAR_x_off 2 -#define VVAR_count_world_xoff 3 // number of constants to send if you changed world+x_off +#define VVAR_x_off 2 +#define VVAR_count_world_xoff \ + 3 // number of constants to send if you changed world+x_off -#define VVAR_texgen_s 3 -#define VVAR_texgen_t 4 -#define VVAR_count 5 // number of constants to send if you changed all per-batch state +#define VVAR_texgen_s 3 +#define VVAR_texgen_t 4 +#define VVAR_count \ + 5 // number of constants to send if you changed all per-batch state -#define VVAR_x3d 5 -#define VVAR_y3d 6 -#define VVAR_z3d 7 -#define VVAR_count3d 8 +#define VVAR_x3d 5 +#define VVAR_y3d 6 +#define VVAR_z3d 7 +#define VVAR_count3d 8 // Fixed-location pixel shader constants -#define PVAR_cmul 0 -#define PVAR_cadd 1 -#define PVAR_focal 2 -#define PVAR_rescale1 3 +#define PVAR_cmul 0 +#define PVAR_cadd 1 +#define PVAR_focal 2 +#define PVAR_rescale1 3 -struct VertexVars -{ - F32 world[2][4]; - F32 x_off[4]; - F32 texgen_s[4]; - F32 texgen_t[4]; - F32 viewproj[3][4]; +struct VertexVars { + F32 world[2][4]; + F32 x_off[4]; + F32 texgen_s[4]; + F32 texgen_t[4]; + F32 viewproj[3][4]; }; //////////////////////////////////////////////////////////////////////// @@ -691,196 +735,199 @@ struct VertexVars // Rendering helpers // -static void set_d3d_texture(U32 sampler, IDirect3DTexture9 *tex, U32 wrap, U32 nearest) -{ - static const int addrmodes[ASSERT_COUNT(GDRAW_WRAP__count, 4)] = { - D3DTADDRESS_CLAMP, // GDRAW_WRAP_clamp - D3DTADDRESS_WRAP, // GDRAW_WRAP_repeat - D3DTADDRESS_MIRROR, // GDRAW_WRAP_mirror - D3DTADDRESS_CLAMP, // GDRAW_WRAP_clamp_to_border (never used by client code!) - }; +static void set_d3d_texture(U32 sampler, IDirect3DTexture9* tex, U32 wrap, + U32 nearest) { + static const int addrmodes[ASSERT_COUNT(GDRAW_WRAP__count, 4)] = { + D3DTADDRESS_CLAMP, // GDRAW_WRAP_clamp + D3DTADDRESS_WRAP, // GDRAW_WRAP_repeat + D3DTADDRESS_MIRROR, // GDRAW_WRAP_mirror + D3DTADDRESS_CLAMP, // GDRAW_WRAP_clamp_to_border (never used by client + // code!) + }; - static const int filtermodes[2] = { - D3DTEXF_LINEAR, // !nearest - D3DTEXF_POINT, // nearest - }; + static const int filtermodes[2] = { + D3DTEXF_LINEAR, // !nearest + D3DTEXF_POINT, // nearest + }; - assert(wrap < sizeof(addrmodes) / sizeof(addrmodes[0])); - assert(nearest < sizeof(filtermodes) / sizeof(filtermodes[0])); - IDirect3DDevice9 *d3d = gdraw->d3d_device; + assert(wrap < sizeof(addrmodes) / sizeof(addrmodes[0])); + assert(nearest < sizeof(filtermodes) / sizeof(filtermodes[0])); + IDirect3DDevice9* d3d = gdraw->d3d_device; - d3d->SetTexture(sampler, tex); - d3d->SetSamplerState(sampler, D3DSAMP_MAGFILTER, filtermodes[nearest]); - d3d->SetSamplerState(sampler, D3DSAMP_ADDRESSU, addrmodes[wrap]); - d3d->SetSamplerState(sampler, D3DSAMP_ADDRESSV, addrmodes[wrap]); + d3d->SetTexture(sampler, tex); + d3d->SetSamplerState(sampler, D3DSAMP_MAGFILTER, filtermodes[nearest]); + d3d->SetSamplerState(sampler, D3DSAMP_ADDRESSU, addrmodes[wrap]); + d3d->SetSamplerState(sampler, D3DSAMP_ADDRESSV, addrmodes[wrap]); } -static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h) -{ - D3DVIEWPORT9 vp = { x, y, w, h, 0.0f, 1.0f }; - gdraw->d3d_device->SetViewport(&vp); +static void set_viewport_raw(S32 x, S32 y, S32 w, S32 h) { + D3DVIEWPORT9 vp = {x, y, w, h, 0.0f, 1.0f}; + gdraw->d3d_device->SetViewport(&vp); } -static void set_projection_base(void) -{ - F32 m[3][4] = { 0 }; +static void set_projection_base(void) { + F32 m[3][4] = {0}; - // x3d = < viewproj.x, 0, 0, 0 > - // y3d = < 0, viewproj.y, 0, 0 > - // w3d = < viewproj.z, viewproj.w, 1.0, 1.0 > + // x3d = < viewproj.x, 0, 0, 0 > + // y3d = < 0, viewproj.y, 0, 0 > + // w3d = < viewproj.z, viewproj.w, 1.0, 1.0 > - m[0][0] = gdraw->projection[0]; - m[1][1] = gdraw->projection[1]; - m[2][0] = gdraw->projection[2]; - m[2][1] = gdraw->projection[3]; + m[0][0] = gdraw->projection[0]; + m[1][1] = gdraw->projection[1]; + m[2][0] = gdraw->projection[2]; + m[2][1] = gdraw->projection[3]; - m[2][2] = 1.0; - m[2][3] = 1.0; + m[2][2] = 1.0; + m[2][3] = 1.0; - gdraw->d3d_device->SetVertexShaderConstantF(VVAR_x3d, m[0], 3); + gdraw->d3d_device->SetVertexShaderConstantF(VVAR_x3d, m[0], 3); } -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) - 0.5f * gdraw->projection[0]; // -0.5f: convert from D3D9 to GL/D3D10 pixel coordinates - gdraw->projection[3] = (y1+y0)/(F32)(y0-y1) - 0.5f * gdraw->projection[1]; +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) - + 0.5f * gdraw->projection[0]; // -0.5f: convert from D3D9 to GL/D3D10 + // pixel coordinates + gdraw->projection[3] = + (y1 + y0) / (F32)(y0 - y1) - 0.5f * gdraw->projection[1]; - set_projection_base(); + set_projection_base(); } -static void set_viewport(void) -{ - if (gdraw->in_blur) { - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - return; - } +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); + 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 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 set_common_renderstate() -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - S32 i; +static void set_common_renderstate() { + IDirect3DDevice9* d3d = gdraw->d3d_device; + S32 i; - // all the render states we never change while drawing - d3d->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); - d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); - d3d->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP); - d3d->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE); - d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL); - d3d->SetRenderState(D3DRS_STENCILREF, 255); - d3d->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); - d3d->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0 ); - d3d->SetRenderState(D3DRS_DEPTHBIAS, 0 ); - d3d->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); - d3d->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE); + // all the render states we never change while drawing + d3d->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); + d3d->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP); + d3d->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE); + d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL); + d3d->SetRenderState(D3DRS_STENCILREF, 255); + d3d->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); + d3d->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0); + d3d->SetRenderState(D3DRS_DEPTHBIAS, 0); + d3d->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + d3d->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE); - for (i=0; i < 3; i++) { - d3d->SetTextureStageState(i, D3DTSS_TEXCOORDINDEX, i); - d3d->SetTextureStageState(i, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE); - d3d->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); - d3d->SetSamplerState(i, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); - d3d->SetSamplerState(i, D3DSAMP_MIPMAPLODBIAS, 0); - d3d->SetSamplerState(i, D3DSAMP_MAXMIPLEVEL, 0); - } + for (i = 0; i < 3; i++) { + d3d->SetTextureStageState(i, D3DTSS_TEXCOORDINDEX, i); + d3d->SetTextureStageState(i, D3DTSS_TEXTURETRANSFORMFLAGS, + D3DTTFF_DISABLE); + d3d->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); + d3d->SetSamplerState(i, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + d3d->SetSamplerState(i, D3DSAMP_MIPMAPLODBIAS, 0); + d3d->SetSamplerState(i, D3DSAMP_MAXMIPLEVEL, 0); + } - d3d->SetTextureStageState(AATEX_SAMPLER, D3DTSS_TEXCOORDINDEX, AATEX_SAMPLER); + d3d->SetTextureStageState(AATEX_SAMPLER, D3DTSS_TEXCOORDINDEX, + AATEX_SAMPLER); - d3d->SetTexture(AATEX_SAMPLER, gdraw->aa_tex); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MIPMAPLODBIAS, 0); - d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MAXMIPLEVEL, 0); + d3d->SetTexture(AATEX_SAMPLER, gdraw->aa_tex); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MIPMAPLODBIAS, 0); + d3d->SetSamplerState(AATEX_SAMPLER, D3DSAMP_MAXMIPLEVEL, 0); - // reset our state caching - gdraw->scissor_state = ~0u; - gdraw->blend_mode = -1; - gdraw->stencil_key = ~0u; - gdraw->z_key = ~0u; + // reset our state caching + gdraw->scissor_state = ~0u; + gdraw->blend_mode = -1; + gdraw->stencil_key = ~0u; + gdraw->z_key = ~0u; - VertexVars vvars = { 0 }; - d3d->SetVertexShaderConstantF(0, vvars.world[0], VVAR_count); + VertexVars vvars = {0}; + d3d->SetVertexShaderConstantF(0, vvars.world[0], VVAR_count); } -static void clear_renderstate(void) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; +static void clear_renderstate(void) { + IDirect3DDevice9* d3d = gdraw->d3d_device; - d3d->SetTexture(0, NULL); - d3d->SetTexture(1, NULL); - d3d->SetTexture(2, NULL); - d3d->SetTexture(AATEX_SAMPLER, NULL); - d3d->SetStreamSource(0, NULL, 0, 0); - d3d->SetIndices(NULL); + d3d->SetTexture(0, NULL); + d3d->SetTexture(1, NULL); + d3d->SetTexture(2, NULL); + d3d->SetTexture(AATEX_SAMPLER, NULL); + d3d->SetStreamSource(0, NULL, 0, 0); + d3d->SetIndices(NULL); - d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - d3d->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS); - d3d->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); - d3d->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf); - d3d->SetRenderState(D3DRS_STENCILENABLE, FALSE); - d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); + d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + d3d->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS); + d3d->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); + d3d->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf); + d3d->SetRenderState(D3DRS_STENCILENABLE, FALSE); + d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - d3d->SetVertexShader(0); - d3d->SetPixelShader(0); - d3d->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); - d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); + d3d->SetVertexShader(0); + d3d->SetPixelShader(0); + d3d->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); } -static void clear_zbuffer(IDirect3DSurface9 *surf, U32 flags) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - IDirect3DSurface9 *target; - D3DSURFACE_DESC desc; - surf->GetDesc(&desc); +static void clear_zbuffer(IDirect3DSurface9* surf, U32 flags) { + IDirect3DDevice9* d3d = gdraw->d3d_device; + IDirect3DSurface9* target; + D3DSURFACE_DESC desc; + surf->GetDesc(&desc); - // here's where it gets stupid: we need a rendertarget that's - // big enough so we can actually clear the full z-buffer. - // we don't actually render to it or anything, we just need to - // set it... - target = gdraw->main_framebuffer; - if (surf != gdraw->main_depthbuffer) { - // tile surface could, in theory, be larger than main framebuffer, so - // check if we have at least one rendertarget matching the rt depth - // buffer created and use that while clearing if possible - S32 i; - for (i=0; i < MAX_RENDER_STACK_DEPTH; ++i) - if (gdraw->rendertargets.handle[i].handle.tex.d3d) { - gdraw->rendertargets.handle[i].handle.tex.d3d->GetSurfaceLevel(0, &target); - break; - } - } + // here's where it gets stupid: we need a rendertarget that's + // big enough so we can actually clear the full z-buffer. + // we don't actually render to it or anything, we just need to + // set it... + target = gdraw->main_framebuffer; + if (surf != gdraw->main_depthbuffer) { + // tile surface could, in theory, be larger than main framebuffer, so + // check if we have at least one rendertarget matching the rt depth + // buffer created and use that while clearing if possible + S32 i; + for (i = 0; i < MAX_RENDER_STACK_DEPTH; ++i) + if (gdraw->rendertargets.handle[i].handle.tex.d3d) { + gdraw->rendertargets.handle[i].handle.tex.d3d->GetSurfaceLevel( + 0, &target); + break; + } + } - D3DVIEWPORT9 vp = { 0, 0, desc.Width, desc.Height, 0.0f, 1.0f }; - d3d->SetRenderTarget(0, target); - d3d->SetDepthStencilSurface(surf); - d3d->SetViewport(&vp); - d3d->Clear(0, NULL, flags, 0, 1.0f, 0); + D3DVIEWPORT9 vp = {0, 0, desc.Width, desc.Height, 0.0f, 1.0f}; + d3d->SetRenderTarget(0, target); + d3d->SetDepthStencilSurface(surf); + d3d->SetViewport(&vp); + d3d->Clear(0, NULL, flags, 0, 1.0f, 0); - if (target != gdraw->main_framebuffer) - target->Release(); + if (target != gdraw->main_framebuffer) target->Release(); } //////////////////////////////////////////////////////////////////////// @@ -888,138 +935,129 @@ static void clear_zbuffer(IDirect3DSurface9 *surf, U32 flags) // Begin/end rendering of a tile and per-frame processing // -void gdraw_D3D_SetTileOrigin(IDirect3DSurface9 *rt, IDirect3DSurface9 *depth, S32 x, S32 y) -{ - D3DSURFACE_DESC desc; +void gdraw_D3D_SetTileOrigin(IDirect3DSurface9* rt, IDirect3DSurface9* depth, + S32 x, S32 y) { + D3DSURFACE_DESC desc; - if (gdraw->frame_done) { - ++gdraw->frame_counter; - gdraw->frame_done = false; - } + if (gdraw->frame_done) { + ++gdraw->frame_counter; + gdraw->frame_done = false; + } - rt->GetDesc(&desc); + rt->GetDesc(&desc); - gdraw->main_framebuffer = rt; - gdraw->main_depthbuffer = depth; - gdraw->main_msaa = (desc.MultiSampleType != D3DMULTISAMPLE_NONE); - gdraw->vx = x; - gdraw->vy = y; + gdraw->main_framebuffer = rt; + gdraw->main_depthbuffer = depth; + gdraw->main_msaa = (desc.MultiSampleType != D3DMULTISAMPLE_NONE); + gdraw->vx = x; + gdraw->vy = y; } -static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scale_x, F32 scale_y) -{ - 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] = scale_x; - gdraw->world_to_pixel[1] = scale_y; +static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scale_x, + F32 scale_y) { + 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] = scale_x; + gdraw->world_to_pixel[1] = scale_y; - set_viewport(); + set_viewport(); } -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 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_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; + + // just record the max, but then when we texture from, we have to use + // sub-regions -- alternatively, each gdraw gets its own rendertargets + 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); + } + + // clear our depth buffers + clear_zbuffer(gdraw->main_depthbuffer, D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER); + if (gdraw->rt_depthbuffer) + clear_zbuffer(gdraw->rt_depthbuffer, + D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER); + + // set our rendertarget + gdraw->d3d_device->SetRenderTarget(0, gdraw->main_framebuffer); + gdraw->d3d_device->SetDepthStencilSurface(gdraw->main_depthbuffer); + set_viewport(); + set_projection(); + set_common_renderstate(); } -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; +static void RADLINK gdraw_RenderTileEnd(GDrawStats* /*stats*/) {} - 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; - - // just record the max, but then when we texture from, we have to use - // sub-regions -- alternatively, each gdraw gets its own rendertargets - 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); - } - - // clear our depth buffers - clear_zbuffer(gdraw->main_depthbuffer, D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER); - if (gdraw->rt_depthbuffer) - clear_zbuffer(gdraw->rt_depthbuffer, D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER); - - // set our rendertarget - gdraw->d3d_device->SetRenderTarget(0, gdraw->main_framebuffer); - gdraw->d3d_device->SetDepthStencilSurface(gdraw->main_depthbuffer); - set_viewport(); - set_projection(); - set_common_renderstate(); +void gdraw_D3D_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); + } } -static void RADLINK gdraw_RenderTileEnd(GDrawStats * /*stats*/) -{ +void gdraw_D3D_NoMoreGDrawThisFrame(void) { + clear_renderstate(); + if (gdraw->main_framebuffer) + gdraw->d3d_device->SetRenderTarget(0, gdraw->main_framebuffer); + if (gdraw->main_depthbuffer) + gdraw->d3d_device->SetDepthStencilSurface(gdraw->main_depthbuffer); + gdraw->frame_done = true; + + GDrawFence now = {gdraw->frame_counter}; + gdraw_HandleCacheTick(gdraw->texturecache, now); + gdraw_HandleCacheTick(gdraw->vbufcache, now); } -void gdraw_D3D_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); - } -} +#define MAX_DEPTH_VALUE (1 << 13) -void gdraw_D3D_NoMoreGDrawThisFrame(void) -{ - clear_renderstate(); - if (gdraw->main_framebuffer) - gdraw->d3d_device->SetRenderTarget(0, gdraw->main_framebuffer); - if (gdraw->main_depthbuffer) - gdraw->d3d_device->SetDepthStencilSurface(gdraw->main_depthbuffer); - gdraw->frame_done = true; +static void RADLINK gdraw_GetInfo(GDrawInfo* d) { + D3DCAPS9 caps; + gdraw->d3d_device->GetDeviceCaps(&caps); - 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) -{ - D3DCAPS9 caps; - gdraw->d3d_device->GetDeviceCaps(&caps); - - 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 = RR_MIN(caps.MaxTextureWidth, caps.MaxTextureHeight); - d->buffer_format = GDRAW_BFORMAT_vbib; - d->shared_depth_stencil = 1; - d->always_mipmap = 1; - d->conditional_nonpow2 = (caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) != 0; + 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 = RR_MIN(caps.MaxTextureWidth, caps.MaxTextureHeight); + d->buffer_format = GDRAW_BFORMAT_vbib; + d->shared_depth_stencil = 1; + d->always_mipmap = 1; + d->conditional_nonpow2 = + (caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) != 0; } //////////////////////////////////////////////////////////////////////// @@ -1027,179 +1065,190 @@ static void RADLINK gdraw_GetInfo(GDrawInfo *d) // Enable/disable rendertargets in stack fashion // -static void set_render_target(GDrawStats *stats) -{ - IDirect3DSurface9 *target = NULL, *depth = NULL; +static void set_render_target(GDrawStats* stats) { + IDirect3DSurface9 *target = NULL, *depth = NULL; - if (gdraw->cur->color_buffer) { - S32 need_depth; - need_depth = (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)); + if (gdraw->cur->color_buffer) { + S32 need_depth; + need_depth = + (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)); - unbind_resources(); // to make sure this RT isn't accidentally set as a texture (avoid D3D warnings) - gdraw->cur->color_buffer->handle.tex.d3d->GetSurfaceLevel(0, &target); // if this fails, there's nothing to be done - if (need_depth) { - if (gdraw->main_msaa) - depth = get_rendertarget_depthbuffer(stats); // @TODO: is this right? get_rt_depthbuffer doesn't seem to do MSAA - else { - // if tile is smaller than frametex, then trying to use the tile's zbuffer may not work - if (gdraw->tw < gdraw->frametex_width || gdraw->th < gdraw->frametex_height) - depth = get_rendertarget_depthbuffer(stats); - else - depth = gdraw->main_depthbuffer; - } - } - } else { - target = gdraw->main_framebuffer; - depth = gdraw->main_depthbuffer; - } + unbind_resources(); // to make sure this RT isn't accidentally set as a + // texture (avoid D3D warnings) + gdraw->cur->color_buffer->handle.tex.d3d->GetSurfaceLevel( + 0, &target); // if this fails, there's nothing to be done + if (need_depth) { + if (gdraw->main_msaa) + depth = get_rendertarget_depthbuffer( + stats); // @TODO: is this right? get_rt_depthbuffer doesn't + // seem to do MSAA + else { + // if tile is smaller than frametex, then trying to use the + // tile's zbuffer may not work + if (gdraw->tw < gdraw->frametex_width || + gdraw->th < gdraw->frametex_height) + depth = get_rendertarget_depthbuffer(stats); + else + depth = gdraw->main_depthbuffer; + } + } + } else { + target = gdraw->main_framebuffer; + depth = gdraw->main_depthbuffer; + } - gdraw->d3d_device->SetRenderTarget(0, target); - gdraw->d3d_device->SetDepthStencilSurface(depth); - if (target != gdraw->main_framebuffer) - target->Release(); + gdraw->d3d_device->SetRenderTarget(0, target); + gdraw->d3d_device->SetDepthStencilSurface(depth); + if (target != gdraw->main_framebuffer) target->Release(); - stats->nonzero_flags |= GDRAW_STATS_rendtarg; - stats->rendertarget_changes += 1; + 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; - if (gdraw->tw == 0 || gdraw->th == 0) - return false; +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; + if (gdraw->tw == 0 || gdraw->th == 0) return false; - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); - return false; - } + if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { + IggyGDrawSendWarning( + NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + return false; + } - if (owner) { - S32 w = region->x1 - region->x0; - S32 h = region->y1 - region->y0; + if (owner) { + S32 w = region->x1 - region->x0; + S32 h = region->y1 - region->y0; - // allocate a texture handle and free enough texture space - t = gdraw_res_alloc_begin(gdraw->texturecache, w*h*4, stats); - if (!t) - return false; - else { - IDirect3DTexture9 * tex; - HRESULT hr = gdraw->d3d_device->CreateTexture(w,h,1, - D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, &tex, NULL); - - if (FAILED(hr)) { - if (t) - gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw D3D error for CreateTexture for cacheAsBitmap rendertarget: 0x%08x", hr); + // allocate a texture handle and free enough texture space + t = gdraw_res_alloc_begin(gdraw->texturecache, w * h * 4, stats); + if (!t) return false; - } + else { + IDirect3DTexture9* tex; + HRESULT hr = gdraw->d3d_device->CreateTexture( + w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, + D3DPOOL_DEFAULT, &tex, NULL); - stats->nonzero_flags |= GDRAW_STATS_alloc_tex; - stats->alloc_tex += 1; - stats->alloc_tex_bytes += w*h*4; + if (FAILED(hr)) { + if (t) gdraw_HandleCacheAllocateFail(t); + IggyGDrawSendWarning(NULL, + "GDraw D3D error for CreateTexture for " + "cacheAsBitmap rendertarget: 0x%08x", + hr); + return false; + } - gdraw_HandleCacheAllocateEnd(t, w*h*4, (void *) 1, GDRAW_HANDLE_STATE_locked); - } - } else { - t = get_color_rendertarget(stats); - if (!t) - return false; - } + stats->nonzero_flags |= GDRAW_STATS_alloc_tex; + stats->alloc_tex += 1; + stats->alloc_tex_bytes += w * h * 4; - n->flags = flags; - n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + gdraw_HandleCacheAllocateEnd(t, w * h * 4, (void*)1, + GDRAW_HANDLE_STATE_locked); + } + } else { + t = get_color_rendertarget(stats); + if (!t) return false; + } - ++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; - } + n->flags = flags; + n->color_buffer = t; + assert(n->color_buffer != NULL); // @GDRAW_ASSERT - set_render_target(stats); - assert(gdraw->frametex_width >= gdraw->tw && gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT - set_viewport(); - set_projection(); + ++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; + } - int k = (int) (t - gdraw->rendertargets.handle); + set_render_target(stats); + assert(gdraw->frametex_width >= gdraw->tw && + gdraw->frametex_height >= gdraw->th); // @GDRAW_ASSERT + set_viewport(); + set_projection(); - if (region) { - D3DRECT 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. + int k = (int)(t - gdraw->rendertargets.handle); - if (gdraw->in_blur) - ox = oy = 0; - else - ox = gdraw->tx0p, oy = gdraw->ty0p; + if (region) { + D3DRECT 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. - // 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); + if (gdraw->in_blur) + ox = oy = 0; + else + ox = gdraw->tx0p, oy = gdraw->ty0p; - // but the padding needs to clamp to render target bounds - r.x1 = RR_MAX(xt0 - pad, 0); - r.y1 = RR_MAX(yt0 - pad, 0); - r.x2 = RR_MIN(xt1 + pad, gdraw->frametex_width); - r.y2 = RR_MIN(yt1 + pad, gdraw->frametex_height); + // 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); - if (r.x2 <= r.x1 || r.y2 <= r.y1) { // 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; - } + // but the padding needs to clamp to render target bounds + r.x1 = RR_MAX(xt0 - pad, 0); + r.y1 = RR_MAX(yt0 - pad, 0); + r.x2 = RR_MIN(xt1 + pad, gdraw->frametex_width); + r.y2 = RR_MIN(yt1 + pad, gdraw->frametex_height); - gdraw->d3d_device->Clear(1, &r, D3DCLEAR_TARGET, 0, 1, 0); - 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_device->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1, 0); - 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 (r.x2 <= r.x1 || + r.y2 <= r.y1) { // 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; + } - return true; + gdraw->d3d_device->Clear(1, &r, D3DCLEAR_TARGET, 0, 1, 0); + 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_device->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1, 0); + 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; + } + + return true; } -static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) -{ - GDrawFramebufferState *n = gdraw->cur; - GDrawFramebufferState *m = --gdraw->cur; +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 (gdraw->tw == 0 || gdraw->th == 0) return 0; - if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) - return 0; // already returned a warning in Begin + if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) + return 0; // already returned a warning in Begin - assert(m >= gdraw->frame); // bug in Iggy -- unbalanced + 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 + 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); + // switch back to old render target + set_render_target(stats); - // if we're at the root, set the viewport back - set_viewport(); - set_projection(); + // if we're at the root, set the viewport back + set_viewport(); + set_projection(); - return (GDrawTexture *) n->color_buffer; + return (GDrawTexture*)n->color_buffer; } - //////////////////////////////////////////////////////////////////////// // // Clear stencil/depth buffers @@ -1208,68 +1257,66 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) // and only clearing those; it depends exactly how fast clearing works. // -static void clear_renderstate_acceleration_cache(void) -{ - gdraw->last_was_3d = false; - gdraw->scissor_state = ~0u; - gdraw->stencil_key = 0; - gdraw->blend_mode = ~0u; +static void clear_renderstate_acceleration_cache(void) { + gdraw->last_was_3d = false; + gdraw->scissor_state = ~0u; + gdraw->stencil_key = 0; + gdraw->blend_mode = ~0u; } -static void do_screen_quad(gswf_recti *s, F32 *tc, GDrawStats *stats); +static void do_screen_quad(gswf_recti* s, F32* tc, GDrawStats* stats); -static void RADLINK gdraw_ClearStencilBits(U32 bits) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - F32 texcoord[8] = { 0 }; - GDrawStats stats = { 0 }; - gswf_recti region; +static void RADLINK gdraw_ClearStencilBits(U32 bits) { + IDirect3DDevice9* d3d = gdraw->d3d_device; + F32 texcoord[8] = {0}; + GDrawStats stats = {0}; + gswf_recti region; - region.x0 = 0; - region.y0 = 0; - region.x1 = gdraw->frametex_width; - region.y1 = gdraw->frametex_height; + region.x0 = 0; + region.y0 = 0; + region.x1 = gdraw->frametex_width; + region.y1 = gdraw->frametex_height; - d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - d3d->SetRenderState(D3DRS_STENCILWRITEMASK, bits); - d3d->SetRenderState(D3DRS_STENCILENABLE, TRUE); - // fewest states to force it to always write: make the stencil test always fail - d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_NEVER); - d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE); - d3d->SetRenderState(D3DRS_STENCILREF, 0); - d3d->SetRenderState(D3DRS_COLORWRITEENABLE, FALSE); - d3d->SetRenderState(D3DRS_ZENABLE, FALSE); - d3d->SetRenderState(D3DRS_ZFUNC, FALSE); - d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); + d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); + d3d->SetRenderState(D3DRS_STENCILWRITEMASK, bits); + d3d->SetRenderState(D3DRS_STENCILENABLE, TRUE); + // fewest states to force it to always write: make the stencil test always + // fail + d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_NEVER); + d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE); + d3d->SetRenderState(D3DRS_STENCILREF, 0); + d3d->SetRenderState(D3DRS_COLORWRITEENABLE, FALSE); + d3d->SetRenderState(D3DRS_ZENABLE, FALSE); + d3d->SetRenderState(D3DRS_ZFUNC, FALSE); + d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - d3d->SetPixelShader(gdraw->manual_clear.pshader); - do_screen_quad(®ion, texcoord, &stats); + d3d->SetPixelShader(gdraw->manual_clear.pshader); + do_screen_quad(®ion, texcoord, &stats); - // restore state from set_common_renderstate - d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); - d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL); - d3d->SetRenderState(D3DRS_STENCILREF, 255); + // restore state from set_common_renderstate + d3d->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP); + d3d->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL); + d3d->SetRenderState(D3DRS_STENCILREF, 255); - // make next renderstate reset other state - clear_renderstate_acceleration_cache(); + // make next renderstate reset other state + clear_renderstate_acceleration_cache(); - // reset matrices et al - set_render_target(&stats); - set_viewport(); - set_projection(); + // reset matrices et al + set_render_target(&stats); + set_viewport(); + set_projection(); } // 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) -{ - GDrawStats stats = { 0 }; +static void RADLINK gdraw_ClearID(void) { + GDrawStats stats = {0}; - clear_zbuffer(gdraw->main_depthbuffer, D3DCLEAR_ZBUFFER); - set_render_target(&stats); - set_viewport(); - set_projection(); + clear_zbuffer(gdraw->main_depthbuffer, D3DCLEAR_ZBUFFER); + set_render_target(&stats); + set_viewport(); + set_projection(); } //////////////////////////////////////////////////////////////////////// @@ -1283,172 +1330,189 @@ static void RADLINK gdraw_ClearID(void) // 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 F32 depth_from_id(S32 id) { + return 1.0f - ((F32)id + 1.0f) / MAX_DEPTH_VALUE; } -static void set_texture(S32 texunit, GDrawTexture *tex) -{ - if (texunit >= 0) - set_d3d_texture(texunit, ((GDrawHandle *) tex)->handle.tex.d3d, GDRAW_WRAP_clamp, 0); +static void set_texture(S32 texunit, GDrawTexture* tex) { + if (texunit >= 0) + set_d3d_texture(texunit, ((GDrawHandle*)tex)->handle.tex.d3d, + GDRAW_WRAP_clamp, 0); } -static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawStats * /*stats*/) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - U32 stencil_key, z_key; - F32 depth = depth_from_id(r->id); - VertexVars vvars; - int vvarcount = VVAR_count_world_xoff; +static int set_renderstate_full(S32 vertex_format, GDrawRenderState* r, + GDrawStats* /*stats*/) { + IDirect3DDevice9* d3d = gdraw->d3d_device; + U32 stencil_key, z_key; + F32 depth = depth_from_id(r->id); + VertexVars vvars; + int vvarcount = VVAR_count_world_xoff; - // set vertex shader - d3d->SetVertexShader(gdraw->vert[vertex_format].vshader); - - // set vertex shader constants - 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); + // set vertex shader + d3d->SetVertexShader(gdraw->vert[vertex_format].vshader); - memcpy(&vvars.x_off, r->edge_matrix, 4*sizeof(F32)); + // set vertex shader constants + 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); - if (r->texgen0_enabled) { - memcpy(&vvars.texgen_s, r->s0_texgen, 4*sizeof(F32)); - memcpy(&vvars.texgen_t, r->t0_texgen, 4*sizeof(F32)); - vvarcount = VVAR_count; - } + memcpy(&vvars.x_off, r->edge_matrix, 4 * sizeof(F32)); - if (gdraw->use_3d || gdraw->last_was_3d) { - if (gdraw->use_3d) { - vvarcount = VVAR_count3d; - memcpy(&vvars.viewproj, gdraw->xform_3d, 12*sizeof(F32)); - } else - set_projection_base(); - gdraw->last_was_3d = gdraw->use_3d; - } + if (r->texgen0_enabled) { + memcpy(&vvars.texgen_s, r->s0_texgen, 4 * sizeof(F32)); + memcpy(&vvars.texgen_t, r->t0_texgen, 4 * sizeof(F32)); + vvarcount = VVAR_count; + } - d3d->SetVertexShaderConstantF(0, vvars.world[0], vvarcount); + if (gdraw->use_3d || gdraw->last_was_3d) { + if (gdraw->use_3d) { + vvarcount = VVAR_count3d; + memcpy(&vvars.viewproj, gdraw->xform_3d, 12 * sizeof(F32)); + } else + set_projection_base(); + gdraw->last_was_3d = gdraw->use_3d; + } - // set the blend mode - int blend_mode = r->blend_mode; - int tex0mode = r->tex0_mode; + d3d->SetVertexShaderConstantF(0, vvars.world[0], vvarcount); - static struct gdraw_d3d_blendspec { - BOOL enable; - D3DBLEND src; - D3DBLEND dest; - } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { - FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, // GDRAW_BLEND_none - TRUE, D3DBLEND_ONE, D3DBLEND_INVSRCALPHA, // GDRAW_BLEND_alpha - TRUE, D3DBLEND_DESTCOLOR, D3DBLEND_INVSRCALPHA, // GDRAW_BLEND_multiply - TRUE, D3DBLEND_ONE, D3DBLEND_ONE, // GDRAW_BLEND_add + // set the blend mode + int blend_mode = r->blend_mode; + int tex0mode = r->tex0_mode; - FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, // GDRAW_BLEND_filter - FALSE, D3DBLEND_ONE, D3DBLEND_ZERO, // GDRAW_BLEND_special - }; - assert(blend_mode >= 0 && blend_mode < sizeof(blends)/sizeof(*blends)); - - if (blend_mode != gdraw->blend_mode) { - gdraw->blend_mode = blend_mode; - if (blends[blend_mode].enable) { - d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - d3d->SetRenderState(D3DRS_SRCBLEND, blends[blend_mode].src); - d3d->SetRenderState(D3DRS_DESTBLEND, blends[blend_mode].dest); - } else - d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - } + static struct gdraw_d3d_blendspec { + BOOL enable; + D3DBLEND src; + D3DBLEND dest; + } blends[ASSERT_COUNT(GDRAW_BLEND__count, 6)] = { + FALSE, + D3DBLEND_ONE, + D3DBLEND_ZERO, // GDRAW_BLEND_none + TRUE, + D3DBLEND_ONE, + D3DBLEND_INVSRCALPHA, // GDRAW_BLEND_alpha + TRUE, + D3DBLEND_DESTCOLOR, + D3DBLEND_INVSRCALPHA, // GDRAW_BLEND_multiply + TRUE, + D3DBLEND_ONE, + D3DBLEND_ONE, // GDRAW_BLEND_add - // set the pixel shader - IDirect3DPixelShader9 *pshader; - if (blend_mode != GDRAW_BLEND_special) { - assert(tex0mode >= 0 && tex0mode < sizeof(gdraw->fprog) / sizeof(*gdraw->fprog)); + FALSE, + D3DBLEND_ONE, + D3DBLEND_ZERO, // GDRAW_BLEND_filter + FALSE, + D3DBLEND_ONE, + D3DBLEND_ZERO, // GDRAW_BLEND_special + }; + assert(blend_mode >= 0 && blend_mode < sizeof(blends) / sizeof(*blends)); - int additive = 0; - if (r->cxf_add) { - additive = 1; - if (r->cxf_add[3]) additive = 2; - } + if (blend_mode != gdraw->blend_mode) { + gdraw->blend_mode = blend_mode; + if (blends[blend_mode].enable) { + d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + d3d->SetRenderState(D3DRS_SRCBLEND, blends[blend_mode].src); + d3d->SetRenderState(D3DRS_DESTBLEND, blends[blend_mode].dest); + } else + d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); + } - pshader = gdraw->fprog[tex0mode][additive].pshader; - } else - pshader = gdraw->exceptional_blend[r->special_blend].pshader; + // set the pixel shader + IDirect3DPixelShader9* pshader; + if (blend_mode != GDRAW_BLEND_special) { + assert(tex0mode >= 0 && + tex0mode < sizeof(gdraw->fprog) / sizeof(*gdraw->fprog)); - d3d->SetPixelShader(pshader); + int additive = 0; + if (r->cxf_add) { + additive = 1; + if (r->cxf_add[3]) additive = 2; + } - // set textures - if (tex0mode != GDRAW_TEXTURE_none) { - if (!r->tex[0]) return 0; - set_d3d_texture(0, ((GDrawHandle *) r->tex[0])->handle.tex.d3d, r->wrap0, r->nearest0); - } + pshader = gdraw->fprog[tex0mode][additive].pshader; + } else + pshader = gdraw->exceptional_blend[r->special_blend].pshader; - // set pixel shader constants - d3d->SetPixelShaderConstantF(PVAR_cmul, r->color, 1); - - if (r->cxf_add) { - F32 temp[4] = { r->cxf_add[0]/255.0f, r->cxf_add[1]/255.0f, r->cxf_add[2]/255.0f, r->cxf_add[3]/255.0f }; - d3d->SetPixelShaderConstantF(PVAR_cadd, temp, 1); - } + d3d->SetPixelShader(pshader); - if (tex0mode == GDRAW_TEXTURE_focal_gradient) - d3d->SetPixelShaderConstantF(PVAR_focal, r->focal_point, 1); + // set textures + if (tex0mode != GDRAW_TEXTURE_none) { + if (!r->tex[0]) return 0; + set_d3d_texture(0, ((GDrawHandle*)r->tex[0])->handle.tex.d3d, r->wrap0, + r->nearest0); + } - // Set pixel operation states - gdraw->scissor_state = ~0u; - if (r->scissor) { - RECT s; - gdraw->scissor_state = r->scissor; - 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->SetScissorRect(&s); - d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); - } else { - if (r->scissor != gdraw->scissor_state) { - gdraw->scissor_state = r->scissor; - d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - } - } + // set pixel shader constants + d3d->SetPixelShaderConstantF(PVAR_cmul, r->color, 1); - // stencil changed? - stencil_key = r->stencil_test | (r->stencil_set << 8); - if (stencil_key != gdraw->stencil_key) { - gdraw->stencil_key = stencil_key; + if (r->cxf_add) { + F32 temp[4] = {r->cxf_add[0] / 255.0f, r->cxf_add[1] / 255.0f, + r->cxf_add[2] / 255.0f, r->cxf_add[3] / 255.0f}; + d3d->SetPixelShaderConstantF(PVAR_cadd, temp, 1); + } - d3d->SetRenderState(D3DRS_STENCILMASK, r->stencil_test); - d3d->SetRenderState(D3DRS_STENCILWRITEMASK, r->stencil_set); - d3d->SetRenderState(D3DRS_STENCILENABLE, (r->stencil_set | r->stencil_test) != 0); - d3d->SetRenderState(D3DRS_COLORWRITEENABLE, r->stencil_set ? 0x0 : 0xf); - } + if (tex0mode == GDRAW_TEXTURE_focal_gradient) + d3d->SetPixelShaderConstantF(PVAR_focal, r->focal_point, 1); - // z key - z_key = r->set_id | (r->test_id << 1); - if (z_key != gdraw->z_key) { - gdraw->z_key = z_key; - d3d->SetRenderState(D3DRS_ZENABLE, (r->test_id | r->set_id) ? D3DZB_TRUE : D3DZB_FALSE); - d3d->SetRenderState(D3DRS_ZFUNC, r->test_id ? D3DCMP_LESS : D3DCMP_ALWAYS); - d3d->SetRenderState(D3DRS_ZWRITEENABLE, r->set_id); - } - - return 1; + // Set pixel operation states + gdraw->scissor_state = ~0u; + if (r->scissor) { + RECT s; + gdraw->scissor_state = r->scissor; + 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->SetScissorRect(&s); + d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE); + } else { + if (r->scissor != gdraw->scissor_state) { + gdraw->scissor_state = r->scissor; + d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); + } + } + + // stencil changed? + stencil_key = r->stencil_test | (r->stencil_set << 8); + if (stencil_key != gdraw->stencil_key) { + gdraw->stencil_key = stencil_key; + + d3d->SetRenderState(D3DRS_STENCILMASK, r->stencil_test); + d3d->SetRenderState(D3DRS_STENCILWRITEMASK, r->stencil_set); + d3d->SetRenderState(D3DRS_STENCILENABLE, + (r->stencil_set | r->stencil_test) != 0); + d3d->SetRenderState(D3DRS_COLORWRITEENABLE, r->stencil_set ? 0x0 : 0xf); + } + + // z key + z_key = r->set_id | (r->test_id << 1); + if (z_key != gdraw->z_key) { + gdraw->z_key = z_key; + d3d->SetRenderState( + D3DRS_ZENABLE, (r->test_id | r->set_id) ? D3DZB_TRUE : D3DZB_FALSE); + d3d->SetRenderState(D3DRS_ZFUNC, + r->test_id ? D3DCMP_LESS : D3DCMP_ALWAYS); + d3d->SetRenderState(D3DRS_ZWRITEENABLE, r->set_id); + } + + return 1; } -static RADINLINE int set_renderstate(S32 vertex_format, GDrawRenderState *r, GDrawStats *stats) -{ - if (r->identical_state) { - // fast path: only need to change vertex shader, other state is the same - gdraw->d3d_device->SetVertexShader(gdraw->vert[vertex_format].vshader); - return 1; - } else - return set_renderstate_full(vertex_format, r, stats); +static RADINLINE int set_renderstate(S32 vertex_format, GDrawRenderState* r, + GDrawStats* stats) { + if (r->identical_state) { + // fast path: only need to change vertex shader, other state is the same + gdraw->d3d_device->SetVertexShader(gdraw->vert[vertex_format].vshader); + return 1; + } else + return set_renderstate_full(vertex_format, r, stats); } //////////////////////////////////////////////////////////////////////// @@ -1456,36 +1520,29 @@ static RADINLINE int set_renderstate(S32 vertex_format, GDrawRenderState *r, GDr // Vertex formats // -static D3DVERTEXELEMENT9 vformat_v2[] = -{ - { 0,0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0 }, - D3DDECL_END() -}; +static D3DVERTEXELEMENT9 vformat_v2[] = { + {0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0}, D3DDECL_END()}; -static D3DVERTEXELEMENT9 vformat_v2aa[] = -{ - { 0,0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0 }, - { 0,8, D3DDECLTYPE_SHORT4, 0, D3DDECLUSAGE_TEXCOORD, 0 }, - D3DDECL_END() -}; +static D3DVERTEXELEMENT9 vformat_v2aa[] = { + {0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0}, + {0, 8, D3DDECLTYPE_SHORT4, 0, D3DDECLUSAGE_TEXCOORD, 0}, + D3DDECL_END()}; -static D3DVERTEXELEMENT9 vformat_v2tc2[] = -{ - { 0,0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0 }, - { 0,8, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 0 }, - D3DDECL_END() -}; +static D3DVERTEXELEMENT9 vformat_v2tc2[] = { + {0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_POSITION, 0}, + {0, 8, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 0}, + D3DDECL_END()}; -static D3DVERTEXELEMENT9 *vformats[ASSERT_COUNT(GDRAW_vformat__count, 3)] = { - vformat_v2, // GDRAW_vformat_v2 - vformat_v2aa, // GDRAW_vformat_v2aa - vformat_v2tc2, // GDRAW_vformat_v2tc2 +static D3DVERTEXELEMENT9* vformats[ASSERT_COUNT(GDRAW_vformat__count, 3)] = { + vformat_v2, // GDRAW_vformat_v2 + vformat_v2aa, // GDRAW_vformat_v2aa + vformat_v2tc2, // GDRAW_vformat_v2tc2 }; static int vertsize[ASSERT_COUNT(GDRAW_vformat__count, 3)] = { - 8, // GDRAW_vformat_v2 - 16, // GDRAW_vformat_v2aa - 16, // GDRAW_vformat_v2tc2 + 8, // GDRAW_vformat_v2 + 16, // GDRAW_vformat_v2aa + 16, // GDRAW_vformat_v2tc2 }; //////////////////////////////////////////////////////////////////////// @@ -1493,54 +1550,62 @@ static int vertsize[ASSERT_COUNT(GDRAW_vformat__count, 3)] = { // 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 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) -{ - GDrawHandle *vb = (GDrawHandle *) buf; - int vfmt = p->vertex_format; - assert(vfmt >= 0 && vfmt < GDRAW_vformat__count); +static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState* r, + GDrawPrimitive* p, + GDrawVertexBuffer* buf, + GDrawStats* stats) { + GDrawHandle* vb = (GDrawHandle*)buf; + int vfmt = p->vertex_format; + assert(vfmt >= 0 && vfmt < GDRAW_vformat__count); - if (!set_renderstate(vfmt, r, stats)) - return; + if (!set_renderstate(vfmt, r, stats)) return; + gdraw->d3d_device->SetVertexDeclaration(gdraw->vdec[vfmt]); - gdraw->d3d_device->SetVertexDeclaration(gdraw->vdec[vfmt]); + if (vb) { + gdraw->d3d_device->SetIndices(vb->handle.vbuf.indices); + gdraw->d3d_device->SetStreamSource( + 0, vb->handle.vbuf.base, (U32)(UINTa)p->vertices, vertsize[vfmt]); - if (vb) { - gdraw->d3d_device->SetIndices(vb->handle.vbuf.indices); - gdraw->d3d_device->SetStreamSource(0, vb->handle.vbuf.base, (U32) (UINTa) p->vertices, vertsize[vfmt]); + gdraw->d3d_device->DrawIndexedPrimitive( + D3DPT_TRIANGLELIST, 0, 0, p->num_vertices, + (U32)((UINTa)p->indices) >> 1, p->num_indices / 3); - gdraw->d3d_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, p->num_vertices, (U32) ((UINTa) p->indices) >> 1, p->num_indices/3); + gdraw->d3d_device->SetStreamSource(0, 0, 0, 0); + gdraw->d3d_device->SetIndices(0); + } else if (p->indices) { + gdraw->d3d_device->DrawIndexedPrimitiveUP( + D3DPT_TRIANGLELIST, 0, p->num_vertices, p->num_indices / 3, + p->indices, D3DFMT_INDEX16, p->vertices, vertsize[vfmt]); + } else { // dynamic quads + assert(p->num_vertices % 4 == 0); + UINT stride = vertsize[vfmt]; + S32 pos = 0; + while (pos < p->num_vertices) { + S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); + gdraw->d3d_device->DrawIndexedPrimitiveUP( + D3DPT_TRIANGLELIST, 0, vert_count, (vert_count / 4) * 2, + quad_ib, D3DFMT_INDEX16, (U8*)p->vertices + pos * stride, + stride); + pos += vert_count; + } + } - gdraw->d3d_device->SetStreamSource(0,0,0,0); - gdraw->d3d_device->SetIndices(0); - } else if (p->indices) { - gdraw->d3d_device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, p->num_vertices, p->num_indices/3, p->indices, D3DFMT_INDEX16, p->vertices, vertsize[vfmt]); - } else { // dynamic quads - assert(p->num_vertices % 4 == 0); - UINT stride = vertsize[vfmt]; - S32 pos = 0; - while (pos < p->num_vertices) { - S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); - gdraw->d3d_device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, vert_count, (vert_count/4)*2, quad_ib, D3DFMT_INDEX16, (U8 *)p->vertices + pos * stride, stride); - pos += vert_count; - } - } + tag_resources(vb, r->tex[0], r->tex[1]); - 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; + stats->nonzero_flags |= GDRAW_STATS_batches; + stats->num_batches += 1; + stats->drawn_indices += p->num_indices; + stats->drawn_vertices += p->num_vertices; } /////////////////////////////////////////////////////////////////////// @@ -1548,246 +1613,274 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti // Flash 8 filter effects // -static void set_pixel_constant(S32 constant, F32 x, F32 y, F32 z, F32 w) -{ - if (constant >= 0) { - F32 value[4] = { x,y,z,w }; - gdraw->d3d_device->SetPixelShaderConstantF(constant, value, 1); - } +static void set_pixel_constant(S32 constant, F32 x, F32 y, F32 z, F32 w) { + if (constant >= 0) { + F32 value[4] = {x, y, z, w}; + gdraw->d3d_device->SetPixelShaderConstantF(constant, value, 1); + } } // caller sets up texture coordinates -static void do_screen_quad(gswf_recti *s, F32 *tc, GDrawStats *stats) -{ - F32 px0 = (F32) s->x0, py0 = (F32) s->y0, px1 = (F32) s->x1, py1 = (F32) s->y1; - gswf_vertex_xyst vert[4]; - VertexVars vvars; +static void do_screen_quad(gswf_recti* s, F32* tc, GDrawStats* stats) { + F32 px0 = (F32)s->x0, py0 = (F32)s->y0, px1 = (F32)s->x1, py1 = (F32)s->y1; + gswf_vertex_xyst vert[4]; + VertexVars vvars; - // interleave the data so we can use UP - 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 = px1; vert[2].y = py1; vert[2].s = tc[2]; vert[2].t = tc[3]; - vert[3].x = px0; vert[3].y = py1; vert[3].s = tc[0]; vert[3].t = tc[3]; + // interleave the data so we can use UP + 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 = px1; + vert[2].y = py1; + vert[2].s = tc[2]; + vert[2].t = tc[3]; + vert[3].x = px0; + vert[3].y = py1; + vert[3].s = tc[0]; + vert[3].t = tc[3]; - gdraw_PixelSpace(vvars.world[0]); + gdraw_PixelSpace(vvars.world[0]); - gdraw->d3d_device->SetVertexDeclaration(gdraw->vdec[GDRAW_vformat_v2tc2]); - gdraw->d3d_device->SetVertexShader(gdraw->vert[GDRAW_vformat_v2tc2].vshader); - gdraw->d3d_device->SetVertexShaderConstantF(0, vvars.world[0], VVAR_count_worldonly); - gdraw->d3d_device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, vert, 16); + gdraw->d3d_device->SetVertexDeclaration(gdraw->vdec[GDRAW_vformat_v2tc2]); + gdraw->d3d_device->SetVertexShader( + gdraw->vert[GDRAW_vformat_v2tc2].vshader); + gdraw->d3d_device->SetVertexShaderConstantF(0, vvars.world[0], + VVAR_count_worldonly); + gdraw->d3d_device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, vert, 16); - stats->nonzero_flags |= GDRAW_STATS_batches; - stats->num_batches += 1; - stats->drawn_indices += 6; - stats->drawn_vertices += 4; + stats->nonzero_flags |= GDRAW_STATS_batches; + stats->num_batches += 1; + stats->drawn_indices += 6; + stats->drawn_vertices += 4; } -static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, float *data, gswf_recti *s, float *tc, float /*height_max*/, float *clamp, GDrawStats *gstats) -{ - ProgramWithCachedVariableLocations *prg = &gdraw->blur_prog[taps]; - gdraw->d3d_device->SetPixelShader(prg->pshader); - set_texture(prg->vars[VAR_blur_tex0], r->tex[0]); +static void gdraw_DriverBlurPass(GDrawRenderState* r, int taps, float* data, + gswf_recti* s, float* tc, float /*height_max*/, + float* clamp, GDrawStats* gstats) { + ProgramWithCachedVariableLocations* prg = &gdraw->blur_prog[taps]; + gdraw->d3d_device->SetPixelShader(prg->pshader); + set_texture(prg->vars[VAR_blur_tex0], r->tex[0]); - assert(prg->vars[VAR_blur_tap] >= 0); - gdraw->d3d_device->SetPixelShaderConstantF(prg->vars[VAR_blur_tap], data, taps); - gdraw->d3d_device->SetPixelShaderConstantF(prg->vars[VAR_blur_clampv], clamp, 1); + assert(prg->vars[VAR_blur_tap] >= 0); + gdraw->d3d_device->SetPixelShaderConstantF(prg->vars[VAR_blur_tap], data, + taps); + gdraw->d3d_device->SetPixelShaderConstantF(prg->vars[VAR_blur_clampv], + clamp, 1); - do_screen_quad(s, tc, gstats); - tag_resources(r->tex[0]); + 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; +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; - gdraw->d3d_device->SetPixelShader(gdraw->colormatrix.pshader); - set_texture(gdraw->colormatrix.vars[VAR_colormatrix_tex0], r->tex[0]); - gdraw->d3d_device->SetPixelShaderConstantF(gdraw->colormatrix.vars[VAR_colormatrix_data], r->shader_data, 5); - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); + gdraw->d3d_device->SetPixelShader(gdraw->colormatrix.pshader); + set_texture(gdraw->colormatrix.vars[VAR_colormatrix_tex0], r->tex[0]); + gdraw->d3d_device->SetPixelShaderConstantF( + gdraw->colormatrix.vars[VAR_colormatrix_data], r->shader_data, 5); + 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 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(int 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 set_clamp_constant(int 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) -{ - 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, stats)) - return; +static void gdraw_Filter(GDrawRenderState* r, gswf_recti* s, float* tc, + int isbevel, GDrawStats* stats) { + ProgramWithCachedVariableLocations* prg = + &gdraw->filter_prog[isbevel][r->filter_mode]; - gdraw->d3d_device->SetPixelShader(prg->pshader); - set_texture(prg->vars[VAR_filter_tex0], r->tex[0]); - set_texture(prg->vars[VAR_filter_tex1], r->tex[1]); - set_texture(prg->vars[VAR_filter_tex2], r->tex[2]); + if (!gdraw_TextureDrawBufferBegin( + s, GDRAW_TEXTURE_FORMAT_rgba32, + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | + GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, + NULL, stats)) + return; - set_pixel_constant(prg->vars[VAR_filter_color], r->shader_data[0], r->shader_data[1], r->shader_data[2], r->shader_data[3]); - set_pixel_constant(prg->vars[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); - set_pixel_constant(prg->vars[VAR_filter_color2], r->shader_data[8], r->shader_data[9], r->shader_data[10], r->shader_data[11]); - set_clamp_constant(prg->vars[VAR_filter_clamp0], r->tex[0]); - set_clamp_constant(prg->vars[VAR_filter_clamp1], r->tex[1]); + gdraw->d3d_device->SetPixelShader(prg->pshader); + set_texture(prg->vars[VAR_filter_tex0], r->tex[0]); + set_texture(prg->vars[VAR_filter_tex1], r->tex[1]); + set_texture(prg->vars[VAR_filter_tex2], r->tex[2]); - do_screen_quad(s, tc, stats); - tag_resources(r->tex[0], r->tex[1], r->tex[2]); - r->tex[0] = gdraw_TextureDrawBufferEnd(stats); + set_pixel_constant(prg->vars[VAR_filter_color], r->shader_data[0], + r->shader_data[1], r->shader_data[2], r->shader_data[3]); + set_pixel_constant(prg->vars[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); + set_pixel_constant(prg->vars[VAR_filter_color2], r->shader_data[8], + r->shader_data[9], r->shader_data[10], + r->shader_data[11]); + set_clamp_constant(prg->vars[VAR_filter_clamp0], r->tex[0]); + set_clamp_constant(prg->vars[VAR_filter_clamp1], r->tex[1]); + + 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) -{ - IDirect3DDevice9 *d3d = gdraw->d3d_device; - F32 tc[4]; - gswf_recti s; +static void RADLINK gdraw_FilterQuad(GDrawRenderState* r, S32 x0, S32 y0, + S32 x1, S32 y1, GDrawStats* stats) { + IDirect3DDevice9* d3d = gdraw->d3d_device; + 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; + // 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; + 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->SetRenderState(D3DRS_STENCILENABLE, FALSE); - d3d->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf); + // clear to known render state + d3d->SetRenderState(D3DRS_STENCILENABLE, FALSE); + d3d->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf); - d3d->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); - d3d->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS); - d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - - d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); + d3d->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); + d3d->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS); + d3d->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - gdraw->scissor_state = 0; - gdraw->blend_mode = GDRAW_BLEND_none; - gdraw->stencil_key = 0; - gdraw->z_key = 0; + d3d->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); + d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - 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 + gdraw->scissor_state = 0; + gdraw->blend_mode = GDRAW_BLEND_none; + gdraw->stencil_key = 0; + gdraw->z_key = 0; - b.BlurPass = gdraw_DriverBlurPass; - b.w = gdraw->tpw; - b.h = gdraw->tph; - b.frametex_width = gdraw->frametex_width; - b.frametex_height = gdraw->frametex_height; + 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 - // blur needs to draw with multiple passes, so set up special state - gdraw->in_blur = true; - set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); - set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); + b.BlurPass = gdraw_DriverBlurPass; + b.w = gdraw->tpw; + b.h = gdraw->tph; + b.frametex_width = gdraw->frametex_width; + b.frametex_height = gdraw->frametex_height; - // do the blur - gdraw_Blur(&gdraw_funcs, &b,r, &s, &bounds, stats); + // blur needs to draw with multiple passes, so set up special + // state + gdraw->in_blur = true; + set_viewport_raw(0, 0, gdraw->tpw, gdraw->tph); + set_projection_raw(0, gdraw->tpw, gdraw->tph, 0); - // restore the normal state - gdraw->in_blur = false; - set_viewport(); - set_projection(); - break; - } + // do the blur + gdraw_Blur(&gdraw_funcs, &b, r, &s, &bounds, stats); - 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; - static S16 zero[4] = { 0, 0, 0, 0 }; - - // for crazy blend modes, we need to read back from the framebuffer - // and do the blending in the pixel shader. we do this with StretchRect - // 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 causes MSAA issues! - if (r->blend_mode == GDRAW_BLEND_special && - (blend_tex = get_color_rendertarget(stats)) != NULL) { - - IDirect3DSurface9 *src; - HRESULT hr = d3d->GetRenderTarget(0, &src); - if (!FAILED(hr)) { - IDirect3DSurface9 *dest; - hr = blend_tex->handle.tex.d3d->GetSurfaceLevel(0, &dest); - if (!FAILED(hr)) { - RECT drect = { 0, 0, gdraw->tpw, gdraw->tph }; - RECT srect; - - if (gdraw->cur != gdraw->frame) - srect = drect; - else { - srect.left = gdraw->vx; - srect.top = gdraw->vy; - srect.right = gdraw->vx + gdraw->tw; - srect.bottom = gdraw->vy + gdraw->th; - drect.left = gdraw->tx0 - gdraw->tx0p; - drect.top = gdraw->ty0 - gdraw->ty0p; - drect.right = drect.left + gdraw->tw; - drect.bottom = drect.top + gdraw->th; - } - - d3d->StretchRect(src, &srect, dest, &drect, D3DTEXF_POINT); - dest->Release(); - - stats->nonzero_flags |= GDRAW_STATS_blits; - stats->num_blits += 1; - stats->num_blit_pixels += (srect.right - srect.left) * (srect.bottom - srect.top); + // restore the normal state + gdraw->in_blur = false; + set_viewport(); + set_projection(); + break; } - src->Release(); - } + case GDRAW_FILTER_colormatrix: + gdraw_Colormatrix(r, &s, tc, stats); + break; - set_texture(1, (GDrawTexture *) blend_tex); - // make sure we set color_add, because the shader reads it - if (!r->cxf_add) - r->cxf_add = zero; - } + case GDRAW_FILTER_dropshadow: + gdraw_Filter(r, &s, tc, 0, stats); + break; - if (!set_renderstate(GDRAW_vformat_v2tc2, r, stats)) - return; + case GDRAW_FILTER_bevel: + gdraw_Filter(r, &s, tc, 1, stats); + break; - do_screen_quad(&s, tc, stats); - tag_resources(r->tex[0], r->tex[1]); - if (blend_tex) - gdraw_FreeTexture((GDrawTexture *) blend_tex, 0, stats); - } + default: + assert(0); + } + } else { + GDrawHandle* blend_tex = NULL; + static S16 zero[4] = {0, 0, 0, 0}; + + // for crazy blend modes, we need to read back from the framebuffer + // and do the blending in the pixel shader. we do this with StretchRect + // 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 causes MSAA issues! + if (r->blend_mode == GDRAW_BLEND_special && + (blend_tex = get_color_rendertarget(stats)) != NULL) { + IDirect3DSurface9* src; + HRESULT hr = d3d->GetRenderTarget(0, &src); + if (!FAILED(hr)) { + IDirect3DSurface9* dest; + hr = blend_tex->handle.tex.d3d->GetSurfaceLevel(0, &dest); + if (!FAILED(hr)) { + RECT drect = {0, 0, gdraw->tpw, gdraw->tph}; + RECT srect; + + if (gdraw->cur != gdraw->frame) + srect = drect; + else { + srect.left = gdraw->vx; + srect.top = gdraw->vy; + srect.right = gdraw->vx + gdraw->tw; + srect.bottom = gdraw->vy + gdraw->th; + drect.left = gdraw->tx0 - gdraw->tx0p; + drect.top = gdraw->ty0 - gdraw->ty0p; + drect.right = drect.left + gdraw->tw; + drect.bottom = drect.top + gdraw->th; + } + + d3d->StretchRect(src, &srect, dest, &drect, D3DTEXF_POINT); + dest->Release(); + + stats->nonzero_flags |= GDRAW_STATS_blits; + stats->num_blits += 1; + stats->num_blit_pixels += + (srect.right - srect.left) * (srect.bottom - srect.top); + } + + src->Release(); + } + + set_texture(1, (GDrawTexture*)blend_tex); + // make sure we set color_add, because the shader reads it + if (!r->cxf_add) r->cxf_add = zero; + } + + if (!set_renderstate(GDRAW_vformat_v2tc2, r, stats)) 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); + } } /////////////////////////////////////////////////////////////////////// @@ -1797,69 +1890,82 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 #include "gdraw_d3d9_shaders.inl" -static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src) -{ - *p = *src; - if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, &p->pshader); - if (FAILED(hr)) { - IggyGDrawSendWarning(NULL, "GDraw D3D error creating pixel shader: 0x%08x", hr); - p->pshader = NULL; - } - } +static void create_pixel_shader(ProgramWithCachedVariableLocations* p, + ProgramWithCachedVariableLocations* src) { + *p = *src; + if (p->bytecode) { + HRESULT hr = + gdraw->d3d_device->CreatePixelShader(p->bytecode, &p->pshader); + if (FAILED(hr)) { + IggyGDrawSendWarning( + NULL, "GDraw D3D error creating pixel shader: 0x%08x", hr); + p->pshader = NULL; + } + } } -static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramWithCachedVariableLocations *src) -{ - *p = *src; - if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, &p->vshader); - if (FAILED(hr)) { - IggyGDrawSendWarning(NULL, "GDraw D3D error creating vertex shader: 0x%08x", hr); - p->vshader = NULL; - } - } +static void create_vertex_shader(ProgramWithCachedVariableLocations* p, + ProgramWithCachedVariableLocations* src) { + *p = *src; + if (p->bytecode) { + HRESULT hr = + gdraw->d3d_device->CreateVertexShader(p->bytecode, &p->vshader); + if (FAILED(hr)) { + IggyGDrawSendWarning( + NULL, "GDraw D3D error creating vertex shader: 0x%08x", hr); + p->vshader = NULL; + } + } } -static void destroy_shader(ProgramWithCachedVariableLocations *p) -{ - safe_release(p->pshader); +static void destroy_shader(ProgramWithCachedVariableLocations* p) { + safe_release(p->pshader); } -static void create_all_shaders(void) -{ - S32 i; +static void create_all_shaders(void) { + S32 i; - 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->manual_clear, pshader_manual_clear_arr); + 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->manual_clear, pshader_manual_clear_arr); - for (i=0; i < GDRAW_vformat__count; i++) { - HRESULT hr = gdraw->d3d_device->CreateVertexDeclaration(vformats[i], &gdraw->vdec[i]); - if (FAILED(hr)) - IggyGDrawSendWarning(NULL, "GDraw D3D error in CreateVertexDeclaration: 0x%08x", hr); + for (i = 0; i < GDRAW_vformat__count; i++) { + HRESULT hr = gdraw->d3d_device->CreateVertexDeclaration( + vformats[i], &gdraw->vdec[i]); + if (FAILED(hr)) + IggyGDrawSendWarning( + NULL, "GDraw D3D error in CreateVertexDeclaration: 0x%08x", hr); - create_vertex_shader(&gdraw->vert[i], vshader_vsd3d9_arr + i); - } + create_vertex_shader(&gdraw->vert[i], vshader_vsd3d9_arr + i); + } } -static void destroy_all_shaders() -{ - S32 i; +static void destroy_all_shaders() { + 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); + 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); - for (i=0; i < GDRAW_vformat__count; i++) { - if (gdraw->vdec[i]) { gdraw->vdec[i]->Release(); gdraw->vdec[i] = 0; } - destroy_shader(&gdraw->vert[i]); - } + for (i = 0; i < GDRAW_vformat__count; i++) { + if (gdraw->vdec[i]) { + gdraw->vdec[i]->Release(); + gdraw->vdec[i] = 0; + } + destroy_shader(&gdraw->vert[i]); + } } //////////////////////////////////////////////////////////////////////// @@ -1867,359 +1973,418 @@ static void destroy_all_shaders() // Create and tear-down the state // -typedef struct -{ - S32 num_handles; - S32 num_bytes; +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[ASSERT_COUNT(GDRAW_D3D_RESOURCE__count, 3)] = { - MAX_RENDER_STACK_DEPTH + 1, 16*1024*1024, // GDRAW_D3D_RESOURCE_rendertarget - 500, 16*1024*1024, // GDRAW_D3D_RESOURCE_texture - 1000, 2*1024*1024, // GDRAW_D3D_RESOURCE_vertexbuffer +// These are the defaults limits used by GDraw unless the user specifies +// something else. +static GDrawResourceLimit + gdraw_limits[ASSERT_COUNT(GDRAW_D3D_RESOURCE__count, 3)] = { + MAX_RENDER_STACK_DEPTH + 1, + 16 * 1024 * 1024, // GDRAW_D3D_RESOURCE_rendertarget + 500, + 16 * 1024 * 1024, // GDRAW_D3D_RESOURCE_texture + 1000, + 2 * 1024 * 1024, // GDRAW_D3D_RESOURCE_vertexbuffer }; -static GDrawHandleCache *make_handle_cache(gdraw_d3d_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_D3D_RESOURCE_vertexbuffer); - } +static GDrawHandleCache* make_handle_cache(gdraw_d3d_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_D3D_RESOURCE_vertexbuffer); + } - return cache; + 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 void free_gdraw() { + if (!gdraw) return; + if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); + if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); + IggyGDrawFree(gdraw); + gdraw = NULL; } -int gdraw_D3D_SetResourceLimits(gdraw_d3d_resourcetype type, S32 num_handles, S32 num_bytes) -{ - GDrawStats stats={0}; +int gdraw_D3D_SetResourceLimits(gdraw_d3d_resourcetype type, S32 num_handles, + S32 num_bytes) { + GDrawStats stats = {0}; - if (type == GDRAW_D3D_RESOURCE_rendertarget) // RT count is small and space is preallocated - num_handles = MAX_RENDER_STACK_DEPTH + 1; + if (type == GDRAW_D3D_RESOURCE_rendertarget) // RT count is small and space + // is preallocated + num_handles = MAX_RENDER_STACK_DEPTH + 1; - assert(type >= GDRAW_D3D_RESOURCE_rendertarget && type < GDRAW_D3D_RESOURCE__count); - assert(num_handles >= 0); - assert(num_bytes >= 0); + assert(type >= GDRAW_D3D_RESOURCE_rendertarget && + type < GDRAW_D3D_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; + // 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; + 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; + // if no gdraw context created, there's nothing to worry about + if (!gdraw) return 1; - // resize the appropriate pool - switch (type) { - case GDRAW_D3D_RESOURCE_rendertarget: - flush_rendertargets(&stats); - gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, num_bytes); - return 1; - - case GDRAW_D3D_RESOURCE_texture: - if (gdraw->texturecache) { - gdraw_res_flush(gdraw->texturecache, &stats); - IggyGDrawFree(gdraw->texturecache); - } - gdraw->texturecache = make_handle_cache(GDRAW_D3D_RESOURCE_texture); - return gdraw->texturecache != NULL; + // resize the appropriate pool + switch (type) { + case GDRAW_D3D_RESOURCE_rendertarget: + flush_rendertargets(&stats); + gdraw_HandleCacheInit(&gdraw->rendertargets, num_handles, + num_bytes); + return 1; - case GDRAW_D3D_RESOURCE_vertexbuffer: - if (gdraw->vbufcache) { - gdraw_res_flush(gdraw->vbufcache, &stats); - IggyGDrawFree(gdraw->vbufcache); - } - gdraw->vbufcache = make_handle_cache(GDRAW_D3D_RESOURCE_vertexbuffer); - return gdraw->vbufcache != NULL; - - default: - return 0; - } -} - -GDrawFunctions *gdraw_D3D_CreateContext(IDirect3DDevice9 *dev, 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->texturecache = make_handle_cache(GDRAW_D3D_RESOURCE_texture); - gdraw->vbufcache = make_handle_cache(GDRAW_D3D_RESOURCE_vertexbuffer); - gdraw_HandleCacheInit(&gdraw->rendertargets, gdraw_limits[GDRAW_D3D_RESOURCE_rendertarget].num_handles, gdraw_limits[GDRAW_D3D_RESOURCE_rendertarget].num_bytes); - - if (!gdraw->texturecache || !gdraw->vbufcache) { - free_gdraw(); - return NULL; - } - - if (!quad_ib[1]) { - // initialize quad index buffer - for (U16 i=0; i < QUAD_IB_COUNT; i++) { - quad_ib[i*6 + 0] = i*4 + 0; - quad_ib[i*6 + 1] = i*4 + 1; - quad_ib[i*6 + 2] = i*4 + 2; - quad_ib[i*6 + 3] = i*4 + 0; - quad_ib[i*6 + 4] = i*4 + 2; - quad_ib[i*6 + 5] = i*4 + 3; - } - } - - D3DCAPS9 caps; - dev->GetDeviceCaps(&caps); - gdraw->conditional_nonpow2 = ((caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) != 0); - - gdraw->d3d_device = dev; - create_all_shaders(); - - 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_D3D_MakeTextureFromResource; - gdraw_funcs.FreeTextureFromResource = gdraw_D3D_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_D3D_DestroyContext(void) -{ - if (gdraw && gdraw->d3d_device) { - GDrawStats stats={0}; - destroy_all_shaders(); - gdraw_res_flush(gdraw->texturecache, &stats); - gdraw_res_flush(gdraw->vbufcache, &stats); - flush_rendertargets(&stats); - - safe_release(gdraw->aa_tex); - gdraw->d3d_device = NULL; - } - - free_gdraw(); -} - -void gdraw_D3D_SetErrorHandler(void (__cdecl *error_handler)(HRESULT hr)) -{ - if (gdraw) - gdraw->error_handler = error_handler; -} - -void gdraw_D3D_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_D3D_PostReset(void) -{ - // maybe re-create rendertargets right now? -} - -void RADLINK gdraw_D3D_BeginCustomDraw(IggyCustomDrawCallbackRegion *region, D3DMATRIX *mat) -{ - clear_renderstate(); - gdraw_GetObjectSpaceMatrix(mat->m[0], region->o2w, gdraw->projection, 0, 0); -} - -void RADLINK gdraw_D3D_EndCustomDraw(IggyCustomDrawCallbackRegion * /*region*/) -{ - set_common_renderstate(); - set_projection(); -} - -void RADLINK gdraw_D3D_GetResourceUsageStats(gdraw_d3d_resourcetype type, S32 *handles_used, S32 *bytes_used) -{ - GDrawHandleCache *cache; - - switch (type) { - case GDRAW_D3D_RESOURCE_rendertarget: cache = &gdraw->rendertargets; break; - case GDRAW_D3D_RESOURCE_texture: cache = gdraw->texturecache; break; - case GDRAW_D3D_RESOURCE_vertexbuffer: cache = gdraw->vbufcache; break; - 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; - } - } -} - -GDrawTexture * RADLINK gdraw_D3D_MakeTextureFromResource(U8 *resource_file, S32 /*len*/, IggyFileTextureRaw *texture) -{ - GDrawTexture *h; - S32 width, height, mipmaps, size; - IDirect3DTexture9 *tex; - D3DFORMAT d3dfmt; - width = texture->w; - height = texture->h; - mipmaps = texture->mipmaps; - - // discard mipmaps on non-pow-of-2 if the hardware doesn't support - if (gdraw->conditional_nonpow2) { - if ((width & (width-1)) || (height & (height-1))) - mipmaps = 1; - } - - switch (texture->format) { - case IFT_FORMAT_rgba_8888 : size= 4; d3dfmt = D3DFMT_A8R8G8B8; break; - case IFT_FORMAT_rgba_4444_LE: size= 2; d3dfmt = D3DFMT_A4R4G4B4; break; - case IFT_FORMAT_rgba_5551_LE: size= 2; d3dfmt = D3DFMT_A1R5G5B5; break; - case IFT_FORMAT_la_88 : size= 2; d3dfmt = D3DFMT_A8L8; break; - case IFT_FORMAT_la_44 : size= 1; d3dfmt = D3DFMT_A4L4; break; - case IFT_FORMAT_i_8 : - case IFT_FORMAT_i_4 : size= 2; d3dfmt = D3DFMT_A8L8; break; - case IFT_FORMAT_l_8 : size= 1; - case IFT_FORMAT_l_4 : size= 1; d3dfmt = D3DFMT_L8; break; - case IFT_FORMAT_DXT1 : size= 8; d3dfmt = D3DFMT_DXT1; break; - case IFT_FORMAT_DXT3 : size=16; d3dfmt = D3DFMT_DXT3; break; - case IFT_FORMAT_DXT5 : size=16; d3dfmt = D3DFMT_DXT5; break; - default: size=0; d3dfmt=D3DFMT_UNKNOWN; break; - } - - HRESULT hr = gdraw->d3d_device->CreateTexture(width, height, mipmaps, - 0, d3dfmt, D3DPOOL_MANAGED, &tex, NULL); - if (FAILED(hr)) { - if (size >= 8 && ((width & 3) || (height & 3))) - IggyGDrawSendWarning(NULL, "GDraw D3D error, dxtc texture dimensions must be multiples of 4"); - else - report_d3d_error(hr, "CreateTexture", ""); - return NULL; - } - - U8 *data = resource_file + texture->file_offset; - - for (int level=0; level < mipmaps; ++level) { - S32 dxt_width = (width+3)/4; - S32 effective_height; - if (size >= 8) - effective_height = (height+3)/4; - else - effective_height = height; - - D3DLOCKED_RECT z; - hr = tex->LockRect(level, &z, NULL, 0); - if (FAILED(hr)) { - report_d3d_error(hr, "LockRect", " while creating texture"); - tex->Release(); - return NULL; - } - U8 *pixels = (U8*) z.pBits; - for (S32 j=0; j < effective_height; ++j) { - switch (texture->format) { - default: - memcpy(pixels + z.Pitch*j, data + j*width*size, width*size); - break; - case IFT_FORMAT_rgba_8888: { - for (S32 i=0; i < width; ++i) { - pixels[z.Pitch*j + i*4 + 0] = data[j*width*4 + i*4 + 2]; - pixels[z.Pitch*j + i*4 + 1] = data[j*width*4 + i*4 + 1]; - pixels[z.Pitch*j + i*4 + 2] = data[j*width*4 + i*4 + 0]; - pixels[z.Pitch*j + i*4 + 3] = data[j*width*4 + i*4 + 3]; - } - break; + case GDRAW_D3D_RESOURCE_texture: + if (gdraw->texturecache) { + gdraw_res_flush(gdraw->texturecache, &stats); + IggyGDrawFree(gdraw->texturecache); } - case IFT_FORMAT_DXT1: - case IFT_FORMAT_DXT3: - case IFT_FORMAT_DXT5: - memcpy(pixels + z.Pitch*j, data + j*dxt_width*size, dxt_width*size); - break; - case IFT_FORMAT_i_8: - case IFT_FORMAT_i_4: { - // convert from intensity to luminance-alpha by replicating all the pixels - for (S32 i=0; i < width; ++i) - pixels[z.Pitch*j + i*2 + 0] = - pixels[z.Pitch*j + i*2 + 1] = data[j*width + i]; - break; + gdraw->texturecache = make_handle_cache(GDRAW_D3D_RESOURCE_texture); + return gdraw->texturecache != NULL; + + case GDRAW_D3D_RESOURCE_vertexbuffer: + if (gdraw->vbufcache) { + gdraw_res_flush(gdraw->vbufcache, &stats); + IggyGDrawFree(gdraw->vbufcache); } - } - } - tex->UnlockRect(level); + gdraw->vbufcache = + make_handle_cache(GDRAW_D3D_RESOURCE_vertexbuffer); + return gdraw->vbufcache != NULL; - data += (size<8) ? width*height*size : ((width+3)/4)*((height+3)/4)*size; - width = width >>1; width += !width ; - height = height>>1; height += !height; - } - - h = gdraw_D3D_WrappedTextureCreate(tex); - if (!h) tex->Release(); - return h; + default: + return 0; + } } -void RADLINK gdraw_D3D_DestroyTextureFromResource(GDrawTexture *tex) -{ - GDrawHandle *h = (GDrawHandle *) tex; - h->handle.tex.d3d->Release(); - gdraw_D3D_WrappedTextureDestroy(tex); +GDrawFunctions* gdraw_D3D_CreateContext(IDirect3DDevice9* dev, 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->texturecache = make_handle_cache(GDRAW_D3D_RESOURCE_texture); + gdraw->vbufcache = make_handle_cache(GDRAW_D3D_RESOURCE_vertexbuffer); + gdraw_HandleCacheInit( + &gdraw->rendertargets, + gdraw_limits[GDRAW_D3D_RESOURCE_rendertarget].num_handles, + gdraw_limits[GDRAW_D3D_RESOURCE_rendertarget].num_bytes); + + if (!gdraw->texturecache || !gdraw->vbufcache) { + free_gdraw(); + return NULL; + } + + if (!quad_ib[1]) { + // initialize quad index buffer + for (U16 i = 0; i < QUAD_IB_COUNT; i++) { + quad_ib[i * 6 + 0] = i * 4 + 0; + quad_ib[i * 6 + 1] = i * 4 + 1; + quad_ib[i * 6 + 2] = i * 4 + 2; + quad_ib[i * 6 + 3] = i * 4 + 0; + quad_ib[i * 6 + 4] = i * 4 + 2; + quad_ib[i * 6 + 5] = i * 4 + 3; + } + } + + D3DCAPS9 caps; + dev->GetDeviceCaps(&caps); + gdraw->conditional_nonpow2 = + ((caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) != 0); + + gdraw->d3d_device = dev; + create_all_shaders(); + + 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_D3D_MakeTextureFromResource; + gdraw_funcs.FreeTextureFromResource = gdraw_D3D_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_D3D_DestroyContext(void) { + if (gdraw && gdraw->d3d_device) { + GDrawStats stats = {0}; + destroy_all_shaders(); + gdraw_res_flush(gdraw->texturecache, &stats); + gdraw_res_flush(gdraw->vbufcache, &stats); + flush_rendertargets(&stats); + + safe_release(gdraw->aa_tex); + gdraw->d3d_device = NULL; + } + + free_gdraw(); +} + +void gdraw_D3D_SetErrorHandler(void(__cdecl* error_handler)(HRESULT hr)) { + if (gdraw) gdraw->error_handler = error_handler; +} + +void gdraw_D3D_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_D3D_PostReset(void) { + // maybe re-create rendertargets right now? +} + +void RADLINK gdraw_D3D_BeginCustomDraw(IggyCustomDrawCallbackRegion* region, + D3DMATRIX* mat) { + clear_renderstate(); + gdraw_GetObjectSpaceMatrix(mat->m[0], region->o2w, gdraw->projection, 0, 0); +} + +void RADLINK gdraw_D3D_EndCustomDraw(IggyCustomDrawCallbackRegion* /*region*/) { + set_common_renderstate(); + set_projection(); +} + +void RADLINK gdraw_D3D_GetResourceUsageStats(gdraw_d3d_resourcetype type, + S32* handles_used, + S32* bytes_used) { + GDrawHandleCache* cache; + + switch (type) { + case GDRAW_D3D_RESOURCE_rendertarget: + cache = &gdraw->rendertargets; + break; + case GDRAW_D3D_RESOURCE_texture: + cache = gdraw->texturecache; + break; + case GDRAW_D3D_RESOURCE_vertexbuffer: + cache = gdraw->vbufcache; + break; + 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; + } + } +} + +GDrawTexture* RADLINK gdraw_D3D_MakeTextureFromResource( + U8* resource_file, S32 /*len*/, IggyFileTextureRaw* texture) { + GDrawTexture* h; + S32 width, height, mipmaps, size; + IDirect3DTexture9* tex; + D3DFORMAT d3dfmt; + width = texture->w; + height = texture->h; + mipmaps = texture->mipmaps; + + // discard mipmaps on non-pow-of-2 if the hardware doesn't support + if (gdraw->conditional_nonpow2) { + if ((width & (width - 1)) || (height & (height - 1))) mipmaps = 1; + } + + switch (texture->format) { + case IFT_FORMAT_rgba_8888: + size = 4; + d3dfmt = D3DFMT_A8R8G8B8; + break; + case IFT_FORMAT_rgba_4444_LE: + size = 2; + d3dfmt = D3DFMT_A4R4G4B4; + break; + case IFT_FORMAT_rgba_5551_LE: + size = 2; + d3dfmt = D3DFMT_A1R5G5B5; + break; + case IFT_FORMAT_la_88: + size = 2; + d3dfmt = D3DFMT_A8L8; + break; + case IFT_FORMAT_la_44: + size = 1; + d3dfmt = D3DFMT_A4L4; + break; + case IFT_FORMAT_i_8: + case IFT_FORMAT_i_4: + size = 2; + d3dfmt = D3DFMT_A8L8; + break; + case IFT_FORMAT_l_8: + size = 1; + case IFT_FORMAT_l_4: + size = 1; + d3dfmt = D3DFMT_L8; + break; + case IFT_FORMAT_DXT1: + size = 8; + d3dfmt = D3DFMT_DXT1; + break; + case IFT_FORMAT_DXT3: + size = 16; + d3dfmt = D3DFMT_DXT3; + break; + case IFT_FORMAT_DXT5: + size = 16; + d3dfmt = D3DFMT_DXT5; + break; + default: + size = 0; + d3dfmt = D3DFMT_UNKNOWN; + break; + } + + HRESULT hr = gdraw->d3d_device->CreateTexture( + width, height, mipmaps, 0, d3dfmt, D3DPOOL_MANAGED, &tex, NULL); + if (FAILED(hr)) { + if (size >= 8 && ((width & 3) || (height & 3))) + IggyGDrawSendWarning(NULL, + "GDraw D3D error, dxtc texture dimensions " + "must be multiples of 4"); + else + report_d3d_error(hr, "CreateTexture", ""); + return NULL; + } + + U8* data = resource_file + texture->file_offset; + + for (int level = 0; level < mipmaps; ++level) { + S32 dxt_width = (width + 3) / 4; + S32 effective_height; + if (size >= 8) + effective_height = (height + 3) / 4; + else + effective_height = height; + + D3DLOCKED_RECT z; + hr = tex->LockRect(level, &z, NULL, 0); + if (FAILED(hr)) { + report_d3d_error(hr, "LockRect", " while creating texture"); + tex->Release(); + return NULL; + } + U8* pixels = (U8*)z.pBits; + for (S32 j = 0; j < effective_height; ++j) { + switch (texture->format) { + default: + memcpy(pixels + z.Pitch * j, data + j * width * size, + width * size); + break; + case IFT_FORMAT_rgba_8888: { + for (S32 i = 0; i < width; ++i) { + pixels[z.Pitch * j + i * 4 + 0] = + data[j * width * 4 + i * 4 + 2]; + pixels[z.Pitch * j + i * 4 + 1] = + data[j * width * 4 + i * 4 + 1]; + pixels[z.Pitch * j + i * 4 + 2] = + data[j * width * 4 + i * 4 + 0]; + pixels[z.Pitch * j + i * 4 + 3] = + data[j * width * 4 + i * 4 + 3]; + } + break; + } + case IFT_FORMAT_DXT1: + case IFT_FORMAT_DXT3: + case IFT_FORMAT_DXT5: + memcpy(pixels + z.Pitch * j, data + j * dxt_width * size, + dxt_width * size); + break; + case IFT_FORMAT_i_8: + case IFT_FORMAT_i_4: { + // convert from intensity to luminance-alpha by replicating + // all the pixels + for (S32 i = 0; i < width; ++i) + pixels[z.Pitch * j + i * 2 + 0] = + pixels[z.Pitch * j + i * 2 + 1] = + data[j * width + i]; + break; + } + } + } + tex->UnlockRect(level); + + data += (size < 8) ? width * height * size + : ((width + 3) / 4) * ((height + 3) / 4) * size; + width = width >> 1; + width += !width; + height = height >> 1; + height += !height; + } + + h = gdraw_D3D_WrappedTextureCreate(tex); + if (!h) tex->Release(); + return h; +} + +void RADLINK gdraw_D3D_DestroyTextureFromResource(GDrawTexture* tex) { + GDrawHandle* h = (GDrawHandle*)tex; + h->handle.tex.d3d->Release(); + gdraw_D3D_WrappedTextureDestroy(tex); } diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.h b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.h index e0ffa0eea..1c413f523 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d.h @@ -6,103 +6,120 @@ #include "../include/gdraw.h" #define IDOC -//idoc(parent,GDraw_d3d9) +// idoc(parent,GDraw_d3d9) -typedef enum gdraw_d3d_resourcetype -{ - GDRAW_D3D_RESOURCE_rendertarget, - GDRAW_D3D_RESOURCE_texture, - GDRAW_D3D_RESOURCE_vertexbuffer, +typedef enum gdraw_d3d_resourcetype { + GDRAW_D3D_RESOURCE_rendertarget, + GDRAW_D3D_RESOURCE_texture, + GDRAW_D3D_RESOURCE_vertexbuffer, - GDRAW_D3D_RESOURCE__count, + GDRAW_D3D_RESOURCE__count, } gdraw_d3d_resourcetype; -IDOC extern int gdraw_D3D_SetResourceLimits(gdraw_d3d_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. +IDOC extern int gdraw_D3D_SetResourceLimits(gdraw_d3d_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. + 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_D3D_CreateContext(IDirect3DDevice9 *dev, S32 w, S32 h); -/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device - and the width/height of the content you're displaying. - - 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. +IDOC extern GDrawFunctions* gdraw_D3D_CreateContext(IDirect3DDevice9* dev, + S32 w, S32 h); +/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D + device and the width/height of the content you're displaying. + + 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. */ + 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_D3D_SetRendertargetSize(S32 w, S32 h); -/* Reset the size used for internal rendertargets defined by CreateContext. Flushes - all existing rendertargets if the size changes. */ +/* Reset the size used for internal rendertargets defined by CreateContext. + Flushes all existing rendertargets if the size changes. */ IDOC extern void gdraw_D3D_DestroyContext(void); /* Destroys the current GDraw context, if any. */ -IDOC extern void gdraw_D3D_SetTileOrigin(IDirect3DSurface9 *rt, IDirect3DSurface9 *depth, S32 x, S32 y); -/* This sets the main rendertarget that GDraw should render to, the corresponding - depth/stencil surface, and the x/y position where to draw the top-left of the current tile (to be used for tiled - rendering). You need to call this before Iggy calls any rendering functions. */ +IDOC extern void gdraw_D3D_SetTileOrigin(IDirect3DSurface9* rt, + IDirect3DSurface9* depth, S32 x, + S32 y); +/* This sets the main rendertarget that GDraw should render to, the + corresponding depth/stencil surface, and the x/y position where to draw the + top-left of the current tile (to be used for tiled rendering). You need to + call this before Iggy calls any rendering functions. */ IDOC extern void gdraw_D3D_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) */ +/* 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_D3D_PreReset(void); -/* Call this before D3D device Reset(); it will free all default pool resources allocated - by GDraw. */ +/* Call this before D3D device Reset(); it will free all default pool resources + allocated by GDraw. */ IDOC extern void gdraw_D3D_PostReset(void); /* Call after D3D device Reset(). */ -IDOC extern void RADLINK gdraw_D3D_BeginCustomDraw(IggyCustomDrawCallbackRegion *Region, D3DMATRIX *mat); -/* 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_D3D_BeginCustomDraw(IggyCustomDrawCallbackRegion* Region, D3DMATRIX* mat); +/* 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_D3D_EndCustomDraw(IggyCustomDrawCallbackRegion *Region); -/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */ +IDOC extern void RADLINK +gdraw_D3D_EndCustomDraw(IggyCustomDrawCallbackRegion* Region); +/* Call at the end of Iggy custom draw callback so GDraw can restore its render + * states. */ -IDOC extern void RADLINK gdraw_D3D_GetResourceUsageStats(gdraw_d3d_resourcetype type, S32 *handles_used, S32 *bytes_used); +IDOC extern void RADLINK gdraw_D3D_GetResourceUsageStats( + gdraw_d3d_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. - 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. */ + This can be used to get an estimate of how much graphics memory got used by + GDraw during the last frame. 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_D3D_WrappedTextureCreate(IDirect3DTexture9 *tex_handle); +IDOC extern GDrawTexture* gdraw_D3D_WrappedTextureCreate( + IDirect3DTexture9* tex_handle); /* Create a wrapped texture from a D3D texture. - 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. */ + 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_D3D_WrappedTextureChange(GDrawTexture *tex, IDirect3DTexture9 *tex_handle); +IDOC extern void gdraw_D3D_WrappedTextureChange(GDrawTexture* tex, + IDirect3DTexture9* tex_handle); /* Switch an existing GDrawTexture * that represents a wrapped texture to use a new underlying D3D texture. 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_D3D_WrappedTextureDestroy(GDrawTexture *tex); +IDOC extern void gdraw_D3D_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. */ -extern GDrawTexture * RADLINK gdraw_D3D_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture); -extern void RADLINK gdraw_D3D_DestroyTextureFromResource(GDrawTexture *tex); +extern GDrawTexture* RADLINK gdraw_D3D_MakeTextureFromResource( + U8* resource_file, S32 length, IggyFileTextureRaw* texture); +extern void RADLINK gdraw_D3D_DestroyTextureFromResource(GDrawTexture* tex); diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.cpp b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.cpp index 0900b400d..de1289445 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.cpp +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.cpp @@ -2,24 +2,30 @@ // // This implements the Iggy graphics driver layer for D3D 10. -// 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. +// 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, +// 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; +// - 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 +// - 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 @@ -29,8 +35,9 @@ #endif // 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(push) +#pragma warning(disable \ + : 4201) // nonstandard extension used : nameless struct/union #include #include @@ -41,97 +48,98 @@ #include "gdraw_d3d10.h" -#pragma warning (pop) +#pragma warning(pop) -// Some macros to allow as much sharing between D3D10 and D3D11 code as possible. -#define D3D1X_(id) D3D10_##id -#define ID3D1X(id) ID3D10##id -#define gdraw_D3D1X_(id) gdraw_D3D10_##id -#define GDRAW_D3D1X_(id) GDRAW_D3D10_##id +// Some macros to allow as much sharing between D3D10 and D3D11 code as +// possible. +#define D3D1X_(id) D3D10_##id +#define ID3D1X(id) ID3D10##id +#define gdraw_D3D1X_(id) gdraw_D3D10_##id +#define GDRAW_D3D1X_(id) GDRAW_D3D10_##id typedef ID3D10Device ID3D1XDevice; typedef ID3D10Device ID3D1XContext; typedef S32 ViewCoord; typedef gdraw_d3d10_resourcetype gdraw_resourcetype; -static void report_d3d_error(HRESULT hr, char *call, char *context); +static void report_d3d_error(HRESULT hr, char* call, char* context); -static void *map_buffer(ID3D1XContext *, ID3D10Buffer *buf, bool discard) -{ - void *ptr; - if (FAILED(buf->Map(discard ? D3D10_MAP_WRITE_DISCARD : D3D10_MAP_WRITE_NO_OVERWRITE, 0, &ptr))) - return NULL; - else - return ptr; +static void* map_buffer(ID3D1XContext*, ID3D10Buffer* buf, bool discard) { + void* ptr; + if (FAILED(buf->Map( + discard ? D3D10_MAP_WRITE_DISCARD : D3D10_MAP_WRITE_NO_OVERWRITE, 0, + &ptr))) + return NULL; + else + return ptr; } -static void unmap_buffer(ID3D1XContext *, ID3D10Buffer *buf) -{ - buf->Unmap(); +static void unmap_buffer(ID3D1XContext*, ID3D10Buffer* buf) { buf->Unmap(); } + +static RADINLINE void set_pixel_shader(ID3D10Device* ctx, + ID3D10PixelShader* shader) { + ctx->PSSetShader(shader); } -static RADINLINE void set_pixel_shader(ID3D10Device *ctx, ID3D10PixelShader *shader) -{ - ctx->PSSetShader(shader); +static RADINLINE void set_vertex_shader(ID3D10Device* ctx, + ID3D10VertexShader* shader) { + ctx->VSSetShader(shader); } -static RADINLINE void set_vertex_shader(ID3D10Device *ctx, ID3D10VertexShader *shader) -{ - ctx->VSSetShader(shader); -} +static ID3D10BlendState* create_blend_state(ID3D10Device* dev, BOOL blend, + D3D10_BLEND src, D3D10_BLEND dst) { + D3D10_BLEND_DESC desc = {}; + desc.BlendEnable[0] = blend; + desc.SrcBlend = src; + desc.DestBlend = dst; + desc.BlendOp = D3D10_BLEND_OP_ADD; + desc.SrcBlendAlpha = + (src == D3D10_BLEND_DEST_COLOR) ? D3D10_BLEND_DEST_ALPHA : src; + desc.DestBlendAlpha = dst; + desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; -static ID3D10BlendState *create_blend_state(ID3D10Device *dev, BOOL blend, D3D10_BLEND src, D3D10_BLEND dst) -{ - D3D10_BLEND_DESC desc = {}; - desc.BlendEnable[0] = blend; - desc.SrcBlend = src; - desc.DestBlend = dst; - desc.BlendOp = D3D10_BLEND_OP_ADD; - desc.SrcBlendAlpha = (src == D3D10_BLEND_DEST_COLOR ) ? D3D10_BLEND_DEST_ALPHA : src; - desc.DestBlendAlpha = dst; - desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; - desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + ID3D10BlendState* res; + HRESULT hr = dev->CreateBlendState(&desc, &res); + if (FAILED(hr)) { + report_d3d_error(hr, "CreateBlendState", ""); + res = NULL; + } - ID3D10BlendState *res; - HRESULT hr = dev->CreateBlendState(&desc, &res); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateBlendState", ""); - res = NULL; - } - - return res; + 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, &p->pshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = NULL; - return; - } - } +static void create_pixel_shader(ProgramWithCachedVariableLocations* p, + ProgramWithCachedVariableLocations* src) { + *p = *src; + if (p->bytecode) { + HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, + &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, &p->vshader); - if (FAILED(hr)) { - report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = 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, + &p->vshader); + if (FAILED(hr)) { + report_d3d_error(hr, "CreateVertexShader", ""); + p->vshader = NULL; + return; + } + } } -GDrawFunctions *gdraw_D3D10_CreateContext(ID3D10Device *dev, S32 w, S32 h) -{ - return create_context(dev, dev, w, h); +GDrawFunctions* gdraw_D3D10_CreateContext(ID3D10Device* dev, S32 w, S32 h) { + return create_context(dev, dev, w, h); } diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.h b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.h index 7eadf2095..65fa8024c 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d10.h @@ -4,130 +4,149 @@ // Interface for creating a D3D10 GDraw driver. #define IDOC -//idoc(parent,GDraw_d3d10) +// idoc(parent,GDraw_d3d10) -typedef enum gdraw_d3d10_resourcetype -{ - GDRAW_D3D10_RESOURCE_rendertarget, - GDRAW_D3D10_RESOURCE_texture, - GDRAW_D3D10_RESOURCE_vertexbuffer, - GDRAW_D3D10_RESOURCE_dynbuffer, // Streaming buffer for dynamic vertex/index data (handle count ignored) +typedef enum gdraw_d3d10_resourcetype { + GDRAW_D3D10_RESOURCE_rendertarget, + GDRAW_D3D10_RESOURCE_texture, + GDRAW_D3D10_RESOURCE_vertexbuffer, + GDRAW_D3D10_RESOURCE_dynbuffer, // Streaming buffer for dynamic + // vertex/index data (handle count ignored) - GDRAW_D3D10_RESOURCE__count, + GDRAW_D3D10_RESOURCE__count, } gdraw_d3d10_resourcetype; -IDOC extern int gdraw_D3D10_SetResourceLimits(gdraw_d3d10_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. +IDOC extern int gdraw_D3D10_SetResourceLimits(gdraw_d3d10_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. + 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_D3D10_CreateContext(ID3D10Device *dev, S32 w, S32 h); -/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D device - and the width/height of render target textures. +IDOC extern GDrawFunctions* gdraw_D3D10_CreateContext(ID3D10Device* dev, S32 w, + S32 h); +/* Creates a GDraw context for rendering using D3D. You need to pass in the D3D + device 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. + 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. */ + 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_D3D10_DestroyContext(void); /* Destroys the current GDraw context, if any. */ -IDOC extern void gdraw_D3D10_SetErrorHandler(void (__cdecl *error_handler)(HRESULT hr)); +IDOC extern void gdraw_D3D10_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). */ + 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_D3D10_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_D3D10_CreateContext, the width and - height specified here are only minimums; GDraw will reallocate larger rendertargets - as needed. */ +/* 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_D3D10_CreateContext, + the width and height specified here are only minimums; GDraw will reallocate + larger rendertargets as needed. */ -IDOC extern void gdraw_D3D10_SetTileOrigin(ID3D10RenderTargetView *main_rt, ID3D10DepthStencilView *main_ds, - ID3D10ShaderResourceView *non_msaa_rt, S32 x, S32 y); +IDOC extern void gdraw_D3D10_SetTileOrigin( + ID3D10RenderTargetView* main_rt, ID3D10DepthStencilView* main_ds, + ID3D10ShaderResourceView* 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. + 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_D3D10_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) */ +/* 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_D3D10_PreReset(void); -/* Call this before D3D device Reset(); it will free all default pool resources allocated - by GDraw. */ +/* Call this before D3D device Reset(); it will free all default pool resources + allocated by GDraw. */ IDOC extern void gdraw_D3D10_PostReset(void); /* Call after D3D device Reset(). */ -IDOC extern void RADLINK gdraw_D3D10_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_D3D10_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_D3D10_EndCustomDraw(IggyCustomDrawCallbackRegion *Region); -/* Call at the end of Iggy custom draw callback so GDraw can restore its render states. */ +IDOC extern void RADLINK +gdraw_D3D10_EndCustomDraw(IggyCustomDrawCallbackRegion* Region); +/* Call at the end of Iggy custom draw callback so GDraw can restore its render + * states. */ -IDOC extern void RADLINK gdraw_D3D10_GetResourceUsageStats(gdraw_d3d10_resourcetype type, S32 *handles_used, S32 *bytes_used); +IDOC extern void RADLINK gdraw_D3D10_GetResourceUsageStats( + gdraw_d3d10_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. + 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. + 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. */ + 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_D3D10_WrappedTextureCreate(ID3D10ShaderResourceView *tex_view); +IDOC extern GDrawTexture* gdraw_D3D10_WrappedTextureCreate( + ID3D10ShaderResourceView* 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. */ + 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_D3D10_WrappedTextureChange(GDrawTexture *tex, ID3D10ShaderResourceView *tex_view); +IDOC extern void gdraw_D3D10_WrappedTextureChange( + GDrawTexture* tex, ID3D10ShaderResourceView* 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_D3D10_WrappedTextureDestroy(GDrawTexture *tex); +IDOC extern void gdraw_D3D10_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. */ -extern GDrawTexture * RADLINK gdraw_D3D10_MakeTextureFromResource(U8 *resource_file, S32 length, IggyFileTextureRaw *texture); -extern void RADLINK gdraw_D3D10_DestroyTextureFromResource(GDrawTexture *tex); +extern GDrawTexture* RADLINK gdraw_D3D10_MakeTextureFromResource( + U8* resource_file, S32 length, IggyFileTextureRaw* texture); +extern void RADLINK gdraw_D3D10_DestroyTextureFromResource(GDrawTexture* tex); diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.cpp index e5ada026f..d8655ff36 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.cpp @@ -1,27 +1,33 @@ -#include "../../../../../Minecraft.World/Platform/stdafx.h" // 4J +#include "../../../../../Minecraft.World/Platform/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. +// 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, +// 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; +// - 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 +// - 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 @@ -31,8 +37,9 @@ #endif // 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(push) +#pragma warning(disable \ + : 4201) // nonstandard extension used : nameless struct/union #include #include @@ -43,105 +50,109 @@ #include "gdraw_d3d11.h" -#pragma warning (pop) +#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 +// 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 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* 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 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_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 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; +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; - } + ID3D11BlendState* res; + HRESULT hr = dev->CreateBlendState(&desc, &res); + if (FAILED(hr)) { + report_d3d_error(hr, "CreateBlendState", ""); + res = NULL; + } - return res; + 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_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; - } - } +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); +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(); -} +// 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/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.h b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.h index 7fd7012fe..0c5b12493 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_d3d11.h @@ -1,139 +1,162 @@ -#pragma once // 4J +#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) +// 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) +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_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. +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. + 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. +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. + 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. */ + 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)); +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). */ + 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. */ +/* 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); +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. + 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) */ +/* 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. */ +/* 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_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_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); +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. + 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. + 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. */ + 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); +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. */ + 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); +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); +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); +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/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c index 8829f176c..7b5fae1f3 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c @@ -22,63 +22,70 @@ // across platforms) // -#define GDRAW_GL_EXTENSION_LIST \ - /* identifier import procname */ \ - /* GL_ARB_multitexture */ \ - GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \ - /* GL_ARB_texture_compression */ \ - GLE(CompressedTexImage2D, "CompressedTexImage2DARB", COMPRESSEDTEXIMAGE2DARB) \ - /* GL_ARB_vertex_buffer_object */ \ - GLE(GenBuffers, "GenBuffersARB", GENBUFFERSARB) \ - GLE(DeleteBuffers, "DeleteBuffersARB", DELETEBUFFERSARB) \ - GLE(BindBuffer, "BindBufferARB", BINDBUFFERARB) \ - GLE(BufferData, "BufferDataARB", BUFFERDATAARB) \ - GLE(MapBuffer, "MapBufferARB", MAPBUFFERARB) \ - GLE(UnmapBuffer, "UnmapBufferARB", UNMAPBUFFERARB) \ - GLE(VertexAttribPointer, "VertexAttribPointerARB", VERTEXATTRIBPOINTERARB) \ - GLE(EnableVertexAttribArray, "EnableVertexAttribArrayARB", ENABLEVERTEXATTRIBARRAYARB) \ - GLE(DisableVertexAttribArray, "DisableVertexAttribArrayARB", DISABLEVERTEXATTRIBARRAYARB) \ - /* GL_ARB_shader_objects */ \ - GLE(CreateShader, "CreateShaderObjectARB", CREATESHADEROBJECTARB) \ - GLE(DeleteShader, "DeleteObjectARB", DELETEOBJECTARB) \ - GLE(ShaderSource, "ShaderSourceARB", SHADERSOURCEARB) \ - GLE(CompileShader, "CompileShaderARB", COMPILESHADERARB) \ - GLE(GetShaderiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \ - GLE(GetShaderInfoLog, "GetInfoLogARB", GETINFOLOGARB) \ - GLE(CreateProgram, "CreateProgramObjectARB", CREATEPROGRAMOBJECTARB) \ - GLE(DeleteProgram, "DeleteObjectARB", DELETEOBJECTARB) \ - GLE(AttachShader, "AttachObjectARB", ATTACHOBJECTARB) \ - GLE(LinkProgram, "LinkProgramARB", LINKPROGRAMARB) \ - GLE(GetUniformLocation, "GetUniformLocationARB", GETUNIFORMLOCATIONARB) \ - GLE(UseProgram, "UseProgramObjectARB", USEPROGRAMOBJECTARB) \ - GLE(GetProgramiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \ - GLE(GetProgramInfoLog, "GetInfoLogARB", GETINFOLOGARB) \ - GLE(Uniform1i, "Uniform1iARB", UNIFORM1IARB) \ - GLE(Uniform4f, "Uniform4fARB", UNIFORM4FARB) \ - GLE(Uniform4fv, "Uniform4fvARB", UNIFORM4FVARB) \ - /* GL_ARB_vertex_shader */ \ - GLE(BindAttribLocation, "BindAttribLocationARB", BINDATTRIBLOCATIONARB) \ - /* GL_EXT_framebuffer_object */ \ - GLE(GenRenderbuffers, "GenRenderbuffersEXT", GENRENDERBUFFERSEXT) \ - GLE(DeleteRenderbuffers, "DeleteRenderbuffersEXT", DELETERENDERBUFFERSEXT) \ - GLE(BindRenderbuffer, "BindRenderbufferEXT", BINDRENDERBUFFEREXT) \ - GLE(RenderbufferStorage, "RenderbufferStorageEXT", RENDERBUFFERSTORAGEEXT) \ - GLE(GenFramebuffers, "GenFramebuffersEXT", GENFRAMEBUFFERSEXT) \ - GLE(DeleteFramebuffers, "DeleteFramebuffersEXT", DELETEFRAMEBUFFERSEXT) \ - GLE(BindFramebuffer, "BindFramebufferEXT", BINDFRAMEBUFFEREXT) \ - GLE(CheckFramebufferStatus, "CheckFramebufferStatusEXT", CHECKFRAMEBUFFERSTATUSEXT) \ - GLE(FramebufferRenderbuffer, "FramebufferRenderbufferEXT", FRAMEBUFFERRENDERBUFFEREXT) \ - GLE(FramebufferTexture2D, "FramebufferTexture2DEXT", FRAMEBUFFERTEXTURE2DEXT) \ - GLE(GenerateMipmap, "GenerateMipmapEXT", GENERATEMIPMAPEXT) \ - /* GL_EXT_framebuffer_blit */ \ - GLE(BlitFramebuffer, "BlitFramebufferEXT", BLITFRAMEBUFFEREXT) \ - /* GL_EXT_framebuffer_multisample */ \ - GLE(RenderbufferStorageMultisample, "RenderbufferStorageMultisampleEXT",RENDERBUFFERSTORAGEMULTISAMPLEEXT) \ - /* */ +#define GDRAW_GL_EXTENSION_LIST \ + /* identifier import procname */ \ + /* GL_ARB_multitexture */ \ + GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \ + /* GL_ARB_texture_compression */ \ + GLE(CompressedTexImage2D, "CompressedTexImage2DARB", \ + COMPRESSEDTEXIMAGE2DARB) \ + /* GL_ARB_vertex_buffer_object */ \ + GLE(GenBuffers, "GenBuffersARB", GENBUFFERSARB) \ + GLE(DeleteBuffers, "DeleteBuffersARB", DELETEBUFFERSARB) \ + GLE(BindBuffer, "BindBufferARB", BINDBUFFERARB) \ + GLE(BufferData, "BufferDataARB", BUFFERDATAARB) \ + GLE(MapBuffer, "MapBufferARB", MAPBUFFERARB) \ + GLE(UnmapBuffer, "UnmapBufferARB", UNMAPBUFFERARB) \ + GLE(VertexAttribPointer, "VertexAttribPointerARB", VERTEXATTRIBPOINTERARB) \ + GLE(EnableVertexAttribArray, "EnableVertexAttribArrayARB", \ + ENABLEVERTEXATTRIBARRAYARB) \ + GLE(DisableVertexAttribArray, "DisableVertexAttribArrayARB", \ + DISABLEVERTEXATTRIBARRAYARB) \ + /* GL_ARB_shader_objects */ \ + GLE(CreateShader, "CreateShaderObjectARB", CREATESHADEROBJECTARB) \ + GLE(DeleteShader, "DeleteObjectARB", DELETEOBJECTARB) \ + GLE(ShaderSource, "ShaderSourceARB", SHADERSOURCEARB) \ + GLE(CompileShader, "CompileShaderARB", COMPILESHADERARB) \ + GLE(GetShaderiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \ + GLE(GetShaderInfoLog, "GetInfoLogARB", GETINFOLOGARB) \ + GLE(CreateProgram, "CreateProgramObjectARB", CREATEPROGRAMOBJECTARB) \ + GLE(DeleteProgram, "DeleteObjectARB", DELETEOBJECTARB) \ + GLE(AttachShader, "AttachObjectARB", ATTACHOBJECTARB) \ + GLE(LinkProgram, "LinkProgramARB", LINKPROGRAMARB) \ + GLE(GetUniformLocation, "GetUniformLocationARB", GETUNIFORMLOCATIONARB) \ + GLE(UseProgram, "UseProgramObjectARB", USEPROGRAMOBJECTARB) \ + GLE(GetProgramiv, "GetObjectParameterivARB", GETOBJECTPARAMETERIVARB) \ + GLE(GetProgramInfoLog, "GetInfoLogARB", GETINFOLOGARB) \ + GLE(Uniform1i, "Uniform1iARB", UNIFORM1IARB) \ + GLE(Uniform4f, "Uniform4fARB", UNIFORM4FARB) \ + GLE(Uniform4fv, "Uniform4fvARB", UNIFORM4FVARB) \ + /* GL_ARB_vertex_shader */ \ + GLE(BindAttribLocation, "BindAttribLocationARB", BINDATTRIBLOCATIONARB) \ + /* GL_EXT_framebuffer_object */ \ + GLE(GenRenderbuffers, "GenRenderbuffersEXT", GENRENDERBUFFERSEXT) \ + GLE(DeleteRenderbuffers, "DeleteRenderbuffersEXT", DELETERENDERBUFFERSEXT) \ + GLE(BindRenderbuffer, "BindRenderbufferEXT", BINDRENDERBUFFEREXT) \ + GLE(RenderbufferStorage, "RenderbufferStorageEXT", RENDERBUFFERSTORAGEEXT) \ + GLE(GenFramebuffers, "GenFramebuffersEXT", GENFRAMEBUFFERSEXT) \ + GLE(DeleteFramebuffers, "DeleteFramebuffersEXT", DELETEFRAMEBUFFERSEXT) \ + GLE(BindFramebuffer, "BindFramebufferEXT", BINDFRAMEBUFFEREXT) \ + GLE(CheckFramebufferStatus, "CheckFramebufferStatusEXT", \ + CHECKFRAMEBUFFERSTATUSEXT) \ + GLE(FramebufferRenderbuffer, "FramebufferRenderbufferEXT", \ + FRAMEBUFFERRENDERBUFFEREXT) \ + GLE(FramebufferTexture2D, "FramebufferTexture2DEXT", \ + FRAMEBUFFERTEXTURE2DEXT) \ + GLE(GenerateMipmap, "GenerateMipmapEXT", GENERATEMIPMAPEXT) \ + /* GL_EXT_framebuffer_blit */ \ + GLE(BlitFramebuffer, "BlitFramebufferEXT", BLITFRAMEBUFFEREXT) \ + /* GL_EXT_framebuffer_multisample */ \ + GLE(RenderbufferStorageMultisample, "RenderbufferStorageMultisampleEXT", \ + RENDERBUFFERSTORAGEMULTISAMPLEEXT) \ + /* */ -#define gdraw_GLx_(id) gdraw_GL_##id -#define GDRAW_GLx_(id) GDRAW_GL_##id -#define GDRAW_SHADERS "gdraw_gl_shaders.inl" +#define gdraw_GLx_(id) gdraw_GL_##id +#define GDRAW_GLx_(id) GDRAW_GL_##id +#define GDRAW_SHADERS "gdraw_gl_shaders.inl" typedef GLhandleARB GLhandle; typedef gdraw_gl_resourcetype gdraw_resourcetype; @@ -88,21 +95,19 @@ typedef gdraw_gl_resourcetype gdraw_resourcetype; GDRAW_GL_EXTENSION_LIST #undef GLE -static void load_extensions(void) -{ -#define GLE(id, import, procname) gl##id = (PFNGL##procname##PROC) wglGetProcAddress("gl" import); - GDRAW_GL_EXTENSION_LIST +static void load_extensions(void) { +#define GLE(id, import, procname) \ + gl##id = (PFNGL##procname##PROC)wglGetProcAddress("gl" import); + GDRAW_GL_EXTENSION_LIST #undef GLE } -static void clear_renderstate_platform_specific(void) -{ - glDisable(GL_ALPHA_TEST); +static void clear_renderstate_platform_specific(void) { + glDisable(GL_ALPHA_TEST); } -static void error_msg_platform_specific(const char *msg) -{ - OutputDebugStringA(msg); +static void error_msg_platform_specific(const char* msg) { + OutputDebugStringA(msg); } /////////////////////////////////////////////////////////////////////////////// @@ -118,84 +123,97 @@ static void error_msg_platform_specific(const char *msg) // Initialization and platform-specific functionality // -GDrawFunctions *gdraw_GL_CreateContext(S32 w, S32 h, S32 msaa_samples) -{ - static const TextureFormatDesc tex_formats[] = { - { IFT_FORMAT_rgba_8888, 1, 1, 4, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_rgba_4444_LE, 1, 1, 2, GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 }, - { IFT_FORMAT_rgba_5551_LE, 1, 1, 2, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 }, - { IFT_FORMAT_la_88, 1, 1, 2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_la_44, 1, 1, 1, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_i_8, 1, 1, 1, GL_INTENSITY8, GL_ALPHA, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_i_4, 1, 1, 1, GL_INTENSITY4, GL_ALPHA, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_l_8, 1, 1, 1, GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_l_4, 1, 1, 1, GL_LUMINANCE4, GL_LUMINANCE, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_DXT1, 4, 4, 8, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 0, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_DXT3, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 0, GL_UNSIGNED_BYTE }, - { IFT_FORMAT_DXT5, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 0, GL_UNSIGNED_BYTE }, - { 0, 0, 0, 0, 0, 0, 0 }, - }; +GDrawFunctions* gdraw_GL_CreateContext(S32 w, S32 h, S32 msaa_samples) { + static const TextureFormatDesc tex_formats[] = { + {IFT_FORMAT_rgba_8888, 1, 1, 4, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE}, + {IFT_FORMAT_rgba_4444_LE, 1, 1, 2, GL_RGBA4, GL_RGBA, + GL_UNSIGNED_SHORT_4_4_4_4}, + {IFT_FORMAT_rgba_5551_LE, 1, 1, 2, GL_RGB5_A1, GL_RGBA, + GL_UNSIGNED_SHORT_5_5_5_1}, + {IFT_FORMAT_la_88, 1, 1, 2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_la_44, 1, 1, 1, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE_ALPHA, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_i_8, 1, 1, 1, GL_INTENSITY8, GL_ALPHA, GL_UNSIGNED_BYTE}, + {IFT_FORMAT_i_4, 1, 1, 1, GL_INTENSITY4, GL_ALPHA, GL_UNSIGNED_BYTE}, + {IFT_FORMAT_l_8, 1, 1, 1, GL_LUMINANCE8, GL_LUMINANCE, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_l_4, 1, 1, 1, GL_LUMINANCE4, GL_LUMINANCE, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_DXT1, 4, 4, 8, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 0, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_DXT3, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 0, + GL_UNSIGNED_BYTE}, + {IFT_FORMAT_DXT5, 4, 4, 16, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 0, + GL_UNSIGNED_BYTE}, + {0, 0, 0, 0, 0, 0, 0}, + }; - GDrawFunctions *funcs; - const char *s; - GLint n; + GDrawFunctions* funcs; + const char* s; + GLint n; - // check for the extensions we need - s = (const char *) glGetString(GL_EXTENSIONS); - if (s == NULL) { - assert(s != NULL); // if this is NULL, you're probably trying to create the device too early - return NULL; - } + // check for the extensions we need + s = (const char*)glGetString(GL_EXTENSIONS); + if (s == NULL) { + assert(s != NULL); // if this is NULL, you're probably trying to create + // the device too early + return NULL; + } - // check for the extensions we won't work without - if (!hasext(s, "GL_ARB_multitexture") || - !hasext(s, "GL_ARB_texture_compression") || - !hasext(s, "GL_ARB_texture_mirrored_repeat") || - !hasext(s, "GL_ARB_texture_non_power_of_two") || // with caveats - see below! - !hasext(s, "GL_ARB_vertex_buffer_object") || - !hasext(s, "GL_EXT_framebuffer_object") || - !hasext(s, "GL_ARB_shader_objects") || - !hasext(s, "GL_ARB_vertex_shader") || - !hasext(s, "GL_ARB_fragment_shader")) - return NULL; - - // if user requests multisampling and HW doesn't support it, bail - if (!hasext(s, "GL_EXT_framebuffer_multisample") && msaa_samples > 1) - return NULL; + // check for the extensions we won't work without + if (!hasext(s, "GL_ARB_multitexture") || + !hasext(s, "GL_ARB_texture_compression") || + !hasext(s, "GL_ARB_texture_mirrored_repeat") || + !hasext( + s, + "GL_ARB_texture_non_power_of_two") || // with caveats - see below! + !hasext(s, "GL_ARB_vertex_buffer_object") || + !hasext(s, "GL_EXT_framebuffer_object") || + !hasext(s, "GL_ARB_shader_objects") || + !hasext(s, "GL_ARB_vertex_shader") || + !hasext(s, "GL_ARB_fragment_shader")) + return NULL; - load_extensions(); - funcs = create_context(w, h); - if (!funcs) - return NULL; + // if user requests multisampling and HW doesn't support it, bail + if (!hasext(s, "GL_EXT_framebuffer_multisample") && msaa_samples > 1) + return NULL; - gdraw->tex_formats = tex_formats; + load_extensions(); + funcs = create_context(w, h); + if (!funcs) return NULL; - // check for optional extensions - gdraw->has_mapbuffer = true; // part of core VBO extension on regular GL - gdraw->has_depth24 = true; // we just assume. - gdraw->has_texture_max_level = true; // core on regular GL + gdraw->tex_formats = tex_formats; - if (hasext(s, "GL_EXT_packed_depth_stencil")) gdraw->has_packed_depth_stencil = true; + // check for optional extensions + gdraw->has_mapbuffer = true; // part of core VBO extension on regular GL + gdraw->has_depth24 = true; // we just assume. + gdraw->has_texture_max_level = true; // core on regular GL - // we require ARB_texture_non_power_of_two - on actual HW, this may either give us - // "full" non-power-of-two support, or "conditional" non-power-of-two (wrap mode must - // be CLAMP_TO_EDGE, no mipmaps). figure out which it is using this heuristic by - // Unity's Aras Pranckevicius (thanks!): - // http://www.aras-p.info/blog/2012/10/17/non-power-of-two-textures/ - // - // we use the second heuristic (texture size <8192 for cards without full NPOT support) - // since we don't otherwise use ARB_fragment_program and don't want to create a program - // just to be able to query MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB! - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &n); - gdraw->has_conditional_non_power_of_two = n < 8192; + if (hasext(s, "GL_EXT_packed_depth_stencil")) + gdraw->has_packed_depth_stencil = true; - // clamp number of multisampling levels to max supported - if (msaa_samples > 1) { - glGetIntegerv(GL_MAX_SAMPLES, &n); - gdraw->multisampling = RR_MIN(msaa_samples, n); - } + // we require ARB_texture_non_power_of_two - on actual HW, this may either + // give us "full" non-power-of-two support, or "conditional" + // non-power-of-two (wrap mode must be CLAMP_TO_EDGE, no mipmaps). figure + // out which it is using this heuristic by Unity's Aras Pranckevicius + // (thanks!): + // http://www.aras-p.info/blog/2012/10/17/non-power-of-two-textures/ + // + // we use the second heuristic (texture size <8192 for cards without full + // NPOT support) since we don't otherwise use ARB_fragment_program and don't + // want to create a program just to be able to query + // MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB! + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &n); + gdraw->has_conditional_non_power_of_two = n < 8192; - opengl_check(); + // clamp number of multisampling levels to max supported + if (msaa_samples > 1) { + glGetIntegerv(GL_MAX_SAMPLES, &n); + gdraw->multisampling = RR_MIN(msaa_samples, n); + } - return funcs; + opengl_check(); + + return funcs; } diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.h b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.h index c290cfc6e..5669624fc 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.h @@ -6,32 +6,42 @@ RADDEFSTART -typedef enum gdraw_gl_resourcetype -{ - GDRAW_GL_RESOURCE_rendertarget, - GDRAW_GL_RESOURCE_texture, - GDRAW_GL_RESOURCE_vertexbuffer, +typedef enum gdraw_gl_resourcetype { + GDRAW_GL_RESOURCE_rendertarget, + GDRAW_GL_RESOURCE_texture, + GDRAW_GL_RESOURCE_vertexbuffer, - GDRAW_GL_RESOURCE__count, + GDRAW_GL_RESOURCE__count, } gdraw_gl_resourcetype; struct IggyCustomDrawCallbackRegion; -extern int gdraw_GL_SetResourceLimits(gdraw_gl_resourcetype type, S32 num_handles, S32 num_bytes); -extern GDrawFunctions * gdraw_GL_CreateContext(S32 min_w, S32 min_h, S32 msaa_samples); +extern int gdraw_GL_SetResourceLimits(gdraw_gl_resourcetype type, + S32 num_handles, S32 num_bytes); +extern GDrawFunctions* gdraw_GL_CreateContext(S32 min_w, S32 min_h, + S32 msaa_samples); extern void gdraw_GL_DestroyContext(void); -extern void gdraw_GL_SetTileOrigin(S32 vx, S32 vy, U32 framebuffer); // framebuffer=FBO handle, or 0 for main frame buffer +extern void gdraw_GL_SetTileOrigin( + S32 vx, S32 vy, + U32 framebuffer); // framebuffer=FBO handle, or 0 for main frame buffer extern void gdraw_GL_NoMoreGDrawThisFrame(void); -extern GDrawTexture *gdraw_GL_WrappedTextureCreate(S32 gl_texture_handle, S32 width, S32 height, rrbool has_mipmaps); -extern void gdraw_GL_WrappedTextureChange(GDrawTexture *tex, S32 new_gl_texture_handle, S32 new_width, S32 new_height, rrbool new_has_mipmaps); -extern void gdraw_GL_WrappedTextureDestroy(GDrawTexture *tex); +extern GDrawTexture* gdraw_GL_WrappedTextureCreate(S32 gl_texture_handle, + S32 width, S32 height, + rrbool has_mipmaps); +extern void gdraw_GL_WrappedTextureChange(GDrawTexture* tex, + S32 new_gl_texture_handle, + S32 new_width, S32 new_height, + rrbool new_has_mipmaps); +extern void gdraw_GL_WrappedTextureDestroy(GDrawTexture* tex); -extern void gdraw_GL_BeginCustomDraw(struct IggyCustomDrawCallbackRegion *region, F32 *matrix); -extern void gdraw_GL_EndCustomDraw(struct IggyCustomDrawCallbackRegion *region); +extern void gdraw_GL_BeginCustomDraw( + struct IggyCustomDrawCallbackRegion* region, F32* matrix); +extern void gdraw_GL_EndCustomDraw(struct IggyCustomDrawCallbackRegion* region); -extern GDrawTexture * RADLINK gdraw_GL_MakeTextureFromResource(U8 *resource_file, S32 resource_len, IggyFileTextureRaw *texture); -extern void RADLINK gdraw_GL_DestroyTextureFromResource(GDrawTexture *tex); +extern GDrawTexture* RADLINK gdraw_GL_MakeTextureFromResource( + U8* resource_file, S32 resource_len, IggyFileTextureRaw* texture); +extern void RADLINK gdraw_GL_DestroyTextureFromResource(GDrawTexture* tex); RADDEFEND diff --git a/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h b/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h index 296a117fc..aa4dc236f 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h @@ -12,122 +12,127 @@ RADDEFSTART -//idoc(parent,GDrawAPI_Buffers) +// 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 +#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(parent,GDrawAPI_Base) -IDOC typedef struct gswf_recti -{ - S32 x0,y0; // Minimum corner of the rectangle - S32 x1,y1; // Maximum corner of the rectangle +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. */ +/* 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 +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. */ +/* 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) +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 +#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 + 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 + 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 */ +/* A structure with statistics information to show in resource browser/Telemetry + */ //////////////////////////////////////////////////////////// // // Queries // -//idoc(parent,GDrawAPI_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 +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__count, } gdraw_bformat; -/* Specifies what data format GDraw expects in MakeVertexBuffer_* and DrawIndexedTriangles. +/* 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. */ + 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 +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); +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. */ @@ -135,41 +140,44 @@ IDOC typedef void RADLINK gdraw_get_info(GDrawInfo *d); // // Drawing State // -//idoc(parent,GDrawAPI_DrawingState) +// 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 +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_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__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)) +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 + // 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__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. @@ -192,14 +200,13 @@ IDOC typedef enum gdraw_blendspecial // (@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 +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__count, } gdraw_filter; /* Specifies a type of post-processing graphics filter. @@ -209,103 +216,124 @@ IDOC typedef enum gdraw_filter 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 +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__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 +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__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 +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 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 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 + 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!) + 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 + 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 + // --- Everything below this point must be manually initialized - //0 mod 8 - F32 color[4]; // Color of the object + // 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 + // 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) + 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. */ +/* 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); +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] */ +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); +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); +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); @@ -314,20 +342,22 @@ IDOC typedef void RADLINK gdraw_rendering_begin(void); IDOC typedef void RADLINK gdraw_rendering_end(void); /* Ends rendering; gives up control of the graphics API. */ - //////////////////////////////////////////////////////////// // // Drawing // -//idoc(parent,GDrawAPI_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. */ +/* 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. */ +/* 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); +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, @@ -336,30 +366,37 @@ IDOC typedef void RADLINK gdraw_filter_quad(GDrawRenderState *r, S32 x0, S32 y0, 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) +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 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) + S32 vertex_format; // One of $gdraw_vformat, specifying the type of element + // in $(GDrawPrimitive::vertices) - U32 uniform_count; - F32 *uniforms; + U32 uniform_count; + F32* uniforms; - U8 drawprim_mode; + U8 drawprim_mode; } GDrawPrimitive; -/* Specifies the vertex and index data necessary to draw a batch of graphics primitives. */ +/* 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. +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; @@ -368,224 +405,281 @@ IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDra for the vertices and a 0 offset for the indices) */ -IDOC typedef void RADLINK gdraw_set_antialias_texture(S32 width, U8 *rgba); +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. */ + '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(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. +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, + // 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. + // 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 +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__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 +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) + 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 + 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 +#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); +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); +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 + $: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); +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 + $: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); +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); +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 + $: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); +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. + + $: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); +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) + $: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); +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); +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); +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 +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 +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; + 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. */ +/* 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 +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_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) +typedef int gdraw_verify_size_xyst[sizeof(gswf_vertex_xyst) == 16 ? 1 : -1]; - GDRAW_vformat__basic_count, - GDRAW_vformat_ihud1 = GDRAW_vformat__basic_count, // primary format for ihud, currently v2tc2mat4 (20 bytes per vertex) +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__count, - GDRAW_vformat_mixed, // Special value that denotes a VB containing data in multiple vertex formats. Never used when drawing! + 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 +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 + 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) + 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. */ +/* $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 + S32 size_in_bytes; // Size of the vertex buffer in bytes } GDraw_VertexBuffer_Description; -/* $GDraw_VertexBuffer_Description contains information about a vertex buffer. */ +/* $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); +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 + $: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); +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 -*/ + $: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); +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); +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); +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 + $: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); +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 + $: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. +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 @@ -594,40 +688,57 @@ IDOC typedef void RADLINK gdraw_unlock_handles(GDrawStats *stats); 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); +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 + $: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); +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 + $: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(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 +#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); +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 + 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); +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. @@ -637,77 +748,81 @@ IDOC typedef GDrawTexture * RADLINK gdraw_texture_draw_buffer_end(GDrawStats *st // // Masking // -//idoc(parent,GDrawAPI_Masking) +// idoc(parent,GDrawAPI_Masking) -IDOC typedef void RADLINK gdraw_draw_mask_begin(gswf_recti *region, S32 mask_bit, GDrawStats *stats); +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. + 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); +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. + 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(parent,GDrawAPI_Base) -IDOC struct GDrawFunctions -{ +IDOC struct GDrawFunctions { // queries - gdraw_get_info *GetInfo; + 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; + 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; + 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_texture_draw_buffer_begin* TextureDrawBufferBegin; + gdraw_texture_draw_buffer_end* TextureDrawBufferEnd; - gdraw_describe_texture * DescribeTexture; - gdraw_describe_vertex_buffer * DescribeVertexBuffer; + 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_set_texture_unique_id* SetTextureUniqueID; - gdraw_draw_mask_begin * DrawMaskBegin; - gdraw_draw_mask_end * DrawMaskEnd; + gdraw_draw_mask_begin* DrawMaskBegin; + gdraw_draw_mask_end* DrawMaskEnd; - gdraw_rendering_begin * RenderingBegin; - gdraw_rendering_end * RenderingEnd; + gdraw_rendering_begin* RenderingBegin; + gdraw_rendering_end* RenderingEnd; - gdraw_make_texture_from_resource * MakeTextureFromResource; - gdraw_free_texture_from_resource * FreeTextureFromResource; + gdraw_make_texture_from_resource* MakeTextureFromResource; + gdraw_free_texture_from_resource* FreeTextureFromResource; - gdraw_set_3d_transform * Set3DTransform; + gdraw_set_3d_transform* Set3DTransform; }; /* The function interface called by Iggy to render graphics on all platforms. diff --git a/Minecraft.Client/Platform/Windows64/Iggy/include/iggy.h b/Minecraft.Client/Platform/Windows64/Iggy/include/iggy.h index d38ccae67..c648b4601 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/include/iggy.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/include/iggy.h @@ -3,104 +3,122 @@ #ifndef __RAD_INCLUDE_IGGY_H__ #define __RAD_INCLUDE_IGGY_H__ -#include // size_t +#include // size_t #define IggyVersion "1.2.30" #define IggyFlashVersion "9,1,2,30" -#include "rrCore.h" // base data types, macros +#include "rrCore.h" // base data types, macros RADDEFSTART #ifndef IGGY_GDRAW_SHARED_TYPEDEF - #define IGGY_GDRAW_SHARED_TYPEDEF +#define IGGY_GDRAW_SHARED_TYPEDEF - typedef struct GDrawFunctions GDrawFunctions; - typedef struct GDrawTexture GDrawTexture; +typedef struct GDrawFunctions GDrawFunctions; +typedef struct GDrawTexture GDrawTexture; -#endif//IGGY_GDRAW_SHARED_TYPEDEF +#endif // IGGY_GDRAW_SHARED_TYPEDEF -#define IDOCN // Used by documentation generation system +#define IDOCN // Used by documentation generation system //////////////////////////////////////////////////////////// // // Basic Operations // -typedef enum IggyResult -{ - IGGY_RESULT_SUCCESS = 0, +typedef enum IggyResult { + IGGY_RESULT_SUCCESS = 0, - IGGY_RESULT_Warning_None = 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_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_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_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_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_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_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. + 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 +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_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 + 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 + // 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_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) + 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) + // 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. */ @@ -111,150 +129,216 @@ IDOCN typedef wchar_t IggyUTF16; 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 +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 +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 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 - }; +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 +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 +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 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 +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 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, +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); +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 +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 +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); +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 +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); +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 */ +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); +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); +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 +typedef enum { + IGGY_LANG_default, + IGGY_LANG_ja, + IGGY_LANG_ja_flash, // more strictly matches Flash } IggyLanguageCode; RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); @@ -267,290 +351,366 @@ RADEXPFUNC void RADEXPLINK IggySetLanguage(IggyLanguageCode lang); 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 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; +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; +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 IggyPlayerCreateFromFileAndPlay( + char const* filename, IggyPlayerConfig const* config); -RADEXPFUNC Iggy * RADEXPLINK IggyPlayerCreateFromMemory( - void const * data, - U32 data_size_in_bytes, - IggyPlayerConfig *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 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 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 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); +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 +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 + 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 + 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 + 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); +RADEXPFUNC IggyProperties* RADEXPLINK IggyPlayerProperties(Iggy* player); -typedef enum -{ - IGGY_PAUSE_continue_audio, - IGGY_PAUSE_pause_audio, - IGGY_PAUSE_stop_audio +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 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); +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; +typedef void* HIGGYEXP; /* An IggyExplorer context, it represents a connection to Iggy Explorer. */ #endif #ifndef __RAD_HIGGYPERFMON_ #define __RAD_HIGGYPERFMON_ -typedef void * HIGGYPERFMON; +typedef void* HIGGYPERFMON; /* An IggyPerfMon context */ #endif +IDOCN typedef void RADLINK iggyexp_detach_callback(void* ptr); -IDOCN typedef void RADLINK iggyexp_detach_callback(void *ptr); - -IDOCN typedef struct -{ - U64 tick_ticks; - U64 draw_ticks; +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); +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 +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 IggyInstallPerfmon(void* perfmon_context); -RADEXPFUNC void RADEXPLINK IggyUseExplorer(Iggy *swf, void *context); -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerSendFrameToExplorer(Iggy *f); +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; +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 +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, + 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 +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 + 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 +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 +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); +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); +#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 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 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; -typedef struct -{ - IggyFontGetFontMetrics *get_font_metrics; + IggyFontGetCodepointGlyph* get_glyph_for_codepoint; + IggyFontGetGlyphMetrics* get_glyph_metrics; + IggyFontIsGlyphEmpty* is_empty; + IggyFontGetKerningForGlyphPair* get_kerning; - IggyFontGetCodepointGlyph *get_glyph_for_codepoint; - IggyFontGetGlyphMetrics *get_glyph_metrics; - IggyFontIsGlyphEmpty *is_empty; - IggyFontGetKerningForGlyphPair *get_kerning; + IggyVectorFontGetGlyphShape* get_shape; + IggyVectorFontFreeGlyphShape* free_shape; - IggyVectorFontGetGlyphShape *get_shape; - IggyVectorFontFreeGlyphShape *free_shape; + S32 num_glyphs; - S32 num_glyphs; - - void *userdata; + void* userdata; } IggyVectorFontProvider; -typedef struct -{ - IggyFontGetFontMetrics *get_font_metrics; +typedef struct { + IggyFontGetFontMetrics* get_font_metrics; - IggyFontGetCodepointGlyph *get_glyph_for_codepoint; - IggyFontGetGlyphMetrics *get_glyph_metrics; - IggyFontIsGlyphEmpty *is_empty; - IggyFontGetKerningForGlyphPair *get_kerning; + IggyFontGetCodepointGlyph* get_glyph_for_codepoint; + IggyFontGetGlyphMetrics* get_glyph_metrics; + IggyFontIsGlyphEmpty* is_empty; + IggyFontGetKerningForGlyphPair* get_kerning; - IggyBitmapFontCanProvideBitmap *can_bitmap; - IggyBitmapFontGetGlyphBitmap *get_bitmap; - IggyBitmapFontFreeGlyphBitmap *free_bitmap; + IggyBitmapFontCanProvideBitmap* can_bitmap; + IggyBitmapFontGetGlyphBitmap* get_bitmap; + IggyBitmapFontFreeGlyphBitmap* free_bitmap; - S32 num_glyphs; + S32 num_glyphs; - void *userdata; + void* userdata; } IggyBitmapFontProvider; -typedef struct -{ - IggyBitmapFontCanProvideBitmap *can_bitmap; - IggyBitmapFontGetGlyphBitmap *get_bitmap; - IggyBitmapFontFreeGlyphBitmap *free_bitmap; - void *userdata; +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_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 +#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 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 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 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); +RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF8(const char* fontname, + S32 fontname_len, + U32 fontflags); +RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16* fontname, + S32 fontname_len, + U32 fontflags); //////////////////////////////////////////////////////////// // @@ -558,9 +718,13 @@ RADEXPFUNC void RADEXPLINK IggyFontSetFallbackFontUTF16(const U16 *fontname, S32 // 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 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); +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 @@ -578,226 +742,259 @@ RADEXPFUNC void RADEXPLINK IggyAudioUseDefault(void); #ifndef __RAD_DEFINE_IGGYMP3__ #define __RAD_DEFINE_IGGYMP3__ IDOCN typedef struct IggyMP3Interface IggyMP3Interface; -IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface *decoder); +IDOCN typedef rrbool IggyGetMP3Decoder(IggyMP3Interface* decoder); #endif #ifdef __RADNT__ - RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); - RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char *path); - RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(wchar_t *path); +RADEXPFUNC void RADEXPLINK IggyAudioInstallMP3Decoder(void); +RADEXPFUNC void RADEXPLINK IggySetDLLDirectory(char* path); +RADEXPFUNC void RADEXPLINK IggySetDLLDirectoryW(wchar_t* 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); +// 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 +#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); +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); +#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 +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) + 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); +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); +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 + 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 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]); +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, +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 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 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) +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 +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 +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); +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); +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; +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); +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, +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; +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; +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; +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; +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; +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; +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; //////////////////////////////////////////////////////////// @@ -805,358 +1002,478 @@ IDOCN typedef struct // 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); +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); +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 +#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 +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). +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 +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; + char* name; - IggyGarbageCollectionEvent event; // the type of garbage collection event that was just performed + 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 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 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 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 + 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); +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); +RADEXPFUNC rrbool RADEXPLINK IggyPlayerGetValid(Iggy* f); -IDOCN struct IggyValuePath -{ - Iggy *f; - IggyValuePath *parent; - //align 0 mod 8 +IDOCN struct IggyValuePath { + Iggy* f; + IggyValuePath* parent; + // align 0 mod 8 IggyName name; IggyValueRef ref; - //align 0 mod 8 + // align 0 mod 8 S32 index; S32 type; - //align 0 mod 8 + // align 0 mod 8 }; -typedef enum -{ - IGGY_ValueRef, - IGGY_ValueRef_Weak, +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 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 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 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 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 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 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); +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, +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? +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, +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, +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, +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, +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_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_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_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, + 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 -{ +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 +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 +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 -{ +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; // + 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 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 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); +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); //////////////////////////////////////////////////////////// // @@ -1167,12 +1484,17 @@ RADEXPFUNC S32 RADEXPLINK IggyPlayerCopyUTF8(Iggy *f, char *buffer, S32 bufferle #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); +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. +#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, @@ -1187,25 +1509,33 @@ IDOCN typedef enum { IGGY_IME_COMPOSITION_CLAUSE_START, } IggyIMECompositionClauseState; -IDOCN typedef struct -{ +IDOCN typedef struct { IggyUTF16 str[IGGY_IME_MAX_CANDIDATE_LENGTH]; - IggyIMECompositionDrawStyle char_style[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 + int candicate_clause_end_pos; // inclusive } IggyIMECompostitionStringState; -IDOCN RADEXPFUNC void RADEXPLINK IggyIMEWin32SetCompositionState(Iggy* f, IggyIMECompostitionStringState* s); +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 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 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]); +IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, + const U8 rgb[3]); #endif @@ -1214,35 +1544,41 @@ IDOCN RADEXPFUNC void RADEXPLINK IggyIMEDrawRect(S32 x0, S32 y0, S32 x1, S32 y1, // Input focus handling // -typedef void *IggyFocusHandle; +typedef void* IggyFocusHandle; -#define IGGY_FOCUS_NULL 0 +#define IGGY_FOCUS_NULL 0 -typedef struct -{ - IggyFocusHandle object; // unique identifier of Iggy object - F32 x0, y0, x1, y1; // bounding box of displayed shape +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); +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 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); +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); @@ -1255,40 +1591,47 @@ IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugBatchChooseEnd(S32 end); // debugging // -IDOCN RADEXPFUNC void RADEXPLINK IggyPlayerDebugUpdateReadyToTickWithFakeRender(Iggy *f); +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; +typedef struct { + S32 size; + char* source_file; + S32 source_line; + char* iggy_file; + char* info; } IggyLeakResultData; -typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData *data); +typedef void RADLINK IggyLeakResultCallback(IggyLeakResultData* data); -typedef struct -{ - char *subcategory; - S32 subcategory_stringlen; +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 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 + 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); +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_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 +#define IGGY_SYNCCHECK_readytotick 1U IDOCN RADDEFEND diff --git a/Minecraft.Client/Platform/Windows64/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Platform/Windows64/Iggy/include/iggyexpruntime.h index 1f1a90a1c..b9221bf7b 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/include/iggyexpruntime.h @@ -9,27 +9,33 @@ RADDEFSTART #ifndef __RAD_HIGGYEXP_ #define __RAD_HIGGYEXP_ -typedef void * HIGGYEXP; +typedef void* HIGGYEXP; #endif -//idoc(parent,IggyExpRuntime_API) +// idoc(parent,IggyExpRuntime_API) -#define IGGYEXP_MIN_STORAGE 1024 IDOC +#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. +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 + $: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. */ +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); +IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); /* Closes and destroys a connection to $IggyExplorer */ IDOC RADEXPFUNC rrbool RADEXPLINK IggyExpCheckValidity(HIGGYEXP p); @@ -46,4 +52,4 @@ An invalid $HIGGYEXP must still be shutdown with $IggyExpDestroy. */ RADDEFEND -#endif//__RAD_INCLUDE_IGGYEXPRUNTIME_H__ \ No newline at end of file +#endif //__RAD_INCLUDE_IGGYEXPRUNTIME_H__ \ No newline at end of file diff --git a/Minecraft.Client/Platform/Windows64/Iggy/include/iggyperfmon.h b/Minecraft.Client/Platform/Windows64/Iggy/include/iggyperfmon.h index 85b84b60b..68f70b728 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/include/iggyperfmon.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/include/iggyperfmon.h @@ -11,60 +11,73 @@ RADDEFSTART #ifndef __RAD_HIGGYPERFMON_ #define __RAD_HIGGYPERFMON_ -typedef void * HIGGYPERFMON; +typedef void* HIGGYPERFMON; #endif -//idoc(parent,IggyPerfmon_API) +// idoc(parent,IggyPerfmon_API) -typedef void * RADLINK iggyperfmon_malloc(void *handle, U32 size); -typedef void RADLINK iggyperfmon_free(void *handle, void *ptr); +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); +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. */ +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; + 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) +#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); +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 @@ -72,18 +85,22 @@ $: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 +$: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); +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 +#endif //__RAD_INCLUDE_IGGYPERFMON_H__ \ No newline at end of file diff --git a/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.cpp b/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.cpp index eb1ccc92e..c317739f3 100644 --- a/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.cpp +++ b/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.cpp @@ -2,4 +2,6 @@ #include "WindowsLeaderboardManager.h" -LeaderboardManager *LeaderboardManager::m_instance = new WindowsLeaderboardManager(); //Singleton instance of the LeaderboardManager \ No newline at end of file +LeaderboardManager* LeaderboardManager::m_instance = + new WindowsLeaderboardManager(); // Singleton instance of the + // LeaderboardManager \ No newline at end of file diff --git a/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.h b/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.h index 8083e5d43..a6e93e5ad 100644 --- a/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.h +++ b/Minecraft.Client/Platform/Windows64/Leaderboards/WindowsLeaderboardManager.h @@ -2,35 +2,50 @@ #include "../../Common/Leaderboards/LeaderboardManager.h" -class WindowsLeaderboardManager : public LeaderboardManager -{ +class WindowsLeaderboardManager : public LeaderboardManager { public: - virtual void Tick() {} + virtual void Tick() {} - //Open a session - virtual bool OpenSession() { return true; } + // Open a session + virtual bool OpenSession() { return true; } - //Close a session - virtual void CloseSession() {} + // Close a session + virtual void CloseSession() {} - //Delete a session - virtual void DeleteSession() {} + // 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 + // 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 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; } + 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() {} + // Perform a flush of the stats + virtual void FlushStats() {} - //Cancel the current operation - virtual void CancelOperation() {} + // Cancel the current operation + virtual void CancelOperation() {} - //Is the leaderboard manager idle. - virtual bool isIdle() { return true; } + // Is the leaderboard manager idle. + virtual bool isIdle() { return true; } }; diff --git a/Minecraft.Client/Platform/Windows64/Miles/include/tmapi.h b/Minecraft.Client/Platform/Windows64/Miles/include/tmapi.h index 997f384d3..4ff673be0 100644 --- a/Minecraft.Client/Platform/Windows64/Miles/include/tmapi.h +++ b/Minecraft.Client/Platform/Windows64/Miles/include/tmapi.h @@ -14,7 +14,7 @@ #define tmSetMutexState(...) #define tmAlloc(...) #define tmRealloc(...) -#define tmFree(...) +#define tmFree(...) #define tmPlot(...) #define tmBlob(...) TMERR_DISABLED #define tmBlobEx(...) TMERR_DISABLED @@ -22,7 +22,7 @@ #define tmEmitAccumulationZones(...) TMERR_DISABLED #define tmEnterAccumulationZone(...) TMERR_DISABLED #define tmLeaveAccumulationZone(...) TMERR_DISABLED -#define tmZone(...) +#define tmZone(...) #define tmSetLockState(...) #define tmLockName(...) #define tmSendCallStack(...) @@ -33,5 +33,4 @@ #define TM_CONTEXT_LITE(val) ((char*)(val)) #define TM_CONTEXT_FULL(val) ((char*)(val)) -typedef char *HTELEMETRY; - +typedef char* HTELEMETRY; diff --git a/Minecraft.Client/Platform/Windows64/Minecraft_Macros.h b/Minecraft.Client/Platform/Windows64/Minecraft_Macros.h index 5700e4762..daee4c3f1 100644 --- a/Minecraft.Client/Platform/Windows64/Minecraft_Macros.h +++ b/Minecraft.Client/Platform/Windows64/Minecraft_Macros.h @@ -5,37 +5,56 @@ // 5 bits alpha // 1 bit decoration // 3 bits poptime -// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved to item bitmask -// 6 bits count -// 6 bits scale +// 8 bits unused // was 11 bits aux val but needed 15 bits for potions so moved +// to item bitmask 6 bits count 6 bits scale -// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one from the packing, and add one on the unpacking -#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex,uiAlpha,bDecorations,uiCount,uiScale,uiPopTime) ((((uiUserIndex&0x7)<<29) | (uiAlpha&0x1F)<<24) | (bDecorations?0x800000:0) | ((uiPopTime&0x7)<<20) | ((uiCount-1)<<6) | (uiScale&0x3F)) +// uiCount is up to 64, but can't ever be 0, so to make it 6 bits, subtract one +// from the packing, and add one on the unpacking +#define MAKE_SLOTDISPLAY_DATA_BITMASK(uiUserIndex, uiAlpha, bDecorations, \ + uiCount, uiScale, uiPopTime) \ + ((((uiUserIndex & 0x7) << 29) | (uiAlpha & 0x1F) << 24) | \ + (bDecorations ? 0x800000 : 0) | ((uiPopTime & 0x7) << 20) | \ + ((uiCount - 1) << 6) | (uiScale & 0x3F)) -#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>29)&0x7) -#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>24)&0x1F) -#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x800000)?true:false) -//#define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask) ((((unsigned long)uiBitmask)>>12)&0x7FF) -#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) (((((unsigned int)uiBitmask)>>6)&0x3F)+1) -#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0x3F) -#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>20)&0x7) +#define GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 29) & 0x7) +#define GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 24) & 0x1F) +#define GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) & 0x800000) ? true : false) +// #define GET_SLOTDISPLAY_AUXVAL_FROM_DATA_BITMASK(uiBitmask) +// ((((unsigned long)uiBitmask)>>12)&0x7FF) +#define GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(uiBitmask) \ + (((((unsigned int)uiBitmask) >> 6) & 0x3F) + 1) +#define GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(uiBitmask) \ + (((unsigned int)uiBitmask) & 0x3F) +#define GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 20) & 0x7) // 16 bits for id (either item id or xzp icon id) // 15 bits for aux value // 1 bit for foil -#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId,uiAuxValue,bFoil) ( (uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil?0x80000000:0) ) - -#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) (((unsigned int)uiBitmask)&0xFFFF) -#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)>>16) & 0x7FFF) -#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) ((((unsigned int)uiBitmask)&0x80000000)?true:false) +#define MAKE_SLOTDISPLAY_ITEM_BITMASK(uiId, uiAuxValue, bFoil) \ + ((uiId & 0xFFFF) | ((uiAuxValue & 0x7FFF) << 16) | (bFoil ? 0x80000000 : 0)) +#define GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(uiBitmask) \ + (((unsigned int)uiBitmask) & 0xFFFF) +#define GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) >> 16) & 0x7FFF) +#define GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(uiBitmask) \ + ((((unsigned int)uiBitmask) & 0x80000000) ? true : false) // For encoding the players skin selection in their profile // bDlcSkin = false is a players skin, bDlcSkin = true is a DLC skin -#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) ( (bDlcSkin?0x80000000:0) | (dwSkinId & 0x7FFFFFFF) ) +#define MAKE_SKIN_BITMASK(bDlcSkin, dwSkinId) \ + ((bDlcSkin ? 0x80000000 : 0) | (dwSkinId & 0x7FFFFFFF)) #define IS_SKIN_ID_IN_RANGE(dwSkinId) (dwSkinId <= 0x7FFFFFFF) -#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) (((uint32_t)uiBitmask)&0x7FFFFFFF) -#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) (((uint32_t)uiBitmask)&0x7FFFFFE0) -#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) (((uint32_t)uiBitmask)&0x0000001F) -#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) ((((uint32_t)uiBitmask)&0x80000000)?true:false) +#define GET_DLC_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (((uint32_t)uiBitmask) & 0x7FFFFFFF) +#define GET_UGC_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (((uint32_t)uiBitmask) & 0x7FFFFFE0) +#define GET_DEFAULT_SKIN_ID_FROM_BITMASK(uiBitmask) \ + (((uint32_t)uiBitmask) & 0x0000001F) +#define GET_IS_DLC_SKIN_FROM_BITMASK(uiBitmask) \ + ((((uint32_t)uiBitmask) & 0x80000000) ? true : false) diff --git a/Minecraft.Client/Platform/Windows64/Resource.h b/Minecraft.Client/Platform/Windows64/Resource.h index 50af4a49e..6d871c475 100644 --- a/Minecraft.Client/Platform/Windows64/Resource.h +++ b/Minecraft.Client/Platform/Windows64/Resource.h @@ -3,29 +3,29 @@ // Used by DurangoRenderTest.rc // -#define IDS_APP_TITLE 103 +#define IDS_APP_TITLE 103 -#define IDR_MAINFRAME 128 -#define IDD_DURANGORENDERTEST_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDI_MINECRAFTWINDOWS 107 -#define IDI_SMALL 108 -#define IDC_MINECRAFTWINDOWS 109 -#define IDC_MYICON 2 +#define IDR_MAINFRAME 128 +#define IDD_DURANGORENDERTEST_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_MINECRAFTWINDOWS 107 +#define IDI_SMALL 108 +#define IDC_MINECRAFTWINDOWS 109 +#define IDC_MYICON 2 #ifndef IDC_STATIC -#define IDC_STATIC -1 +#define IDC_STATIC -1 #endif // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 130 -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 #endif #endif diff --git a/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h b/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h index 0f5732165..eaedf23ca 100644 --- a/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h +++ b/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h @@ -68,8 +68,8 @@ private: void* userCallbackData); static void GetDataCompletedCallback(int32_t taskResult, void* userCallbackData); -};#pragma once - +}; +#pragma once // 4J Stu - This file defines the id's for the dynamic configurations that we // are currently using as well as the format of the data in them @@ -84,7 +84,7 @@ private: #define DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME \ 2400 // 40 mins 1200 // 20 mins //300; // 5 minutes -class MinecraftDynamicConfigurations { + class MinecraftDynamicConfigurations { private: enum EDynamic_Configs { eDynamic_Config_Trial, diff --git a/Minecraft.Client/Platform/Windows64/Sentient/SentientManager.h b/Minecraft.Client/Platform/Windows64/Sentient/SentientManager.h index 065b2a995..8101745af 100644 --- a/Minecraft.Client/Platform/Windows64/Sentient/SentientManager.h +++ b/Minecraft.Client/Platform/Windows64/Sentient/SentientManager.h @@ -33,16 +33,20 @@ public: ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, uint32_t numberOfOnlinePlayers); - bool RecordLevelExit(uint32_t dwUserId, ESen_LevelExitStatus levelExitStatus); - bool RecordLevelSaveOrCheckpoint(uint32_t dwUserId, int32_t saveOrCheckPointID, + bool RecordLevelExit(uint32_t dwUserId, + ESen_LevelExitStatus levelExitStatus); + bool RecordLevelSaveOrCheckpoint(uint32_t dwUserId, + int32_t saveOrCheckPointID, int32_t saveSizeInBytes); bool RecordLevelResume(uint32_t dwUserId, ESen_FriendOrMatch friendsOrMatch, ESen_CompeteOrCoop competeOrCoop, int difficulty, uint32_t numberOfLocalPlayers, - uint32_t numberOfOnlinePlayers, int32_t saveOrCheckPointID); + uint32_t numberOfOnlinePlayers, + int32_t saveOrCheckPointID); bool RecordPauseOrInactive(uint32_t dwUserId); bool RecordUnpauseOrActive(uint32_t dwUserId); - bool RecordMenuShown(uint32_t dwUserId, int32_t menuID, int32_t optionalMenuSubID); + bool RecordMenuShown(uint32_t dwUserId, int32_t menuID, + int32_t optionalMenuSubID); bool RecordAchievementUnlocked(uint32_t dwUserId, int32_t achievementID, int32_t achievementGamerscore); bool RecordMediaShareUpload(uint32_t dwUserId, @@ -54,12 +58,14 @@ public: int32_t marketplaceOfferID, ESen_UpsellOutcome upsellOutcome); bool RecordPlayerDiedOrFailed(uint32_t dwUserId, int32_t lowResMapX, - int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, - int32_t playerWeaponID, int32_t enemyWeaponID, + int32_t lowResMapY, int32_t lowResMapZ, + int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID); bool RecordEnemyKilledOrOvercome(uint32_t dwUserId, int32_t lowResMapX, - int32_t lowResMapY, int32_t lowResMapZ, int32_t mapID, - int32_t playerWeaponID, int32_t enemyWeaponID, + int32_t lowResMapY, int32_t lowResMapZ, + int32_t mapID, int32_t playerWeaponID, + int32_t enemyWeaponID, ETelemetryChallenges enemyTypeID); bool RecordSkinChanged(uint32_t dwUserId, uint32_t dwSkinId); diff --git a/Minecraft.Client/Platform/Windows64/Sentient/SentientStats.h b/Minecraft.Client/Platform/Windows64/Sentient/SentientStats.h index d82d13978..6f7321bab 100644 --- a/Minecraft.Client/Platform/Windows64/Sentient/SentientStats.h +++ b/Minecraft.Client/Platform/Windows64/Sentient/SentientStats.h @@ -12,77 +12,173 @@ // PlayerSessionStart // Player signed in or joined -bool SenStatPlayerSessionStart ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t TitleBuildID, int32_t SkeletonDistanceInInches, int32_t EnrollmentType, int32_t NumberOfSkeletonsInView ); +bool SenStatPlayerSessionStart(uint32_t dwUserID, + int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, + int32_t OptionalSubLevelID, int32_t TitleBuildID, + int32_t SkeletonDistanceInInches, + int32_t EnrollmentType, + int32_t NumberOfSkeletonsInView); // PlayerSessionExit // Player signed out or left -bool SenStatPlayerSessionExit ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID ); +bool SenStatPlayerSessionExit(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID); // HeartBeat // Sent every 60 seconds by title -bool SenStatHeartBeat ( uint32_t dwUserID, int32_t SecondsSinceInitialize ); +bool SenStatHeartBeat(uint32_t dwUserID, int32_t SecondsSinceInitialize); // LevelStart // Level started -bool SenStatLevelStart ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, int32_t CompeteOrCoop, int32_t DifficultyLevel, int32_t NumberOfLocalPlayers, int32_t NumberOfOnlinePlayers, int32_t License, int32_t DefaultGameControls, int32_t AudioSettings, int32_t SkeletonDistanceInInches, int32_t NumberOfSkeletonsInView ); +bool SenStatLevelStart(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, + int32_t CompeteOrCoop, int32_t DifficultyLevel, + int32_t NumberOfLocalPlayers, + int32_t NumberOfOnlinePlayers, int32_t License, + int32_t DefaultGameControls, int32_t AudioSettings, + int32_t SkeletonDistanceInInches, + int32_t NumberOfSkeletonsInView); // LevelExit // Level exited -bool SenStatLevelExit ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LevelExitStatus, int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, int32_t LevelDurationInSeconds ); +bool SenStatLevelExit(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t LevelExitStatus, int32_t LevelExitProgressStat1, + int32_t LevelExitProgressStat2, + int32_t LevelDurationInSeconds); // LevelSaveOrCheckpoint // Level saved explicitly or implicitly -bool SenStatLevelSaveOrCheckpoint ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, int32_t LevelDurationInSeconds, int32_t SaveOrCheckPointID ); +bool SenStatLevelSaveOrCheckpoint( + uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t LevelExitProgressStat1, int32_t LevelExitProgressStat2, + int32_t LevelDurationInSeconds, int32_t SaveOrCheckPointID); // LevelResume // Level resumed from a save or restarted at a checkpoint -bool SenStatLevelResume ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, int32_t CompeteOrCoop, int32_t DifficultyLevel, int32_t NumberOfLocalPlayers, int32_t NumberOfOnlinePlayers, int32_t License, int32_t DefaultGameControls, int32_t SaveOrCheckPointID, int32_t AudioSettings, int32_t SkeletonDistanceInInches, int32_t NumberOfSkeletonsInView ); +bool SenStatLevelResume(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SingleOrMultiplayer, int32_t FriendsOrMatch, + int32_t CompeteOrCoop, int32_t DifficultyLevel, + int32_t NumberOfLocalPlayers, + int32_t NumberOfOnlinePlayers, int32_t License, + int32_t DefaultGameControls, int32_t SaveOrCheckPointID, + int32_t AudioSettings, int32_t SkeletonDistanceInInches, + int32_t NumberOfSkeletonsInView); // PauseOrInactive -// Player paused game or has become inactive, level and mode are for what the player is leaving -bool SenStatPauseOrInactive ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// Player paused game or has become inactive, level and mode are for what the +// player is leaving +bool SenStatPauseOrInactive(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // UnpauseOrActive -// Player unpaused game or has become active, level and mode are for what the player is entering into -bool SenStatUnpauseOrActive ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// Player unpaused game or has become active, level and mode are for what the +// player is entering into +bool SenStatUnpauseOrActive(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // MenuShown // A menu screen or major menu area has been shown -bool SenStatMenuShown ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t MenuID, int32_t OptionalMenuSubID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +bool SenStatMenuShown(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t MenuID, int32_t OptionalMenuSubID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID); // AchievementUnlocked // An achievement was unlocked -bool SenStatAchievementUnlocked ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t AchievementID, int32_t AchievementGamerscore ); +bool SenStatAchievementUnlocked( + uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, + int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t AchievementID, int32_t AchievementGamerscore); // MediaShareUpload // The user uploaded something to Kinect Share -bool SenStatMediaShareUpload ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t MediaDestination, int32_t MediaType ); +bool SenStatMediaShareUpload(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, + int32_t MediaDestination, int32_t MediaType); // UpsellPresented // The user is shown an upsell to purchase something -bool SenStatUpsellPresented ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t UpsellID, int32_t MarketplaceOfferID ); +bool SenStatUpsellPresented(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t UpsellID, + int32_t MarketplaceOfferID); // UpsellResponded // The user responded to the upsell -bool SenStatUpsellResponded ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t UpsellID, int32_t MarketplaceOfferID, int32_t UpsellOutcome ); +bool SenStatUpsellResponded(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t UpsellID, + int32_t MarketplaceOfferID, int32_t UpsellOutcome); // PlayerDiedOrFailed // The player died or failed a challenge - can be used for many types of failure -bool SenStatPlayerDiedOrFailed ( uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, int32_t CopyOfSecondsSinceInitialize ); +bool SenStatPlayerDiedOrFailed( + uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, + int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, + int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, + int32_t CopyOfSecondsSinceInitialize); // EnemyKilledOrOvercome // The player killed an enemy or overcame or solved a major challenge -bool SenStatEnemyKilledOrOvercome ( uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, int32_t CopyOfSecondsSinceInitialize ); +bool SenStatEnemyKilledOrOvercome( + uint32_t dwUserID, int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID, int32_t LowResMapX, int32_t LowResMapY, + int32_t LowResMapZ, int32_t MapID, int32_t PlayerWeaponID, + int32_t EnemyWeaponID, int32_t EnemyTypeID, int32_t SecondsSinceInitialize, + int32_t CopyOfSecondsSinceInitialize); // SkinChanged -// The player has changed their skin, level and mode are for what the player is currently in -bool SenStatSkinChanged ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID, int32_t SkinID ); +// The player has changed their skin, level and mode are for what the player is +// currently in +bool SenStatSkinChanged(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID, + int32_t SkinID); // BanLevel -// The player has banned a level, level and mode are for what the player is currently in and banning -bool SenStatBanLevel ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); +// The player has banned a level, level and mode are for what the player is +// currently in and banning +bool SenStatBanLevel(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, + int32_t OptionalSubLevelID, int32_t LevelInstanceID, + int32_t MultiplayerInstanceID); // UnBanLevel -// The player has ubbanned a level, level and mode are for what the player is currently in and unbanning -bool SenStatUnBanLevel ( uint32_t dwUserID, int32_t SecondsSinceInitialize, int32_t ModeID, int32_t OptionalSubModeID, int32_t LevelID, int32_t OptionalSubLevelID, int32_t LevelInstanceID, int32_t MultiplayerInstanceID ); - +// The player has ubbanned a level, level and mode are for what the player is +// currently in and unbanning +bool SenStatUnBanLevel(uint32_t dwUserID, int32_t SecondsSinceInitialize, + int32_t ModeID, int32_t OptionalSubModeID, + int32_t LevelID, int32_t OptionalSubLevelID, + int32_t LevelInstanceID, int32_t MultiplayerInstanceID); diff --git a/Minecraft.Client/Platform/Windows64/Social/SocialManager.h b/Minecraft.Client/Platform/Windows64/Social/SocialManager.h index 72051c74d..de278e62f 100644 --- a/Minecraft.Client/Platform/Windows64/Social/SocialManager.h +++ b/Minecraft.Client/Platform/Windows64/Social/SocialManager.h @@ -11,122 +11,124 @@ #include #endif -#define MAX_SOCIALPOST_CAPTION 60 -#define MAX_SOCIALPOST_DESC 100 +#define MAX_SOCIALPOST_CAPTION 60 +#define MAX_SOCIALPOST_DESC 100 // XDK only provides for facebook so far. Others may follow!? -enum ESocialNetwork -{ - eFacebook = 0, - eNumSocialNetworks -}; - +enum ESocialNetwork { eFacebook = 0, eNumSocialNetworks }; // Class follows singleton design pattern. -class CSocialManager -{ +class CSocialManager { private: - // Default constructor, copy constructor and assignment operator are all private. - CSocialManager(); - CSocialManager( const CSocialManager& ); - CSocialManager& operator= ( const CSocialManager& ); + // Default constructor, copy constructor and assignment operator are all + // private. + CSocialManager(); + CSocialManager(const CSocialManager&); + CSocialManager& operator=(const CSocialManager&); - // Static private instance. - static CSocialManager* m_pInstance; + // Static private instance. + static CSocialManager* m_pInstance; - // Bitset of title posting capability flags ( XSOCIAL_CAPABILITY_POSTIMAGE, XSOCIAL_CAPABILITY_POSTLINK ). - uint32_t m_dwSocialPostingCapability; + // Bitset of title posting capability flags ( XSOCIAL_CAPABILITY_POSTIMAGE, + // XSOCIAL_CAPABILITY_POSTLINK ). + uint32_t m_dwSocialPostingCapability; - // Index of user who made current active request. - uint32_t m_dwCurrRequestUser; + // Index of user who made current active request. + uint32_t m_dwCurrRequestUser; - // WESTY : Not sure if we even need to get social access key! -/* - // Size of the social network access key text buffer. - uint32_t m_dwAccessKeyTextSize; + // WESTY : Not sure if we even need to get social access key! + /* + // Size of the social network access key text buffer. + uint32_t m_dwAccessKeyTextSize; - // Pointer to the social network access key text buffer. - wchar_t* m_pAccessKeyText; - */ + // Pointer to the social network access key text buffer. + wchar_t* m_pAccessKeyText; + */ - // The various states of the manager. - enum EState - { - eStateUnitialised = 0, - eStateReady, - eStateGetPostingCapability, - eStatePostingImage, - eStatePostingLink, - }; + // The various states of the manager. + enum EState { + eStateUnitialised = 0, + eStateReady, + eStateGetPostingCapability, + eStatePostingImage, + eStatePostingLink, + }; - - // Current state that manager is in. - EState m_eCurrState; + // Current state that manager is in. + EState m_eCurrState; - // For xsocial asyncronous operations. - XOVERLAPPED m_Overlapped; - uint32_t m_dwOverlappedResultCode; + // For xsocial asyncronous operations. + XOVERLAPPED m_Overlapped; + uint32_t m_dwOverlappedResultCode; - // Social post preview image struct. - XSOCIAL_PREVIEWIMAGE m_PostPreviewImage; + // Social post preview image struct. + XSOCIAL_PREVIEWIMAGE m_PostPreviewImage; + // Image details for posting an image to social network. + unsigned char* m_pMainImageBuffer; + uint32_t m_dwMainImageBufferSize; - // Image details for posting an image to social network. - unsigned char* m_pMainImageBuffer; - uint32_t m_dwMainImageBufferSize; + void DestroyMainPostImage(); + void DestroyPreviewPostImage(); - void DestroyMainPostImage(); - void DestroyPreviewPostImage(); - - // WESTY : Not sure if we even need to get social access key! -/* - bool GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect, uint32_t dwUserTrackingIndex, bool bShowNetworkSignin ); -*/ + // WESTY : Not sure if we even need to get social access key! + /* + bool GetSocialNetworkAccessKey( ESocialNetwork + eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect, uint32_t + dwUserTrackingIndex, bool bShowNetworkSignin ); + */ public: - // Retrieve singleton instance. - static CSocialManager* Instance(); + // Retrieve singleton instance. + static CSocialManager* Instance(); - // To be called once during game init. - void Initialise(); + // To be called once during game init. + void Initialise(); - // Tick the social manager. Only does anything in async mode, polls for results of async actions. - void Tick(); + // Tick the social manager. Only does anything in async mode, polls for + // results of async actions. + void Tick(); - // May need to be called if something changes (i.e. player signs in to live ). - bool RefreshPostingCapability(); + // May need to be called if something changes (i.e. player signs in to live + // ). + bool RefreshPostingCapability(); - // Returns true if any social newtork posting is allowed by us, false if not (if false, game must not display any social network UI). - bool IsTitleAllowedToPostAnything(); + // Returns true if any social newtork posting is allowed by us, false if not + // (if false, game must not display any social network UI). + bool IsTitleAllowedToPostAnything(); - // Returns true if we are allowed to post images to social networks. - bool IsTitleAllowedToPostImages(); + // Returns true if we are allowed to post images to social networks. + bool IsTitleAllowedToPostImages(); - // Returns true if we are allowed to post links to social networks. - bool IsTitleAllowedToPostLinks(); + // Returns true if we are allowed to post links to social networks. + bool IsTitleAllowedToPostLinks(); - // Returns false if any of the live signed in users have disabled XPRIVILEGE_SOCIAL_NETWORK_SHARING - bool AreAllUsersAllowedToPostImages(); + // Returns false if any of the live signed in users have disabled + // XPRIVILEGE_SOCIAL_NETWORK_SHARING + bool AreAllUsersAllowedToPostImages(); - // Post a test link to social network. - bool PostLinkToSocialNetwork( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ); + // Post a test link to social network. + bool PostLinkToSocialNetwork(ESocialNetwork eSocialNetwork, + uint32_t dwUserIndex, bool bUsingKinect); - // Post a test image to social network. - bool PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ); + // Post a test image to social network. + bool PostImageToSocialNetwork(ESocialNetwork eSocialNetwork, + uint32_t dwUserIndex, bool bUsingKinect); - void SetSocialPostText(const wchar_t* Title, const wchar_t* Caption, const wchar_t* Desc); + void SetSocialPostText(const wchar_t* Title, const wchar_t* Caption, + const wchar_t* Desc); - // WESTY : Not sure if we even need to get social access key! -/* - // We do not currently know what this is used for. We may not even need it? - bool ObtainSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ); - */ + // WESTY : Not sure if we even need to get social access key! + /* + // We do not currently know what this is used for. We may not even + need it? bool ObtainSocialNetworkAccessKey( ESocialNetwork + eSocialNetwork, uint32_t dwUserIndex, bool bUsingKinect ); + */ private: - wchar_t m_wchTitleA[MAX_SOCIALPOST_CAPTION+1]; - wchar_t m_wchCaptionA[MAX_SOCIALPOST_CAPTION+1]; - wchar_t m_wchDescA[MAX_SOCIALPOST_DESC+1]; - + wchar_t m_wchTitleA[MAX_SOCIALPOST_CAPTION + 1]; + wchar_t m_wchCaptionA[MAX_SOCIALPOST_CAPTION + 1]; + wchar_t m_wchDescA[MAX_SOCIALPOST_DESC + 1]; }; #endif diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index 13b493dfe..14a263414 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -13,124 +13,115 @@ CConsoleMinecraftApp app; -#define CONTEXT_GAME_STATE 0 +#define CONTEXT_GAME_STATE 0 -CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() -{ +CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() {} + +void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) { + ProfileManager.SetRichPresenceContextValue(iPad, CONTEXT_GAME_STATE, + contextId); } -void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) -{ - ProfileManager.SetRichPresenceContextValue(iPad,CONTEXT_GAME_STATE,contextId); +void CConsoleMinecraftApp::StoreLaunchData() {} +void CConsoleMinecraftApp::ExitGame() {} +void CConsoleMinecraftApp::FatalLoadError() {} + +void CConsoleMinecraftApp::CaptureSaveThumbnail() {} +void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t** thumbnailData, + unsigned int* thumbnailSize) {} +void CConsoleMinecraftApp::ReleaseSaveThumbnail() {} + +void CConsoleMinecraftApp::GetScreenshot(int iPad, + std::uint8_t** screenshotData, + unsigned int* screenshotSize) {} + +void CConsoleMinecraftApp::TemporaryCreateGameStart() { + ////////////////////////////////////////////////////////////////////////////////////////////// + ///From CScene_Main::OnInit + + app.setLevelGenerationOptions(nullptr); + + // From CScene_Main::RunPlayGame + Minecraft* pMinecraft = Minecraft::GetInstance(); + app.ReleaseSaveThumbnail(); + ProfileManager.SetLockedProfile(0); + pMinecraft->user->name = L"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::wstring wWorldName = L"TestWorld"; + + StorageManager.ResetSaveData(); + StorageManager.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(); } -void CConsoleMinecraftApp::StoreLaunchData() -{ -} -void CConsoleMinecraftApp::ExitGame() -{ -} -void CConsoleMinecraftApp::FatalLoadError() -{ +int CConsoleMinecraftApp::GetLocalTMSFileIndex(wchar_t* wchTMSFile, + bool bFilenameIncludesExtension, + eFileExtensionType eEXT) { + return -1; } -void CConsoleMinecraftApp::CaptureSaveThumbnail() -{ -} -void CConsoleMinecraftApp::GetSaveThumbnail(std::uint8_t **thumbnailData, unsigned int *thumbnailSize) -{ -} -void CConsoleMinecraftApp::ReleaseSaveThumbnail() -{ +int CConsoleMinecraftApp::LoadLocalTMSFile(wchar_t* wchTMSFile) { return -1; } + +int CConsoleMinecraftApp::LoadLocalTMSFile(wchar_t* wchTMSFile, + eFileExtensionType eExt) { + return -1; } -void CConsoleMinecraftApp::GetScreenshot(int iPad, std::uint8_t **screenshotData, unsigned int *screenshotSize) -{ -} - -void CConsoleMinecraftApp::TemporaryCreateGameStart() -{ - ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - - app.setLevelGenerationOptions(nullptr); - - // From CScene_Main::RunPlayGame - Minecraft *pMinecraft=Minecraft::GetInstance(); - app.ReleaseSaveThumbnail(); - ProfileManager.SetLockedProfile(0); - pMinecraft->user->name = L"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::wstring wWorldName = L"TestWorld"; - - StorageManager.ResetSaveData(); - StorageManager.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(); -} - -int CConsoleMinecraftApp::GetLocalTMSFileIndex(wchar_t *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT) -{ - return -1; -} - -int CConsoleMinecraftApp::LoadLocalTMSFile(wchar_t *wchTMSFile) -{ - return -1; -} - -int CConsoleMinecraftApp::LoadLocalTMSFile(wchar_t *wchTMSFile, eFileExtensionType eExt) -{ - return -1; -} - -void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) -{ -} +void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) {} diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.h b/Minecraft.Client/Platform/Windows64/Windows64_App.h index a292f9589..c48c35499 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.h +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.h @@ -1,34 +1,38 @@ #pragma once -class CConsoleMinecraftApp : public CMinecraftApp -{ +class CConsoleMinecraftApp : public CMinecraftApp { public: - CConsoleMinecraftApp(); + CConsoleMinecraftApp(); - virtual void SetRichPresenceContext(int iPad, int contextId); + virtual void SetRichPresenceContext(int iPad, int contextId); - virtual void StoreLaunchData(); - virtual void ExitGame(); - virtual void FatalLoadError(); + 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 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(wchar_t *wchTMSFile); - virtual int LoadLocalTMSFile(wchar_t *wchTMSFile, eFileExtensionType eExt); + virtual int LoadLocalTMSFile(wchar_t* wchTMSFile); + virtual int LoadLocalTMSFile(wchar_t* wchTMSFile, eFileExtensionType eExt); - virtual void FreeLocalTMSFiles(eTMSFileType eType); - virtual int GetLocalTMSFileIndex(wchar_t *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT=eFileExtensionType_PNG); + virtual void FreeLocalTMSFiles(eTMSFileType eType); + virtual int GetLocalTMSFileIndex( + wchar_t* wchTMSFile, bool bFilenameIncludesExtension, + eFileExtensionType eEXT = eFileExtensionType_PNG); - // BANNED LEVEL LIST - virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} + // BANNED LEVEL LIST + virtual void ReadBannedList(int iPad, eTMSAction action = (eTMSAction)0, + bool bCallback = false) {} - C4JStringTable *GetStringTable() { return nullptr;} + C4JStringTable* GetStringTable() { return nullptr; } - // original code - virtual void TemporaryCreateGameStart(); + // original code + virtual void TemporaryCreateGameStart(); }; extern CConsoleMinecraftApp app; diff --git a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp index 1c90eca18..a01fb36ac 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp @@ -37,7 +37,8 @@ #include "../../../Minecraft.World/Level/Storage/OldChunkStorage.h" HINSTANCE hMyInst; -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, + LPARAM lParam); char chGlobalText[256]; uint16_t ui16GlobalText[256]; @@ -55,9 +56,7 @@ uint16_t ui16GlobalText[256]; // #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 -}; +uint32_t dwProfileSettingsA[NUM_PROFILE_VALUES] = {0, 0, 0, 0, 0}; //------------------------------------------------------------------------------------- // Time Since fAppTime is a float, we need to keep the quadword app @@ -520,7 +519,8 @@ void SeedEditBox() { } //--------------------------------------------------------------------------- -LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, LPARAM lParam) { +LRESULT CALLBACK DlgProc(HWND hWndDlg, uint32_t Msg, WPARAM wParam, + LPARAM lParam) { switch (Msg) { case WM_INITDIALOG: return true; @@ -618,8 +618,8 @@ int32_t InitDevice() { descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = - g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, + &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; @@ -714,7 +714,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, return 0; } - static bool bTrialTimerDisplayed = true; #if defined(MEMORY_TRACKING) @@ -894,7 +893,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Any threading type things to deal with from the xui side? app.HandleXuiActions(); - // 4J-PB - Update the trial timer display if we are in the trial version if (!ProfileManager.IsFullVersion()) { // display the trial timer diff --git a/Minecraft.Client/Platform/Windows64/Windows64_UIController.cpp b/Minecraft.Client/Platform/Windows64/Windows64_UIController.cpp index 87388425f..cd5a5c24b 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_UIController.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_UIController.cpp @@ -9,181 +9,176 @@ ConsoleUIController ui; -void ConsoleUIController::init(ID3D11Device *dev, ID3D11DeviceContext *ctx, ID3D11RenderTargetView* pRenderTargetView, ID3D11DepthStencilView* pDepthStencilView, S32 w, S32 h) -{ +void ConsoleUIController::init(ID3D11Device* dev, ID3D11DeviceContext* ctx, + ID3D11RenderTargetView* pRenderTargetView, + ID3D11DepthStencilView* pDepthStencilView, S32 w, + S32 h) { #ifdef _ENABLEIGGY - m_pRenderTargetView = pRenderTargetView; - m_pDepthStencilView = pDepthStencilView; + m_pRenderTargetView = pRenderTargetView; + m_pDepthStencilView = pDepthStencilView; - // Shared init - preInit(w,h); + // Shared init + preInit(w, h); - gdraw_funcs = gdraw_D3D11_CreateContext(dev, ctx, w, h); + gdraw_funcs = gdraw_D3D11_CreateContext(dev, ctx, w, h); - if(!gdraw_funcs) - { - app.DebugPrintf("Failed to initialise GDraw!\n"); + if (!gdraw_funcs) { + app.DebugPrintf("Failed to initialise GDraw!\n"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + __debugbreak(); #endif - app.FatalLoadError(); - } + 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 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.) + 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); + 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); + /* 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(); + /* 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(); + // Shared init + postInit(); #endif } -void ConsoleUIController::render() -{ +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. + /* 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 ); + 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(); + 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(); + /* 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) -{ - PIXBeginNamedEvent(0,"Starting Iggy custom draw\n"); +void ConsoleUIController::beginIggyCustomDraw4J( + IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) { + PIXBeginNamedEvent(0, "Starting Iggy custom draw\n"); - PIXBeginNamedEvent(0,"Gdraw setup"); - // 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); - PIXEndNamedEvent(); + PIXBeginNamedEvent(0, "Gdraw setup"); + // 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); + PIXEndNamedEvent(); } -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; +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; - PIXBeginNamedEvent(0,"Starting Iggy custom draw\n"); - // 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); + PIXBeginNamedEvent(0, "Starting Iggy custom draw\n"); + // 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); + setupCustomDrawGameStateAndMatrices(scene, customDrawRegion); - return 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; +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); + gdraw_D3D11_CalculateCustomDraw_4J(region, customDrawRegion->mat); - return customDrawRegion; + return customDrawRegion; } -void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion *region) -{ - endCustomDrawGameStateAndMatrices(); +void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion* region) { + endCustomDrawGameStateAndMatrices(); - gdraw_D3D11_EndCustomDraw(region); - PIXEndNamedEvent(); + gdraw_D3D11_EndCustomDraw(region); + PIXEndNamedEvent(); } -void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) -{ - gdraw_D3D11_SetTileOrigin( m_pRenderTargetView, - m_pDepthStencilView, - nullptr, - xPos, - yPos ); +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 = RenderManager.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; +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 = RenderManager.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::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() -{ +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(); + /* 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/Minecraft.Client/Platform/Windows64/Windows64_UIController.h b/Minecraft.Client/Platform/Windows64/Windows64_UIController.h index cab14ce8a..d574a4fa8 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_UIController.h +++ b/Minecraft.Client/Platform/Windows64/Windows64_UIController.h @@ -2,29 +2,35 @@ #include "../Common/UI/UIController.h" -class ConsoleUIController : public UIController -{ +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); + ID3D11RenderTargetView* m_pRenderTargetView; + ID3D11DepthStencilView* m_pDepthStencilView; - 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); +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); + virtual void setTileOrigin(S32 xPos, S32 yPos); public: - void shutdown(); + 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/Minecraft.Client/Platform/Windows64/XML/ATGXmlParser.h b/Minecraft.Client/Platform/Windows64/XML/ATGXmlParser.h index 21a9f91d0..ab5b6bd48 100644 --- a/Minecraft.Client/Platform/Windows64/XML/ATGXmlParser.h +++ b/Minecraft.Client/Platform/Windows64/XML/ATGXmlParser.h @@ -1,8 +1,11 @@ // 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. +// 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 @@ -17,139 +20,138 @@ #ifndef ATGXMLPARSER_H #define ATGXMLPARSER_H -namespace ATG -{ +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 ) +#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; -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 +// No tag can be longer than XML_WRITE_BUFFER_SIZE - an error will be returned +// if it is //------------------------------------------------------------------------------------- -struct XMLAttribute -{ - wchar_t* strName; - uint32_t NameLen; - wchar_t* strValue; - uint32_t ValueLen; +struct XMLAttribute { + wchar_t* strName; + uint32_t NameLen; + wchar_t* strValue; + uint32_t ValueLen; }; //------------------------------------------------------------------------------------- -class ISAXCallback -{ -friend class XMLParser; +class ISAXCallback { + friend class XMLParser; + public: ISAXCallback() {}; virtual ~ISAXCallback() {}; - virtual int32_t StartDocument() = 0; - virtual int32_t EndDocument() = 0; + virtual int32_t StartDocument() = 0; + virtual int32_t EndDocument() = 0; - virtual int32_t ElementBegin( const wchar_t* strName, uint32_t NameLen, - const XMLAttribute *pAttributes, uint32_t NumAttributes ) = 0; - virtual int32_t ElementContent( const wchar_t *strData, uint32_t DataLen, bool More ) = 0; - virtual int32_t ElementEnd( const wchar_t *strName, uint32_t NameLen ) = 0; + virtual int32_t ElementBegin(const wchar_t* strName, uint32_t NameLen, + const XMLAttribute* pAttributes, + uint32_t NumAttributes) = 0; + virtual int32_t ElementContent(const wchar_t* strData, uint32_t DataLen, + bool More) = 0; + virtual int32_t ElementEnd(const wchar_t* strName, uint32_t NameLen) = 0; - virtual int32_t CDATABegin( ) = 0; - virtual int32_t CDATAData( const wchar_t *strCDATA, uint32_t CDATALen, bool bMore ) = 0; - virtual int32_t CDATAEnd( ) = 0; + virtual int32_t CDATABegin() = 0; + virtual int32_t CDATAData(const wchar_t* strCDATA, uint32_t CDATALen, + bool bMore) = 0; + virtual int32_t CDATAEnd() = 0; - virtual void Error( int32_t hError, const char *strMessage ) = 0; + virtual void Error(int32_t hError, const char* strMessage) = 0; - virtual void SetParseProgress( uint32_t dwProgress ) { } + virtual void SetParseProgress(uint32_t dwProgress) {} - const char* GetFilename() { return m_strFilename; } - uint32_t GetLineNumber() { return m_LineNum; } - uint32_t GetLinePosition() { return m_LinePos; } + 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; + const char* m_strFilename; + uint32_t m_LineNum; + uint32_t m_LinePos; }; - //------------------------------------------------------------------------------------- -class XMLParser -{ -public: +class XMLParser { +public: XMLParser(); ~XMLParser(); - + // Register an interface inheiriting from ISAXCallback - void RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ); - + void RegisterSAXCallbackInterface(ISAXCallback* pISAXCallback); + // Get the registered interface - ISAXCallback* GetSAXCallbackInterface(); + ISAXCallback* GetSAXCallbackInterface(); // ParseXMLFile returns one of the following: - // E_COULD_NOT_OPEN_FILE - couldn't open the file + // 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 + // S_OK - file parsed and completed - int32_t ParseXMLFile( const char *strFilename ); - - // Parses from a buffer- if you pass a wchar_t buffer (and cast it), it will - // correctly detect it and use unicode instead. Return codes are the - // same as for ParseXMLFile + int32_t ParseXMLFile(const char* strFilename); - int32_t ParseXMLBuffer( const char* strBuffer, uint32_t uBufferSize ); + // Parses from a buffer- if you pass a wchar_t buffer (and cast it), it + // will + // correctly detect it and use unicode instead. Return codes are + // the same as for ParseXMLFile -private: - int32_t MainParseLoop(); + int32_t ParseXMLBuffer(const char* strBuffer, uint32_t uBufferSize); - int32_t AdvanceCharacter( bool bOkToFail = false ); - void SkipNextAdvance(); +private: + int32_t MainParseLoop(); - int32_t ConsumeSpace(); - int32_t ConvertEscape(); - int32_t AdvanceElement(); - int32_t AdvanceName(); - int32_t AdvanceAttrVal(); - int32_t AdvanceCDATA(); - int32_t AdvanceComment(); + int32_t AdvanceCharacter(bool bOkToFail = false); + void SkipNextAdvance(); - 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, ... ); + 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, ... ); + void Error(int32_t hRet, const char* strFormat, ...); #endif - ISAXCallback* m_pISAXCallback; + ISAXCallback* m_pISAXCallback; - void* m_hFile; - const char* m_pInXMLBuffer; - uint32_t m_uInXMLBufferCharsLeft; - uint32_t m_dwCharsTotal; - uint32_t m_dwCharsConsumed; + 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 + wchar_t m_pWriteBuf[XML_WRITE_BUFFER_SIZE]; - uint8_t m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL - wchar_t m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; + uint8_t* m_pReadPtr; + wchar_t* m_pWritePtr; // write pointer within m_pBuf - uint8_t* m_pReadPtr; - wchar_t* 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_bUnicode; // true = 16-bits, false = 8-bits - bool m_bReverseBytes; // true = reverse bytes, false = don't reverse - - bool m_bSkipNextAdvance; - wchar_t m_Ch; // Current character being parsed + bool m_bSkipNextAdvance; + wchar_t m_Ch; // Current character being parsed }; } // namespace ATG diff --git a/Minecraft.Client/Platform/Windows64/Xbox_BuildVer.h b/Minecraft.Client/Platform/Windows64/Xbox_BuildVer.h index 1fc3e4c16..ed6c609a7 100644 --- a/Minecraft.Client/Platform/Windows64/Xbox_BuildVer.h +++ b/Minecraft.Client/Platform/Windows64/Xbox_BuildVer.h @@ -1,30 +1,33 @@ #pragma once +#define VER_PRODUCTMAJORVERSION 0 +#define VER_PRODUCTMINORVERSION 0 +#define VER_PRODUCTBUILD 170 +#define VER_PRODUCTBUILD_QFE 0 -#define VER_PRODUCTMAJORVERSION 0 -#define VER_PRODUCTMINORVERSION 0 -#define VER_PRODUCTBUILD 170 -#define VER_PRODUCTBUILD_QFE 0 +#define VER_FILEVERSION_STRING "1.1" +#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING +#define VER_FILEVERSION_STRING_W L"1.1" +#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W -#define VER_FILEVERSION_STRING "1.1" -#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING -#define VER_FILEVERSION_STRING_W L"1.1" -#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W - -#define VER_FILEBETA_STR "" +#define VER_FILEBETA_STR "" #undef VER_FILEVERSION -#define VER_FILEVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE -#define VER_PRODUCTVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE +#define VER_FILEVERSION \ + VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \ + VER_PRODUCTBUILD_QFE +#define VER_PRODUCTVERSION \ + VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, \ + VER_PRODUCTBUILD_QFE -#if (VER_PRODUCTBUILD < 10) -#define VER_FILEBPAD "000" +#if (VER_PRODUCTBUILD < 10) +#define VER_FILEBPAD "000" #define VER_FILEBPAD_W L"000" -#elif (VER_PRODUCTBUILD < 100) -#define VER_FILEBPAD "00" +#elif (VER_PRODUCTBUILD < 100) +#define VER_FILEBPAD "00" #define VER_FILEBPAD_W L"00" -#elif (VER_PRODUCTBUILD < 1000) -#define VER_FILEBPAD "0" +#elif (VER_PRODUCTBUILD < 1000) +#define VER_FILEBPAD "0" #define VER_FILEBPAD_W L"0" #else #define VER_FILEBPAD @@ -33,21 +36,25 @@ #define VER_WIDE_PREFIX(x) L##x -#define VER_FILEVERSION_STR2(x,y) VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y -#define VER_FILEVERSION_STR2_W(x,y) VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) L"." 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) +#define VER_FILEVERSION_STR2(x, y) \ + VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y +#define VER_FILEVERSION_STR2_W(x, y) \ + VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX( \ + #x) L"." 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) #undef VER_FILEVERSION_STR -#define VER_FILEVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_FILEVERSION_STR \ + VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_PRODUCTVERSION_STR \ + VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_FILEVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#define VER_PRODUCTVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_FILEVERSION_STR_W \ + VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) +#define VER_PRODUCTVERSION_STR_W \ + VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE) -#if (VER_PRODUCTBUILD_QFE >= 256) -#error "QFE number cannot exceed 255" +#if (VER_PRODUCTBUILD_QFE >= 256) +#error "QFE number cannot exceed 255" #endif - - - diff --git a/Minecraft.Client/Platform/extraX64client.h b/Minecraft.Client/Platform/extraX64client.h index d4b341620..88b5abb87 100644 --- a/Minecraft.Client/Platform/extraX64client.h +++ b/Minecraft.Client/Platform/extraX64client.h @@ -1,102 +1,87 @@ #pragma once +typedef enum _XBACKGROUND_DOWNLOAD_MODE { + XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW = 1, + XBACKGROUND_DOWNLOAD_MODE_AUTO = 2 +} XBACKGROUND_DOWNLOAD_MODE, + *PXBACKGROUND_DOWNLOAD_MODE; -typedef enum _XBACKGROUND_DOWNLOAD_MODE -{ - XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW = 1, - XBACKGROUND_DOWNLOAD_MODE_AUTO = 2 -} XBACKGROUND_DOWNLOAD_MODE, *PXBACKGROUND_DOWNLOAD_MODE; - -uint32_t XBackgroundDownloadSetMode( - XBACKGROUND_DOWNLOAD_MODE Mode -); +uint32_t XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode); #define XONLINE_S_LOGON_CONNECTION_ESTABLISHED 0 #define XPARTY_E_NOT_IN_PARTY 0 #define XPARTY_MAX_USERS 4 typedef struct _XPARTY_USER_INFO { - PlayerUID Xuid; - char GamerTag[XUSER_NAME_SIZE]; - uint32_t dwUserIndex; - // XONLINE_NAT_TYPE NatType; - uint32_t dwTitleId; - uint32_t dwFlags; -// XSESSION_INFO SessionInfo; -// XPARTY_CUSTOM_DATA CustomData; + PlayerUID Xuid; + char GamerTag[XUSER_NAME_SIZE]; + uint32_t dwUserIndex; + // XONLINE_NAT_TYPE NatType; + uint32_t dwTitleId; + uint32_t dwFlags; + // XSESSION_INFO SessionInfo; + // XPARTY_CUSTOM_DATA CustomData; } XPARTY_USER_INFO; typedef struct _XPARTY_USER_LIST { - uint32_t dwUserCount; - XPARTY_USER_INFO Users[XPARTY_MAX_USERS]; + uint32_t dwUserCount; + XPARTY_USER_INFO Users[XPARTY_MAX_USERS]; } XPARTY_USER_LIST; - uint32_t XShowPartyUI(uint32_t dwUserIndex); uint32_t XShowFriendsUI(uint32_t dwUserIndex); -int32_t XPartyGetUserList(XPARTY_USER_LIST *pUserList); +int32_t XPartyGetUserList(XPARTY_USER_LIST* pUserList); -uint32_t XContentGetThumbnail(uint32_t dwUserIndex, const XCONTENT_DATA *pContentData, uint8_t* pbThumbnail, uint32_t* pcbThumbnail, PXOVERLAPPED *pOverlapped); +uint32_t XContentGetThumbnail(uint32_t dwUserIndex, + const XCONTENT_DATA* pContentData, + uint8_t* pbThumbnail, uint32_t* pcbThumbnail, + PXOVERLAPPED* pOverlapped); void XShowAchievementsUI(int i); -uint32_t XUserAreUsersFriends( - uint32_t dwUserIndex, - PPlayerUID pXuids, - uint32_t dwXuidCount, - bool* pfResult, - void *pOverlapped); +uint32_t XUserAreUsersFriends(uint32_t dwUserIndex, PPlayerUID pXuids, + uint32_t dwXuidCount, bool* pfResult, + void* pOverlapped); -class XSOCIAL_IMAGEPOSTPARAMS -{ -}; +class XSOCIAL_IMAGEPOSTPARAMS {}; -class XSOCIAL_LINKPOSTPARAMS -{ -}; +class XSOCIAL_LINKPOSTPARAMS {}; -typedef struct _XSESSION_VIEW_PROPERTIES -{ - uint32_t dwViewId; - uint32_t dwNumProperties; - XUSER_PROPERTY *pProperties; +typedef struct _XSESSION_VIEW_PROPERTIES { + uint32_t dwViewId; + uint32_t dwNumProperties; + XUSER_PROPERTY* pProperties; } XSESSION_VIEW_PROPERTIES; #define XUSER_STATS_ATTRS_IN_SPEC 1 -typedef struct _XUSER_STATS_SPEC -{ - uint32_t dwViewId; - uint32_t dwNumColumnIds; - uint16_t rgwColumnIds[XUSER_STATS_ATTRS_IN_SPEC]; +typedef struct _XUSER_STATS_SPEC { + uint32_t dwViewId; + uint32_t dwNumColumnIds; + uint16_t rgwColumnIds[XUSER_STATS_ATTRS_IN_SPEC]; } XUSER_STATS_SPEC, *PXUSER_STATS_SPEC; typedef struct _XUSER_STATS_COLUMN { - uint16_t wColumnId; - XUSER_DATA Value; + uint16_t wColumnId; + XUSER_DATA Value; } XUSER_STATS_COLUMN, *PXUSER_STATS_COLUMN; - typedef struct _XUSER_STATS_ROW { - PlayerUID xuid; - uint32_t dwRank; - int64_t i64Rating; - char szGamertag[XUSER_NAME_SIZE]; - uint32_t dwNumColumns; - PXUSER_STATS_COLUMN pColumns; + PlayerUID xuid; + uint32_t dwRank; + int64_t i64Rating; + char szGamertag[XUSER_NAME_SIZE]; + uint32_t dwNumColumns; + PXUSER_STATS_COLUMN pColumns; } XUSER_STATS_ROW, *PXUSER_STATS_ROW; - typedef struct _XUSER_STATS_VIEW { - uint32_t dwViewId; - uint32_t dwTotalViewRows; - uint32_t dwNumRows; - PXUSER_STATS_ROW pRows; + uint32_t dwViewId; + uint32_t dwTotalViewRows; + uint32_t dwNumRows; + PXUSER_STATS_ROW pRows; } XUSER_STATS_VIEW, *PXUSER_STATS_VIEW; - typedef struct _XUSER_STATS_READ_RESULTS { - uint32_t dwNumViews; - PXUSER_STATS_VIEW pViews; + uint32_t dwNumViews; + PXUSER_STATS_VIEW pViews; } XUSER_STATS_READ_RESULTS, *PXUSER_STATS_READ_RESULTS; - - diff --git a/Minecraft.Client/Platform/stdafx.h b/Minecraft.Client/Platform/stdafx.h index 85fbc0205..ab8d08080 100644 --- a/Minecraft.Client/Platform/stdafx.h +++ b/Minecraft.Client/Platform/stdafx.h @@ -36,7 +36,6 @@ using namespace DirectX; #define HRESULT_SUCCEEDED(hr) (((int32_t)(hr)) >= 0) #endif - #include "../../Minecraft.World/Platform/x64headers/extraX64.h" #include diff --git a/Minecraft.Client/Platform/stubs.cpp b/Minecraft.Client/Platform/stubs.cpp index a4ca18df7..ba7c2bd5c 100644 --- a/Minecraft.Client/Platform/stubs.cpp +++ b/Minecraft.Client/Platform/stubs.cpp @@ -14,102 +14,53 @@ void LinuxLogStubLightmapProbe() { #else -void glReadPixels(int,int, int, int, int, int, ByteBuffer *) -{ -} +void glReadPixels(int, int, int, int, int, int, ByteBuffer*) {} -void glClearDepth(double) -{ -} +void glClearDepth(double) {} -void glVertexPointer(int, int, int, int) -{ -} +void glVertexPointer(int, int, int, int) {} -void glVertexPointer(int, int, FloatBuffer *) -{ -} +void glVertexPointer(int, int, FloatBuffer*) {} -void glTexCoordPointer(int, int, int, int) -{ -} +void glTexCoordPointer(int, int, int, int) {} -void glTexCoordPointer(int, int, FloatBuffer *) -{ -} +void glTexCoordPointer(int, int, FloatBuffer*) {} -void glNormalPointer(int, int, int) -{ -} +void glNormalPointer(int, int, int) {} -void glNormalPointer(int, ByteBuffer *) -{ -} +void glNormalPointer(int, ByteBuffer*) {} -void glEnableClientState(int) -{ -} +void glEnableClientState(int) {} -void glDisableClientState(int) -{ -} +void glDisableClientState(int) {} -void glColorPointer(int, int, int, int) -{ -} +void glColorPointer(int, int, int, int) {} -void glColorPointer(int, bool, int, ByteBuffer *) -{ -} +void glColorPointer(int, bool, int, ByteBuffer*) {} -void glDrawArrays(int,int,int) -{ -} +void glDrawArrays(int, int, int) {} -void glNormal3f(float,float,float) -{ -} +void glNormal3f(float, float, float) {} -void glGenQueriesARB(IntBuffer *) -{ -} +void glGenQueriesARB(IntBuffer*) {} -void glBeginQueryARB(int,int) -{ -} +void glBeginQueryARB(int, int) {} -void glEndQueryARB(int) -{ -} +void glEndQueryARB(int) {} -void glGetQueryObjectuARB(int,int,IntBuffer *) -{ -} +void glGetQueryObjectuARB(int, int, IntBuffer*) {} -void glShadeModel(int) -{ -} +void glShadeModel(int) {} -void glColorMaterial(int,int) -{ -} +void glColorMaterial(int, int) {} -//1.8.2 -void glClientActiveTexture(int) -{ -} +// 1.8.2 +void glClientActiveTexture(int) {} -void glActiveTexture(int) -{ -} +void glActiveTexture(int) {} -void glFlush() -{ -} - -void glTexGeni(int,int,int) -{ -} +void glFlush() {} +void glTexGeni(int, int, int) {} #endif diff --git a/Minecraft.Client/Player/EntityTracker.cpp b/Minecraft.Client/Player/EntityTracker.cpp index 2d8c5e0dd..c64cb685a 100644 --- a/Minecraft.Client/Player/EntityTracker.cpp +++ b/Minecraft.Client/Player/EntityTracker.cpp @@ -171,7 +171,8 @@ void EntityTracker::tick() { if (sp->connection == nullptr) continue; INetworkPlayer* otherPlayer = sp->connection->getNetworkPlayer(); - if (otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer)) { + if (otherPlayer != nullptr && + thisPlayer->IsSameSystem(otherPlayer)) { addPlayer = true; break; } @@ -191,8 +192,7 @@ void EntityTracker::tick() { } // 4J Stu - We want to do this for dead players as they don't tick normally - for (auto it = level->players.begin(); it != level->players.end(); - ++it) { + for (auto it = level->players.begin(); it != level->players.end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); if (!player->isAlive()) { diff --git a/Minecraft.Client/Player/LocalPlayer.cpp b/Minecraft.Client/Player/LocalPlayer.cpp index 90cb94336..9c84f17c8 100644 --- a/Minecraft.Client/Player/LocalPlayer.cpp +++ b/Minecraft.Client/Player/LocalPlayer.cpp @@ -771,8 +771,9 @@ void LocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damageSource) { if (this->getHealth() <= 0) { int deathTime = (int)(level->getGameTime() % Level::TICKS_PER_DAY) / 1000; - int carriedId = - inventory->getSelected() == nullptr ? 0 : inventory->getSelected()->id; + int carriedId = inventory->getSelected() == nullptr + ? 0 + : inventory->getSelected()->id; TelemetryManager->RecordPlayerDiedOrFailed(GetXboxPad(), 0, y, 0, 0, carriedId, 0, damageSource); @@ -934,7 +935,6 @@ void LocalPlayer::awardStat(Stat* stat, byteArray param) { } } - #if defined(_EXTENDED_ACHIEVEMENTS) // AWARD : Porkchop, cook and eat a porkchop. @@ -1445,7 +1445,8 @@ bool LocalPlayer::handleMouseClick(int button) { // multiplayer game - we need to wake up, and we don't have the // inbedchatscreen with a button - if (button == 1 && (isSleeping() && level != nullptr && level->isClientSide)) { + if (button == 1 && + (isSleeping() && level != nullptr && level->isClientSide)) { if (lastClickState == lastClick_oldRepeat) return false; std::shared_ptr mplp = @@ -1551,9 +1552,11 @@ bool LocalPlayer::handleMouseClick(int button) { void LocalPlayer::updateRichPresence() { if ((m_iPad != -1) /* && !ui.GetMenuDisplayed(m_iPad)*/) { std::shared_ptr selectedItem = inventory->getSelected(); - if (selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { + if (selectedItem != nullptr && + selectedItem->id == Item::fishingRod_Id) { app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_FISHING); - } else if (selectedItem != nullptr && selectedItem->id == Item::map_Id) { + } else if (selectedItem != nullptr && + selectedItem->id == Item::map_Id) { app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_MAP); } else if ((riding != nullptr) && riding->instanceof(eTYPE_MINECART)) { app.SetRichPresenceContext(m_iPad, diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.cpp b/Minecraft.Client/Player/MultiPlayerGameMode.cpp index 99ba16e67..29a804452 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/Player/MultiPlayerGameMode.cpp @@ -320,8 +320,8 @@ bool MultiPlayerGameMode::useItemOn(std::shared_ptr player, } // 4J Stu - In Java we send the use packet before the above check for item - // being nullptr so the following never gets executed but the packet still gets - // sent (for opening chests etc) + // being nullptr so the following never gets executed but the packet still + // gets sent (for opening chests etc) if (item != nullptr) { if (!didSomething && player->isAllowedToUse(item)) { if (localPlayerMode->isCreative()) { diff --git a/Minecraft.Client/Player/MultiPlayerGameMode.h b/Minecraft.Client/Player/MultiPlayerGameMode.h index 1343cceb7..a43685cd9 100644 --- a/Minecraft.Client/Player/MultiPlayerGameMode.h +++ b/Minecraft.Client/Player/MultiPlayerGameMode.h @@ -48,7 +48,8 @@ public: 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); + bool bTestUseOnly = false, + bool* pbUsedItem = nullptr); virtual bool useItem(std::shared_ptr player, Level* level, std::shared_ptr item, bool bTestUseOnly = false); diff --git a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp index ca5d90dc9..4fc916c09 100644 --- a/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/Player/MultiPlayerLocalPlayer.cpp @@ -448,7 +448,6 @@ void MultiplayerLocalPlayer::StressTestMove(double* tempX, double* tempY, static float dx = cos(30.0); static float dz = sin(30.0); - float nx = x + (dx * 1.2); float nz = z + (dz * 1.2); float ny = y; diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index 3bb901dd4..419dd4384 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -331,8 +331,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // the spiral of chunks that that method creates, long before // transmission of them is complete. double dist = DBL_MAX; - for (auto it = chunksToSend.begin(); it != chunksToSend.end(); - it++) { + for (auto it = chunksToSend.begin(); it != chunksToSend.end(); it++) { ChunkPos chunk = *it; if (level->isChunkFinalised(chunk.x, chunk.z)) { double newDist = chunk.distanceToSqr(x, z); @@ -344,8 +343,8 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { } } - // if (nearest != nullptr) // 4J - removed as we don't have - // references here + // if (nearest != nullptr) // 4J - removed as we + // don't have references here if (nearestValid) { bool okToSend = false; @@ -572,8 +571,7 @@ void ServerPlayer::doTickB() { players.push_back( std::dynamic_pointer_cast(shared_from_this())); - for (auto it = objectives->begin(); it != objectives->end(); - ++it) { + for (auto it = objectives->begin(); it != objectives->end(); ++it) { Objective* objective = *it; getScoreboard() ->getPlayerScore(getAName(), objective) @@ -619,7 +617,8 @@ void ServerPlayer::die(DamageSource* source) { } std::shared_ptr killer = getKillCredit(); - if (killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore); + if (killer != nullptr) + killer->awardKillScore(shared_from_this(), deathScore); // awardStat(Stats::deaths, 1); } @@ -643,20 +642,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; } } @@ -807,8 +805,8 @@ void ServerPlayer::changeDimension(int i) { } if (thisPlayer != nullptr) { for (auto it = MinecraftServer::getInstance() - ->getPlayers() - ->players.begin(); + ->getPlayers() + ->players.begin(); it != MinecraftServer::getInstance()->getPlayers()->players.end(); ++it) { diff --git a/Minecraft.Client/Player/ServerPlayerGameMode.cpp b/Minecraft.Client/Player/ServerPlayerGameMode.cpp index f00ed0335..fce273b72 100644 --- a/Minecraft.Client/Player/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/Player/ServerPlayerGameMode.cpp @@ -310,8 +310,8 @@ bool ServerPlayerGameMode::useItem(std::shared_ptr player, Level* level, std::shared_ptr itemInstance = item->use(level, player); if (itemInstance != item || (itemInstance != nullptr && (itemInstance->count != oldCount || - itemInstance->getUseDuration() > 0 || - itemInstance->getAuxValue() != oldAux))) { + itemInstance->getUseDuration() > 0 || + itemInstance->getAuxValue() != oldAux))) { player->inventory->items[player->inventory->selected] = itemInstance; if (isCreative()) { itemInstance->count = oldCount; @@ -345,7 +345,8 @@ bool ServerPlayerGameMode::useItemOn(std::shared_ptr player, } else { if (Tile::tiles[t]->use(level, x, y, z, player, face, clickX, clickY, clickZ)) { - if (m_gameRules != nullptr) m_gameRules->onUseTile(t, x, y, z); + if (m_gameRules != nullptr) + m_gameRules->onUseTile(t, x, y, z); return true; } } diff --git a/Minecraft.Client/Player/TrackedEntity.cpp b/Minecraft.Client/Player/TrackedEntity.cpp index 7e6c54ae5..8e60db877 100644 --- a/Minecraft.Client/Player/TrackedEntity.cpp +++ b/Minecraft.Client/Player/TrackedEntity.cpp @@ -635,8 +635,8 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, std::dynamic_pointer_cast(e); std::vector* activeEffects = mob->getActiveEffects(); - for (auto it = activeEffects->begin(); - it != activeEffects->end(); ++it) { + for (auto it = activeEffects->begin(); it != activeEffects->end(); + ++it) { MobEffectInstance* effect = *it; sp->connection->send(std::shared_ptr( @@ -724,17 +724,17 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { } else if (e->instanceof(eTYPE_FISHINGHOOK)) { std::shared_ptr owner = std::dynamic_pointer_cast(e)->owner; - return std::shared_ptr( - new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, - owner != nullptr ? owner->entityId : e->entityId, - yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr(new AddEntityPacket( + e, AddEntityPacket::FISH_HOOK, + owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, + yp, zp)); } else if (e->instanceof(eTYPE_ARROW)) { std::shared_ptr owner = (std::dynamic_pointer_cast(e))->owner; - return std::shared_ptr( - new AddEntityPacket(e, AddEntityPacket::ARROW, - owner != nullptr ? owner->entityId : e->entityId, - yRotp, xRotp, xp, yp, zp)); + return std::shared_ptr(new AddEntityPacket( + e, AddEntityPacket::ARROW, + owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, + yp, zp)); } else if (e->instanceof(eTYPE_SNOWBALL)) { return std::shared_ptr(new AddEntityPacket( e, AddEntityPacket::SNOWBALL, yRotp, xRotp, xp, yp, zp)); diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 1743b524b..8da2d0e57 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -10,7 +10,6 @@ #include "../Utils/FrameProfiler.h" #include - int Chunk::updates = 0; #if defined(_LARGE_WORLDS) @@ -38,7 +37,8 @@ void Chunk::reconcileRenderableTileEntities( std::unordered_set currentRenderableTileEntitySet; currentRenderableTileEntitySet.reserve(renderableTileEntities.size()); for (size_t i = 0; i < renderableTileEntities.size(); i++) { - currentRenderableTileEntitySet.insert(renderableTileEntities[i].get()); + currentRenderableTileEntitySet.insert( + renderableTileEntities[i].get()); } if (it != globalRenderableTileEntities->end()) { @@ -63,7 +63,8 @@ void Chunk::reconcileRenderableTileEntities( for (size_t i = 0; i < renderableTileEntities.size(); i++) { renderableTileEntities[i]->setRenderRemoveStage( TileEntity::e_RenderRemoveStageKeep); - if (existingBucket.indexByTile.find(renderableTileEntities[i].get()) == + if (existingBucket.indexByTile.find( + renderableTileEntities[i].get()) == existingBucket.indexByTile.end()) { levelRenderer->addRenderableTileEntity_Locked( key, renderableTileEntities[i]); @@ -78,13 +79,12 @@ void Chunk::reconcileRenderableTileEntities( } } } else if (it != globalRenderableTileEntities->end()) { - for (auto it2 = it->second.tiles.begin(); - it2 != it->second.tiles.end(); + for (auto it2 = it->second.tiles.begin(); it2 != it->second.tiles.end(); it2++) { (*it2)->setRenderRemoveStage( TileEntity::e_RenderRemoveStageFlaggedAtChunk); - levelRenderer->queueRenderableTileEntityForRemoval_Locked(key, - (*it2).get()); + levelRenderer->queueRenderableTileEntityForRemoval_Locked( + key, (*it2).get()); } } } @@ -290,8 +290,8 @@ void Chunk::rebuild() { for (int yy = y0; yy < y1; yy++) { for (int zz = 0; zz < 16; zz++) { for (int xx = 0; xx < 16; xx++) { - // 4J Stu - tile data is ordered in 128 blocks of full width, - // lower 128 then upper 128 + // 4J Stu - tile data is ordered in 128 blocks of full + // width, lower 128 then upper 128 int indexY = yy; int offset = 0; if (indexY >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { @@ -304,43 +304,50 @@ void Chunk::rebuild() { (indexY + 0))]; if (tileId > 0) empty = false; - // Don't bother trying to work out neighbours for this tile if - // we are at the edge of the chunk - apart from the very bottom - // of the world where we shouldn't ever be able to see + // Don't bother trying to work out neighbours for this tile + // if we are at the edge of the chunk - apart from the very + // bottom of the world where we shouldn't ever be able to + // see if (yy == (Level::maxBuildHeight - 1)) continue; if ((xx == 0) || (xx == 15)) continue; if ((zz == 0) || (zz == 15)) continue; - // Establish whether this tile and its neighbours are all made - // of rock, dirt, unbreakable tiles, or have already been - // determined to meet this criteria themselves and have a tile - // of 255 set. - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + // Establish whether this tile and its neighbours are all + // made of rock, dirt, unbreakable tiles, or have already + // been determined to meet this criteria themselves and have + // a tile of 255 set. + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; - tileId = tileIds[offset + (((xx - 1) << 11) | ((zz + 0) << 7) | - (indexY + 0))]; - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + tileId = tileIds[offset + (((xx - 1) << 11) | + ((zz + 0) << 7) | (indexY + 0))]; + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; - tileId = tileIds[offset + (((xx + 1) << 11) | ((zz + 0) << 7) | - (indexY + 0))]; - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + tileId = tileIds[offset + (((xx + 1) << 11) | + ((zz + 0) << 7) | (indexY + 0))]; + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; - tileId = tileIds[offset + (((xx + 0) << 11) | ((zz - 1) << 7) | - (indexY + 0))]; - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + tileId = tileIds[offset + (((xx + 0) << 11) | + ((zz - 1) << 7) | (indexY + 0))]; + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; - tileId = tileIds[offset + (((xx + 0) << 11) | ((zz + 1) << 7) | - (indexY + 0))]; - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + tileId = tileIds[offset + (((xx + 0) << 11) | + ((zz + 1) << 7) | (indexY + 0))]; + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; - // Treat the bottom of the world differently - we shouldn't ever - // be able to look up at this, so consider tiles as invisible if - // they are surrounded on sides other than the bottom + // Treat the bottom of the world differently - we shouldn't + // ever be able to look up at this, so consider tiles as + // invisible if they are surrounded on sides other than the + // bottom if (yy > 0) { int indexYMinusOne = yy - 1; int yMinusOneOffset = 0; @@ -348,26 +355,30 @@ void Chunk::rebuild() { Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { indexYMinusOne -= Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - yMinusOneOffset = Level::COMPRESSED_CHUNK_SECTION_TILES; + yMinusOneOffset = + Level::COMPRESSED_CHUNK_SECTION_TILES; } tileId = tileIds[yMinusOneOffset + (((xx + 0) << 11) | ((zz + 0) << 7) | indexYMinusOne)]; if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || - (tileId == Tile::unbreakable_Id) || (tileId == 255))) + (tileId == Tile::unbreakable_Id) || + (tileId == 255))) continue; } int indexYPlusOne = yy + 1; int yPlusOneOffset = 0; - if (indexYPlusOne >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { + if (indexYPlusOne >= + Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { indexYPlusOne -= Level::COMPRESSED_CHUNK_SECTION_HEIGHT; yPlusOneOffset = Level::COMPRESSED_CHUNK_SECTION_TILES; } - tileId = - tileIds[yPlusOneOffset + (((xx + 0) << 11) | - ((zz + 0) << 7) | indexYPlusOne)]; - if (!((tileId == Tile::stone_Id) || (tileId == Tile::dirt_Id) || + tileId = tileIds[yPlusOneOffset + (((xx + 0) << 11) | + ((zz + 0) << 7) | + indexYPlusOne)]; + if (!((tileId == Tile::stone_Id) || + (tileId == Tile::dirt_Id) || (tileId == Tile::unbreakable_Id) || (tileId == 255))) continue; @@ -481,7 +492,6 @@ void Chunk::rebuild() { } } - if (started) { t->end(); bounds.addBounds(t->bounds); // 4J MGH - added @@ -554,7 +564,6 @@ void Chunk::rebuild() { return; } - float Chunk::distanceToSqr(std::shared_ptr player) const { float xd = (float)(player->x - xm); float yd = (float)(player->y - ym); diff --git a/Minecraft.Client/Rendering/Chunk.h b/Minecraft.Client/Rendering/Chunk.h index ea24723b7..699496d9e 100644 --- a/Minecraft.Client/Rendering/Chunk.h +++ b/Minecraft.Client/Rendering/Chunk.h @@ -70,7 +70,8 @@ public: private: void translateToPos(); void reconcileRenderableTileEntities( - const std::vector >& renderableTileEntities); + const std::vector >& + renderableTileEntities); public: void makeCopyForRebuild(Chunk* source); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp index a8541fd00..f215d186d 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EnchantTableRenderer.cpp @@ -18,7 +18,6 @@ void EnchantTableRenderer::render(std::shared_ptr _table, double x, std::shared_ptr table = std::dynamic_pointer_cast(_table); - glPushMatrix(); glTranslatef((float)x + 0.5f, (float)y + 12 / 16.0f, (float)z + 0.5f); diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp index 305fe1bed..ab7fff785 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp @@ -189,7 +189,7 @@ EntityRenderer* EntityRenderDispatcher::getRenderer(eINSTANCEOF e) { if ((e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER; // EntityRenderer * r = renderers[e]; auto it = renderers.find(e); // 4J Stu - The .at and [] accessors - // insert elements if they don't exist + // insert elements if they don't exist if (it == renderers.end()) { app.DebugPrintf("Couldn't find renderer for entity of type %d\n", e); diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp index c7b1bf6cd..e814afb66 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemInHandRenderer.cpp @@ -946,8 +946,8 @@ void ItemInHandRenderer::tick() { if (selectedItem == nullptr && nextTile == nullptr) { matches = true; } - if (nextTile != nullptr && selectedItem != nullptr && nextTile != selectedItem && - nextTile->id == selectedItem->id && + if (nextTile != nullptr && selectedItem != nullptr && + nextTile != selectedItem && nextTile->id == selectedItem->id && nextTile->getAuxValue() == selectedItem->getAuxValue()) { selectedItem = nextTile; matches = true; diff --git a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp index 6ec3c8286..b8641c198 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp @@ -12,7 +12,6 @@ #include "../../GameState/Options.h" #include "../../Textures/TextureAtlas.h" - ItemRenderer::ItemRenderer() : EntityRenderer() { random = new Random(); setColor = true; diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 4d54f0b7f..d032450e3 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -438,7 +438,6 @@ void PlayerRenderer::renderNameTags(std::shared_ptr player, double x, double y, double z, std::wstring msg, float scale, double dist) { - LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); } diff --git a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp index e90405934..6f3683118 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/ProgressRenderer.cpp @@ -37,7 +37,6 @@ void ProgressRenderer::_progressStart(int title) { lastPercent = 0; this->title = title; LeaveCriticalSection(&ProgressRenderer::s_progress); - } void ProgressRenderer::progressStage(int status) { @@ -61,7 +60,6 @@ void ProgressRenderer::progressStagePercentage(int i) { EnterCriticalSection(&ProgressRenderer::s_progress); lastPercent = i; LeaveCriticalSection(&ProgressRenderer::s_progress); - } int ProgressRenderer::getCurrentPercent() { diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp index 282e4ffda..f3cec5af6 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp @@ -59,7 +59,7 @@ TileEntityRenderer* TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) { TileEntityRenderer* r = nullptr; // TileEntityRenderer *r = renderers[e]; auto it = renderers.find(e); // 4J Stu - The .at and [] accessors - // insert elements if they don't exist + // insert elements if they don't exist if (it == renderers.end()) { return nullptr; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp index 550296b45..a43146943 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.cpp @@ -183,10 +183,7 @@ void TileRenderer::setFixedTexture(Icon* fixedTexture) { void TileRenderer::clearFixedTexture() { this->fixedTexture = nullptr; } -bool TileRenderer::hasFixedTexture() { - - return fixedTexture != nullptr; -} +bool TileRenderer::hasFixedTexture() { return fixedTexture != nullptr; } void TileRenderer::setShape(float x0, float y0, float z0, float x1, float y1, float z1) { @@ -7130,7 +7127,6 @@ void TileRenderer::renderFaceDown(Tile* tt, double x, double y, double z, double z1 = z + tileShapeZ1; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x0), (float)(y0), (float)(z1), (float)(u10), @@ -7238,7 +7234,6 @@ void TileRenderer::renderFaceUp(Tile* tt, double x, double y, double z, double z1 = z + tileShapeZ1; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x1), (float)(y1), (float)(z1), (float)(u11), @@ -7351,7 +7346,6 @@ void TileRenderer::renderNorth(Tile* tt, double x, double y, double z, double z0 = z + tileShapeZ0; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x0), (float)(y1), (float)(z0), (float)(u01), @@ -7464,7 +7458,6 @@ void TileRenderer::renderSouth(Tile* tt, double x, double y, double z, double z1 = z + tileShapeZ1; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x0), (float)(y1), (float)(z1), (float)(u00), @@ -7577,7 +7570,6 @@ void TileRenderer::renderWest(Tile* tt, double x, double y, double z, double z1 = z + tileShapeZ1; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x0), (float)(y1), (float)(z1), (float)(u01), @@ -7690,7 +7682,6 @@ void TileRenderer::renderEast(Tile* tt, double x, double y, double z, double z1 = z + tileShapeZ1; if (applyAmbienceOcclusion) { - t->color(c1r, c1g, c1b); if (SharedConstants::TEXTURE_LIGHTING) t->tex2(tc1); t->vertexUV((float)(x1), (float)(y0), (float)(z1), (float)(u10), @@ -8333,6 +8324,5 @@ Icon* TileRenderer::getTextureOrMissing(Icon* icon) { if (icon == nullptr) return minecraft->textures->getMissingIcon(Icon::TYPE_TERRAIN); - return icon; } diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h index 29f19ef57..beb3f7728 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h +++ b/Minecraft.Client/Rendering/EntityRenderers/TileRenderer.h @@ -115,8 +115,7 @@ private: bool render); float tesselateAnvilPiece(AnvilTile* tt, int x, int y, int z, int part, float bottom, float width, float height, - float length, bool rotate, bool render, - int data); + float length, bool rotate, bool render, int data); public: bool tesselateTorchInWorld(Tile* tt, int x, int y, int z); diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index fc429f5c2..395ece8b1 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -990,7 +990,6 @@ void GameRenderer::render(float a, bool bFirst) { } } - if (mc->noRender) return; GameRenderer::anaglyph3d = mc->options->anaglyph3d; diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index 38405101d..e5af80e96 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -68,7 +68,6 @@ // #define DISABLE_SPU_CODE - ResourceLocation LevelRenderer::MOON_LOCATION = ResourceLocation(TN_TERRAIN_MOON); ResourceLocation LevelRenderer::MOON_PHASES_LOCATION = @@ -157,7 +156,8 @@ LevelRenderer::LevelRenderer(Minecraft* mc, Textures* textures) { totalChunks = offscreenChunks = occludedChunks = renderedChunks = emptyChunks = 0; for (int i = 0; i < 4; i++) { - // sortedChunks[i] = nullptr; // 4J - removed - not sorting + // sortedChunks[i] = nullptr; // 4J - removed - not + //sorting // our chunks anymore chunks[i] = ClipChunkArray(); lastPlayerCount[i] = 0; @@ -474,8 +474,8 @@ void LevelRenderer::allChanged(int playerIndex) { zMaxChunk = zChunks; // 4J removed - we now only fully clear this on exiting the game (setting - // level to nullptr). Apart from that, the chunk rebuilding is responsible for - // maintaining this + // level to nullptr). Apart from that, the chunk rebuilding is responsible + // for maintaining this // renderableTileEntities.clear(); for (int x = 0; x < xChunks; x++) { @@ -565,8 +565,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { totalEntities = (int)entities.size(); auto itEndGE = level[playerIndex]->globalEntities.end(); - for (auto it = level[playerIndex]->globalEntities.begin(); - it != itEndGE; it++) { + for (auto it = level[playerIndex]->globalEntities.begin(); it != itEndGE; + it++) { std::shared_ptr entity = *it; // level->globalEntities[i]; renderedEntities++; if (entity->shouldRender(cam)) @@ -626,8 +626,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { // Don't render if it isn't in the same dimension as this player if (!isGlobalIndexInSameDimension(idx, level[playerIndex])) continue; - for (auto it2 = it->second.tiles.begin(); - it2 != it->second.tiles.end(); it2++) { + for (auto it2 = it->second.tiles.begin(); it2 != it->second.tiles.end(); + it2++) { TileEntityRenderDispatcher::instance->render(*it2, a); } } @@ -768,10 +768,6 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { glTranslatef((float)-xOff, (float)-yOff, (float)-zOff); - - - - bool first = true; int count = 0; ClipChunk* pClipChunk = chunks[playerIndex].data; @@ -836,8 +832,6 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { RenderManager.SetChunkOffset(0.f, 0.f, 0.f); } - - glPopMatrix(); mc->gameRenderer->turnOffLightLayer(alpha); @@ -934,7 +928,6 @@ void LevelRenderer::renderSky(float alpha) { glDepthMask(false); - glEnable(GL_FOG); glColor3f(sr, sg, sb); glCallList(skyList); @@ -1049,7 +1042,6 @@ void LevelRenderer::renderSky(float alpha) { glEnable(GL_ALPHA_TEST); glEnable(GL_FOG); - glPopMatrix(); glDisable(GL_TEXTURE_2D); glColor3f(0, 0, 0); @@ -1783,9 +1775,9 @@ bool LevelRenderer::updateDirtyChunks() { // Find nearest chunk that is dirty for (int p = 0; p < XUSER_MAX_COUNT; p++) { - // It's possible that the localplayers member can be set to nullptr - // on the main thread when a player chooses to exit the game So - // take a reference to the player object now. As it is a + // It's possible that the localplayers member can be set to + // nullptr on the main thread when a player chooses to exit the + // game So take a reference to the player object now. As it is a // shared_ptr it should live as long as we need it std::shared_ptr player = mc->localplayers[p]; if (player == nullptr) continue; @@ -2444,14 +2436,12 @@ bool inline clip(float* bb, float* frustum) { return true; } - // 4jcraft: optional occlusion culling system, i hope to upgrade it soon // gives better performances but mostly breaks chunk rendering void LevelRenderer::cull(Culler* culler, float a) { int playerIndex = mc->player->GetXboxPad(); if (chunks[playerIndex].data == nullptr) return; - FrustumCuller* fc = (FrustumCuller*)culler; FrustumData* fd = fc->frustum; float fdraw[6 * 4]; @@ -2821,8 +2811,8 @@ void LevelRenderer::playSoundExceptPlayer(std::shared_ptr player, void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) { -if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr) -return; +if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == +nullptr) return; double xd = mc->cameraTargetPlayer->x - x; double yd = mc->cameraTargetPlayer->y - y; @@ -2915,14 +2905,15 @@ std::shared_ptr LevelRenderer::addParticleInternal( } // 4J - this is a bit of hack to get communication through from the level - // itself, but if Minecraft::animateTickLevel is nullptr then we are to behave - // as normal, and if it is set, then we should use that as a pointer to the - // level the particle is to be created with rather than try to work it out - // from the current player. This is because in this state we are calling - // from a loop that is trying to amalgamate particle creation between all - // players for a particular level. Also don't do distance clipping as it - // isn't for a particular player, and distance is already taken into account - // before we get here anyway by the code in Level::animateTickDoWork + // itself, but if Minecraft::animateTickLevel is nullptr then we are to + // behave as normal, and if it is set, then we should use that as a pointer + // to the level the particle is to be created with rather than try to work + // it out from the current player. This is because in this state we are + // calling from a loop that is trying to amalgamate particle creation + // between all players for a particular level. Also don't do distance + // clipping as it isn't for a particular player, and distance is already + // taken into account before we get here anyway by the code in + // Level::animateTickDoWork if (mc->animateTickLevel == nullptr) { double particleDistanceSquared = 16 * 16; double xd = 0.0f; diff --git a/Minecraft.Client/Rendering/Minimap.cpp b/Minecraft.Client/Rendering/Minimap.cpp index 4a9bf773b..2003f4f1d 100644 --- a/Minecraft.Client/Rendering/Minimap.cpp +++ b/Minecraft.Client/Rendering/Minimap.cpp @@ -8,7 +8,7 @@ #include "../../Minecraft.World/Headers/net.minecraft.world.level.saveddata.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.material.h" -int Minimap::LUT[256]; // 4J added +int Minimap::LUT[256]; // 4J added bool Minimap::genLUT = true; // 4J added Minimap::Minimap(Font* font, Options* options, Textures* textures, @@ -148,8 +148,8 @@ void Minimap::render(std::shared_ptr player, Textures* textures, } #endif - // 4J Stu - For item frame renders, the player is nullptr. We do not want - // to show player icons on the frames. + // 4J Stu - For item frame renders, the player is nullptr. We do not + // want to show player icons on the frames. if (player == nullptr && (imgIndex != 12)) continue; else if (player != nullptr && imgIndex == 12) @@ -194,8 +194,8 @@ void Minimap::render(std::shared_ptr player, Textures* textures, char imgIndex = dec->img; imgIndex -= 16; - // 4J Stu - For item frame renders, the player is nullptr. We do not want - // to show player icons on the frames. + // 4J Stu - For item frame renders, the player is nullptr. We do not + // want to show player icons on the frames. if (player == nullptr && (imgIndex != 12)) continue; else if (player != nullptr && imgIndex == 12) diff --git a/Minecraft.Client/Rendering/Minimap.h b/Minecraft.Client/Rendering/Minimap.h index 9bb7efbec..0fd927d5e 100644 --- a/Minecraft.Client/Rendering/Minimap.h +++ b/Minecraft.Client/Rendering/Minimap.h @@ -11,9 +11,9 @@ private: static const int w = MapItem::IMAGE_WIDTH; static const int h = MapItem::IMAGE_HEIGHT; static int LUT[256]; // 4J added - static bool genLUT; // 4J added - int renderCount; // 4J added - bool m_optimised; // 4J Added + static bool genLUT; // 4J added + int renderCount; // 4J added + bool m_optimised; // 4J Added intArray pixels; int mapTexture; Options* options; diff --git a/Minecraft.Client/Rendering/Models/ModelPart.cpp b/Minecraft.Client/Rendering/Models/ModelPart.cpp index e04a3d716..01d4ab249 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.cpp +++ b/Minecraft.Client/Rendering/Models/ModelPart.cpp @@ -58,8 +58,8 @@ ModelPart* ModelPart::retrieveChild(SKIN_BOX* pBox) { for (auto it = children.begin(); it != children.end(); ++it) { ModelPart* child = *it; - for (auto itcube = child->cubes.begin(); - itcube != child->cubes.end(); ++itcube) { + for (auto itcube = child->cubes.begin(); itcube != child->cubes.end(); + ++itcube) { Cube* pCube = *itcube; if ((pCube->x0 == pBox->fX) && (pCube->y0 == pBox->fY) && diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp index 9e8758378..9ae08c5d3 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp @@ -262,7 +262,7 @@ void ParticleEngine::moveParticleInList(std::shared_ptr particle, : (particle->level->dimension->id == -1 ? 1 : 2); for (int tt = 0; tt < TEXTURE_COUNT; tt++) { auto it = find(particles[l][tt][source].begin(), - particles[l][tt][source].end(), particle); + particles[l][tt][source].end(), particle); if (it != particles[l][tt][source].end()) { (*it) = particles[l][tt][source].back(); particles[l][tt][source].pop_back(); diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index e896334d4..6bc17df8d 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -72,7 +72,6 @@ Tesselator::Tesselator(int size) { vboIds = MemoryTracker::createIntBuffer(vboCounts); ARBVertexBufferObject::glGenBuffersARB(vboIds); } - } Tesselator* Tesselator::getUniqueInstance(int size) { @@ -83,8 +82,7 @@ void Tesselator::end() { // if (!tesselating) throw new IllegalStateException("Not tesselating!"); // // 4J - removed tesselating = false; - if (vertices > 0) - { + if (vertices > 0) { // 4J - a lot of stuff taken out here for fiddling round with enable // client states etc. that don't matter for our renderer if (!hasColor) { @@ -111,13 +109,14 @@ void Tesselator::end() { ? C4JRender::PIXEL_SHADER_TYPE_PROJECTION : C4JRender::PIXEL_SHADER_TYPE_STANDARD); } else { -// glDrawArrays(mode, 0, vertices); // 4J - changed for xbox -// For compact vertices, the vertexCount has to be calculated from the amount of -// data written, as we insert extra fake vertices to encode supplementary data -// for more awkward quads that have non axis aligned UVs (eg flowing lava/water) + // glDrawArrays(mode, 0, vertices); // 4J - changed + // for xbox + // For compact vertices, the vertexCount has to be calculated from + // the amount of data written, as we insert extra fake vertices to + // encode supplementary data for more awkward quads that have non + // axis aligned UVs (eg flowing lava/water) int vertexCount = vertices; if (useCompactFormat360) { - RenderManager.DrawVertices( (C4JRender::ePrimitiveType)mode, vertexCount, _array->data, C4JRender::VERTEX_TYPE_COMPRESSED, @@ -157,7 +156,6 @@ void Tesselator::clear() { p = 0; count = 0; - } void Tesselator::begin() { @@ -181,7 +179,6 @@ bool Tesselator::setMipmapEnable(bool enable) { return prev; } - void Tesselator::begin(int mode) { /* // 4J - removed if (tesselating) { @@ -406,7 +403,6 @@ void Tesselator::packCompactQuad() { } } - typedef unsigned short hfloat; extern hfloat convertFloatToHFloat(float f); extern float convertHFloatToFloat(hfloat hf); @@ -460,7 +456,6 @@ void Tesselator::vertex(float x, float y, float z) { std::int16_t* pShortData = (std::int16_t*)&_array->data[p]; - pShortData[0] = (((int)((x + xo) * 1024.0f)) & 0xffff); pShortData[1] = (((int)((y + yo) * 1024.0f)) & 0xffff); pShortData[2] = (((int)((z + zo) * 1024.0f)) & 0xffff); @@ -478,13 +473,8 @@ void Tesselator::vertex(float x, float y, float z) { p += 4; - - - vertices++; - - if (vertices % 4 == 0 && ((p >= size - 4 * 4) || ((p / 4) >= @@ -577,7 +567,6 @@ void Tesselator::color(int c, int alpha) { void Tesselator::noColor() { _noColor = true; } - void Tesselator::normal(float x, float y, float z) { hasNormal = true; @@ -605,6 +594,4 @@ void Tesselator::addOffset(float x, float y, float z) { zo += z; } -bool Tesselator::hasMaxVertices() { - return false; -} \ No newline at end of file +bool Tesselator::hasMaxVertices() { return false; } \ No newline at end of file diff --git a/Minecraft.Client/Rendering/Tesselator.h b/Minecraft.Client/Rendering/Tesselator.h index 3b3b5db58..d6a7283ef 100644 --- a/Minecraft.Client/Rendering/Tesselator.h +++ b/Minecraft.Client/Rendering/Tesselator.h @@ -73,7 +73,6 @@ private: unsigned int m_t2[4]; void packCompactQuad(); - public: // 4J MGH - added, to calculate tight bounds class Bounds { diff --git a/Minecraft.Client/Rendering/glWrapper.cpp b/Minecraft.Client/Rendering/glWrapper.cpp index b58a250d8..f328063c9 100644 --- a/Minecraft.Client/Rendering/glWrapper.cpp +++ b/Minecraft.Client/Rendering/glWrapper.cpp @@ -56,9 +56,7 @@ int glGenLists(int count) { return RenderManager.CBuffCreate(count); } void glNewList(int index, int mode) { RenderManager.CBuffStart(index); } -void glEndList(int vertexCount) { - RenderManager.CBuffEnd(); -} +void glEndList(int vertexCount) { RenderManager.CBuffEnd(); } void glCallList(int index) { RenderManager.CBuffCall(index); } @@ -186,9 +184,7 @@ void glAlphaFunc(int func, float param) { RenderManager.StateSetAlphaFunc(func, param); } -void glDepthFunc(int func) { - RenderManager.StateSetDepthFunc(func); -} +void glDepthFunc(int func) { RenderManager.StateSetDepthFunc(func); } void glTexParameteri(int target, int param, int value) { RenderManager.TextureSetParam(param, value); diff --git a/Minecraft.Client/Textures/BufferedImage.cpp b/Minecraft.Client/Textures/BufferedImage.cpp index 2dd13ef83..8a624960d 100644 --- a/Minecraft.Client/Textures/BufferedImage.cpp +++ b/Minecraft.Client/Textures/BufferedImage.cpp @@ -10,7 +10,6 @@ #include #include - BufferedImage::BufferedImage(int width, int height, int type) { data[0] = new int[width * height]; diff --git a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp index 1e34b2b20..8d4051fdd 100644 --- a/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/AbstractTexturePack.cpp @@ -35,11 +35,9 @@ std::wstring AbstractTexturePack::trim(std::wstring line) { return line; } -void AbstractTexturePack::loadIcon() { -} +void AbstractTexturePack::loadIcon() {} -void AbstractTexturePack::loadComparison() { -} +void AbstractTexturePack::loadComparison() {} void AbstractTexturePack::loadDescription() { // 4J Unused currently @@ -157,9 +155,7 @@ BufferedImage* AbstractTexturePack::getImageResource( filenameHasExtension, bTitleUpdateTexture, drive); } -void AbstractTexturePack::loadDefaultUI() { - ui.ReloadSkin(); -} +void AbstractTexturePack::loadDefaultUI() { ui.ReloadSkin(); } void AbstractTexturePack::loadColourTable() { loadDefaultColourTable(); @@ -198,11 +194,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() { } } - -void AbstractTexturePack::loadUI() { - loadColourTable(); - -} +void AbstractTexturePack::loadUI() { loadColourTable(); } void AbstractTexturePack::unloadUI() { // Do nothing diff --git a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp index 18c7c8511..0feb4ec7d 100644 --- a/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DLCTexturePack.cpp @@ -65,7 +65,6 @@ DLCTexturePack::DLCTexturePack(std::uint32_t id, DLCPack* pack, m_stringTable = nullptr; - if (m_dlcInfoPack->doesPackContainFile( DLCManager::e_DLCType_LocalisationData, L"languages.loc")) { DLCLocalisationFile* localisationFile = @@ -223,8 +222,7 @@ void DLCTexturePack::loadData() { if (StorageManager.MountInstalledDLC(ProfileManager.GetPrimaryPad(), mountIndex, &DLCTexturePack::packMounted, this, - "TPACK") != ERROR_IO_PENDING) - { + "TPACK") != ERROR_IO_PENDING) { // corrupt DLC m_bHasLoadedData = true; if (app.getLevelGenerationOptions()) @@ -394,8 +392,7 @@ void DLCTexturePack::loadUI() { if (m_archiveFile && m_archiveFile->hasFile(L"skin.swf")) { ui.ReloadSkin(); bUILoaded = true; - } - else { + } else { loadDefaultUI(); bUILoaded = true; } diff --git a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp index 2b1aace90..2774d398a 100644 --- a/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/DefaultTexturePack.cpp @@ -41,7 +41,8 @@ InputStream* DefaultTexturePack::getResourceImplementation( InputStream* resource = InputStream::getResourceAsStream(wDrive + name); // InputStream *stream = - // DefaultTexturePack::class->getResourceAsStream(name); if (stream == nullptr) + // DefaultTexturePack::class->getResourceAsStream(name); if (stream == + // nullptr) //{ // throw new FileNotFoundException(name); // } @@ -56,6 +57,4 @@ void DefaultTexturePack::loadUI() { AbstractTexturePack::loadUI(); } -void DefaultTexturePack::unloadUI() { - AbstractTexturePack::unloadUI(); -} +void DefaultTexturePack::unloadUI() { AbstractTexturePack::unloadUI(); } diff --git a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp index ee009f7cb..a7a48daa3 100644 --- a/Minecraft.Client/Textures/Packs/FileTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FileTexturePack.cpp @@ -10,8 +10,7 @@ FileTexturePack::FileTexturePack(std::uint32_t id, File* file, loadDescription(); } -void FileTexturePack::unload(Textures* textures) { -} +void FileTexturePack::unload(Textures* textures) {} InputStream* FileTexturePack::getResourceImplementation( const std::wstring& name) // throws IOException @@ -19,14 +18,9 @@ InputStream* FileTexturePack::getResourceImplementation( return nullptr; } -bool FileTexturePack::hasFile(const std::wstring& name) { - return false; -} +bool FileTexturePack::hasFile(const std::wstring& name) { return false; } void FileTexturePack::loadZipFile() // throws IOException -{ -} +{} -bool FileTexturePack::isTerrainUpdateCompatible() { - return false; -} +bool FileTexturePack::isTerrainUpdateCompatible() { return false; } diff --git a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp index a0dc9236a..f2b466b34 100644 --- a/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/FolderTexturePack.cpp @@ -15,13 +15,13 @@ FolderTexturePack::FolderTexturePack(std::uint32_t id, const std::wstring& name, InputStream* FolderTexturePack::getResourceImplementation( const std::wstring& name) // throws IOException { - std::wstring wDrive = L""; // Make the content package point to to the UPDATE: drive is needed wDrive = L"Common\\DummyTexturePack\\res"; InputStream* resource = InputStream::getResourceAsStream(wDrive + name); // InputStream *stream = - // DefaultTexturePack::class->getResourceAsStream(name); if (stream == nullptr) + // DefaultTexturePack::class->getResourceAsStream(name); if (stream == + // nullptr) //{ // throw new FileNotFoundException(name); // } @@ -36,9 +36,7 @@ bool FolderTexturePack::hasFile(const std::wstring& name) { // return true; } -bool FolderTexturePack::isTerrainUpdateCompatible() { - return true; -} +bool FolderTexturePack::isTerrainUpdateCompatible() { return true; } std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, const char* pchBDPatchFilename) { @@ -47,8 +45,6 @@ std::wstring FolderTexturePack::getPath(bool bTitleUpdateTexture /*= false*/, return wDrive; } -void FolderTexturePack::loadUI() { -} +void FolderTexturePack::loadUI() {} -void FolderTexturePack::unloadUI() { -} \ No newline at end of file +void FolderTexturePack::unloadUI() {} \ No newline at end of file diff --git a/Minecraft.Client/Textures/Packs/TexturePack.cpp b/Minecraft.Client/Textures/Packs/TexturePack.cpp index aefa78618..1cbe8e450 100644 --- a/Minecraft.Client/Textures/Packs/TexturePack.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePack.cpp @@ -1,8 +1,9 @@ #include "../../Platform/stdafx.h" #include "TexturePack.h" -std::wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/, - const char* pchBDPatchFileName /*= nullptr*/) { +std::wstring TexturePack::getPath( + bool bTitleUpdateTexture /*= false*/, + const char* pchBDPatchFileName /*= nullptr*/) { std::wstring wDrive; if (bTitleUpdateTexture) { diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index d6fd10592..697eb5356 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -224,8 +224,7 @@ void TexturePackRepository::removeTexturePackById(std::uint32_t id) { if (it != cacheById.end()) { TexturePack* oldPack = it->second; - auto it2 = - find(texturePacks->begin(), texturePacks->end(), oldPack); + auto it2 = find(texturePacks->begin(), texturePacks->end(), oldPack); if (it2 != texturePacks->end()) { texturePacks->erase(it2); if (lastSelected == oldPack) { diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.h b/Minecraft.Client/Textures/Packs/TexturePackRepository.h index 105c634e0..5b8bd0d1d 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.h +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.h @@ -59,7 +59,7 @@ public: bool canUseWebSkin(); bool isUsingDefaultSkin() { return selected == DEFAULT_TEXTURE_PACK; - } // 4J Added + } // 4J Added TexturePack* getDefault() { return DEFAULT_TEXTURE_PACK; } // 4J Added std::vector >* diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index efd0e9646..553f63221 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -92,7 +92,7 @@ void PreStitchedTextureMap::stitch() { std::wstring drive = L""; // 4J-PB - need to check for BD patched files - if (texturePack->hasFile(L"res/" + filename, false)) { + if (texturePack->hasFile(L"res/" + filename, false)) { drive = texturePack->getPath(true); } else { drive = Minecraft::GetInstance()->skins->getDefault()->getPath(true); @@ -119,8 +119,7 @@ void PreStitchedTextureMap::stitch() { TextureManager::getInstance()->registerName(name, stitchResult); // stitchResult = stitcher->constructTexture(m_mipMap); - for (auto it = texturesByName.begin(); it != texturesByName.end(); - ++it) { + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { StitchedTexture* preStitched = (StitchedTexture*)it->second; int x = preStitched->getU0() * stitchResult->getWidth(); @@ -132,8 +131,7 @@ void PreStitchedTextureMap::stitch() { } MemSect(52); - for (auto it = texturesByName.begin(); it != texturesByName.end(); - ++it) { + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { StitchedTexture* preStitched = (StitchedTexture*)(it->second); makeTextureAnimated(texturePack, preStitched); @@ -144,7 +142,6 @@ void PreStitchedTextureMap::stitch() { stitchResult->writeAsPNG(L"debug.stitched_" + name + L".png"); stitchResult->updateOnGPU(); - } void PreStitchedTextureMap::makeTextureAnimated(TexturePack* texturePack, @@ -265,8 +262,7 @@ void PreStitchedTextureMap::loadUVs() { return; } - for (auto it = texturesByName.begin(); it != texturesByName.end(); - ++it) { + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { delete it->second; } texturesByName.clear(); diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index b52980e17..2a98bd466 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -30,7 +30,8 @@ bool StitchSlot::add(TextureHolder* textureHolder) { } // Exact fit! best-case-solution - if (textureWidth == width && textureHeight == height && subSlots == nullptr) { + if (textureWidth == width && textureHeight == height && + subSlots == nullptr) { // Store somehow this->textureHolder = textureHolder; return true; diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index 08829e3e5..20a636913 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -59,8 +59,7 @@ void TextureMap::stitch() { Stitcher* stitcher = TextureManager::getInstance()->createStitcher(name); - for (auto it = texturesByName.begin(); it != texturesByName.end(); - ++it) { + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { delete it->second; } texturesByName.clear(); @@ -83,8 +82,8 @@ void TextureMap::stitch() { // Extract frames from textures and add them to the stitchers // for (final String name : texturesToRegister.keySet()) - for (auto it = texturesToRegister.begin(); - it != texturesToRegister.end(); ++it) { + for (auto it = texturesToRegister.begin(); it != texturesToRegister.end(); + ++it) { std::wstring name = it->first; std::wstring filename = path + name + extension; @@ -194,8 +193,8 @@ void TextureMap::stitch() { missingPosition = texturesByName.find(NAME_MISSING_TEXTURE)->second; // for (StitchedTexture texture : texturesToRegister.values()) - for (auto it = texturesToRegister.begin(); - it != texturesToRegister.end(); ++it) { + for (auto it = texturesToRegister.begin(); it != texturesToRegister.end(); + ++it) { StitchedTexture* texture = it->second; texture->replaceWith(missingPosition); } diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index 58fa9082b..2ec68febc 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -4,7 +4,6 @@ #include "TextureManager.h" #include "Texture.h" - #define MAX_MIP_LEVELS 5 Texture::Texture(const std::wstring& name, int mode, int width, int height, @@ -65,7 +64,6 @@ void Texture::_init(const std::wstring& name, int mode, int width, int height, if (m_iMipLevels > MAX_MIP_LEVELS) m_iMipLevels = MAX_MIP_LEVELS; } - if (mode != TM_CONTAINER) { glId = glGenTextures(); @@ -232,7 +230,6 @@ void Texture::blit(int x, int y, Texture* source, bool rotated) { data[level]->position(0); srcBuffer->position(0); - for (int srcY = 0; srcY < shh; srcY++) { int dstY = yy + srcY; int srcLine = srcY * sww * 4; @@ -347,10 +344,10 @@ void Texture::transferFromImage(BufferedImage* image) { return; } -// #if 0 -// int byteRemapRGBA[] = { 0, 1, 2, 3 }; -// int byteRemapBGRA[] = { 2, 1, 0, 3 }; -// #else + // #if 0 + // int byteRemapRGBA[] = { 0, 1, 2, 3 }; + // int byteRemapBGRA[] = { 2, 1, 0, 3 }; + // #else int byteRemapRGBA[] = {3, 0, 1, 2}; int byteRemapBGRA[] = {3, 2, 1, 0}; // #endif diff --git a/Minecraft.Client/Textures/Texture.h b/Minecraft.Client/Textures/Texture.h index c8d4bf4da..9d4ac284d 100644 --- a/Minecraft.Client/Textures/Texture.h +++ b/Minecraft.Client/Textures/Texture.h @@ -4,7 +4,6 @@ class Rect2i; class ByteBuffer; class BufferedImage; - class Texture { public: static const int WM_WRAP = GL_REPEAT; diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index 355e53dc8..ac92dc81c 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -36,8 +36,7 @@ void TextureManager::registerName(const std::wstring& name, Texture* texture) { } void TextureManager::registerTexture(Texture* texture) { - for (auto it = idToTextureMap.begin(); it != idToTextureMap.end(); - ++it) { + for (auto it = idToTextureMap.begin(); it != idToTextureMap.end(); ++it) { if (it->second == texture) { // Minecraft.getInstance().getLogger().warning("TextureManager.registerTexture // called, but this texture has " + "already been registered. diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 7a5cacecf..481a7bb70 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -529,11 +529,12 @@ void Textures::bindTextureLayers(ResourceLocation* resource) { void Textures::bind(int id) { // 4jcraft: Classic GUI code still performs some raw glBindTexture calls, so - // this path must always rebind rather than trusting lastBoundId to be in sync. - // TODO(4jcraft): Long term, route all texture binds through one synchronized - // path or invalidate lastBoundId at every raw glBindTexture call so this can - // safely use cached binds again without breaking font/UI rendering. - // if (id != lastBoundId) + // this path must always rebind rather than trusting lastBoundId to be in + // sync. + // TODO(4jcraft): Long term, route all texture binds through one + // synchronized path or invalidate lastBoundId at every raw glBindTexture + // call so this can safely use cached binds again without breaking font/UI + // rendering. if (id != lastBoundId) { if (id < 0) return; glBindTexture(GL_TEXTURE_2D, id); @@ -1190,7 +1191,6 @@ void Textures::reloadAll() { skins->clearInvalidTexturePacks(); - // Recalculate fonts // Minecraft::GetInstance()->font->loadCharacterWidths(); // Minecraft::GetInstance()->altFont->loadCharacterWidths(); diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index 9cbd4f13d..e5ec7ca2b 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -743,7 +743,6 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { int xo = iSafezoneXHalf + 10; int yo = iSafezoneTopYHalf + 10; - glPushMatrix(); glTranslatef((float)xo, (float)yo, 50); float ss = 12; diff --git a/Minecraft.Client/UI/Screens/ContainerScreen.cpp b/Minecraft.Client/UI/Screens/ContainerScreen.cpp index 3a461f9c0..9e073a6e6 100644 --- a/Minecraft.Client/UI/Screens/ContainerScreen.cpp +++ b/Minecraft.Client/UI/Screens/ContainerScreen.cpp @@ -17,8 +17,7 @@ ContainerScreen::ContainerScreen(std::shared_ptr inventory, imageHeight = noRowHeight + containerRows * 18; } -void ContainerScreen::renderLabels() { -} +void ContainerScreen::renderLabels() {} void ContainerScreen::renderBg(float a) { // 4J Unused diff --git a/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp b/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp index d5a682883..150df4da6 100644 --- a/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp +++ b/Minecraft.Client/UI/Screens/SelectWorldScreen.cpp @@ -116,7 +116,7 @@ void SelectWorldScreen::buttonClicked(Button* button) { minecraft->setScreen(nullptr); if (done) return; done = true; -// 4J Stu - Not used, so commenting to stop the build failing + // 4J Stu - Not used, so commenting to stop the build failing } } else if (button->id == BUTTON_RENAME_ID) { minecraft->setScreen( @@ -142,7 +142,7 @@ void SelectWorldScreen::worldSelected(int id) { { worldFolderName = L"World" + _toString(id); } -// 4J Stu - Not used, so commenting to stop the build failing + // 4J Stu - Not used, so commenting to stop the build failing } void SelectWorldScreen::confirmResult(bool result, int id) { diff --git a/Minecraft.Client/UI/Screens/StatsScreen.cpp b/Minecraft.Client/UI/Screens/StatsScreen.cpp index 9d267a279..de2cdf9c8 100644 --- a/Minecraft.Client/UI/Screens/StatsScreen.cpp +++ b/Minecraft.Client/UI/Screens/StatsScreen.cpp @@ -126,7 +126,7 @@ void StatsScreen::GeneralStatisticsList::renderItem(int i, int x, int y, int h, } void StatsScreen::blitSlot(int x, int y, int item) { -// 4J Unused + // 4J Unused } void StatsScreen::blitSlotBg(int x, int y) { blitSlotIcon(x, y, 0, 0); } diff --git a/Minecraft.Client/Utils/FrameProfiler.cpp b/Minecraft.Client/Utils/FrameProfiler.cpp index 7c0d937c4..fbaebbb1d 100644 --- a/Minecraft.Client/Utils/FrameProfiler.cpp +++ b/Minecraft.Client/Utils/FrameProfiler.cpp @@ -26,7 +26,16 @@ constexpr std::uint64_t kNsPerMs = 1000ULL * 1000ULL; constexpr std::uint64_t kReportIntervalNs = 1000ULL * 1000ULL * 1000ULL; constexpr std::size_t kBucketCount = FrameProfiler::BucketCount(); constexpr auto kFalseTokens = std::to_array({ - "0", "false", "False", "false", "no", "No", "NO", "off", "Off", "OFF", + "0", + "false", + "False", + "false", + "no", + "No", + "NO", + "off", + "Off", + "OFF", }); constexpr std::array kBucketDescriptors = {{ @@ -103,8 +112,7 @@ static_assert(kBucketDescriptors.size() == kBucketCount); return static_cast(ns) / static_cast(kNsPerMs); } -[[nodiscard]] constexpr bool envSaysDisabled( - std::string_view value) noexcept { +[[nodiscard]] constexpr bool envSaysDisabled(std::string_view value) noexcept { if (value.empty()) return false; for (std::string_view falseToken : kFalseTokens) { @@ -123,7 +131,8 @@ inline void updateAtomicMax(std::atomic& value, } } -inline void recordWorkerBucket(Bucket bucket, std::uint64_t elapsedNs) noexcept { +inline void recordWorkerBucket(Bucket bucket, + std::uint64_t elapsedNs) noexcept { AtomicBucketTotals& state = g_profilerState.workerBuckets[FrameProfiler::BucketIndex(bucket)]; state.totalNs.fetch_add(elapsedNs, std::memory_order_relaxed); @@ -147,8 +156,7 @@ FRAME_PROFILER_NOINLINE void emitWindowReport( buckets[FrameProfiler::BucketIndex(Bucket::Frame)].calls; if (frames == 0) return; - std::fprintf(stderr, - "[frame-prof] avg/frame(ms) frames=%llu", + std::fprintf(stderr, "[frame-prof] avg/frame(ms) frames=%llu", static_cast(frames)); for (const auto& descriptor : kBucketDescriptors) { const BucketTotals& bucket = @@ -164,17 +172,16 @@ FRAME_PROFILER_NOINLINE void emitWindowReport( const BucketTotals& bucket = buckets[FrameProfiler::BucketIndex(descriptor.bucket)]; const std::string_view label = descriptor.label; - std::fprintf(stderr, " %.*s=%.2f/%llu", - static_cast(label.size()), label.data(), - nsToMs(bucket.maxNs), + std::fprintf(stderr, " %.*s=%.2f/%llu", static_cast(label.size()), + label.data(), nsToMs(bucket.maxNs), static_cast(bucket.calls)); } std::fputc('\n', stderr); std::fflush(stderr); } -[[nodiscard]] std::array snapshotAndResetWorkerBuckets() - noexcept { +[[nodiscard]] std::array +snapshotAndResetWorkerBuckets() noexcept { std::array snapshot = {}; for (std::size_t i = 0; i < kBucketCount; ++i) { AtomicBucketTotals& workerBucket = g_profilerState.workerBuckets[i]; diff --git a/Minecraft.Client/Utils/FrameProfiler.h b/Minecraft.Client/Utils/FrameProfiler.h index c22351f69..71fa01937 100644 --- a/Minecraft.Client/Utils/FrameProfiler.h +++ b/Minecraft.Client/Utils/FrameProfiler.h @@ -85,10 +85,10 @@ private: #define FRAME_PROFILE_CONCAT_INNER(a, b) a##b #define FRAME_PROFILE_CONCAT(a, b) FRAME_PROFILE_CONCAT_INNER(a, b) -#define FRAME_PROFILE_SCOPE(bucket_name) \ - FrameProfiler::Scope FRAME_PROFILE_CONCAT(frameProfileScope_, __LINE__)( \ - FrameProfiler::Bucket::bucket_name) -#define FRAME_PROFILE_FRAME_SCOPE() \ +#define FRAME_PROFILE_SCOPE(bucket_name) \ + FrameProfiler::Scope FRAME_PROFILE_CONCAT( \ + frameProfileScope_, __LINE__)(FrameProfiler::Bucket::bucket_name) +#define FRAME_PROFILE_FRAME_SCOPE() \ FrameProfiler::FrameScope FRAME_PROFILE_CONCAT(frameProfileFrameScope_, \ __LINE__) diff --git a/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp b/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp index c38b9f931..3cb0e0dc8 100644 --- a/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp +++ b/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp @@ -3,8 +3,7 @@ #include "BaseAttributeMap.h" BaseAttributeMap::~BaseAttributeMap() { - for (auto it = attributesById.begin(); it != attributesById.end(); - ++it) { + for (auto it = attributesById.begin(); it != attributesById.end(); ++it) { delete it->second; } } @@ -23,8 +22,7 @@ AttributeInstance* BaseAttributeMap::getInstance(eATTRIBUTE_ID id) { } void BaseAttributeMap::getAttributes(std::vector& atts) { - for (auto it = attributesById.begin(); it != attributesById.end(); - ++it) { + for (auto it = attributesById.begin(); it != attributesById.end(); ++it) { atts.push_back(it->second); } } diff --git a/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp b/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp index ef0688357..865a71375 100644 --- a/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp +++ b/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp @@ -15,8 +15,7 @@ ModifiableAttributeInstance::ModifiableAttributeInstance( ModifiableAttributeInstance::~ModifiableAttributeInstance() { for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { - for (auto it = modifiers[i].begin(); it != modifiers[i].end(); - ++it) { + for (auto it = modifiers[i].begin(); it != modifiers[i].end(); ++it) { // Delete all modifiers delete *it; } @@ -45,8 +44,7 @@ void ModifiableAttributeInstance::getModifiers( for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { std::unordered_set* opModifiers = &modifiers[i]; - for (auto it = opModifiers->begin(); it != opModifiers->end(); - ++it) { + for (auto it = opModifiers->begin(); it != opModifiers->end(); ++it) { result.insert(*it); } } @@ -94,8 +92,7 @@ void ModifiableAttributeInstance::setDirty() { void ModifiableAttributeInstance::removeModifier(AttributeModifier* modifier) { for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { - for (auto it = modifiers[i].begin(); it != modifiers[i].end(); - ++it) { + for (auto it = modifiers[i].begin(); it != modifiers[i].end(); ++it) { if (modifier->equals(*it)) { modifiers[i].erase(it); break; diff --git a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp index 91ae14770..9288a7d93 100644 --- a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp @@ -55,8 +55,8 @@ bool AvoidPlayerGoal::canUse() { } else { AABB grown_bb = mob->bb.grow(maxDist, 3, maxDist); std::vector >* entities = - mob->level->getEntitiesOfClass( - avoidType, &grown_bb, entitySelector); + mob->level->getEntitiesOfClass(avoidType, &grown_bb, + entitySelector); if (entities->empty()) { delete entities; return false; diff --git a/Minecraft.World/AI/Goals/BreedGoal.cpp b/Minecraft.World/AI/Goals/BreedGoal.cpp index de4cbfa7b..ea219158f 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.cpp +++ b/Minecraft.World/AI/Goals/BreedGoal.cpp @@ -70,9 +70,9 @@ void BreedGoal::breed() { animal->setDespawnProtected(); partner.lock()->setDespawnProtected(); if (offspring == nullptr) { - // This will be nullptr if we've hit our limits for spawning any particular - // type of animal... reset things as normally as we can, without - // actually producing any offspring + // This will be nullptr if we've hit our limits for spawning any + // particular type of animal... reset things as normally as we can, + // without actually producing any offspring animal->resetLove(); partner.lock()->resetLove(); return; diff --git a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp index 784ccc958..f32574982 100644 --- a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp @@ -117,7 +117,8 @@ void ControlledByPlayerGoal::tick() { mob->getRandom()->nextFloat() < 0.006f && !boosting) { std::shared_ptr carriedItem = player->getCarriedItem(); - if (carriedItem != nullptr && carriedItem->id == Item::carrotOnAStick_Id) { + if (carriedItem != nullptr && + carriedItem->id == Item::carrotOnAStick_Id) { carriedItem->hurtAndBreak(1, player); if (carriedItem->count == 0) { diff --git a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp index d83fc334e..ec922cd28 100644 --- a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp @@ -22,10 +22,11 @@ void HurtByTargetGoal::start() { if (alertSameType) { double within = getFollowDistance(); - AABB mob_bb = AABB(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1).grow(within, 4, within); + AABB mob_bb = + AABB(mob->x, mob->y, mob->z, mob->x + 1, mob->y + 1, mob->z + 1) + .grow(within, 4, within); std::vector >* nearby = - mob->level->getEntitiesOfClass( - typeid(*mob), &mob_bb); + mob->level->getEntitiesOfClass(typeid(*mob), &mob_bb); for (auto it = nearby->begin(); it != nearby->end(); ++it) { std::shared_ptr other = std::dynamic_pointer_cast(*it); diff --git a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp index b4f30c952..975ec5c46 100644 --- a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp @@ -14,7 +14,8 @@ SubselectEntitySelector::~SubselectEntitySelector() { delete m_subselector; } bool SubselectEntitySelector::matches(std::shared_ptr entity) const { if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; - if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; + if (m_subselector != nullptr && !m_subselector->matches(entity)) + return false; return m_parent->canAttack(std::dynamic_pointer_cast(entity), false); } diff --git a/Minecraft.World/AI/Goals/TargetGoal.cpp b/Minecraft.World/AI/Goals/TargetGoal.cpp index 1804e676f..1c37f6050 100644 --- a/Minecraft.World/AI/Goals/TargetGoal.cpp +++ b/Minecraft.World/AI/Goals/TargetGoal.cpp @@ -70,8 +70,9 @@ bool TargetGoal::canAttack(std::shared_ptr target, if (ownableMob != nullptr && !ownableMob->getOwnerUUID().empty()) { std::shared_ptr ownableTarget = std::dynamic_pointer_cast(target); - if (ownableTarget != nullptr && ownableMob->getOwnerUUID().compare( - ownableTarget->getOwnerUUID()) == 0) { + if (ownableTarget != nullptr && + ownableMob->getOwnerUUID().compare(ownableTarget->getOwnerUUID()) == + 0) { // We're attacking something owned by the same person... return false; } diff --git a/Minecraft.World/AI/Navigation/PathFinder.cpp b/Minecraft.World/AI/Navigation/PathFinder.cpp index 84af25c56..3ceb018a0 100644 --- a/Minecraft.World/AI/Navigation/PathFinder.cpp +++ b/Minecraft.World/AI/Navigation/PathFinder.cpp @@ -170,10 +170,11 @@ Node* PathFinder::getNode(Entity* entity, int x, int y, int z, Node* size, // fell too far? if (++drop >= 4) return nullptr; // 4J - rolling this back to pre-java 1.6.4 - // version as we're suspicious of the performance - // implications of this - // if (drop++ >= - // entity->getMaxFallDistance()) return nullptr; + // version as we're suspicious of the + // performance implications of this + // if (drop++ >= + // entity->getMaxFallDistance()) return + // nullptr; y--; if (y > 0) best = getNode(x, y, z); diff --git a/Minecraft.World/AI/Navigation/PathNavigation.cpp b/Minecraft.World/AI/Navigation/PathNavigation.cpp index 811ba923b..35da31448 100644 --- a/Minecraft.World/AI/Navigation/PathNavigation.cpp +++ b/Minecraft.World/AI/Navigation/PathNavigation.cpp @@ -137,7 +137,8 @@ void PathNavigation::updatePath() { // find first elevations in path int firstElevation = path->getSize(); - for (int i = path->getIndex(); path != nullptr && i < path->getSize(); ++i) { + for (int i = path->getIndex(); path != nullptr && i < path->getSize(); + ++i) { if ((int)path->get(i)->y != (int)mobPos.y) { firstElevation = i; break; diff --git a/Minecraft.World/Blocks/AnvilTile.cpp b/Minecraft.World/Blocks/AnvilTile.cpp index f490bf2d0..7e4f025c1 100644 --- a/Minecraft.World/Blocks/AnvilTile.cpp +++ b/Minecraft.World/Blocks/AnvilTile.cpp @@ -16,8 +16,7 @@ const unsigned int AnvilTile::ANVIL_NAMES[ANVIL_NAMES_LENGTH] = { std::wstring AnvilTile::TEXTURE_DAMAGE_NAMES[ANVIL_NAMES_LENGTH] = { L"anvil_top", L"anvil_top_damaged_1", L"anvil_top_damaged_2"}; -AnvilTile::AnvilTile(int id) - : HeavyTile(id, Material::heavyMetal, false) { +AnvilTile::AnvilTile(int id) : HeavyTile(id, Material::heavyMetal, false) { part = PART_BASE; setLightBlock(0); icons = nullptr; diff --git a/Minecraft.World/Blocks/BaseRailTile.cpp b/Minecraft.World/Blocks/BaseRailTile.cpp index 46f144fd3..26085e720 100644 --- a/Minecraft.World/Blocks/BaseRailTile.cpp +++ b/Minecraft.World/Blocks/BaseRailTile.cpp @@ -312,7 +312,9 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit) bool BaseRailTile::isUsesDataBit() { return usesDataBit; } -std::optional BaseRailTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional BaseRailTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool BaseRailTile::blocksLight() { return false; } diff --git a/Minecraft.World/Blocks/BeaconTile.cpp b/Minecraft.World/Blocks/BeaconTile.cpp index 7dbd6aa35..5ed7c98e5 100644 --- a/Minecraft.World/Blocks/BeaconTile.cpp +++ b/Minecraft.World/Blocks/BeaconTile.cpp @@ -4,8 +4,7 @@ #include "../Headers/net.minecraft.world.level.tile.entity.h" #include "BeaconTile.h" -BeaconTile::BeaconTile(int id) - : BaseEntityTile(id, Material::glass, false) { +BeaconTile::BeaconTile(int id) : BaseEntityTile(id, Material::glass, false) { setDestroyTime(3.0f); } diff --git a/Minecraft.World/Blocks/BedTile.cpp b/Minecraft.World/Blocks/BedTile.cpp index 186b4b02b..2db5bdac6 100644 --- a/Minecraft.World/Blocks/BedTile.cpp +++ b/Minecraft.World/Blocks/BedTile.cpp @@ -9,8 +9,7 @@ int BedTile::HEAD_DIRECTION_OFFSETS[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}}; -BedTile::BedTile(int id) - : DirectionalTile(id, Material::cloth, false) { +BedTile::BedTile(int id) : DirectionalTile(id, Material::cloth, false) { setShape(); iconEnd = nullptr; diff --git a/Minecraft.World/Blocks/ButtonTile.cpp b/Minecraft.World/Blocks/ButtonTile.cpp index bf0cb742e..b77abf25d 100644 --- a/Minecraft.World/Blocks/ButtonTile.cpp +++ b/Minecraft.World/Blocks/ButtonTile.cpp @@ -21,7 +21,9 @@ Icon* ButtonTile::getTexture(int face, int data) { return Tile::stone->getTexture(Facing::UP); } -std::optional ButtonTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional ButtonTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} int ButtonTile::getTickDelay(Level* level) { return sensitive ? 30 : 20; } diff --git a/Minecraft.World/Blocks/CactusTile.cpp b/Minecraft.World/Blocks/CactusTile.cpp index 62cfb7b2f..8ce97f40a 100644 --- a/Minecraft.World/Blocks/CactusTile.cpp +++ b/Minecraft.World/Blocks/CactusTile.cpp @@ -35,7 +35,8 @@ void CactusTile::tick(Level* level, int x, int y, int z, Random* random) { std::optional CactusTile::getAABB(Level* level, int x, int y, int z) { float r = 1 / 16.0f; - return AABB{x + r, static_cast(y), z + r, x + 1 - r, y + 1 - r, z + 1 - r}; + return AABB{x + r, static_cast(y), z + r, x + 1 - r, y + 1 - r, + z + 1 - r}; } AABB CactusTile::getTileAABB(Level* level, int x, int y, int z) { diff --git a/Minecraft.World/Blocks/CakeTile.cpp b/Minecraft.World/Blocks/CakeTile.cpp index ad687e6b2..83b2749f7 100644 --- a/Minecraft.World/Blocks/CakeTile.cpp +++ b/Minecraft.World/Blocks/CakeTile.cpp @@ -39,7 +39,8 @@ std::optional CakeTile::getAABB(Level* level, int x, int y, int z) { float r = 1 / 16.0f; float r2 = (1 + d * 2) / 16.0f; float h = 8 / 16.0f; - return AABB{x + r2, static_cast(y), z + r, x + 1 - r, y + h - r, z + 1 - r}; + return AABB{x + r2, static_cast(y), z + r, x + 1 - r, y + h - r, + z + 1 - r}; } AABB CakeTile::getTileAABB(Level* level, int x, int y, int z) { diff --git a/Minecraft.World/Blocks/CauldronTile.cpp b/Minecraft.World/Blocks/CauldronTile.cpp index d8589e61f..5aeacabf6 100644 --- a/Minecraft.World/Blocks/CauldronTile.cpp +++ b/Minecraft.World/Blocks/CauldronTile.cpp @@ -11,8 +11,7 @@ const std::wstring CauldronTile::TEXTURE_INSIDE = L"cauldron_inner"; const std::wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; -CauldronTile::CauldronTile(int id) - : Tile(id, Material::metal, false) { +CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, false) { iconInner = nullptr; iconTop = nullptr; iconBottom = nullptr; diff --git a/Minecraft.World/Blocks/CocoaTile.cpp b/Minecraft.World/Blocks/CocoaTile.cpp index 73449170d..7c06ba874 100644 --- a/Minecraft.World/Blocks/CocoaTile.cpp +++ b/Minecraft.World/Blocks/CocoaTile.cpp @@ -10,8 +10,7 @@ const std::wstring CocoaTile::TEXTURE_AGES[] = {L"cocoa_0", L"cocoa_1", L"cocoa_2"}; -CocoaTile::CocoaTile(int id) - : DirectionalTile(id, Material::plant, false) { +CocoaTile::CocoaTile(int id) : DirectionalTile(id, Material::plant, false) { setTicking(true); } diff --git a/Minecraft.World/Blocks/DoorTile.cpp b/Minecraft.World/Blocks/DoorTile.cpp index 1c2692370..5e3faf703 100644 --- a/Minecraft.World/Blocks/DoorTile.cpp +++ b/Minecraft.World/Blocks/DoorTile.cpp @@ -11,8 +11,7 @@ const std::wstring DoorTile::TEXTURES[] = { L"doorWood_lower", L"doorWood_upper", L"doorIron_lower", L"doorIron_upper"}; -DoorTile::DoorTile(int id, Material* material) - : Tile(id, material, false) { +DoorTile::DoorTile(int id, Material* material) : Tile(id, material, false) { if (material == Material::metal) { texBase = 2; } else { diff --git a/Minecraft.World/Blocks/DropperTile.cpp b/Minecraft.World/Blocks/DropperTile.cpp index b7e1f13c6..906a6e380 100644 --- a/Minecraft.World/Blocks/DropperTile.cpp +++ b/Minecraft.World/Blocks/DropperTile.cpp @@ -60,7 +60,8 @@ void DropperTile::dispenseFrom(Level* level, int x, int y, int z) { } } else { remaining = DISPENSE_BEHAVIOUR->dispense(&source, item); - if (remaining != nullptr && remaining->count == 0) remaining = nullptr; + if (remaining != nullptr && remaining->count == 0) + remaining = nullptr; } trap->setItem(slot, remaining); diff --git a/Minecraft.World/Blocks/FallingTile.cpp b/Minecraft.World/Blocks/FallingTile.cpp index b8ff427bf..53d664c58 100644 --- a/Minecraft.World/Blocks/FallingTile.cpp +++ b/Minecraft.World/Blocks/FallingTile.cpp @@ -114,7 +114,8 @@ void FallingTile::tick() { if (hv) { hv->onLand(level, xt, yt, zt, data); } - if (tileData != nullptr && Tile::tiles[tile]->isEntityTile()) { + if (tileData != nullptr && + Tile::tiles[tile]->isEntityTile()) { std::shared_ptr tileEntity = level->getTileEntity(xt, yt, zt); diff --git a/Minecraft.World/Blocks/FireTile.cpp b/Minecraft.World/Blocks/FireTile.cpp index ce4ff7b81..3ee78cdbb 100644 --- a/Minecraft.World/Blocks/FireTile.cpp +++ b/Minecraft.World/Blocks/FireTile.cpp @@ -58,7 +58,9 @@ void FireTile::setFlammable(int id, int flame, int burn) { burnOdds[id] = burn; } -std::optional FireTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional FireTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool FireTile::blocksLight() { return false; } @@ -345,9 +347,6 @@ void FireTile::registerIcons(IconRegister* iconRegister) { icons[1] = iconRegister->registerIcon(TEXTURE_SECOND); } -Icon* FireTile::getTextureLayer(int layer) { - - return icons[layer]; -} +Icon* FireTile::getTextureLayer(int layer) { return icons[layer]; } Icon* FireTile::getTexture(int face, int data) { return icons[0]; } diff --git a/Minecraft.World/Blocks/FlowerPotTile.cpp b/Minecraft.World/Blocks/FlowerPotTile.cpp index 4e1dc5599..5c9ff9835 100644 --- a/Minecraft.World/Blocks/FlowerPotTile.cpp +++ b/Minecraft.World/Blocks/FlowerPotTile.cpp @@ -5,8 +5,7 @@ #include "../Headers/net.minecraft.world.level.tile.h" #include "FlowerPotTile.h" -FlowerPotTile::FlowerPotTile(int id) - : Tile(id, Material::decoration, false) { +FlowerPotTile::FlowerPotTile(int id) : Tile(id, Material::decoration, false) { updateDefaultShape(); sendTileData(); } diff --git a/Minecraft.World/Blocks/GrassTile.cpp b/Minecraft.World/Blocks/GrassTile.cpp index b1a41e2d5..0781505d4 100644 --- a/Minecraft.World/Blocks/GrassTile.cpp +++ b/Minecraft.World/Blocks/GrassTile.cpp @@ -110,7 +110,6 @@ int GrassTile::getResource(int data, Random* random, int playerBonusLevel) { } Icon* GrassTile::getSideTextureOverlay() { - return Tile::grass->iconSideOverlay; } diff --git a/Minecraft.World/Blocks/HopperTile.cpp b/Minecraft.World/Blocks/HopperTile.cpp index 7915cc05e..ac6bf32b1 100644 --- a/Minecraft.World/Blocks/HopperTile.cpp +++ b/Minecraft.World/Blocks/HopperTile.cpp @@ -11,8 +11,7 @@ const std::wstring HopperTile::TEXTURE_OUTSIDE = L"hopper_outside"; const std::wstring HopperTile::TEXTURE_INSIDE = L"hopper_inside"; -HopperTile::HopperTile(int id) - : BaseEntityTile(id, Material::metal, false) { +HopperTile::HopperTile(int id) : BaseEntityTile(id, Material::metal, false) { setShape(0, 0, 0, 1, 1, 1); } diff --git a/Minecraft.World/Blocks/JukeboxTile.cpp b/Minecraft.World/Blocks/JukeboxTile.cpp index 3897b5a48..e0615cc61 100644 --- a/Minecraft.World/Blocks/JukeboxTile.cpp +++ b/Minecraft.World/Blocks/JukeboxTile.cpp @@ -155,5 +155,5 @@ int JukeboxTile::getAnalogOutputSignal(Level* level, int x, int y, int z, level->getTileEntity(x, y, z)) ->getRecord(); return record == nullptr ? Redstone::SIGNAL_NONE - : record->id + 1 - Item::record_01_Id; + : record->id + 1 - Item::record_01_Id; } \ No newline at end of file diff --git a/Minecraft.World/Blocks/LadderTile.cpp b/Minecraft.World/Blocks/LadderTile.cpp index 06b016284..f061eceed 100644 --- a/Minecraft.World/Blocks/LadderTile.cpp +++ b/Minecraft.World/Blocks/LadderTile.cpp @@ -3,8 +3,7 @@ #include "LadderTile.h" #include "Util/AABB.h" -LadderTile::LadderTile(int id) - : Tile(id, Material::decoration, false) {} +LadderTile::LadderTile(int id) : Tile(id, Material::decoration, false) {} std::optional LadderTile::getAABB(Level* level, int x, int y, int z) { updateShape(level, x, y, z); diff --git a/Minecraft.World/Blocks/LeverTile.cpp b/Minecraft.World/Blocks/LeverTile.cpp index ffb8deead..11e8db00f 100644 --- a/Minecraft.World/Blocks/LeverTile.cpp +++ b/Minecraft.World/Blocks/LeverTile.cpp @@ -5,10 +5,11 @@ #include "LeverTile.h" #include "Util/AABB.h" -LeverTile::LeverTile(int id) - : Tile(id, Material::decoration, false) {} +LeverTile::LeverTile(int id) : Tile(id, Material::decoration, false) {} -std::optional LeverTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional LeverTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool LeverTile::blocksLight() { return false; } diff --git a/Minecraft.World/Blocks/MelonTile.cpp b/Minecraft.World/Blocks/MelonTile.cpp index b18f6be12..c392b90fa 100644 --- a/Minecraft.World/Blocks/MelonTile.cpp +++ b/Minecraft.World/Blocks/MelonTile.cpp @@ -4,7 +4,9 @@ #include "../Headers/net.minecraft.world.h" #include "../Util/Facing.h" -MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) { iconTop = nullptr; } +MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) { + iconTop = nullptr; +} Icon* MelonTile::getTexture(int face, int data) { if (face == Facing::UP || face == Facing::DOWN) return iconTop; diff --git a/Minecraft.World/Blocks/MobSpawner.cpp b/Minecraft.World/Blocks/MobSpawner.cpp index 63f8de2c0..123e88295 100644 --- a/Minecraft.World/Blocks/MobSpawner.cpp +++ b/Minecraft.World/Blocks/MobSpawner.cpp @@ -333,7 +333,6 @@ bool MobSpawner::isSpawnPositionOk(MobCategory* category, Level* level, int x, // can happen on another thread if (!level->hasChunkAt(x, y, z)) return false; - if (category->getSpawnPositionMaterial() == Material::water) { // 4J - changed to spawn water things only in deep water int yo = 0; diff --git a/Minecraft.World/Blocks/PistonMovingTileEntity.h b/Minecraft.World/Blocks/PistonMovingTileEntity.h index ec3a5aa7f..4b0fd1849 100644 --- a/Minecraft.World/Blocks/PistonMovingTileEntity.h +++ b/Minecraft.World/Blocks/PistonMovingTileEntity.h @@ -34,8 +34,8 @@ public: std::shared_ptr forceEntity = std::shared_ptr< TileEntity>()); // 4J added forceData, forceEntity param - std::optional getAABB(Level* level, int x, int y, int z, int tile, float progress, - int facing); + std::optional getAABB(Level* level, int x, int y, int z, int tile, + float progress, int facing); private: std::shared_ptr getEntity(LevelSource* level, int x, diff --git a/Minecraft.World/Blocks/PlantTile.cpp b/Minecraft.World/Blocks/PlantTile.cpp index 543008466..5789a441c 100644 --- a/Minecraft.World/Blocks/PlantTile.cpp +++ b/Minecraft.World/Blocks/PlantTile.cpp @@ -9,9 +9,7 @@ void Bush::_init() { updateDefaultShape(); } -Bush::Bush(int id, Material* material) : Tile(id, material, false) { - _init(); -} +Bush::Bush(int id, Material* material) : Tile(id, material, false) { _init(); } Bush::Bush(int id) : Tile(id, Material::plant, false) { _init(); } @@ -53,7 +51,9 @@ bool Bush::canSurvive(Level* level, int x, int y, int z) { mayPlaceOn(level->getTile(x, y - 1, z)); } -std::optional Bush::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional Bush::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool Bush::blocksLight() { return false; } diff --git a/Minecraft.World/Blocks/PortalTile.cpp b/Minecraft.World/Blocks/PortalTile.cpp index 0629d13dc..4a4a9e133 100644 --- a/Minecraft.World/Blocks/PortalTile.cpp +++ b/Minecraft.World/Blocks/PortalTile.cpp @@ -37,7 +37,9 @@ void PortalTile::tick(Level* level, int x, int y, int z, Random* random) { } } -std::optional PortalTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional PortalTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} void PortalTile::updateShape( LevelSource* level, int x, int y, int z, int forceData, diff --git a/Minecraft.World/Blocks/PoweredRailTile.cpp b/Minecraft.World/Blocks/PoweredRailTile.cpp index 20ff4f56b..a75fc74b9 100644 --- a/Minecraft.World/Blocks/PoweredRailTile.cpp +++ b/Minecraft.World/Blocks/PoweredRailTile.cpp @@ -88,8 +88,8 @@ bool PoweredRailTile::findPoweredRailSignal(Level* level, int x, int y, int z, if (isSameRailWithPower(level, x, y, z, forward, searchDepth, dir)) { return true; } - if (checkBelow && isSameRailWithPower(level, x, y - 1, z, forward, - searchDepth, dir)) { + if (checkBelow && + isSameRailWithPower(level, x, y - 1, z, forward, searchDepth, dir)) { return true; } return false; @@ -117,8 +117,8 @@ bool PoweredRailTile::isSameRailWithPower(Level* level, int x, int y, int z, if (level->hasNeighborSignal(x, y, z)) { return true; } else { - return findPoweredRailSignal(level, x, y, z, tileData, - forward, searchDepth + 1); + return findPoweredRailSignal(level, x, y, z, tileData, forward, + searchDepth + 1); } } } diff --git a/Minecraft.World/Blocks/PoweredRailTile.h b/Minecraft.World/Blocks/PoweredRailTile.h index 9d334137c..841be6105 100644 --- a/Minecraft.World/Blocks/PoweredRailTile.h +++ b/Minecraft.World/Blocks/PoweredRailTile.h @@ -16,11 +16,9 @@ public: protected: virtual bool findPoweredRailSignal(Level* level, int x, int y, int z, - int data, bool forward, - int searchDepth); + int data, bool forward, int searchDepth); virtual bool isSameRailWithPower(Level* level, int x, int y, int z, - bool forward, int searchDepth, - int dir); + bool forward, int searchDepth, int dir); virtual void updateState(Level* level, int x, int y, int z, int data, int dir, int type); }; \ No newline at end of file diff --git a/Minecraft.World/Blocks/RedStoneDustTile.cpp b/Minecraft.World/Blocks/RedStoneDustTile.cpp index 0301cb839..8babbeaf9 100644 --- a/Minecraft.World/Blocks/RedStoneDustTile.cpp +++ b/Minecraft.World/Blocks/RedStoneDustTile.cpp @@ -423,7 +423,6 @@ void RedStoneDustTile::registerIcons(IconRegister* iconRegister) { } Icon* RedStoneDustTile::getTexture(const std::wstring& name) { - if (name.compare(TEXTURE_CROSS) == 0) return Tile::redStoneDust->iconCross; if (name.compare(TEXTURE_LINE) == 0) return Tile::redStoneDust->iconLine; if (name.compare(TEXTURE_CROSS_OVERLAY) == 0) diff --git a/Minecraft.World/Blocks/ReedTile.cpp b/Minecraft.World/Blocks/ReedTile.cpp index 7961dbaeb..716cf471e 100644 --- a/Minecraft.World/Blocks/ReedTile.cpp +++ b/Minecraft.World/Blocks/ReedTile.cpp @@ -65,7 +65,9 @@ bool ReedTile::canSurvive(Level* level, int x, int y, int z) { return mayPlace(level, x, y, z); } -std::optional ReedTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional ReedTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} int ReedTile::getResource(int data, Random* random, int playerBonusLevel) { return Item::reeds->id; diff --git a/Minecraft.World/Blocks/SignTile.cpp b/Minecraft.World/Blocks/SignTile.cpp index 7a62f9248..85c53aaf1 100644 --- a/Minecraft.World/Blocks/SignTile.cpp +++ b/Minecraft.World/Blocks/SignTile.cpp @@ -25,7 +25,9 @@ void SignTile::updateDefaultShape() { this->setShape(0.5f - r, 0, 0.5f - r, 0.5f + r, h, 0.5f + r); } -std::optional SignTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional SignTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} AABB SignTile::getTileAABB(Level* level, int x, int y, int z) { updateShape(level, x, y, z); diff --git a/Minecraft.World/Blocks/SkullTile.cpp b/Minecraft.World/Blocks/SkullTile.cpp index 002868bcd..8594baaad 100644 --- a/Minecraft.World/Blocks/SkullTile.cpp +++ b/Minecraft.World/Blocks/SkullTile.cpp @@ -8,8 +8,7 @@ #include "../Headers/net.minecraft.h" #include "SkullTile.h" -SkullTile::SkullTile(int id) - : BaseEntityTile(id, Material::decoration, false) { +SkullTile::SkullTile(int id) : BaseEntityTile(id, Material::decoration, false) { setShape(4.0f / 16.0f, 0, 4.0f / 16.0f, 12.0f / 16.0f, .5f, 12.0f / 16.0f); } diff --git a/Minecraft.World/Blocks/Tile.cpp b/Minecraft.World/Blocks/Tile.cpp index f312d74d7..995e37598 100644 --- a/Minecraft.World/Blocks/Tile.cpp +++ b/Minecraft.World/Blocks/Tile.cpp @@ -1713,7 +1713,8 @@ void Tile::staticCtor() { bool propagate = false; if (i > 0 && Tile::tiles[i]->getRenderShape() == Tile::SHAPE_STAIRS) propagate = true; - if (i > 0 && dynamic_cast(Tile::tiles[i]) != nullptr) { + if (i > 0 && + dynamic_cast(Tile::tiles[i]) != nullptr) { propagate = true; } if (i == Tile::farmland_Id) propagate = true; @@ -2602,8 +2603,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 (0 || 0 || 0 || defined __linux__) const int Tile::stone_Id; const int Tile::grass_Id; const int Tile::dirt_Id; diff --git a/Minecraft.World/Blocks/Tile.h b/Minecraft.World/Blocks/Tile.h index 8c9d33566..baffa8ebb 100644 --- a/Minecraft.World/Blocks/Tile.h +++ b/Minecraft.World/Blocks/Tile.h @@ -59,6 +59,7 @@ protected: ThreadStorage(); }; static thread_local ThreadStorage* m_tlsShape; + public: // Each new thread that needs to use Vec3 pools will need to call one of the // following 2 functions, to either create its own local storage, or share diff --git a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp index 795ef0afa..8341a6758 100644 --- a/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/BrewingStandTileEntity.cpp @@ -71,7 +71,8 @@ void BrewingStandTileEntity::tick() { int BrewingStandTileEntity::getBrewTime() { return brewTime; } bool BrewingStandTileEntity::isBrewable() { - if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0) { + if (items[INGREDIENT_SLOT] == nullptr || + items[INGREDIENT_SLOT]->count <= 0) { return false; } std::shared_ptr ingredient = items[INGREDIENT_SLOT]; diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp index e8298ed52..2a17b1566 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp @@ -218,13 +218,16 @@ void ChestTileEntity::checkNeighbors() { n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH); if (s.lock() != nullptr) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH); - if (e.lock() != nullptr) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); - if (w.lock() != nullptr) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); + if (e.lock() != nullptr) + e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); + if (w.lock() != nullptr) + w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); } bool ChestTileEntity::isSameChest(int x, int y, int z) { Tile* tile = Tile::tiles[level->getTile(x, y, z)]; - if (tile == nullptr || !(dynamic_cast(tile) != nullptr)) return false; + if (tile == nullptr || !(dynamic_cast(tile) != nullptr)) + return false; return ((ChestTile*)tile)->type == getType(); } @@ -338,7 +341,8 @@ void ChestTileEntity::startOpen() { } void ChestTileEntity::stopOpen() { - if (getTile() == nullptr || !(dynamic_cast(getTile()) != nullptr)) + if (getTile() == nullptr || + !(dynamic_cast(getTile()) != nullptr)) return; openCount--; level->tileEvent(x, y, z, getTile()->id, ChestTile::EVENT_SET_OPEN_COUNT, @@ -360,7 +364,8 @@ void ChestTileEntity::setRemoved() { int ChestTileEntity::getType() { if (type == -1) { - if (level != nullptr && dynamic_cast(getTile()) != nullptr) { + if (level != nullptr && + dynamic_cast(getTile()) != nullptr) { type = ((ChestTile*)getTile())->type; } else { return ChestTile::TYPE_BASIC; diff --git a/Minecraft.World/Blocks/TileEntities/DaylightDetectorTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/DaylightDetectorTileEntity.cpp index b342c3d61..786dda13d 100644 --- a/Minecraft.World/Blocks/TileEntities/DaylightDetectorTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/DaylightDetectorTileEntity.cpp @@ -9,7 +9,8 @@ void DaylightDetectorTileEntity::tick() { if (level != nullptr && !level->isClientSide && (level->getGameTime() % SharedConstants::TICKS_PER_SECOND) == 0) { tile = getTile(); - if (tile != nullptr && dynamic_cast(tile) != nullptr) { + if (tile != nullptr && + dynamic_cast(tile) != nullptr) { ((DaylightDetectorTile*)tile)->updateSignalStrength(level, x, y, z); } } diff --git a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp index c3ac0ed33..56185e42a 100644 --- a/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/FurnaceTileEntity.cpp @@ -176,9 +176,10 @@ void FurnaceTileEntity::tick() { ->getItem() ->getCraftingRemainingItem(); items[SLOT_FUEL] = - remaining != nullptr ? std::shared_ptr( - new ItemInstance(remaining)) - : nullptr; + remaining != nullptr + ? std::shared_ptr( + new ItemInstance(remaining)) + : nullptr; } } } diff --git a/Minecraft.World/Blocks/TileEntities/HopperTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/HopperTileEntity.cpp index e4645eb39..d12b38315 100644 --- a/Minecraft.World/Blocks/TileEntities/HopperTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/HopperTileEntity.cpp @@ -219,7 +219,8 @@ bool HopperTileEntity::tryTakeInItemFromSlot(Hopper* hopper, int face) { std::shared_ptr item = container->getItem(slot); - if (item != nullptr && canTakeItemFromContainer(container, item, slot, face)) { + if (item != nullptr && + canTakeItemFromContainer(container, item, slot, face)) { std::shared_ptr original = item->copy(); std::shared_ptr result = addItem(hopper, container->removeItem(slot, 1), -1); diff --git a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp index 40d9fca8f..6862471b6 100644 --- a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp @@ -93,8 +93,8 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) { collisionHolder.push_back(*it); } - for (auto it = collisionHolder.begin(); - it != collisionHolder.end(); it++) { + for (auto it = collisionHolder.begin(); it != collisionHolder.end(); + it++) { (*it)->move(amount * Facing::STEP_X[facing], amount * Facing::STEP_Y[facing], amount * Facing::STEP_Z[facing]); diff --git a/Minecraft.World/Blocks/TopSnowTile.cpp b/Minecraft.World/Blocks/TopSnowTile.cpp index cd5182116..54a5ea5a3 100644 --- a/Minecraft.World/Blocks/TopSnowTile.cpp +++ b/Minecraft.World/Blocks/TopSnowTile.cpp @@ -26,7 +26,7 @@ std::optional TopSnowTile::getAABB(Level* level, int x, int y, int z) { float offset = 2.0f / SharedConstants::WORLD_RESOLUTION; ThreadStorage* tls = m_tlsShape; return AABB(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, - y + (height * offset), z + tls->zz1); + y + (height * offset), z + tls->zz1); } float TopSnowTile::getHeight(Level* level, int x, int y, int z) { diff --git a/Minecraft.World/Blocks/TorchTile.cpp b/Minecraft.World/Blocks/TorchTile.cpp index 4932ff4fc..c3d742531 100644 --- a/Minecraft.World/Blocks/TorchTile.cpp +++ b/Minecraft.World/Blocks/TorchTile.cpp @@ -10,7 +10,9 @@ TorchTile::TorchTile(int id) : Tile(id, Material::decoration, false) { this->setTicking(true); } -std::optional TorchTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional TorchTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} AABB TorchTile::getTileAABB(Level* level, int x, int y, int z) { updateShape(level, x, y, z); diff --git a/Minecraft.World/Blocks/TripWireSourceTile.cpp b/Minecraft.World/Blocks/TripWireSourceTile.cpp index c9115901e..f2e4a4a30 100644 --- a/Minecraft.World/Blocks/TripWireSourceTile.cpp +++ b/Minecraft.World/Blocks/TripWireSourceTile.cpp @@ -12,7 +12,8 @@ TripWireSourceTile::TripWireSourceTile(int id) this->setTicking(true); } -std::optional TripWireSourceTile::getAABB(Level* level, int x, int y, int z) { +std::optional TripWireSourceTile::getAABB(Level* level, int x, int y, + int z) { return std::nullopt; } diff --git a/Minecraft.World/Blocks/TripWireTile.cpp b/Minecraft.World/Blocks/TripWireTile.cpp index aae4aa76c..3fc850110 100644 --- a/Minecraft.World/Blocks/TripWireTile.cpp +++ b/Minecraft.World/Blocks/TripWireTile.cpp @@ -17,7 +17,9 @@ int TripWireTile::getTickDelay(Level* level) { return 20; // 10; } -std::optional TripWireTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional TripWireTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool TripWireTile::blocksLight() { return false; } diff --git a/Minecraft.World/Blocks/VineTile.cpp b/Minecraft.World/Blocks/VineTile.cpp index 57de96e58..3c527ece7 100644 --- a/Minecraft.World/Blocks/VineTile.cpp +++ b/Minecraft.World/Blocks/VineTile.cpp @@ -9,8 +9,7 @@ #include "../Headers/net.minecraft.world.level.biome.h" #include "Util/AABB.h" -VineTile::VineTile(int id) - : Tile(id, Material::replaceable_plant, false) { +VineTile::VineTile(int id) : Tile(id, Material::replaceable_plant, false) { setTicking(true); } @@ -86,7 +85,9 @@ void VineTile::updateShape( setShape(minX, minY, minZ, maxX, maxY, maxZ); } -std::optional VineTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional VineTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} bool VineTile::mayPlace(Level* level, int x, int y, int z, int face) { switch (face) { diff --git a/Minecraft.World/Blocks/WaterLilyTile.cpp b/Minecraft.World/Blocks/WaterLilyTile.cpp index 3110a2452..29f76bc34 100644 --- a/Minecraft.World/Blocks/WaterLilyTile.cpp +++ b/Minecraft.World/Blocks/WaterLilyTile.cpp @@ -28,7 +28,7 @@ std::optional WaterlilyTile::getAABB(Level* level, int x, int y, int z) { // 4J Stu - Added this so that the TLS shape is correct for this tile if (tls->tileId != this->id) updateDefaultShape(); return AABB(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, - y + tls->yy1, z + tls->zz1); + y + tls->yy1, z + tls->zz1); } int WaterlilyTile::getColor() const { diff --git a/Minecraft.World/Blocks/WebTile.cpp b/Minecraft.World/Blocks/WebTile.cpp index 26e8e909a..043079a99 100644 --- a/Minecraft.World/Blocks/WebTile.cpp +++ b/Minecraft.World/Blocks/WebTile.cpp @@ -13,7 +13,9 @@ void WebTile::entityInside(Level* level, int x, int y, int z, bool WebTile::isSolidRender(bool isServerLevel) { return false; } -std::optional WebTile::getAABB(Level* level, int x, int y, int z) { return std::nullopt; } +std::optional WebTile::getAABB(Level* level, int x, int y, int z) { + return std::nullopt; +} int WebTile::getRenderShape() { return Tile::SHAPE_CROSS_TEXTURE; } diff --git a/Minecraft.World/Blocks/WeightedPressurePlateTile.cpp b/Minecraft.World/Blocks/WeightedPressurePlateTile.cpp index e31a7c451..850a21dfc 100644 --- a/Minecraft.World/Blocks/WeightedPressurePlateTile.cpp +++ b/Minecraft.World/Blocks/WeightedPressurePlateTile.cpp @@ -22,8 +22,7 @@ int WeightedPressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) { AABB at_bb = getSensitiveAABB(x, y, z); int weightOfEntities = - level->getEntitiesOfClass(typeid(Entity), &at_bb) - ->size(); + level->getEntitiesOfClass(typeid(Entity), &at_bb)->size(); int count = std::min(weightOfEntities, maxWeight); if (count <= 0) { diff --git a/Minecraft.World/Blocks/WoolCarpetTile.cpp b/Minecraft.World/Blocks/WoolCarpetTile.cpp index 030285d7f..23222cb18 100644 --- a/Minecraft.World/Blocks/WoolCarpetTile.cpp +++ b/Minecraft.World/Blocks/WoolCarpetTile.cpp @@ -22,7 +22,7 @@ std::optional WoolCarpetTile::getAABB(Level* level, int x, int y, int z) { // 4J Stu - Added this so that the TLS shape is correct for this tile if (tls->tileId != this->id) updateDefaultShape(); return AABB(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, - y + (height * offset), z + tls->zz1); + y + (height * offset), z + tls->zz1); } bool WoolCarpetTile::blocksLight() { return false; } diff --git a/Minecraft.World/Containers/AbstractContainerMenu.cpp b/Minecraft.World/Containers/AbstractContainerMenu.cpp index b40fef4e2..2a8a89929 100644 --- a/Minecraft.World/Containers/AbstractContainerMenu.cpp +++ b/Minecraft.World/Containers/AbstractContainerMenu.cpp @@ -42,8 +42,8 @@ void AbstractContainerMenu::addSlotListener(ContainerListener* listener) { } void AbstractContainerMenu::removeSlotListener(ContainerListener* listener) { - auto it = find(containerListeners.begin(), containerListeners.end(), - listener); + auto it = + find(containerListeners.begin(), containerListeners.end(), listener); if (it != containerListeners.end()) containerListeners.erase(it); } @@ -367,8 +367,9 @@ std::shared_ptr AbstractContainerMenu::clicked( if (slot->mayPickup(player)) { std::shared_ptr current = inventory->getItem(buttonNum); - bool canMove = current == nullptr || (slot->container == inventory && - slot->mayPlace(current)); + bool canMove = + current == nullptr || + (slot->container == inventory && slot->mayPlace(current)); int freeSlot = -1; if (!canMove) { diff --git a/Minecraft.World/Containers/AnvilMenu.cpp b/Minecraft.World/Containers/AnvilMenu.cpp index 0ebaa8f99..03bf9509b 100644 --- a/Minecraft.World/Containers/AnvilMenu.cpp +++ b/Minecraft.World/Containers/AnvilMenu.cpp @@ -242,8 +242,7 @@ void AnvilMenu::createResult() { } int count = 0; - for (auto it = enchantments->begin(); it != enchantments->end(); - ++it) { + for (auto it = enchantments->begin(); it != enchantments->end(); ++it) { int id = it->first; Enchantment* enchantment = Enchantment::enchantments[id]; int level = it->second; diff --git a/Minecraft.World/Containers/BrewingStandMenu.cpp b/Minecraft.World/Containers/BrewingStandMenu.cpp index 9133fcfd8..78e152661 100644 --- a/Minecraft.World/Containers/BrewingStandMenu.cpp +++ b/Minecraft.World/Containers/BrewingStandMenu.cpp @@ -44,8 +44,8 @@ void BrewingStandMenu::broadcastChanges() { AbstractContainerMenu::broadcastChanges(); // for (int i = 0; i < containerListeners->size(); i++) - for (auto it = containerListeners.begin(); - it != containerListeners.end(); ++it) { + for (auto it = containerListeners.begin(); it != containerListeners.end(); + ++it) { ContainerListener* listener = *it; // containerListeners.at(i); if (tc != brewingStand->getBrewTime()) { listener->setContainerData(this, 0, brewingStand->getBrewTime()); diff --git a/Minecraft.World/Containers/ContainerMenu.cpp b/Minecraft.World/Containers/ContainerMenu.cpp index 0dd0c1956..6a5b71bdd 100644 --- a/Minecraft.World/Containers/ContainerMenu.cpp +++ b/Minecraft.World/Containers/ContainerMenu.cpp @@ -103,8 +103,7 @@ std::shared_ptr ContainerMenu::clicked( int minedCount = sc->getTotalValue(GenericStats::blocksMined(Tile::stone_Id)) + sc->getTotalValue(GenericStats::blocksMined(Tile::cobblestone_Id)); - if (cobblecount >= 1728 && minedCount >= 1728) - { + if (cobblecount >= 1728 && minedCount >= 1728) { localPlayer->awardStat( GenericStats::chestfulOfCobblestone(), GenericStats::param_chestfulOfCobblestone(cobblecount)); diff --git a/Minecraft.World/Containers/Inventory.cpp b/Minecraft.World/Containers/Inventory.cpp index 3ce081614..ea30b2cee 100644 --- a/Minecraft.World/Containers/Inventory.cpp +++ b/Minecraft.World/Containers/Inventory.cpp @@ -602,10 +602,12 @@ bool Inventory::stillValid(std::shared_ptr player) { bool Inventory::contains(std::shared_ptr itemInstance) { for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) return true; + if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) + return true; } for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != nullptr && items[i]->sameItem(itemInstance)) return true; + if (items[i] != nullptr && items[i]->sameItem(itemInstance)) + return true; } return false; } diff --git a/Minecraft.World/Containers/MerchantRecipe.cpp b/Minecraft.World/Containers/MerchantRecipe.cpp index 614b081e4..ace323517 100644 --- a/Minecraft.World/Containers/MerchantRecipe.cpp +++ b/Minecraft.World/Containers/MerchantRecipe.cpp @@ -55,7 +55,8 @@ bool MerchantRecipe::isSame(MerchantRecipe* other) { return false; } return (buyB == nullptr && other->buyB == nullptr) || - (buyB != nullptr && other->buyB != nullptr && buyB->id == other->buyB->id); + (buyB != nullptr && other->buyB != nullptr && + buyB->id == other->buyB->id); } bool MerchantRecipe::isSameSameButBetter(MerchantRecipe* other) { diff --git a/Minecraft.World/Containers/RepairResultSlot.cpp b/Minecraft.World/Containers/RepairResultSlot.cpp index d8f0a6f49..75a1318df 100644 --- a/Minecraft.World/Containers/RepairResultSlot.cpp +++ b/Minecraft.World/Containers/RepairResultSlot.cpp @@ -33,7 +33,8 @@ void RepairResultSlot::onTake(std::shared_ptr player, if (m_menu->repairItemCountCost > 0) { std::shared_ptr addition = m_menu->repairSlots->getItem(AnvilMenu::ADDITIONAL_SLOT); - if (addition != nullptr && addition->count > m_menu->repairItemCountCost) { + if (addition != nullptr && + addition->count > m_menu->repairItemCountCost) { addition->count -= m_menu->repairItemCountCost; m_menu->repairSlots->setItem(AnvilMenu::ADDITIONAL_SLOT, addition); } else { diff --git a/Minecraft.World/Containers/Slot.cpp b/Minecraft.World/Containers/Slot.cpp index 1ecdd27aa..45bdea020 100644 --- a/Minecraft.World/Containers/Slot.cpp +++ b/Minecraft.World/Containers/Slot.cpp @@ -117,7 +117,8 @@ std::shared_ptr Slot::combine( std::shared_ptr first = getItem(); std::shared_ptr craftSlots = - std::shared_ptr(new CraftingContainer(nullptr, 2, 2)); + std::shared_ptr( + new CraftingContainer(nullptr, 2, 2)); craftSlots->setItem(0, item); craftSlots->setItem(1, first); diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.cpp b/Minecraft.World/Enchantments/EnchantmentHelper.cpp index a573f7be5..80e20b8cb 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.cpp +++ b/Minecraft.World/Enchantments/EnchantmentHelper.cpp @@ -377,8 +377,8 @@ std::vector* EnchantmentHelper::selectEnchantment( int nextEnchantment = it->first; // mapIter.next(); bool valid = true; // for (EnchantmentInstance *current : results) - for (auto resIt = results->begin(); - resIt != results->end(); ++resIt) { + for (auto resIt = results->begin(); resIt != results->end(); + ++resIt) { EnchantmentInstance* current = *resIt; if (!current->enchantment->isCompatibleWith( Enchantment::enchantments[nextEnchantment])) { diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index 3da8a941a..a7dbc71e3 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -1730,7 +1730,9 @@ std::wstring Entity::getAName() { #endif } -std::vector >* Entity::getSubEntities() { return nullptr; } +std::vector >* Entity::getSubEntities() { + return nullptr; +} bool Entity::is(std::shared_ptr other) { return shared_from_this() == other; diff --git a/Minecraft.World/Entities/ItemEntity.cpp b/Minecraft.World/Entities/ItemEntity.cpp index 0a04f5bfd..a6627c6cc 100644 --- a/Minecraft.World/Entities/ItemEntity.cpp +++ b/Minecraft.World/Entities/ItemEntity.cpp @@ -96,8 +96,8 @@ void ItemEntity::tick() { float friction = 0.98f; if (onGround) { friction = 0.6f * 0.98f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); + int t = + level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, Mth::floor(z)); if (t > 0) { friction = Tile::tiles[t]->friction * 0.98f; } diff --git a/Minecraft.World/Entities/LivingEntity.cpp b/Minecraft.World/Entities/LivingEntity.cpp index 8c9288d2f..ef84a0837 100644 --- a/Minecraft.World/Entities/LivingEntity.cpp +++ b/Minecraft.World/Entities/LivingEntity.cpp @@ -378,8 +378,7 @@ void LivingEntity::addAdditonalSaveData(CompoundTag* entityTag) { if (!activeEffects.empty()) { ListTag* listTag = new ListTag(); - for (auto it = activeEffects.begin(); it != activeEffects.end(); - ++it) { + for (auto it = activeEffects.begin(); it != activeEffects.end(); ++it) { MobEffectInstance* effect = it->second; listTag->add(effect->save(new CompoundTag())); } @@ -390,7 +389,8 @@ void LivingEntity::addAdditonalSaveData(CompoundTag* entityTag) { void LivingEntity::readAdditionalSaveData(CompoundTag* tag) { setAbsorptionAmount(tag->getFloat(L"AbsorptionAmount")); - if (tag->contains(L"Attributes") && level != nullptr && !level->isClientSide) { + if (tag->contains(L"Attributes") && level != nullptr && + !level->isClientSide) { SharedMonsterAttributes::loadAttributes( getAttributes(), (ListTag*)tag->getList(L"Attributes")); @@ -460,8 +460,8 @@ void LivingEntity::tickEffects() { setWeakened(false); } else { std::vector values; - for (auto it = activeEffects.begin(); - it != activeEffects.end(); ++it) { + for (auto it = activeEffects.begin(); it != activeEffects.end(); + ++it) { values.push_back(it->second); } int colorValue = PotionBrewing::getColorValue(&values); @@ -684,7 +684,8 @@ bool LivingEntity::hurt(DamageSource* source, float dmg) { // Stu - Change to the fix to only show damage when attacked, rather than // collision damage Fix for #10299 - When in corners, passive mobs may show // that they are taking damage. 4J Stu - Change to the fix for TU6, as - // source is never nullptr due to changes in 1.8.2 to what source actually is + // source is never nullptr due to changes in 1.8.2 to what source actually + // is if (level->isClientSide && dynamic_cast(source) == nullptr) return false; @@ -824,7 +825,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)); @@ -952,7 +954,8 @@ int LivingEntity::getArmorValue() { ItemInstanceArray items = getEquipmentSlots(); for (unsigned int i = 0; i < items.length; ++i) { std::shared_ptr item = items[i]; - if (item != nullptr && dynamic_cast(item->getItem()) != nullptr) { + if (item != nullptr && + dynamic_cast(item->getItem()) != nullptr) { int baseProtection = ((ArmorItem*)item->getItem())->defense; val += baseProtection; } @@ -1023,7 +1026,8 @@ void LivingEntity::actuallyHurt(DamageSource* source, float dmg) { CombatTracker* LivingEntity::getCombatTracker() { return combatTracker; } std::shared_ptr LivingEntity::getKillCredit() { - if (combatTracker->getKiller() != nullptr) return combatTracker->getKiller(); + if (combatTracker->getKiller() != nullptr) + return combatTracker->getKiller(); if (lastHurtByPlayer != nullptr) return lastHurtByPlayer; if (lastHurtByMob != nullptr) return lastHurtByMob; return nullptr; @@ -1411,9 +1415,11 @@ void LivingEntity::tick() { shared_from_this(), std::shared_ptr( new SetEquippedItemPacket(entityId, i, current))); - if (previous != nullptr) attributes->removeItemModifiers(previous); + if (previous != nullptr) + attributes->removeItemModifiers(previous); if (current != nullptr) attributes->addItemModifiers(current); - lastEquipment[i] = current == nullptr ? nullptr : current->copy(); + lastEquipment[i] = + current == nullptr ? nullptr : current->copy(); } } } diff --git a/Minecraft.World/Entities/MinecartHopper.cpp b/Minecraft.World/Entities/MinecartHopper.cpp index ef70622c7..58ad09612 100644 --- a/Minecraft.World/Entities/MinecartHopper.cpp +++ b/Minecraft.World/Entities/MinecartHopper.cpp @@ -86,9 +86,8 @@ bool MinecartHopper::suckInItems() { if (HopperTileEntity::suckInItems(this)) return true; AABB grown = bb.grow(0.25, 0, 0.25); - std::vector >* items = - level->getEntitiesOfClass(typeid(ItemEntity), &grown, - EntitySelector::ENTITY_STILL_ALIVE); + std::vector >* items = level->getEntitiesOfClass( + typeid(ItemEntity), &grown, EntitySelector::ENTITY_STILL_ALIVE); if (items->size() > 0) { HopperTileEntity::addItem( diff --git a/Minecraft.World/Entities/Mob.cpp b/Minecraft.World/Entities/Mob.cpp index 8c7caa2b0..270b5d112 100644 --- a/Minecraft.World/Entities/Mob.cpp +++ b/Minecraft.World/Entities/Mob.cpp @@ -301,7 +301,7 @@ void Mob::aiStep() { if (!level->isClientSide && canPickUpLoot() && !dead && level->getGameRules()->getBoolean(GameRules::RULE_MOBGRIEFING)) { - AABB grown = bb.grow(1, 0, 1); + AABB grown = bb.grow(1, 0, 1); std::vector >* entities = level->getEntitiesOfClass(typeid(ItemEntity), &grown); for (auto it = entities->begin(); it != entities->end(); ++it) { @@ -323,7 +323,8 @@ void Mob::aiStep() { dynamic_cast(current->getItem()); if (newWeapon != nullptr && oldWeapon == nullptr) { replace = true; - } else if (newWeapon != nullptr && oldWeapon != nullptr) { + } else if (newWeapon != nullptr && + oldWeapon != nullptr) { if (newWeapon->getTierDamage() == oldWeapon->getTierDamage()) { replace = item->getAuxValue() > @@ -850,10 +851,8 @@ void Mob::restoreLeashFromSave() { std::wstring leashUuid = leashInfoTag->getString(L"UUID"); AABB grown = bb.grow(10, 10, 10); std::vector >* livingEnts = - level->getEntitiesOfClass(typeid(LivingEntity), - &grown); - for (auto it = livingEnts->begin(); it != livingEnts->end(); - ++it) { + level->getEntitiesOfClass(typeid(LivingEntity), &grown); + for (auto it = livingEnts->begin(); it != livingEnts->end(); ++it) { std::shared_ptr le = std::dynamic_pointer_cast(*it); if (le->getUUID().compare(leashUuid) == 0) { diff --git a/Minecraft.World/Entities/MobEffect.cpp b/Minecraft.World/Entities/MobEffect.cpp index fb61e406e..418cbb7bd 100644 --- a/Minecraft.World/Entities/MobEffect.cpp +++ b/Minecraft.World/Entities/MobEffect.cpp @@ -412,8 +412,8 @@ MobEffect::getAttributeModifiers() { void MobEffect::removeAttributeModifiers(std::shared_ptr entity, BaseAttributeMap* attributes, int amplifier) { - for (auto it = attributeModifiers.begin(); - it != attributeModifiers.end(); ++it) { + for (auto it = attributeModifiers.begin(); it != attributeModifiers.end(); + ++it) { AttributeInstance* attribute = attributes->getInstance(it->first); if (attribute != nullptr) { @@ -425,8 +425,8 @@ void MobEffect::removeAttributeModifiers(std::shared_ptr entity, void MobEffect::addAttributeModifiers(std::shared_ptr entity, BaseAttributeMap* attributes, int amplifier) { - for (auto it = attributeModifiers.begin(); - it != attributeModifiers.end(); ++it) { + for (auto it = attributeModifiers.begin(); it != attributeModifiers.end(); + ++it) { AttributeInstance* attribute = attributes->getInstance(it->first); if (attribute != nullptr) { diff --git a/Minecraft.World/Entities/Mobs/Animal.cpp b/Minecraft.World/Entities/Mobs/Animal.cpp index 822f5106d..7fbc4b9c2 100644 --- a/Minecraft.World/Entities/Mobs/Animal.cpp +++ b/Minecraft.World/Entities/Mobs/Animal.cpp @@ -84,7 +84,8 @@ void Animal::checkHurtTarget(std::shared_ptr target, float d) { holdGround = true; } } else if (getInLoveValue() > 0 && a->getInLoveValue() > 0) { - if (a->attackTarget == nullptr) a->attackTarget = shared_from_this(); + if (a->attackTarget == nullptr) + a->attackTarget = shared_from_this(); if (a->attackTarget == shared_from_this() && d < 3.5) { a->setInLoveValue(a->getInLoveValue() + 1); diff --git a/Minecraft.World/Entities/Mobs/Blaze.cpp b/Minecraft.World/Entities/Mobs/Blaze.cpp index 6766d7c83..dc1306dee 100644 --- a/Minecraft.World/Entities/Mobs/Blaze.cpp +++ b/Minecraft.World/Entities/Mobs/Blaze.cpp @@ -99,8 +99,7 @@ void Blaze::checkHurtTarget(std::shared_ptr target, float d) { doHurtTarget(target); } else if (d < 30) { double xd = target->x - x; - double yd = - (target->bb.y0 + target->bbHeight / 2) - (y + bbHeight / 2); + double yd = (target->bb.y0 + target->bbHeight / 2) - (y + bbHeight / 2); double zd = target->z - z; if (attackTime == 0) { diff --git a/Minecraft.World/Entities/Mobs/Boat.cpp b/Minecraft.World/Entities/Mobs/Boat.cpp index 2d186dd2c..7d151c603 100644 --- a/Minecraft.World/Entities/Mobs/Boat.cpp +++ b/Minecraft.World/Entities/Mobs/Boat.cpp @@ -241,7 +241,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; diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.cpp b/Minecraft.World/Entities/Mobs/EnderDragon.cpp index 7254b718a..2db34b8fc 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.cpp +++ b/Minecraft.World/Entities/Mobs/EnderDragon.cpp @@ -464,8 +464,7 @@ void EnderDragon::aiStep() { std::vector >* targets = level->getEntities(shared_from_this(), &m_acidArea); - for (auto it = targets->begin(); it != targets->end(); - ++it) { + for (auto it = targets->begin(); it != targets->end(); ++it) { if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { // app.DebugPrintf("Attacking entity with acid\n"); std::shared_ptr e = @@ -688,7 +687,7 @@ void EnderDragon::aiStep() { double acidY = y + yOffset + ssTilt * 10.5f; double acidZ = z - cc * 9.5f * ccTilt; m_acidArea = {acidX - 5, acidY - 17, acidZ - 5, - acidX + 5, acidY + 4, acidZ + 5}; + acidX + 5, acidY + 4, acidZ + 5}; // app.DebugPrintf("\nDragon is %s, yRot = %f, yRotA = %f, ss = %f, cc = // %f, ccTilt = %f\n",level->isClientSide?"client":"server", yRot, @@ -794,8 +793,8 @@ void EnderDragon::aiStep() { // End fireball attack if (!level->isClientSide) { - inWall = - checkWalls(&head->bb) | checkWalls(&neck->bb) | checkWalls(&body->bb); + inWall = checkWalls(&head->bb) | checkWalls(&neck->bb) | + checkWalls(&body->bb); } } diff --git a/Minecraft.World/Entities/Mobs/EntityHorse.cpp b/Minecraft.World/Entities/Mobs/EntityHorse.cpp index e797f3319..98e01f758 100644 --- a/Minecraft.World/Entities/Mobs/EntityHorse.cpp +++ b/Minecraft.World/Entities/Mobs/EntityHorse.cpp @@ -538,7 +538,8 @@ void EntityHorse::playStepSound(int xt, int yt, int zt, int t) { } if (!Tile::tiles[t]->material->isLiquid()) { int type = getType(); - if (rider.lock() != nullptr && type != TYPE_DONKEY && type != TYPE_MULE) { + if (rider.lock() != nullptr && type != TYPE_DONKEY && + type != TYPE_MULE) { gallopSoundCounter++; if (gallopSoundCounter > 5 && gallopSoundCounter % 3 == 0) { playSound(eSoundType_MOB_HORSE_GALLOP, @@ -904,7 +905,8 @@ void EntityHorse::aiStep() { heal(1); } - if (!isEating() && rider.lock() == nullptr && random->nextInt(300) == 0) { + if (!isEating() && rider.lock() == nullptr && + random->nextInt(300) == 0) { if (level->getTile(Mth::floor(x), Mth::floor(y) - 1, Mth::floor(z)) == Tile::grass_Id) { setEating(true); @@ -1012,8 +1014,8 @@ void EntityHorse::openMouth() { } bool EntityHorse::isReadyForParenting() { - return rider.lock() == nullptr && riding == nullptr && isTamed() && isAdult() && - !isSterile() && getHealth() >= getMaxHealth(); + return rider.lock() == nullptr && riding == nullptr && isTamed() && + isAdult() && !isSterile() && getHealth() >= getMaxHealth(); } bool EntityHorse::renderName() { diff --git a/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp b/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp index 92f648e9b..a187fea38 100644 --- a/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp +++ b/Minecraft.World/Entities/Mobs/ExperienceOrb.cpp @@ -121,8 +121,8 @@ void ExperienceOrb::tick() { float friction = 0.98f; if (onGround) { friction = 0.6f * 0.98f; - int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, - Mth::floor(z)); + int t = + level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, Mth::floor(z)); if (t > 0) { friction = Tile::tiles[t]->friction * 0.98f; } diff --git a/Minecraft.World/Entities/Mobs/FishingHook.cpp b/Minecraft.World/Entities/Mobs/FishingHook.cpp index 9b755a07b..57c01e41c 100644 --- a/Minecraft.World/Entities/Mobs/FishingHook.cpp +++ b/Minecraft.World/Entities/Mobs/FishingHook.cpp @@ -284,10 +284,10 @@ void FishingHook::tick() { int steps = 5; double waterPercentage = 0; for (int i = 0; i < steps; i++) { - double y0 = bb.y0 + (bb.y1 - bb.y0) * (i + 0) / steps - 2 / 16.0f + - 2 / 16.0f; - double y1 = bb.y0 + (bb.y1 - bb.y0) * (i + 1) / steps - 2 / 16.0f + - 2 / 16.0f; + double y0 = + bb.y0 + (bb.y1 - bb.y0) * (i + 0) / steps - 2 / 16.0f + 2 / 16.0f; + double y1 = + bb.y0 + (bb.y1 - bb.y0) * (i + 1) / steps - 2 / 16.0f + 2 / 16.0f; AABB bb2(bb.x0, y0, bb.z0, bb.x1, y1, bb.z1); if (level->containsLiquid(&bb2, Material::water)) { waterPercentage += 1.0 / steps; diff --git a/Minecraft.World/Entities/Mobs/Minecart.cpp b/Minecraft.World/Entities/Mobs/Minecart.cpp index 17916a72e..d66e830e2 100644 --- a/Minecraft.World/Entities/Mobs/Minecart.cpp +++ b/Minecraft.World/Entities/Mobs/Minecart.cpp @@ -55,7 +55,8 @@ void Minecart::_init() { Minecart::Minecart(Level* level) : Entity(level) { _init(); - // soundUpdater = level != nullptr ? level->makeSoundUpdater(this) : nullptr; + // soundUpdater = level != nullptr ? level->makeSoundUpdater(this) : + // nullptr; } Minecart::~Minecart() {} @@ -201,7 +202,8 @@ void Minecart::tick() { outOfWorld(); } - if (!level->isClientSide && dynamic_cast(level) != nullptr) { + if (!level->isClientSide && + dynamic_cast(level) != nullptr) { MinecraftServer* server = ((ServerLevel*)level)->getServer(); int waitTime = getPortalWaitTime(); @@ -407,7 +409,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()); diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index 121e56cbc..e0b19a30f 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -127,8 +127,7 @@ void Villager::serverAiMobStep() { // improve max uses for all obsolete recipes if (offers->size() > 0) { // for (MerchantRecipe recipe : offers) - for (auto it = offers->begin(); it != offers->end(); - ++it) { + for (auto it = offers->begin(); it != offers->end(); ++it) { MerchantRecipe* recipe = *it; if (recipe->isDeprecated()) { recipe->increaseMaxUses(random->nextInt(6) + @@ -234,7 +233,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; @@ -254,11 +253,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/Minecraft.World/Entities/Mobs/Witch.cpp b/Minecraft.World/Entities/Mobs/Witch.cpp index e329c81be..40e40e77f 100644 --- a/Minecraft.World/Entities/Mobs/Witch.cpp +++ b/Minecraft.World/Entities/Mobs/Witch.cpp @@ -93,8 +93,8 @@ void Witch::aiStep() { std::vector* effects = Item::potion->getMobEffects(item); if (effects != nullptr) { - for (auto it = effects->begin(); - it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); + ++it) { addEffect(new MobEffectInstance(*it)); } } diff --git a/Minecraft.World/Entities/Mobs/Wolf.cpp b/Minecraft.World/Entities/Mobs/Wolf.cpp index db23fd439..21ff4e4fc 100644 --- a/Minecraft.World/Entities/Mobs/Wolf.cpp +++ b/Minecraft.World/Entities/Mobs/Wolf.cpp @@ -243,7 +243,7 @@ bool Wolf::hurt(DamageSource* source, float dmg) { std::shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || - sourceEntity->instanceof(eTYPE_ARROW))) { + sourceEntity->instanceof(eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; } diff --git a/Minecraft.World/Entities/PathfinderMob.cpp b/Minecraft.World/Entities/PathfinderMob.cpp index eb51a8760..b87662e2b 100644 --- a/Minecraft.World/Entities/PathfinderMob.cpp +++ b/Minecraft.World/Entities/PathfinderMob.cpp @@ -79,13 +79,14 @@ void PathfinderMob::serverAiStep() { // had their flag set through the considerForExtraWandering method so that // these can keep doing random strolling. - if (!holdGround && - (attackTarget != nullptr && (path == nullptr || random->nextInt(20) == 0))) { + if (!holdGround && (attackTarget != nullptr && + (path == nullptr || random->nextInt(20) == 0))) { setPath(level->findPath(shared_from_this(), attackTarget, maxDist, true, false, false, true)); // 4J - changed to setPath from path = } else if (!holdGround && - ((path == nullptr && (random->nextInt(180) == 0) || fleeTime > 0) || + ((path == nullptr && (random->nextInt(180) == 0) || + fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) { if (noActionTime < SharedConstants::TICKS_PER_SECOND * 5) { findRandomStrollLocation(); diff --git a/Minecraft.World/Entities/SyncedEntityData.cpp b/Minecraft.World/Entities/SyncedEntityData.cpp index ba57c5649..74dcc1bdd 100644 --- a/Minecraft.World/Entities/SyncedEntityData.cpp +++ b/Minecraft.World/Entities/SyncedEntityData.cpp @@ -77,8 +77,7 @@ void SynchedEntityData::defineNULL(int id, void* pVal) { m_isEmpty = false; } -void SynchedEntityData::checkId(int id) { -} +void SynchedEntityData::checkId(int id) {} uint8_t SynchedEntityData::getByte(int id) { return itemsById[id]->getValue_byte(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFile.h b/Minecraft.World/IO/Files/ConsoleSaveFile.h index 7627b2116..93ae12cd8 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFile.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFile.h @@ -40,7 +40,6 @@ public: virtual std::vector* getRegionFilesByDimension( unsigned int dimensionIndex) = 0; - virtual int getSaveVersion() = 0; virtual int getOriginalSaveVersion() = 0; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index 9041f3bdc..5df018def 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -267,8 +267,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, // region files std::vector* allFilesInSave = sourceSave->getFilesWithPrefix(std::wstring(L"")); - for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); - ++it) { + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; if (fe != sourceLdatFe) { std::wstring fName(fe->data.filename); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 7abb318cf..78da41b70 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -139,10 +139,9 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal( 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); + void* pvRet = + VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, + COMMIT_ALLOCATION, PAGE_READWRITE); if (pvRet == nullptr) { // Out of physical memory __debugbreak(); @@ -588,10 +587,9 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { const auto startTime = std::chrono::steady_clock::now(); Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem, fileSize); - fElapsedTime = - std::chrono::duration(std::chrono::steady_clock::now() - - startTime) - .count(); + fElapsedTime = std::chrono::duration( + std::chrono::steady_clock::now() - startTime) + .count(); app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -611,10 +609,9 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { const auto startTime = std::chrono::steady_clock::now(); Compression::getCompression()->Compress(compData + 8, &compLength, pvSaveMem, fileSize); - fElapsedTime = - std::chrono::duration(std::chrono::steady_clock::now() - - startTime) - .count(); + fElapsedTime = std::chrono::duration( + std::chrono::steady_clock::now() - startTime) + .count(); app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); PIXEndNamedEvent(); @@ -701,7 +698,8 @@ int ConsoleSaveFileOriginal::SaveSaveDataCallback(void* lpParam, bool bRes) { #ifndef _CONTENT_PACKAGE void ConsoleSaveFileOriginal::DebugFlushToFile( - void* compressedData /*= nullptr*/, unsigned int compressedDataSize /*= 0*/) { + void* compressedData /*= nullptr*/, + unsigned int compressedDataSize /*= 0*/) { LockSaveAccess(); finalizeWrite(); @@ -727,8 +725,8 @@ void ConsoleSaveFileOriginal::DebugFlushToFile( } swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH + 1, L"\\v%04d-%ls%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); + cutFileName.c_str(), t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, + t.tm_sec); const std::wstring outputPath = targetFileDir.getPath() + std::wstring(fileName); @@ -857,8 +855,7 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { // convert each of the region files to the local platform std::vector* allFilesInSave = getFilesWithPrefix(std::wstring(L"")); - for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); - ++it) { + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; std::wstring fName(fe->data.filename); std::wstring suffix(L".mcr"); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h index 7ca7e7cf6..9dd6a5805 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.h @@ -33,7 +33,8 @@ public: static int SaveSaveDataCallback(void* lpParam, bool bRes); #endif ConsoleSaveFileOriginal(const std::wstring& fileName, - void* pvSaveData = nullptr, unsigned int fileSize = 0, + void* pvSaveData = nullptr, + unsigned int fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); virtual ~ConsoleSaveFileOriginal(); @@ -75,7 +76,6 @@ public: virtual std::vector* getRegionFilesByDimension( unsigned int dimensionIndex); - virtual int getSaveVersion(); virtual int getOriginalSaveVersion(); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 31bc923f1..dd3eeb4f3 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -176,7 +176,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Compress() { // std::int64_t endTime = System::currentTimeMillis(); // app.DebugPrintf("Compressing region file 0x%.8x from %d to %d bytes - //%dms\n", fileEntry->data.regionIndex, fileEntry->data.length, - //dataCompressedSize, endTime - startTime); + // dataCompressedSize, endTime - startTime); } // Decompress from dataCompressed -> data. See comment in Compress method for @@ -256,7 +256,7 @@ void ConsoleSaveFileSplit::RegionFileReference::Decompress() { // std::int64_t endTime = System::currentTimeMillis(); // app.DebugPrintf("Decompressing region file from 0x%.8x %d to %d bytes - //%dms\n", fileEntry->data.regionIndex, dataCompressedSize, - //fileEntry->data.length, endTime - startTime);// + // fileEntry->data.length, endTime - startTime);// } unsigned int ConsoleSaveFileSplit::RegionFileReference::GetCompressedSize() { @@ -315,7 +315,7 @@ unsigned int ConsoleSaveFileSplit::RegionFileReference::GetCompressedSize() { // Release dataCompressed void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed() { // app.DebugPrintf("Releasing compressed data for region file from - //0x%.8x\n", fileEntry->data.regionIndex ); + // 0x%.8x\n", fileEntry->data.regionIndex ); free(dataCompressed); dataCompressed = nullptr; dataCompressedSize = 0; @@ -376,8 +376,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile* sourceSave, sourceSave->getFilesWithPrefix(L""); unsigned int bytesWritten = 0; - for (auto it = sourceFiles->begin(); it != sourceFiles->end(); - ++it) { + for (auto it = sourceFiles->begin(); it != sourceFiles->end(); ++it) { FileEntry* sourceEntry = *it; sourceSave->setFilePointer(sourceEntry, 0, SaveFileSeekOrigin::Begin); @@ -705,9 +704,9 @@ bool ConsoleSaveFileSplit::writeFile(FileEntry* file, const void* lpBuffer, nNumberOfBytesToWrite); // app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's - //data 0x%.8x, 0x%x offset %d of %d bytes (writing %d - //bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, - //file->getFileSize(), nNumberOfBytesToWrite); + // data 0x%.8x, 0x%x offset %d of %d bytes (writing %d + // bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, + // file->getFileSize(), nNumberOfBytesToWrite); file->currentFilePointer += nNumberOfBytesToWrite; file->updateLastModifiedTime(); @@ -772,9 +771,9 @@ bool ConsoleSaveFileSplit::zeroFile(FileEntry* file, nNumberOfBytesToWrite); // app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's - //data 0x%.8x, 0x%x offset %d of %d bytes (writing %d - //bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, - //file->getFileSize(), nNumberOfBytesToWrite); + // data 0x%.8x, 0x%x offset %d of %d bytes (writing %d + // bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, + // file->getFileSize(), nNumberOfBytesToWrite); file->currentFilePointer += nNumberOfBytesToWrite; file->updateLastModifiedTime(); @@ -950,8 +949,8 @@ void ConsoleSaveFileSplit::tick() { regionRef->Compress(); // app.DebugPrintf("Tick: Writing region 0x%.8x, compressed - //as %d bytes\n",regionRef->fileEntry->getRegionFileIndex(), - //regionRef->dataCompressedSize); + // as %d bytes\n",regionRef->fileEntry->getRegionFileIndex(), + // regionRef->dataCompressedSize); StorageManager.UpdateSubfile(regionRef->index, regionRef->dataCompressed, regionRef->dataCompressedSize); @@ -1253,11 +1252,9 @@ bool ConsoleSaveFileSplit::doesFileExist(ConsoleSavePath file) { void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { LockSaveAccess(); - // The storage manage might potentially be busy doing a sub-file write // initiated from the tick. Wait until this is totally processed. while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle) { - app.DebugPrintf("Flush wait\n"); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } @@ -1348,7 +1345,6 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { std::uint8_t* pbDataSaveImage = nullptr; unsigned int dwDataSizeSaveImage = 0; - std::uint8_t bTextMetadata[88]; ZeroMemory(bTextMetadata, 88); @@ -1419,7 +1415,8 @@ int ConsoleSaveFileSplit::SaveRegionFilesCallback(void* lpParam, bool bRes) { #if !defined(_CONTENT_PACKAGE) void ConsoleSaveFileSplit::DebugFlushToFile( - void* compressedData /*= nullptr*/, unsigned int compressedDataSize /*= 0*/) { + void* compressedData /*= nullptr*/, + unsigned int compressedDataSize /*= 0*/) { LockSaveAccess(); finalizeWrite(); @@ -1501,7 +1498,6 @@ std::vector* ConsoleSaveFileSplit::getRegionFilesByDimension( return files; } - int ConsoleSaveFileSplit::getSaveVersion() { return header.getSaveVersion(); } int ConsoleSaveFileSplit::getOriginalSaveVersion() { @@ -1583,8 +1579,7 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { // convert each of the region files to the local platform std::vector* allFilesInSave = getFilesWithPrefix(std::wstring(L"")); - for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); - ++it) { + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; std::wstring fName(fe->data.filename); std::wstring suffix(L".mcr"); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h index 971d859b5..19950dfee 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.h @@ -99,8 +99,9 @@ private: unsigned int fileSize, ESavePlatform plat); public: - ConsoleSaveFileSplit(const std::wstring& fileName, void* pvSaveData = nullptr, - unsigned int fileSize = 0, bool forceCleanSave = false, + ConsoleSaveFileSplit(const std::wstring& fileName, + void* pvSaveData = nullptr, unsigned int fileSize = 0, + bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); ConsoleSaveFileSplit(ConsoleSaveFile* sourceSave, bool alreadySmallRegions = true, @@ -145,7 +146,6 @@ public: virtual std::vector* getRegionFilesByDimension( unsigned int dimensionIndex); - virtual int getSaveVersion(); virtual int getOriginalSaveVersion(); diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index 6af09503f..a679e2ddc 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -177,16 +177,18 @@ void FileHeader::ReadHeader( switch (m_saveVersion) { // case SAVE_FILE_VERSION_NUMBER: // case 8: // 4J Stu - SAVE_FILE_VERSION_NUMBER 2,3,4,5,6,7,8 are the - // same, but: : Bumped it to 3 in TU5 to force older builds (ie 0062) to - //generate a new world when trying to load new saves : Bumped it to 4 in - //TU9 to delete versions of The End that were generated in builds prior - //to TU9 : Bumped it to 5 in TU9 to update the map data that was only - //using 1 bit to determine dimension : Bumped it to 6 for PS3 v1 to - //update map data mappings to use larger PlayerUID : Bumped it to 7 for - //Durango v1 to update map data mappings to use string based PlayerUID - // : Bumped it to 8 - //for Durango v1 when to save the chunks in a different compressed - //format + // same, but: : Bumped + // it to 3 in TU5 to force older builds (ie 0062) to + // generate a new world when trying to load new saves + // : Bumped it to 4 in TU9 to delete versions of The End that were + // generated in builds prior to TU9 + // : Bumped it to 5 in TU9 to update the map data that was only using 1 + // bit to determine dimension + // : Bumped it to 6 for PS3 v1 to update map data mappings to use larger + // PlayerUID : Bumped + // it to 7 for Durango v1 to update map data mappings to use string + // based PlayerUID : Bumped it to 8 for Durango v1 when to save the + // chunks in a different compressed format case SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE: case SAVE_FILE_VERSION_DURANGO_CHANGE_MAP_DATA_MAPPING_SIZE: case SAVE_FILE_VERSION_CHANGE_MAP_DATA_MAPPING_SIZE: @@ -338,7 +340,6 @@ std::vector* FileHeader::getFilesWithPrefix( return files; } - ByteOrder FileHeader::getEndian(ESavePlatform plat) { ByteOrder platEndian; switch (plat) { diff --git a/Minecraft.World/IO/Files/FileHeader.h b/Minecraft.World/IO/Files/FileHeader.h index 68cd0505a..256f6c6c2 100644 --- a/Minecraft.World/IO/Files/FileHeader.h +++ b/Minecraft.World/IO/Files/FileHeader.h @@ -183,7 +183,6 @@ protected: std::vector* getValidPlayerDatFiles(); - void setSaveVersion(int version) { m_saveVersion = version; } int getSaveVersion() { return m_saveVersion; } void setOriginalSaveVersion(int version) { diff --git a/Minecraft.World/IO/NBT/CompoundTag.h b/Minecraft.World/IO/NBT/CompoundTag.h index 2629ebd16..26fbd90af 100644 --- a/Minecraft.World/IO/NBT/CompoundTag.h +++ b/Minecraft.World/IO/NBT/CompoundTag.h @@ -173,9 +173,7 @@ public: return (ListTag*)tags[name]; } - bool getBoolean(const std::wstring& string) { - return getByte(string) != 0; - } + bool getBoolean(const std::wstring& string) { return getByte(string) != 0; } void remove(const std::wstring& name) { auto it = tags.find(name); diff --git a/Minecraft.World/IO/NBT/ListTag.h b/Minecraft.World/IO/NBT/ListTag.h index 7df99ae4a..3177964de 100644 --- a/Minecraft.World/IO/NBT/ListTag.h +++ b/Minecraft.World/IO/NBT/ListTag.h @@ -115,8 +115,8 @@ public: // sizes of the data sets for (auto it = list.begin(); it != itEnd; ++it) { bool thisMatches = false; - for (auto it2 = o->list.begin(); - it2 != o->list.end(); ++it2) { + for (auto it2 = o->list.begin(); it2 != o->list.end(); + ++it2) { if ((*it)->equals(*it2)) { thisMatches = true; break; diff --git a/Minecraft.World/IO/Streams/ByteArrayInputStream.h b/Minecraft.World/IO/Streams/ByteArrayInputStream.h index 290cef2db..28f2ece6f 100644 --- a/Minecraft.World/IO/Streams/ByteArrayInputStream.h +++ b/Minecraft.World/IO/Streams/ByteArrayInputStream.h @@ -9,7 +9,7 @@ protected: // stream. unsigned int count; // The index one greater than the last valid character // in the input stream buffer. - unsigned int mark; // The currently marked position in the stream. + unsigned int mark; // The currently marked position in the stream. unsigned int pos; // The index of the next character to read from the input // stream buffer. diff --git a/Minecraft.World/IO/Streams/ByteBuffer.cpp b/Minecraft.World/IO/Streams/ByteBuffer.cpp index 358088ee4..96168693c 100644 --- a/Minecraft.World/IO/Streams/ByteBuffer.cpp +++ b/Minecraft.World/IO/Streams/ByteBuffer.cpp @@ -428,4 +428,3 @@ FloatBuffer* ByteBuffer::asFloatBuffer() { return new FloatBuffer((m_limit - m_position) / 4, (float*)(buffer + m_position)); } - diff --git a/Minecraft.World/IO/Streams/ByteBuffer.h b/Minecraft.World/IO/Streams/ByteBuffer.h index 8ef81176a..74dd5fafd 100644 --- a/Minecraft.World/IO/Streams/ByteBuffer.h +++ b/Minecraft.World/IO/Streams/ByteBuffer.h @@ -41,4 +41,3 @@ public: IntBuffer* asIntBuffer(); FloatBuffer* asFloatBuffer(); }; - diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index da7662638..cb7cf0f86 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -10,7 +10,8 @@ #undef Byte #endif -thread_local Compression::ThreadStorage* Compression::m_tlsCompression = nullptr; +thread_local Compression::ThreadStorage* Compression::m_tlsCompression = + nullptr; Compression::ThreadStorage* Compression::m_tlsCompressionDefault = nullptr; Compression::ThreadStorage::ThreadStorage() { compression = new Compression(); } @@ -445,7 +446,6 @@ Compression::Compression() { } Compression::~Compression() { - XMemDestroyCompressionContext(compressionContext); XMemDestroyDecompressionContext(decompressionContext); DeleteCriticalSection(&rleCompressLock); diff --git a/Minecraft.World/IO/Streams/DataInputStream.cpp b/Minecraft.World/IO/Streams/DataInputStream.cpp index 38f22f148..3cc3988ac 100644 --- a/Minecraft.World/IO/Streams/DataInputStream.cpp +++ b/Minecraft.World/IO/Streams/DataInputStream.cpp @@ -18,7 +18,8 @@ DataInputStream::DataInputStream(InputStream* in) : stream(in) {} int DataInputStream::read() { if (stream == nullptr) { app.DebugPrintf( - "DataInputStream::read() called but underlying stream is nullptr\n"); + "DataInputStream::read() called but underlying stream is " + "nullptr\n"); return -1; } return stream->read(); @@ -104,7 +105,8 @@ int DataInputStream::read(byteArray b, unsigned int offset, void DataInputStream::close() { if (stream == nullptr) { app.DebugPrintf( - "DataInputStream::close() called but underlying stream is nullptr\n"); + "DataInputStream::close() called but underlying stream is " + "nullptr\n"); return; } stream->close(); @@ -116,7 +118,8 @@ void DataInputStream::close() { bool DataInputStream::readBoolean() { if (stream == nullptr) { app.DebugPrintf( - "DataInputStream::readBoolean() but underlying stream is nullptr\n"); + "DataInputStream::readBoolean() but underlying stream is " + "nullptr\n"); return false; } return stream->read() != 0; @@ -513,7 +516,8 @@ int DataInputStream::readUTFChar() { int returnValue = -1; if (stream == nullptr) { app.DebugPrintf( - "DataInputStream::readUTFChar() but underlying stream is nullptr\n"); + "DataInputStream::readUTFChar() but underlying stream is " + "nullptr\n"); return returnValue; } int firstByte = stream->read(); diff --git a/Minecraft.World/IO/Streams/DataOutputStream.cpp b/Minecraft.World/IO/Streams/DataOutputStream.cpp index b1e19d614..fc5d80451 100644 --- a/Minecraft.World/IO/Streams/DataOutputStream.cpp +++ b/Minecraft.World/IO/Streams/DataOutputStream.cpp @@ -34,7 +34,8 @@ void DataOutputStream::write(unsigned int b) { void DataOutputStream::flush() { if (stream == nullptr) { app.DebugPrintf( - "DataOutputStream::flush() called but underlying stream is nullptr\n"); + "DataOutputStream::flush() called but underlying stream is " + "nullptr\n"); return; } stream->flush(); @@ -68,7 +69,8 @@ void DataOutputStream::write(byteArray b, unsigned int offset, void DataOutputStream::close() { if (stream == nullptr) { app.DebugPrintf( - "DataOutputStream::close() called but underlying stream is nullptr\n"); + "DataOutputStream::close() called but underlying stream is " + "nullptr\n"); return; } stream->close(); @@ -254,6 +256,4 @@ void DataOutputStream::writeUTF(const std::wstring& str) { } // 4J Added -void DataOutputStream::writePlayerUID(PlayerUID player) { - writeLong(player); -} +void DataOutputStream::writePlayerUID(PlayerUID player) { writeLong(player); } diff --git a/Minecraft.World/IO/Streams/Reader.h b/Minecraft.World/IO/Streams/Reader.h index 48f881aba..81585a940 100644 --- a/Minecraft.World/IO/Streams/Reader.h +++ b/Minecraft.World/IO/Streams/Reader.h @@ -6,7 +6,7 @@ public: virtual void close() = 0; // Closes the stream and releases any system // resources associated with it. - virtual int read() = 0; // Reads a single character. + virtual int read() = 0; // Reads a single character. virtual int read( wchar_t cbuf[], unsigned int off, unsigned int len) = 0; // Reads characters into a portion of an array. diff --git a/Minecraft.World/Items/DyePowderItem.cpp b/Minecraft.World/Items/DyePowderItem.cpp index c4c8ac6cc..6ea385dcc 100644 --- a/Minecraft.World/Items/DyePowderItem.cpp +++ b/Minecraft.World/Items/DyePowderItem.cpp @@ -247,7 +247,8 @@ void DyePowderItem::addGrowthParticles(Level* level, int x, int y, int z, int count) { int id = level->getTile(x, y, z); if (count == 0) count = 15; - Tile* tile = id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; + Tile* tile = + id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; if (tile == nullptr) return; tile->updateShape(level, x, y, z); diff --git a/Minecraft.World/Items/HatchetItem.cpp b/Minecraft.World/Items/HatchetItem.cpp index f763ed0e3..7247e1caf 100644 --- a/Minecraft.World/Items/HatchetItem.cpp +++ b/Minecraft.World/Items/HatchetItem.cpp @@ -24,8 +24,8 @@ HatchetItem::HatchetItem(int id, const Tier* tier) float HatchetItem::getDestroySpeed(std::shared_ptr itemInstance, Tile* tile) { if (tile != nullptr && (tile->material == Material::wood || - tile->material == Material::plant || - tile->material == Material::replaceable_plant)) { + tile->material == Material::plant || + tile->material == Material::replaceable_plant)) { return speed; } return DiggerItem::getDestroySpeed(itemInstance, tile); diff --git a/Minecraft.World/Items/Item.cpp b/Minecraft.World/Items/Item.cpp index 24b4651ad..2e3cdc4e0 100644 --- a/Minecraft.World/Items/Item.cpp +++ b/Minecraft.World/Items/Item.cpp @@ -1519,7 +1519,9 @@ bool Item::shouldOverrideMultiplayerNBT() { return true; } Item* Item::getCraftingRemainingItem() { return craftingRemainingItem; } -bool Item::hasCraftingRemainingItem() { return craftingRemainingItem != nullptr; } +bool Item::hasCraftingRemainingItem() { + return craftingRemainingItem != nullptr; +} std::wstring Item::getName() { return L""; // I18n::get(getDescriptionId() + L".name"); @@ -1647,8 +1649,7 @@ attrAttrModMap* Item::getDefaultAttributeModifiers() { 4J: These are necesary on the PS3. (and 4 and Vita). */ -#if (0 || 0 || 0 || \ - defined __linux__) +#if (0 || 0 || 0 || defined __linux__) const int Item::shovel_iron_Id; const int Item::pickAxe_iron_Id; const int Item::hatchet_iron_Id; diff --git a/Minecraft.World/Items/ItemInstance.cpp b/Minecraft.World/Items/ItemInstance.cpp index 940640bf2..2e01eb296 100644 --- a/Minecraft.World/Items/ItemInstance.cpp +++ b/Minecraft.World/Items/ItemInstance.cpp @@ -350,8 +350,8 @@ std::wstring ItemInstance::toString() { std::wostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed if (Item::items[id] == nullptr) { - oss << std::dec << count << L"x" << L" Item::items[id] is nullptr " << L"@" - << auxValue; + oss << std::dec << count << L"x" << L" Item::items[id] is nullptr " + << L"@" << auxValue; } else { oss << std::dec << count << L"x" << Item::items[id]->getDescription(shared_from_this()) << L"@" diff --git a/Minecraft.World/Items/PickaxeItem.cpp b/Minecraft.World/Items/PickaxeItem.cpp index 03c19a4e4..55ff1a084 100644 --- a/Minecraft.World/Items/PickaxeItem.cpp +++ b/Minecraft.World/Items/PickaxeItem.cpp @@ -58,8 +58,8 @@ bool PickaxeItem::canDestroySpecial(Tile* tile) { float PickaxeItem::getDestroySpeed(std::shared_ptr itemInstance, Tile* tile) { if (tile != nullptr && (tile->material == Material::metal || - tile->material == Material::heavyMetal || - tile->material == Material::stone)) { + tile->material == Material::heavyMetal || + tile->material == Material::stone)) { return speed; } return DiggerItem::getDestroySpeed(itemInstance, tile); diff --git a/Minecraft.World/Items/PotionItem.cpp b/Minecraft.World/Items/PotionItem.cpp index 79d314a30..9bd524b5c 100644 --- a/Minecraft.World/Items/PotionItem.cpp +++ b/Minecraft.World/Items/PotionItem.cpp @@ -43,8 +43,9 @@ std::vector* PotionItem::getMobEffects( } // Result should be a new (unmanaged) vector, so create a new one - return effects == nullptr ? nullptr - : new std::vector(*effects); + return effects == nullptr + ? nullptr + : new std::vector(*effects); } else { std::vector* effects = new std::vector(); @@ -391,8 +392,9 @@ std::vector >* PotionItem::getUniquePotionValues() { for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* mei = *it; - effectsHashCode = 31 * effectsHashCode + - (mei == nullptr ? 0 : mei->hashCode()); + effectsHashCode = + 31 * effectsHashCode + + (mei == nullptr ? 0 : mei->hashCode()); delete (*it); } diff --git a/Minecraft.World/Items/TileItems/ColoredTileItem.cpp b/Minecraft.World/Items/TileItems/ColoredTileItem.cpp index 0cebe5356..dc6c607e6 100644 --- a/Minecraft.World/Items/TileItems/ColoredTileItem.cpp +++ b/Minecraft.World/Items/TileItems/ColoredTileItem.cpp @@ -12,7 +12,8 @@ ColoredTileItem::ColoredTileItem(int id, bool stackedByData) : TileItem(id) { } ColoredTileItem::~ColoredTileItem() { - if (descriptionPostfixes.data != nullptr) delete[] descriptionPostfixes.data; + if (descriptionPostfixes.data != nullptr) + delete[] descriptionPostfixes.data; } int ColoredTileItem::getColor(std::shared_ptr item, diff --git a/Minecraft.World/Level/BaseMobSpawner.cpp b/Minecraft.World/Level/BaseMobSpawner.cpp index b2ee3b0cb..e85d3f7ae 100644 --- a/Minecraft.World/Level/BaseMobSpawner.cpp +++ b/Minecraft.World/Level/BaseMobSpawner.cpp @@ -24,8 +24,8 @@ BaseMobSpawner::BaseMobSpawner() { BaseMobSpawner::~BaseMobSpawner() { if (spawnPotentials) { - for (auto it = spawnPotentials->begin(); - it != spawnPotentials->end(); ++it) { + for (auto it = spawnPotentials->begin(); it != spawnPotentials->end(); + ++it) { delete *it; } delete spawnPotentials; diff --git a/Minecraft.World/Level/ChunkSource.h b/Minecraft.World/Level/ChunkSource.h index 24215175a..ced0a1e84 100644 --- a/Minecraft.World/Level/ChunkSource.h +++ b/Minecraft.World/Level/ChunkSource.h @@ -74,7 +74,7 @@ public: virtual bool shouldSave() = 0; virtual LevelChunk** getCache() { return nullptr; } // 4J added - virtual void dataReceived(int x, int z) {} // 4J added + virtual void dataReceived(int x, int z) {} // 4J added /** * Returns some stats that are rendered when the user holds F3. diff --git a/Minecraft.World/Level/CustomLevelSource.cpp b/Minecraft.World/Level/CustomLevelSource.cpp index c06ddffdd..7df8394ac 100644 --- a/Minecraft.World/Level/CustomLevelSource.cpp +++ b/Minecraft.World/Level/CustomLevelSource.cpp @@ -31,8 +31,8 @@ CustomLevelSource::CustomLevelSource(Level* level, int64_t seed, std::string path = "GAME:\\GameRules\\heightmap.bin"; #endif #endif - void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, nullptr); + void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (file == INVALID_HANDLE_VALUE) { app.FatalLoadError(); uint32_t error = GetLastError(); @@ -528,7 +528,6 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { } PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Monster rooms"); for (int i = 0; i < 8; i++) { int x = xo + pprandom->nextInt(16) + 8; @@ -606,7 +605,8 @@ std::vector* CustomLevelSource::getMobsAt( TilePos* CustomLevelSource::findNearestMapFeature( Level* level, const std::wstring& featureName, int x, int y, int z) { #if defined(_OVERRIDE_HEIGHTMAP) - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) { + if (LargeFeature::STRONGHOLD == featureName && + strongholdFeature != nullptr) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } #endif diff --git a/Minecraft.World/Level/Dimensions/SkyIslandDimension.cpp b/Minecraft.World/Level/Dimensions/SkyIslandDimension.cpp index cb7c8ad56..56b7d1b76 100644 --- a/Minecraft.World/Level/Dimensions/SkyIslandDimension.cpp +++ b/Minecraft.World/Level/Dimensions/SkyIslandDimension.cpp @@ -18,7 +18,9 @@ float SkyIslandDimension::getTimeOfDay(int64_t time, float a) const { return 0.0f; } -float* SkyIslandDimension::getSunriseColor(float td, float a) { return nullptr; } +float* SkyIslandDimension::getSunriseColor(float td, float a) { + return nullptr; +} Vec3 SkyIslandDimension::getFogColor(float td, float a) const { int fogColor = 0x8080a0; diff --git a/Minecraft.World/Level/Events/VillageSiege.cpp b/Minecraft.World/Level/Events/VillageSiege.cpp index aa5e7d554..509cc306a 100644 --- a/Minecraft.World/Level/Events/VillageSiege.cpp +++ b/Minecraft.World/Level/Events/VillageSiege.cpp @@ -96,8 +96,7 @@ bool VillageSiege::tryToSetupSiege() { std::vector >* villages = level->villages->getVillages(); // for (Village v : level.villages.getVillages()) - for (auto itV = villages->begin(); itV != villages->end(); - ++itV) { + for (auto itV = villages->begin(); itV != villages->end(); ++itV) { std::shared_ptr v = *itV; if (v == _village) continue; if (v->isInside(spawnX, spawnY, spawnZ)) { diff --git a/Minecraft.World/Level/Explosion.cpp b/Minecraft.World/Level/Explosion.cpp index eb14bee9f..fe1ac7c03 100644 --- a/Minecraft.World/Level/Explosion.cpp +++ b/Minecraft.World/Level/Explosion.cpp @@ -118,8 +118,8 @@ void Explosion::explode() { // walls bool canDamage = false; for (auto it2 = toBlow.begin(); it2 != toBlow.end(); ++it2) { - if (e->bb.intersects(it2->x, it2->y, it2->z, it2->x + 1, - it2->y + 1, it2->z + 1)) { + if (e->bb.intersects(it2->x, it2->y, it2->z, it2->x + 1, it2->y + 1, + it2->z + 1)) { canDamage = true; break; } @@ -201,8 +201,7 @@ void Explosion::finalizeExplosion( if (fraction == 0) fraction = 1; size_t j = toBlowArray->size() - 1; // for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); - ++it) { + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos* tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; int yt = tp->y; @@ -261,8 +260,7 @@ void Explosion::finalizeExplosion( if (fire) { // for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); - ++it) { + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos* tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; int yt = tp->y; diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index 2a1870696..fbc0775ff 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -562,9 +562,9 @@ Biome* Level::getBiome(int x, int z) { if (hasChunkAt(x, 0, z)) { LevelChunk* lc = getChunkAt(x, z); if (lc != nullptr) { - // Water chunks at the edge of the world return nullptr for their biome - // as they can't store it, so should fall back on the normal method - // below + // Water chunks at the edge of the world return nullptr for their + // biome as they can't store it, so should fall back on the normal + // method below Biome* biome = lc->getBiome(x & 0xf, z & 0xf, dimension->biomeSource); if (biome) return biome; @@ -602,8 +602,8 @@ Level::Level(std::shared_ptr levelStorage, } dimension->init(this); - chunkSource = nullptr; // 4J - added flag so chunk source can be called from - // derived class instead + chunkSource = nullptr; // 4J - added flag so chunk source can be called + // from derived class instead updateSkyBrightness(); prepareWeather(); @@ -672,8 +672,8 @@ void Level::_init(std::shared_ptr levelStorage, chunkSource = doCreateChunkSource ? createChunkSource() - : nullptr; // 4J - added flag so chunk source can be called - // from derived class instead + : nullptr; // 4J - added flag so chunk source can be + // called from derived class instead // 4J Stu- Moved to derived classes // if (!levelData->isInitialized()) @@ -1377,8 +1377,10 @@ HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid) { } HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid, bool solidOnly) { - if (std::isnan(a->x) || std::isnan(a->y) || std::isnan(a->z)) return nullptr; - if (std::isnan(b->x) || std::isnan(b->y) || std::isnan(b->z)) return nullptr; + if (std::isnan(a->x) || std::isnan(a->y) || std::isnan(a->z)) + return nullptr; + if (std::isnan(b->x) || std::isnan(b->y) || std::isnan(b->z)) + return nullptr; int xTile1 = Mth::floor(b->x); int yTile1 = Mth::floor(b->y); @@ -1800,9 +1802,8 @@ AABBList* Level::getCubes(std::shared_ptr source, AABB* box, if (noEntities) return &boxes; double r = 0.25; - AABB grown = box->grow(r, r, r); - std::vector >* ee = - getEntities(source, &grown); + AABB grown = box->grow(r, r, r); + std::vector >* ee = getEntities(source, &grown); std::vector >::iterator itEnd = ee->end(); for (auto it = ee->begin(); it != itEnd; it++) { AABB* collideBox = (*it)->getCollideBox(); @@ -2088,8 +2089,8 @@ void Level::tickEntities() { for (auto it = entities.begin(); it != entities.end();) { bool found = false; - for (auto it2 = entitiesToRemove.begin(); - it2 != entitiesToRemove.end(); it2++) { + for (auto it2 = entitiesToRemove.begin(); it2 != entitiesToRemove.end(); + it2++) { if ((*it) == (*it2)) { found = true; break; @@ -2209,8 +2210,7 @@ void Level::tickEntities() { if (!tileEntitiesToUnload.empty()) { FRAME_PROFILE_SCOPE(TileEntityUnloadCleanup); - for (auto it = tileEntityList.begin(); - it != tileEntityList.end();) { + for (auto it = tileEntityList.begin(); it != tileEntityList.end();) { if (tileEntitiesToUnload.find(*it) != tileEntitiesToUnload.end()) { if (isClientSide) { __debugbreak(); @@ -2267,8 +2267,7 @@ void Level::tick(std::shared_ptr e, bool actual) { int xc = Mth::floor(e->x); int zc = Mth::floor(e->z); int r = 32; - if (actual && !hasChunksAt(xc - r, 0, zc - r, xc + r, 0, zc + r)) - { + if (actual && !hasChunksAt(xc - r, 0, zc - r, xc + r, 0, zc + r)) { return; } @@ -2278,8 +2277,7 @@ void Level::tick(std::shared_ptr e, bool actual) { e->yRotO = e->yRot; e->xRotO = e->xRot; - if (actual && e->inChunk) - { + if (actual && e->inChunk) { e->tickCount++; if (e->riding != nullptr) { e->rideTick(); @@ -2686,20 +2684,19 @@ void Level::removeTileEntity(int x, int y, int z) { std::shared_ptr te = getTileEntity(x, y, z); if (te != nullptr && updatingTileEntities) { te->setRemoved(); - auto it = find(pendingTileEntities.begin(), - pendingTileEntities.end(), te); + auto it = + find(pendingTileEntities.begin(), pendingTileEntities.end(), te); if (it != pendingTileEntities.end()) { pendingTileEntities.erase(it); } } else { if (te != nullptr) { auto it = find(pendingTileEntities.begin(), - pendingTileEntities.end(), te); + pendingTileEntities.end(), te); if (it != pendingTileEntities.end()) { pendingTileEntities.erase(it); } - auto it2 = - find(tileEntityList.begin(), tileEntityList.end(), te); + auto it2 = find(tileEntityList.begin(), tileEntityList.end(), te); if (it2 != tileEntityList.end()) { tileEntityList.erase(it2); } @@ -3109,7 +3106,6 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, if (!hasChunksAt(xc, yc, zc, 17)) return; } - EnterCriticalSection(&m_checkLightCS); initCachePartial(cache, xc, yc, zc); @@ -3203,8 +3199,9 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, // 4J - some changes here brought forward // from 1.2.3 int block = std::max( - 1, getBlockingCached(cache, layer, nullptr, - xx, yy, zz)); + 1, + getBlockingCached(cache, layer, nullptr, + xx, yy, zz)); current = getBrightnessCached(cache, layer, xx, yy, zz); if ((current == expected - block) && @@ -3362,7 +3359,6 @@ std::vector >* Level::getEntities( int zc0 = Mth::floor((bb->z0 - 2) / 16); int zc1 = Mth::floor((bb->z1 + 2) / 16); - for (int xc = xc0; xc <= xc1; xc++) for (int zc = zc0; zc <= zc1; zc++) { if (hasChunk(xc, zc)) { @@ -3371,7 +3367,6 @@ std::vector >* Level::getEntities( } MemSect(0); - return &es; } @@ -3389,7 +3384,6 @@ std::vector >* Level::getEntitiesOfClass( std::vector >* es = new std::vector >(); - for (int xc = xc0; xc <= xc1; xc++) { for (int zc = zc0; zc <= zc1; zc++) { if (hasChunk(xc, zc)) { @@ -3399,7 +3393,6 @@ std::vector >* Level::getEntitiesOfClass( } } - return es; } @@ -3436,13 +3429,13 @@ void Level::tileEntityChanged(int x, int y, int z, } } - // 4J - added - more limited (but faster) version of above, used to count water // animals, animals, monsters for the mob spawner singleType flag should be true // if we are just trying to match eINSTANCEOF exactly, and false if it is a // eINSTANCEOF from a group (eTYPE_WATERANIMAL, eTYPE_ANIMAL, eTYPE_MONSTER) unsigned int Level::countInstanceOf( - eINSTANCEOF clas, bool singleType, unsigned int* protectedCount /* = nullptr*/, + eINSTANCEOF clas, bool singleType, + unsigned int* protectedCount /* = nullptr*/, unsigned int* couldWanderCount /* = nullptr*/) { unsigned int count = 0; if (protectedCount) *protectedCount = 0; diff --git a/Minecraft.World/Level/Level.h b/Minecraft.World/Level/Level.h index a5992f429..dc6e0e71a 100644 --- a/Minecraft.World/Level/Level.h +++ b/Minecraft.World/Level/Level.h @@ -511,7 +511,8 @@ public: void tileEntityChanged(int x, int y, int z, std::shared_ptr te); // unsigned int countInstanceOf(BaseObject::Class *clas); unsigned int countInstanceOf( - eINSTANCEOF clas, bool singleType, unsigned int* protectedCount = nullptr, + eINSTANCEOF clas, bool singleType, + unsigned int* protectedCount = nullptr, unsigned int* couldWanderCount = nullptr); // 4J added unsigned int countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, diff --git a/Minecraft.World/Level/LevelChunk.cpp b/Minecraft.World/Level/LevelChunk.cpp index dc8df54fc..930775c1c 100644 --- a/Minecraft.World/Level/LevelChunk.cpp +++ b/Minecraft.World/Level/LevelChunk.cpp @@ -481,7 +481,6 @@ int LevelChunk::getHighestSectionPosition() { void LevelChunk::recalcBlockLights() {} void LevelChunk::recalcHeightmapOnly() { - int min = Level::maxBuildHeight - 1; for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) { @@ -490,8 +489,8 @@ void LevelChunk::recalcHeightmapOnly() { // value changed from -999 to 255 int y = Level::maxBuildHeight - 1; - // int p = x << level->depthBitsPlusFour | z << - // level->depthBits; // 4J - removed + // int p = x << level->depthBitsPlusFour | z << + // level->depthBits; // 4J - removed CompressedTileStorage* blocks = (y - 1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks : lowerBlocks; @@ -516,7 +515,6 @@ void LevelChunk::recalcHeightmapOnly() { this->minHeight = min; this->setUnsaved(true); - } void LevelChunk::recalcHeightmap() { @@ -526,8 +524,8 @@ void LevelChunk::recalcHeightmap() { for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) { int y = Level::maxBuildHeight - 1; - // int p = x << level->depthBitsPlusFour | z << - // level->depthBits; // 4J - removed + // int p = x << level->depthBitsPlusFour | z << + // level->depthBits; // 4J - removed CompressedTileStorage* blocks = (y - 1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks @@ -591,7 +589,6 @@ void LevelChunk::recalcHeightmap() { } this->setUnsaved(true); - } // 4J - this code is fully commented out in the java version, but we have @@ -1418,8 +1415,7 @@ void LevelChunk::load() { std::vector > values; EnterCriticalSection(&m_csTileEntities); - for (auto it = tileEntities.begin(); it != tileEntities.end(); - it++) { + for (auto it = tileEntities.begin(); it != tileEntities.end(); it++) { values.push_back(it->second); } LeaveCriticalSection(&m_csTileEntities); @@ -1451,8 +1447,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter if (unloadTileEntities) { std::vector > tileEntitiesToRemove; EnterCriticalSection(&m_csTileEntities); - for (auto it = tileEntities.begin(); it != tileEntities.end(); - it++) { + for (auto it = tileEntities.begin(); it != tileEntities.end(); it++) { tileEntitiesToRemove.push_back(it->second); } LeaveCriticalSection(&m_csTileEntities); diff --git a/Minecraft.World/Level/LevelChunk.h b/Minecraft.World/Level/LevelChunk.h index 820f1eac8..d4637fd8b 100644 --- a/Minecraft.World/Level/LevelChunk.h +++ b/Minecraft.World/Level/LevelChunk.h @@ -17,7 +17,6 @@ class EntitySelector; #define SHARING_ENABLED class TileCompressData_SPU; - class LevelChunk { friend class TileCompressData_SPU; friend class LevelRenderer; diff --git a/Minecraft.World/Level/LevelData.cpp b/Minecraft.World/Level/LevelData.cpp index 490e30f70..9750e06e8 100644 --- a/Minecraft.World/Level/LevelData.cpp +++ b/Minecraft.World/Level/LevelData.cpp @@ -210,7 +210,8 @@ LevelData::LevelData(LevelSettings* levelSettings, gameTime = -1; lastPlayed = 0; sizeOnDisk = 0; - // this->loadedPlayerTag = nullptr; // 4J - we don't store this anymore + // this->loadedPlayerTag = nullptr; // 4J - we don't store this + // anymore dimension = 0; version = 0; rainTime = 0; diff --git a/Minecraft.World/Level/RandomLevelSource.cpp b/Minecraft.World/Level/RandomLevelSource.cpp index 8424090a2..85144a1a1 100644 --- a/Minecraft.World/Level/RandomLevelSource.cpp +++ b/Minecraft.World/Level/RandomLevelSource.cpp @@ -10,7 +10,6 @@ #include "../Headers/net.minecraft.world.entity.h" #include "RandomLevelSource.h" - const double RandomLevelSource::SNOW_SCALE = 0.3; const double RandomLevelSource::SNOW_CUTOFF = 0.5; @@ -564,7 +563,6 @@ doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y, ar = lperlinNoise1->getRegion(ar, x, y, z, xSize, ySize, zSize, s, hs, s); br = lperlinNoise2->getRegion(br, x, y, z, xSize, ySize, zSize, s, hs, s); - x = z = 0; int p = 0; @@ -861,7 +859,8 @@ std::vector* RandomLevelSource::getMobsAt( TilePos* RandomLevelSource::findNearestMapFeature( Level* level, const std::wstring& featureName, int x, int y, int z) { - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) { + if (LargeFeature::STRONGHOLD == featureName && + strongholdFeature != nullptr) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } return nullptr; diff --git a/Minecraft.World/Level/Storage/CompressedTileStorage.cpp b/Minecraft.World/Level/Storage/CompressedTileStorage.cpp index 04f805208..2784e2e40 100644 --- a/Minecraft.World/Level/Storage/CompressedTileStorage.cpp +++ b/Minecraft.World/Level/Storage/CompressedTileStorage.cpp @@ -1,8 +1,6 @@ #include "../../Platform/stdafx.h" #include "CompressedTileStorage.h" - - // Note: See header for an overview of this class int CompressedTileStorage::deleteQueueIndex; @@ -768,21 +766,19 @@ void CompressedTileStorage::tick() { unsigned char* toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); -// if( toFree ) printf("Deleting 0x%x\n", toFree); + // if( toFree ) printf("Deleting 0x%x\n", toFree); if (toFree) XPhysicalFree(toFree); } while (toFree); deleteQueueIndex = (deleteQueueIndex + 1) % 3; } - // Compresses the data currently stored in one of two ways: // (1) Attempt to compresses every block as much as possible (if upgradeBlock is // -1) (2) Copy all blocks as-is apart from the block specified by upgradeBlock // ( if > -1 ), which is changed to be the next-most-accomodating storage from // its current state void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { - unsigned char tempdata[64]; unsigned short _blockIndices[512]; @@ -857,7 +853,6 @@ void CompressedTileStorage::compress(int upgradeBlock /*=-1*/) { // compress any further and require no storage. Store flags for // each tile type used in an array of 4 64-bit flags. - uint64_t usedFlags[4] = {0, 0, 0, 0}; int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index cededb290..fbb42ec8d 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -108,12 +108,12 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int& id, int centreX, int centreZ, int dimension, int scale) { - //int64_t zMasked = centreZ & 0x1FFFFFFF; - //int64_t xMasked = centreX & 0x1FFFFFFF; - //int64_t zShifted = zMasked << 34; - //int64_t xShifted = xMasked << 5; - // app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d - // (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); + // int64_t zMasked = centreZ & 0x1FFFFFFF; + // int64_t xMasked = centreX & 0x1FFFFFFF; + // int64_t zShifted = zMasked << 34; + // int64_t xShifted = xMasked << 5; + // app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d + // (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted); int64_t index = (((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | (((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ((scale & 0x7) << 2) | (dimension & 0x3); @@ -359,8 +359,7 @@ void DirectoryLevelStorage::saveLevelData(LevelData* levelData) { void DirectoryLevelStorage::save(std::shared_ptr player) { // 4J Jev, removed try/catch. PlayerUID playerXuid = player->getXuid(); - if (playerXuid != INVALID_XUID && !player->isGuest()) - { + if (playerXuid != INVALID_XUID && !player->isGuest()) { CompoundTag* tag = new CompoundTag(); player->saveWithoutId(tag); ConsoleSavePath realFile = ConsoleSavePath( @@ -580,8 +579,8 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, ConsoleSavePath file = getDataFile(id); if (m_saveFile->doesFileExist(file)) { - auto it = find(m_mapFilesToDelete.begin(), - m_mapFilesToDelete.end(), mapId); + auto it = find(m_mapFilesToDelete.begin(), m_mapFilesToDelete.end(), + mapId); if (it != m_mapFilesToDelete.end()) m_mapFilesToDelete.erase(it); m_saveFile->deleteFile(m_saveFile->createFile(file)); @@ -610,8 +609,8 @@ void DirectoryLevelStorage::saveMapIdLookup() { DataOutputStream dos(&baos); dos.writeInt(m_playerMappings.size()); app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size()); - for (auto it = m_playerMappings.begin(); - it != m_playerMappings.end(); ++it) { + for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); + ++it) { #if defined(_WINDOWS64) || defined(__linux__) app.DebugPrintf(" -- %d\n", it->first); #else @@ -737,8 +736,8 @@ void DirectoryLevelStorage::saveAllCachedData() { } m_cachedSaveData.clear(); - for (auto it = m_mapFilesToDelete.begin(); - it != m_mapFilesToDelete.end(); ++it) { + for (auto it = m_mapFilesToDelete.begin(); it != m_mapFilesToDelete.end(); + ++it) { std::wstring id = std::wstring(L"map_") + _toString(*it); ConsoleSavePath file = getDataFile(id); if (m_saveFile->doesFileExist(file)) { diff --git a/Minecraft.World/Level/Storage/EntityIO.cpp b/Minecraft.World/Level/Storage/EntityIO.cpp index 85f0a9e09..4023f1f4a 100644 --- a/Minecraft.World/Level/Storage/EntityIO.cpp +++ b/Minecraft.World/Level/Storage/EntityIO.cpp @@ -317,7 +317,8 @@ std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, auto it2 = numCreateMap->find(it->second); if (it2 != numCreateMap->end()) { entityCreateFn create = it2->second; - if (create != nullptr) entity = std::shared_ptr(create(level)); + if (create != nullptr) + entity = std::shared_ptr(create(level)); if ((entity != nullptr) && entity->GetType() == eTYPE_ENDERDRAGON) { std::dynamic_pointer_cast(entity) ->AddParts(); // 4J added to finalise creation diff --git a/Minecraft.World/Level/Storage/LevelType.cpp b/Minecraft.World/Level/Storage/LevelType.cpp index a0ad493fc..ae48a2f82 100644 --- a/Minecraft.World/Level/Storage/LevelType.cpp +++ b/Minecraft.World/Level/Storage/LevelType.cpp @@ -19,7 +19,8 @@ LevelType* LevelType::lvl_flat = nullptr; // = new LevelType(1, "flat"); LevelType* LevelType::lvl_largeBiomes = nullptr; // = new LevelType(2, "largeBiomes"); LevelType* LevelType::lvl_normal_1_1 = - nullptr; // = new LevelType(8, "default_1_1", 0).setSelectableByUser(false); + nullptr; // = new LevelType(8, "default_1_1", + // 0).setSelectableByUser(false); void LevelType::staticCtor() { for (int i = 0; i < 16; i++) levelTypes[i] = nullptr; diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.cpp b/Minecraft.World/Level/Storage/MapItemSavedData.cpp index 7e38466fb..fc1afa910 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.cpp +++ b/Minecraft.World/Level/Storage/MapItemSavedData.cpp @@ -246,8 +246,8 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, if (hp->player->removed) //|| (!hp->player->inventory->contains(item) //&& !item->isFramed() )) { - auto it2 = carriedByPlayers.find( - (std::shared_ptr)hp->player); + auto it2 = + carriedByPlayers.find((std::shared_ptr)hp->player); if (it2 != carriedByPlayers.end()) { carriedByPlayers.erase(it2); } @@ -271,8 +271,8 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, } } - auto currentPortalDecoration = - nonPlayerDecorations.find(END_PORTAL_DECORATION_KEY); + auto currentPortalDecoration = + nonPlayerDecorations.find(END_PORTAL_DECORATION_KEY); if (currentPortalDecoration == nonPlayerDecorations.end() && atLeastOnePlayerInTheEnd) { float origX = 0.0f; @@ -573,7 +573,7 @@ void MapItemSavedData::mergeInMapData( void MapItemSavedData::removeItemFrameDecoration( std::shared_ptr item) { auto frameDecoration = - nonPlayerDecorations.find(item->getFrame()->entityId); + nonPlayerDecorations.find(item->getFrame()->entityId); if (frameDecoration != nonPlayerDecorations.end()) { delete frameDecoration->second; nonPlayerDecorations.erase(frameDecoration); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp index 041b69782..81ceed4d4 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp @@ -330,7 +330,8 @@ void McRegionChunkStorage::staticCtor() { // saveThreads[j] = // CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); - s_saveThreads[i] = new C4JThread(runSaveThreadProc, nullptr, threadName); + s_saveThreads[i] = + new C4JThread(runSaveThreadProc, nullptr, threadName); // app.DebugPrintf("Created new thread: %s\n",threadName); @@ -448,4 +449,3 @@ void McRegionChunkStorage::WaitForSaves() { } } } - diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp index 40c8eab52..e7247f0f5 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp @@ -31,8 +31,8 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { m_saveFile->getRegionFilesByDimension(1); if (netherFiles != nullptr) { uint32_t bytesWritten = 0; - for (auto it = netherFiles->begin(); - it != netherFiles->end(); ++it) { + for (auto it = netherFiles->begin(); it != netherFiles->end(); + ++it) { m_saveFile->zeroFile(*it, (*it)->getFileSize(), &bytesWritten); } @@ -42,8 +42,8 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { std::vector* netherFiles = m_saveFile->getFilesWithPrefix(LevelStorage::NETHER_FOLDER); if (netherFiles != nullptr) { - for (auto it = netherFiles->begin(); - it != netherFiles->end(); ++it) { + for (auto it = netherFiles->begin(); it != netherFiles->end(); + ++it) { m_saveFile->deleteFile(*it); } delete netherFiles; @@ -78,8 +78,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { // 4J-PB - There will be no End in early saves if (endFiles != nullptr) { - for (auto it = endFiles->begin(); it != endFiles->end(); - ++it) { + for (auto it = endFiles->begin(); it != endFiles->end(); ++it) { m_saveFile->deleteFile(*it); } delete endFiles; diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp index e7861e446..a456c6ec6 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp @@ -11,7 +11,6 @@ #include "../../IO/Files/ConsoleSaveFileIO.h" - McRegionLevelStorageSource::McRegionLevelStorageSource(File dir) : DirectoryLevelStorageSource(dir) {} @@ -72,7 +71,6 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile* saveFile, return true; } - void McRegionLevelStorageSource::convertRegions( File& baseFolder, std::vector* chunkFiles, int currentCount, int totalCount, ProgressListener* progress) { @@ -99,4 +97,3 @@ void McRegionLevelStorageSource::eraseFolders(std::vector* folders, progress->progressStagePercentage(percent); } } - diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index f4b2fa155..249ba25c7 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -562,7 +562,6 @@ LevelChunk* OldChunkStorage::load(Level* level, CompoundTag* tag) { } } - // 4J removed - we shouldn't need this any more #if !defined(_CONTENT_PACKAGE) diff --git a/Minecraft.World/Level/Storage/Region.cpp b/Minecraft.World/Level/Storage/Region.cpp index 2c4cf90a4..ca1687549 100644 --- a/Minecraft.World/Level/Storage/Region.cpp +++ b/Minecraft.World/Level/Storage/Region.cpp @@ -72,7 +72,6 @@ int Region::getTile(int x, int y, int z) { int xc = (x >> 4); int zc = (z >> 4); - xc -= xc1; zc -= zc1; diff --git a/Minecraft.World/Level/Storage/SparseDataStorage.cpp b/Minecraft.World/Level/Storage/SparseDataStorage.cpp index 518f064f8..061c38a03 100644 --- a/Minecraft.World/Level/Storage/SparseDataStorage.cpp +++ b/Minecraft.World/Level/Storage/SparseDataStorage.cpp @@ -430,7 +430,7 @@ void SparseDataStorage::addNewPlane(int y) { // try again queueForDelete(dataPointer); // printf("Marking for delete (fail) 0x%x\n", - //dataPointer); + // dataPointer); } } while (!success); } @@ -461,9 +461,9 @@ void SparseDataStorage::tick() { unsigned char* toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); -// if( toFree ) printf("Deleting 0x%x\n", toFree); -// Determine correct means to free this data - could have been allocated either -// with XPhysicalAlloc or malloc + // 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); } @@ -495,7 +495,7 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full - //replace)\n", lastDataPointer); + // replace)\n", lastDataPointer); queueForDelete(lastDataPointer); } } while (!success); @@ -570,13 +570,13 @@ int SparseDataStorage::compress() { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress - //fail)\n", newIndicesAndData); + // fail)\n", newIndicesAndData); queueForDelete(newIndicesAndData); } else { // Success queueForDelete(planeIndices); // printf("Successfully compressed to %d planes, to delete -//0x%x\n", planesToAlloc, planeIndices); +// 0x%x\n", planesToAlloc, planeIndices); #if defined(DATA_COMPRESSION_STATS) count = planesToAlloc; #endif diff --git a/Minecraft.World/Level/Storage/SparseLightStorage.cpp b/Minecraft.World/Level/Storage/SparseLightStorage.cpp index 372bc63d5..f713858ab 100644 --- a/Minecraft.World/Level/Storage/SparseLightStorage.cpp +++ b/Minecraft.World/Level/Storage/SparseLightStorage.cpp @@ -433,7 +433,7 @@ void SparseLightStorage::addNewPlane(int y) { // try again queueForDelete(dataPointer); // printf("Marking for delete (fail) 0x%x\n", - //dataPointer); + // dataPointer); } } while (!success); } @@ -464,9 +464,9 @@ void SparseLightStorage::tick() { unsigned char* toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); -// if( toFree ) printf("Deleting 0x%x\n", toFree); -// Determine correct means to free this data - could have been allocated either -// with XPhysicalAlloc or malloc + // 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); } @@ -498,7 +498,7 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) { success = true; // Queue old data to be deleted // printf("Marking for delete 0x%x (full - //replace)\n", lastDataPointer); + // replace)\n", lastDataPointer); queueForDelete(lastDataPointer); } } while (!success); @@ -580,13 +580,13 @@ int SparseLightStorage::compress() { // Failed to write. Don't bother trying again... being very // conservative here. // printf("Marking for delete 0x%x (compress - //fail)\n", newIndicesAndData); + // fail)\n", newIndicesAndData); queueForDelete(newIndicesAndData); } else { // Success queueForDelete(planeIndices); // printf("Successfully compressed to %d planes, to delete -//0x%x\n", planesToAlloc, planeIndices); +// 0x%x\n", planesToAlloc, planeIndices); #if defined(LIGHT_COMPRESSION_STATS) count = planesToAlloc; #endif diff --git a/Minecraft.World/Level/Storage/SparseLightStorage.h b/Minecraft.World/Level/Storage/SparseLightStorage.h index 63f131368..7077e3fb9 100644 --- a/Minecraft.World/Level/Storage/SparseLightStorage.h +++ b/Minecraft.World/Level/Storage/SparseLightStorage.h @@ -72,6 +72,7 @@ private: static const int ALL_0_INDEX = 128; static const int ALL_15_INDEX = 129; + public: SparseLightStorage(bool sky); SparseLightStorage(bool sky, bool isUpper); diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp index e4b47ff2d..df386b6d4 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp @@ -65,8 +65,8 @@ ZoneFile* ZonedChunkStorage::getZoneFile(int x, int z, bool create) { if (!file.exists()) { if (!create) return nullptr; void* ch = CreateFile(wstringtofilename(file.getPath()), - GENERIC_READ | GENERIC_WRITE, 0, nullptr, - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + GENERIC_READ | GENERIC_WRITE, 0, nullptr, + OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); CloseHandle(ch); } diff --git a/Minecraft.World/Level/TickNextTickData.cpp b/Minecraft.World/Level/TickNextTickData.cpp index 999a1c18b..aa3455296 100644 --- a/Minecraft.World/Level/TickNextTickData.cpp +++ b/Minecraft.World/Level/TickNextTickData.cpp @@ -27,10 +27,9 @@ bool TickNextTickData::equals(const TickNextTickData* o) const { } int TickNextTickData::hashCode() const { - std::uint32_t hash = - (((std::uint32_t)x * 1024u * 1024u) + ((std::uint32_t)z * 1024u) + - (std::uint32_t)y) * - 256u; + std::uint32_t hash = (((std::uint32_t)x * 1024u * 1024u) + + ((std::uint32_t)z * 1024u) + (std::uint32_t)y) * + 256u; return (std::int32_t)hash; } diff --git a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp index 2f82aa3d7..a10aabed6 100644 --- a/Minecraft.World/Network/Packets/AddPlayerPacket.cpp +++ b/Minecraft.World/Network/Packets/AddPlayerPacket.cpp @@ -99,7 +99,7 @@ void AddPlayerPacket::write(DataOutputStream* dos) // throws IOException dos->writeInt(z); dos->writeByte(static_cast(yRot)); dos->writeByte(static_cast(xRot)); - dos->writeByte(static_cast(yHeadRot)); // 4J Added + dos->writeByte(static_cast(yHeadRot)); // 4J Added dos->writeShort(carriedItem); dos->writePlayerUID(xuid); dos->writePlayerUID(OnlineXuid); diff --git a/Minecraft.World/Network/Packets/AwardStatPacket.cpp b/Minecraft.World/Network/Packets/AwardStatPacket.cpp index b87aebca3..c95f201cd 100644 --- a/Minecraft.World/Network/Packets/AwardStatPacket.cpp +++ b/Minecraft.World/Network/Packets/AwardStatPacket.cpp @@ -63,9 +63,7 @@ int AwardStatPacket::getEstimatedSize() { return 6; } bool AwardStatPacket::isAync() { return true; } // On most platforms we only store 'count' in an AwardStatPacket. -int AwardStatPacket::getCount() { - return *((int*)this->m_paramData.data); -} +int AwardStatPacket::getCount() { return *((int*)this->m_paramData.data); } // On Durango we store 'Event' parameters here in a blob. byteArray AwardStatPacket::getParamData() { return m_paramData; } diff --git a/Minecraft.World/Network/Packets/ChatAutoCompletePacket.h b/Minecraft.World/Network/Packets/ChatAutoCompletePacket.h index 1796e0013..9da5874d7 100644 --- a/Minecraft.World/Network/Packets/ChatAutoCompletePacket.h +++ b/Minecraft.World/Network/Packets/ChatAutoCompletePacket.h @@ -2,5 +2,4 @@ #include "Packet.h" -class ChatAutoCompletePacket : public Packet { -}; \ No newline at end of file +class ChatAutoCompletePacket : public Packet {}; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ClientInformationPacket.h b/Minecraft.World/Network/Packets/ClientInformationPacket.h index 13eb5797b..f4b73ad27 100644 --- a/Minecraft.World/Network/Packets/ClientInformationPacket.h +++ b/Minecraft.World/Network/Packets/ClientInformationPacket.h @@ -2,5 +2,4 @@ #include "../../Platform/stdafx.h" -class ClientInformationPacket : public Packet { -}; \ No newline at end of file +class ClientInformationPacket : public Packet {}; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/ClientProtocolPacket.h b/Minecraft.World/Network/Packets/ClientProtocolPacket.h index a8dc2530f..07a232c2d 100644 --- a/Minecraft.World/Network/Packets/ClientProtocolPacket.h +++ b/Minecraft.World/Network/Packets/ClientProtocolPacket.h @@ -2,5 +2,4 @@ #include "Packet.h" -class ClientProtocolPacket : public Packet { -}; \ No newline at end of file +class ClientProtocolPacket : public Packet {}; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/Packet.cpp b/Minecraft.World/Network/Packets/Packet.cpp index 7c85036ee..3ea1bbb7a 100644 --- a/Minecraft.World/Network/Packets/Packet.cpp +++ b/Minecraft.World/Network/Packets/Packet.cpp @@ -285,7 +285,6 @@ int Packet::renderPos = 0; void Packet::map(int id, bool receiveOnClient, bool receiveOnServer, bool sendToAnyClient, bool renderStats, const std::type_info& clazz, packetCreateFn createFn) { - idToCreateMap.insert( std::unordered_map::value_type(id, createFn)); @@ -337,8 +336,8 @@ void Packet::updatePacketStatsPIX() { #if !defined(_CONTENT_PACKAGE) #if PACKET_ENABLE_STAT_TRACKING - for (auto it = outgoingStatistics.begin(); - it != outgoingStatistics.end(); it++) { + for (auto it = outgoingStatistics.begin(); it != outgoingStatistics.end(); + it++) { Packet::PacketStatistics* stat = it->second; int64_t count = stat->getRunningCount(); wchar_t pixName[256]; @@ -473,7 +472,6 @@ void Packet::writeUtf(const std::wstring& value, DataOutputStream* dos) // throws IOException TODO 4J JEV, // should this declare a throws? { - dos->writeShort((short)value.length()); dos->writeChars(value); } diff --git a/Minecraft.World/Network/Packets/RemoveEntitiesPacket.cpp b/Minecraft.World/Network/Packets/RemoveEntitiesPacket.cpp index 405e69186..1b745c698 100644 --- a/Minecraft.World/Network/Packets/RemoveEntitiesPacket.cpp +++ b/Minecraft.World/Network/Packets/RemoveEntitiesPacket.cpp @@ -39,7 +39,6 @@ int RemoveEntitiesPacket::getEstimatedSize() { return 1 + (ids.length * 4); } 4J: These are necesary on the PS3. (and 4). */ -#if (0 || 0 || 0 || \ - defined __linux__) +#if (0 || 0 || 0 || defined __linux__) const int RemoveEntitiesPacket::MAX_PER_PACKET; #endif diff --git a/Minecraft.World/Network/Packets/ServerAuthDataPacket.h b/Minecraft.World/Network/Packets/ServerAuthDataPacket.h index 8fe43f2e2..30fe3f6bb 100644 --- a/Minecraft.World/Network/Packets/ServerAuthDataPacket.h +++ b/Minecraft.World/Network/Packets/ServerAuthDataPacket.h @@ -2,5 +2,4 @@ #include "Packet.h" -class ServerAuthDataPacket : public Packet { -}; \ No newline at end of file +class ServerAuthDataPacket : public Packet {}; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/SharedKeyPacket.h b/Minecraft.World/Network/Packets/SharedKeyPacket.h index 4df520504..81ec3aaec 100644 --- a/Minecraft.World/Network/Packets/SharedKeyPacket.h +++ b/Minecraft.World/Network/Packets/SharedKeyPacket.h @@ -2,5 +2,4 @@ #include "Packet.h" -class SharedKeyPacket : public Packet { -}; \ No newline at end of file +class SharedKeyPacket : public Packet {}; \ No newline at end of file diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index e2c2aafae..df9876aee 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -98,8 +98,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( this->BoxDataA = new SKIN_BOX[this->dwBoxC]; int iCount = 0; - for (auto it = pvSkinBoxes->begin(); it != pvSkinBoxes->end(); - ++it) { + for (auto it = pvSkinBoxes->begin(); it != pvSkinBoxes->end(); ++it) { SKIN_BOX* pSkinBox = *it; this->BoxDataA[iCount++] = *pSkinBox; } diff --git a/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp b/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp index 8d99bc087..8e7e2be26 100644 --- a/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp +++ b/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp @@ -70,8 +70,7 @@ void UpdateAttributesPacket::write(DataOutputStream* dos) { dos->writeDouble(attribute->getBase()); dos->writeShort(modifiers->size()); - for (auto it2 = modifiers->begin(); it2 != modifiers->end(); - ++it2) { + for (auto it2 = modifiers->begin(); it2 != modifiers->end(); ++it2) { AttributeModifier* modifier = (*it2); dos->writeInt(modifier->getId()); dos->writeDouble(modifier->getAmount()); diff --git a/Minecraft.World/Network/Socket.cpp b/Minecraft.World/Network/Socket.cpp index 3f8afba37..04e75a4e8 100644 --- a/Minecraft.World/Network/Socket.cpp +++ b/Minecraft.World/Network/Socket.cpp @@ -460,7 +460,8 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, INetworkPlayer* socketPlayer = m_socket->getPlayer(); if (socketPlayer == nullptr) { app.DebugPrintf( - "Trying to write to network, but the socketPlayer is nullptr\n"); + "Trying to write to network, but the socketPlayer is " + "nullptr\n"); return; } @@ -477,11 +478,12 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, hostPlayer->SendData(socketPlayer, buffer.pbyData, buffer.dwDataSize, lowPriority, requireAck); - // uint32_t queueSize = hostPlayer->GetSendQueueSize( nullptr, - // QNET_GETSENDQUEUESIZE_BYTES ); if( queueSize > 24000 ) + // uint32_t queueSize = hostPlayer->GetSendQueueSize( + // nullptr, QNET_GETSENDQUEUESIZE_BYTES ); if( + // queueSize > 24000 ) // { // //printf("Queue size is: %d, forcing - // doWork()\n",queueSize); g_NetworkManager.DoWork(); + // doWork()\n",queueSize); g_NetworkManager.DoWork(); // } } else { // printf( "Sent %u bytes of data from \"%ls\" to \"%ls\"\n", diff --git a/Minecraft.World/Platform/System.cpp b/Minecraft.World/Platform/System.cpp index a97104b7d..23d92499e 100644 --- a/Minecraft.World/Platform/System.cpp +++ b/Minecraft.World/Platform/System.cpp @@ -107,9 +107,7 @@ int64_t System::currentTimeMillis() { // 4J Stu - Added this so that we can use real-world timestamps in PSVita saves. // Particularly required for the save transfers to be smooth -int64_t System::currentRealTimeMillis() { - return currentTimeMillis(); -} +int64_t System::currentRealTimeMillis() { return currentTimeMillis(); } void System::ReverseUSHORT(unsigned short* pusVal) { unsigned short usValue = *pusVal; diff --git a/Minecraft.World/Platform/System.h b/Minecraft.World/Platform/System.h index 6cd496f9a..20424e4f7 100644 --- a/Minecraft.World/Platform/System.h +++ b/Minecraft.World/Platform/System.h @@ -39,8 +39,8 @@ public: static void ReverseWCHARA(wchar_t* pwch, int iLen); }; -#define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ - (static_cast(static_cast(ch0)) | \ - (static_cast(static_cast(ch1)) << 8) | \ +#define MAKE_FOURCC(ch0, ch1, ch2, ch3) \ + (static_cast(static_cast(ch0)) | \ + (static_cast(static_cast(ch1)) << 8) | \ (static_cast(static_cast(ch2)) << 16) | \ (static_cast(static_cast(ch3)) << 24)) diff --git a/Minecraft.World/Platform/x64headers/extraX64.h b/Minecraft.World/Platform/x64headers/extraX64.h index 021305422..efc640224 100644 --- a/Minecraft.World/Platform/x64headers/extraX64.h +++ b/Minecraft.World/Platform/x64headers/extraX64.h @@ -260,7 +260,7 @@ typedef struct _XUSER_SIGNIN_INFO { #define XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002 uint32_t XUserGetSigninInfo(uint32_t dwUserIndex, uint32_t dwFlags, - PXUSER_SIGNIN_INFO pSigninInfo); + PXUSER_SIGNIN_INFO pSigninInfo); class CXuiStringTable { public: diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index c120ce2e8..a89270574 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -101,7 +101,6 @@ void Player::_init() { m_bCheckedForModelParts = false; m_bCheckedDLCForModelParts = false; - enderChestInventory = std::shared_ptr( new PlayerEnderChestContainer()); @@ -225,10 +224,11 @@ void Player::updateFrameTick() { // 4J Stu - Fix for #45508 - TU5: Gameplay: Eating one piece of food // will result in a second piece being eaten as well Original code was // item != useItem. Changed this now to use the equals function, and add - // the nullptr check as well for the other possible not equals (useItem is - // not nullptr if we are here) This is because the useItem and item could - // be different objects due to an inventory update from the server, but - // still be the same item (with the same id,count and auxvalue) + // the nullptr check as well for the other possible not equals (useItem + // is not nullptr if we are here) This is because the useItem and item + // could be different objects due to an inventory update from the + // server, but still be the same item (with the same id,count and + // auxvalue) if (item == nullptr || !item->equals(useItem)) { stopUsingItem(); } else { @@ -614,9 +614,7 @@ unsigned int Player::getSkinAnimOverrideBitmask(std::uint32_t skinId) { return bitmask; } -void Player::setXuid(PlayerUID xuid) { - m_xuid = xuid; -} +void Player::setXuid(PlayerUID xuid) { m_xuid = xuid; } void Player::setCustomCape(std::uint32_t capeId) { #if !defined(_CONTENT_PACKAGE) @@ -1331,7 +1329,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; } @@ -1591,7 +1590,8 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, Pos* pos = bedPosition; Pos* standUp = bedPosition; - if (pos != nullptr && level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) { + if (pos != nullptr && + level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) { BedTile::setOccupied(level, pos->x, pos->y, pos->z, false); standUp = @@ -2636,7 +2636,8 @@ std::vector* Player::GetAdditionalModelParts() { app.IsFileInMemoryTextures(customTextureUrl)) { m_bCheckedForModelParts = true; } - if (m_ppAdditionalModelParts == nullptr && !m_bCheckedDLCForModelParts) { + if (m_ppAdditionalModelParts == nullptr && + !m_bCheckedDLCForModelParts) { m_bCheckedDLCForModelParts = true; // we don't have the data from the dlc skin yet @@ -2679,4 +2680,3 @@ void Player::SetAdditionalModelParts( std::vector* ppAdditionalModelParts) { m_ppAdditionalModelParts = ppAdditionalModelParts; } - diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index 640bb7342..563aa6c17 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -586,7 +586,6 @@ private: std::vector* m_ppAdditionalModelParts; bool m_bCheckedForModelParts; bool m_bCheckedDLCForModelParts; - }; struct PlayerKeyHash { diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp index e0f34ae6d..ebf83a363 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp @@ -144,7 +144,6 @@ void ArmorDyeRecipe::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9); ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9); - pIngReq->iIngIDA = new int[TempIngReq.iIngC]; pIngReq->iIngValA = new int[TempIngReq.iIngC]; pIngReq->iIngAuxValA = new int[TempIngReq.iIngC]; diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.h b/Minecraft.World/Recipes/ArmorDyeRecipe.h index 5aba1b6d5..fd94efff3 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.h +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.h @@ -19,8 +19,6 @@ public: virtual const int getGroup(); // 4J-PB - virtual bool - requiresRecipe(int iRecipe); - virtual void - collectRequirements(INGREDIENTS_REQUIRED* pIngReq); + virtual bool requiresRecipe(int iRecipe); + virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq); }; \ No newline at end of file diff --git a/Minecraft.World/Recipes/ClothDyeRecipes.cpp b/Minecraft.World/Recipes/ClothDyeRecipes.cpp index 50c47c06c..26a382df9 100644 --- a/Minecraft.World/Recipes/ClothDyeRecipes.cpp +++ b/Minecraft.World/Recipes/ClothDyeRecipes.cpp @@ -19,7 +19,6 @@ void ClothDyeRecipes::addRecipes(Recipes* r) { L"sssczczg", L"###", L"#X#", L"###", L'#', new ItemInstance(Tile::clayHardened), L'X', new ItemInstance(Item::dye_powder, 1, i), L'D'); - } // some dye recipes diff --git a/Minecraft.World/Recipes/Recipy.h b/Minecraft.World/Recipes/Recipy.h index d1570b216..fded84c19 100644 --- a/Minecraft.World/Recipes/Recipy.h +++ b/Minecraft.World/Recipes/Recipy.h @@ -51,10 +51,6 @@ public: virtual const int getGroup() = 0; // 4J-PB - virtual bool - requiresRecipe(int iRecipe) - = 0; - virtual void - collectRequirements(INGREDIENTS_REQUIRED* pIngReq) - = 0; + virtual bool requiresRecipe(int iRecipe) = 0; + virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq) = 0; }; diff --git a/Minecraft.World/Recipes/ShapedRecipy.cpp b/Minecraft.World/Recipes/ShapedRecipy.cpp index ce1a75f3b..e5b1ea0f0 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.cpp +++ b/Minecraft.World/Recipes/ShapedRecipy.cpp @@ -195,8 +195,7 @@ void ShapedRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { delete[] TempIngReq.uiGridA; } -ShapedRecipy* -ShapedRecipy::keepTag() { +ShapedRecipy* ShapedRecipy::keepTag() { _keepTag = true; return this; } \ No newline at end of file diff --git a/Minecraft.World/Recipes/ShapedRecipy.h b/Minecraft.World/Recipes/ShapedRecipy.h index 47c175d8d..97eabd472 100644 --- a/Minecraft.World/Recipes/ShapedRecipy.h +++ b/Minecraft.World/Recipes/ShapedRecipy.h @@ -31,8 +31,6 @@ public: ShapedRecipy* keepTag(); // 4J-PB - to return the items required to make a recipe - virtual bool - requiresRecipe(int iRecipe); - virtual void - collectRequirements(INGREDIENTS_REQUIRED* pIngReq); + virtual bool requiresRecipe(int iRecipe); + virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq); }; diff --git a/Minecraft.World/Recipes/ShapelessRecipy.cpp b/Minecraft.World/Recipes/ShapelessRecipy.cpp index ce11e8a6d..7bffab698 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.cpp +++ b/Minecraft.World/Recipes/ShapelessRecipy.cpp @@ -33,15 +33,14 @@ bool ShapelessRecipy::matches(std::shared_ptr craftSlots, bool found = false; auto citEnd = ingredients->end(); - for (auto cit = ingredients->begin(); cit != citEnd; - ++cit) { + for (auto cit = ingredients->begin(); cit != citEnd; ++cit) { ItemInstance* ingredient = *cit; if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue())) { found = true; - auto it = find(tempList.begin(), tempList.end(), - ingredient); + auto it = + find(tempList.begin(), tempList.end(), ingredient); if (it != tempList.end()) tempList.erase(it); break; } diff --git a/Minecraft.World/Recipes/ShapelessRecipy.h b/Minecraft.World/Recipes/ShapelessRecipy.h index 671f730c4..1a8bd0cf1 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.h +++ b/Minecraft.World/Recipes/ShapelessRecipy.h @@ -20,8 +20,6 @@ public: virtual int size(); // 4J-PB - to return the items required to make a recipe - virtual bool - requiresRecipe(int iRecipe); - virtual void - collectRequirements(INGREDIENTS_REQUIRED* pIngReq); + virtual bool requiresRecipe(int iRecipe); + virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq); }; diff --git a/Minecraft.World/Stats/Achievement.cpp b/Minecraft.World/Stats/Achievement.cpp index 2376d85c8..76bd0e3a1 100644 --- a/Minecraft.World/Stats/Achievement.cpp +++ b/Minecraft.World/Stats/Achievement.cpp @@ -53,8 +53,8 @@ Achievement::Achievement(int id, const std::wstring& name, int x, int y, y(y), prerequisite(prerequisite) {} - Achievement::Achievement(int id, const std::wstring& name, int x, int y, - Tile* icon, Achievement* prerequisite) +Achievement::Achievement(int id, const std::wstring& name, int x, int y, + Tile* icon, Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name))), desc(I18n::get( @@ -64,9 +64,9 @@ Achievement::Achievement(int id, const std::wstring& name, int x, int y, y(y), prerequisite(prerequisite) {} - Achievement::Achievement(int id, const std::wstring& name, int x, int y, - std::shared_ptr icon, - Achievement* prerequisite) +Achievement::Achievement(int id, const std::wstring& name, int x, int y, + std::shared_ptr icon, + Achievement* prerequisite) : Stat(Achievements::ACHIEVEMENT_OFFSET + id, I18n::get(std::wstring(L"achievement.").append(name))), desc(I18n::get( diff --git a/Minecraft.World/Stats/Achievement.h b/Minecraft.World/Stats/Achievement.h index efa22615f..bfd3c0ec8 100644 --- a/Minecraft.World/Stats/Achievement.h +++ b/Minecraft.World/Stats/Achievement.h @@ -7,8 +7,7 @@ class DescFormatter; class Achievement : public Stat { public: const int x, y; - Achievement* - prerequisite; + Achievement* prerequisite; private: const std::wstring desc; diff --git a/Minecraft.World/Stats/GenericStats.cpp b/Minecraft.World/Stats/GenericStats.cpp index 4013931a7..5a79b03c5 100644 --- a/Minecraft.World/Stats/GenericStats.cpp +++ b/Minecraft.World/Stats/GenericStats.cpp @@ -64,7 +64,9 @@ Stat* GenericStats::get_blocksPlaced(int blockId) { return nullptr; } Stat* GenericStats::get_blocksMined(int blockId) { return nullptr; } -Stat* GenericStats::get_itemsCollected(int itemId, int itemAux) { return nullptr; } +Stat* GenericStats::get_itemsCollected(int itemId, int itemAux) { + return nullptr; +} Stat* GenericStats::get_itemsCrafted(int itemId) { return nullptr; } @@ -158,9 +160,7 @@ Stat* GenericStats::diamonds() { return instance->get_achievement(eAward_diamonds); } -Stat* GenericStats::ghast() { - return instance->get_achievement(eAward_ghast); -} +Stat* GenericStats::ghast() { return instance->get_achievement(eAward_ghast); } Stat* GenericStats::blazeRod() { return instance->get_achievement(eAward_blazeRod); diff --git a/Minecraft.World/Stats/Stats.cpp b/Minecraft.World/Stats/Stats.cpp index 91c375404..00a676fb5 100644 --- a/Minecraft.World/Stats/Stats.cpp +++ b/Minecraft.World/Stats/Stats.cpp @@ -66,10 +66,11 @@ StatArray Stats::biomesVisisted; #endif Stat* Stats::killsEnderdragon = - nullptr; // The number of times this player has dealt the killing blow to the - // Enderdragon -Stat* Stats::completeTheEnd = nullptr; // The number of times this player has been - // present when the Enderdragon has died + nullptr; // The number of times this player has dealt the killing blow to + // the Enderdragon +Stat* Stats::completeTheEnd = + nullptr; // The number of times this player has been + // present when the Enderdragon has died void Stats::staticCtor() { Stats::walkOneM = (new GeneralStat(2000, L"stat.walkOneM", diff --git a/Minecraft.World/Util/C4JThread.cpp b/Minecraft.World/Util/C4JThread.cpp index ccd8cf62d..209eb7e29 100644 --- a/Minecraft.World/Util/C4JThread.cpp +++ b/Minecraft.World/Util/C4JThread.cpp @@ -87,12 +87,10 @@ const std::thread::id g_processMainThreadId = std::this_thread::get_id(); template bool WaitForCondition(std::condition_variable& condition, - std::unique_lock& lock, - int timeoutMs, + std::unique_lock& lock, int timeoutMs, Predicate predicate) { - if (timeoutMs < 0 || - static_cast(timeoutMs) == - static_cast(INFINITE)) { + if (timeoutMs < 0 || static_cast(timeoutMs) == + static_cast(INFINITE)) { condition.wait(lock, predicate); return true; } @@ -117,8 +115,9 @@ std::uint32_t BuildMaskForSize(int size) { } void FormatThreadName(std::string& outThreadName, const char* threadName) { - const char* safeName = - (threadName != nullptr && threadName[0] != '\0') ? threadName : "Unnamed"; + const char* safeName = (threadName != nullptr && threadName[0] != '\0') + ? threadName + : "Unnamed"; char buffer[64]; std::snprintf(buffer, sizeof(buffer), "(4J) %s", safeName); @@ -151,22 +150,22 @@ std::int64_t GetLinuxThreadId() { int MapPriorityToNice(int priority) { switch (priority) { - case THREAD_PRIORITY_TIME_CRITICAL: - return -15; - case THREAD_PRIORITY_HIGHEST: - return -10; - case THREAD_PRIORITY_ABOVE_NORMAL: - return -5; - case THREAD_PRIORITY_NORMAL: - return 0; - case THREAD_PRIORITY_BELOW_NORMAL: - return 5; - case THREAD_PRIORITY_LOWEST: - return 10; - case THREAD_PRIORITY_IDLE: - return 19; - default: - return 0; + case THREAD_PRIORITY_TIME_CRITICAL: + return -15; + case THREAD_PRIORITY_HIGHEST: + return -10; + case THREAD_PRIORITY_ABOVE_NORMAL: + return -5; + case THREAD_PRIORITY_NORMAL: + return 0; + case THREAD_PRIORITY_BELOW_NORMAL: + return 5; + case THREAD_PRIORITY_LOWEST: + return 10; + case THREAD_PRIORITY_IDLE: + return 19; + default: + return 0; } } #endif @@ -268,10 +267,9 @@ void C4JThread::entryPoint(C4JThread* pThread) { int exitCode = 0; try { - exitCode = - (pThread->m_startFunc != nullptr) - ? (*pThread->m_startFunc)(pThread->m_threadParam) - : 0; + exitCode = (pThread->m_startFunc != nullptr) + ? (*pThread->m_startFunc)(pThread->m_threadParam) + : 0; } catch (...) { exitCode = -1; } @@ -561,9 +559,8 @@ void C4JThread::Event::Clear() { std::uint32_t C4JThread::Event::WaitForSignal(int timeoutMs) { std::unique_lock lock(m_mutex); - const bool signaled = - WaitForCondition(m_condition, lock, timeoutMs, - [this] { return m_signaled; }); + const bool signaled = WaitForCondition(m_condition, lock, timeoutMs, + [this] { return m_signaled; }); if (!signaled) { return WAIT_TIMEOUT; @@ -577,11 +574,7 @@ std::uint32_t C4JThread::Event::WaitForSignal(int timeoutMs) { } C4JThread::EventArray::EventArray(int size, EMode mode) - : m_size(size), - m_mode(mode), - m_mutex(), - m_condition(), - m_signaledMask(0U) { + : m_size(size), m_mode(mode), m_mutex(), m_condition(), m_signaledMask(0U) { assert(m_size > 0); assert(m_size <= 32); } @@ -627,11 +620,9 @@ std::uint32_t C4JThread::EventArray::WaitForSingle(int index, int timeoutMs) { const std::uint32_t bitMask = 1U << static_cast(index); std::unique_lock lock(m_mutex); - const bool signaled = - WaitForCondition(m_condition, lock, timeoutMs, - [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - }); + const bool signaled = WaitForCondition( + m_condition, lock, timeoutMs, + [this, bitMask] { return (m_signaledMask & bitMask) != 0U; }); if (!signaled) { return WAIT_TIMEOUT; @@ -648,11 +639,9 @@ std::uint32_t C4JThread::EventArray::WaitForAll(int timeoutMs) { const std::uint32_t bitMask = BuildMaskForSize(m_size); std::unique_lock lock(m_mutex); - const bool signaled = - WaitForCondition(m_condition, lock, timeoutMs, - [this, bitMask] { - return (m_signaledMask & bitMask) == bitMask; - }); + const bool signaled = WaitForCondition( + m_condition, lock, timeoutMs, + [this, bitMask] { return (m_signaledMask & bitMask) == bitMask; }); if (!signaled) { return WAIT_TIMEOUT; @@ -669,11 +658,9 @@ std::uint32_t C4JThread::EventArray::WaitForAny(int timeoutMs) { const std::uint32_t bitMask = BuildMaskForSize(m_size); std::unique_lock lock(m_mutex); - const bool signaled = - WaitForCondition(m_condition, lock, timeoutMs, - [this, bitMask] { - return (m_signaledMask & bitMask) != 0U; - }); + const bool signaled = WaitForCondition( + m_condition, lock, timeoutMs, + [this, bitMask] { return (m_signaledMask & bitMask) != 0U; }); if (!signaled) { return WAIT_TIMEOUT; @@ -733,8 +720,8 @@ void C4JThread::EventQueue::setPriority(int priority) { void C4JThread::EventQueue::init() { std::call_once(m_initOnce, [this]() { - m_thread = std::make_unique(threadFunc, this, - m_threadName.c_str()); + m_thread = + std::make_unique(threadFunc, this, m_threadName.c_str()); if (m_processor >= 0) { m_thread->SetProcessor(m_processor); @@ -767,9 +754,8 @@ void C4JThread::EventQueue::waitForFinish() { init(); std::unique_lock lock(m_mutex); - m_drainedCondition.wait(lock, [this] { - return m_queue.empty() && !m_busy; - }); + m_drainedCondition.wait(lock, + [this] { return m_queue.empty() && !m_busy; }); } int C4JThread::EventQueue::threadFunc(void* lpParam) { @@ -794,14 +780,12 @@ void C4JThread::EventQueue::threadPoll() { { std::unique_lock lock(m_mutex); - m_queueCondition.wait_for(lock, - std::chrono::milliseconds( - kEventQueueShutdownPollMs), - [this] { - return m_stopRequested.load( - std::memory_order_acquire) || - !m_queue.empty(); - }); + m_queueCondition.wait_for( + lock, std::chrono::milliseconds(kEventQueueShutdownPollMs), + [this] { + return m_stopRequested.load(std::memory_order_acquire) || + !m_queue.empty(); + }); if (m_stopRequested.load(std::memory_order_acquire)) { break; @@ -847,8 +831,7 @@ void C4JThread::PushAffinityAllCores() { DWORD_PTR processAffinityMask = 0; DWORD_PTR systemAffinityMask = 0; - if (!::GetProcessAffinityMask(::GetCurrentProcess(), - &processAffinityMask, + if (!::GetProcessAffinityMask(::GetCurrentProcess(), &processAffinityMask, &systemAffinityMask) || processAffinityMask == 0) { return; diff --git a/Minecraft.World/Util/C4JThread.h b/Minecraft.World/Util/C4JThread.h index 195d86b69..8fea963f1 100644 --- a/Minecraft.World/Util/C4JThread.h +++ b/Minecraft.World/Util/C4JThread.h @@ -125,7 +125,9 @@ public: void Run(); [[nodiscard]] bool isRunning() const noexcept { return m_isRunning.load(); } - [[nodiscard]] bool hasStarted() const noexcept { return m_hasStarted.load(); } + [[nodiscard]] bool hasStarted() const noexcept { + return m_hasStarted.load(); + } void SetProcessor(int proc); void SetPriority(int priority); diff --git a/Minecraft.World/Util/CombatTracker.cpp b/Minecraft.World/Util/CombatTracker.cpp index 3aae99de4..f607a972b 100644 --- a/Minecraft.World/Util/CombatTracker.cpp +++ b/Minecraft.World/Util/CombatTracker.cpp @@ -88,10 +88,10 @@ std::shared_ptr CombatTracker::getDeathMessagePacket() { result = std::shared_ptr( new ChatPacket(mob->getNetworkName(), message)); } else if (attackerEntity != nullptr && - (killingEntity == nullptr || attackerEntity != killingEntity)) { + (killingEntity == nullptr || + attackerEntity != killingEntity)) { std::shared_ptr attackerItem = - attackerEntity->instanceof - (eTYPE_LIVINGENTITY) + attackerEntity->instanceof(eTYPE_LIVINGENTITY) ? std::dynamic_pointer_cast(attackerEntity) ->getCarriedItem() : nullptr; @@ -109,8 +109,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; @@ -146,20 +146,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/Minecraft.World/Util/Icon.h b/Minecraft.World/Util/Icon.h index b75c68a2c..5a17df0df 100644 --- a/Minecraft.World/Util/Icon.h +++ b/Minecraft.World/Util/Icon.h @@ -8,7 +8,6 @@ public: static const int IS_GRASS_SIDE = 1; static const int IS_GRASS_TOP = 2; - virtual ~Icon() {} // added by 4jcraft, needed for abstract class virtual int getX() const = 0; diff --git a/Minecraft.World/Util/Pos.cpp b/Minecraft.World/Util/Pos.cpp index d4f5cfd0c..194765f4a 100644 --- a/Minecraft.World/Util/Pos.cpp +++ b/Minecraft.World/Util/Pos.cpp @@ -20,8 +20,8 @@ Pos::Pos(Pos* position) { // public bool equals(Object other) bool Pos::equals(void* other) { // TODO 4J Stu I cannot do a dynamic_cast from a void pointer - // If I cast it to a Pos then do a dynamic_cast will it still return nullptr if - // it wasn't originally a Pos? + // If I cast it to a Pos then do a dynamic_cast will it still return nullptr + // if it wasn't originally a Pos? if (!(dynamic_cast((Pos*)other) != nullptr)) { return false; } diff --git a/Minecraft.World/Util/libdivide.h b/Minecraft.World/Util/libdivide.h index bdcebf9ea..f2a55b186 100644 --- a/Minecraft.World/Util/libdivide.h +++ b/Minecraft.World/Util/libdivide.h @@ -20,13 +20,13 @@ #include #endif -#if ! LIBDIVIDE_HAS_STDINT_TYPES && ! LIBDIVIDE_VC +#if !LIBDIVIDE_HAS_STDINT_TYPES && !LIBDIVIDE_VC /* Visual C++ still doesn't ship with stdint.h (!) */ #include #define LIBDIVIDE_HAS_STDINT_TYPES 1 #endif -#if ! LIBDIVIDE_HAS_STDINT_TYPES +#if !LIBDIVIDE_HAS_STDINT_TYPES typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; @@ -36,9 +36,9 @@ typedef unsigned __int8 uint8_t; #endif #if LIBDIVIDE_USE_SSE2 - #if LIBDIVIDE_VC - #include - #endif +#if LIBDIVIDE_VC +#include +#endif #include #endif @@ -64,26 +64,36 @@ typedef unsigned __int8 uint8_t; #define LIBDIVIDE_GCC_STYLE_ASM 1 #endif - -/* libdivide may use the pmuldq (vector signed 32x32->64 mult instruction) which is in SSE 4.1. However, signed multiplication can be emulated efficiently with unsigned multiplication, and SSE 4.1 is currently rare, so it is OK to not turn this on */ +/* libdivide may use the pmuldq (vector signed 32x32->64 mult instruction) which + * is in SSE 4.1. However, signed multiplication can be emulated efficiently + * with unsigned multiplication, and SSE 4.1 is currently rare, so it is OK to + * not turn this on */ #ifdef LIBDIVIDE_USE_SSE4_1 #include #endif #ifdef __cplusplus -/* We place libdivide within the libdivide namespace, and that goes in an anonymous namespace so that the functions are only visible to files that #include this header and don't get external linkage. At least that's the theory. */ +/* We place libdivide within the libdivide namespace, and that goes in an + * anonymous namespace so that the functions are only visible to files that + * #include this header and don't get external linkage. At least that's the + * theory. */ namespace { namespace libdivide { #endif -/* Explanation of "more" field: bit 6 is whether to use shift path. If we are using the shift path, bit 7 is whether the divisor is negative in the signed case; in the unsigned case it is 0. Bits 0-4 is shift value (for shift path or mult path). In 32 bit case, bit 5 is always 0. We use bit 7 as the "negative divisor indicator" so that we can use sign extension to efficiently go to a full-width -1. +/* Explanation of "more" field: bit 6 is whether to use shift path. If we are +using the shift path, bit 7 is whether the divisor is negative in the signed +case; in the unsigned case it is 0. Bits 0-4 is shift value (for shift path or +mult path). In 32 bit case, bit 5 is always 0. We use bit 7 as the "negative +divisor indicator" so that we can use sign extension to efficiently go to a +full-width -1. u32: [0-4] shift value [5] ignored [6] add indicator [7] shift path - + s32: [0-4] shift value [5] shift path [6] add indicator @@ -106,10 +116,9 @@ enum { LIBDIVIDE_U32_SHIFT_PATH = 0x80, LIBDIVIDE_U64_SHIFT_PATH = 0x80, LIBDIVIDE_S32_SHIFT_PATH = 0x20, - LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 + LIBDIVIDE_NEGATIVE_DIVISOR = 0x80 }; - struct libdivide_u32_t { uint32_t magic; uint8_t more; @@ -123,103 +132,146 @@ struct libdivide_s32_t { struct libdivide_u64_t { uint64_t magic; uint8_t more; -}; +}; struct libdivide_s64_t { int64_t magic; uint8_t more; }; - - #ifndef LIBDIVIDE_API - #ifdef __cplusplus - /* In C++, we don't want our public functions to be static, because they are arguments to templates and static functions can't do that. They get internal linkage through virtue of the anonymous namespace. In C, they should be static. */ - #define LIBDIVIDE_API - #else - #define LIBDIVIDE_API static - #endif +#ifdef __cplusplus +/* In C++, we don't want our public functions to be static, because they are + * arguments to templates and static functions can't do that. They get internal + * linkage through virtue of the anonymous namespace. In C, they should be + * static. */ +#define LIBDIVIDE_API +#else +#define LIBDIVIDE_API static +#endif #endif - LIBDIVIDE_API struct libdivide_s32_t libdivide_s32_gen(int32_t y); LIBDIVIDE_API struct libdivide_u32_t libdivide_u32_gen(uint32_t y); LIBDIVIDE_API struct libdivide_s64_t libdivide_s64_gen(int64_t y); LIBDIVIDE_API struct libdivide_u64_t libdivide_u64_gen(uint64_t y); - -LIBDIVIDE_API int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom); -LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom); -LIBDIVIDE_API uint64_t libdivide_u64_do(uint64_t y, const struct libdivide_u64_t *denom); -LIBDIVIDE_API int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom); -LIBDIVIDE_API uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom); -LIBDIVIDE_API uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom); -LIBDIVIDE_API uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom); - -LIBDIVIDE_API int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom); -LIBDIVIDE_API uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom); -LIBDIVIDE_API uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom); -LIBDIVIDE_API uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom); - -LIBDIVIDE_API int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom); -LIBDIVIDE_API int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom); -LIBDIVIDE_API int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom); -LIBDIVIDE_API int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom); -LIBDIVIDE_API int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom); -LIBDIVIDE_API int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom); - -LIBDIVIDE_API int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t *denom); -LIBDIVIDE_API int64_t libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t *denom); +LIBDIVIDE_API int32_t libdivide_s32_do(int32_t numer, + const struct libdivide_s32_t* denom); +LIBDIVIDE_API uint32_t libdivide_u32_do(uint32_t numer, + const struct libdivide_u32_t* denom); +LIBDIVIDE_API int64_t libdivide_s64_do(int64_t numer, + const struct libdivide_s64_t* denom); +LIBDIVIDE_API uint64_t libdivide_u64_do(uint64_t y, + const struct libdivide_u64_t* denom); + +LIBDIVIDE_API int libdivide_u32_get_algorithm( + const struct libdivide_u32_t* denom); +LIBDIVIDE_API uint32_t +libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t* denom); +LIBDIVIDE_API uint32_t +libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t* denom); +LIBDIVIDE_API uint32_t +libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t* denom); + +LIBDIVIDE_API int libdivide_u64_get_algorithm( + const struct libdivide_u64_t* denom); +LIBDIVIDE_API uint64_t +libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t* denom); +LIBDIVIDE_API uint64_t +libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t* denom); +LIBDIVIDE_API uint64_t +libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t* denom); + +LIBDIVIDE_API int libdivide_s32_get_algorithm( + const struct libdivide_s32_t* denom); +LIBDIVIDE_API int32_t +libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t* denom); +LIBDIVIDE_API int32_t +libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t* denom); +LIBDIVIDE_API int32_t +libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t* denom); +LIBDIVIDE_API int32_t +libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t* denom); +LIBDIVIDE_API int32_t +libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t* denom); + +LIBDIVIDE_API int libdivide_s64_get_algorithm( + const struct libdivide_s64_t* denom); +LIBDIVIDE_API int64_t +libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t* denom); +LIBDIVIDE_API int64_t +libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t* denom); +LIBDIVIDE_API int64_t +libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t* denom); +LIBDIVIDE_API int64_t +libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t* denom); +LIBDIVIDE_API int64_t +libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t* denom); #if LIBDIVIDE_USE_SSE2 -LIBDIVIDE_API __m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t * denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * denom); -LIBDIVIDE_API __m128i libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t * denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector(__m128i numers, const struct libdivide_s64_t * denom); +LIBDIVIDE_API __m128i +libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t* denom); +LIBDIVIDE_API __m128i +libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t* denom); +LIBDIVIDE_API __m128i +libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t* denom); +LIBDIVIDE_API __m128i +libdivide_s64_do_vector(__m128i numers, const struct libdivide_s64_t* denom); -LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg0(__m128i numers, const struct libdivide_u32_t * denom); -LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg1(__m128i numers, const struct libdivide_u32_t * denom); -LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg2(__m128i numers, const struct libdivide_u32_t * denom); +LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg0( + __m128i numers, const struct libdivide_u32_t* denom); +LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg1( + __m128i numers, const struct libdivide_u32_t* denom); +LIBDIVIDE_API __m128i libdivide_u32_do_vector_alg2( + __m128i numers, const struct libdivide_u32_t* denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg0(__m128i numers, const struct libdivide_s32_t * denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg1(__m128i numers, const struct libdivide_s32_t * denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg2(__m128i numers, const struct libdivide_s32_t * denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg3(__m128i numers, const struct libdivide_s32_t * denom); -LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg4(__m128i numers, const struct libdivide_s32_t * denom); +LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg0( + __m128i numers, const struct libdivide_s32_t* denom); +LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg1( + __m128i numers, const struct libdivide_s32_t* denom); +LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg2( + __m128i numers, const struct libdivide_s32_t* denom); +LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg3( + __m128i numers, const struct libdivide_s32_t* denom); +LIBDIVIDE_API __m128i libdivide_s32_do_vector_alg4( + __m128i numers, const struct libdivide_s32_t* denom); -LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg0(__m128i numers, const struct libdivide_u64_t * denom); -LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg1(__m128i numers, const struct libdivide_u64_t * denom); -LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg2(__m128i numers, const struct libdivide_u64_t * denom); +LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg0( + __m128i numers, const struct libdivide_u64_t* denom); +LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg1( + __m128i numers, const struct libdivide_u64_t* denom); +LIBDIVIDE_API __m128i libdivide_u64_do_vector_alg2( + __m128i numers, const struct libdivide_u64_t* denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg0(__m128i numers, const struct libdivide_s64_t * denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg1(__m128i numers, const struct libdivide_s64_t * denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg2(__m128i numers, const struct libdivide_s64_t * denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_t * denom); -LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t * denom); +LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg0( + __m128i numers, const struct libdivide_s64_t* denom); +LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg1( + __m128i numers, const struct libdivide_s64_t* denom); +LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg2( + __m128i numers, const struct libdivide_s64_t* denom); +LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg3( + __m128i numers, const struct libdivide_s64_t* denom); +LIBDIVIDE_API __m128i libdivide_s64_do_vector_alg4( + __m128i numers, const struct libdivide_s64_t* denom); #endif - - - + //////// Internal Utility Functions - + static inline uint32_t libdivide__mullhi_u32(uint32_t x, uint32_t y) { uint64_t xl = x, yl = y; uint64_t rl = xl * yl; return (uint32_t)(rl >> 32); } - + static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { #if HAS_INT128_T __uint128_t xl = x, yl = y; __uint128_t rl = xl * yl; return (uint64_t)(rl >> 64); #else - //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) + // full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 + // << 64) const uint32_t mask = 0xFFFFFFFF; const uint32_t x0 = (uint32_t)(x & mask), x1 = (uint32_t)(x >> 32); const uint32_t y0 = (uint32_t)(y & mask), y1 = (uint32_t)(y >> 32); @@ -227,39 +279,41 @@ static uint64_t libdivide__mullhi_u64(uint64_t x, uint64_t y) { const uint64_t x0y1 = x0 * (uint64_t)y1; const uint64_t x1y0 = x1 * (uint64_t)y0; const uint64_t x1y1 = x1 * (uint64_t)y1; - + uint64_t temp = x1y0 + x0y0_hi; uint64_t temp_lo = temp & mask, temp_hi = temp >> 32; return x1y1 + temp_hi + ((temp_lo + x0y1) >> 32); #endif } - + static inline int64_t libdivide__mullhi_s64(int64_t x, int64_t y) { #if HAS_INT128_T __int128_t xl = x, yl = y; __int128_t rl = xl * yl; - return (int64_t)(rl >> 64); + return (int64_t)(rl >> 64); #else - //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) + // full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 + // << 64) const uint32_t mask = 0xFFFFFFFF; const uint32_t x0 = (uint32_t)(x & mask), y0 = (uint32_t)(y & mask); const int32_t x1 = (int32_t)(x >> 32), y1 = (int32_t)(y >> 32); const uint32_t x0y0_hi = libdivide__mullhi_u32(x0, y0); - const int64_t t = x1*(int64_t)y0 + x0y0_hi; - const int64_t w1 = x0*(int64_t)y1 + (t & mask); - return x1*(int64_t)y1 + (t >> 32) + (w1 >> 32); + const int64_t t = x1 * (int64_t)y0 + x0y0_hi; + const int64_t w1 = x0 * (int64_t)y1 + (t & mask); + return x1 * (int64_t)y1 + (t >> 32) + (w1 >> 32); #endif } - + #if LIBDIVIDE_USE_SSE2 static inline __m128i libdivide__u64_to_m128(uint64_t x) { #if LIBDIVIDE_VC - //64 bit windows doesn't seem to have an implementation of any of these load intrinsics, and 32 bit Visual C++ crashes + // 64 bit windows doesn't seem to have an implementation of any of these + // load intrinsics, and 32 bit Visual C++ crashes _declspec(align(16)) uint64_t temp[2] = {x, x}; return _mm_load_si128((const __m128i*)temp); #elif defined(__ICC) - uint64_t __attribute__((aligned(16))) temp[2] = {x,x}; + uint64_t __attribute__((aligned(16))) temp[2] = {x, x}; return _mm_load_si128((const __m128i*)temp); #elif __clang__ // clang does not provide this intrinsic either @@ -271,72 +325,93 @@ static inline __m128i libdivide__u64_to_m128(uint64_t x) { } static inline __m128i libdivide_get_FFFFFFFF00000000(void) { - //returns the same as _mm_set1_epi64(0xFFFFFFFF00000000ULL) without touching memory - __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X + // returns the same as _mm_set1_epi64(0xFFFFFFFF00000000ULL) without + // touching memory + __m128i result = _mm_set1_epi8(-1); // optimizes to pcmpeqd on OS X return _mm_slli_epi64(result, 32); } - + static inline __m128i libdivide_get_00000000FFFFFFFF(void) { - //returns the same as _mm_set1_epi64(0x00000000FFFFFFFFULL) without touching memory - __m128i result = _mm_set1_epi8(-1); //optimizes to pcmpeqd on OS X + // returns the same as _mm_set1_epi64(0x00000000FFFFFFFFULL) without + // touching memory + __m128i result = _mm_set1_epi8(-1); // optimizes to pcmpeqd on OS X result = _mm_srli_epi64(result, 32); return result; } static inline __m128i libdivide_get_0000FFFF(void) { - //returns the same as _mm_set1_epi32(0x0000FFFFULL) without touching memory - __m128i result; //we don't care what its contents are - result = _mm_cmpeq_epi8(result, result); //all 1s + // returns the same as _mm_set1_epi32(0x0000FFFFULL) without touching memory + __m128i result; // we don't care what its contents are + result = _mm_cmpeq_epi8(result, result); // all 1s result = _mm_srli_epi32(result, 16); - return result; + return result; } static inline __m128i libdivide_s64_signbits(__m128i v) { - //we want to compute v >> 63, that is, _mm_srai_epi64(v, 63). But there is no 64 bit shift right arithmetic instruction in SSE2. So we have to fake it by first duplicating the high 32 bit values, and then using a 32 bit shift. Another option would be to use _mm_srli_epi64(v, 63) and then subtract that from 0, but that approach appears to be substantially slower for unknown reasons + // we want to compute v >> 63, that is, _mm_srai_epi64(v, 63). But there is + // no 64 bit shift right arithmetic instruction in SSE2. So we have to fake + // it by first duplicating the high 32 bit values, and then using a 32 bit + // shift. Another option would be to use _mm_srli_epi64(v, 63) and then + // subtract that from 0, but that approach appears to be substantially + // slower for unknown reasons __m128i hiBitsDuped = _mm_shuffle_epi32(v, _MM_SHUFFLE(3, 3, 1, 1)); __m128i signBits = _mm_srai_epi32(hiBitsDuped, 31); return signBits; } -/* Returns an __m128i whose low 32 bits are equal to amt and has zero elsewhere. */ +/* Returns an __m128i whose low 32 bits are equal to amt and has zero elsewhere. + */ static inline __m128i libdivide_u32_to_m128i(uint32_t amt) { return _mm_set_epi32(0, 0, 0, amt); } - + static inline __m128i libdivide_s64_shift_right_vector(__m128i v, int amt) { - //implementation of _mm_sra_epi64. Here we have two 64 bit values which are shifted right to logically become (64 - amt) values, and are then sign extended from a (64 - amt) bit number. + // implementation of _mm_sra_epi64. Here we have two 64 bit values which + // are shifted right to logically become (64 - amt) values, and are then + // sign extended from a (64 - amt) bit number. const int b = 64 - amt; __m128i m = libdivide__u64_to_m128(1ULL << (b - 1)); __m128i x = _mm_srl_epi64(v, libdivide_u32_to_m128i(amt)); - __m128i result = _mm_sub_epi64(_mm_xor_si128(x, m), m); //result = x^m - m + __m128i result = _mm_sub_epi64(_mm_xor_si128(x, m), m); // result = x^m - m return result; } -/* Here, b is assumed to contain one 32 bit value repeated four times. If it did not, the function would not work. */ +/* Here, b is assumed to contain one 32 bit value repeated four times. If it + * did not, the function would not work. */ static inline __m128i libdivide__mullhi_u32_flat_vector(__m128i a, __m128i b) { __m128i hi_product_0Z2Z = _mm_srli_epi64(_mm_mul_epu32(a, b), 32); __m128i a1X3X = _mm_srli_epi64(a, 32); - __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epu32(a1X3X, b), libdivide_get_FFFFFFFF00000000()); - return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 + __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epu32(a1X3X, b), + libdivide_get_FFFFFFFF00000000()); + return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 } - /* Here, y is assumed to contain one 64 bit value repeated twice. */ static inline __m128i libdivide_mullhi_u64_flat_vector(__m128i x, __m128i y) { - //full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 << 64) + // full 128 bits are x0 * y0 + (x0 * y1 << 32) + (x1 * y0 << 32) + (x1 * y1 + // << 64) const __m128i mask = libdivide_get_00000000FFFFFFFF(); - const __m128i x0 = _mm_and_si128(x, mask), x1 = _mm_srli_epi64(x, 32); //x0 is low half of 2 64 bit values, x1 is high half in low slots + const __m128i x0 = _mm_and_si128(x, mask), + x1 = _mm_srli_epi64( + x, 32); // x0 is low half of 2 64 bit values, x1 is high + // half in low slots const __m128i y0 = _mm_and_si128(y, mask), y1 = _mm_srli_epi64(y, 32); - const __m128i x0y0_hi = _mm_srli_epi64(_mm_mul_epu32(x0, y0), 32); //x0 happens to have the low half of the two 64 bit values in 32 bit slots 0 and 2, so _mm_mul_epu32 computes their full product, and then we shift right by 32 to get just the high values + const __m128i x0y0_hi = _mm_srli_epi64( + _mm_mul_epu32(x0, y0), + 32); // x0 happens to have the low half of the two 64 bit values in 32 + // bit slots 0 and 2, so _mm_mul_epu32 computes their full + // product, and then we shift right by 32 to get just the high + // values const __m128i x0y1 = _mm_mul_epu32(x0, y1); const __m128i x1y0 = _mm_mul_epu32(x1, y0); const __m128i x1y1 = _mm_mul_epu32(x1, y1); - + const __m128i temp = _mm_add_epi64(x1y0, x0y0_hi); - __m128i temp_lo = _mm_and_si128(temp, mask), temp_hi = _mm_srli_epi64(temp, 32); + __m128i temp_lo = _mm_and_si128(temp, mask), + temp_hi = _mm_srli_epi64(temp, 32); temp_lo = _mm_srli_epi64(_mm_add_epi64(temp_lo, x0y1), 32); temp_hi = _mm_add_epi64(x1y1, temp_hi); - + return _mm_add_epi64(temp_lo, temp_hi); } @@ -349,23 +424,27 @@ static inline __m128i libdivide_mullhi_s64_flat_vector(__m128i x, __m128i y) { p = _mm_sub_epi64(p, t2); return p; } - + #ifdef LIBDIVIDE_USE_SSE4_1 - + /* b is one 32 bit value repeated four times. */ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { __m128i hi_product_0Z2Z = _mm_srli_epi64(_mm_mul_epi32(a, b), 32); __m128i a1X3X = _mm_srli_epi64(a, 32); - __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epi32(a1X3X, b), libdivide_get_FFFFFFFF00000000()); - return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 + __m128i hi_product_Z1Z3 = _mm_and_si128(_mm_mul_epi32(a1X3X, b), + libdivide_get_FFFFFFFF00000000()); + return _mm_or_si128(hi_product_0Z2Z, hi_product_Z1Z3); // = hi_product_0123 } - + #else -/* SSE2 does not have a signed multiplication instruction, but we can convert unsigned to signed pretty efficiently. Again, b is just a 32 bit value repeated four times. */ +/* SSE2 does not have a signed multiplication instruction, but we can convert + * unsigned to signed pretty efficiently. Again, b is just a 32 bit value + * repeated four times. */ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { __m128i p = libdivide__mullhi_u32_flat_vector(a, b); - __m128i t1 = _mm_and_si128(_mm_srai_epi32(a, 31), b); //t1 = (a >> 31) & y, arithmetic shift + __m128i t1 = _mm_and_si128(_mm_srai_epi32(a, 31), + b); // t1 = (a >> 31) & y, arithmetic shift __m128i t2 = _mm_and_si128(_mm_srai_epi32(b, 31), a); p = _mm_sub_epi32(p, t1); p = _mm_sub_epi32(p, t2); @@ -373,7 +452,7 @@ static inline __m128i libdivide_mullhi_s32_flat_vector(__m128i a, __m128i b) { } #endif #endif - + static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) { #if __GNUC__ || __has_builtin(__builtin_ctz) /* Fast way to count trailing zeros */ @@ -389,34 +468,37 @@ static inline int32_t libdivide__count_trailing_zeros32(uint32_t val) { return result; #endif } - + static inline int32_t libdivide__count_trailing_zeros64(uint64_t val) { #if __LP64__ && (__GNUC__ || __has_builtin(__builtin_ctzll)) - /* Fast way to count trailing zeros. Note that we disable this in 32 bit because gcc does something horrible - it calls through to a dynamically bound function. */ + /* Fast way to count trailing zeros. Note that we disable this in 32 bit + * because gcc does something horrible - it calls through to a dynamically + * bound function. */ return __builtin_ctzll(val); #else - /* Pretty good way to count trailing zeros. Note that this hangs for val = 0! */ + /* Pretty good way to count trailing zeros. Note that this hangs for val = + * 0! */ uint32_t lo = val & 0xFFFFFFFF; if (lo != 0) return libdivide__count_trailing_zeros32(lo); return 32 + libdivide__count_trailing_zeros32((uint32_t)(val >> 32)); #endif } - + static inline int32_t libdivide__count_leading_zeros32(uint32_t val) { #if __GNUC__ || __has_builtin(__builtin_clzll) /* Fast way to count leading zeros */ - return __builtin_clz(val); + return __builtin_clz(val); #else /* Dorky way to count leading zeros. Note that this hangs for val = 0! */ int32_t result = 0; - while (! (val & (1U << 31))) { + while (!(val & (1U << 31))) { val <<= 1; result++; } - return result; + return result; #endif } - + static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { #if __GNUC__ || __has_builtin(__builtin_clzll) /* Fast way to count leading zeros */ @@ -424,7 +506,7 @@ static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { #else /* Dorky way to count leading zeros. Note that this hangs for val = 0! */ int32_t result = 0; - while (! (val & (1ULL << 63))) { + while (!(val & (1ULL << 63))) { val <<= 1; result++; } @@ -432,545 +514,665 @@ static inline int32_t libdivide__count_leading_zeros64(uint64_t val) { #endif } -//libdivide_64_div_32_to_32: divides a 64 bit uint {u1, u0} by a 32 bit uint {v}. The result must fit in 32 bits. Returns the quotient directly and the remainder in *r +// libdivide_64_div_32_to_32: divides a 64 bit uint {u1, u0} by a 32 bit uint +// {v}. The result must fit in 32 bits. Returns the quotient directly and the +// remainder in *r #if (LIBDIVIDE_IS_i386 || LIBDIVIDE_IS_X86_64) && LIBDIVIDE_GCC_STYLE_ASM -static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, uint32_t *r) { +static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, + uint32_t* r) { uint32_t result; __asm__("divl %[v]" : "=a"(result), "=d"(*r) - : [v] "r"(v), "a"(u0), "d"(u1) - ); + : [v] "r"(v), "a"(u0), "d"(u1)); return result; } #else -static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, uint32_t *r) { +static uint32_t libdivide_64_div_32_to_32(uint32_t u1, uint32_t u0, uint32_t v, + uint32_t* r) { uint64_t n = (((uint64_t)u1) << 32) | u0; uint32_t result = (uint32_t)(n / v); *r = (uint32_t)(n - result * (uint64_t)v); return result; } #endif - + #if LIBDIVIDE_IS_X86_64 && LIBDIVIDE_GCC_STYLE_ASM -static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { - //u0 -> rax - //u1 -> rdx - //divq +static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, + uint64_t* r) { + // u0 -> rax + // u1 -> rdx + // divq uint64_t result; __asm__("divq %[v]" : "=a"(result), "=d"(*r) - : [v] "r"(v), "a"(u0), "d"(u1) - ); + : [v] "r"(v), "a"(u0), "d"(u1)); return result; - } #else - -/* Code taken from Hacker's Delight, http://www.hackersdelight.org/HDcode/divlu.c . License permits inclusion here per http://www.hackersdelight.org/permissions.htm + +/* Code taken from Hacker's Delight, + * http://www.hackersdelight.org/HDcode/divlu.c . License permits inclusion + * here per http://www.hackersdelight.org/permissions.htm */ -static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) { - const uint64_t b = (1ULL << 32); // Number base (16 bits). - uint64_t un1, un0, // Norm. dividend LSD's. - vn1, vn0, // Norm. divisor digits. - q1, q0, // Quotient digits. - un64, un21, un10,// Dividend digit pairs. - rhat; // A remainder. - int s; // Shift amount for norm. - - if (u1 >= v) { // If overflow, set rem. +static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, + uint64_t* r) { + const uint64_t b = (1ULL << 32); // Number base (16 bits). + uint64_t un1, un0, // Norm. dividend LSD's. + vn1, vn0, // Norm. divisor digits. + q1, q0, // Quotient digits. + un64, un21, un10, // Dividend digit pairs. + rhat; // A remainder. + int s; // Shift amount for norm. + + if (u1 >= v) { // If overflow, set rem. if (r != nullptr) // to an impossible value, - *r = (uint64_t)(-1); // and return the largest - return (uint64_t)(-1);} // possible quotient. - + *r = (uint64_t)(-1); // and return the largest + return (uint64_t)(-1); + } // possible quotient. + /* count leading zeros */ - s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. - - v = v << s; // Normalize divisor. - vn1 = v >> 32; // Break divisor up into - vn0 = v & 0xFFFFFFFF; // two 32-bit digits. - + s = libdivide__count_leading_zeros64(v); // 0 <= s <= 63. + + v = v << s; // Normalize divisor. + vn1 = v >> 32; // Break divisor up into + vn0 = v & 0xFFFFFFFF; // two 32-bit digits. + un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31)); - un10 = u0 << s; // Shift dividend left. - + un10 = u0 << s; // Shift dividend left. + un1 = un10 >> 32; // Break right half of un0 = un10 & 0xFFFFFFFF; // dividend into two digits. - - q1 = un64/vn1; // Compute the first - rhat = un64 - q1*vn1; // quotient digit, q1. + + q1 = un64 / vn1; // Compute the first + rhat = un64 - q1 * vn1; // quotient digit, q1. again1: - if (q1 >= b || q1*vn0 > b*rhat + un1) { + if (q1 >= b || q1 * vn0 > b * rhat + un1) { q1 = q1 - 1; rhat = rhat + vn1; - if (rhat < b) goto again1;} - - un21 = un64*b + un1 - q1*v; // Multiply and subtract. - - q0 = un21/vn1; // Compute the second - rhat = un21 - q0*vn1; // quotient digit, q0. + if (rhat < b) goto again1; + } + + un21 = un64 * b + un1 - q1 * v; // Multiply and subtract. + + q0 = un21 / vn1; // Compute the second + rhat = un21 - q0 * vn1; // quotient digit, q0. again2: - if (q0 >= b || q0*vn0 > b*rhat + un0) { + if (q0 >= b || q0 * vn0 > b * rhat + un0) { q0 = q0 - 1; rhat = rhat + vn1; - if (rhat < b) goto again2;} - - if (r != nullptr) // If remainder is wanted, - *r = (un21*b + un0 - q0*v) >> s; // return it. - return q1*b + q0; + if (rhat < b) goto again2; + } + + if (r != nullptr) // If remainder is wanted, + *r = (un21 * b + un0 - q0 * v) >> s; // return it. + return q1 * b + q0; } #endif - + #if LIBDIVIDE_ASSERTIONS_ON -#define LIBDIVIDE_ASSERT(x) do { if (! (x)) { fprintf(stderr, "Assertion failure on line %ld: %s\n", (long)__LINE__, #x); exit(-1); } } while (0) +#define LIBDIVIDE_ASSERT(x) \ + do { \ + if (!(x)) { \ + fprintf(stderr, "Assertion failure on line %ld: %s\n", \ + (long)__LINE__, #x); \ + exit(-1); \ + } \ + } while (0) #else -#define LIBDIVIDE_ASSERT(x) +#define LIBDIVIDE_ASSERT(x) #endif - + #ifndef LIBDIVIDE_HEADER_ONLY - + ////////// UINT32 struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { struct libdivide_u32_t result; if ((d & (d - 1)) == 0) { result.magic = 0; - result.more = libdivide__count_trailing_zeros32(d) | LIBDIVIDE_U32_SHIFT_PATH; - } - else { + result.more = + libdivide__count_trailing_zeros32(d) | LIBDIVIDE_U32_SHIFT_PATH; + } else { const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(d); - + uint8_t more; uint32_t rem, proposed_m; proposed_m = libdivide_64_div_32_to_32(1U << floor_log_2_d, 0, d, &rem); LIBDIVIDE_ASSERT(rem > 0 && rem < d); const uint32_t e = d - rem; - - /* This power works if e < 2**floor_log_2_d. */ - if (e < (1U << floor_log_2_d)) { + + /* This power works if e < 2**floor_log_2_d. */ + if (e < (1U << floor_log_2_d)) { /* This power works */ more = floor_log_2_d; - } - else { - /* We have to use the general 33-bit algorithm. We need to compute (2**power) / d. However, we already have (2**(power-1))/d and its remainder. By doubling both, and then correcting the remainder, we can compute the larger division. */ - proposed_m += proposed_m; //don't care about overflow here - in fact, we expect it + } else { + /* We have to use the general 33-bit algorithm. We need to compute + * (2**power) / d. However, we already have (2**(power-1))/d and its + * remainder. By doubling both, and then correcting the remainder, + * we can compute the larger division. */ + proposed_m += proposed_m; // don't care about overflow here - in + // fact, we expect it const uint32_t twice_rem = rem + rem; if (twice_rem >= d || twice_rem < rem) proposed_m += 1; more = floor_log_2_d | LIBDIVIDE_ADD_MARKER; } result.magic = 1 + proposed_m; result.more = more; - //result.more's shift should in general be ceil_log_2_d. But if we used the smaller power, we subtract one from the shift because we're using the smaller power. If we're using the larger power, we subtract one from the shift because it's taken care of by the add indicator. So floor_log_2_d happens to be correct in both cases. - + // result.more's shift should in general be ceil_log_2_d. But if we + // used the smaller power, we subtract one from the shift because we're + // using the smaller power. If we're using the larger power, we subtract + // one from the shift because it's taken care of by the add indicator. + // So floor_log_2_d happens to be correct in both cases. } return result; } -uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) { +uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U32_SHIFT_PATH) { return numer >> (more & LIBDIVIDE_32_SHIFT_MASK); - } - else { + } else { uint32_t q = libdivide__mullhi_u32(denom->magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { uint32_t t = ((numer - q) >> 1) + q; return t >> (more & LIBDIVIDE_32_SHIFT_MASK); - } - else { - return q >> more; //all upper bits are 0 - don't need to mask them off + } else { + return q >> + more; // all upper bits are 0 - don't need to mask them off } } } - -int libdivide_u32_get_algorithm(const struct libdivide_u32_t *denom) { +int libdivide_u32_get_algorithm(const struct libdivide_u32_t* denom) { uint8_t more = denom->more; - if (more & LIBDIVIDE_U32_SHIFT_PATH) return 0; - else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; - else return 2; + if (more & LIBDIVIDE_U32_SHIFT_PATH) + return 0; + else if (!(more & LIBDIVIDE_ADD_MARKER)) + return 1; + else + return 2; } - -uint32_t libdivide_u32_do_alg0(uint32_t numer, const struct libdivide_u32_t *denom) { + +uint32_t libdivide_u32_do_alg0(uint32_t numer, + const struct libdivide_u32_t* denom) { return numer >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); } - -uint32_t libdivide_u32_do_alg1(uint32_t numer, const struct libdivide_u32_t *denom) { + +uint32_t libdivide_u32_do_alg1(uint32_t numer, + const struct libdivide_u32_t* denom) { uint32_t q = libdivide__mullhi_u32(denom->magic, numer); return q >> denom->more; -} - -uint32_t libdivide_u32_do_alg2(uint32_t numer, const struct libdivide_u32_t *denom) { +} + +uint32_t libdivide_u32_do_alg2(uint32_t numer, + const struct libdivide_u32_t* denom) { // denom->add != 0 uint32_t q = libdivide__mullhi_u32(denom->magic, numer); uint32_t t = ((numer - q) >> 1) + q; return t >> (denom->more & LIBDIVIDE_32_SHIFT_MASK); } - - - -#if LIBDIVIDE_USE_SSE2 -__m128i libdivide_u32_do_vector(__m128i numers, const struct libdivide_u32_t *denom) { +#if LIBDIVIDE_USE_SSE2 +__m128i libdivide_u32_do_vector(__m128i numers, + const struct libdivide_u32_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U32_SHIFT_PATH) { - return _mm_srl_epi32(numers, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); - } - else { - __m128i q = libdivide__mullhi_u32_flat_vector(numers, _mm_set1_epi32(denom->magic)); + return _mm_srl_epi32( + numers, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); + } else { + __m128i q = libdivide__mullhi_u32_flat_vector( + numers, _mm_set1_epi32(denom->magic)); if (more & LIBDIVIDE_ADD_MARKER) { - //uint32_t t = ((numer - q) >> 1) + q; - //return t >> denom->shift; - __m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q); - return _mm_srl_epi32(t, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); - - } - else { - //q >> denom->shift + // uint32_t t = ((numer - q) >> 1) + q; + // return t >> denom->shift; + __m128i t = + _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q); + return _mm_srl_epi32( + t, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); + + } else { + // q >> denom->shift return _mm_srl_epi32(q, libdivide_u32_to_m128i(more)); } } } -__m128i libdivide_u32_do_vector_alg0(__m128i numers, const struct libdivide_u32_t *denom) { - return _mm_srl_epi32(numers, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); +__m128i libdivide_u32_do_vector_alg0(__m128i numers, + const struct libdivide_u32_t* denom) { + return _mm_srl_epi32( + numers, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); } -__m128i libdivide_u32_do_vector_alg1(__m128i numers, const struct libdivide_u32_t *denom) { - __m128i q = libdivide__mullhi_u32_flat_vector(numers, _mm_set1_epi32(denom->magic)); +__m128i libdivide_u32_do_vector_alg1(__m128i numers, + const struct libdivide_u32_t* denom) { + __m128i q = + libdivide__mullhi_u32_flat_vector(numers, _mm_set1_epi32(denom->magic)); return _mm_srl_epi32(q, libdivide_u32_to_m128i(denom->more)); } -__m128i libdivide_u32_do_vector_alg2(__m128i numers, const struct libdivide_u32_t *denom) { - __m128i q = libdivide__mullhi_u32_flat_vector(numers, _mm_set1_epi32(denom->magic)); +__m128i libdivide_u32_do_vector_alg2(__m128i numers, + const struct libdivide_u32_t* denom) { + __m128i q = + libdivide__mullhi_u32_flat_vector(numers, _mm_set1_epi32(denom->magic)); __m128i t = _mm_add_epi32(_mm_srli_epi32(_mm_sub_epi32(numers, q), 1), q); - return _mm_srl_epi32(t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); + return _mm_srl_epi32( + t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); } #endif - + /////////// UINT64 struct libdivide_u64_t libdivide_u64_gen(uint64_t d) { struct libdivide_u64_t result; if ((d & (d - 1)) == 0) { - result.more = libdivide__count_trailing_zeros64(d) | LIBDIVIDE_U64_SHIFT_PATH; + result.more = + libdivide__count_trailing_zeros64(d) | LIBDIVIDE_U64_SHIFT_PATH; result.magic = 0; - } - else { + } else { const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(d); - + uint64_t proposed_m, rem; uint8_t more; - proposed_m = libdivide_128_div_64_to_64(1ULL << floor_log_2_d, 0, d, &rem); //== (1 << (64 + floor_log_2_d)) / d + proposed_m = libdivide_128_div_64_to_64( + 1ULL << floor_log_2_d, 0, d, + &rem); //== (1 << (64 + floor_log_2_d)) / d LIBDIVIDE_ASSERT(rem > 0 && rem < d); const uint64_t e = d - rem; - - /* This power works if e < 2**floor_log_2_d. */ - if (e < (1ULL << floor_log_2_d)) { + + /* This power works if e < 2**floor_log_2_d. */ + if (e < (1ULL << floor_log_2_d)) { /* This power works */ more = floor_log_2_d; - } - else { - /* We have to use the general 65-bit algorithm. We need to compute (2**power) / d. However, we already have (2**(power-1))/d and its remainder. By doubling both, and then correcting the remainder, we can compute the larger division. */ - proposed_m += proposed_m; //don't care about overflow here - in fact, we expect it + } else { + /* We have to use the general 65-bit algorithm. We need to compute + * (2**power) / d. However, we already have (2**(power-1))/d and its + * remainder. By doubling both, and then correcting the remainder, + * we can compute the larger division. */ + proposed_m += proposed_m; // don't care about overflow here - in + // fact, we expect it const uint64_t twice_rem = rem + rem; if (twice_rem >= d || twice_rem < rem) proposed_m += 1; more = floor_log_2_d | LIBDIVIDE_ADD_MARKER; } result.magic = 1 + proposed_m; result.more = more; - //result.more's shift should in general be ceil_log_2_d. But if we used the smaller power, we subtract one from the shift because we're using the smaller power. If we're using the larger power, we subtract one from the shift because it's taken care of by the add indicator. So floor_log_2_d happens to be correct in both cases, which is why we do it outside of the if statement. + // result.more's shift should in general be ceil_log_2_d. But if we + // used the smaller power, we subtract one from the shift because we're + // using the smaller power. If we're using the larger power, we subtract + // one from the shift because it's taken care of by the add indicator. + // So floor_log_2_d happens to be correct in both cases, which is why we + // do it outside of the if statement. } return result; } -uint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t *denom) { +uint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U64_SHIFT_PATH) { return numer >> (more & LIBDIVIDE_64_SHIFT_MASK); - } - else { + } else { uint64_t q = libdivide__mullhi_u64(denom->magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { uint64_t t = ((numer - q) >> 1) + q; return t >> (more & LIBDIVIDE_64_SHIFT_MASK); - } - else { - return q >> more; //all upper bits are 0 - don't need to mask them off + } else { + return q >> + more; // all upper bits are 0 - don't need to mask them off } } } - -int libdivide_u64_get_algorithm(const struct libdivide_u64_t *denom) { +int libdivide_u64_get_algorithm(const struct libdivide_u64_t* denom) { uint8_t more = denom->more; - if (more & LIBDIVIDE_U64_SHIFT_PATH) return 0; - else if (! (more & LIBDIVIDE_ADD_MARKER)) return 1; - else return 2; + if (more & LIBDIVIDE_U64_SHIFT_PATH) + return 0; + else if (!(more & LIBDIVIDE_ADD_MARKER)) + return 1; + else + return 2; } - -uint64_t libdivide_u64_do_alg0(uint64_t numer, const struct libdivide_u64_t *denom) { - return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); + +uint64_t libdivide_u64_do_alg0(uint64_t numer, + const struct libdivide_u64_t* denom) { + return numer >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); } - -uint64_t libdivide_u64_do_alg1(uint64_t numer, const struct libdivide_u64_t *denom) { + +uint64_t libdivide_u64_do_alg1(uint64_t numer, + const struct libdivide_u64_t* denom) { uint64_t q = libdivide__mullhi_u64(denom->magic, numer); return q >> denom->more; } - -uint64_t libdivide_u64_do_alg2(uint64_t numer, const struct libdivide_u64_t *denom) { + +uint64_t libdivide_u64_do_alg2(uint64_t numer, + const struct libdivide_u64_t* denom) { uint64_t q = libdivide__mullhi_u64(denom->magic, numer); uint64_t t = ((numer - q) >> 1) + q; return t >> (denom->more & LIBDIVIDE_64_SHIFT_MASK); } - -#if LIBDIVIDE_USE_SSE2 -__m128i libdivide_u64_do_vector(__m128i numers, const struct libdivide_u64_t * denom) { + +#if LIBDIVIDE_USE_SSE2 +__m128i libdivide_u64_do_vector(__m128i numers, + const struct libdivide_u64_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_U64_SHIFT_PATH) { - return _mm_srl_epi64(numers, libdivide_u32_to_m128i(more & LIBDIVIDE_64_SHIFT_MASK)); - } - else { - __m128i q = libdivide_mullhi_u64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); + return _mm_srl_epi64( + numers, libdivide_u32_to_m128i(more & LIBDIVIDE_64_SHIFT_MASK)); + } else { + __m128i q = libdivide_mullhi_u64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); if (more & LIBDIVIDE_ADD_MARKER) { - //uint32_t t = ((numer - q) >> 1) + q; - //return t >> denom->shift; - __m128i t = _mm_add_epi64(_mm_srli_epi64(_mm_sub_epi64(numers, q), 1), q); - return _mm_srl_epi64(t, libdivide_u32_to_m128i(more & LIBDIVIDE_64_SHIFT_MASK)); - } - else { - //q >> denom->shift + // uint32_t t = ((numer - q) >> 1) + q; + // return t >> denom->shift; + __m128i t = + _mm_add_epi64(_mm_srli_epi64(_mm_sub_epi64(numers, q), 1), q); + return _mm_srl_epi64( + t, libdivide_u32_to_m128i(more & LIBDIVIDE_64_SHIFT_MASK)); + } else { + // q >> denom->shift return _mm_srl_epi64(q, libdivide_u32_to_m128i(more)); } } } -__m128i libdivide_u64_do_vector_alg0(__m128i numers, const struct libdivide_u64_t *denom) { - return _mm_srl_epi64(numers, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); +__m128i libdivide_u64_do_vector_alg0(__m128i numers, + const struct libdivide_u64_t* denom) { + return _mm_srl_epi64( + numers, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); } -__m128i libdivide_u64_do_vector_alg1(__m128i numers, const struct libdivide_u64_t *denom) { - __m128i q = libdivide_mullhi_u64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); +__m128i libdivide_u64_do_vector_alg1(__m128i numers, + const struct libdivide_u64_t* denom) { + __m128i q = libdivide_mullhi_u64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); return _mm_srl_epi64(q, libdivide_u32_to_m128i(denom->more)); } -__m128i libdivide_u64_do_vector_alg2(__m128i numers, const struct libdivide_u64_t *denom) { - __m128i q = libdivide_mullhi_u64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); +__m128i libdivide_u64_do_vector_alg2(__m128i numers, + const struct libdivide_u64_t* denom) { + __m128i q = libdivide_mullhi_u64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); __m128i t = _mm_add_epi64(_mm_srli_epi64(_mm_sub_epi64(numers, q), 1), q); - return _mm_srl_epi64(t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); + return _mm_srl_epi64( + t, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_64_SHIFT_MASK)); } - #endif - + /////////// SINT32 - static inline int32_t libdivide__mullhi_s32(int32_t x, int32_t y) { int64_t xl = x, yl = y; int64_t rl = xl * yl; - return (int32_t)(rl >> 32); //needs to be arithmetic shift + return (int32_t)(rl >> 32); // needs to be arithmetic shift } struct libdivide_s32_t libdivide_s32_gen(int32_t d) { struct libdivide_s32_t result; - - /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ - uint32_t absD = (uint32_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick - if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero + + /* If d is a power of 2, or negative a power of 2, we have to use a shift. + * This is especially important because the magic algorithm fails for -1. To + * check if d is a power of 2 or its inverse, it suffices to check whether + * its absolute value has exactly one bit set. This works even for INT_MIN, + * because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a + * power of 2. */ + uint32_t absD = + (uint32_t)(d < 0 ? -d : d); // gcc optimizes this to the fast abs trick + if ((absD & (absD - 1)) == + 0) { // check if exactly one bit is set, don't care if absD is 0 since + // that's divide by zero result.magic = 0; - result.more = libdivide__count_trailing_zeros32(absD) | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0) | LIBDIVIDE_S32_SHIFT_PATH; - } - else { - const uint32_t floor_log_2_d = 31 - libdivide__count_leading_zeros32(absD); - LIBDIVIDE_ASSERT(floor_log_2_d >= 1); - + result.more = libdivide__count_trailing_zeros32(absD) | + (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0) | + LIBDIVIDE_S32_SHIFT_PATH; + } else { + const uint32_t floor_log_2_d = + 31 - libdivide__count_leading_zeros32(absD); + LIBDIVIDE_ASSERT(floor_log_2_d >= 1); + uint8_t more; - //the dividend here is 2**(floor_log_2_d + 31), so the low 32 bit word is 0 and the high word is floor_log_2_d - 1 + // the dividend here is 2**(floor_log_2_d + 31), so the low 32 bit word + // is 0 and the high word is floor_log_2_d - 1 uint32_t rem, proposed_m; - proposed_m = libdivide_64_div_32_to_32(1U << (floor_log_2_d - 1), 0, absD, &rem); + proposed_m = + libdivide_64_div_32_to_32(1U << (floor_log_2_d - 1), 0, absD, &rem); const uint32_t e = absD - rem; - - /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ + + /* We are going to start with a power of floor_log_2_d - 1. This works + * if works if e < 2**floor_log_2_d. */ if (e < (1U << floor_log_2_d)) { /* This power works */ more = floor_log_2_d - 1; - } - else { - /* We need to go one higher. This should not make proposed_m overflow, but it will make it negative when interpreted as an int32_t. */ + } else { + /* We need to go one higher. This should not make proposed_m + * overflow, but it will make it negative when interpreted as an + * int32_t. */ proposed_m += proposed_m; const uint32_t twice_rem = rem + rem; if (twice_rem >= absD || twice_rem < rem) proposed_m += 1; - more = floor_log_2_d | LIBDIVIDE_ADD_MARKER | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); //use the general algorithm + more = floor_log_2_d | LIBDIVIDE_ADD_MARKER | + (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR + : 0); // use the general algorithm } proposed_m += 1; result.magic = (d < 0 ? -(int32_t)proposed_m : (int32_t)proposed_m); result.more = more; - } return result; } -int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t *denom) { +int32_t libdivide_s32_do(int32_t numer, const struct libdivide_s32_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_S32_SHIFT_PATH) { uint8_t shifter = more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); q = q >> shifter; - int32_t shiftMask = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend + int32_t shiftMask = + (int8_t)more >> 7; // must be arithmetic shift and then sign-extend q = (q ^ shiftMask) - shiftMask; return q; - } - else { + } else { int32_t q = libdivide__mullhi_s32(denom->magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { - int32_t sign = (int8_t)more >> 7; //must be arithmetic shift and then sign extend + int32_t sign = (int8_t)more >> + 7; // must be arithmetic shift and then sign extend q += ((numer ^ sign) - sign); } q >>= more & LIBDIVIDE_32_SHIFT_MASK; q += (q < 0); return q; } -} - -int libdivide_s32_get_algorithm(const struct libdivide_s32_t *denom) { - uint8_t more = denom->more; - int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); - if (more & LIBDIVIDE_S32_SHIFT_PATH) return (positiveDivisor ? 0 : 1); - else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); - else return 4; } - -int32_t libdivide_s32_do_alg0(int32_t numer, const struct libdivide_s32_t *denom) { + +int libdivide_s32_get_algorithm(const struct libdivide_s32_t* denom) { + uint8_t more = denom->more; + int positiveDivisor = !(more & LIBDIVIDE_NEGATIVE_DIVISOR); + if (more & LIBDIVIDE_S32_SHIFT_PATH) + return (positiveDivisor ? 0 : 1); + else if (more & LIBDIVIDE_ADD_MARKER) + return (positiveDivisor ? 2 : 3); + else + return 4; +} + +int32_t libdivide_s32_do_alg0(int32_t numer, + const struct libdivide_s32_t* denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); return q >> shifter; } - -int32_t libdivide_s32_do_alg1(int32_t numer, const struct libdivide_s32_t *denom) { + +int32_t libdivide_s32_do_alg1(int32_t numer, + const struct libdivide_s32_t* denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; int32_t q = numer + ((numer >> 31) & ((1 << shifter) - 1)); - return - (q >> shifter); + return -(q >> shifter); } - -int32_t libdivide_s32_do_alg2(int32_t numer, const struct libdivide_s32_t *denom) { + +int32_t libdivide_s32_do_alg2(int32_t numer, + const struct libdivide_s32_t* denom) { int32_t q = libdivide__mullhi_s32(denom->magic, numer); q += numer; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } - -int32_t libdivide_s32_do_alg3(int32_t numer, const struct libdivide_s32_t *denom) { + +int32_t libdivide_s32_do_alg3(int32_t numer, + const struct libdivide_s32_t* denom) { int32_t q = libdivide__mullhi_s32(denom->magic, numer); q -= numer; q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); - return q; -} - -int32_t libdivide_s32_do_alg4(int32_t numer, const struct libdivide_s32_t *denom) { - int32_t q = libdivide__mullhi_s32(denom->magic, numer); - q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } -#if LIBDIVIDE_USE_SSE2 -__m128i libdivide_s32_do_vector(__m128i numers, const struct libdivide_s32_t * denom) { +int32_t libdivide_s32_do_alg4(int32_t numer, + const struct libdivide_s32_t* denom) { + int32_t q = libdivide__mullhi_s32(denom->magic, numer); + q >>= denom->more & LIBDIVIDE_32_SHIFT_MASK; + q += (q < 0); + return q; +} + +#if LIBDIVIDE_USE_SSE2 +__m128i libdivide_s32_do_vector(__m128i numers, + const struct libdivide_s32_t* denom) { uint8_t more = denom->more; if (more & LIBDIVIDE_S32_SHIFT_PATH) { uint32_t shifter = more & LIBDIVIDE_32_SHIFT_MASK; - __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); //could use _mm_srli_epi32 with an all -1 register - __m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); //q = numer + ((numer >> 31) & roundToZeroTweak); - q = _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter)); // q = q >> shifter - __m128i shiftMask = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //set all bits of shift mask = to the sign bit of more - q = _mm_sub_epi32(_mm_xor_si128(q, shiftMask), shiftMask); //q = (q ^ shiftMask) - shiftMask; + __m128i roundToZeroTweak = _mm_set1_epi32( + (1 << shifter) - + 1); // could use _mm_srli_epi32 with an all -1 register + __m128i q = _mm_add_epi32( + numers, + _mm_and_si128(_mm_srai_epi32(numers, 31), + roundToZeroTweak)); // q = numer + ((numer >> 31) & + // roundToZeroTweak); + q = _mm_sra_epi32(q, + libdivide_u32_to_m128i(shifter)); // q = q >> shifter + __m128i shiftMask = _mm_set1_epi32( + (int32_t)((int8_t)more >> 7)); // set all bits of shift mask = to + // the sign bit of more + q = _mm_sub_epi32(_mm_xor_si128(q, shiftMask), + shiftMask); // q = (q ^ shiftMask) - shiftMask; return q; - } - else { - __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); + } else { + __m128i q = libdivide_mullhi_s32_flat_vector( + numers, _mm_set1_epi32(denom->magic)); if (more & LIBDIVIDE_ADD_MARKER) { - __m128i sign = _mm_set1_epi32((int32_t)(int8_t)more >> 7); //must be arithmetic shift - q = _mm_add_epi32(q, _mm_sub_epi32(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); + __m128i sign = _mm_set1_epi32((int32_t)(int8_t)more >> + 7); // must be arithmetic shift + q = _mm_add_epi32( + q, _mm_sub_epi32(_mm_xor_si128(numers, sign), + sign)); // q += ((numer ^ sign) - sign); } - q = _mm_sra_epi32(q, libdivide_u32_to_m128i(more & LIBDIVIDE_32_SHIFT_MASK)); //q >>= shift - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) + q = _mm_sra_epi32( + q, libdivide_u32_to_m128i(more & + LIBDIVIDE_32_SHIFT_MASK)); // q >>= shift + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) return q; } } -__m128i libdivide_s32_do_vector_alg0(__m128i numers, const struct libdivide_s32_t *denom) { +__m128i libdivide_s32_do_vector_alg0(__m128i numers, + const struct libdivide_s32_t* denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); - __m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); + __m128i q = _mm_add_epi32( + numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); return _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter)); } -__m128i libdivide_s32_do_vector_alg1(__m128i numers, const struct libdivide_s32_t *denom) { +__m128i libdivide_s32_do_vector_alg1(__m128i numers, + const struct libdivide_s32_t* denom) { uint8_t shifter = denom->more & LIBDIVIDE_32_SHIFT_MASK; __m128i roundToZeroTweak = _mm_set1_epi32((1 << shifter) - 1); - __m128i q = _mm_add_epi32(numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); - return _mm_sub_epi32(_mm_setzero_si128(), _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter))); + __m128i q = _mm_add_epi32( + numers, _mm_and_si128(_mm_srai_epi32(numers, 31), roundToZeroTweak)); + return _mm_sub_epi32(_mm_setzero_si128(), + _mm_sra_epi32(q, libdivide_u32_to_m128i(shifter))); } -__m128i libdivide_s32_do_vector_alg2(__m128i numers, const struct libdivide_s32_t *denom) { - __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); +__m128i libdivide_s32_do_vector_alg2(__m128i numers, + const struct libdivide_s32_t* denom) { + __m128i q = + libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); q = _mm_add_epi32(q, numers); - q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); + q = _mm_sra_epi32( + q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); return q; } -__m128i libdivide_s32_do_vector_alg3(__m128i numers, const struct libdivide_s32_t *denom) { - __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); +__m128i libdivide_s32_do_vector_alg3(__m128i numers, + const struct libdivide_s32_t* denom) { + __m128i q = + libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); q = _mm_sub_epi32(q, numers); - q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); + q = _mm_sra_epi32( + q, libdivide_u32_to_m128i(denom->more & LIBDIVIDE_32_SHIFT_MASK)); + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); return q; } -__m128i libdivide_s32_do_vector_alg4(__m128i numers, const struct libdivide_s32_t *denom) { - __m128i q = libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); - q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more)); //q >>= shift - q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) - return q; +__m128i libdivide_s32_do_vector_alg4(__m128i numers, + const struct libdivide_s32_t* denom) { + __m128i q = + libdivide_mullhi_s32_flat_vector(numers, _mm_set1_epi32(denom->magic)); + q = _mm_sra_epi32(q, libdivide_u32_to_m128i(denom->more)); // q >>= shift + q = _mm_add_epi32(q, _mm_srli_epi32(q, 31)); // q += (q < 0) + return q; } #endif - + ///////////// SINT64 - struct libdivide_s64_t libdivide_s64_gen(int64_t d) { struct libdivide_s64_t result; - - /* If d is a power of 2, or negative a power of 2, we have to use a shift. This is especially important because the magic algorithm fails for -1. To check if d is a power of 2 or its inverse, it suffices to check whether its absolute value has exactly one bit set. This works even for INT_MIN, because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a power of 2. */ - const uint64_t absD = (uint64_t)(d < 0 ? -d : d); //gcc optimizes this to the fast abs trick - if ((absD & (absD - 1)) == 0) { //check if exactly one bit is set, don't care if absD is 0 since that's divide by zero - result.more = libdivide__count_trailing_zeros64(absD) | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); + + /* If d is a power of 2, or negative a power of 2, we have to use a shift. + * This is especially important because the magic algorithm fails for -1. To + * check if d is a power of 2 or its inverse, it suffices to check whether + * its absolute value has exactly one bit set. This works even for INT_MIN, + * because abs(INT_MIN) == INT_MIN, and INT_MIN has one bit set and is a + * power of 2. */ + const uint64_t absD = + (uint64_t)(d < 0 ? -d : d); // gcc optimizes this to the fast abs trick + if ((absD & (absD - 1)) == + 0) { // check if exactly one bit is set, don't care if absD is 0 since + // that's divide by zero + result.more = libdivide__count_trailing_zeros64(absD) | + (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); result.magic = 0; - } - else { - const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(absD); - - //the dividend here is 2**(floor_log_2_d + 63), so the low 64 bit word is 0 and the high word is floor_log_2_d - 1 + } else { + const uint32_t floor_log_2_d = + 63 - libdivide__count_leading_zeros64(absD); + + // the dividend here is 2**(floor_log_2_d + 63), so the low 64 bit word + // is 0 and the high word is floor_log_2_d - 1 uint8_t more; uint64_t rem, proposed_m; - proposed_m = libdivide_128_div_64_to_64(1ULL << (floor_log_2_d - 1), 0, absD, &rem); + proposed_m = libdivide_128_div_64_to_64(1ULL << (floor_log_2_d - 1), 0, + absD, &rem); const uint64_t e = absD - rem; - - /* We are going to start with a power of floor_log_2_d - 1. This works if works if e < 2**floor_log_2_d. */ + + /* We are going to start with a power of floor_log_2_d - 1. This works + * if works if e < 2**floor_log_2_d. */ if (e < (1ULL << floor_log_2_d)) { /* This power works */ more = floor_log_2_d - 1; - } - else { - /* We need to go one higher. This should not make proposed_m overflow, but it will make it negative when interpreted as an int32_t. */ + } else { + /* We need to go one higher. This should not make proposed_m + * overflow, but it will make it negative when interpreted as an + * int32_t. */ proposed_m += proposed_m; const uint64_t twice_rem = rem + rem; if (twice_rem >= absD || twice_rem < rem) proposed_m += 1; - more = floor_log_2_d | LIBDIVIDE_ADD_MARKER | (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); + more = floor_log_2_d | LIBDIVIDE_ADD_MARKER | + (d < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0); } proposed_m += 1; result.more = more; @@ -979,324 +1181,524 @@ struct libdivide_s64_t libdivide_s64_gen(int64_t d) { return result; } -int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t *denom) { +int64_t libdivide_s64_do(int64_t numer, const struct libdivide_s64_t* denom) { uint8_t more = denom->more; int64_t magic = denom->magic; - if (magic == 0) { //shift path + if (magic == 0) { // shift path uint32_t shifter = more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); q = q >> shifter; - int64_t shiftMask = (int8_t)more >> 7; //must be arithmetic shift and then sign-extend + int64_t shiftMask = + (int8_t)more >> 7; // must be arithmetic shift and then sign-extend q = (q ^ shiftMask) - shiftMask; return q; - } - else { + } else { int64_t q = libdivide__mullhi_s64(magic, numer); if (more & LIBDIVIDE_ADD_MARKER) { - int64_t sign = (int8_t)more >> 7; //must be arithmetic shift and then sign extend + int64_t sign = (int8_t)more >> + 7; // must be arithmetic shift and then sign extend q += ((numer ^ sign) - sign); } q >>= more & LIBDIVIDE_64_SHIFT_MASK; q += (q < 0); return q; } -} - - -int libdivide_s64_get_algorithm(const struct libdivide_s64_t *denom) { +} + +int libdivide_s64_get_algorithm(const struct libdivide_s64_t* denom) { uint8_t more = denom->more; - int positiveDivisor = ! (more & LIBDIVIDE_NEGATIVE_DIVISOR); - if (denom->magic == 0) return (positiveDivisor ? 0 : 1); //shift path - else if (more & LIBDIVIDE_ADD_MARKER) return (positiveDivisor ? 2 : 3); - else return 4; + int positiveDivisor = !(more & LIBDIVIDE_NEGATIVE_DIVISOR); + if (denom->magic == 0) + return (positiveDivisor ? 0 : 1); // shift path + else if (more & LIBDIVIDE_ADD_MARKER) + return (positiveDivisor ? 2 : 3); + else + return 4; } - -int64_t libdivide_s64_do_alg0(int64_t numer, const struct libdivide_s64_t *denom) { + +int64_t libdivide_s64_do_alg0(int64_t numer, + const struct libdivide_s64_t* denom) { uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); - return q >> shifter; + return q >> shifter; } - -int64_t libdivide_s64_do_alg1(int64_t numer, const struct libdivide_s64_t *denom) { - //denom->shifter != -1 && demo->shiftMask != 0 + +int64_t libdivide_s64_do_alg1(int64_t numer, + const struct libdivide_s64_t* denom) { + // denom->shifter != -1 && demo->shiftMask != 0 uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; int64_t q = numer + ((numer >> 63) & ((1LL << shifter) - 1)); - return - (q >> shifter); + return -(q >> shifter); } - -int64_t libdivide_s64_do_alg2(int64_t numer, const struct libdivide_s64_t *denom) { + +int64_t libdivide_s64_do_alg2(int64_t numer, + const struct libdivide_s64_t* denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q += numer; q >>= denom->more & LIBDIVIDE_64_SHIFT_MASK; q += (q < 0); return q; } - -int64_t libdivide_s64_do_alg3(int64_t numer, const struct libdivide_s64_t *denom) { + +int64_t libdivide_s64_do_alg3(int64_t numer, + const struct libdivide_s64_t* denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q -= numer; q >>= denom->more & LIBDIVIDE_64_SHIFT_MASK; - q += (q < 0); + q += (q < 0); return q; } - -int64_t libdivide_s64_do_alg4(int64_t numer, const struct libdivide_s64_t *denom) { + +int64_t libdivide_s64_do_alg4(int64_t numer, + const struct libdivide_s64_t* denom) { int64_t q = libdivide__mullhi_s64(denom->magic, numer); q >>= denom->more; q += (q < 0); - return q; + return q; } - #if LIBDIVIDE_USE_SSE2 -__m128i libdivide_s64_do_vector(__m128i numers, const struct libdivide_s64_t * denom) { +__m128i libdivide_s64_do_vector(__m128i numers, + const struct libdivide_s64_t* denom) { uint8_t more = denom->more; int64_t magic = denom->magic; - if (magic == 0) { //shift path + if (magic == 0) { // shift path uint32_t shifter = more & LIBDIVIDE_64_SHIFT_MASK; __m128i roundToZeroTweak = libdivide__u64_to_m128((1LL << shifter) - 1); - __m128i q = _mm_add_epi64(numers, _mm_and_si128(libdivide_s64_signbits(numers), roundToZeroTweak)); //q = numer + ((numer >> 63) & roundToZeroTweak); - q = libdivide_s64_shift_right_vector(q, shifter); // q = q >> shifter + __m128i q = _mm_add_epi64( + numers, + _mm_and_si128(libdivide_s64_signbits(numers), + roundToZeroTweak)); // q = numer + ((numer >> 63) & + // roundToZeroTweak); + q = libdivide_s64_shift_right_vector(q, shifter); // q = q >> shifter __m128i shiftMask = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); - q = _mm_sub_epi64(_mm_xor_si128(q, shiftMask), shiftMask); //q = (q ^ shiftMask) - shiftMask; + q = _mm_sub_epi64(_mm_xor_si128(q, shiftMask), + shiftMask); // q = (q ^ shiftMask) - shiftMask; return q; - } - else { - __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(magic)); + } else { + __m128i q = libdivide_mullhi_s64_flat_vector( + numers, libdivide__u64_to_m128(magic)); if (more & LIBDIVIDE_ADD_MARKER) { - __m128i sign = _mm_set1_epi32((int32_t)((int8_t)more >> 7)); //must be arithmetic shift - q = _mm_add_epi64(q, _mm_sub_epi64(_mm_xor_si128(numers, sign), sign)); // q += ((numer ^ sign) - sign); + __m128i sign = _mm_set1_epi32( + (int32_t)((int8_t)more >> 7)); // must be arithmetic shift + q = _mm_add_epi64( + q, _mm_sub_epi64(_mm_xor_si128(numers, sign), + sign)); // q += ((numer ^ sign) - sign); } - q = libdivide_s64_shift_right_vector(q, more & LIBDIVIDE_64_SHIFT_MASK); //q >>= denom->mult_path.shift - q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) + q = libdivide_s64_shift_right_vector( + q, more & LIBDIVIDE_64_SHIFT_MASK); // q >>= denom->mult_path.shift + q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) return q; } } -__m128i libdivide_s64_do_vector_alg0(__m128i numers, const struct libdivide_s64_t *denom) { +__m128i libdivide_s64_do_vector_alg0(__m128i numers, + const struct libdivide_s64_t* denom) { uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; __m128i roundToZeroTweak = libdivide__u64_to_m128((1LL << shifter) - 1); - __m128i q = _mm_add_epi64(numers, _mm_and_si128(libdivide_s64_signbits(numers), roundToZeroTweak)); + __m128i q = _mm_add_epi64( + numers, + _mm_and_si128(libdivide_s64_signbits(numers), roundToZeroTweak)); q = libdivide_s64_shift_right_vector(q, shifter); return q; } -__m128i libdivide_s64_do_vector_alg1(__m128i numers, const struct libdivide_s64_t *denom) { +__m128i libdivide_s64_do_vector_alg1(__m128i numers, + const struct libdivide_s64_t* denom) { uint32_t shifter = denom->more & LIBDIVIDE_64_SHIFT_MASK; __m128i roundToZeroTweak = libdivide__u64_to_m128((1LL << shifter) - 1); - __m128i q = _mm_add_epi64(numers, _mm_and_si128(libdivide_s64_signbits(numers), roundToZeroTweak)); + __m128i q = _mm_add_epi64( + numers, + _mm_and_si128(libdivide_s64_signbits(numers), roundToZeroTweak)); q = libdivide_s64_shift_right_vector(q, shifter); return _mm_sub_epi64(_mm_setzero_si128(), q); } -__m128i libdivide_s64_do_vector_alg2(__m128i numers, const struct libdivide_s64_t *denom) { - __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); +__m128i libdivide_s64_do_vector_alg2(__m128i numers, + const struct libdivide_s64_t* denom) { + __m128i q = libdivide_mullhi_s64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); q = _mm_add_epi64(q, numers); - q = libdivide_s64_shift_right_vector(q, denom->more & LIBDIVIDE_64_SHIFT_MASK); - q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) + q = libdivide_s64_shift_right_vector(q, + denom->more & LIBDIVIDE_64_SHIFT_MASK); + q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) return q; } -__m128i libdivide_s64_do_vector_alg3(__m128i numers, const struct libdivide_s64_t *denom) { - __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); +__m128i libdivide_s64_do_vector_alg3(__m128i numers, + const struct libdivide_s64_t* denom) { + __m128i q = libdivide_mullhi_s64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); q = _mm_sub_epi64(q, numers); - q = libdivide_s64_shift_right_vector(q, denom->more & LIBDIVIDE_64_SHIFT_MASK); - q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) - return q; + q = libdivide_s64_shift_right_vector(q, + denom->more & LIBDIVIDE_64_SHIFT_MASK); + q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); // q += (q < 0) + return q; } -__m128i libdivide_s64_do_vector_alg4(__m128i numers, const struct libdivide_s64_t *denom) { - __m128i q = libdivide_mullhi_s64_flat_vector(numers, libdivide__u64_to_m128(denom->magic)); +__m128i libdivide_s64_do_vector_alg4(__m128i numers, + const struct libdivide_s64_t* denom) { + __m128i q = libdivide_mullhi_s64_flat_vector( + numers, libdivide__u64_to_m128(denom->magic)); q = libdivide_s64_shift_right_vector(q, denom->more); q = _mm_add_epi64(q, _mm_srli_epi64(q, 63)); - return q; + return q; } #endif - + /////////// C++ stuff - + #ifdef __cplusplus -/* The C++ template design here is a total mess. This needs to be fixed by someone better at templates than I. The current design is: +/* The C++ template design here is a total mess. This needs to be fixed by +someone better at templates than I. The current design is: -- The base is a template divider_base that takes the integer type, the libdivide struct, a generating function, a get algorithm function, a do function, and either a do vector function or a dummy int. -- The base has storage for the libdivide struct. This is the only storage (so the C++ class should be no larger than the libdivide struct). +- The base is a template divider_base that takes the integer type, the libdivide +struct, a generating function, a get algorithm function, a do function, and +either a do vector function or a dummy int. +- The base has storage for the libdivide struct. This is the only storage (so +the C++ class should be no larger than the libdivide struct). -- Above that, there's divider_mid. This is an empty struct by default, but it is specialized against our four int types. divider_mid contains a template struct algo, that contains a typedef for a specialization of divider_base. struct algo is specialized to take an "algorithm number," where -1 means to use the general algorithm. +- Above that, there's divider_mid. This is an empty struct by default, but it +is specialized against our four int types. divider_mid contains a template +struct algo, that contains a typedef for a specialization of divider_base. +struct algo is specialized to take an "algorithm number," where -1 means to use +the general algorithm. -- Publicly we have class divider, which inherits from divider_mid::algo. This also take an algorithm number, which defaults to -1 (the general algorithm). -- divider has a operator / which allows you to use a divider as the divisor in a quotient expression. +- Publicly we have class divider, which inherits from divider_mid::algo. This +also take an algorithm number, which defaults to -1 (the general algorithm). +- divider has a operator / which allows you to use a divider as the divisor in a +quotient expression. */ namespace libdivide_internal { - + #if LIBDIVIDE_USE_SSE2 #define MAYBE_VECTOR(x) x -#define MAYBE_VECTOR_PARAM __m128i vector_func(__m128i, const DenomType *) +#define MAYBE_VECTOR_PARAM __m128i vector_func(__m128i, const DenomType*) #else #define MAYBE_VECTOR(x) 0 #define MAYBE_VECTOR_PARAM int vector_func #endif - /* Some bogus unswitch functions for unsigned types so the same (presumably templated) code can work for both signed and unsigned. */ - uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *(uint32_t *)nullptr; } - uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *(uint64_t *)nullptr; } -#if LIBDIVIDE_USE_SSE2 - __m128i crash_u32_vector(__m128i, const libdivide_u32_t *) { abort(); return *(__m128i *)nullptr; } - __m128i crash_u64_vector(__m128i, const libdivide_u64_t *) { abort(); return *(__m128i *)nullptr; } -#endif - - template - class divider_base { - public: - DenomType denom; - divider_base(IntType d) : denom(gen_func(d)) { } - divider_base(const DenomType & d) : denom(d) { } - - IntType perform_divide(IntType val) const { return do_func(val, &denom); } -#if LIBDIVIDE_USE_SSE2 - __m128i perform_divide_vector(__m128i val) const { return vector_func(val, &denom); } -#endif - - int get_algorithm() const { return get_algo(&denom); } - }; - - - template struct divider_mid { }; - - template<> struct divider_mid { - typedef uint32_t IntType; - typedef struct libdivide_u32_t DenomType; - template struct denom { - typedef divider_base divider; - }; - - template struct algo { }; - template struct algo<-1, J> { typedef denom::divider divider; }; - template struct algo<0, J> { typedef denom::divider divider; }; - template struct algo<1, J> { typedef denom::divider divider; }; - template struct algo<2, J> { typedef denom::divider divider; }; - - /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ - template struct algo<3, J> { typedef denom::divider divider; }; - template struct algo<4, J> { typedef denom::divider divider; }; - - }; - - template<> struct divider_mid { - typedef int32_t IntType; - typedef struct libdivide_s32_t DenomType; - template struct denom { - typedef divider_base divider; - }; - - - template struct algo { }; - template struct algo<-1, J> { typedef denom::divider divider; }; - template struct algo<0, J> { typedef denom::divider divider; }; - template struct algo<1, J> { typedef denom::divider divider; }; - template struct algo<2, J> { typedef denom::divider divider; }; - template struct algo<3, J> { typedef denom::divider divider; }; - template struct algo<4, J> { typedef denom::divider divider; }; - - }; - - template<> struct divider_mid { - typedef uint64_t IntType; - typedef struct libdivide_u64_t DenomType; - template struct denom { - typedef divider_base divider; - }; - - template struct algo { }; - template struct algo<-1, J> { typedef denom::divider divider; }; - template struct algo<0, J> { typedef denom::divider divider; }; - template struct algo<1, J> { typedef denom::divider divider; }; - template struct algo<2, J> { typedef denom::divider divider; }; - - /* Define two more bogus ones so that the same (templated, presumably) code can handle both signed and unsigned */ - template struct algo<3, J> { typedef denom::divider divider; }; - template struct algo<4, J> { typedef denom::divider divider; }; - - - }; - - template<> struct divider_mid { - typedef int64_t IntType; - typedef struct libdivide_s64_t DenomType; - template struct denom { - typedef divider_base divider; - }; - - template struct algo { }; - template struct algo<-1, J> { typedef denom::divider divider; }; - template struct algo<0, J> { typedef denom::divider divider; }; - template struct algo<1, J> { typedef denom::divider divider; }; - template struct algo<2, J> { typedef denom::divider divider; }; - template struct algo<3, J> { typedef denom::divider divider; }; - template struct algo<4, J> { typedef denom::divider divider; }; - }; - +/* Some bogus unswitch functions for unsigned types so the same (presumably + * templated) code can work for both signed and unsigned. */ +uint32_t crash_u32(uint32_t, const libdivide_u32_t*) { + abort(); + return *(uint32_t*)nullptr; } +uint64_t crash_u64(uint64_t, const libdivide_u64_t*) { + abort(); + return *(uint64_t*)nullptr; +} +#if LIBDIVIDE_USE_SSE2 +__m128i crash_u32_vector(__m128i, const libdivide_u32_t*) { + abort(); + return *(__m128i*)nullptr; +} +__m128i crash_u64_vector(__m128i, const libdivide_u64_t*) { + abort(); + return *(__m128i*)nullptr; +} +#endif -template -class divider -{ - private: - typename libdivide_internal::divider_mid::template algo::divider sub; - template friend divider unswitch(const divider & d); - divider(const typename libdivide_internal::divider_mid::DenomType & denom) : sub(denom) { } - - public: - +template +class divider_base { +public: + DenomType denom; + divider_base(IntType d) : denom(gen_func(d)) {} + divider_base(const DenomType& d) : denom(d) {} + + IntType perform_divide(IntType val) const { return do_func(val, &denom); } +#if LIBDIVIDE_USE_SSE2 + __m128i perform_divide_vector(__m128i val) const { + return vector_func(val, &denom); + } +#endif + + int get_algorithm() const { return get_algo(&denom); } +}; + +template +struct divider_mid {}; + +template <> +struct divider_mid { + typedef uint32_t IntType; + typedef struct libdivide_u32_t DenomType; + template + struct denom { + typedef divider_base + divider; + }; + + template + struct algo {}; + template + struct algo<-1, J> { + typedef denom::divider divider; + }; + template + struct algo<0, J> { + typedef denom::divider + divider; + }; + template + struct algo<1, J> { + typedef denom::divider + divider; + }; + template + struct algo<2, J> { + typedef denom::divider + divider; + }; + + /* Define two more bogus ones so that the same (templated, presumably) code + * can handle both signed and unsigned */ + template + struct algo<3, J> { + typedef denom::divider + divider; + }; + template + struct algo<4, J> { + typedef denom::divider + divider; + }; +}; + +template <> +struct divider_mid { + typedef int32_t IntType; + typedef struct libdivide_s32_t DenomType; + template + struct denom { + typedef divider_base + divider; + }; + + template + struct algo {}; + template + struct algo<-1, J> { + typedef denom::divider divider; + }; + template + struct algo<0, J> { + typedef denom::divider + divider; + }; + template + struct algo<1, J> { + typedef denom::divider + divider; + }; + template + struct algo<2, J> { + typedef denom::divider + divider; + }; + template + struct algo<3, J> { + typedef denom::divider + divider; + }; + template + struct algo<4, J> { + typedef denom::divider + divider; + }; +}; + +template <> +struct divider_mid { + typedef uint64_t IntType; + typedef struct libdivide_u64_t DenomType; + template + struct denom { + typedef divider_base + divider; + }; + + template + struct algo {}; + template + struct algo<-1, J> { + typedef denom::divider divider; + }; + template + struct algo<0, J> { + typedef denom::divider + divider; + }; + template + struct algo<1, J> { + typedef denom::divider + divider; + }; + template + struct algo<2, J> { + typedef denom::divider + divider; + }; + + /* Define two more bogus ones so that the same (templated, presumably) code + * can handle both signed and unsigned */ + template + struct algo<3, J> { + typedef denom::divider + divider; + }; + template + struct algo<4, J> { + typedef denom::divider + divider; + }; +}; + +template <> +struct divider_mid { + typedef int64_t IntType; + typedef struct libdivide_s64_t DenomType; + template + struct denom { + typedef divider_base + divider; + }; + + template + struct algo {}; + template + struct algo<-1, J> { + typedef denom::divider divider; + }; + template + struct algo<0, J> { + typedef denom::divider + divider; + }; + template + struct algo<1, J> { + typedef denom::divider + divider; + }; + template + struct algo<2, J> { + typedef denom::divider + divider; + }; + template + struct algo<3, J> { + typedef denom::divider + divider; + }; + template + struct algo<4, J> { + typedef denom::divider + divider; + }; +}; + +} // namespace libdivide_internal + +template +class divider { +private: + typename libdivide_internal::divider_mid::template algo::divider + sub; + template + friend divider unswitch(const divider& d); + divider(const typename libdivide_internal::divider_mid::DenomType& denom) + : sub(denom) {} + +public: /* Ordinary constructor, that takes the divisor as a parameter. */ - divider(T n) : sub(n) { } - + divider(T n) : sub(n) {} + /* Default constructor, that divides by 1 */ - divider() : sub(1) { } - + divider() : sub(1) {} + /* Divides the parameter by the divisor, returning the quotient */ T perform_divide(T val) const { return sub.perform_divide(val); } - + #if LIBDIVIDE_USE_SSE2 - /* Treats the vector as either two or four packed values (depending on the size), and divides each of them by the divisor, returning the packed quotients. */ - __m128i perform_divide_vector(__m128i val) const { return sub.perform_divide_vector(val); } + /* Treats the vector as either two or four packed values (depending on the + * size), and divides each of them by the divisor, returning the packed + * quotients. */ + __m128i perform_divide_vector(__m128i val) const { + return sub.perform_divide_vector(val); + } #endif /* Returns the index of algorithm, for use in the unswitch function */ - int get_algorithm() const { return sub.get_algorithm(); } // returns the algorithm for unswitching - + int get_algorithm() const { + return sub.get_algorithm(); + } // returns the algorithm for unswitching + /* operator== */ - bool operator==(const divider & him) const { return sub.denom.magic == him.sub.denom.magic && sub.denom.more == him.sub.denom.more; } - - bool operator!=(const divider & him) const { return ! (*this == him); } + bool operator==(const divider& him) const { + return sub.denom.magic == him.sub.denom.magic && + sub.denom.more == him.sub.denom.more; + } + + bool operator!=(const divider& him) const { + return !(*this == him); + } }; /* Returns a divider specialized for the given algorithm. */ -template -divider unswitch(const divider & d) { return divider(d.sub.denom); } +template +divider unswitch(const divider& d) { + return divider(d.sub.denom); +} /* Overload of the / operator for scalar division. */ -template -int_type operator/(int_type numer, const divider & denom) { +template +int_type operator/(int_type numer, const divider& denom) { return denom.perform_divide(numer); } -#if LIBDIVIDE_USE_SSE2 +#if LIBDIVIDE_USE_SSE2 /* Overload of the / operator for vector division. */ -template -__m128i operator/(__m128i numer, const divider & denom) { +template +__m128i operator/(__m128i numer, const divider& denom) { return denom.perform_divide_vector(numer); } #endif - - -#endif //__cplusplus - -#endif //LIBDIVIDE_HEADER_ONLY + +#endif //__cplusplus + +#endif // LIBDIVIDE_HEADER_ONLY #ifdef __cplusplus -} //close namespace libdivide -} //close anonymous namespace +} // close namespace libdivide +} // close anonymous namespace #endif diff --git a/Minecraft.World/WorldGen/Biomes/BiomeSource.cpp b/Minecraft.World/WorldGen/Biomes/BiomeSource.cpp index e79dfa75b..76e896d34 100644 --- a/Minecraft.World/WorldGen/Biomes/BiomeSource.cpp +++ b/Minecraft.World/WorldGen/Biomes/BiomeSource.cpp @@ -135,7 +135,6 @@ BiomeArray BiomeSource::getRawBiomeBlock(int x, int z, int w, int h) const { // 4J added void BiomeSource::getRawBiomeIndices(intArray& biomes, int x, int z, int w, int h) const { - intArray result = layer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { biomes[i] = result[i]; @@ -351,9 +350,7 @@ void BiomeSource::update() { cache->update(); } // #define DEBUG_SEEDS 50 // 4J added - find a seed for this biomesource that matches certain criteria -int64_t BiomeSource::findSeed(LevelType* generator) -{ - +int64_t BiomeSource::findSeed(LevelType* generator) { int64_t bestSeed = 0; ProgressRenderer* mcprogress = Minecraft::GetInstance()->progressRenderer; diff --git a/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp b/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp index 051204266..e8e9c7d2a 100644 --- a/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp @@ -67,8 +67,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, (x == xCenterFeatureChunk && z == zCenterFeatureChunk)) { Biome* biome = level->getBiomeSource()->getBiome(x * 16 + 8, z * 16 + 8); - for (auto it = allowedBiomes.begin(); it != allowedBiomes.end(); - ++it) { + for (auto it = allowedBiomes.begin(); it != allowedBiomes.end(); ++it) { Biome* a = *it; if (biome == a) { return true; @@ -122,7 +121,8 @@ bool RandomScatteredLargeFeature::isSwamphut(int cellX, int cellY, int cellZ) { StructurePiece* first = nullptr; auto it = structureAt->pieces.begin(); if (it != structureAt->pieces.end()) first = *it; - return dynamic_cast(first) != nullptr; + return dynamic_cast(first) != + nullptr; } std::vector* diff --git a/Minecraft.World/WorldGen/Features/StructureFeature.cpp b/Minecraft.World/WorldGen/Features/StructureFeature.cpp index 2cad49ffc..749990f5b 100644 --- a/Minecraft.World/WorldGen/Features/StructureFeature.cpp +++ b/Minecraft.World/WorldGen/Features/StructureFeature.cpp @@ -134,8 +134,7 @@ StructureStart* StructureFeature::getStructureAt(int cellX, int cellY, std::list* pieces = pStructureStart->getPieces(); - for (auto it2 = pieces->begin(); it2 != pieces->end(); - it2++) { + for (auto it2 = pieces->begin(); it2 != pieces->end(); it2++) { StructurePiece* piece = *it2; if (piece->getBoundingBox()->isInside(cellX, cellY, cellZ)) { diff --git a/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp b/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp index 66a42933f..9971645cc 100644 --- a/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp +++ b/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp @@ -44,9 +44,7 @@ void FlatGeneratorInfo::updateLayers() { } } -std::wstring FlatGeneratorInfo::toString() { - return L""; -} +std::wstring FlatGeneratorInfo::toString() { return L""; } FlatLayerInfo* FlatGeneratorInfo::getLayerFromString(const std::wstring& input, int yOffset) { @@ -74,7 +72,6 @@ std::vector* FlatGeneratorInfo::getLayersFromString( FlatGeneratorInfo* FlatGeneratorInfo::fromValue(const std::wstring& input) { return getDefault(); - } FlatGeneratorInfo* FlatGeneratorInfo::getDefault() { diff --git a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp index 9a8fa91dd..eb0dc5cd1 100644 --- a/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp +++ b/Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp @@ -9,16 +9,16 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { #if defined(_UNICODE) std::wstring path = L"GAME:\\GameRules\\biomemap.bin"; - void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, nullptr); + void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else #if defined(_WINDOWS64) std::string path = "GameRules\\biomemap.bin"; #else std::string path = "GAME:\\GameRules\\biomemap.bin"; #endif - void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, nullptr); + void* file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if (file == INVALID_HANDLE_VALUE) { uint32_t error = GetLastError(); @@ -32,8 +32,8 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) { app.DebugPrintf("Biomemap binary is too large!!\n"); __debugbreak(); } - bool bSuccess = - ReadFile(file, m_biomeOverride.data, dwFileSize, &bytesRead, nullptr); + bool bSuccess = ReadFile(file, m_biomeOverride.data, dwFileSize, + &bytesRead, nullptr); if (bSuccess == false) { app.FatalLoadError(); diff --git a/Minecraft.World/WorldGen/Layers/Layer.cpp b/Minecraft.World/WorldGen/Layers/Layer.cpp index 66983ff80..cd97198b9 100644 --- a/Minecraft.World/WorldGen/Layers/Layer.cpp +++ b/Minecraft.World/WorldGen/Layers/Layer.cpp @@ -3,7 +3,6 @@ #include "../../Headers/net.minecraft.world.level.h" #include "BiomeOverrideLayer.h" - LayerArray Layer::getDefaultLayers(int64_t seed, LevelType* levelType) { // 4J - Some changes moved here from 1.2.3. Temperature & downfall layers // are no longer created & returned, and a debug layer is isn't. For @@ -160,7 +159,6 @@ void Layer::initRandom(int64_t x, int64_t y) { } int Layer::nextRandom(int max) { - int result = (int)((rval >> 24) % max); if (result < 0) result += max; diff --git a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp index 090b4999e..216958a2c 100644 --- a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp @@ -113,8 +113,8 @@ MineShaftPieces::MineShaftRoom::MineShaftRoom(int genDepth, Random* random, } MineShaftPieces::MineShaftRoom::~MineShaftRoom() { - for (auto it = childEntranceBoxes.begin(); - it != childEntranceBoxes.end(); ++it) { + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); + ++it) { delete (*it); } } @@ -225,8 +225,8 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level* level, Random* random, boundingBox->z0, boundingBox->x1, std::min(boundingBox->y0 + 3, boundingBox->y1), boundingBox->z1, 0, 0, false); - for (auto it = childEntranceBoxes.begin(); - it != childEntranceBoxes.end(); ++it) { + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); + ++it) { BoundingBox* entranceBox = *it; generateBox(level, chunkBB, entranceBox->x0, entranceBox->y1 - (DEFAULT_SHAFT_HEIGHT - 1), @@ -242,8 +242,8 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level* level, Random* random, void MineShaftPieces::MineShaftRoom::addAdditonalSaveData(CompoundTag* tag) { ListTag* entrances = new ListTag(L"Entrances"); - for (auto it = childEntranceBoxes.begin(); - it != childEntranceBoxes.end(); ++it) { + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); + ++it) { BoundingBox* bb = *it; entrances->add(bb->createTag(L"")); } diff --git a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp index e86172c39..47e003124 100644 --- a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp @@ -185,8 +185,7 @@ int NetherBridgePieces::NetherBridgePiece::updatePieceWeight( std::list* currentPieces) { bool hasAnyPieces = false; int totalWeight = 0; - for (auto it = currentPieces->begin(); it != currentPieces->end(); - it++) { + for (auto it = currentPieces->begin(); it != currentPieces->end(); it++) { PieceWeight* piece = *it; if (piece->maxPlaceCount > 0 && diff --git a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp index 4c8a4c805..dd35a16d8 100644 --- a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp @@ -165,8 +165,7 @@ StrongholdPieces::StrongholdPiece* StrongholdPieces::generatePieceFromSmallDoor( numAttempts++; int weightSelection = random->nextInt(totalWeight); - for (auto it = currentPieces.begin(); it != currentPieces.end(); - it++) { + for (auto it = currentPieces.begin(); it != currentPieces.end(); it++) { PieceWeight* piece = *it; weightSelection -= piece->weight; if (weightSelection < 0) { @@ -461,8 +460,9 @@ bool StrongholdPieces::StrongholdPiece::isOkBox(BoundingBox* box, if (box != nullptr) { if (box->y0 > LOWEST_Y_POSITION) bIsOk = true; - if (startRoom != nullptr && startRoom->m_level->getOriginalSaveVersion() >= - SAVE_FILE_VERSION_MOVED_STRONGHOLD) { + if (startRoom != nullptr && + startRoom->m_level->getOriginalSaveVersion() >= + SAVE_FILE_VERSION_MOVED_STRONGHOLD) { int xzSize = startRoom->m_level->getLevelData()->getXZSize(); int blockMin = -((xzSize << 4) / 2) + 1; int blockMax = ((xzSize << 4) / 2) - 1; diff --git a/Minecraft.World/WorldGen/Structures/Village.cpp b/Minecraft.World/WorldGen/Structures/Village.cpp index fcd8ebf60..aa6ae7c19 100644 --- a/Minecraft.World/WorldGen/Structures/Village.cpp +++ b/Minecraft.World/WorldGen/Structures/Village.cpp @@ -120,19 +120,18 @@ void Village::countGolem() { AABB village_golem_bb = AABB(center->x, center->y, center->z, center->x, center->y, center->z) .grow(radius, 4, radius); - std::vector >* golems = level->getEntitiesOfClass( - typeid(VillagerGolem), - &village_golem_bb); + std::vector >* golems = + level->getEntitiesOfClass(typeid(VillagerGolem), &village_golem_bb); golemCount = golems->size(); delete golems; } void Village::countPopulation() { - AABB villager_bb = AABB(center->x, center->y, center->z, center->x, center->y, center->z).grow(radius, 4, radius); + AABB villager_bb = + AABB(center->x, center->y, center->z, center->x, center->y, center->z) + .grow(radius, 4, radius); std::vector >* villagers = - level->getEntitiesOfClass( - typeid(Villager), - &villager_bb); + level->getEntitiesOfClass(typeid(Villager), &villager_bb); populationSize = villagers->size(); delete villagers; @@ -254,8 +253,7 @@ std::shared_ptr Village::getClosestBadStandingPlayer( std::shared_ptr closest = nullptr; // for (String player : playerStanding.keySet()) - for (auto it = playerStanding.begin(); it != playerStanding.end(); - ++it) { + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { std::wstring player = it->first; if (isVeryBadStanding(player)) { std::shared_ptr mob = level->getPlayerByName(player); @@ -429,8 +427,7 @@ void Village::addAdditonalSaveData(CompoundTag* tag) { ListTag* playerTags = new ListTag(L"Players"); // for (String player : playerStanding.keySet()) - for (auto it = playerStanding.begin(); it != playerStanding.end(); - ++it) { + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { std::wstring player = it->first; CompoundTag* playerTag = new CompoundTag(player); playerTag->putString(L"Name", player); @@ -452,8 +449,7 @@ bool Village::isBreedTimerOk() { void Village::rewardAllPlayers(int amount) { // for (String player : playerStanding.keySet()) - for (auto it = playerStanding.begin(); it != playerStanding.end(); - ++it) { + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { modifyStanding(it->first, amount); } } diff --git a/Minecraft.World/WorldGen/Structures/Village.h b/Minecraft.World/WorldGen/Structures/Village.h index b63f3e8e9..111d0a349 100644 --- a/Minecraft.World/WorldGen/Structures/Village.h +++ b/Minecraft.World/WorldGen/Structures/Village.h @@ -37,7 +37,8 @@ public: void tick(int tick); private: - std::optional findRandomSpawnPos(int x, int y, int z, int sx, int sy, int sz); + std::optional findRandomSpawnPos(int x, int y, int z, int sx, int sy, + int sz); bool canSpawnAt(int x, int y, int z, int sx, int sy, int sz); void countGolem(); void countPopulation(); diff --git a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp index 53f0e2f2e..2b9f3dcaa 100644 --- a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp @@ -110,8 +110,7 @@ std::list* VillagePieces::createPieceSet( int VillagePieces::updatePieceWeight(std::list* currentPieces) { bool hasAnyPieces = false; int totalWeight = 0; - for (auto it = currentPieces->begin(); it != currentPieces->end(); - it++) { + for (auto it = currentPieces->begin(); it != currentPieces->end(); it++) { PieceWeight* piece = *it; if (piece->maxPlaceCount > 0 && piece->placeCount < piece->maxPlaceCount) { @@ -599,8 +598,8 @@ VillagePieces::StartPiece::StartPiece(BiomeSource* biomeSource, int genDepth, std::list* pieceSet, int villageSize, Level* level) : Well(nullptr, 0, random, west, north) { - isLibraryAdded = false; // 4J - added initialiser - previousPiece = nullptr; // 4J - added initialiser + isLibraryAdded = false; // 4J - added initialiser + previousPiece = nullptr; // 4J - added initialiser this->biomeSource = biomeSource; this->pieceSet = pieceSet; this->villageSize = villageSize; From 826862e79e0fe3ff3f831c52ad93d4ec9d32e03d Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 30 Mar 2026 02:19:38 -0500 Subject: [PATCH 2/4] format more things i missed --- Minecraft.Client/Commands/TeleportCommand.cpp | 2 +- .../Platform/Common/UI/UIScene_ControlsMenu.h | 112 +++++++++--------- Minecraft.Client/Platform/Extrax64Stubs.cpp | 5 +- .../Platform/Linux/Iggy/include/gdraw.h | 4 +- .../Platform/Windows64/Iggy/gdraw/gdraw_wgl.c | 2 +- .../Platform/Windows64/Iggy/include/gdraw.h | 4 +- .../Sentient/DynamicConfigurations.h | 2 +- .../Platform/Windows64/Windows64_App.cpp | 6 +- Minecraft.Client/Rendering/LevelRenderer.cpp | 2 +- Minecraft.World/IO/Files/FileHeader.cpp | 5 +- 10 files changed, 76 insertions(+), 68 deletions(-) diff --git a/Minecraft.Client/Commands/TeleportCommand.cpp b/Minecraft.Client/Commands/TeleportCommand.cpp index dab978392..4c6a39236 100644 --- a/Minecraft.Client/Commands/TeleportCommand.cpp +++ b/Minecraft.Client/Commands/TeleportCommand.cpp @@ -81,7 +81,7 @@ void TeleportCommand::execute(std::shared_ptr source, // victim.connection.teleport(destination.x, destination.y, // destination.z, destination.yRot, destination.xRot); // logAdminAction(source, "commands.tp.success", victim.getAName(), - //destination.getAName()); + // destination.getAName()); // } //} } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h index 9bdb85118..a3733cae7 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h @@ -87,67 +87,73 @@ UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") UI_MAP_ELEMENT( "LabelRS_2") UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], "LabelTouch") - UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") UI_MAP_ELEMENT( - m_controlLines[e_PadLT], - "LineLT") UI_MAP_ELEMENT(m_controlLines[e_PadLB], - "LineLB") UI_MAP_ELEMENT(m_controlLines - [e_PadDPadLeft], - "Line" - "Dpad" - "Lef" - "t") - UI_MAP_ELEMENT( - m_controlLines[e_PadDPadRight], - "LineDpadRight") UI_MAP_ELEMENT(m_controlLines - [e_PadDPadUp], - "LineDpadUp") + UI_MAP_ELEMENT( + m_controlLines[e_PadBack], + "LineBack") UI_MAP_ELEMENT(m_controlLines[e_PadLT], + "LineLT") + UI_MAP_ELEMENT(m_controlLines[e_PadLB], "LineLB") UI_MAP_ELEMENT( + m_controlLines[e_PadDPadLeft], + "Line" + "Dpad" + "Lef" + "t") UI_MAP_ELEMENT(m_controlLines[e_PadDPadRight], + "LineDpadRight") UI_MAP_ELEMENT( - m_controlLines[e_PadDPadDown], - "LineDpadDown") UI_MAP_ELEMENT(m_controlLines - [e_PadLS_1], - "LineL3") + m_controlLines[e_PadDPadUp], + "LineDpadUp") UI_MAP_ELEMENT(m_controlLines + [e_PadDPadDown], + "LineDpadDown") UI_MAP_ELEMENT( - m_controlLines[e_PadLS_2], - "LineLeftStick") UI_MAP_ELEMENT(m_controlLines - [e_PadStart], - "LineStart") + m_controlLines[e_PadLS_1], + "LineL3") UI_MAP_ELEMENT(m_controlLines + [e_PadLS_2], + "LineLeftStick") UI_MAP_ELEMENT( - m_controlLines[e_PadRT], - "LineRT") UI_MAP_ELEMENT(m_controlLines - [e_PadRB], - "LineRB") + m_controlLines[e_PadStart], + "LineStart") UI_MAP_ELEMENT(m_controlLines + [e_PadRT], + "LineRT") UI_MAP_ELEMENT( - m_controlLines[e_PadY], - "LineY") UI_MAP_ELEMENT(m_controlLines - [e_PadB], - "LineB") + m_controlLines[e_PadRB], + "LineRB") UI_MAP_ELEMENT(m_controlLines + [e_PadY], + "LineY") UI_MAP_ELEMENT( - m_controlLines[e_PadA], - "LineA") UI_MAP_ELEMENT(m_controlLines - [e_PadX], - "LineX") + m_controlLines[e_PadB], + "LineB") UI_MAP_ELEMENT(m_controlLines + [e_PadA], + "LineA") UI_MAP_ELEMENT( - m_controlLines[e_PadRS_1], - "LineR3") UI_MAP_ELEMENT(m_controlLines - [e_PadRS_2], - "L" - "i" - "n" - "e" - "R" - "i" - "g" - "h" - "t" - "S" - "t" - "i" - "c" - "k") + m_controlLines[e_PadX], + "LineX") UI_MAP_ELEMENT(m_controlLines + [e_PadRS_1], + "Li" + "ne" + "R" + "3") UI_MAP_ELEMENT( m_controlLines - [e_PadTouch], - "LineTouch") + [e_PadRS_2], + "L" + "i" + "n" + "e" + "R" + "i" + "g" + "h" + "t" + "S" + "t" + "i" + "c" + "k") UI_MAP_ELEMENT(m_controlLines + [e_PadTouch], + "Li" + "ne" + "To" + "uc" + "h") UI_MAP_ELEMENT( m_checkboxInvert, diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 958d7ad7a..68656798a 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -353,8 +353,9 @@ void C_4JProfile::Initialise(std::uint32_t dwTitleID, std::uint32_t dwOfferID, GAMESETTING_CLOUDS; // eGameSetting_Clouds - on pGameSettings->uiBitmaskValues |= GAMESETTING_ONLINE; // eGameSetting_GameSetting_Online - on - pGameSettings->uiBitmaskValues |= GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends - // - on + pGameSettings->uiBitmaskValues |= + GAMESETTING_FRIENDSOFFRIENDS; // eGameSetting_GameSetting_FriendsOfFriends + // - on pGameSettings->uiBitmaskValues |= GAMESETTING_DISPLAYUPDATEMSG; // eGameSetting_DisplayUpdateMessage // (counter) diff --git a/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h b/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h index fce9065cf..7ca675cdf 100644 --- a/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h +++ b/Minecraft.Client/Platform/Linux/Iggy/include/gdraw.h @@ -424,8 +424,8 @@ IDOC typedef enum gdraw_texture_format { // $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. + // 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, diff --git a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c index 7b5fae1f3..df2a78e90 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c +++ b/Minecraft.Client/Platform/Windows64/Iggy/gdraw/gdraw_wgl.c @@ -23,7 +23,7 @@ // #define GDRAW_GL_EXTENSION_LIST \ - /* identifier import procname */ \ + /* identifier import procname */ \ /* GL_ARB_multitexture */ \ GLE(ActiveTexture, "ActiveTextureARB", ACTIVETEXTUREARB) \ /* GL_ARB_texture_compression */ \ diff --git a/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h b/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h index aa4dc236f..ab41d5075 100644 --- a/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h +++ b/Minecraft.Client/Platform/Windows64/Iggy/include/gdraw.h @@ -424,8 +424,8 @@ IDOC typedef enum gdraw_texture_format { // $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. + // 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, diff --git a/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h b/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h index eaedf23ca..be7e8a869 100644 --- a/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h +++ b/Minecraft.Client/Platform/Windows64/Sentient/DynamicConfigurations.h @@ -84,7 +84,7 @@ private: #define DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME \ 2400 // 40 mins 1200 // 20 mins //300; // 5 minutes - class MinecraftDynamicConfigurations { +class MinecraftDynamicConfigurations { private: enum EDynamic_Configs { eDynamic_Config_Trial, diff --git a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp index 14a263414..8bccd39a6 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_App.cpp @@ -37,7 +37,7 @@ void CConsoleMinecraftApp::GetScreenshot(int iPad, void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_Main::OnInit + /// From CScene_Main::OnInit app.setLevelGenerationOptions(nullptr); @@ -49,7 +49,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { app.ApplyGameSettingsChanged(0); ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_MultiGameJoinLoad::OnInit + /// From CScene_MultiGameJoinLoad::OnInit MinecraftServer::resetFlags(); // From CScene_MultiGameJoinLoad::OnNotifyPressEx @@ -57,7 +57,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { app.SetCorruptSaveDeleted(false); ////////////////////////////////////////////////////////////////////////////////////////////// - ///From CScene_MultiGameCreate::CreateGame + /// From CScene_MultiGameCreate::CreateGame app.ClearTerrainFeaturePosition(); std::wstring wWorldName = L"TestWorld"; diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index e5af80e96..4f0ccde53 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -157,7 +157,7 @@ LevelRenderer::LevelRenderer(Minecraft* mc, Textures* textures) { emptyChunks = 0; for (int i = 0; i < 4; i++) { // sortedChunks[i] = nullptr; // 4J - removed - not - //sorting + // sorting // our chunks anymore chunks[i] = ClipChunkArray(); lastPlayerCount[i] = 0; diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index a679e2ddc..2e69e4d27 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -187,8 +187,9 @@ void FileHeader::ReadHeader( // : Bumped it to 6 for PS3 v1 to update map data mappings to use larger // PlayerUID : Bumped // it to 7 for Durango v1 to update map data mappings to use string - // based PlayerUID : Bumped it to 8 for Durango v1 when to save the - // chunks in a different compressed format + // based PlayerUID + // : Bumped it to 8 for Durango v1 when to save the chunks in a + // different compressed format case SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE: case SAVE_FILE_VERSION_DURANGO_CHANGE_MAP_DATA_MAPPING_SIZE: case SAVE_FILE_VERSION_CHANGE_MAP_DATA_MAPPING_SIZE: From 078eb3a144c867475491368f54edd24c2050d86a Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 30 Mar 2026 02:24:37 -0500 Subject: [PATCH 3/4] format UIScene_ControlsMenu --- .../Platform/Common/UI/UIScene_ControlsMenu.h | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h index a3733cae7..de6edab48 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h @@ -87,73 +87,74 @@ UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") UI_MAP_ELEMENT( "LabelRS_2") UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], "LabelTouch") - UI_MAP_ELEMENT( - m_controlLines[e_PadBack], - "LineBack") UI_MAP_ELEMENT(m_controlLines[e_PadLT], - "LineLT") - UI_MAP_ELEMENT(m_controlLines[e_PadLB], "LineLB") UI_MAP_ELEMENT( - m_controlLines[e_PadDPadLeft], - "Line" - "Dpad" - "Lef" - "t") UI_MAP_ELEMENT(m_controlLines[e_PadDPadRight], - "LineDpadRight") + UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") UI_MAP_ELEMENT( + m_controlLines[e_PadLT], + "LineLT") UI_MAP_ELEMENT(m_controlLines[e_PadLB], + "LineLB") UI_MAP_ELEMENT(m_controlLines + [e_PadDPadLeft], + "Line" + "Dpad" + "Lef" + "t") + UI_MAP_ELEMENT( + m_controlLines[e_PadDPadRight], + "LineDpadRight") UI_MAP_ELEMENT(m_controlLines + [e_PadDPadUp], + "LineDpadUp") UI_MAP_ELEMENT( - m_controlLines[e_PadDPadUp], - "LineDpadUp") UI_MAP_ELEMENT(m_controlLines - [e_PadDPadDown], - "LineDpadDown") + m_controlLines[e_PadDPadDown], + "LineDpadDown") UI_MAP_ELEMENT(m_controlLines + [e_PadLS_1], + "LineL3") UI_MAP_ELEMENT( - m_controlLines[e_PadLS_1], - "LineL3") UI_MAP_ELEMENT(m_controlLines - [e_PadLS_2], - "LineLeftStick") + m_controlLines[e_PadLS_2], + "LineLeftStick") UI_MAP_ELEMENT(m_controlLines + [e_PadStart], + "LineStart") UI_MAP_ELEMENT( - m_controlLines[e_PadStart], - "LineStart") UI_MAP_ELEMENT(m_controlLines - [e_PadRT], - "LineRT") + m_controlLines[e_PadRT], + "LineRT") UI_MAP_ELEMENT(m_controlLines + [e_PadRB], + "LineRB") UI_MAP_ELEMENT( - m_controlLines[e_PadRB], - "LineRB") UI_MAP_ELEMENT(m_controlLines - [e_PadY], - "LineY") + m_controlLines[e_PadY], + "LineY") UI_MAP_ELEMENT(m_controlLines + [e_PadB], + "LineB") UI_MAP_ELEMENT( - m_controlLines[e_PadB], - "LineB") UI_MAP_ELEMENT(m_controlLines - [e_PadA], - "LineA") + m_controlLines[e_PadA], + "LineA") UI_MAP_ELEMENT(m_controlLines + [e_PadX], + "LineX") UI_MAP_ELEMENT( - m_controlLines[e_PadX], - "LineX") UI_MAP_ELEMENT(m_controlLines - [e_PadRS_1], - "Li" - "ne" - "R" - "3") + m_controlLines[e_PadRS_1], + "Li" + "ne" + "R" + "3") UI_MAP_ELEMENT(m_controlLines + [e_PadRS_2], + "L" + "i" + "n" + "e" + "R" + "i" + "g" + "h" + "t" + "S" + "t" + "i" + "c" + "k") UI_MAP_ELEMENT( m_controlLines - [e_PadRS_2], - "L" - "i" - "n" - "e" - "R" - "i" - "g" - "h" - "t" - "S" - "t" - "i" - "c" - "k") UI_MAP_ELEMENT(m_controlLines - [e_PadTouch], - "Li" - "ne" - "To" - "uc" - "h") + [e_PadTouch], + "Li" + "ne" + "To" + "uc" + "h") UI_MAP_ELEMENT( m_checkboxInvert, From a8b9e9a185a11dfec9e2c752dbc2cce5fff164a0 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 30 Mar 2026 02:31:58 -0500 Subject: [PATCH 4/4] wtf --- .../Platform/Common/UI/UIScene_ControlsMenu.h | 177 +++++------------- 1 file changed, 51 insertions(+), 126 deletions(-) diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h index de6edab48..2ef0d3b60 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h +++ b/Minecraft.Client/Platform/Common/UI/UIScene_ControlsMenu.h @@ -49,138 +49,63 @@ private: UIControl_Button m_buttonLayouts[3]; UIControl_CheckBox m_checkboxInvert, m_checkboxSouthpaw; IggyName m_funcSetPlatform, m_funcSetControllerLayout; -UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - {UI_MAP_ELEMENT(m_labelCurrentLayout, "CurrentLayout") + UI_MAP_ELEMENT(m_labelCurrentLayout, "CurrentLayout") - UI_MAP_ELEMENT(m_buttonLayouts[0], "Button1") - UI_MAP_ELEMENT(m_buttonLayouts[1], "Button2") - UI_MAP_ELEMENT(m_buttonLayouts[2], "Button3")} + UI_MAP_ELEMENT(m_buttonLayouts[0], "Button1") + UI_MAP_ELEMENT(m_buttonLayouts[1], "Button2") + UI_MAP_ELEMENT(m_buttonLayouts[2], "Button3") -UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") UI_MAP_ELEMENT( - m_labelsPad[e_PadLT], - "LabelLT") UI_MAP_ELEMENT(m_labelsPad[e_PadLB], - "LabelLB") UI_MAP_ELEMENT(m_labelsPad - [e_PadDPadLeft], - "LabelDPadLeft") - UI_MAP_ELEMENT(m_labelsPad[e_PadDPadRight], "LabelDPadRight") UI_MAP_ELEMENT( - m_labelsPad[e_PadDPadUp], - "LabelDPadUp") UI_MAP_ELEMENT(m_labelsPad[e_PadDPadDown], - "LabelDPadDown") UI_MAP_ELEMENT(m_labelsPad - [e_PadLS_1], - "LabelLS_" - "1") - UI_MAP_ELEMENT(m_labelsPad[e_PadLS_2], "LabelLS_2") UI_MAP_ELEMENT( - m_labelsPad[e_PadStart], - "LabelStart") UI_MAP_ELEMENT(m_labelsPad[e_PadRT], - "LabelRT") UI_MAP_ELEMENT(m_labelsPad - [e_PadRB], - "LabelRB") - UI_MAP_ELEMENT(m_labelsPad[e_PadY], "LabelY") UI_MAP_ELEMENT( - m_labelsPad[e_PadB], - "LabelB") UI_MAP_ELEMENT(m_labelsPad[e_PadA], - "LabelA") UI_MAP_ELEMENT(m_labelsPad - [e_PadX], - "LabelX") - UI_MAP_ELEMENT(m_labelsPad[e_PadRS_1], "LabelRS_1") UI_MAP_ELEMENT( - m_labelsPad[e_PadRS_2], - "LabelRS_2") UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], - "LabelTouch") + UI_MAP_ELEMENT(m_labelsPad[e_PadBack], "LabelBack") + UI_MAP_ELEMENT(m_labelsPad[e_PadLT], "LabelLT") + UI_MAP_ELEMENT(m_labelsPad[e_PadLB], "LabelLB") + UI_MAP_ELEMENT(m_labelsPad[e_PadDPadLeft], "LabelDPadLeft") + UI_MAP_ELEMENT(m_labelsPad[e_PadDPadRight], "LabelDPadRight") + UI_MAP_ELEMENT(m_labelsPad[e_PadDPadUp], "LabelDPadUp") + UI_MAP_ELEMENT(m_labelsPad[e_PadDPadDown], "LabelDPadDown") + UI_MAP_ELEMENT(m_labelsPad[e_PadLS_1], "LabelLS_1") + UI_MAP_ELEMENT(m_labelsPad[e_PadLS_2], "LabelLS_2") + UI_MAP_ELEMENT(m_labelsPad[e_PadStart], "LabelStart") + UI_MAP_ELEMENT(m_labelsPad[e_PadRT], "LabelRT") + UI_MAP_ELEMENT(m_labelsPad[e_PadRB], "LabelRB") + UI_MAP_ELEMENT(m_labelsPad[e_PadY], "LabelY") + UI_MAP_ELEMENT(m_labelsPad[e_PadB], "LabelB") + UI_MAP_ELEMENT(m_labelsPad[e_PadA], "LabelA") + UI_MAP_ELEMENT(m_labelsPad[e_PadX], "LabelX") + UI_MAP_ELEMENT(m_labelsPad[e_PadRS_1], "LabelRS_1") + UI_MAP_ELEMENT(m_labelsPad[e_PadRS_2], "LabelRS_2") + UI_MAP_ELEMENT(m_labelsPad[e_PadTouch], "LabelTouch") - UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") UI_MAP_ELEMENT( - m_controlLines[e_PadLT], - "LineLT") UI_MAP_ELEMENT(m_controlLines[e_PadLB], - "LineLB") UI_MAP_ELEMENT(m_controlLines - [e_PadDPadLeft], - "Line" - "Dpad" - "Lef" - "t") - UI_MAP_ELEMENT( - m_controlLines[e_PadDPadRight], - "LineDpadRight") UI_MAP_ELEMENT(m_controlLines - [e_PadDPadUp], - "LineDpadUp") - UI_MAP_ELEMENT( - m_controlLines[e_PadDPadDown], - "LineDpadDown") UI_MAP_ELEMENT(m_controlLines - [e_PadLS_1], - "LineL3") - UI_MAP_ELEMENT( - m_controlLines[e_PadLS_2], - "LineLeftStick") UI_MAP_ELEMENT(m_controlLines - [e_PadStart], - "LineStart") - UI_MAP_ELEMENT( - m_controlLines[e_PadRT], - "LineRT") UI_MAP_ELEMENT(m_controlLines - [e_PadRB], - "LineRB") - UI_MAP_ELEMENT( - m_controlLines[e_PadY], - "LineY") UI_MAP_ELEMENT(m_controlLines - [e_PadB], - "LineB") - UI_MAP_ELEMENT( - m_controlLines[e_PadA], - "LineA") UI_MAP_ELEMENT(m_controlLines - [e_PadX], - "LineX") - UI_MAP_ELEMENT( - m_controlLines[e_PadRS_1], - "Li" - "ne" - "R" - "3") UI_MAP_ELEMENT(m_controlLines - [e_PadRS_2], - "L" - "i" - "n" - "e" - "R" - "i" - "g" - "h" - "t" - "S" - "t" - "i" - "c" - "k") - UI_MAP_ELEMENT( - m_controlLines - [e_PadTouch], - "Li" - "ne" - "To" - "uc" - "h") + UI_MAP_ELEMENT(m_controlLines[e_PadBack], "LineBack") + UI_MAP_ELEMENT(m_controlLines[e_PadLT], "LineLT") + UI_MAP_ELEMENT(m_controlLines[e_PadLB], "LineLB") + UI_MAP_ELEMENT(m_controlLines[e_PadDPadLeft], "LineDpadLeft") + UI_MAP_ELEMENT(m_controlLines[e_PadDPadRight], "LineDpadRight") + UI_MAP_ELEMENT(m_controlLines[e_PadDPadUp], "LineDpadUp") + UI_MAP_ELEMENT(m_controlLines[e_PadDPadDown], "LineDpadDown") + UI_MAP_ELEMENT(m_controlLines[e_PadLS_1], "LineL3") + UI_MAP_ELEMENT(m_controlLines[e_PadLS_2], "LineLeftStick") + UI_MAP_ELEMENT(m_controlLines[e_PadStart], "LineStart") + UI_MAP_ELEMENT(m_controlLines[e_PadRT], "LineRT") + UI_MAP_ELEMENT(m_controlLines[e_PadRB], "LineRB") + UI_MAP_ELEMENT(m_controlLines[e_PadY], "LineY") + UI_MAP_ELEMENT(m_controlLines[e_PadB], "LineB") + UI_MAP_ELEMENT(m_controlLines[e_PadA], "LineA") + UI_MAP_ELEMENT(m_controlLines[e_PadX], "LineX") + UI_MAP_ELEMENT(m_controlLines[e_PadRS_1], "LineR3") + UI_MAP_ELEMENT(m_controlLines[e_PadRS_2], "LineRightStick") + UI_MAP_ELEMENT(m_controlLines[e_PadTouch], "LineTouch") - UI_MAP_ELEMENT( - m_checkboxInvert, - "InvertLook") - UI_MAP_ELEMENT( - m_checkboxSouthpaw, - "SouthPaw") + UI_MAP_ELEMENT(m_checkboxInvert, "InvertLook") + UI_MAP_ELEMENT(m_checkboxSouthpaw, "SouthPaw") - UI_MAP_NAME( - m_funcSetPlatform, - L"SetPlatfo" - L"rm") - UI_MAP_NAME( - m_funcSetControllerLayout, - L"SetCo" - L"ntrol" - L"lerLa" - L"yout") - UI_MAP_ELEMENT( - m_labelVersion, - "Ve" - "rs" - "io" - "n") - UI_END_MAP_ELEMENTS_AND_NAMES() public - : UIScene_ControlsMenu(int iPad, void* initData, UILayer* parentLayer); + UI_MAP_NAME(m_funcSetPlatform, L"SetPlatform") + UI_MAP_NAME(m_funcSetControllerLayout, L"SetControllerLayout") + UI_MAP_ELEMENT(m_labelVersion, "Version") + UI_END_MAP_ELEMENTS_AND_NAMES() +public: + UIScene_ControlsMenu(int iPad, void* initData, UILayer* parentLayer); virtual EUIScene getSceneType() { return eUIScene_ControlsMenu; }