diff --git a/VERSION b/VERSION index f225a78..aedc15b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.2 +2.5.3 diff --git a/dependencies/gles-compatibility-layer/src b/dependencies/gles-compatibility-layer/src index 5bf535a..67a8d02 160000 --- a/dependencies/gles-compatibility-layer/src +++ b/dependencies/gles-compatibility-layer/src @@ -1 +1 @@ -Subproject commit 5bf535a68fe1ca0381b4628859e642b40a166017 +Subproject commit 67a8d026aa5aef062dae654d418c3cd09417c0c1 diff --git a/dependencies/glfw/src b/dependencies/glfw/src index 3eaf125..b4c3ef9 160000 --- a/dependencies/glfw/src +++ b/dependencies/glfw/src @@ -1 +1 @@ -Subproject commit 3eaf1255b29fdf5c2895856c7be7d7185ef2b241 +Subproject commit b4c3ef9d0fdf46845f3e81e5d989dab06e71e6c1 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 39e6d38..a06335b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +**2.5.3** +* Add ``Replace Block Highlight With Outline`` Feature Flag (Enabled By Default) + * By Default, The Outline Width Is Set Using The GUI Scale + * This Can Be Overridden Using The ``MCPI_BLOCK_OUTLINE_WIDTH`` Environmental Variable +* Added ``overwrite_calls_within`` Function + **2.5.2** * Add ``3D Chest Model`` Feature Flag (Enabled By Default) * Stop Using Jenkins @@ -7,7 +13,7 @@ * Replace LibPNG **2.5.1** -* Allow Overriidng Custom Skin Server Using ``MCPI_SKIN_SERVER`` Environmental Variable +* Allow Overriding Custom Skin Server Using ``MCPI_SKIN_SERVER`` Environmental Variable * Fix Bug With SDK Generation **2.5.0** diff --git a/images/start.png b/images/start.png index 491ee6a..e89cdda 100644 Binary files a/images/start.png and b/images/start.png differ diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index 5fcacab..a8436a3 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -50,3 +50,4 @@ FALSE Disable Block Tinting TRUE Disable Hostile AI In Creative Mode TRUE Load Custom Skins TRUE 3D Chest Model +TRUE Replace Block Highlight With Outline diff --git a/libreborn/src/patch/patch.c b/libreborn/src/patch/patch.c index 3e5654c..488cc40 100644 --- a/libreborn/src/patch/patch.c +++ b/libreborn/src/patch/patch.c @@ -122,6 +122,7 @@ void _overwrite_call(const char *file, int line, void *start, void *target) { } // Overwrite All B(L) Intrusctions That Target The Specified Address +#define NO_CALLSITE_ERROR "(%s:%i) Unable To Find Callsites For 0x%08x" void _overwrite_calls(const char *file, int line, void *start, void *target) { // Add New Target To Code Block update_code_block(target); @@ -140,10 +141,10 @@ void _overwrite_calls(const char *file, int line, void *start, void *target) { // Check if (data.found < 1) { - ERR("(%s:%i) Unable To Find Callsites For 0x%08x", file, line, (uint32_t) start); + ERR(NO_CALLSITE_ERROR, file, line, (uint32_t) start); } } -void _overwrite_calls_within(const char *file, int line, void *from, void *to, void *target, void *replacement) { +void _overwrite_calls_within(const char *file, int line, void *from /* inclusive */, void *to /* exclusive */, void *target, void *replacement) { // Add New Target To Code Block update_code_block(replacement); @@ -151,7 +152,7 @@ void _overwrite_calls_within(const char *file, int line, void *from, void *to, v int found = _overwrite_calls_within_internal(file, line, from, to, target, code_block); // Check if (found < 1) { - ERR("(%s:%i) Unable To Find Callsites For 0x%08x", file, line, (uint32_t) target); + ERR(NO_CALLSITE_ERROR, file, line, (uint32_t) target); } // Increment Code Block Position diff --git a/media-layer/core/gles/src/passthrough.c b/media-layer/core/gles/src/passthrough.c index 53f9c08..66720a8 100644 --- a/media-layer/core/gles/src/passthrough.c +++ b/media-layer/core/gles/src/passthrough.c @@ -1,6 +1,6 @@ #include -#include "../dependencies/gles-compatibility-layer/src/passthrough.h" +#include "../../../../dependencies/gles-compatibility-layer/src/src/passthrough.h" GL_FUNC(glFogfv, void, (GLenum pname, const GLfloat *params)); void glFogfv(GLenum pname, const GLfloat *params) { diff --git a/media-layer/proxy/src/GLESv1_CM.c b/media-layer/proxy/src/GLESv1_CM.c index 81b77a9..1781e6f 100644 --- a/media-layer/proxy/src/GLESv1_CM.c +++ b/media-layer/proxy/src/GLESv1_CM.c @@ -926,6 +926,10 @@ static int get_glGetFloatv_params_size(GLenum pname) { case GL_PROJECTION_MATRIX: { return 16; } + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_SMOOTH_LINE_WIDTH_RANGE: { + return 2; + } default: { PROXY_ERR("Unsupported glGetFloatv Property: %u", pname); } diff --git a/mods/src/misc/misc.c b/mods/src/misc/misc.c index d4a5802..0afdfe8 100644 --- a/mods/src/misc/misc.c +++ b/mods/src/misc/misc.c @@ -4,7 +4,9 @@ #include #include +#ifndef MCPI_HEADLESS_MODE #include +#endif #include #include @@ -495,6 +497,35 @@ static unsigned char *ContainerMenu_destructor_injection(unsigned char *containe return (*ContainerMenu_destructor)(container_menu); } +#ifndef MCPI_HEADLESS_MODE +// Custom Outline Color +static void glColor4f_injection(__attribute__((unused)) GLfloat red, __attribute__((unused)) GLfloat green, __attribute__((unused)) GLfloat blue, __attribute__((unused)) GLfloat alpha) { + // Set Color + glColor4f(0, 0, 0, 1); + + // Find Line Width + char *custom_line_width = getenv("MCPI_BLOCK_OUTLINE_WIDTH"); + float line_width; + if (custom_line_width != NULL) { + // Custom + line_width = strtof(custom_line_width, NULL); + } else { + // Guess + line_width = 1.75 / (*InvGuiScale); + } + // Clamp Line Width + float range[2]; + glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range); + if (range[1] < line_width) { + line_width = range[1]; + } else if (range[0] > line_width) { + line_width = range[0]; + } + // Set Line Width + glLineWidth(line_width); +} +#endif + // Init static void nop() { } @@ -662,6 +693,16 @@ void init_misc() { } patch_address((void *) 0x115b48, (void *) ChestTileEntity_shouldSave_injection); +#ifndef MCPI_HEADLESS_MODE + // Replace Block Highlight With Outline + if (feature_has("Replace Block Highlight With Outline", server_disabled)) { + overwrite((void *) LevelRenderer_renderHitSelect, (void *) LevelRenderer_renderHitOutline); + unsigned char fix_outline_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" + patch((void *) 0x4d830, fix_outline_patch); + overwrite_call((void *) 0x4d764, (void *) glColor4f_injection); + } +#endif + // Init C++ And Logging _init_misc_cpp(); _init_misc_logging(); diff --git a/scripts/build.sh b/scripts/build.sh index 888860b..e166ddf 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -6,6 +6,7 @@ set -e build() { # Use Build Dir if [ ! -f "build/${MODE}-${ARCH}/arm/build.ninja" ] || [ ! -f "build/${MODE}-${ARCH}/native/build.ninja" ]; then + # Run CMake ./scripts/setup.sh "${MODE}" "${ARCH}" fi cd "build/${MODE}-${ARCH}" diff --git a/scripts/test.sh b/scripts/test.sh index 053065f..6b873a2 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,6 +2,8 @@ set -e +## Server Test + # Build Test ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)" ./scripts/setup.sh server "${ARCH}" @@ -19,6 +21,8 @@ cd build/test minecraft-pi-reborn-server --only-generate cd ../../ +## Client Test + # Build Benchmark ./scripts/setup.sh client "${ARCH}" -DMCPI_HEADLESS_MODE=ON ./scripts/build.sh client "${ARCH}" @@ -32,3 +36,16 @@ export _MCPI_SKIP_ROOT_CHECK=1 # Run Benchmark export HOME="$(pwd)/build/test" minecraft-pi-reborn-client --default --no-cache --benchmark + +## Example Mods Test + +# Build +for project in example-mods/*/; do + cd "${project}" + rm -rf build + mkdir build + cd build + cmake -GNinja .. + cmake --build . + cd ../../../ +done diff --git a/symbols/include/symbols/minecraft.h b/symbols/include/symbols/minecraft.h index 7103464..7b1a916 100644 --- a/symbols/include/symbols/minecraft.h +++ b/symbols/include/symbols/minecraft.h @@ -574,6 +574,10 @@ static LevelRenderer_renderDebug_t LevelRenderer_renderDebug = (LevelRenderer_re typedef void (*LevelRenderer_generateSky_t)(unsigned char *level_renderer); static LevelRenderer_generateSky_t LevelRenderer_generateSky = (LevelRenderer_generateSky_t) 0x4d0d4; +typedef void (*LevelRenderer_renderHitSelect_t)(unsigned char *level_renderer, unsigned char* player, unsigned char *hit_result, int32_t i, void *vp, float f); +static LevelRenderer_renderHitSelect_t LevelRenderer_renderHitSelect = (LevelRenderer_renderHitSelect_t) 0x4e318; +static LevelRenderer_renderHitSelect_t LevelRenderer_renderHitOutline = (LevelRenderer_renderHitSelect_t) 0x4dc14; + static uint32_t LevelRenderer_minecraft_property_offset = 0x4; // Minecraft * // PerfRenderer