From 287a06069548e5b0deadbf16dc68fcfa59579956 Mon Sep 17 00:00:00 2001 From: BendedWills Date: Mon, 2 Mar 2026 04:08:43 -0600 Subject: [PATCH 01/16] CMake support --- .gitignore | 11 + CMakeLists.txt | 68 ++ Minecraft.Client/crt_compat.cpp | 28 + Minecraft.World/Hasher.cpp | 3 +- Minecraft.World/I18n.cpp | 7 +- Minecraft.World/Language.cpp | 2 + Minecraft.World/Player.cpp | 2 +- Vendor/CMakeLists.txt | 0 cmake/Sources.cmake | 1162 +++++++++++++++++++++++++++++++ 9 files changed, 1278 insertions(+), 5 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 Minecraft.Client/crt_compat.cpp create mode 100644 Vendor/CMakeLists.txt create mode 100644 cmake/Sources.cmake diff --git a/.gitignore b/.gitignore index ac97f2f..c3fa494 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,17 @@ ipch/ *.ilk *.exp +# =========================================== +# CLion files +# =========================================== +.idea + +# =========================================== +# CMake +# =========================================== +cmake-build-debug +cmake-build-release + # =========================================== # Archives & packaged binaries # =========================================== diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..52c7318 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.10) +project("LCEMP") + +set(CMAKE_CXX_STANDARD 11) +add_subdirectory(Vendor) + +if(NOT WIN32) + message(FATAL_ERROR "Windows is currently the only supported OS") +endif() + +# Fix linking errors with other libs compiled with an older CRT +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + +include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Sources.cmake") + +list(TRANSFORM MINECRAFT_WORLD_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/") +list(TRANSFORM MINECRAFT_CLIENT_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/") + +add_library(MinecraftWorld STATIC ${MINECRAFT_WORLD_SOURCES}) +add_executable(MinecraftClient WIN32 ${MINECRAFT_CLIENT_SOURCES}) + +if(MSVC) + # /MT and /MTd options set the CRT version to multi-threaded static mode + # which is what the 4J libs were compiled with + target_compile_options(MinecraftWorld PRIVATE /W3 /MP $<$:/MTd> $<$>:/MT> /EHsc) + target_compile_options(MinecraftClient PRIVATE /W3 /MP $<$:/MTd> $<$>:/MT> /EHsc) +endif() + +target_compile_definitions(MinecraftWorld PRIVATE + $<$:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64> + $<$>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64> +) + +target_compile_definitions(MinecraftClient PRIVATE + $<$:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64> + $<$>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64> +) + +target_include_directories(MinecraftWorld PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/x64headers" +) + +target_include_directories(MinecraftClient PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/include" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/Sentient/Include" +) + +target_link_libraries(MinecraftClient PRIVATE + MinecraftWorld + d3d11 + XInput9_1_0 + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Miles/lib/mss64.lib" + $<$: + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Profile_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC_d.lib" + > + $<$>: + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_r.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_r.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Profile_r.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC.lib" + > +) \ No newline at end of file diff --git a/Minecraft.Client/crt_compat.cpp b/Minecraft.Client/crt_compat.cpp new file mode 100644 index 0000000..9b9f92a --- /dev/null +++ b/Minecraft.Client/crt_compat.cpp @@ -0,0 +1,28 @@ +// CRT compatibility shim for linking VS2012-era libraries with VS2022 +// Provides symbols removed in the Universal CRT (VS2015+) + +#include +#include + +// __iob_func was removed in VS2015. Old code (e.g. libpng) references it. +// Provide a shim that returns the stdio file pointers. +extern "C" FILE* __iob_func(void) +{ + // The old __iob_func returned an array of {stdin, stdout, stderr}. + // In the Universal CRT, these are functions, not a contiguous array. + // We return a static array mimicking the old layout. + static FILE iob[3]; + iob[0] = *stdin; + iob[1] = *stdout; + iob[2] = *stderr; + return iob; +} + +// std::_Winerror_map was an internal MSVC runtime function used by +// std::system_category::message(). Old .lib files compiled with VS2012 +// may reference it. Provide a minimal stub. +namespace std { + const char* _Winerror_map(int) { + return ""; + } +} diff --git a/Minecraft.World/Hasher.cpp b/Minecraft.World/Hasher.cpp index bbf47d4..45c933f 100644 --- a/Minecraft.World/Hasher.cpp +++ b/Minecraft.World/Hasher.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include +#include #include "Hasher.h" @@ -19,7 +20,7 @@ wstring Hasher::getHash(wstring &name) //return new BigInteger(1, m.digest()).toString(16); // TODO 4J Stu - Will this hash us with the same distribution as the MD5? - return _toString( hash_value( s ) ); + return _toString( std::hash{}( s ) ); //} //catch (NoSuchAlgorithmException e) //{ diff --git a/Minecraft.World/I18n.cpp b/Minecraft.World/I18n.cpp index 51998c9..6b6d05a 100644 --- a/Minecraft.World/I18n.cpp +++ b/Minecraft.World/I18n.cpp @@ -3,14 +3,15 @@ #include "I18n.h" Language *I18n::lang = Language::getInstance(); -wstring I18n::get(const wstring& id, ...) -{ +wstring I18n::get(const wstring& id, ...) { #ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway return L""; +#elif _MSC_VER >= 1930 // VS2022+ also disallows va_start with reference types + return id; #else va_list va; va_start(va, id); - return I18n::get(id, va); + return I18n::get(id, va); #endif } diff --git a/Minecraft.World/Language.cpp b/Minecraft.World/Language.cpp index 6c349fe..73e56a4 100644 --- a/Minecraft.World/Language.cpp +++ b/Minecraft.World/Language.cpp @@ -24,6 +24,8 @@ wstring Language::getElement(const wstring& elementId, ...) { #ifdef __PSVITA__ // 4J - vita doesn't like having a reference type as the last parameter passed to va_start - we shouldn't need this method anyway return L""; +#elif _MSC_VER >= 1930 // VS2022+ also disallows va_start with reference types + return elementId; #else va_list args; va_start(args, elementId); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 05d9774..d4832e4 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -2561,7 +2561,7 @@ int Player::hash_fnct(const shared_ptr k) #ifdef __PS3__ return (int)boost::hash_value( k->name ); // 4J Stu - Names are completely unique? #else - return (int)std::hash_value( k->name ); // 4J Stu - Names are completely unique? + return (int)std::hash{}( k->name ); // 4J Stu - Names are completely unique? #endif //__PS3__ } diff --git a/Vendor/CMakeLists.txt b/Vendor/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/cmake/Sources.cmake b/cmake/Sources.cmake new file mode 100644 index 0000000..8c65483 --- /dev/null +++ b/cmake/Sources.cmake @@ -0,0 +1,1162 @@ +set(MINECRAFT_CLIENT_SOURCES + "AbstractTexturePack.cpp" + "crt_compat.cpp" + "AchievementPopup.cpp" + "AchievementScreen.cpp" + "AllowAllCuller.cpp" + "ArchiveFile.cpp" + "ArrowRenderer.cpp" + "BlazeModel.cpp" + "BlazeRenderer.cpp" + "BoatModel.cpp" + "BoatRenderer.cpp" + "BookModel.cpp" + "BreakingItemParticle.cpp" + "BubbleParticle.cpp" + "BufferedImage.cpp" + "Button.cpp" + "Camera.cpp" + "ChatScreen.cpp" + "ChestModel.cpp" + "ChestRenderer.cpp" + "ChickenModel.cpp" + "ChickenRenderer.cpp" + "Chunk.cpp" + "ClientConnection.cpp" + "ClientConstants.cpp" + "ClockTexture.cpp" + "Common/Audio/Consoles_SoundEngine.cpp" + "Common/Audio/SoundEngine.cpp" + "Common/Audio/SoundNames.cpp" + "Common/Colours/ColourTable.cpp" + "Common/Consoles_App.cpp" + "Common/DLC/DLCAudioFile.cpp" + "Common/DLC/DLCCapeFile.cpp" + "Common/DLC/DLCColourTableFile.cpp" + "Common/DLC/DLCFile.cpp" + "Common/DLC/DLCGameRulesFile.cpp" + "Common/DLC/DLCGameRulesHeader.cpp" + "Common/DLC/DLCLocalisationFile.cpp" + "Common/DLC/DLCManager.cpp" + "Common/DLC/DLCPack.cpp" + "Common/DLC/DLCSkinFile.cpp" + "Common/DLC/DLCTextureFile.cpp" + "Common/DLC/DLCUIDataFile.cpp" + "Common/GameRules/AddEnchantmentRuleDefinition.cpp" + "Common/GameRules/AddItemRuleDefinition.cpp" + "Common/GameRules/ApplySchematicRuleDefinition.cpp" + "Common/GameRules/BiomeOverride.cpp" + "Common/GameRules/CollectItemRuleDefinition.cpp" + "Common/GameRules/CompleteAllRuleDefinition.cpp" + "Common/GameRules/CompoundGameRuleDefinition.cpp" + "Common/GameRules/GameRule.cpp" + "Common/GameRules/GameRuleDefinition.cpp" + "Common/GameRules/GameRuleManager.cpp" + "Common/GameRules/LevelGenerationOptions.cpp" + "Common/GameRules/LevelGenerators.cpp" + "Common/GameRules/LevelRules.cpp" + "Common/GameRules/LevelRuleset.cpp" + "Common/GameRules/NamedAreaRuleDefinition.cpp" + "Common/GameRules/StartFeature.cpp" + "Common/GameRules/UpdatePlayerRuleDefinition.cpp" + "Common/GameRules/UseTileRuleDefinition.cpp" + "Common/GameRules/ConsoleGenerateStructure.cpp" + "Common/GameRules/ConsoleSchematicFile.cpp" + "Common/GameRules/XboxStructureActionGenerateBox.cpp" + "Common/GameRules/XboxStructureActionPlaceBlock.cpp" + "Common/GameRules/XboxStructureActionPlaceContainer.cpp" + "Common/GameRules/XboxStructureActionPlaceSpawner.cpp" + "Common/Leaderboards/LeaderboardManager.cpp" + "Common/Network/GameNetworkManager.cpp" + "Common/Network/PlatformNetworkManagerStub.cpp" + "Common/Telemetry/TelemetryManager.cpp" + "Common/Trial/TrialMode.cpp" + "Common/Tutorial/AreaConstraint.cpp" + "Common/Tutorial/AreaHint.cpp" + "Common/Tutorial/AreaTask.cpp" + "Common/Tutorial/ChangeStateConstraint.cpp" + "Common/Tutorial/ChoiceTask.cpp" + "Common/Tutorial/CompleteUsingItemTask.cpp" + "Common/Tutorial/ControllerTask.cpp" + "Common/Tutorial/CraftTask.cpp" + "Common/Tutorial/DiggerItemHint.cpp" + "Common/Tutorial/EffectChangedTask.cpp" + "Common/Tutorial/FullTutorial.cpp" + "Common/Tutorial/FullTutorialActiveTask.cpp" + "Common/Tutorial/FullTutorialMode.cpp" + "Common/Tutorial/InfoTask.cpp" + "Common/Tutorial/InputConstraint.cpp" + "Common/Tutorial/LookAtEntityHint.cpp" + "Common/Tutorial/LookAtTileHint.cpp" + "Common/Tutorial/PickupTask.cpp" + "Common/Tutorial/ProcedureCompoundTask.cpp" + "Common/Tutorial/ProgressFlagTask.cpp" + "Common/Tutorial/StatTask.cpp" + "Common/Tutorial/TakeItemHint.cpp" + "Common/Tutorial/Tutorial.cpp" + "Common/Tutorial/TutorialHint.cpp" + "Common/Tutorial/TutorialMessage.cpp" + "Common/Tutorial/TutorialMode.cpp" + "Common/Tutorial/TutorialTask.cpp" + "Common/Tutorial/UseItemTask.cpp" + "Common/Tutorial/UseTileTask.cpp" + "Common/Tutorial/XuiCraftingTask.cpp" + "Common/ConsoleGameMode.cpp" + "Common/Console_Utils.cpp" + "Common/UI/IUIScene_AbstractContainerMenu.cpp" + "Common/UI/IUIScene_AnvilMenu.cpp" + "Common/UI/IUIScene_BrewingMenu.cpp" + "Common/UI/IUIScene_ContainerMenu.cpp" + "Common/UI/IUIScene_CraftingMenu.cpp" + "Common/UI/IUIScene_CreativeMenu.cpp" + "Common/UI/IUIScene_DispenserMenu.cpp" + "Common/UI/IUIScene_EnchantingMenu.cpp" + "Common/UI/IUIScene_FurnaceMenu.cpp" + "Common/UI/IUIScene_InventoryMenu.cpp" + "Common/UI/IUIScene_PauseMenu.cpp" + "Common/UI/IUIScene_StartGame.cpp" + "Common/UI/IUIScene_TradingMenu.cpp" + "Common/UI/UIComponent_DebugUIMarketingGuide.cpp" + "Common/UI/UIScene_Keyboard.cpp" + "Common/UI/UIComponent_MenuBackground.cpp" + "Common/UI/UIComponent_PressStartToPlay.cpp" + "Common/UI/UIControl_Base.cpp" + "Common/UI/UIControl_BitmapIcon.cpp" + "Common/UI/UIControl_DLCList.cpp" + "Common/UI/UIControl_DynamicLabel.cpp" + "Common/UI/UIControl_EnchantmentBook.cpp" + "Common/UI/UIControl_EnchantmentButton.cpp" + "Common/UI/UIControl_HTMLLabel.cpp" + "Common/UI/UIControl_LeaderboardList.cpp" + "Common/UI/UIControl_MinecraftPlayer.cpp" + "Common/UI/UIControl_PlayerList.cpp" + "Common/UI/UIControl_SaveList.cpp" + "Common/UI/UIControl_SpaceIndicatorBar.cpp" + "Common/UI/UIControl_TexturePackList.cpp" + "Common/UI/UIFontData.cpp" + "Common/UI/UIScene_AnvilMenu.cpp" + "Common/UI/UIScene_ControlsMenu.cpp" + "Common/UI/UIScene_Credits.cpp" + "Common/UI/UIScene_DebugCreateSchematic.cpp" + "Common/UI/UIScene_DebugSetCamera.cpp" + "Common/UI/UIScene_DLCMainMenu.cpp" + "Common/UI/UIScene_DLCOffersMenu.cpp" + "Common/UI/UIScene_EndPoem.cpp" + "Common/UI/UIScene_EULA.cpp" + "Common/UI/UIScene_HowToPlay.cpp" + "Common/UI/UIScene_InGameHostOptionsMenu.cpp" + "Common/UI/UIScene_InGameInfoMenu.cpp" + "Common/UI/UIScene_InGamePlayerOptionsMenu.cpp" + "Common/UI/UIScene_LeaderboardsMenu.cpp" + "Common/UI/UIScene_MessageBox.cpp" + "Common/UI/UIBitmapFont.cpp" + "Common/UI/UIComponent_Chat.cpp" + "Common/UI/UIComponent_DebugUIConsole.cpp" + "Common/UI/UIComponent_Logo.cpp" + "Common/UI/UIComponent_Panorama.cpp" + "Common/UI/UIComponent_Tooltips.cpp" + "Common/UI/UIComponent_TutorialPopup.cpp" + "Common/UI/UIControl.cpp" + "Common/UI/UIController.cpp" + "Common/UI/UIControl_Button.cpp" + "Common/UI/UIControl_CheckBox.cpp" + "Common/UI/UIControl_Cursor.cpp" + "Common/UI/UIControl_Label.cpp" + "Common/UI/UIControl_PlayerSkinPreview.cpp" + "Common/UI/UIControl_Progress.cpp" + "Common/UI/UIControl_ButtonList.cpp" + "Common/UI/UIControl_Slider.cpp" + "Common/UI/UIControl_SlotList.cpp" + "Common/UI/UIControl_TextInput.cpp" + "Common/UI/UIGroup.cpp" + "Common/UI/UILayer.cpp" + "Common/UI/UIScene.cpp" + "Common/UI/UIScene_AbstractContainerMenu.cpp" + "Common/UI/UIScene_BrewingStandMenu.cpp" + "Common/UI/UIScene_ConnectingProgress.cpp" + "Common/UI/UIScene_ContainerMenu.cpp" + "Common/UI/UIScene_CraftingMenu.cpp" + "Common/UI/UIScene_CreateWorldMenu.cpp" + "Common/UI/UIScene_CreativeMenu.cpp" + "Common/UI/UIScene_DeathMenu.cpp" + "Common/UI/UIScene_DebugOptions.cpp" + "Common/UI/UIScene_DebugOverlay.cpp" + "Common/UI/UIScene_DispenserMenu.cpp" + "Common/UI/UIScene_EnchantingMenu.cpp" + "Common/UI/UIScene_FullscreenProgress.cpp" + "Common/UI/UIScene_FurnaceMenu.cpp" + "Common/UI/UIScene_HelpAndOptionsMenu.cpp" + "Common/UI/UIScene_HowToPlayMenu.cpp" + "Common/UI/UIScene_HUD.cpp" + "Common/UI/UIScene_Intro.cpp" + "Common/UI/UIScene_JoinMenu.cpp" + "Common/UI/UIScene_LaunchMoreOptionsMenu.cpp" + "Common/UI/UIScene_LoadMenu.cpp" + "Common/UI/UIScene_LoadOrJoinMenu.cpp" + "Common/UI/UIScene_MainMenu.cpp" + "Common/UI/UIScene_InventoryMenu.cpp" + "Common/UI/UIScene_PauseMenu.cpp" + "Common/UI/UIScene_QuadrantSignin.cpp" + "Common/UI/UIScene_ReinstallMenu.cpp" + "Common/UI/UIScene_SaveMessage.cpp" + "Common/UI/UIScene_SettingsAudioMenu.cpp" + "Common/UI/UIScene_SettingsControlMenu.cpp" + "Common/UI/UIScene_SettingsGraphicsMenu.cpp" + "Common/UI/UIScene_SettingsMenu.cpp" + "Common/UI/UIScene_SettingsOptionsMenu.cpp" + "Common/UI/UIScene_SettingsUIMenu.cpp" + "Common/UI/UIScene_SignEntryMenu.cpp" + "Common/UI/UIScene_SkinSelectMenu.cpp" + "Common/UI/UIScene_TeleportMenu.cpp" + "Common/UI/UIScene_Timer.cpp" + "Common/UI/UIScene_TradingMenu.cpp" + "Common/UI/UIScene_TrialExitUpsell.cpp" + "Common/UI/UITTFFont.cpp" + "Common/zlib/adler32.c" + "Common/zlib/compress.c" + "Common/zlib/crc32.c" + "Common/zlib/deflate.c" + "Common/zlib/gzclose.c" + "Common/zlib/gzlib.c" + "Common/zlib/gzread.c" + "Common/zlib/gzwrite.c" + "Common/zlib/infback.c" + "Common/zlib/inffast.c" + "Common/zlib/inflate.c" + "Common/zlib/inftrees.c" + "Common/zlib/trees.c" + "Common/zlib/uncompr.c" + "Common/zlib/zutil.c" + "CompassTexture.cpp" + "ConfirmScreen.cpp" + "ConsoleInput.cpp" + "ControlsScreen.cpp" + "CowModel.cpp" + "CowRenderer.cpp" + "CreateWorldScreen.cpp" + "CreeperModel.cpp" + "CreeperRenderer.cpp" + "CritParticle.cpp" + "CritParticle2.cpp" + "Cube.cpp" + "DeathScreen.cpp" + "DefaultRenderer.cpp" + "DefaultTexturePack.cpp" + "DemoLevel.cpp" + "DemoUser.cpp" + "DerivedServerLevel.cpp" + "DirtyChunkSorter.cpp" + "DistanceChunkSorter.cpp" + "DLCTexturePack.cpp" + "DragonBreathParticle.cpp" + "DragonModel.cpp" + "DripParticle.cpp" + "EchantmentTableParticle.cpp" + "EditBox.cpp" + "EnchantTableRenderer.cpp" + "EnderChestRenderer.cpp" + "EnderCrystalModel.cpp" + "EnderCrystalRenderer.cpp" + "EnderDragonRenderer.cpp" + "EndermanModel.cpp" + "EndermanRenderer.cpp" + "EnderParticle.cpp" + "EntityRenderDispatcher.cpp" + "EntityRenderer.cpp" + "EntityTileRenderer.cpp" + "EntityTracker.cpp" + "ErrorScreen.cpp" + "ExperienceOrbRenderer.cpp" + "ExplodeParticle.cpp" + "Extrax64Stubs.cpp" + "FallingTileRenderer.cpp" + "FileTexturePack.cpp" + "FireballRenderer.cpp" + "FishingHookRenderer.cpp" + "FlameParticle.cpp" + "FolderTexturePack.cpp" + "Font.cpp" + "FootstepParticle.cpp" + "Frustum.cpp" + "FrustumCuller.cpp" + "FrustumData.cpp" + "GameRenderer.cpp" + "GhastModel.cpp" + "GhastRenderer.cpp" + "GiantMobRenderer.cpp" + "glWrapper.cpp" + "Gui.cpp" + "GuiComponent.cpp" + "GuiMessage.cpp" + "GuiParticle.cpp" + "GuiParticles.cpp" + "HeartParticle.cpp" + "HttpTexture.cpp" + "HugeExplosionParticle.cpp" + "HugeExplosionSeedParticle.cpp" + "HumanoidMobRenderer.cpp" + "HumanoidModel.cpp" + "InBedChatScreen.cpp" + "Input.cpp" + "ItemFrameRenderer.cpp" + "ItemInHandRenderer.cpp" + "ItemRenderer.cpp" + "ItemSpriteRenderer.cpp" + "JoinMultiplayerScreen.cpp" + "KeyMapping.cpp" + "LargeChestModel.cpp" + "LavaParticle.cpp" + "LavaSlimeModel.cpp" + "LavaSlimeRenderer.cpp" + "LevelRenderer.cpp" + "Lighting.cpp" + "LightningBoltRenderer.cpp" + "MemoryTracker.cpp" + "MemTexture.cpp" + "MinecartModel.cpp" + "MinecartRenderer.cpp" + "Minecraft.cpp" + "MinecraftServer.cpp" + "Minimap.cpp" + "MobRenderer.cpp" + "MobSkinMemTextureProcessor.cpp" + "MobSkinTextureProcessor.cpp" + "MobSpawnerRenderer.cpp" + "Model.cpp" + "ModelPart.cpp" + "MultiPlayerChunkCache.cpp" + "MultiPlayerGameMode.cpp" + "MultiPlayerLevel.cpp" + "MultiPlayerLocalPlayer.cpp" + "MushroomCowRenderer.cpp" + "NameEntryScreen.cpp" + "NoteParticle.cpp" + "OffsettedRenderList.cpp" + "Options.cpp" + "OptionsScreen.cpp" + "OzelotModel.cpp" + "OzelotRenderer.cpp" + "PaintingRenderer.cpp" + "Particle.cpp" + "ParticleEngine.cpp" + "PauseScreen.cpp" + "PendingConnection.cpp" + "PigModel.cpp" + "PigRenderer.cpp" + "LocalPlayer.cpp" + "PistonPieceRenderer.cpp" + "PlayerChunkMap.cpp" + "PlayerCloudParticle.cpp" + "PlayerConnection.cpp" + "PlayerList.cpp" + "PreStitchedTextureMap.cpp" + "ProgressRenderer.cpp" + "PS3/PS3Extras/ShutdownManager.cpp" + "Rect2i.cpp" + "RemotePlayer.cpp" + "PlayerRenderer.cpp" + "Polygon.cpp" + "NetherPortalParticle.cpp" + "QuadrupedModel.cpp" + "RedDustParticle.cpp" + "RenameWorldScreen.cpp" + "Screen.cpp" + "ScreenSizeCalculator.cpp" + "ScrolledSelectionList.cpp" + "SelectWorldScreen.cpp" + "ServerChunkCache.cpp" + "ServerCommandDispatcher.cpp" + "ServerConnection.cpp" + "ServerPlayerGameMode.cpp" + "ServerLevel.cpp" + "ServerLevelListener.cpp" + "ServerPlayer.cpp" + "Settings.cpp" + "SheepFurModel.cpp" + "SheepModel.cpp" + "SheepRenderer.cpp" + "SignModel.cpp" + "SignRenderer.cpp" + "SilverfishModel.cpp" + "SilverfishRenderer.cpp" + "SimpleIcon.cpp" + "SkeletonHeadModel.cpp" + "SkeletonModel.cpp" + "SkullTileRenderer.cpp" + "SlideButton.cpp" + "SlimeModel.cpp" + "SlimeRenderer.cpp" + "SmallButton.cpp" + "SmokeParticle.cpp" + "SnowManModel.cpp" + "SnowManRenderer.cpp" + "SnowShovelParticle.cpp" + "SpellParticle.cpp" + "SpiderModel.cpp" + "SpiderRenderer.cpp" + "SplashParticle.cpp" + "SquidModel.cpp" + "SquidRenderer.cpp" + "StatsCounter.cpp" + "StatsScreen.cpp" + "StatsSyncher.cpp" + "stdafx.cpp" + "StitchedTexture.cpp" + "Stitcher.cpp" + "StitchSlot.cpp" + "StringTable.cpp" + "stubs.cpp" + "SuspendedParticle.cpp" + "SuspendedTownParticle.cpp" + "TakeAnimationParticle.cpp" + "TeleportCommand.cpp" + "TerrainParticle.cpp" + "Tesselator.cpp" + "TexOffs.cpp" + "Texture.cpp" + "TextureHolder.cpp" + "TextureManager.cpp" + "TextureMap.cpp" + "TexturePack.cpp" + "TexturePackRepository.cpp" + "Textures.cpp" + "TheEndPortalRenderer.cpp" + "TileEntityRenderDispatcher.cpp" + "TileEntityRenderer.cpp" + "TileRenderer.cpp" + "Timer.cpp" + "TitleScreen.cpp" + "TntRenderer.cpp" + "TrackedEntity.cpp" + "User.cpp" + "Vertex.cpp" + "VideoSettingsScreen.cpp" + "ViewportCuller.cpp" + "VillagerGolemModel.cpp" + "VillagerGolemRenderer.cpp" + "VillagerModel.cpp" + "VillagerRenderer.cpp" + "VillagerZombieModel.cpp" + "WaterDropParticle.cpp" + "Windows64/Iggy/gdraw/gdraw_d3d11.cpp" + "Windows64/Leaderboards/WindowsLeaderboardManager.cpp" + "Windows64/Windows64_App.cpp" + "Windows64/Windows64_Minecraft.cpp" + "Windows64/Network/WinsockNetLayer.cpp" + "KeyboardMouseInput.cpp" + "Windows64/Windows64_UIController.cpp" + "WolfModel.cpp" + "WolfRenderer.cpp" + "WstringLookup.cpp" + "Xbox/Network/NetworkPlayerXbox.cpp" + "ZombieModel.cpp" + "ZombieRenderer.cpp" +) + +set(MINECRAFT_WORLD_SOURCES + "AABB.cpp" + "Abilities.cpp" + "AbstractContainerMenu.cpp" + "Achievement.cpp" + "Achievements.cpp" + "AddEntityPacket.cpp" + "AddExperienceOrbPacket.cpp" + "AddGlobalEntityPacket.cpp" + "AddIslandLayer.cpp" + "AddMobPacket.cpp" + "AddMushroomIslandLayer.cpp" + "AddPaintingPacket.cpp" + "AddPlayerPacket.cpp" + "AddSnowLayer.cpp" + "AgableMob.cpp" + "AirTile.cpp" + "Animal.cpp" + "AnimatePacket.cpp" + "AnvilTile.cpp" + "AnvilTileItem.cpp" + "ArmorDyeRecipe.cpp" + "ArmorItem.cpp" + "ArmorRecipes.cpp" + "ArmorSlot.cpp" + "Arrow.cpp" + "ArrowAttackGoal.cpp" + "ArrowDamageEnchantment.cpp" + "ArrowFireEnchantment.cpp" + "ArrowInfiniteEnchantment.cpp" + "ArrowKnockbackEnchantment.cpp" + "AuxDataTileItem.cpp" + "AvoidPlayerGoal.cpp" + "AwardStatPacket.cpp" + "BasicTree.cpp" + "BasicTypeContainers.cpp" + "BeachBiome.cpp" + "BedItem.cpp" + "BedTile.cpp" + "BegGoal.cpp" + "BinaryHeap.cpp" + "Biome.cpp" + "BiomeCache.cpp" + "BiomeDecorator.cpp" + "BiomeInitLayer.cpp" + "BiomeOverrideLayer.cpp" + "BiomeSource.cpp" + "BirchFeature.cpp" + "Blaze.cpp" + "BlockDestructionProgress.cpp" + "BlockGenMethods.cpp" + "BlockRegionUpdatePacket.cpp" + "BlockReplacements.cpp" + "Boat.cpp" + "BoatItem.cpp" + "BodyControl.cpp" + "BonusChestFeature.cpp" + "BookItem.cpp" + "BookshelfTile.cpp" + "BossMob.cpp" + "BossMobPart.cpp" + "BottleItem.cpp" + "BoundingBox.cpp" + "BowItem.cpp" + "BowlFoodItem.cpp" + "BreakDoorGoal.cpp" + "BreedGoal.cpp" + "BrewingStandMenu.cpp" + "BrewingStandTile.cpp" + "BrewingStandTileEntity.cpp" + "BucketItem.cpp" + "Buffer.cpp" + "BufferedOutputStream.cpp" + "BufferedReader.cpp" + "Bush.cpp" + "ButtonTile.cpp" + "ByteArrayInputStream.cpp" + "ByteArrayOutputStream.cpp" + "ByteBuffer.cpp" + "CactusFeature.cpp" + "CactusTile.cpp" + "CakeTile.cpp" + "CanyonFeature.cpp" + "CarrotOnAStickItem.cpp" + "CarrotTile.cpp" + "CauldronTile.cpp" + "CaveFeature.cpp" + "CaveSpider.cpp" + "ChatPacket.cpp" + "ChestTile.cpp" + "ChestTileEntity.cpp" + "Chicken.cpp" + "ChunkPos.cpp" + "ChunkStorageProfileDecorator.cpp" + "ChunkTilesUpdatePacket.cpp" + "ChunkVisibilityAreaPacket.cpp" + "ChunkVisibilityPacket.cpp" + "Class.cpp" + "ClayFeature.cpp" + "ClayTile.cpp" + "ClientCommandPacket.cpp" + "ClientSideMerchant.cpp" + "ClockItem.cpp" + "ClothDyeRecipes.cpp" + "ClothTile.cpp" + "ClothTileItem.cpp" + "CoalItem.cpp" + "CocoaTile.cpp" + "Color.cpp" + "ColoredTileItem.cpp" + "Command.cpp" + "CommandDispatcher.cpp" + "CommonStats.cpp" + "CompassItem.cpp" + "ComplexItem.cpp" + "ComplexItemDataPacket.cpp" + "CompoundContainer.cpp" + "CompressedTileStorage.cpp" + "compression.cpp" + "Connection.cpp" + "ConsoleSaveFileConverter.cpp" + "ConsoleSaveFileOriginal.cpp" + "Container.cpp" + "ContainerAckPacket.cpp" + "ContainerButtonClickPacket.cpp" + "ContainerClickPacket.cpp" + "ContainerClosePacket.cpp" + "ContainerOpenPacket.cpp" + "ContainerSetContentPacket.cpp" + "ContainerSetDataPacket.cpp" + "ContainerSetSlotPacket.cpp" + "ControlledByPlayerGoal.cpp" + "CoralTile.cpp" + "Cow.cpp" + "CraftingContainer.cpp" + "CraftingMenu.cpp" + "DefaultGameModeCommand.cpp" + "EnchantItemCommand.cpp" + "ExperienceCommand.cpp" + "GameCommandPacket.cpp" + "GameModeCommand.cpp" + "GenericStats.cpp" + "GiveItemCommand.cpp" + "KillCommand.cpp" + "PerformanceTimer.cpp" + "TimeCommand.cpp" + "ToggleDownfallCommand.cpp" + "TradeItemPacket.cpp" + "CraftItemPacket.cpp" + "Creature.cpp" + "Creeper.cpp" + "CropTile.cpp" + "CustomLevelSource.cpp" + "CustomPayloadPacket.cpp" + "DamageEnchantment.cpp" + "DamageSource.cpp" + "DataInputStream.cpp" + "DataLayer.cpp" + "DataOutputStream.cpp" + "DeadBushFeature.cpp" + "DeadBushTile.cpp" + "DebugOptionsPacket.cpp" + "DefendVillageTargetGoal.cpp" + "DelayedRelease.cpp" + "DerivedLevelData.cpp" + "DesertBiome.cpp" + "DesertWellFeature.cpp" + "DetectorRailTile.cpp" + "DigDurabilityEnchantment.cpp" + "DiggerItem.cpp" + "DiggingEnchantment.cpp" + "Dimension.cpp" + "DiodeTile.cpp" + "Direction.cpp" + "DirectionalTile.cpp" + "DirectoryLevelStorage.cpp" + "DirectoryLevelStorageSource.cpp" + "DirtTile.cpp" + "DisconnectPacket.cpp" + "DispenserTile.cpp" + "DispenserTileEntity.cpp" + "DoorInfo.cpp" + "DoorInteractGoal.cpp" + "DragonFireball.cpp" + "EatTileGoal.cpp" + "EggTile.cpp" + "EnchantedBookItem.cpp" + "Enchantment.cpp" + "EnchantmentCategory.cpp" + "EnchantmentContainer.cpp" + "EnchantmentHelper.cpp" + "EnchantmentInstance.cpp" + "EnchantmentMenu.cpp" + "EnchantmentTableEntity.cpp" + "EnchantmentTableTile.cpp" + "EnderChestTile.cpp" + "EnderChestTileEntity.cpp" + "EnderEyeItem.cpp" + "EnderpearlItem.cpp" + "EndPodiumFeature.cpp" + "ExperienceItem.cpp" + "ExtremeHillsBiome.cpp" + "Feature.cpp" + "EnderCrystal.cpp" + "EnderDragon.cpp" + "EyeOfEnderSignal.cpp" + "FireAspectEnchantment.cpp" + "FireChargeItem.cpp" + "FleeSunGoal.cpp" + "FlippedIcon.cpp" + "FloatGoal.cpp" + "FlowerPotTile.cpp" + "FollowOwnerGoal.cpp" + "FollowParentGoal.cpp" + "Goal.cpp" + "GoalSelector.cpp" + "GoldenAppleItem.cpp" + "Golem.cpp" + "GroundBushFeature.cpp" + "GrowMushroomIslandLayer.cpp" + "HalfSlabTile.cpp" + "HangingEntity.cpp" + "HangingEntityItem.cpp" + "HellFlatLevelSource.cpp" + "HurtByTargetGoal.cpp" + "IceBiome.cpp" + "InteractGoal.cpp" + "ItemFrame.cpp" + "JumpControl.cpp" + "JungleBiome.cpp" + "KickPlayerPacket.cpp" + "KnockbackEnchantment.cpp" + "LavaSlime.cpp" + "LeapAtTargetGoal.cpp" + "LevelSoundPacket.cpp" + "LookAtPlayerGoal.cpp" + "LookAtTradingPlayerGoal.cpp" + "LookControl.cpp" + "LootBonusEnchantment.cpp" + "MakeLoveGoal.cpp" + "MegaTreeFeature.cpp" + "MeleeAttackGoal.cpp" + "MerchantContainer.cpp" + "MerchantMenu.cpp" + "MerchantRecipe.cpp" + "MerchantRecipeList.cpp" + "MerchantResultSlot.cpp" + "MilkBucketItem.cpp" + "MonsterPlacerItem.cpp" + "MoveControl.cpp" + "MoveIndoorsGoal.cpp" + "MoveThroughVillageGoal.cpp" + "MoveTowardsRestrictionGoal.cpp" + "MoveTowardsTargetGoal.cpp" + "MultiTextureTileItem.cpp" + "MushroomCow.cpp" + "MushroomIslandBiome.cpp" + "MycelTile.cpp" + "NearestAttackableTargetGoal.cpp" + "NetherBridgeFeature.cpp" + "NetherBridgePieces.cpp" + "NetherStalkTile.cpp" + "NonTameRandomTargetGoal.cpp" + "Npc.cpp" + "OcelotSitOnTileGoal.cpp" + "OfferFlowerGoal.cpp" + "OpenDoorGoal.cpp" + "OwnerHurtByTargetGoal.cpp" + "OwnerHurtTargetGoal.cpp" + "OxygenEnchantment.cpp" + "Ozelot.cpp" + "OzelotAttackGoal.cpp" + "PanicGoal.cpp" + "PathNavigation.cpp" + "PlayerAbilitiesPacket.cpp" + "PlayerEnderChestContainer.cpp" + "PlayGoal.cpp" + "PotatoTile.cpp" + "PotionBrewing.cpp" + "PotionItem.cpp" + "ProtectionEnchantment.cpp" + "QuartzBlockTile.cpp" + "RandomLookAroundGoal.cpp" + "RandomPos.cpp" + "RandomScatteredLargeFeature.cpp" + "RandomStrollGoal.cpp" + "Rarity.cpp" + "RedlightTile.cpp" + "RegionHillsLayer.cpp" + "RepairContainer.cpp" + "RepairMenu.cpp" + "RepairResultSlot.cpp" + "RestrictOpenDoorGoal.cpp" + "RestrictSunGoal.cpp" + "RotateHeadPacket.cpp" + "ScatteredFeaturePieces.cpp" + "SeedFoodItem.cpp" + "Sensing.cpp" + "SitGoal.cpp" + "SkullItem.cpp" + "SkullTile.cpp" + "SkullTileEntity.cpp" + "SparseDataStorage.cpp" + "SwampRiversLayer.cpp" + "SwellGoal.cpp" + "TakeFlowerGoal.cpp" + "TamableAnimal.cpp" + "TargetGoal.cpp" + "TemptGoal.cpp" + "ThornsEnchantment.cpp" + "TileDestructionPacket.cpp" + "TileEventData.cpp" + "TradeWithPlayerGoal.cpp" + "TripWireSourceTile.cpp" + "TripWireTile.cpp" + "Village.cpp" + "VillagerGolem.cpp" + "Villages.cpp" + "VillageSiege.cpp" + "VinesFeature.cpp" + "WallTile.cpp" + "WeighedTreasure.cpp" + "WoodSlabTile.cpp" + "C4JThread.cpp" + "WoodTile.cpp" + "WoolCarpetTile.cpp" + "XZPacket.cpp" + "ShoreLayer.cpp" + "SmoothStoneBrickTileItem.cpp" + "SparseLightStorage.cpp" + "SpikeFeature.cpp" + "NetherSphere.cpp" + "SmallFireball.cpp" + "SnowMan.cpp" + "StoneMonsterTileItem.cpp" + "TextureAndGeometryChangePacket.cpp" + "TextureAndGeometryPacket.cpp" + "TheEndBiome.cpp" + "TheEndBiomeDecorator.cpp" + "TheEndDimension.cpp" + "TheEndLevelRandomLevelSource.cpp" + "TheEndPortal.cpp" + "TheEndPortalFrameTile.cpp" + "TheEndPortalTileEntity.cpp" + "Throwable.cpp" + "ThrownEnderpearl.cpp" + "ThrownExpBottle.cpp" + "ThrownPotion.cpp" + "TileEntityDataPacket.cpp" + "UntouchingEnchantment.cpp" + "UpdateGameRuleProgressPacket.cpp" + "Distort.cpp" + "DoorItem.cpp" + "DoorTile.cpp" + "DownfallLayer.cpp" + "DownfallMixerLayer.cpp" + "DungeonFeature.cpp" + "DyePowderItem.cpp" + "EggItem.cpp" + "Emboss.cpp" + "EmptyLevelChunk.cpp" + "EnderMan.cpp" + "Enemy.cpp" + "Entity.cpp" + "EntityActionAtPositionPacket.cpp" + "EntityDamageSource.cpp" + "EntityEventPacket.cpp" + "EntityIO.cpp" + "EntityPos.cpp" + "EntityTile.cpp" + "ExperienceOrb.cpp" + "ExplodePacket.cpp" + "Explosion.cpp" + "Facing.cpp" + "FallingTile.cpp" + "FarmTile.cpp" + "FastNoise.cpp" + "FenceGateTile.cpp" + "FenceTile.cpp" + "File.cpp" + "FileHeader.cpp" + "FileInputStream.cpp" + "FileOutputStream.cpp" + "Fireball.cpp" + "FireTile.cpp" + "FishingHook.cpp" + "FishingRodItem.cpp" + "FixedBiomeSource.cpp" + "FlatLayer.cpp" + "FlatLevelSource.cpp" + "FlintAndSteelItem.cpp" + "FloatBuffer.cpp" + "FlowerFeature.cpp" + "FlyingMob.cpp" + "FoliageColor.cpp" + "FoodConstants.cpp" + "FoodData.cpp" + "FoodItem.cpp" + "FoodRecipies.cpp" + "ForestBiome.cpp" + "FurnaceMenu.cpp" + "FurnaceRecipes.cpp" + "FurnaceResultSlot.cpp" + "FurnaceTile.cpp" + "FurnaceTileEntity.cpp" + "FuzzyZoomLayer.cpp" + "GameEventPacket.cpp" + "GeneralStat.cpp" + "GetInfoPacket.cpp" + "Ghast.cpp" + "Giant.cpp" + "GlassTile.cpp" + "GlobalEntity.cpp" + "GrassColor.cpp" + "GrassTile.cpp" + "GravelTile.cpp" + "HalfTransparentTile.cpp" + "Hasher.cpp" + "HatchetItem.cpp" + "HellBiome.cpp" + "HellDimension.cpp" + "HellFireFeature.cpp" + "HellPortalFeature.cpp" + "HellRandomLevelSource.cpp" + "HellSandTile.cpp" + "HellSpringFeature.cpp" + "HellStoneTile.cpp" + "HitResult.cpp" + "HoeItem.cpp" + "HouseFeature.cpp" + "HugeMushroomFeature.cpp" + "HugeMushroomTile.cpp" + "I18n.cpp" + "IceTile.cpp" + "ImprovedNoise.cpp" + "ContainerMenu.cpp" + "IndirectEntityDamageSource.cpp" + "InputStream.cpp" + "InputStreamReader.cpp" + "InstantenousMobEffect.cpp" + "IntBuffer.cpp" + "IntCache.cpp" + "InteractPacket.cpp" + "Inventory.cpp" + "InventoryMenu.cpp" + "IslandLayer.cpp" + "Item.cpp" + "ItemEntity.cpp" + "ItemInstance.cpp" + "ItemStat.cpp" + "KeepAlivePacket.cpp" + "LadderTile.cpp" + "LakeFeature.cpp" + "Language.cpp" + "LargeCaveFeature.cpp" + "LargeFeature.cpp" + "LargeHellCaveFeature.cpp" + "Layer.cpp" + "LeafTile.cpp" + "LeafTileItem.cpp" + "LevelConflictException.cpp" + "LevelData.cpp" + "Level.cpp" + "LevelChunk.cpp" + "LevelEventPacket.cpp" + "LevelSettings.cpp" + "LevelStorage.cpp" + "LevelStorageProfilerDecorator.cpp" + "LevelSummary.cpp" + "LevelType.cpp" + "LeverTile.cpp" + "LightGemFeature.cpp" + "LightGemTile.cpp" + "LightningBolt.cpp" + "LiquidTile.cpp" + "LiquidTileDynamic.cpp" + "LiquidTileStatic.cpp" + "LockedChestTile.cpp" + "LoginPacket.cpp" + "MapItem.cpp" + "MapItemSavedData.cpp" + "Material.cpp" + "MaterialColor.cpp" + "JavaMath.cpp" + "McRegionChunkStorage.cpp" + "McRegionLevelStorageSource.cpp" + "McRegionLevelStorage.cpp" + "MelonTile.cpp" + "MenuBackup.cpp" + "MetalTile.cpp" + "Minecart.cpp" + "MinecartItem.cpp" + "Minecraft.World.cpp" + "MineShaftFeature.cpp" + "MineShaftPieces.cpp" + "MineShaftStart.cpp" + "Mob.cpp" + "MobCategory.cpp" + "MobEffect.cpp" + "MobEffectInstance.cpp" + "MobSpawner.cpp" + "MobSpawnerTile.cpp" + "MobSpawnerTileEntity.cpp" + "MockedLevelStorage.cpp" + "Monster.cpp" + "MonsterRoomFeature.cpp" + "MoveEntityPacket.cpp" + "MoveEntityPacketSmall.cpp" + "MovePlayerPacket.cpp" + "Mth.cpp" + "Mushroom.cpp" + "MusicTile.cpp" + "MusicTileEntity.cpp" + "NbtIo.cpp" + "Node.cpp" + "NotGateTile.cpp" + "ObsidianTile.cpp" + "OldChunkStorage.cpp" + "OreFeature.cpp" + "OreRecipies.cpp" + "OreTile.cpp" + "Packet.cpp" + "PacketListener.cpp" + "Painting.cpp" + "Path.cpp" + "PathFinder.cpp" + "PathfinderMob.cpp" + "PerlinNoise.cpp" + "PerlinSimplexNoise.cpp" + "PickaxeItem.cpp" + "Pig.cpp" + "PigZombie.cpp" + "PineFeature.cpp" + "PistonBaseTile.cpp" + "PistonExtensionTile.cpp" + "PistonMovingPiece.cpp" + "PistonPieceEntity.cpp" + "PistonTileItem.cpp" + "PlainsBiome.cpp" + "Player.cpp" + "PlayerActionPacket.cpp" + "PlayerCommandPacket.cpp" + "PlayerInfoPacket.cpp" + "PlayerInputPacket.cpp" + "PortalForcer.cpp" + "PortalTile.cpp" + "Pos.cpp" + "PreLoginPacket.cpp" + "PressurePlateTile.cpp" + "PrimedTnt.cpp" + "PumpkinFeature.cpp" + "PumpkinTile.cpp" + "RailTile.cpp" + "RainforestBiome.cpp" + "Random.cpp" + "RandomLevelSource.cpp" + "ReadOnlyChunkCache.cpp" + "Recipes.cpp" + "RecordingItem.cpp" + "RecordPlayerTile.cpp" + "RedStoneDustTile.cpp" + "RedStoneItem.cpp" + "RedStoneOreTile.cpp" + "ReedsFeature.cpp" + "ReedTile.cpp" + "Region.cpp" + "RegionFile.cpp" + "RegionFileCache.cpp" + "RemoveEntitiesPacket.cpp" + "RemoveMobEffectPacket.cpp" + "RespawnPacket.cpp" + "ResultContainer.cpp" + "ResultSlot.cpp" + "RiverInitLayer.cpp" + "RiverLayer.cpp" + "RiverMixerLayer.cpp" + "Rotate.cpp" + "SaddleItem.cpp" + "SandFeature.cpp" + "SandStoneTile.cpp" + "HeavyTile.cpp" + "Sapling.cpp" + "SaplingTileItem.cpp" + "SavedData.cpp" + "SavedDataStorage.cpp" + "Scale.cpp" + "SeedItem.cpp" + "ServerSettingsChangedPacket.cpp" + "SetCarriedItemPacket.cpp" + "SetCreativeModeSlotPacket.cpp" + "SetEntityDataPacket.cpp" + "SetEntityMotionPacket.cpp" + "SetEquippedItemPacket.cpp" + "SetExperiencePacket.cpp" + "SetHealthPacket.cpp" + "SetRidingPacket.cpp" + "SetSpawnPositionPacket.cpp" + "SetTimePacket.cpp" + "ShapedRecipy.cpp" + "ShapelessRecipy.cpp" + "SharedConstants.cpp" + "ShearsItem.cpp" + "Sheep.cpp" + "ShovelItem.cpp" + "SignItem.cpp" + "SignTile.cpp" + "SignTileEntity.cpp" + "SignUpdatePacket.cpp" + "Silverfish.cpp" + "SimpleContainer.cpp" + "SimplexNoise.cpp" + "Skeleton.cpp" + "Slime.cpp" + "Slot.cpp" + "SmoothFloat.cpp" + "SmoothLayer.cpp" + "SmoothStoneBrickTile.cpp" + "SmoothZoomLayer.cpp" + "Snowball.cpp" + "SnowballItem.cpp" + "SnowTile.cpp" + "Socket.cpp" + "Spider.cpp" + "Sponge.cpp" + "SpringFeature.cpp" + "SpringTile.cpp" + "SpruceFeature.cpp" + "Squid.cpp" + "Stat.cpp" + "Stats.cpp" + "StairTile.cpp" + "stdafx.cpp" + "StemTile.cpp" + "StoneMonsterTile.cpp" + "StoneSlabTile.cpp" + "StoneSlabTileItem.cpp" + "StoneTile.cpp" + "StringHelpers.cpp" + "StrongholdFeature.cpp" + "StrongholdPieces.cpp" + "StructureFeature.cpp" + "StructurePiece.cpp" + "StructureRecipies.cpp" + "StructureStart.cpp" + "SwampBiome.cpp" + "SwampTreeFeature.cpp" + "SynchedEntityData.cpp" + "Synth.cpp" + "system.cpp" + "Tag.cpp" + "TaigaBiome.cpp" + "TakeItemEntityPacket.cpp" + "TallGrass.cpp" + "TallGrassFeature.cpp" + "TeleportEntityPacket.cpp" + "TemperatureLayer.cpp" + "TemperatureMixerLayer.cpp" + "TextureChangePacket.cpp" + "TexturePacket.cpp" + "ThinFenceTile.cpp" + "ThreadName.cpp" + "ThrownEgg.cpp" + "TickNextTickData.cpp" + "Tile.cpp" + "TileEventPacket.cpp" + "TileItem.cpp" + "TileEntity.cpp" + "TilePlanterItem.cpp" + "TilePos.cpp" + "TileUpdatePacket.cpp" + "TntTile.cpp" + "ToolRecipies.cpp" + "TopSnowTile.cpp" + "TorchTile.cpp" + "TransparentTile.cpp" + "TrapDoorTile.cpp" + "TrapMenu.cpp" + "TreeFeature.cpp" + "TreeTileItem.cpp" + "UpdateMobEffectPacket.cpp" + "UpdateProgressPacket.cpp" + "UseItemPacket.cpp" + "Vec3.cpp" + "VillageFeature.cpp" + "VillagePieces.cpp" + "Villager.cpp" + "VineTile.cpp" + "VoronoiZoom.cpp" + "WaterColor.cpp" + "WaterLevelChunk.cpp" + "WaterlilyFeature.cpp" + "WaterLilyTile.cpp" + "WaterLilyTileItem.cpp" + "WaterWorkerEnchantment.cpp" + "WeaponItem.cpp" + "WeaponRecipies.cpp" + "WeighedRandom.cpp" + "Wolf.cpp" + "TreeTile.cpp" + "WebTile.cpp" + "WorkbenchTile.cpp" + "ConsoleSaveFileInputStream.cpp" + "ConsoleSaveFileOutputStream.cpp" + "Zombie.cpp" + "WaterAnimal.cpp" + "ZoomLayer.cpp" +) \ No newline at end of file From 720bc9d17007d00cb170aaaf47c27e8e5c0cf582 Mon Sep 17 00:00:00 2001 From: BendedWills Date: Mon, 2 Mar 2026 05:17:58 -0600 Subject: [PATCH 02/16] Remove unused vendor & add working directory --- .gitignore | 5 +++-- CMakeLists.txt | 4 ++++ Vendor/CMakeLists.txt | 0 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 Vendor/CMakeLists.txt diff --git a/.gitignore b/.gitignore index c3fa494..916b70b 100644 --- a/.gitignore +++ b/.gitignore @@ -54,7 +54,8 @@ Minecraft.Client/music/ *.binka # Common Media - UI (SWF), Graphics (PNG), Sound (WAV), Fonts -Minecraft.Client/Common/Media/ +Assets +Assets/Common/Media/ # Game resource textures, art, audio, etc. Minecraft.Client/Common/res/ Minecraft.Client/Common/DummyTexturePack/ @@ -82,7 +83,7 @@ Minecraft.Client/Windows64/GameHDD/ # Thumbnail / test images *.png # But allow source code PNG references to be noted -!Minecraft.Client/Common/Media/Graphics/.gitkeep +!Assets/Common/Media/Graphics/.gitkeep # SWF UI files (Flash-based UI assets) *.swf diff --git a/CMakeLists.txt b/CMakeLists.txt index 52c7318..bee5654 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) project("LCEMP") +set(LCEMP_WORKING_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Assets" CACHE STRING "The working directory for MinecraftClient") + set(CMAKE_CXX_STANDARD 11) add_subdirectory(Vendor) @@ -19,6 +21,8 @@ list(TRANSFORM MINECRAFT_CLIENT_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Min add_library(MinecraftWorld STATIC ${MINECRAFT_WORLD_SOURCES}) add_executable(MinecraftClient WIN32 ${MINECRAFT_CLIENT_SOURCES}) +set_property(TARGET MinecraftClient PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${LCEMP_WORKING_DIR}") + if(MSVC) # /MT and /MTd options set the CRT version to multi-threaded static mode # which is what the 4J libs were compiled with diff --git a/Vendor/CMakeLists.txt b/Vendor/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 From 16fd73510f4e710dad4ff6e56c7c5a92977a82cb Mon Sep 17 00:00:00 2001 From: BendedWills Date: Mon, 2 Mar 2026 05:19:59 -0600 Subject: [PATCH 03/16] Don't add the vendor directory --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bee5654..e39204a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ project("LCEMP") set(LCEMP_WORKING_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Assets" CACHE STRING "The working directory for MinecraftClient") set(CMAKE_CXX_STANDARD 11) -add_subdirectory(Vendor) if(NOT WIN32) message(FATAL_ERROR "Windows is currently the only supported OS") From 1e7985dcc3a3ad8f7a201b267a6729f32ebffdf0 Mon Sep 17 00:00:00 2001 From: BendedWills Date: Mon, 2 Mar 2026 05:47:03 -0600 Subject: [PATCH 04/16] Initialize the flags of DSV desc --- Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index f3bc185..ae9aa32 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -730,6 +730,8 @@ app.DebugPrintf("width: %d, height: %d\n", width, height); descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; descDSView.Texture2D.MipSlice = 0; + // when would this ever be a non-garbage value? + descDSView.Flags = 0; hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); From 256363b710e313344cc05aff41b217f149365eea Mon Sep 17 00:00:00 2001 From: Gamemode111 <85313116+Gamemode111@users.noreply.github.com> Date: Tue, 3 Mar 2026 02:49:35 +0300 Subject: [PATCH 05/16] =?UTF-8?q?fixing=20the=20=C2=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit just cool change --- Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 427567b..704d736 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -123,8 +123,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) #ifdef __ORBIS__ // we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus. //X coordinate of the touch point (0 to 1919) - //Y coordinate of the touch point (0 to 941: DUALSHOCK�4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation�4 development tool, - //0 to 753: JDX-1000x series controllers for the PlayStation�4 development tool,) + //Y coordinate of the touch point (0 to 941: DUALSHOCK®4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation®4 development tool, + //0 to 753: JDX-1000x series controllers for the PlayStation®4 development tool,) m_fTouchPadMulX=fPanelWidth/1919.0f; m_fTouchPadMulY=fPanelHeight/941.0f; m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX; From de44564825e239acf816ac820e786b3e0afe6cdb Mon Sep 17 00:00:00 2001 From: Windermed <80722937+Windermed@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:58:25 -0800 Subject: [PATCH 06/16] pick block for mobs * adjusted the pick block addition to also count for mobs being looked at (which should give the player it's proper spawn egg) --- Minecraft.Client/Minecraft.cpp | 125 +++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 51 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 865f8a9..3494d2a 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -62,6 +62,7 @@ #include "..\Minecraft.World\StrongholdFeature.h" #include "..\Minecraft.World\IntCache.h" #include "..\Minecraft.World\Villager.h" +#include "..\Minecraft.World\EntityIO.h" // for mobs #include "..\Minecraft.World\SparseLightStorage.h" #include "..\Minecraft.World\SparseDataStorage.h" #include "TextureManager.h" @@ -3296,63 +3297,85 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef _WINDOWS64 // allows for the player to get the block they are looking at in creative by middle clicking. - if (iPad == 0 && player->abilities.instabuild && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE) && hitResult != NULL && hitResult->type == HitResult::TILE) + if (iPad == 0 && player->abilities.instabuild && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE) && hitResult != NULL && (hitResult->type == HitResult::TILE || hitResult->type == HitResult::ENTITY)) { - //printf("MIDDLE CLICK TEST!!"); - int tileId = level->getTile(hitResult->x, hitResult->y, hitResult->z); - Tile *tile = (tileId > 0 && tileId < Tile::TILE_NUM_COUNT) ? Tile::tiles[tileId] : NULL; + //printf("MIDDLE CLICK TEST!!"); // windermed was here. + int cloneId = -1; + int cloneData = 0; + bool checkData = false; - if (tile != NULL) + // if its a tile + if (hitResult->type == HitResult::TILE) { - int cloneId = tile->cloneTileId(level, hitResult->x, hitResult->y, hitResult->z); - - if (cloneId > 0 && cloneId < Item::ITEM_NUM_COUNT && Item::items[cloneId] != NULL) + int tileId = level->getTile(hitResult->x, hitResult->y, hitResult->z); + Tile* tile = (tileId > 0 && tileId < Tile::TILE_NUM_COUNT) ? Tile::tiles[tileId] : NULL; + if (tile != NULL) { - int cloneData = tile->cloneTileData(level, hitResult->x, hitResult->y, hitResult->z); - bool checkData = Item::items[cloneId]->isStackedByData(); - - int quickbarSlot = -1; - - for (int slot = 0; slot < Inventory::getSelectionSize(); ++slot) - { - shared_ptr quickbarItem = player->inventory->items[slot]; - if (quickbarItem == NULL || quickbarItem->id != cloneId) - { - continue; - } - - if (!checkData || quickbarItem->getAuxValue() == cloneData) - { - quickbarSlot = slot; - break; - } - } - - if (quickbarSlot >= 0) - { - player->inventory->selected = quickbarSlot; - } - else - { - player->inventory->grabTexture(cloneId, cloneData, checkData, true); - } - - // should prevent ghost items/blocks - shared_ptr selctedItem = player->inventory->getSelected(); - if (gameMode != NULL && selctedItem != NULL) - { - const int creativeHotbarSlotStart = 36; - gameMode->handleCreativeModeItemAdd(selctedItem, creativeHotbarSlotStart + player->inventory->selected); - } - - if (gameMode != NULL && gameMode->getTutorial() != NULL) - { - gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected()); - } - - player->updateRichPresence(); + cloneId = tile->cloneTileId(level, hitResult->x, hitResult->y, hitResult->z); + cloneData = tile->cloneTileData(level, hitResult->x, hitResult->y, hitResult->z); } } + + // if its an entity + else if (hitResult->type == HitResult::ENTITY && hitResult->entity != NULL) + { + int entityIoId = EntityIO::eTypeToIoid(hitResult->entity->GetType()); + if (entityIoId > 0 && EntityIO::idsSpawnableInCreative.find(entityIoId) != EntityIO::idsSpawnableInCreative.end()) + { + cloneId = Item::monsterPlacer_Id; + cloneData = entityIoId; + checkData = true; + } + } + + // if we have a valid cloneId, try to find it in the quickbar and select it, otherwise just grab it. + if (cloneId > 0 && cloneId < Item::ITEM_NUM_COUNT && Item::items[cloneId] != NULL) + { + if (hitResult->type == HitResult::TILE) + { + checkData = Item::items[cloneId]->isStackedByData(); + } + + int quickbarSlot = -1; + for (int slot = 0; slot < Inventory::getSelectionSize(); ++slot) + { + shared_ptr quickbarItem = player->inventory->items[slot]; + if (quickbarItem == NULL || quickbarItem->id != cloneId) + { + continue; + } + + if (!checkData || quickbarItem->getAuxValue() == cloneData) + { + quickbarSlot = slot; + break; + } + } + + if (quickbarSlot >= 0) + { + player->inventory->selected = quickbarSlot; + } + else + { + player->inventory->grabTexture(cloneId, cloneData, checkData, true); + } + + // should prevent ghost items/blocks + shared_ptr selectedItem = player->inventory->getSelected(); + if (gameMode != NULL && selectedItem != NULL) + { + const int creativeQuickbarSlotStart = 36; + gameMode->handleCreativeModeItemAdd(selectedItem, creativeQuickbarSlotStart + player->inventory->selected); + } + + if (gameMode != NULL && gameMode->getTutorial() != NULL) + { + gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected()); + } + + player->updateRichPresence(); + } } #endif From 7c4b30d11e98aaba96aae82ddbfd0347ba07e30f Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Mon, 2 Mar 2026 23:10:41 -0300 Subject: [PATCH 07/16] fix: major windows64 net fixes --- Minecraft.Client/ClientConnection.cpp | 59 +++++++ .../Network/PlatformNetworkManagerStub.cpp | 38 ++++- Minecraft.Client/Extrax64Stubs.cpp | 45 ++++-- .../Windows64/Network/WinsockNetLayer.cpp | 146 +++++++++++++----- .../Windows64/Network/WinsockNetLayer.h | 2 + 5 files changed, 235 insertions(+), 55 deletions(-) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index b80eaed..628b330 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -52,6 +52,11 @@ #endif #include "DLCTexturePack.h" +#ifdef _WINDOWS64 +#include "Xbox\Network\NetworkPlayerXbox.h" +#include "Common\Network\PlatformNetworkManagerStub.h" +#endif + #ifdef _DURANGO #include "..\Minecraft.World\DurangoStats.h" #include "..\Minecraft.World\GenericStats.h" @@ -758,6 +763,27 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) player->displayName = player->name; #endif +#ifdef _WINDOWS64 + { + PlayerUID pktXuid = player->getXuid(); + const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e; + if (pktXuid >= WIN64_XUID_BASE && pktXuid < WIN64_XUID_BASE + MINECRAFT_NET_MAX_PLAYERS) + { + BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE); + INetworkPlayer *np = g_NetworkManager.GetPlayerBySmallId(smallId); + if (np != NULL) + { + NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np; + IQNetPlayer *qp = npx->GetQNetPlayer(); + if (qp != NULL && qp->m_gamertag[0] == 0) + { + wcsncpy_s(qp->m_gamertag, 32, packet->name.c_str(), _TRUNCATE); + } + } + } + } +#endif + // printf("\t\t\t\t%d: Add player\n",packet->id,packet->yRot); int item = packet->carriedItem; @@ -893,6 +919,39 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr p void ClientConnection::handleRemoveEntity(shared_ptr packet) { +#ifdef _WINDOWS64 + if (!g_NetworkManager.IsHost()) + { + for (int i = 0; i < packet->ids.length; i++) + { + shared_ptr entity = getEntity(packet->ids[i]); + if (entity != NULL && entity->GetType() == eTYPE_PLAYER) + { + shared_ptr player = dynamic_pointer_cast(entity); + if (player != NULL) + { + PlayerUID xuid = player->getXuid(); + INetworkPlayer *np = g_NetworkManager.GetPlayerByXuid(xuid); + if (np != NULL) + { + NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np; + IQNetPlayer *qp = npx->GetQNetPlayer(); + if (qp != NULL) + { + extern CPlatformNetworkManagerStub *g_pPlatformNetworkManager; + g_pPlatformNetworkManager->NotifyPlayerLeaving(qp); + qp->m_smallId = 0; + qp->m_isRemote = false; + qp->m_isHostPlayer = false; + qp->m_gamertag[0] = 0; + qp->SetCustomDataValue(0); + } + } + } + } + } + } +#endif for (int i = 0; i < packet->ids.length; i++) { level->removeEntity(packet->ids[i]); diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 24d5243..0a69cd6 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -240,6 +240,28 @@ void CPlatformNetworkManagerStub::DoWork() IQNet::s_playerCount--; } } + + for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++) + { + IQNetPlayer *qp = &IQNet::m_player[i]; + if (qp->GetCustomDataValue() == 0) + continue; + INetworkPlayer *np = (INetworkPlayer *)qp->GetCustomDataValue(); + Socket *sock = np->GetSocket(); + if (sock != NULL && sock->isClosing()) + { + WinsockNetLayer::CloseConnectionBySmallId((BYTE)i); + } + } + } + if (_iQNetStubState == QNET_STATE_GAME_PLAY && !m_pIQNet->IsHost()) + { + if (!WinsockNetLayer::IsConnected() && !g_NetworkManager.IsLeavingGame()) + { + if (app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) + app.SetDisconnectReason(DisconnectPacket::eDisconnect_Quitting); + app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ExitWorld, (void *)TRUE); + } } #endif } @@ -811,7 +833,21 @@ INetworkPlayer * CPlatformNetworkManagerStub::GetPlayerByXuid(PlayerUID xuid) INetworkPlayer * CPlatformNetworkManagerStub::GetPlayerBySmallId(unsigned char smallId) { - return getNetworkPlayer(m_pIQNet->GetPlayerBySmallId(smallId)); + IQNetPlayer *qnetPlayer = m_pIQNet->GetPlayerBySmallId(smallId); + if (qnetPlayer == NULL) + return NULL; + + INetworkPlayer *networkPlayer = getNetworkPlayer(qnetPlayer); +#ifdef _WINDOWS64 + if (networkPlayer == NULL && smallId != 0 && !m_pIQNet->IsHost()) + { + qnetPlayer->m_isRemote = true; + qnetPlayer->m_isHostPlayer = false; + NotifyPlayerJoined(qnetPlayer); + networkPlayer = getNetworkPlayer(qnetPlayer); + } +#endif + return networkPlayer; } INetworkPlayer *CPlatformNetworkManagerStub::GetHostPlayer() diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 4ebd89e..9db5776 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -168,7 +168,7 @@ void PIXSetMarkerDeprecated(int a, char *b, ...) {} bool IsEqualXUID(PlayerUID a, PlayerUID b) { -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) +#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) return (a == b); #else return false; @@ -232,13 +232,17 @@ void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, IQNet::s_playerCount = smallId + 1; } +static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index); + HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex){ return S_OK; } IQNetPlayer *IQNet::GetHostPlayer() { return &m_player[0]; } IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) { if (s_isHosting) { - if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && !m_player[dwUserIndex].m_isRemote) + if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && + !m_player[dwUserIndex].m_isRemote && + Win64_IsActivePlayer(&m_player[dwUserIndex], dwUserIndex)) return &m_player[dwUserIndex]; return NULL; } @@ -246,7 +250,7 @@ IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) return NULL; for (DWORD i = 0; i < s_playerCount; i++) { - if (!m_player[i].m_isRemote) + if (!m_player[i].m_isRemote && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; } return NULL; @@ -272,19 +276,21 @@ IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex) } IQNetPlayer *IQNet::GetPlayerBySmallId(BYTE SmallId) { - for (DWORD i = 0; i < s_playerCount; i++) - { - if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; - } - return NULL; + if (SmallId >= MINECRAFT_NET_MAX_PLAYERS) + return NULL; + + m_player[SmallId].m_smallId = SmallId; + if (SmallId >= s_playerCount) + s_playerCount = SmallId + 1; + return &m_player[SmallId]; } IQNetPlayer *IQNet::GetPlayerByXuid(PlayerUID xuid) { - for (DWORD i = 0; i < s_playerCount; i++) + for (DWORD i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i]; } - return &m_player[0]; + return NULL; } DWORD IQNet::GetPlayerCount() { @@ -299,15 +305,28 @@ QNET_STATE IQNet::GetState() { return _iQNetStubState; } bool IQNet::IsHost() { return s_isHosting; } HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; } void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; } -void IQNet::ClientJoinGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = false; } +void IQNet::ClientJoinGame() +{ + _iQNetStubState = QNET_STATE_SESSION_STARTING; + s_isHosting = false; + + for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) + { + m_player[i].m_smallId = (BYTE)i; + m_player[i].m_isRemote = true; + m_player[i].m_isHostPlayer = false; + m_player[i].m_gamertag[0] = 0; + m_player[i].SetCustomDataValue(0); + } +} void IQNet::EndGame() { _iQNetStubState = QNET_STATE_IDLE; s_isHosting = false; s_playerCount = 1; - for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++) + for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++) { - m_player[i].m_smallId = 0; + m_player[i].m_smallId = (BYTE)i; m_player[i].m_isRemote = false; m_player[i].m_isHostPlayer = false; m_player[i].m_gamertag[0] = 0; diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 19fc259..7e7c6ae 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -213,6 +213,14 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) s_isHost = false; s_hostSmallId = 0; + s_connected = false; + s_active = false; + + if (s_hostConnectionSocket != INVALID_SOCKET) + { + closesocket(s_hostConnectionSocket); + s_hostConnectionSocket = INVALID_SOCKET; + } struct addrinfo hints = {}; struct addrinfo *result = NULL; @@ -231,37 +239,55 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) return false; } - s_hostConnectionSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); - if (s_hostConnectionSocket == INVALID_SOCKET) + bool connected = false; + BYTE assignedSmallId = 0; + const int maxAttempts = 12; + + for (int attempt = 0; attempt < maxAttempts; ++attempt) { - app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); - freeaddrinfo(result); - return false; + s_hostConnectionSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); + if (s_hostConnectionSocket == INVALID_SOCKET) + { + app.DebugPrintf("socket() failed: %d\n", WSAGetLastError()); + break; + } + + int noDelay = 1; + setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay)); + + iResult = connect(s_hostConnectionSocket, result->ai_addr, (int)result->ai_addrlen); + if (iResult == SOCKET_ERROR) + { + int err = WSAGetLastError(); + app.DebugPrintf("connect() to %s:%d failed (attempt %d/%d): %d\n", ip, port, attempt + 1, maxAttempts, err); + closesocket(s_hostConnectionSocket); + s_hostConnectionSocket = INVALID_SOCKET; + Sleep(200); + continue; + } + + BYTE assignBuf[1]; + int bytesRecv = recv(s_hostConnectionSocket, (char *)assignBuf, 1, 0); + if (bytesRecv != 1) + { + app.DebugPrintf("Failed to receive small ID assignment from host (attempt %d/%d)\n", attempt + 1, maxAttempts); + closesocket(s_hostConnectionSocket); + s_hostConnectionSocket = INVALID_SOCKET; + Sleep(200); + continue; + } + + assignedSmallId = assignBuf[0]; + connected = true; + break; } - - int noDelay = 1; - setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay)); - - iResult = connect(s_hostConnectionSocket, result->ai_addr, (int)result->ai_addrlen); freeaddrinfo(result); - if (iResult == SOCKET_ERROR) - { - app.DebugPrintf("connect() to %s:%d failed: %d\n", ip, port, WSAGetLastError()); - closesocket(s_hostConnectionSocket); - s_hostConnectionSocket = INVALID_SOCKET; - return false; - } - BYTE assignBuf[1]; - int bytesRecv = recv(s_hostConnectionSocket, (char *)assignBuf, 1, 0); - if (bytesRecv != 1) + if (!connected) { - app.DebugPrintf("Failed to receive small ID assignment from host\n"); - closesocket(s_hostConnectionSocket); - s_hostConnectionSocket = INVALID_SOCKET; return false; } - s_localSmallId = assignBuf[0]; + s_localSmallId = assignedSmallId; app.DebugPrintf("Win64 LAN: Connected to %s:%d, assigned smallId=%d\n", ip, port, s_localSmallId); @@ -479,7 +505,8 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) BYTE clientSmallId = s_connections[connIdx].smallId; LeaveCriticalSection(&s_connectionsLock); - BYTE *recvBuf = new BYTE[WIN64_NET_RECV_BUFFER_SIZE]; + std::vector recvBuf; + recvBuf.resize(WIN64_NET_RECV_BUFFER_SIZE); while (s_active) { @@ -490,33 +517,47 @@ DWORD WINAPI WinsockNetLayer::RecvThreadProc(LPVOID param) break; } - int packetSize = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3]; + int packetSize = + ((uint32_t)header[0] << 24) | + ((uint32_t)header[1] << 16) | + ((uint32_t)header[2] << 8) | + ((uint32_t)header[3]); - if (packetSize <= 0 || packetSize > WIN64_NET_RECV_BUFFER_SIZE) + if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE) { - app.DebugPrintf("Win64 LAN: Invalid packet size %d from client smallId=%d\n", packetSize, clientSmallId); + app.DebugPrintf("Win64 LAN: Invalid packet size %d from client smallId=%d (max=%d)\n", + packetSize, + clientSmallId, + (int)WIN64_NET_MAX_PACKET_SIZE); break; } - if (!RecvExact(sock, recvBuf, packetSize)) + if ((int)recvBuf.size() < packetSize) + { + recvBuf.resize(packetSize); + app.DebugPrintf("Win64 LAN: Resized host recv buffer to %d bytes for client smallId=%d\n", packetSize, clientSmallId); + } + + if (!RecvExact(sock, &recvBuf[0], packetSize)) { app.DebugPrintf("Win64 LAN: Client smallId=%d disconnected (body)\n", clientSmallId); break; } - HandleDataReceived(clientSmallId, s_hostSmallId, recvBuf, packetSize); + HandleDataReceived(clientSmallId, s_hostSmallId, &recvBuf[0], packetSize); } - delete[] recvBuf; - EnterCriticalSection(&s_connectionsLock); for (size_t i = 0; i < s_connections.size(); i++) { if (s_connections[i].smallId == clientSmallId) { s_connections[i].active = false; - closesocket(s_connections[i].tcpSocket); - s_connections[i].tcpSocket = INVALID_SOCKET; + if (s_connections[i].tcpSocket != INVALID_SOCKET) + { + closesocket(s_connections[i].tcpSocket); + s_connections[i].tcpSocket = INVALID_SOCKET; + } break; } } @@ -550,9 +591,26 @@ void WinsockNetLayer::PushFreeSmallId(BYTE smallId) LeaveCriticalSection(&s_freeSmallIdLock); } +void WinsockNetLayer::CloseConnectionBySmallId(BYTE smallId) +{ + EnterCriticalSection(&s_connectionsLock); + for (size_t i = 0; i < s_connections.size(); i++) + { + if (s_connections[i].smallId == smallId && s_connections[i].active && s_connections[i].tcpSocket != INVALID_SOCKET) + { + closesocket(s_connections[i].tcpSocket); + s_connections[i].tcpSocket = INVALID_SOCKET; + app.DebugPrintf("Win64 LAN: Force-closed TCP connection for smallId=%d\n", smallId); + break; + } + } + LeaveCriticalSection(&s_connectionsLock); +} + DWORD WINAPI WinsockNetLayer::ClientRecvThreadProc(LPVOID param) { - BYTE *recvBuf = new BYTE[WIN64_NET_RECV_BUFFER_SIZE]; + std::vector recvBuf; + recvBuf.resize(WIN64_NET_RECV_BUFFER_SIZE); while (s_active && s_hostConnectionSocket != INVALID_SOCKET) { @@ -565,23 +623,29 @@ DWORD WINAPI WinsockNetLayer::ClientRecvThreadProc(LPVOID param) int packetSize = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3]; - if (packetSize <= 0 || packetSize > WIN64_NET_RECV_BUFFER_SIZE) + if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE) { - app.DebugPrintf("Win64 LAN: Invalid packet size %d from host\n", packetSize); + app.DebugPrintf("Win64 LAN: Invalid packet size %d from host (max=%d)\n", + packetSize, + (int)WIN64_NET_MAX_PACKET_SIZE); break; } - if (!RecvExact(s_hostConnectionSocket, recvBuf, packetSize)) + if ((int)recvBuf.size() < packetSize) + { + recvBuf.resize(packetSize); + app.DebugPrintf("Win64 LAN: Resized client recv buffer to %d bytes\n", packetSize); + } + + if (!RecvExact(s_hostConnectionSocket, &recvBuf[0], packetSize)) { app.DebugPrintf("Win64 LAN: Disconnected from host (body)\n"); break; } - HandleDataReceived(s_hostSmallId, s_localSmallId, recvBuf, packetSize); + HandleDataReceived(s_hostSmallId, s_localSmallId, &recvBuf[0], packetSize); } - delete[] recvBuf; - s_connected = false; return 0; } diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h index 96b03c9..e6ace42 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h @@ -12,6 +12,7 @@ #define WIN64_NET_DEFAULT_PORT 25565 #define WIN64_NET_MAX_CLIENTS 7 #define WIN64_NET_RECV_BUFFER_SIZE 65536 +#define WIN64_NET_MAX_PACKET_SIZE (4 * 1024 * 1024) #define WIN64_LAN_DISCOVERY_PORT 25566 #define WIN64_LAN_BROADCAST_MAGIC 0x4D434C4E @@ -81,6 +82,7 @@ public: static bool PopDisconnectedSmallId(BYTE *outSmallId); static void PushFreeSmallId(BYTE smallId); + static void CloseConnectionBySmallId(BYTE smallId); static bool StartAdvertising(int gamePort, const wchar_t *hostName, unsigned int gameSettings, unsigned int texPackId, unsigned char subTexId, unsigned short netVer); static void StopAdvertising(); From 43d20374a45f06a0d44c6ce0123a0529d210ed51 Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Mon, 2 Mar 2026 23:43:15 -0300 Subject: [PATCH 08/16] fix: improve input and fix debug menu crash --- Minecraft.Client/Common/UI/UIController.cpp | 23 ++++--- Minecraft.Client/Input.cpp | 8 +-- Minecraft.Client/KeyboardMouseInput.cpp | 1 + Minecraft.Client/KeyboardMouseInput.h | 5 ++ Minecraft.Client/Minecraft.cpp | 64 ++++++++++--------- .../Windows64/Windows64_Minecraft.cpp | 19 ++++++ 6 files changed, 76 insertions(+), 44 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 7e7eb79..988f085 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -729,20 +729,23 @@ void UIController::tickInput() S32 numFocusables = 0; IggyPlayerGetFocusableObjects(movie, ¤tFocus, focusables, 64, &numFocusables); - IggyFocusHandle hitObject = IGGY_FOCUS_NULL; - for (S32 i = 0; i < numFocusables; ++i) + if (numFocusables > 0 && numFocusables <= 64) { - if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 && - mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1) + IggyFocusHandle hitObject = IGGY_FOCUS_NULL; + for (S32 i = 0; i < numFocusables; ++i) { - hitObject = focusables[i].object; - break; + if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 && + mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1) + { + hitObject = focusables[i].object; + break; + } } - } - if (hitObject != IGGY_FOCUS_NULL && hitObject != currentFocus) - { - IggyPlayerSetFocusRS(movie, hitObject, 0); + if (hitObject != IGGY_FOCUS_NULL && hitObject != currentFocus) + { + IggyPlayerSetFocusRS(movie, hitObject, 0); + } } if (g_KBMInput.IsMouseButtonDown(0) || g_KBMInput.IsMouseButtonPressed(0)) diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index 6772b3c..b44e81b 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -46,7 +46,7 @@ void Input::tick(LocalPlayer *player) float kbXA = 0.0f; float kbYA = 0.0f; #ifdef _WINDOWS64 - if (iPad == 0 && g_KBMInput.IsMouseGrabbed()) + if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { if( pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT) ) kbXA = g_KBMInput.GetMoveX(); @@ -94,7 +94,7 @@ void Input::tick(LocalPlayer *player) } #ifdef _WINDOWS64 - if (iPad == 0 && g_KBMInput.IsMouseGrabbed()) + if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { // Left Shift = sneak (hold to crouch) if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE)) @@ -166,7 +166,7 @@ void Input::tick(LocalPlayer *player) float turnY = ty * abs(ty) * turnSpeed; #ifdef _WINDOWS64 - if (iPad == 0 && g_KBMInput.IsMouseGrabbed()) + if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f; float mouseLookScale = 5.0f; @@ -190,7 +190,7 @@ void Input::tick(LocalPlayer *player) unsigned int jump = InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP); bool kbJump = false; #ifdef _WINDOWS64 - kbJump = (iPad == 0) && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_JUMP); + kbJump = (iPad == 0) && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_JUMP); #endif if( (jump > 0 || kbJump) && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP) ) jumping = true; diff --git a/Minecraft.Client/KeyboardMouseInput.cpp b/Minecraft.Client/KeyboardMouseInput.cpp index 4d5855c..63a1dae 100644 --- a/Minecraft.Client/KeyboardMouseInput.cpp +++ b/Minecraft.Client/KeyboardMouseInput.cpp @@ -36,6 +36,7 @@ void KeyboardMouseInput::Init() m_cursorHiddenForUI = false; m_windowFocused = true; m_hasInput = false; + m_kbmActive = true; RAWINPUTDEVICE rid; rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC diff --git a/Minecraft.Client/KeyboardMouseInput.h b/Minecraft.Client/KeyboardMouseInput.h index 03e4e29..d5a4c3b 100644 --- a/Minecraft.Client/KeyboardMouseInput.h +++ b/Minecraft.Client/KeyboardMouseInput.h @@ -66,6 +66,9 @@ public: bool HasAnyInput() const { return m_hasInput; } + void SetKBMActive(bool active) { m_kbmActive = active; } + bool IsKBMActive() const { return m_kbmActive; } + float GetMoveX() const; float GetMoveY() const; @@ -107,6 +110,8 @@ private: bool m_windowFocused; bool m_hasInput; + + bool m_kbmActive; }; extern KeyboardMouseInput g_KBMInput; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 3494d2a..fe3b1b2 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1457,7 +1457,7 @@ void Minecraft::run_middle() { if(InputManager.ButtonDown(i, MINECRAFT_ACTION_SNEAK_TOGGLE)) localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL< 0) + localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<inventory) + localplayers[i]->inventory->selected = slot; + } + } + } + + // Utility keys always work regardless of KBM active state if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE)) { localplayers[i]->ullButtonsPressed|=1LL< 0) - localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<inventory) - localplayers[i]->inventory->selected = slot; - } - } } #endif @@ -3267,7 +3271,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) wheel = -1; } #ifdef _WINDOWS64 - if (iPad == 0 && wheel == 0) + if (iPad == 0 && wheel == 0 && g_KBMInput.IsKBMActive()) { int mw = g_KBMInput.GetMouseWheel(); if (mw > 0) wheel = -1; @@ -3297,7 +3301,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef _WINDOWS64 // allows for the player to get the block they are looking at in creative by middle clicking. - if (iPad == 0 && player->abilities.instabuild && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE) && hitResult != NULL && (hitResult->type == HitResult::TILE || hitResult->type == HitResult::ENTITY)) + if (iPad == 0 && g_KBMInput.IsKBMActive() && player->abilities.instabuild && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE) && hitResult != NULL && (hitResult->type == HitResult::TILE || hitResult->type == HitResult::ENTITY)) { //printf("MIDDLE CLICK TEST!!"); // windermed was here. int cloneId = -1; @@ -3390,7 +3394,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef _WINDOWS64 - bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT)); + bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT)); #else bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION); #endif @@ -3421,7 +3425,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } */ #ifdef _WINDOWS64 - bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE) || (iPad == 0 && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)); + bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)); #else bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE); #endif diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index f3bc185..3315784 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1185,6 +1185,25 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, PIXBeginNamedEvent(0,"Input manager tick"); InputManager.Tick(); + // detect input mode + if (InputManager.IsPadConnected(0)) + { + bool controllerUsed = InputManager.ButtonPressed(0) || + InputManager.GetJoypadStick_LX(0, false) != 0.0f || + InputManager.GetJoypadStick_LY(0, false) != 0.0f || + InputManager.GetJoypadStick_RX(0, false) != 0.0f || + InputManager.GetJoypadStick_RY(0, false) != 0.0f; + + if (controllerUsed) + g_KBMInput.SetKBMActive(false); + else if (g_KBMInput.HasAnyInput()) + g_KBMInput.SetKBMActive(true); + } + else + { + g_KBMInput.SetKBMActive(true); + } + PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Profile manager tick"); // ProfileManager.Tick(); From f83a6ab2e519d4cdcb7885844cc2807b238f579a Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 00:08:42 -0300 Subject: [PATCH 09/16] fix: proper kbm and controller input --- .../Common/UI/IUIScene_AbstractContainerMenu.cpp | 4 ++-- Minecraft.Client/Common/UI/UIController.cpp | 2 +- .../Common/UI/UIScene_AbstractContainerMenu.cpp | 2 ++ Minecraft.Client/KeyboardMouseInput.cpp | 1 + Minecraft.Client/KeyboardMouseInput.h | 5 +++++ Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 8 ++++++++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index dac2f6e..1b4f37e 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -471,7 +471,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() #endif #ifdef _WINDOWS64 - if (!g_KBMInput.IsMouseGrabbed()) + if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { int deltaX = g_KBMInput.GetMouseDeltaX(); int deltaY = g_KBMInput.GetMouseDeltaY(); @@ -716,7 +716,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // If there is no stick input, and we are over a slot, then snap pointer to slot centre. // 4J - TomK - only if this particular component allows so! #ifdef _WINDOWS64 - if(g_KBMInput.IsMouseGrabbed() && CanHaveFocus(eSectionUnderPointer)) + if((g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) && CanHaveFocus(eSectionUnderPointer)) #else if(CanHaveFocus(eSectionUnderPointer)) #endif diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 988f085..8e6897b 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -691,7 +691,7 @@ void UIController::tickInput() #endif { #ifdef _WINDOWS64 - if (!g_KBMInput.IsMouseGrabbed()) + if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { UIScene *pScene = NULL; for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 704d736..a1b144b 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -45,6 +45,7 @@ void UIScene_AbstractContainerMenu::handleDestroy() g_savedInventoryCursorPos.y = m_pointerPos.y; g_savedInventoryCursorPos.hasSavedPos = true; + g_KBMInput.SetScreenCursorHidden(false); g_KBMInput.SetCursorHiddenForUI(false); #endif @@ -82,6 +83,7 @@ void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractConta void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) { #ifdef _WINDOWS64 + g_KBMInput.SetScreenCursorHidden(true); g_KBMInput.SetCursorHiddenForUI(true); #endif diff --git a/Minecraft.Client/KeyboardMouseInput.cpp b/Minecraft.Client/KeyboardMouseInput.cpp index 63a1dae..8308e9b 100644 --- a/Minecraft.Client/KeyboardMouseInput.cpp +++ b/Minecraft.Client/KeyboardMouseInput.cpp @@ -37,6 +37,7 @@ void KeyboardMouseInput::Init() m_windowFocused = true; m_hasInput = false; m_kbmActive = true; + m_screenWantsCursorHidden = false; RAWINPUTDEVICE rid; rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC diff --git a/Minecraft.Client/KeyboardMouseInput.h b/Minecraft.Client/KeyboardMouseInput.h index d5a4c3b..10aa709 100644 --- a/Minecraft.Client/KeyboardMouseInput.h +++ b/Minecraft.Client/KeyboardMouseInput.h @@ -69,6 +69,9 @@ public: void SetKBMActive(bool active) { m_kbmActive = active; } bool IsKBMActive() const { return m_kbmActive; } + void SetScreenCursorHidden(bool hidden) { m_screenWantsCursorHidden = hidden; } + bool IsScreenCursorHidden() const { return m_screenWantsCursorHidden; } + float GetMoveX() const; float GetMoveY() const; @@ -112,6 +115,8 @@ private: bool m_hasInput; bool m_kbmActive; + + bool m_screenWantsCursorHidden; }; extern KeyboardMouseInput g_KBMInput; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 3315784..bef05fe 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1204,6 +1204,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, g_KBMInput.SetKBMActive(true); } + if (!g_KBMInput.IsMouseGrabbed()) + { + if (!g_KBMInput.IsKBMActive()) + g_KBMInput.SetCursorHiddenForUI(true); + else if (!g_KBMInput.IsScreenCursorHidden()) + g_KBMInput.SetCursorHiddenForUI(false); + } + PIXEndNamedEvent(); PIXBeginNamedEvent(0,"Profile manager tick"); // ProfileManager.Tick(); From db79e7d54cd2cc151e9789eb2b35b28007e3bf83 Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 00:38:11 -0300 Subject: [PATCH 10/16] Update README with credit requirement for code usage --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a06ad1f..f42390b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Minecraft LCEMP LCEMP is my Minecraft Legacy Console Edition source fork that enables LAN multiplayer hosting along side more complete pc compatibility. +If you use my multiplayer code or other fixes from this repo in other LCE-based projects, credit me (and the project) and link the repo + ## notes: - This is NOT the full source code. - You need to provide the required asset files yourself. From 14537283de09e4128cd7232dde53a58a8569e86d Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 04:13:37 -0300 Subject: [PATCH 11/16] misc: add comment --- Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 7e7c6ae..8dd814a 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -1,3 +1,5 @@ +// Code implemented by LCEMP, credit if used on other repos + #include "stdafx.h" #ifdef _WINDOWS64 From 9df1a077d5ce38566da2a7e4873525020a6be8f0 Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 13:08:34 -0300 Subject: [PATCH 12/16] update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 916b70b..b49bd9b 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ Minecraft.Client/music/ # Common Media - UI (SWF), Graphics (PNG), Sound (WAV), Fonts Assets Assets/Common/Media/ +Minecraft.Client/Common/Media/ # Game resource textures, art, audio, etc. Minecraft.Client/Common/res/ Minecraft.Client/Common/DummyTexturePack/ @@ -83,6 +84,7 @@ Minecraft.Client/Windows64/GameHDD/ # Thumbnail / test images *.png # But allow source code PNG references to be noted +!Minecraft.Client/Common/Media/Graphics/.gitkeep !Assets/Common/Media/Graphics/.gitkeep # SWF UI files (Flash-based UI assets) From ea2503637539dac6f5064d83fc5aa7f83e73f66f Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 13:13:58 -0300 Subject: [PATCH 13/16] fix: vs2012 building --- Minecraft.World/Hasher.cpp | 4 ++++ Minecraft.World/Player.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Minecraft.World/Hasher.cpp b/Minecraft.World/Hasher.cpp index 45c933f..a058030 100644 --- a/Minecraft.World/Hasher.cpp +++ b/Minecraft.World/Hasher.cpp @@ -20,7 +20,11 @@ wstring Hasher::getHash(wstring &name) //return new BigInteger(1, m.digest()).toString(16); // TODO 4J Stu - Will this hash us with the same distribution as the MD5? +#if _MSC_VER >= 1900 return _toString( std::hash{}( s ) ); +#else + return _toString( stdext::hash_value( s ) ); +#endif //} //catch (NoSuchAlgorithmException e) //{ diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index d4832e4..7bf7714 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -2560,9 +2560,11 @@ int Player::hash_fnct(const shared_ptr k) // TODO 4J Stu - Should we just be using the pointers and hashing them? #ifdef __PS3__ return (int)boost::hash_value( k->name ); // 4J Stu - Names are completely unique? -#else +#elif _MSC_VER >= 1900 return (int)std::hash{}( k->name ); // 4J Stu - Names are completely unique? -#endif //__PS3__ +#else + return (int)stdext::hash_value( k->name ); // 4J Stu - Names are completely unique? +#endif } bool Player::eq_test(const shared_ptr x, const shared_ptr y) From bd535e5b4918620d08c00d86bafdffc338cffbf6 Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 13:31:01 -0300 Subject: [PATCH 14/16] fix: proper/somewhat decent gamma and rendering fixes --- Minecraft.Client/Minecraft.Client.vcxproj | 82 +++++- .../Windows64/Windows64_Minecraft.cpp | 56 ++-- .../Windows64/Windows64_PostProcess.cpp | 251 ++++++++++++++++++ .../Windows64/Windows64_PostProcess.h | 8 + 4 files changed, 355 insertions(+), 42 deletions(-) create mode 100644 Minecraft.Client/Windows64/Windows64_PostProcess.cpp create mode 100644 Minecraft.Client/Windows64/Windows64_PostProcess.h diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 078a606..18154a8 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1293,7 +1293,7 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata" true $(OutDir)$(ProjectName).pdb - d3d11.lib;..\Minecraft.World\x64_Debug\Minecraft.World.lib;%(AdditionalDependencies);XInput9_1_0.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib + d3d11.lib;d3dcompiler.lib;..\Minecraft.World\x64_Debug\Minecraft.World.lib;%(AdditionalDependencies);XInput9_1_0.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib NotSet false @@ -1432,7 +1432,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU true $(OutDir)$(ProjectName).pdb - d3d11.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib;%(AdditionalDependencies) + d3d11.lib;d3dcompiler.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib;%(AdditionalDependencies) NotSet false @@ -1484,7 +1484,7 @@ copy /Y "$(ProjectDir)Durango\Sound\Minecraft.msscmp" "$(OutDir)Durango\Sound\"< true $(OutDir)$(ProjectName).pdb - d3d11.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;%(AdditionalDependencies) + d3d11.lib;d3dcompiler.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;%(AdditionalDependencies) NotSet false @@ -16657,6 +16657,37 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + false + false + false + true + true + true + true + true + true + true + true true @@ -29116,6 +29147,51 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + false + false + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true true diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 1e52a16..f17d698 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -37,8 +37,11 @@ #include "Resource.h" #include "..\..\Minecraft.World\compression.h" #include "..\..\Minecraft.World\OldChunkStorage.h" + #include "Network\WinsockNetLayer.h" +#include "Windows64_PostProcess.h" + #include "Xbox/resource.h" HINSTANCE hMyInst; @@ -343,54 +346,23 @@ ID3D11Device* g_pd3dDevice = NULL; ID3D11DeviceContext* g_pImmediateContext = NULL; IDXGISwapChain* g_pSwapChain = NULL; -static WORD g_originalGammaRamp[3][256]; -static bool g_gammaRampSaved = false; +ID3D11RenderTargetView* g_pRenderTargetView = NULL; +ID3D11DepthStencilView* g_pDepthStencilView = NULL; +ID3D11Texture2D* g_pDepthStencilBuffer = NULL; void Windows64_UpdateGamma(unsigned short usGamma) { - if (!g_hWnd) return; - - HDC hdc = GetDC(g_hWnd); - if (!hdc) return; - - if (!g_gammaRampSaved) - { - GetDeviceGammaRamp(hdc, g_originalGammaRamp); - g_gammaRampSaved = true; - } - float gamma = (float)usGamma / 32768.0f; - if (gamma < 0.01f) gamma = 0.01f; + if (gamma < 0.0f) gamma = 0.0f; if (gamma > 1.0f) gamma = 1.0f; - float invGamma = 1.0f / (0.5f + gamma * 0.5f); - - WORD ramp[3][256]; - for (int i = 0; i < 256; i++) - { - float normalized = (float)i / 255.0f; - float corrected = powf(normalized, invGamma); - WORD val = (WORD)(corrected * 65535.0f + 0.5f); - ramp[0][i] = val; - ramp[1][i] = val; - ramp[2][i] = val; - } - - SetDeviceGammaRamp(hdc, ramp); - ReleaseDC(g_hWnd, hdc); + SetGammaValue(0.5f * powf(4.0f, gamma)); } void Windows64_RestoreGamma() { - if (!g_gammaRampSaved || !g_hWnd) return; - HDC hdc = GetDC(g_hWnd); - if (!hdc) return; - SetDeviceGammaRamp(hdc, g_originalGammaRamp); - ReleaseDC(g_hWnd, hdc); + } -ID3D11RenderTargetView* g_pRenderTargetView = NULL; -ID3D11DepthStencilView* g_pDepthStencilView = NULL; -ID3D11Texture2D* g_pDepthStencilBuffer = NULL; // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) @@ -712,6 +684,7 @@ app.DebugPrintf("width: %d, height: %d\n", width, height); // Create a depth stencil buffer D3D11_TEXTURE2D_DESC descDepth; + ZeroMemory(&descDepth, sizeof(descDepth)); descDepth.Width = width; descDepth.Height = height; @@ -727,11 +700,10 @@ app.DebugPrintf("width: %d, height: %d\n", width, height); hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; + ZeroMemory(&descDSView, sizeof(descDSView)); descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; descDSView.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; descDSView.Texture2D.MipSlice = 0; - // when would this ever be a non-garbage value? - descDSView.Flags = 0; hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); @@ -777,6 +749,8 @@ void CleanupDevice() extern void Windows64_RestoreGamma(); Windows64_RestoreGamma(); + CleanupGammaPostProcess(); + if( g_pImmediateContext ) g_pImmediateContext->ClearState(); if( g_pRenderTargetView ) g_pRenderTargetView->Release(); @@ -861,6 +835,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, return 0; } + InitGammaPostProcess(); + #if 0 // Main message loop MSG msg = {0}; @@ -1337,6 +1313,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, RenderManager.Set_matrixDirty(); #endif + ApplyGammaPostProcess(); + // Present the frame. RenderManager.Present(); diff --git a/Minecraft.Client/Windows64/Windows64_PostProcess.cpp b/Minecraft.Client/Windows64/Windows64_PostProcess.cpp new file mode 100644 index 0000000..1d06ec8 --- /dev/null +++ b/Minecraft.Client/Windows64/Windows64_PostProcess.cpp @@ -0,0 +1,251 @@ +#include "stdafx.h" +#include "Windows64_PostProcess.h" +#include +#pragma comment(lib, "d3dcompiler.lib") + +extern ID3D11Device* g_pd3dDevice; +extern ID3D11DeviceContext* g_pImmediateContext; +extern IDXGISwapChain* g_pSwapChain; +extern ID3D11RenderTargetView* g_pRenderTargetView; + +static ID3D11Texture2D* g_pGammaOffscreenTex = NULL; +static ID3D11ShaderResourceView* g_pGammaOffscreenSRV = NULL; +static ID3D11RenderTargetView* g_pGammaOffscreenRTV = NULL; +static ID3D11VertexShader* g_pGammaVS = NULL; +static ID3D11PixelShader* g_pGammaPS = NULL; +static ID3D11Buffer* g_pGammaCB = NULL; +static ID3D11SamplerState* g_pGammaSampler = NULL; +static ID3D11RasterizerState* g_pGammaRastState = NULL; +static ID3D11DepthStencilState* g_pGammaDepthState = NULL; +static ID3D11BlendState* g_pGammaBlendState = NULL; +static bool g_gammaPostProcessReady = false; +static float g_gammaValue = 1.0f; + +struct GammaCBData +{ + float gamma; + float pad[3]; +}; + +static const char* g_gammaVSCode = + "void main(uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD0)\n" + "{\n" + " uv = float2((id << 1) & 2, id & 2);\n" + " pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);\n" + "}\n"; + +static const char* g_gammaPSCode = + "cbuffer GammaCB : register(b0)\n" + "{\n" + " float gamma;\n" + " float3 pad;\n" + "};\n" + "Texture2D sceneTex : register(t0);\n" + "SamplerState sceneSampler : register(s0);\n" + "float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target\n" + "{\n" + " float4 color = sceneTex.Sample(sceneSampler, uv);\n" + " color.rgb = pow(max(color.rgb, 0.0), 1.0 / gamma);\n" + " return color;\n" + "}\n"; + + +void SetGammaValue(float gamma) +{ + g_gammaValue = gamma; +} + +bool InitGammaPostProcess() +{ + if (!g_pd3dDevice || !g_pSwapChain) return false; + + HRESULT hr; + + ID3D11Texture2D* pBackBuffer = NULL; + hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); + if (FAILED(hr)) return false; + + D3D11_TEXTURE2D_DESC bbDesc; + pBackBuffer->GetDesc(&bbDesc); + pBackBuffer->Release(); + + D3D11_TEXTURE2D_DESC texDesc; + ZeroMemory(&texDesc, sizeof(texDesc)); + texDesc.Width = bbDesc.Width; + texDesc.Height = bbDesc.Height; + texDesc.MipLevels = 1; + texDesc.ArraySize = 1; + texDesc.Format = bbDesc.Format; + texDesc.SampleDesc.Count = 1; + texDesc.SampleDesc.Quality = 0; + texDesc.Usage = D3D11_USAGE_DEFAULT; + texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; + hr = g_pd3dDevice->CreateTexture2D(&texDesc, NULL, &g_pGammaOffscreenTex); + if (FAILED(hr)) return false; + + hr = g_pd3dDevice->CreateShaderResourceView(g_pGammaOffscreenTex, NULL, &g_pGammaOffscreenSRV); + if (FAILED(hr)) return false; + + hr = g_pd3dDevice->CreateRenderTargetView(g_pGammaOffscreenTex, NULL, &g_pGammaOffscreenRTV); + if (FAILED(hr)) return false; + + ID3DBlob* vsBlob = NULL; + ID3DBlob* errBlob = NULL; + hr = D3DCompile(g_gammaVSCode, strlen(g_gammaVSCode), "GammaVS", NULL, NULL, "main", "vs_4_0", 0, 0, &vsBlob, &errBlob); + if (FAILED(hr)) + { + if (errBlob) errBlob->Release(); + return false; + } + hr = g_pd3dDevice->CreateVertexShader(vsBlob->GetBufferPointer(), vsBlob->GetBufferSize(), NULL, &g_pGammaVS); + vsBlob->Release(); + if (errBlob) errBlob->Release(); + if (FAILED(hr)) return false; + + errBlob = NULL; + ID3DBlob* psBlob = NULL; + hr = D3DCompile(g_gammaPSCode, strlen(g_gammaPSCode), "GammaPS", NULL, NULL, "main", "ps_4_0", 0, 0, &psBlob, &errBlob); + if (FAILED(hr)) + { + if (errBlob) errBlob->Release(); + return false; + } + hr = g_pd3dDevice->CreatePixelShader(psBlob->GetBufferPointer(), psBlob->GetBufferSize(), NULL, &g_pGammaPS); + psBlob->Release(); + if (errBlob) errBlob->Release(); + if (FAILED(hr)) return false; + + D3D11_BUFFER_DESC cbDesc; + ZeroMemory(&cbDesc, sizeof(cbDesc)); + cbDesc.ByteWidth = sizeof(GammaCBData); + cbDesc.Usage = D3D11_USAGE_DYNAMIC; + cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + GammaCBData initData = { 1.0f, {0, 0, 0} }; + D3D11_SUBRESOURCE_DATA srData; + srData.pSysMem = &initData; + srData.SysMemPitch = 0; + srData.SysMemSlicePitch = 0; + hr = g_pd3dDevice->CreateBuffer(&cbDesc, &srData, &g_pGammaCB); + if (FAILED(hr)) return false; + + D3D11_SAMPLER_DESC sampDesc; + ZeroMemory(&sampDesc, sizeof(sampDesc)); + sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; + sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + hr = g_pd3dDevice->CreateSamplerState(&sampDesc, &g_pGammaSampler); + if (FAILED(hr)) return false; + + D3D11_RASTERIZER_DESC rasDesc; + ZeroMemory(&rasDesc, sizeof(rasDesc)); + rasDesc.FillMode = D3D11_FILL_SOLID; + rasDesc.CullMode = D3D11_CULL_NONE; + rasDesc.DepthClipEnable = FALSE; + hr = g_pd3dDevice->CreateRasterizerState(&rasDesc, &g_pGammaRastState); + if (FAILED(hr)) return false; + + // Depth stencil state (disabled) + D3D11_DEPTH_STENCIL_DESC dsDesc; + ZeroMemory(&dsDesc, sizeof(dsDesc)); + dsDesc.DepthEnable = FALSE; + dsDesc.StencilEnable = FALSE; + hr = g_pd3dDevice->CreateDepthStencilState(&dsDesc, &g_pGammaDepthState); + if (FAILED(hr)) return false; + + D3D11_BLEND_DESC blendDesc; + ZeroMemory(&blendDesc, sizeof(blendDesc)); + blendDesc.RenderTarget[0].BlendEnable = FALSE; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + hr = g_pd3dDevice->CreateBlendState(&blendDesc, &g_pGammaBlendState); + if (FAILED(hr)) return false; + + g_gammaPostProcessReady = true; + return true; +} + +void ApplyGammaPostProcess() +{ + if (!g_gammaPostProcessReady) return; + + if (g_gammaValue > 0.99f && g_gammaValue < 1.01f) return; + + ID3D11DeviceContext* ctx = g_pImmediateContext; + + ID3D11Texture2D* pBackBuffer = NULL; + HRESULT hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); + if (FAILED(hr)) return; + ctx->CopyResource(g_pGammaOffscreenTex, pBackBuffer); + + D3D11_MAPPED_SUBRESOURCE mapped; + hr = ctx->Map(g_pGammaCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped); + if (SUCCEEDED(hr)) + { + GammaCBData* cb = (GammaCBData*)mapped.pData; + cb->gamma = g_gammaValue; + ctx->Unmap(g_pGammaCB, 0); + } + + ID3D11RenderTargetView* oldRTV = NULL; + ID3D11DepthStencilView* oldDSV = NULL; + ctx->OMGetRenderTargets(1, &oldRTV, &oldDSV); + + UINT numViewports = 1; + D3D11_VIEWPORT oldViewport; + ctx->RSGetViewports(&numViewports, &oldViewport); + + ID3D11RenderTargetView* bbRTV = g_pRenderTargetView; + ctx->OMSetRenderTargets(1, &bbRTV, NULL); + + // Set viewport to full screen + D3D11_TEXTURE2D_DESC bbDesc; + pBackBuffer->GetDesc(&bbDesc); + pBackBuffer->Release(); + + D3D11_VIEWPORT vp; + vp.Width = (FLOAT)bbDesc.Width; + vp.Height = (FLOAT)bbDesc.Height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + vp.TopLeftX = 0; + vp.TopLeftY = 0; + ctx->RSSetViewports(1, &vp); + + ctx->IASetInputLayout(NULL); + ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ctx->VSSetShader(g_pGammaVS, NULL, 0); + ctx->PSSetShader(g_pGammaPS, NULL, 0); + ctx->PSSetShaderResources(0, 1, &g_pGammaOffscreenSRV); + ctx->PSSetSamplers(0, 1, &g_pGammaSampler); + ctx->PSSetConstantBuffers(0, 1, &g_pGammaCB); + ctx->RSSetState(g_pGammaRastState); + ctx->OMSetDepthStencilState(g_pGammaDepthState, 0); + float blendFactor[4] = { 0, 0, 0, 0 }; + ctx->OMSetBlendState(g_pGammaBlendState, blendFactor, 0xFFFFFFFF); + + ctx->Draw(3, 0); + + ID3D11ShaderResourceView* nullSRV = NULL; + ctx->PSSetShaderResources(0, 1, &nullSRV); + + ctx->OMSetRenderTargets(1, &oldRTV, oldDSV); + ctx->RSSetViewports(1, &oldViewport); + if (oldRTV) oldRTV->Release(); + if (oldDSV) oldDSV->Release(); +} + +void CleanupGammaPostProcess() +{ + if (g_pGammaBlendState) { g_pGammaBlendState->Release(); g_pGammaBlendState = NULL; } + if (g_pGammaDepthState) { g_pGammaDepthState->Release(); g_pGammaDepthState = NULL; } + if (g_pGammaRastState) { g_pGammaRastState->Release(); g_pGammaRastState = NULL; } + if (g_pGammaSampler) { g_pGammaSampler->Release(); g_pGammaSampler = NULL; } + if (g_pGammaCB) { g_pGammaCB->Release(); g_pGammaCB = NULL; } + if (g_pGammaPS) { g_pGammaPS->Release(); g_pGammaPS = NULL; } + if (g_pGammaVS) { g_pGammaVS->Release(); g_pGammaVS = NULL; } + if (g_pGammaOffscreenRTV) { g_pGammaOffscreenRTV->Release(); g_pGammaOffscreenRTV = NULL; } + if (g_pGammaOffscreenSRV) { g_pGammaOffscreenSRV->Release(); g_pGammaOffscreenSRV = NULL; } + if (g_pGammaOffscreenTex) { g_pGammaOffscreenTex->Release(); g_pGammaOffscreenTex = NULL; } + g_gammaPostProcessReady = false; +} diff --git a/Minecraft.Client/Windows64/Windows64_PostProcess.h b/Minecraft.Client/Windows64/Windows64_PostProcess.h new file mode 100644 index 0000000..27d209c --- /dev/null +++ b/Minecraft.Client/Windows64/Windows64_PostProcess.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +bool InitGammaPostProcess(); +void ApplyGammaPostProcess(); +void CleanupGammaPostProcess(); +void SetGammaValue(float gamma); From fe804d3bec4b296d4beebe5ce16f3697d8dac606 Mon Sep 17 00:00:00 2001 From: AlienDenis12 <87435855+AlienDenis12@users.noreply.github.com> Date: Tue, 3 Mar 2026 22:13:33 +0100 Subject: [PATCH 15/16] Fix inverted pitch in ThirdPersonView 2 (Front View) --- Minecraft.Client/GameRenderer.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index 508b3a1..70d2ff4 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -552,6 +552,10 @@ void GameRenderer::moveCameraToPlayer(float a) double zd = Mth::cos(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI) * cameraDist; double yd = -Mth::sin(xRot / 180 * PI) * cameraDist; + // Invert Y offset if in third-person front view (camera faces player) + if (localplayer->ThirdPersonView() == 2) + yd = Mth::sin(xRot / 180 * PI) * cameraDist; + for (int i = 0; i < 8; i++) { float xo = (float)((i & 1) * 2 - 1); @@ -588,7 +592,18 @@ void GameRenderer::moveCameraToPlayer(float a) if (!mc->options->fixedCamera) { - glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0); + //glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0); + + float pitch = player->xRotO + (player->xRot - player->xRotO) * a; + + // Invert pitch if in third-person front view (camera faces player) + if(localplayer->ThirdPersonView() == 2) + { + pitch = -pitch; + } + + glRotatef(pitch, 1, 0, 0); + if( localplayer->ThirdPersonView() == 2 ) { // Third person view is now 0 for disabled, 1 for original, 2 for flipped From f30619d597a58fbfbffc367c13770df19f34da0d Mon Sep 17 00:00:00 2001 From: NOTPIES Date: Tue, 3 Mar 2026 20:04:29 -0300 Subject: [PATCH 16/16] add choicetask input support for kbm --- .../Common/Tutorial/ChoiceTask.cpp | 31 +++++++++++++++++-- .../Common/Tutorial/ControllerTask.cpp | 12 +++++++ Minecraft.Client/Common/Tutorial/InfoTask.cpp | 20 +++++++++++- Minecraft.Client/KeyboardMouseInput.h | 2 ++ Minecraft.Client/Minecraft.cpp | 2 +- 5 files changed, 63 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index c03166b..e4747bd 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -8,6 +8,20 @@ #include "ChoiceTask.h" #include "..\..\..\Minecraft.World\Material.h" +#ifdef _WINDOWS64 +#include "..\..\KeyboardMouseInput.h" + +static int ActionToVK(int action) +{ + switch (action) + { + case ACTION_MENU_A: return KeyboardMouseInput::KEY_CONFIRM; + case ACTION_MENU_B: return KeyboardMouseInput::KEY_CANCEL; + default: return 0; + } +} +#endif + ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) @@ -51,11 +65,24 @@ bool ChoiceTask::isCompleted() // If the player is under water then allow all keypresses so they can jump out if( pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water) ) return false; - if(!m_bConfirmMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iConfirmMapping) > 0 ) + int xboxPad = pMinecraft->player->GetXboxPad(); +#ifdef _WINDOWS64 + if(!m_bConfirmMappingComplete && + (InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0 + || g_KBMInput.IsKeyDown(ActionToVK(m_iConfirmMapping)))) +#else + if(!m_bConfirmMappingComplete && InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0 ) +#endif { m_bConfirmMappingComplete = true; } - if(!m_bCancelMappingComplete && InputManager.GetValue(pMinecraft->player->GetXboxPad(), m_iCancelMapping) > 0 ) +#ifdef _WINDOWS64 + if(!m_bCancelMappingComplete && + (InputManager.GetValue(xboxPad, m_iCancelMapping) > 0 + || g_KBMInput.IsKeyDown(ActionToVK(m_iCancelMapping)))) +#else + if(!m_bCancelMappingComplete && InputManager.GetValue(xboxPad, m_iCancelMapping) > 0 ) +#endif { m_bCancelMappingComplete = true; } diff --git a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp index c5fe071..d518736 100644 --- a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp @@ -7,6 +7,10 @@ #include "TutorialConstraints.h" #include "ControllerTask.h" +#ifdef _WINDOWS64 +#include "..\..\KeyboardMouseInput.h" +#endif + ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime, int mappings[], unsigned int mappingsLength, int iCompletionMaskA[], int iCompletionMaskACount, int iSouthpawMappings[], unsigned int uiSouthpawMappingsCount) : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL, showMinimumTime ) @@ -66,7 +70,11 @@ bool ControllerTask::isCompleted() } else { +#ifdef _WINDOWS64 + bAllComplete = true; +#else bAllComplete = false; +#endif } } iCurrent++; @@ -87,7 +95,11 @@ bool ControllerTask::isCompleted() } else { +#ifdef _WINDOWS64 + bAllComplete = true; +#else bAllComplete = false; +#endif } } iCurrent++; diff --git a/Minecraft.Client/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Common/Tutorial/InfoTask.cpp index 5330841..874a9b0 100644 --- a/Minecraft.Client/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Common/Tutorial/InfoTask.cpp @@ -8,6 +8,20 @@ #include "InfoTask.h" #include "..\..\..\Minecraft.World\Material.h" +#ifdef _WINDOWS64 +#include "..\..\KeyboardMouseInput.h" + +static int ActionToVK(int action) +{ + switch (action) + { + case ACTION_MENU_A: return KeyboardMouseInput::KEY_CONFIRM; + case ACTION_MENU_B: return KeyboardMouseInput::KEY_CANCEL; + default: return 0; + } +} +#endif + InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) @@ -65,12 +79,16 @@ bool InfoTask::isCompleted() bool current = (*it).second; if(!current) { +#ifdef _WINDOWS64 + if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 || g_KBMInput.IsKeyDown(ActionToVK((*it).first)) ) +#else if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 ) +#endif { (*it).second = true; bAllComplete=true; } - else + if (!(*it).second) { bAllComplete = false; } diff --git a/Minecraft.Client/KeyboardMouseInput.h b/Minecraft.Client/KeyboardMouseInput.h index 10aa709..d1e1613 100644 --- a/Minecraft.Client/KeyboardMouseInput.h +++ b/Minecraft.Client/KeyboardMouseInput.h @@ -23,6 +23,8 @@ public: static const int KEY_DROP = 'Q'; static const int KEY_CRAFTING = VK_TAB; static const int KEY_CRAFTING_ALT = 'R'; + static const int KEY_CONFIRM = VK_RETURN; + static const int KEY_CANCEL = VK_ESCAPE; static const int KEY_PAUSE = VK_ESCAPE; static const int KEY_THIRD_PERSON = VK_F5; static const int KEY_DEBUG_INFO = VK_F3; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index fe3b1b2..fce577f 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1504,7 +1504,7 @@ void Minecraft::run_middle() } // Utility keys always work regardless of KBM active state - if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE)) + if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_PAUSE) && !ui.IsTutorialVisible(i)) { localplayers[i]->ullButtonsPressed|=1LL<