This commit is contained in:
TheBrokenRail 2023-12-26 02:31:22 -05:00
parent ef29e4fc0e
commit ac55d7d6b3
13 changed files with 83 additions and 8 deletions

View File

@ -1 +1 @@
2.5.2
2.5.3

@ -1 +1 @@
Subproject commit 5bf535a68fe1ca0381b4628859e642b40a166017
Subproject commit 67a8d026aa5aef062dae654d418c3cd09417c0c1

@ -1 +1 @@
Subproject commit 3eaf1255b29fdf5c2895856c7be7d7185ef2b241
Subproject commit b4c3ef9d0fdf46845f3e81e5d989dab06e71e6c1

View File

@ -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**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
#include <GLES/gl.h>
#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) {

View File

@ -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);
}

View File

@ -4,7 +4,9 @@
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef MCPI_HEADLESS_MODE
#include <GLES/gl.h>
#endif
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
@ -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();

View File

@ -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}"

View File

@ -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

View File

@ -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