Merged
Conversation
- Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
…ker101/MinecraftConsoles into feat/project-modernization
Contributor
Author
2026-03-07.23-42-01.mp4 |
Collaborator
|
Tests okay for me (multiplayer, world gen, etc), merging! |
piebotc
pushed a commit
to piebotc/LegacyEvolved
that referenced
this pull request
Mar 9, 2026
* Fixed boats falling and a TP glitch smartcmd#266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch smartcmd#266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR
MrTheShy
added a commit
to MrTheShy/MinecraftConsoles
that referenced
this pull request
Mar 9, 2026
…ain compile error Merges 19 commits from smartcmd/MinecraftConsoles (upstream/main) into the dedicated-server branch and resolves the resulting networking conflicts while preserving all dedicated-server-specific behaviour. --- Upstream commits included in this merge: - Port over RCE Patches from LCEMP (smartcmd#1023) Hardened packet parsing across ByteArrayInputStream/OutputStream, Tag, Socket, Connection, and a dozen packet types; bounds-checked reads, length limits, and safe decompression paths to close known RCE vectors. - Revert accidentally pushed "LCEMP RCE fixes" / LCEMP RCE fixes Intermediate clean-up of the above work. - Reject duplicate UIDs on login and remove noisy gdraw debug log (smartcmd#1013) Incoming players whose UID is already active are now disconnected instead of force-kicking the existing player. Removes a per-frame debug printf left in gdraw_SetViewSizeAndWorldScale. - Always show version overlay, add more info Version string is now always visible at runtime. - Fix split-screen UI wrong positioning on window resize (smartcmd#989) - Reimplement boat gravity again (smartcmd#988) - Use correctly sized icons on 720p (smartcmd#883) - Revert workaround for loading HD textures (smartcmd#999) - Fix crash when launching at 720p or lower resolutions (smartcmd#981) - Modernize project codebase (smartcmd#906): NULL → nullptr, C-style cast → C++ cast, shared_ptr(new …) → make_shared, misc type fixes. - Split screen, widescreen support, font rendering and UI scaling fixes (smartcmd#767) - Flame not working with one-shot arrow (smartcmd#856) - Fix focus sound playing repeatedly on mouse hover (smartcmd#890) - Fix stale held item appearing when switching worlds (smartcmd#910) - Fix F3 debug crash when throwing ender pearl long distance (smartcmd#934) - Allow closing some menus with inventory/crafting keys (smartcmd#868) - Fix second-person nametag pitch (smartcmd#963) --- Conflict resolutions (4 files): Minecraft.Client/Common/Network/GameNetworkManager.cpp Conflict 1 — variable declarations in StartNetworkGame: Kept HEAD. The dedicated-server branch declares `dedicatedNoLocalHostPlayer` here and reads it from NetworkGameInitData. Upstream had dropped that variable while modernising the NULL → nullptr style; keeping it is required for the dedicated-server startup path. Conflict 2 — primary-player connection block: Kept HEAD. When `dedicatedNoLocalHostPlayer` is true the branch intentionally skips creating a local-host ClientConnection and goes straight to setting the game mode. Upstream's refactor created a ClientConnection with a null socket even for the dedicated path and ran the full tick loop; that approach is incompatible with headless operation. Minecraft.Client/PendingConnection.cpp Kept HEAD. The branch wraps the duplicate-XUID rejection path with a #if MINECRAFT_SERVER_BUILD guard that calls ServerLogManager::OnRejectedPlayerLogin. Upstream's version removed that call and rewrote only the comment. Preserving the guard keeps the server-build audit log intact. Minecraft.Client/ServerConnection.cpp Kept HEAD comment. Both sides changed only a single-line comment above the playerSnapshot vector. HEAD's comment ("Disconnect through PlayerConnection so clients receive a proper DisconnectPacket before socket close") describes the functional intent; it was kept as the more meaningful description for this branch. Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp Conflicts 1 & 2 — shutdown thread teardown: Hybrid: adopted upstream's nullptr style (consistent with the rest of the file after the modernisation PR) while keeping HEAD's more precise comment ("Ensure all host-side receive threads have exited before destroying locks"). Conflict 3 — AcceptThreadProc accept() call: Kept HEAD. HEAD passes sockaddr_in remoteAddress to accept() so that TryGetNumericRemoteIp can extract the client IP for connection logging and the IP-ban check (ServerRuntime::Access::IsIpBanned). Upstream had simplified the call to accept(…, nullptr, nullptr), which would have silently broken IP-based access control in the server build. --- fix: declare extern ConsoleUIController ui in ServerMain.cpp Windows64_UIController.h (included by ServerMain.cpp) defines the class but does not forward-declare the global `ui` instance. The `extern ConsoleUIController ui` declaration lives only in Common/UI/UI.h, which is not in ServerMain.cpp's include chain. The object is defined in Windows64_UIController.cpp, which IS compiled as part of Minecraft.Server.vcxproj, so the linker already sees it; the missing declaration caused a C2065 compile error only in the server translation unit. Added the extern declaration alongside the other extern globals at the top of ServerMain.cpp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds checks to prevent
std::vectorout of range access and null pointer dereferences that causes runtime assertions which caused a crash in my last PR.Changes
Previous Behavior
Some rendering and UI code assumed pointers and vectors indices were always valid. In certain cases this cause the MSVC crash/assertion 'vector subscript out of range`.
Root Cause
size_tcould underflow when decrementing past 0.New Behavior
The code now validates indices and pointers before use, preventing invalid vector access and null dereferences.
Fix Implementation
size_Twithintto avoid unsinged underflow.AI Use Disclosure
No.
Related Issues/PR
@codeHusky Sorry about not testing it totally cross my mind while I was doing it, because I was just confident in my code which was a rookie mistake. But I tested this one and it was working just fine so if you could review this one.