Improve feature_has

This commit is contained in:
TheBrokenRail 2022-04-09 20:01:16 -04:00
parent ed58356dd8
commit 157d51e6b6
26 changed files with 62 additions and 70 deletions

View File

@ -255,7 +255,7 @@ void bootstrap(int argc, char *argv[]) {
// Load ARM Libraries (Ensure Priority) // Load ARM Libraries (Ensure Priority)
string_append(&new_ld_path, ":%s/usr/lib/arm-linux-gnueabihf:%s/usr/arm-linux-gnueabihf/lib", usr_prefix, usr_prefix); string_append(&new_ld_path, ":%s/usr/lib/arm-linux-gnueabihf:%s/usr/arm-linux-gnueabihf/lib", usr_prefix, usr_prefix);
// Add LD_LIBRARY_PATH (ARM32 Only) // Add LD_LIBRARY_PATH
{ {
char *value = get_env_safe("LD_LIBRARY_PATH"); char *value = get_env_safe("LD_LIBRARY_PATH");
if (strlen(value) > 0) { if (strlen(value) > 0) {
@ -299,24 +299,14 @@ void bootstrap(int argc, char *argv[]) {
free(mods_folder); free(mods_folder);
} }
// Add MCPI_LD_PRELOAD // Add LD_PRELOAD
{ {
char *value = get_env_safe("MCPI_LD_PRELOAD"); char *value = get_env_safe("LD_PRELOAD");
if (strlen(value) > 0) { if (strlen(value) > 0) {
string_append(&new_ld_preload, ":%s", value); string_append(&new_ld_preload, ":%s", value);
} }
} }
// Add LD_PRELOAD (ARM32 Only)
#ifdef __arm__
{
char *value = get_env_safe("MCPI_LD_PRELOAD");
if (strlen(value) > 0) {
string_append(&new_ld_preload, ":%s", value);
}
}
#endif
// Set LD_PRELOAD // Set LD_PRELOAD
set_and_print_env("LD_PRELOAD", new_ld_preload); set_and_print_env("LD_PRELOAD", new_ld_preload);
free(new_ld_preload); free(new_ld_preload);

View File

@ -21,6 +21,9 @@ target_link_libraries(version reborn-patch symbols)
add_library(chat SHARED src/chat/chat.cpp src/chat/ui.c) add_library(chat SHARED src/chat/chat.cpp src/chat/ui.c)
target_link_libraries(chat reborn-patch symbols feature pthread) target_link_libraries(chat reborn-patch symbols feature pthread)
add_library(creative SHARED src/creative/creative.cpp)
target_link_libraries(creative reborn-patch symbols feature)
if(MCPI_SERVER_MODE) if(MCPI_SERVER_MODE)
add_library(server SHARED src/server/server.cpp src/server/server_properties.cpp) add_library(server SHARED src/server/server.cpp src/server/server_properties.cpp)
target_link_libraries(server reborn-patch symbols feature home misc compat dl media-layer-core pthread) target_link_libraries(server reborn-patch symbols feature home misc compat dl media-layer-core pthread)
@ -44,9 +47,6 @@ else()
add_library(sign SHARED src/sign/sign.cpp) add_library(sign SHARED src/sign/sign.cpp)
target_link_libraries(sign reborn-patch symbols feature input) target_link_libraries(sign reborn-patch symbols feature input)
add_library(creative SHARED src/creative/creative.cpp)
target_link_libraries(creative reborn-patch symbols feature)
add_library(touch SHARED src/touch/touch.c) add_library(touch SHARED src/touch/touch.c)
target_link_libraries(touch reborn-patch symbols feature) target_link_libraries(touch reborn-patch symbols feature)
@ -84,22 +84,22 @@ add_library(test SHARED src/test/test.c)
target_link_libraries(test reborn-patch home) target_link_libraries(test reborn-patch home)
add_library(init SHARED src/init/init.c) add_library(init SHARED src/init/init.c)
target_link_libraries(init compat game-mode misc death options chat home version test media-layer-core) target_link_libraries(init compat game-mode misc death options chat creative home version test media-layer-core)
if(MCPI_SERVER_MODE) if(MCPI_SERVER_MODE)
target_link_libraries(init server) target_link_libraries(init server)
else() else()
target_link_libraries(init multiplayer sound camera input sign creative touch textures atlas) target_link_libraries(init multiplayer sound camera input sign touch textures atlas)
if(NOT MCPI_HEADLESS_MODE) if(NOT MCPI_HEADLESS_MODE)
target_link_libraries(init benchmark) target_link_libraries(init benchmark)
endif() endif()
endif() endif()
## Install Mods ## Install Mods
install(TARGETS init compat readdir feature game-mode misc death options chat home version test DESTINATION "${MCPI_INSTALL_DIR}/mods") install(TARGETS init compat readdir feature game-mode misc death options chat creative home version test DESTINATION "${MCPI_INSTALL_DIR}/mods")
if(MCPI_SERVER_MODE) if(MCPI_SERVER_MODE)
install(TARGETS server DESTINATION "${MCPI_INSTALL_DIR}/mods") install(TARGETS server DESTINATION "${MCPI_INSTALL_DIR}/mods")
else() else()
install(TARGETS multiplayer sound override camera input sign creative touch textures atlas DESTINATION "${MCPI_INSTALL_DIR}/mods") install(TARGETS multiplayer sound override camera input sign touch textures atlas DESTINATION "${MCPI_INSTALL_DIR}/mods")
if(NOT MCPI_HEADLESS_MODE) if(NOT MCPI_HEADLESS_MODE)
install(TARGETS benchmark DESTINATION "${MCPI_INSTALL_DIR}/mods") install(TARGETS benchmark DESTINATION "${MCPI_INSTALL_DIR}/mods")
endif() endif()

View File

@ -123,7 +123,7 @@ void init_atlas() {
overwrite_calls((void *) ItemRenderer_renderGuiItem_two, (void *) ItemRenderer_renderGuiItem_two_injection); overwrite_calls((void *) ItemRenderer_renderGuiItem_two, (void *) ItemRenderer_renderGuiItem_two_injection);
// Disable The gui_blocks Atlas Which Contains Pre-Rendered Textures For Blocks In The Inventory // Disable The gui_blocks Atlas Which Contains Pre-Rendered Textures For Blocks In The Inventory
if (feature_has("Disable \"gui_blocks\" Atlas", 0)) { if (feature_has("Disable \"gui_blocks\" Atlas", server_disabled)) {
unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x63c2c, disable_gui_blocks_atlas_patch); patch((void *) 0x63c2c, disable_gui_blocks_atlas_patch);
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled // Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled

View File

@ -37,7 +37,7 @@ void init_camera() {
patch_address(AppPlatform_linux_saveScreenshot_vtable_addr, (void *) AppPlatform_linux_saveScreenshot_injection); patch_address(AppPlatform_linux_saveScreenshot_vtable_addr, (void *) AppPlatform_linux_saveScreenshot_injection);
// Fix Camera Rendering // Fix Camera Rendering
if (feature_has("Fix Camera Rendering", 0)) { if (feature_has("Fix Camera Rendering", server_disabled)) {
// Enable TripodCameraRenderer // Enable TripodCameraRenderer
overwrite_calls((void *) EntityRenderDispatcher, (void *) EntityRenderDispatcher_injection); overwrite_calls((void *) EntityRenderDispatcher, (void *) EntityRenderDispatcher_injection);
// Display Smoke From TripodCamera Higher // Display Smoke From TripodCamera Higher

View File

@ -119,7 +119,7 @@ static void send_queued_messages(unsigned char *minecraft) {
// Init // Init
void init_chat() { void init_chat() {
_chat_enabled = feature_has("Implement Chat", 1); _chat_enabled = feature_has("Implement Chat", server_enabled);
if (_chat_enabled) { if (_chat_enabled) {
// Disable Original ChatPacket Loopback // Disable Original ChatPacket Loopback
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"

View File

@ -5,6 +5,7 @@
#include "../feature/feature.h" #include "../feature/feature.h"
#include "creative.h" #include "creative.h"
#ifndef MCPI_SERVER_MODE
// Add Item To Inventory // Add Item To Inventory
static void inventory_add_item(unsigned char *inventory, unsigned char *item, bool is_tile) { static void inventory_add_item(unsigned char *inventory, unsigned char *item, bool is_tile) {
ItemInstance *item_instance = new ItemInstance; ItemInstance *item_instance = new ItemInstance;
@ -80,6 +81,7 @@ static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(un
return ret; return ret;
} }
#endif
// Hook Specific TileItem Constructor // Hook Specific TileItem Constructor
static unsigned char *Tile_initTiles_TileItem_injection(unsigned char *tile_item, int32_t id) { static unsigned char *Tile_initTiles_TileItem_injection(unsigned char *tile_item, int32_t id) {
@ -106,8 +108,10 @@ int creative_is_restricted() {
// Init // Init
void init_creative() { void init_creative() {
// Add Extra Items To Creative Inventory (Only Replace Specific Function Call) // Add Extra Items To Creative Inventory (Only Replace Specific Function Call)
if (feature_has("Expand Creative Inventory", 0)) { if (feature_has("Expand Creative Inventory", server_enabled)) {
#ifndef MCPI_SERVER_MODE
overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection); overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
#endif
// Use AuxDataTileItem by default instead of TileItem, so tiles in the Creative // Use AuxDataTileItem by default instead of TileItem, so tiles in the Creative
// Inventory can have arbitrary auxiliary values. // Inventory can have arbitrary auxiliary values.
@ -121,7 +125,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", 0)) { if (feature_has("Remove Creative Mode Restrictions", server_disabled)) {
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

@ -62,7 +62,7 @@ static void LocalPlayer_actuallyHurt_injection(unsigned char *player, int32_t da
// Init // Init
void init_death() { void init_death() {
// Death Messages // Death Messages
if (feature_has("Implement Death Messages", 1)) { if (feature_has("Implement Death Messages", server_enabled)) {
patch_address(ServerPlayer_actuallyHurt_vtable_addr, (void *) ServerPlayer_actuallyHurt_injection); patch_address(ServerPlayer_actuallyHurt_vtable_addr, (void *) ServerPlayer_actuallyHurt_injection);
patch_address(LocalPlayer_actuallyHurt_vtable_addr, (void *) LocalPlayer_actuallyHurt_injection); patch_address(LocalPlayer_actuallyHurt_vtable_addr, (void *) LocalPlayer_actuallyHurt_injection);
} }

View File

@ -6,16 +6,7 @@
#include "feature.h" #include "feature.h"
// Check For Feature // Check For Feature
int feature_has(const char *name, int server_default) { int _feature_has(const char *name) {
// Default Value For Server Mode
#ifdef MCPI_SERVER_MODE
if (server_default != -1) {
return server_default;
}
#else
(void) server_default;
#endif
// Get Value // Get Value
char *env = getenv("MCPI_FEATURE_FLAGS"); char *env = getenv("MCPI_FEATURE_FLAGS");
char *features = strdup(env != NULL ? env : ""); char *features = strdup(env != NULL ? env : "");

View File

@ -4,7 +4,16 @@
extern "C" { extern "C" {
#endif #endif
int feature_has(const char *name, int server_default); int _feature_has(const char *name);
#ifdef MCPI_SERVER_MODE
#define _feature_has__server_defaul_is_server_disabled(name) 0
#define _feature_has__server_defaul_is_server_auto(name) _feature_has(name)
#define _feature_has__server_defaul_is_server_enabled(name) 1
#define feature_has(name, server_default) _feature_has__server_defaul_is_##server_default(name)
#else
#define feature_has(name, server_default) _feature_has(name)
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -49,7 +49,7 @@ static unsigned char *Minecraft_getCreator_injection(unsigned char *minecraft) {
// Init // Init
void init_game_mode() { void init_game_mode() {
// Dynamic Game Mode Switching // Dynamic Game Mode Switching
if (feature_has("Implement Game-Mode Switching", 1)) { if (feature_has("Implement Game-Mode Switching", server_enabled)) {
set_is_survival(1); set_is_survival(1);
overwrite_calls((void *) Minecraft_setIsCreativeMode, (void *) Minecraft_setIsCreativeMode_injection); overwrite_calls((void *) Minecraft_setIsCreativeMode, (void *) Minecraft_setIsCreativeMode_injection);
@ -68,7 +68,7 @@ void init_game_mode() {
} }
// Allow Joining Survival Servers // Allow Joining Survival Servers
if (feature_has("Allow Joining Survival Servers", 1)) { if (feature_has("Allow Joining Survival Servers", server_enabled)) {
unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea}; // "b 0x6dcb4" unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea}; // "b 0x6dcb4"
patch((void *) 0x6dc70, server_patch); patch((void *) 0x6dc70, server_patch);
} }

View File

@ -40,7 +40,7 @@ static int32_t MouseBuildInput_tickBuild_injection(unsigned char *mouse_build_in
// Init // Init
void _init_attack() { void _init_attack() {
// Allow Attacking Mobs // Allow Attacking Mobs
if (feature_has("Fix Attacking", 0)) { if (feature_has("Fix Attacking", server_disabled)) {
patch_address(MouseBuildInput_tickBuild_vtable_addr, (void *) MouseBuildInput_tickBuild_injection); patch_address(MouseBuildInput_tickBuild_vtable_addr, (void *) MouseBuildInput_tickBuild_injection);
} }
} }

View File

@ -31,6 +31,6 @@ static void _handle_bow(unsigned char *minecraft) {
// Init // Init
void _init_bow() { void _init_bow() {
// Enable Bow & Arrow Fix // Enable Bow & Arrow Fix
fix_bow = feature_has("Fix Bow & Arrow", 0); fix_bow = feature_has("Fix Bow & Arrow", server_disabled);
input_run_on_tick(_handle_bow); input_run_on_tick(_handle_bow);
} }

View File

@ -86,6 +86,6 @@ static void _handle_drop(unsigned char *minecraft) {
// Init // Init
void _init_drop() { void _init_drop() {
enable_drop = feature_has("Bind \"Q\" Key To Item Dropping", 0); enable_drop = feature_has("Bind \"Q\" Key To Item Dropping", server_disabled);
input_run_on_tick(_handle_drop); input_run_on_tick(_handle_drop);
} }

View File

@ -49,7 +49,7 @@ void init_input() {
_init_attack(); _init_attack();
// Disable Raw Mouse Motion // Disable Raw Mouse Motion
if (feature_has("Disable Raw Mouse Motion (Not Recommended)", 9)) { if (feature_has("Disable Raw Mouse Motion (Not Recommended)", server_disabled)) {
media_set_raw_mouse_motion_enabled(0); media_set_raw_mouse_motion_enabled(0);
} }
} }

View File

@ -79,7 +79,7 @@ static void Gui_handleClick_injection(unsigned char *gui, int32_t param_2, int32
// Init // Init
void _init_misc() { void _init_misc() {
enable_misc = feature_has("Miscellaneous Input Fixes", 0); enable_misc = feature_has("Miscellaneous Input Fixes", server_disabled);
if (enable_misc) { if (enable_misc) {
// Fix OptionsScreen Ignoring The Back Button // Fix OptionsScreen Ignoring The Back Button
patch_address(OptionsScreen_handleBackEvent_vtable_addr, (void *) OptionsScreen_handleBackEvent_injection); patch_address(OptionsScreen_handleBackEvent_vtable_addr, (void *) OptionsScreen_handleBackEvent_injection);

View File

@ -37,6 +37,6 @@ static void _handle_toggle_options(unsigned char *minecraft) {
// Init // Init
void _init_toggle() { void _init_toggle() {
enable_toggles = feature_has("Bind Common Toggleable Options To Function Keys", 0); enable_toggles = feature_has("Bind Common Toggleable Options To Function Keys", server_disabled);
input_run_on_tick(_handle_toggle_options); input_run_on_tick(_handle_toggle_options);
} }

View File

@ -204,14 +204,14 @@ static void GameRenderer_render_injection(unsigned char *game_renderer, float pa
// Init // Init
void init_misc() { void init_misc() {
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas) // Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
if (feature_has("Remove Invalid Item Background", 0)) { if (feature_has("Remove Invalid Item Background", server_disabled)) {
unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x63c98, invalid_item_background_patch); patch((void *) 0x63c98, invalid_item_background_patch);
} }
// Render Selected Item Text + Hide Chat Messages // Render Selected Item Text + Hide Chat Messages
hide_chat_messages = feature_has("Hide Chat Messages", 0); hide_chat_messages = feature_has("Hide Chat Messages", server_disabled);
render_selected_item_text = feature_has("Render Selected Item Text", 0); render_selected_item_text = feature_has("Render Selected Item Text", server_disabled);
overwrite_calls((void *) Gui_renderChatMessages, (void *) Gui_renderChatMessages_injection); overwrite_calls((void *) Gui_renderChatMessages, (void *) Gui_renderChatMessages_injection);
overwrite_calls((void *) Gui_tick, (void *) Gui_tick_injection); overwrite_calls((void *) Gui_tick, (void *) Gui_tick_injection);
overwrite_calls((void *) Inventory_selectSlot, (void *) Inventory_selectSlot_injection); overwrite_calls((void *) Inventory_selectSlot, (void *) Inventory_selectSlot_injection);
@ -229,17 +229,17 @@ void init_misc() {
overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection); overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection);
// Close Current Screen On Death To Prevent Bugs // Close Current Screen On Death To Prevent Bugs
if (feature_has("Close Current Screen On Death", 0)) { if (feature_has("Close Current Screen On Death", server_disabled)) {
patch_address(LocalPlayer_die_vtable_addr, (void *) LocalPlayer_die_injection); patch_address(LocalPlayer_die_vtable_addr, (void *) LocalPlayer_die_injection);
} }
// Fix Furnace Not Checking Item Auxiliary When Inserting New Item // Fix Furnace Not Checking Item Auxiliary When Inserting New Item
if (feature_has("Fix Furnace Not Checking Item Auxiliary", 0)) { if (feature_has("Fix Furnace Not Checking Item Auxiliary", server_disabled)) {
overwrite_calls((void *) FurnaceScreen_handleAddItem, (void *) FurnaceScreen_handleAddItem_injection); overwrite_calls((void *) FurnaceScreen_handleAddItem, (void *) FurnaceScreen_handleAddItem_injection);
} }
// Improved Cursor Rendering // Improved Cursor Rendering
if (feature_has("Improved Cursor Rendering", 0)) { if (feature_has("Improved Cursor Rendering", server_disabled)) {
// Disable Normal Cursor Rendering // Disable Normal Cursor Rendering
unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x4a6c0, disable_cursor_patch); patch((void *) 0x4a6c0, disable_cursor_patch);
@ -248,7 +248,7 @@ void init_misc() {
} }
// Disable V-Sync // Disable V-Sync
if (feature_has("Disable V-Sync", 0)) { if (feature_has("Disable V-Sync", server_disabled)) {
media_disable_vsync(); media_disable_vsync();
} }

View File

@ -48,7 +48,7 @@ static void Minecraft_update_injection(unsigned char *minecraft) {
// Init // Init
void _init_misc_cpp() { void _init_misc_cpp() {
// Implement AppPlatform::readAssetFile So Translations Work // Implement AppPlatform::readAssetFile So Translations Work
if (feature_has("Load Language Files", 1)) { if (feature_has("Load Language Files", server_enabled)) {
overwrite((void *) AppPlatform_readAssetFile, (void *) AppPlatform_readAssetFile_injection); overwrite((void *) AppPlatform_readAssetFile, (void *) AppPlatform_readAssetFile_injection);
} }

View File

@ -127,7 +127,7 @@ static void RakNetInstance_pingForHosts_injection(unsigned char *rak_net_instanc
// Init // Init
void init_multiplayer() { void init_multiplayer() {
// Inject Code // Inject Code
if (feature_has("External Server Support", 0)) { if (feature_has("External Server Support", server_disabled)) {
patch_address(RakNetInstance_pingForHosts_vtable_addr, (void *) RakNetInstance_pingForHosts_injection); patch_address(RakNetInstance_pingForHosts_vtable_addr, (void *) RakNetInstance_pingForHosts_injection);
} }
} }

View File

@ -72,16 +72,16 @@ static void Minecraft_init_injection(unsigned char *this) {
// Init // Init
void init_options() { void init_options() {
// Force Mob Spawning // Force Mob Spawning
if (feature_has("Force Mob Spawning", -1)) { if (feature_has("Force Mob Spawning", server_auto)) {
overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection); overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection);
} }
// Enable Fancy Graphics // Enable Fancy Graphics
fancy_graphics = feature_has("Fancy Graphics", 0); fancy_graphics = feature_has("Fancy Graphics", server_disabled);
// Peaceful Mode // Peaceful Mode
peaceful_mode = feature_has("Peaceful Mode", -1); peaceful_mode = feature_has("Peaceful Mode", server_auto);
// 3D Anaglyph // 3D Anaglyph
anaglyph = feature_has("3D Anaglyph", 0); anaglyph = feature_has("3D Anaglyph", server_disabled);
// Render Distance // Render Distance
#ifndef MCPI_SERVER_MODE #ifndef MCPI_SERVER_MODE
render_distance = get_render_distance(); render_distance = get_render_distance();
@ -90,7 +90,7 @@ void init_options() {
render_distance = 3; render_distance = 3;
#endif #endif
// Server Visible // Server Visible
server_visible = !feature_has("Disable Hosting LAN Worlds", 0); server_visible = !feature_has("Disable Hosting LAN Worlds", server_disabled);
// Set Options // Set Options
overwrite_calls((void *) Minecraft_init, (void *) Minecraft_init_injection); overwrite_calls((void *) Minecraft_init, (void *) Minecraft_init_injection);
@ -106,12 +106,12 @@ void init_options() {
patch_address((void *) default_username, (void *) username); patch_address((void *) default_username, (void *) username);
// Disable Autojump By Default // Disable Autojump By Default
if (feature_has("Disable Autojump By Default", 0)) { if (feature_has("Disable Autojump By Default", server_disabled)) {
unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0"
patch((void *) 0x44b90, autojump_patch); patch((void *) 0x44b90, autojump_patch);
} }
// Display Nametags By Default // Display Nametags By Default
if (feature_has("Display Nametags By Default", 0)) { if (feature_has("Display Nametags By Default", server_disabled)) {
// r6 = 0x1 // r6 = 0x1
// r5 = 0x0 // r5 = 0x0
unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5}; // "strb r6, [r0, #0x1d]" unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5}; // "strb r6, [r0, #0x1d]"
@ -119,7 +119,7 @@ void init_options() {
} }
// Enable Smooth Lighting // Enable Smooth Lighting
smooth_lighting = feature_has("Smooth Lighting", 0); smooth_lighting = feature_has("Smooth Lighting", server_disabled);
if (smooth_lighting) { if (smooth_lighting) {
unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3}; // "cmp r3, #0x1" unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3}; // "cmp r3, #0x1"
patch((void *) 0x59ea4, smooth_lighting_patch); patch((void *) 0x59ea4, smooth_lighting_patch);

View File

@ -58,7 +58,7 @@ static void TextEditScreen_updateEvents_injection(unsigned char *screen) {
// Init // Init
void init_sign() { void init_sign() {
if (feature_has("Fix Sign Placement", 0)) { if (feature_has("Fix Sign Placement", server_disabled)) {
// Fix Signs // Fix Signs
patch_address(LocalPlayer_openTextEdit_vtable_addr, (void *) LocalPlayer_openTextEdit_injection); patch_address(LocalPlayer_openTextEdit_vtable_addr, (void *) LocalPlayer_openTextEdit_injection);
patch_address(TextEditScreen_updateEvents_vtable_addr, (void *) TextEditScreen_updateEvents_injection); patch_address(TextEditScreen_updateEvents_vtable_addr, (void *) TextEditScreen_updateEvents_injection);

View File

@ -114,7 +114,7 @@ static void SoundEngine_init_injection(unsigned char *sound_engine, unsigned cha
// Init // Init
void init_sound() { void init_sound() {
// Implement Sound Engine // Implement Sound Engine
if (feature_has("Implement Sound Engine", 0)) { if (feature_has("Implement Sound Engine", server_disabled)) {
overwrite_calls((void *) SoundEngine_playUI, (void *) SoundEngine_playUI_injection); overwrite_calls((void *) SoundEngine_playUI, (void *) SoundEngine_playUI_injection);
overwrite_calls((void *) SoundEngine_play, (void *) SoundEngine_play_injection); overwrite_calls((void *) SoundEngine_play, (void *) SoundEngine_play_injection);
overwrite_calls((void *) SoundEngine_update, (void *) SoundEngine_update_injection); overwrite_calls((void *) SoundEngine_update, (void *) SoundEngine_update_injection);

View File

@ -166,7 +166,7 @@ static void Textures_tick_glTexSubImage2D_injection(GLenum target, GLint level,
// Init // Init
void init_textures() { void init_textures() {
// Tick Dynamic Textures (Animated Water) // Tick Dynamic Textures (Animated Water)
if (feature_has("Animated Water", 0)) { if (feature_has("Animated Water", server_disabled)) {
overwrite_calls((void *) Minecraft_tick, (void *) Minecraft_tick_injection); overwrite_calls((void *) Minecraft_tick, (void *) Minecraft_tick_injection);
} }

View File

@ -12,7 +12,7 @@ static int32_t Minecraft_isTouchscreen_injection(__attribute__((unused)) unsigne
// Init // Init
void init_touch() { void init_touch() {
int touch_gui = feature_has("Touch GUI", 0); int touch_gui = feature_has("Touch GUI", server_disabled);
if (touch_gui) { if (touch_gui) {
// Main UI // Main UI
overwrite((void *) Minecraft_isTouchscreen, (void *) Minecraft_isTouchscreen_injection); overwrite((void *) Minecraft_isTouchscreen, (void *) Minecraft_isTouchscreen_injection);

View File

@ -131,9 +131,7 @@ const runtime = {
`usr/lib/${name}/minecraft-pi`, `usr/lib/${name}/minecraft-pi`,
`usr/lib/${name}/**/*.so`, `usr/lib/${name}/**/*.so`,
'usr/arm-linux-gnueabihf/lib' 'usr/arm-linux-gnueabihf/lib'
] : undefined, ] : undefined
// libapprun_hooks.so Is Buggy And Unneeded
no_hooks: true
}; };
// AppDir // AppDir

View File

@ -118,4 +118,4 @@ sudo rm -f /usr/local/bin/appimagetool
sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
# Install appimage-builder # Install appimage-builder
sudo pip3 install 'git+https://github.com/TheBrokenRail/appimage-builder.git@combined' sudo pip3 install 'git+https//github.com/AppImageCrafters/appimage-builder.git'