Bug Fixes

This commit is contained in:
TheBrokenRail 2022-09-21 17:34:19 -04:00
parent d03a1a96ff
commit 58f329bb4f
7 changed files with 29 additions and 8 deletions

View File

@ -16,12 +16,12 @@ void init_multiplayer();
void init_sound(); void init_sound();
void init_input(); void init_input();
void init_sign(); void init_sign();
void init_creative();
void init_camera(); void init_camera();
void init_touch(); void init_touch();
void init_textures(); void init_textures();
void init_atlas(); void init_atlas();
#endif #endif
void init_creative();
void init_game_mode(); void init_game_mode();
void init_misc(); void init_misc();
void init_death(); void init_death();

View File

@ -121,7 +121,7 @@ void init_creative() {
} }
// Remove Creative Restrictions (Opening Chests, Crafting, Etc) // Remove Creative Restrictions (Opening Chests, Crafting, Etc)
if (feature_has("Remove Creative Mode Restrictions", server_disabled)) { if (feature_has("Remove Creative Mode Restrictions", server_enabled)) {
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
// Remove Restrictions // Remove Restrictions
patch((void *) 0x43ee8, nop_patch); patch((void *) 0x43ee8, nop_patch);

View File

@ -16,12 +16,12 @@ __attribute__((constructor)) static void init() {
init_sound(); init_sound();
init_input(); init_input();
init_sign(); init_sign();
init_creative();
init_camera(); init_camera();
init_touch(); init_touch();
init_textures(); init_textures();
init_atlas(); init_atlas();
#endif #endif
init_creative();
init_game_mode(); init_game_mode();
init_misc(); init_misc();
init_death(); init_death();

View File

@ -302,6 +302,13 @@ static void anGenBuffers_injection(int32_t count, uint32_t *buffers) {
glGenBuffers(count, buffers); glGenBuffers(count, buffers);
} }
// Fix Graphics Bug When Switching To First-Person While Sneaking
static void HumanoidMobRenderer_render_injection(unsigned char *model_renderer, unsigned char *entity, float param_2, float param_3, float param_4, float param_5, float param_6) {
(*HumanoidMobRenderer_render)(model_renderer, entity, param_2, param_3, param_4, param_5, param_6);
unsigned char *model = *(unsigned char **) (model_renderer + HumanoidMobRenderer_model_property_offset);
*(bool *) (model + HumanoidModel_is_sneaking_property_offset) = 0;
}
// Init // Init
static void nop() { static void nop() {
} }
@ -387,6 +394,9 @@ void init_misc() {
// Properly Generate Buffers // Properly Generate Buffers
overwrite((void *) anGenBuffers, (void *) anGenBuffers_injection); overwrite((void *) anGenBuffers, (void *) anGenBuffers_injection);
// Fix Graphics Bug When Switching To First-Person While Sneaking
patch_address(PlayerRenderer_render_vtable_addr, (void *) HumanoidMobRenderer_render_injection);
// Init C++ And Logging // Init C++ And Logging
_init_misc_cpp(); _init_misc_cpp();
_init_misc_logging(); _init_misc_logging();

View File

@ -503,6 +503,7 @@ static unsigned char get_max_players() {
return (unsigned char) val; return (unsigned char) val;
} }
// Real Init Server
static void server_init() { static void server_init() {
// Open Properties File // Open Properties File
std::string file(home_get()); std::string file(home_get());

View File

@ -87,9 +87,4 @@ void init_touch() {
int block_outlines = feature_has("Show Block Outlines", server_disabled); int block_outlines = feature_has("Show Block Outlines", server_disabled);
unsigned char outline_patch[4] = {(unsigned char) (block_outlines ? !touch_gui : touch_gui), 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0" unsigned char outline_patch[4] = {(unsigned char) (block_outlines ? !touch_gui : touch_gui), 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0"
patch((void *) 0x4a210, outline_patch); patch((void *) 0x4a210, outline_patch);
if (block_outlines) {
// Disable Broken Touchscreen-Specific Block Outline Behavior
unsigned char block_highlight_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3"
patch((void *) 0x494b4, block_highlight_patch);
}
} }

View File

@ -819,6 +819,21 @@ static Recipes_t Recipes = (Recipes_t) 0x9cabc;
static Recipes_t FurnaceRecipes = (Recipes_t) 0xa0778; static Recipes_t FurnaceRecipes = (Recipes_t) 0xa0778;
// HumanoidMobRenderer
typedef void (*HumanoidMobRenderer_render_t)(unsigned char *model_renderer, unsigned char *entity, float param_2, float param_3, float param_4, float param_5, float param_6);
static HumanoidMobRenderer_render_t HumanoidMobRenderer_render = (HumanoidMobRenderer_render_t) 0x62b8c;
static uint32_t HumanoidMobRenderer_model_property_offset = 0x14; // HumanoidModel *
// HumanoidModel
static uint32_t HumanoidModel_is_sneaking_property_offset = 0x236; // bool
// PlayerRenderer
static void *PlayerRenderer_render_vtable_addr = (void *) 0x107f08;
// Method That Require C++ Types // Method That Require C++ Types
#ifdef __cplusplus #ifdef __cplusplus