Commit graph

34 commits

Author SHA1 Message Date
MrTheShy 8583e99d94 Fix crash in WriteHeader when save buffer is too small for header table
When a player enters a new region, RegionFile's constructor calls
createFile which adds a FileEntry with length 0 to the file table.
This increases the header table size (appended at the end of the save
buffer) by sizeof(FileEntrySaveData) per entry, but since no actual
data is written to the file, MoveDataBeyond is never called and the
committed virtual memory pages are never grown to match.

On the next autosave tick, saveLevelData writes level.dat first
(before chunkSource->save which would have grown the buffer). If
level.dat doesn't need to grow, finalizeWrite calls WriteHeader which
tries to memcpy the now-larger header table past the end of committed
memory, causing an access violation.

This is especially likely in splitscreen where two players exploring
at the same time can create multiple new RegionFile entries within a
single tick, quickly exhausting the page-alignment slack in the buffer
(yes i am working at splitscreen in the meanwhile :) )

The fix was deduced by tracing the crash callstack through the save
system: FileHeader, ConsoleSaveFileOriginal, the stream chain, and
the RegionFile/RegionFileCache layer. The root cause turned out to be
a gap between createFile (which grows the header table) and
MoveDataBeyond (the only place that grows the buffer), with
finalizeWrite sitting right in between unprotected.

The buffer growth check added here mirrors the exact same VirtualAlloc
pattern already used in MoveDataBeyond (line 484-497) and in the
constructor's decompression path (line 176-190), so it integrates
naturally with the existing code. Same types, same page rounding,
same error handling. The fast path (no new entries, buffer already big
enough) is a single DWORD comparison that doesn't get taken, so there
is zero overhead in the common case.

This is the right place for the fix because finalizeWrite is the sole
caller of WriteHeader, meaning every code path that writes the header
(closeHandle, PrepareForWrite, deleteFile, Flush) is now protected by
a single check point.
2026-03-06 13:26:14 +01:00
Kevin d22ab815e3
Initial fixes for ContainerSetSlotPacket and CraftItemPacket (#649) 2026-03-05 21:20:40 -06:00
AcTh2 75c4f51218
Close the villager trade gui when he dies (#637) 2026-03-06 07:00:04 +07:00
ModMaker101 eed770b121
Fixed boats falling and a TP glitch #266 (#615) 2026-03-05 16:07:47 -06:00
void_17 55231bb8d3
Remove AUTO_VAR macro and _toString function (#592) 2026-03-06 02:11:18 +07:00
qwasdrizzel 892a6056ea
Modify dispense behavior to set outcome as LEFT_ITEM (#542) 2026-03-05 14:31:37 +07:00
disintegrate 33c798a885
Failsafe for signs if entered over max line length (#389)
* Failsafe for signs if entered over max line length

* Removed debug message.

* Revert "Removed debug message."

This reverts commit 553c436697.

* Update SignTileEntity.cpp

* Changed flag to _DEBUG
2026-03-05 14:30:56 +07:00
ModMaker101 91e50aa346
Fix animals stuck in panic state #514 (#519) 2026-03-05 14:23:56 +07:00
Siobhan 🏳️‍⚧️ 981c87732c
Restore the original follow range for Zombies and Withers (#510)
* Restore original follow range for Zombie

* Restore original WitherBoss follow range
2026-03-05 14:22:31 +07:00
Alezito2008 ac03b88a90
Fix:Prevent horse spawner crash (#433) 2026-03-04 23:42:32 +07:00
ModMaker101 206c6800f2
Fix incorrect distance comparison return value (#432) 2026-03-04 23:41:59 +07:00
Loki Rautio 42aec6dac5 Merge branch 'main' into pr/win64-world-saves
# Conflicts:
#	Minecraft.Client/MinecraftServer.cpp
#	README.md
2026-03-04 03:56:03 -06:00
daoge_cmd d112090fde feat: headless server 2026-03-04 17:29:43 +08:00
Alezito2008 6c842b2854
Disable flight state when riding entities (#368) 2026-03-04 13:21:21 +08:00
void_17 acf4a38555 Enable more aggressive optimizations /O2 /Ob3 2026-03-03 09:45:52 +07:00
void_17 d7882b68a4 Fix crash on item frame destruction 2026-03-03 09:27:28 +07:00
void_17 ccebb87ca7 Enable Whole Program Optimization in Release mode
This noticeably improves FPS
2026-03-03 08:54:08 +07:00
void_17 95d4d0a703 Temporarily turn off all MSVC warnings
Before any major refactoring, warnings do help a little except for slowing down the compilation (as it needs to output everything to stdout), so disable MSVC warnings in Release mode.
2026-03-03 07:10:55 +07:00
lspepinho 8b28c20d7a
Fixes for PR #96 (#170)
* Implement basic multiplayer functionality

* Update README.md

---------

Co-authored-by: Slenderman <ssimulpong@outlook.com>
2026-03-03 06:30:22 +07:00
void_17 13c8bafad5 Minor fixes
1. Improve const correctness in a few places (such as `Container::getMaxStackSize()` -> `Container::getMaxStackSize() const`)

2. Use C++11 varargs for `I18n::get`, `Entity::newDoubleList` and `Language::getElement`
2026-03-03 06:14:34 +07:00
dtentiion 63e590d783 Win64: show actual world names in save list, sort newest-first, preserve level name on load/resave 2026-03-02 21:13:11 +00:00
Andrew f917335b13
Fix Windows64 mouse capture and static initialization crashes (#177) 2026-03-03 03:17:10 +07:00
Austen Maneggio bbef5445f9
Add ARM64EC Support (#174)
Co-authored-by: Tubbymcwubby <maneggioausten@gmail.com>
2026-03-03 03:06:21 +07:00
daoge b3feddfef3
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-03-03 03:04:10 +08:00
daoge_cmd bbb199c2a2 feat(timer): improve high-FPS timing with high-resolution Windows clock 2026-03-03 00:31:47 +08:00
void_17 b9a2951901 Revert "Get rid of MSVC's __int64"
This reverts commit d63f79325f.
2026-03-02 17:39:35 +07:00
void_17 119bff3514 Revert "shared_ptr -> std::shared_ptr"
This reverts commit 7074f35e4b.
2026-03-02 17:37:16 +07:00
void_17 7ae0c13854 Revert "dynamic_pointer_cast -> std::dynamic_pointer_cast"
This reverts commit 07ad68bc15.
2026-03-02 17:36:56 +07:00
void_17 07ad68bc15 dynamic_pointer_cast -> std::dynamic_pointer_cast 2026-03-02 17:10:34 +07:00
void_17 7074f35e4b shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
2026-03-02 15:58:20 +07:00
void_17 d63f79325f Get rid of MSVC's __int64
Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
2026-03-02 15:53:32 +07:00
void_17 09e0c04f7b Further C-style struct definitions fixes 2026-03-02 15:11:05 +07:00
void_17 def238ff08 Fix C-style struct functor definitions 2026-03-02 14:51:05 +07:00
daoge_cmd b691c43c44 Initial commit 2026-03-01 12:16:08 +08:00