From 8bc90dae044b2802b8324e1c9907b6e99daf6b71 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 12 Jun 2024 02:33:29 -0400 Subject: [PATCH] More Tweaks --- CMakeLists.txt | 9 --------- Dockerfile | 19 ------------------- cmake/options/extra-options.cmake | 11 ++++++++++- mods/src/benchmark/benchmark.cpp | 12 ++++++++---- mods/src/misc/misc.cpp | 4 ++-- symbols/src/tile/entity/ChestTileEntity.def | 2 ++ 6 files changed, 22 insertions(+), 35 deletions(-) delete mode 100644 Dockerfile diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e0ab89..db6ab12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,15 +84,6 @@ endif() # Buld Dependencies add_subdirectory(dependencies) -# Version -set_property( - DIRECTORY - APPEND - PROPERTY CMAKE_CONFIGURE_DEPENDS VERSION -) -file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MCPI_VERSION) -file(TIMESTAMP "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MCPI_VERSION_DATE "%Y-%m-%d" UTC) - # Build libreborn add_subdirectory(libreborn) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ad9cd98..0000000 --- a/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM debian:bullseye-slim - -# Install -RUN \ - apt-get update && \ - apt-get install -y tini qemu-user && \ - apt-get --fix-broken install -y && \ - rm -rf /var/lib/apt/lists/* - -# Copy -ADD ./out/server-amd64 /app - -# Setup Working Directory -RUN mkdir /data -WORKDIR /data - -# Setup Entrypoint -ENTRYPOINT ["/usr/bin/tini", "--"] -CMD ["/app/usr/bin/minecraft-pi-reborn-server"] diff --git a/cmake/options/extra-options.cmake b/cmake/options/extra-options.cmake index c30049d..fc83462 100644 --- a/cmake/options/extra-options.cmake +++ b/cmake/options/extra-options.cmake @@ -71,5 +71,14 @@ mcpi_option(SKIN_SERVER "Skin Server" STRING "https://raw.githubusercontent.com/ # Discord Invite URL mcpi_option(DISCORD_INVITE "Discord Invite URL" STRING "https://discord.gg/mcpi-revival-740287937727561779") +# Version +set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS VERSION +) +file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../../VERSION" MCPI_VERSION) +file(TIMESTAMP "${CMAKE_CURRENT_LIST_DIR}/../../VERSION" MCPI_VERSION_DATE "%Y-%m-%d" UTC) + # Documentation URL -mcpi_option(DOCUMENTATION "Documentation URL" STRING "https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/src/branch/master/docs/") \ No newline at end of file +mcpi_option(DOCUMENTATION "Documentation URL" STRING "https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/src/tag/${MCPI_VERSION}/docs/") \ No newline at end of file diff --git a/mods/src/benchmark/benchmark.cpp b/mods/src/benchmark/benchmark.cpp index dc952f4..77c3349 100644 --- a/mods/src/benchmark/benchmark.cpp +++ b/mods/src/benchmark/benchmark.cpp @@ -72,7 +72,7 @@ static long long int get_time() { } // Store Time When World Loaded -static int world_loaded = 0; +static bool world_loaded = false; static long long int world_loaded_time; #ifndef MCPI_HEADLESS_MODE static unsigned long long int world_loaded_frames; @@ -92,10 +92,14 @@ static void Minecraft_update_injection(Minecraft *minecraft) { loaded = true; } + // Get Current Time + long long int now = get_time(); + // Detect World Loaded if (!world_loaded && minecraft->isLevelGenerated()) { - world_loaded = 1; - world_loaded_time = get_time(); + world_loaded = true; + INFO("Loaded"); + world_loaded_time = now; #ifndef MCPI_HEADLESS_MODE world_loaded_frames = frames; #endif @@ -105,7 +109,7 @@ static void Minecraft_update_injection(Minecraft *minecraft) { // Run Benchmark if (!exit_requested && world_loaded) { // Get Time - long long int current_time = get_time() - world_loaded_time; + long long int current_time = now - world_loaded_time; #ifndef MCPI_HEADLESS_MODE unsigned long long int current_frames = frames - world_loaded_frames; #endif diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 22cf727..5276802 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -532,7 +532,7 @@ static void Tesselator_vertexUV_injection(Tesselator_vertexUV_t original, Tessel // Call Original Method original(tesselator, x, y, z, u, v); } -static bool ChestTileEntity_shouldSave_injection(__attribute__((unused)) unsigned char *tile_entity) { +static bool ChestTileEntity_shouldSave_injection(__attribute__((unused)) ChestTileEntity_shouldSave_t original, __attribute__((unused)) ChestTileEntity *tile_entity) { return true; } @@ -926,7 +926,7 @@ void init_misc() { overwrite_calls(ContainerMenu_constructor, ContainerMenu_injection); overwrite_calls(ContainerMenu_destructor_complete, ContainerMenu_destructor_injection); } - patch_address((void *) 0x115b48, (void *) ChestTileEntity_shouldSave_injection); + overwrite_calls(ChestTileEntity_shouldSave, ChestTileEntity_shouldSave_injection); #ifndef MCPI_HEADLESS_MODE // Replace Block Highlight With Outline diff --git a/symbols/src/tile/entity/ChestTileEntity.def b/symbols/src/tile/entity/ChestTileEntity.def index decdfa0..c10c6ce 100644 --- a/symbols/src/tile/entity/ChestTileEntity.def +++ b/symbols/src/tile/entity/ChestTileEntity.def @@ -1,3 +1,5 @@ +vtable 0x115b40; + extends TileEntity; constructor () = 0xcfa78;