From 180ba9dcaf7aa82efcbed1159351e2c5398c1954 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sun, 11 Feb 2024 20:35:41 -0500 Subject: [PATCH] Small Changes --- CMakeLists.txt | 4 +++- docs/CHANGELOG.md | 4 ++++ launcher/src/client/available-feature-flags | 2 ++ mods/src/misc/misc.cpp | 22 +++++++++++++++++++-- symbols/src/app-platform/AppPlatform.def | 1 + 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8df5635a2..551d9f9c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,8 @@ include(cmake/options/paths.cmake) string(CONCAT COMPILE_FLAGS_SETUP # Optimizations "if(CMAKE_BUILD_TYPE STREQUAL \"Release\")\n" - " add_compile_options(-O3 -s)\n" + " add_compile_options(-O3)\n" + " add_link_options(-s)\n" "else()\n" " add_compile_options(-g)\n" "endif()\n" @@ -159,6 +160,7 @@ if(BUILD_NATIVE_COMPONENTS) else() list(APPEND ARM_OPTIONS "-DMCPI_USE_PREBUILT_ARMHF_TOOLCHAIN:BOOL=TRUE") endif() + list(APPEND ARM_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}") # Build ExternalProject_Add(arm-components DOWNLOAD_COMMAND "" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 780e7021e..574b7c43c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,12 +11,16 @@ * Add `Use Java Beta 1.3 Light Ramp` Feature Flag (Enabled By Default) * Add `Send Full Level When Hosting Game` Feature Flag (Enabled By Default) * Add `Food Overlay` Feature Flag (Disabled By Default) +* Add `Display Date In Select World Screen` Feature Flag (Enabled By Default) +* Add `Optimized Chunk Sorting` Feature Flag (Enabled By Default) +* Add `Add Cake` Feature Flag (Enabled By Default) * Add Milk Buckets * Implement Crafting Remainders * Improve Death Messages * Massive Build System Improvements * Fix Item Dropping When Killing Players From The Server Console * Fix Furnace Visual Bug When Using Lava Bucket As Fuel +* Add Splash Text To Start Screen **2.5.3** * Add `Replace Block Highlight With Outline` Feature Flag (Enabled By Default) diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index bc1d7b52f..4086ac199 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -58,3 +58,5 @@ TRUE Use Java Beta 1.3 Light Ramp TRUE Send Full Level When Hosting Game FALSE Food Overlay TRUE Add Splashes +TRUE Display Date In Select World Screen +TRUE Optimized Chunk Sorting diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index bc15a2746..50818bec2 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -123,6 +123,17 @@ static void sort_chunks(Chunk **chunks_begin, Chunk **chunks_end, DistanceChunkS } } +// Display Date In Select World Screen +static std::string AppPlatform_linux_getDateString_injection(__attribute__((unused)) AppPlatform_linux *app_platform, int time) { + // From https://github.com/ReMinecraftPE/mcpe/blob/56e51027b1c2e67fe5a0e8a091cefe51d4d11926/platforms/sdl/base/AppPlatform_sdl_base.cpp#L68-L84 + time_t tt = time; + struct tm t; + gmtime_r(&tt, &t); + char buf[2048]; + strftime(buf, sizeof buf, "%b %d %Y %H:%M:%S", &t); + return std::string(buf); +} + // Init void _init_misc_cpp() { // Implement AppPlatform::readAssetFile So Translations Work @@ -136,10 +147,17 @@ void _init_misc_cpp() { patch_address(PauseScreen_init_vtable_addr, (void *) PauseScreen_init_injection); } - // Implement crafting remainders + // Implement Crafting Remainders overwrite_call((void *) 0x2e230, (void *) PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_injection); overwrite((void *) Item_getCraftingRemainingItem_non_virtual, (void *) Item_getCraftingRemainingItem_injection); // Replace 2011 std::sort With Optimized(TM) Code - overwrite((void *) 0x51fac, (void *) sort_chunks); + if (feature_has("Optimized Chunk Sorting", server_enabled)) { + overwrite((void *) 0x51fac, (void *) sort_chunks); + } + + // Display Date In Select World Screen + if (feature_has("Display Date In Select World Screen", server_disabled)) { + patch_address(AppPlatform_linux_getDateString_vtable_addr, (void *) AppPlatform_linux_getDateString_injection); + } } diff --git a/symbols/src/app-platform/AppPlatform.def b/symbols/src/app-platform/AppPlatform.def index dd42aee50..3e4bd72d7 100644 --- a/symbols/src/app-platform/AppPlatform.def +++ b/symbols/src/app-platform/AppPlatform.def @@ -3,3 +3,4 @@ vtable 0x1020d8; virtual-method void saveScreenshot(std::string *path, int width, int height) = 0x8; virtual-method AppPlatform_readAssetFile_return_value readAssetFile(std::string *path) = 0x34; virtual-method Texture loadTexture(std::string *path, bool b) = 0xc; +virtual-method std::string getDateString(int time) = 0x24;