Fix Rare Segfault

This commit is contained in:
TheBrokenRail 2024-09-23 21:22:43 -04:00
parent be3ccae7c1
commit 65190afe73
4 changed files with 18 additions and 1 deletions
docs
launcher/src/client
mods/src/misc
symbols/src/level

@ -44,6 +44,7 @@
* `Improved Classic Title Positioning` (Enabled By Default)
* `Use Updated Title` (Enabled By Default)
* `Hide Block Outline When GUI Is Hidden` (Enabled By Default)
* `Fix Crash When Generating Certain Seed` (Enabled By Default)
* Existing Functionality (All Enabled By Default)
* `Fix Screen Rendering When Hiding HUD`
* `Sanitize Usernames`

@ -106,4 +106,5 @@ TRUE Property Scale Animated Textures
TRUE Allow High-Resolution Title
TRUE Improved Classic Title Positioning
TRUE Use Updated Title
TRUE Hide Block Outline When GUI Is Hidden
TRUE Hide Block Outline When GUI Is Hidden
TRUE Fix Crash When Generating Certain Seed

@ -434,6 +434,15 @@ static void Player_tick_injection(Player_tick_t original, Player *self) {
original(self);
}
// Rare Segfault
static int Dimension_isValidSpawn_Level_getTopTile_injection(Level *self, int x, int z) {
int ret = self->getTopTile(x, z);
if (ret == 0) {
ret = Tile::invisible_bedrock->id;
}
return ret;
}
// Init
void init_misc() {
// Sanitize Username
@ -579,6 +588,11 @@ void init_misc() {
overwrite_calls(Player_tick, Player_tick_injection);
}
// Rare Segfault
if (feature_has("Fix Crash When Generating Certain Seed", server_enabled)) {
overwrite_call((void *) 0xb198c, (void *) Dimension_isValidSpawn_Level_getTopTile_injection);
}
// Init Other Components
_init_misc_tinting();
_init_misc_ui();

@ -49,6 +49,7 @@ method bool hasDirectSignal(int x, int y, int z) = 0xa5d88;
method bool getDirectSignal(int x, int y, int z, int direction) = 0xa5d2c;
method bool canSeeSky(int x, int y, int z) = 0xa39b8;
method bool isDay() = 0xa3d9c;
method int getTopTile(int x, int z) = 0xa2cc8;
virtual-method void tick() = 0x28;
virtual-method void updateSleepingPlayerList() = 0x2c;