Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
2.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
NoozAbooz committed Nov 1, 2022
1 parent 81ecd7d commit 129f285
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.5
2.4.6
2 changes: 1 addition & 1 deletion dependencies/libpng/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ add_subdirectory(src EXCLUDE_FROM_ALL)
add_custom_target(zlib-build ALL DEPENDS zlibstatic)

# License
install(FILES src/README DESTINATION "${MCPI_LEGAL_DIR}/zlib")
install(FILES src/LICENSE DESTINATION "${MCPI_LEGAL_DIR}/zlib")
2 changes: 1 addition & 1 deletion dependencies/zenity/src
Submodule src updated from 435bc1 to a74964
9 changes: 4 additions & 5 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Changelog
The changelog for every single MCPI v2 release is listed here. Under-the-hood modifications that don't effect the user experience are prefixed with "[INT]".

### **2.4.6-1**
* Fix Crash Report Log Saving

### **2.4.6**

* Fix Crash Report Log Saving
* Fix Holding Left-Click When Attacking
* Fix Crashing On ARMHF

### **2.4.5**
* Remove Coloured Terminal Output
Expand All @@ -24,7 +23,7 @@ The changelog for every single MCPI v2 release is listed here. Under-the-hood mo
* Add Options Button (Moved From ``Fix Options Screen`` Feature Flag)
* Add ``Disable Speed Bridging`` Feature Flag (Disabled By Default)
* Add ``Disable Creative Mode Mining Delay`` Feature Flag (Disabled By Default)
* Improved Feature Flag Names
* Improved Feature Flag Namesp
* Miscellaneous Bug Fixes
* Improved Build System

Expand Down
3 changes: 3 additions & 0 deletions docs/COMMAND_LINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### ``--version`` (Or ``-v``)
If you run MCPI-Reborn with ``--version`` it will print its version to ``stdout``.

### ``--debug``
This sets ``MCPI_DEBUG``.

### Client Mode Only

#### ``--print-available-feature-flags``
Expand Down
9 changes: 9 additions & 0 deletions libreborn/src/util/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ char *run_command(const char *const command[], int *exit_status) {
close(output_pipe[0]);
close(output_pipe[1]);

// Setup stderr
if (getenv("MCPI_DEBUG") == NULL) {
const char *log_file_fd_env = getenv("MCPI_LOG_FILE_FD");
if (log_file_fd_env == NULL) {
IMPOSSIBLE();
}
dup2(atoi(log_file_fd_env), STDERR_FILENO);
}

// Setup Environment
setup_exec_environment(0);

Expand Down
2 changes: 1 addition & 1 deletion media-layer/core/src/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static SDLKey glfw_key_to_sdl_key(int key) {
// Drop Item
case GLFW_KEY_Q:
return SDLK_q;
// Hotbar
// Toolbar
case GLFW_KEY_1:
return SDLK_1;
case GLFW_KEY_2:
Expand Down
23 changes: 23 additions & 0 deletions mods/src/input/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,33 @@ static int32_t MouseBuildInput_tickBuild_injection(unsigned char *mouse_build_in
return ret;
}

// Fix Holding Attack
static bool last_player_attack_successful = 0;
static bool Player_attack_Entity_hurt_injection(unsigned char *entity, unsigned char *attacker, int32_t damage) {
// Call Original Method
unsigned char *entity_vtable = *(unsigned char **) entity;
Entity_hurt_t Entity_hurt = *(Entity_hurt_t *) (entity_vtable + Entity_hurt_vtable_offset);
last_player_attack_successful = (*Entity_hurt)(entity, attacker, damage);
return last_player_attack_successful;
}
static ItemInstance *Player_attack_Inventory_getSelected_injection(unsigned char *inventory) {
// Check If Attack Was Successful
if (!last_player_attack_successful) {
return NULL;
}

// Call Original Method
return (*Inventory_getSelected)(inventory);
}

// Init
void _init_attack() {
// Allow Attacking Mobs
if (feature_has("Fix Attacking", server_disabled)) {
patch_address(MouseBuildInput_tickBuild_vtable_addr, (void *) MouseBuildInput_tickBuild_injection);

// Fix Holding Attack
overwrite_call((void *) 0x8fc1c, (void *) Player_attack_Entity_hurt_injection);
overwrite_call((void *) 0x8fc24, (void *) Player_attack_Inventory_getSelected_injection);
}
}
6 changes: 6 additions & 0 deletions mods/src/input/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ int input_back() {

// Handle Back Button Presses
static void _handle_back(unsigned char *minecraft) {
// If Minecraft's Level property is initialized, but Minecraft's Player property is NULL, then Minecraft::handleBack may crash.
if ((*(unsigned char **) (minecraft + Minecraft_level_property_offset)) != NULL && (*(unsigned char **) (minecraft + Minecraft_player_property_offset)) == NULL) {
// Unable to safely run Minecraft::handleBack, deferring until safe.
return;
}
// Send Event
unsigned char *minecraft_vtable = *(unsigned char **) minecraft;
Minecraft_handleBack_t Minecraft_handleBack = *(Minecraft_handleBack_t *) (minecraft_vtable + Minecraft_handleBack_vtable_offset);
for (int i = 0; i < back_button_presses; i++) {
Expand Down
6 changes: 6 additions & 0 deletions symbols/include/symbols/minecraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ static uint32_t AuxDataTileItem_icon_tile_property_offset = 0x28; // Tile *

// Entity

typedef bool (*Entity_hurt_t)(unsigned char *entity, unsigned char *attacker, int32_t damage);
static uint32_t Entity_hurt_vtable_offset = 0xa4;

static uint32_t Entity_x_property_offset = 0x4; // float
static uint32_t Entity_y_property_offset = 0x8; // float
static uint32_t Entity_z_property_offset = 0xc; // float
Expand Down Expand Up @@ -764,6 +767,9 @@ static uint32_t ServerSideNetworkHandler_minecraft_property_offset = 0x8; // Min
typedef void (*Inventory_selectSlot_t)(unsigned char *inventory, int32_t slot);
static Inventory_selectSlot_t Inventory_selectSlot = (Inventory_selectSlot_t) 0x8d13c;

typedef ItemInstance *(*Inventory_getSelected_t)(unsigned char *inventory);
static Inventory_getSelected_t Inventory_getSelected = (Inventory_getSelected_t) 0x8d134;

static uint32_t Inventory_selectedSlot_property_offset = 0x28; // int32_t

// TripodCameraRenderer
Expand Down

0 comments on commit 129f285

Please sign in to comment.