diff --git a/dependencies/minecraft-pi/CMakeLists.txt b/dependencies/minecraft-pi/CMakeLists.txt index b7c4f724..638ec17f 100644 --- a/dependencies/minecraft-pi/CMakeLists.txt +++ b/dependencies/minecraft-pi/CMakeLists.txt @@ -7,7 +7,7 @@ include(FetchContent) # Download FetchContent_Declare( minecraft-pi - URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.1.tar.gz" + URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.0.tar.gz" ) FetchContent_Populate(minecraft-pi) diff --git a/dependencies/minecraft-pi/minecraft-pi-0.1.0.tar.gz b/dependencies/minecraft-pi/minecraft-pi-0.1.0.tar.gz new file mode 100644 index 00000000..4be74a78 Binary files /dev/null and b/dependencies/minecraft-pi/minecraft-pi-0.1.0.tar.gz differ diff --git a/dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz b/dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz deleted file mode 100644 index 1bb0c93f..00000000 Binary files a/dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz and /dev/null differ diff --git a/example-mods/expanded-creative/expanded-creative.cpp b/example-mods/expanded-creative/expanded-creative.cpp index bda94624..b0a7a753 100644 --- a/example-mods/expanded-creative/expanded-creative.cpp +++ b/example-mods/expanded-creative/expanded-creative.cpp @@ -378,146 +378,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsig bread_instance->id = 297; (*FillingContainer_addItem)(filling_container, bread_instance); - ItemInstance *diamondHelm_instance = new ItemInstance; - ALLOC_CHECK(diamondHelm_instance); - diamondHelm_instance->count = 255; - diamondHelm_instance->auxiliary = 0; - diamondHelm_instance->id = 310; - (*FillingContainer_addItem)(filling_container, diamondHelm_instance); - - ItemInstance *diamondChest_instance = new ItemInstance; - ALLOC_CHECK(diamondChest_instance); - diamondChest_instance->count = 255; - diamondChest_instance->auxiliary = 0; - diamondChest_instance->id = 311; - (*FillingContainer_addItem)(filling_container, diamondChest_instance); - - ItemInstance *diamondLeg_instance = new ItemInstance; - ALLOC_CHECK(diamondLeg_instance); - diamondLeg_instance->count = 255; - diamondLeg_instance->auxiliary = 0; - diamondLeg_instance->id = 312; - (*FillingContainer_addItem)(filling_container, diamondLeg_instance); - - ItemInstance *diamondBoot_instance = new ItemInstance; - ALLOC_CHECK(diamondBoot_instance); - diamondBoot_instance->count = 255; - diamondBoot_instance->auxiliary = 0; - diamondBoot_instance->id = 313; - (*FillingContainer_addItem)(filling_container, diamondBoot_instance); - - ItemInstance *leatherCap_instance = new ItemInstance; - ALLOC_CHECK(leatherCap_instance); - leatherCap_instance->count = 255; - leatherCap_instance->auxiliary = 0; - leatherCap_instance->id = 298; - (*FillingContainer_addItem)(filling_container, leatherCap_instance); - - ItemInstance *leatherShirt_instance = new ItemInstance; - ALLOC_CHECK(leatherShirt_instance); - leatherShirt_instance->count = 255; - leatherShirt_instance->auxiliary = 0; - leatherShirt_instance->id = 299; - (*FillingContainer_addItem)(filling_container, leatherShirt_instance); - - ItemInstance *leatherPants_instance = new ItemInstance; - ALLOC_CHECK(leatherPants_instance); - leatherPants_instance->count = 255; - leatherPants_instance->auxiliary = 0; - leatherPants_instance->id = 300; - (*FillingContainer_addItem)(filling_container, leatherPants_instance); - - ItemInstance *leatherBoots_instance = new ItemInstance; - ALLOC_CHECK(leatherBoots_instance); - leatherBoots_instance->count = 255; - leatherBoots_instance->auxiliary = 0; - leatherBoots_instance->id = 301; - (*FillingContainer_addItem)(filling_container, leatherBoots_instance); - - ItemInstance *chainHelm_instance = new ItemInstance; - ALLOC_CHECK(chainHelm_instance); - chainHelm_instance->count = 255; - chainHelm_instance->auxiliary = 0; - chainHelm_instance->id = 302; - (*FillingContainer_addItem)(filling_container, chainHelm_instance); - - ItemInstance *chainShirt_instance = new ItemInstance; - ALLOC_CHECK(chainShirt_instance); - chainShirt_instance->count = 255; - chainShirt_instance->auxiliary = 0; - chainShirt_instance->id = 303; - (*FillingContainer_addItem)(filling_container, chainShirt_instance); - - ItemInstance *chainLegs_instance = new ItemInstance; - ALLOC_CHECK(chainLegs_instance); - chainLegs_instance->count = 255; - chainLegs_instance->auxiliary = 0; - chainLegs_instance->id = 304; - (*FillingContainer_addItem)(filling_container, chainLegs_instance); - - ItemInstance *chainBoots_instance = new ItemInstance; - ALLOC_CHECK(chainBoots_instance); - chainBoots_instance->count = 255; - chainBoots_instance->auxiliary = 0; - chainBoots_instance->id = 305; - (*FillingContainer_addItem)(filling_container, chainBoots_instance); - - ItemInstance *goldHelm_instance = new ItemInstance; - ALLOC_CHECK(goldHelm_instance); - goldHelm_instance->count = 255; - goldHelm_instance->auxiliary = 0; - goldHelm_instance->id = 314; - (*FillingContainer_addItem)(filling_container, goldHelm_instance); - - ItemInstance *goldChest_instance = new ItemInstance; - ALLOC_CHECK(goldChest_instance); - goldChest_instance->count = 255; - goldChest_instance->auxiliary = 0; - goldChest_instance->id = 315; - (*FillingContainer_addItem)(filling_container, goldChest_instance); - - ItemInstance *goldLegs_instance = new ItemInstance; - ALLOC_CHECK(goldLegs_instance); - goldLegs_instance->count = 255; - goldLegs_instance->auxiliary = 0; - goldLegs_instance->id = 316; - (*FillingContainer_addItem)(filling_container, goldLegs_instance); - - ItemInstance *goldBoots_instance = new ItemInstance; - ALLOC_CHECK(goldBoots_instance); - goldBoots_instance->count = 255; - goldBoots_instance->auxiliary = 0; - goldBoots_instance->id = 317; - (*FillingContainer_addItem)(filling_container, goldBoots_instance); - - ItemInstance *ironHelm_instance = new ItemInstance; - ALLOC_CHECK(ironHelm_instance); - ironHelm_instance->count = 255; - ironHelm_instance->auxiliary = 0; - ironHelm_instance->id = 306; - (*FillingContainer_addItem)(filling_container, ironHelm_instance); - - ItemInstance *ironChest_instance = new ItemInstance; - ALLOC_CHECK(ironChest_instance); - ironChest_instance->count = 255; - ironChest_instance->auxiliary = 0; - ironChest_instance->id = 307; - (*FillingContainer_addItem)(filling_container, ironChest_instance); - - ItemInstance *ironLegs_instance = new ItemInstance; - ALLOC_CHECK(ironLegs_instance); - ironLegs_instance->count = 255; - ironLegs_instance->auxiliary = 0; - ironLegs_instance->id = 308; - (*FillingContainer_addItem)(filling_container, ironLegs_instance); - - ItemInstance *ironBoots_instance = new ItemInstance; - ALLOC_CHECK(ironBoots_instance); - ironBoots_instance->count = 255; - ironBoots_instance->auxiliary = 0; - ironBoots_instance->id = 309; - (*FillingContainer_addItem)(filling_container, ironBoots_instance); - ItemInstance *flint2_instance = new ItemInstance; ALLOC_CHECK(flint2_instance); flint2_instance->count = 255; diff --git a/images/start.png b/images/start.png index 72cee4f1..6ce342fa 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 4bc5500e..474e97a2 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -1,16 +1,17 @@ FALSE Full Touch GUI -TRUE Fix Bow & Arrow TRUE Fix Attacking FALSE Force Mob Spawning +TRUE Fancy Graphics TRUE Disable Autojump By Default TRUE Display Nametags By Default -TRUE Fix Sign Placement TRUE Show Block Outlines FALSE Expand Creative Inventory FALSE Remove Creative Mode Restrictions +FALSE Peaceful Mode TRUE Animated Water TRUE Remove Invalid Item Background TRUE Disable "gui_blocks" Atlas +TRUE Smooth Lighting FALSE 3D Anaglyph TRUE Fix Camera Rendering TRUE Implement Chat @@ -28,9 +29,9 @@ TRUE Implement Sound Engine TRUE Close Current Screen On Death FALSE Disable Raw Mouse Motion (Not Recommended) TRUE Fix Furnace Not Checking Item Auxiliary +FALSE Disable Hosting LAN Worlds TRUE Improved Cursor Rendering TRUE Disable V-Sync -TRUE Fix Options Screen TRUE Force Touch GUI Inventory TRUE Fix Pause Menu TRUE Improved Title Background diff --git a/mods/CMakeLists.txt b/mods/CMakeLists.txt index 3b94a90c..7977a8dd 100644 --- a/mods/CMakeLists.txt +++ b/mods/CMakeLists.txt @@ -20,7 +20,7 @@ if(NOT MCPI_HEADLESS_MODE) target_link_libraries(compat screenshot) endif() if(NOT MCPI_SERVER_MODE) - target_link_libraries(compat input sign chat home dl) + target_link_libraries(compat input chat home dl) endif() add_library(readdir SHARED src/readdir/readdir.c) @@ -62,12 +62,9 @@ else() target_link_libraries(camera screenshot) endif() - add_library(input SHARED src/input/input.cpp src/input/bow.c src/input/attack.c src/input/toggle.c src/input/misc.c src/input/drop.cpp) + add_library(input SHARED src/input/input.cpp src/input/attack.c src/input/toggle.c src/input/misc.c src/input/drop.cpp) target_link_libraries(input mods-headers reborn-patch symbols creative feature misc media-layer-core) - add_library(sign SHARED src/sign/sign.cpp) - target_link_libraries(sign mods-headers reborn-patch symbols feature input media-layer-core) - add_library(touch SHARED src/touch/touch.cpp) target_link_libraries(touch mods-headers reborn-patch symbols feature) @@ -90,8 +87,8 @@ target_link_libraries(death mods-headers reborn-patch symbols feature) add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp src/misc/logging.cpp src/misc/api.cpp) target_link_libraries(misc mods-headers reborn-patch symbols media-layer-core feature) -add_library(options SHARED src/options/options.c src/options/options.cpp) -target_link_libraries(options mods-headers reborn-patch symbols feature home) +add_library(options SHARED src/options/options.c) +target_link_libraries(options mods-headers reborn-patch symbols feature) add_library(bucket SHARED src/bucket/bucket.cpp) target_link_libraries(bucket mods-headers reborn-patch symbols feature misc) @@ -112,7 +109,7 @@ target_link_libraries(init mods-headers reborn-util compat game-mode misc death if(MCPI_SERVER_MODE) target_link_libraries(init server) else() - target_link_libraries(init multiplayer sound camera input sign touch textures atlas benchmark) + target_link_libraries(init multiplayer sound camera input touch textures atlas benchmark) endif() ## Install Mods @@ -120,7 +117,7 @@ set(MODS_TO_INSTALL init compat readdir feature game-mode misc override death op if(MCPI_SERVER_MODE) list(APPEND MODS_TO_INSTALL server) else() - list(APPEND MODS_TO_INSTALL multiplayer sound camera input sign touch textures atlas benchmark) + list(APPEND MODS_TO_INSTALL multiplayer sound camera input touch textures atlas benchmark) endif() if(NOT MCPI_HEADLESS_MODE) list(APPEND MODS_TO_INSTALL screenshot) diff --git a/mods/include/mods/init/init.h b/mods/include/mods/init/init.h index 2b4793e5..6f550a69 100644 --- a/mods/include/mods/init/init.h +++ b/mods/include/mods/init/init.h @@ -15,7 +15,6 @@ void init_server(); void init_multiplayer(); void init_sound(); void init_input(); -void init_sign(); void init_creative(); void init_camera(); void init_touch(); diff --git a/mods/include/mods/input/input.h b/mods/include/mods/input/input.h index 1771a2fa..b350133e 100644 --- a/mods/include/mods/input/input.h +++ b/mods/include/mods/input/input.h @@ -7,7 +7,6 @@ extern "C" { typedef void (*input_tick_function_t)(unsigned char *minecraft); void input_run_on_tick(input_tick_function_t function); -void input_set_is_right_click(int val); void input_hide_gui(); void input_third_person(); int input_back(); diff --git a/mods/include/mods/misc/misc.h b/mods/include/mods/misc/misc.h index 9e08cfcc..690d69b2 100644 --- a/mods/include/mods/misc/misc.h +++ b/mods/include/mods/misc/misc.h @@ -15,6 +15,7 @@ void misc_run_on_recipes_setup(misc_update_function_t function); // obj == Recip void misc_run_on_furnace_recipes_setup(misc_update_function_t function); // obj == FurnaceRecipes * void misc_run_on_creative_inventory_setup(misc_update_function_t function); // obj == FillingContainer * void misc_run_on_tiles_setup(misc_update_function_t function); // obj == NULL +void misc_run_on_internal_after_tiles_setup(misc_update_function_t function); // obj == NULL void misc_run_on_items_setup(misc_update_function_t function); // obj == NULL void Level_saveLevelData_injection(unsigned char *level); diff --git a/mods/include/mods/sign/sign.h b/mods/include/mods/sign/sign.h deleted file mode 100644 index fd654311..00000000 --- a/mods/include/mods/sign/sign.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -void sign_key_press(char key); - -#ifdef __cplusplus -} -#endif diff --git a/mods/src/atlas/atlas.cpp b/mods/src/atlas/atlas.cpp index af0fe2a7..2c3b5560 100644 --- a/mods/src/atlas/atlas.cpp +++ b/mods/src/atlas/atlas.cpp @@ -57,9 +57,9 @@ static void Tesselator_color_injection(unsigned char *tesselator, int32_t r, int // Call Original Method (*Tesselator_color)(tesselator, r, g, b, a); } -static void Tesselator_begin_injection(unsigned char *tesselator, int32_t mode) { +static void Tesselator_begin_injection(unsigned char *tesselator) { // Call Original Method - (*Tesselator_begin)(tesselator, mode); + (*Tesselator_begin)(tesselator); // Fix Furnace UI if (item_color_fix_mode != 0) { @@ -96,14 +96,14 @@ void init_atlas() { // Disable The gui_blocks Atlas Which Contains Pre-Rendered Textures For Blocks In The Inventory if (feature_has("Disable \"gui_blocks\" Atlas", server_disabled)) { - unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x63c2c, disable_gui_blocks_atlas_patch); + unsigned char disable_gui_blocks_atlas_patch[4] = {0x45, 0x00, 0x00, 0xea}; // "b 0x7f740" + patch((void *) 0x7f624, disable_gui_blocks_atlas_patch); // Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled overwrite_calls((void *) ItemRenderer_renderGuiItemCorrect, (void *) ItemRenderer_renderGuiItemCorrect_injection); // Fix Furnace UI overwrite_calls((void *) Tesselator_begin, (void *) Tesselator_begin_injection); overwrite_calls((void *) Tesselator_color, (void *) Tesselator_color_injection); - overwrite_call((void *) 0x32324, (void *) FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection); - overwrite_call((void *) 0x1e21c, (void *) InventoryPane_renderBatch_Tesselator_color_injection); + overwrite_call((void *) 0x3bff4, (void *) FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection); + overwrite_call((void *) 0x23c0c, (void *) InventoryPane_renderBatch_Tesselator_color_injection); } } diff --git a/mods/src/bucket/bucket.cpp b/mods/src/bucket/bucket.cpp index 26a0fff7..dc250683 100644 --- a/mods/src/bucket/bucket.cpp +++ b/mods/src/bucket/bucket.cpp @@ -146,7 +146,7 @@ static unsigned char *create_bucket(int32_t id, int32_t texture_x, int32_t textu // Construct unsigned char *item = (unsigned char *) ::operator new(ITEM_SIZE); ALLOC_CHECK(item); - (*Item)(item, id); + new ((std::string *) (item + Item_description_id_property_offset)) std::string; // Set VTable *(unsigned char **) item = get_bucket_vtable(); @@ -159,10 +159,16 @@ static unsigned char *create_bucket(int32_t id, int32_t texture_x, int32_t textu // Setup (*Item_setIcon)(item, texture_x, texture_y); (*Item_setDescriptionId)(item, name); + *(int32_t *) (item + Item_id_property_offset) = id + 0x100; *(int32_t *) (item + Item_is_stacked_by_data_property_offset) = 1; - *(int32_t *) (item + Item_category_property_offset) = 2; + *(int32_t *) (item + Item_is_hand_equipped_property_offset) = 0; + *(int32_t *) (item + Item_category_property_offset) = 1; *(int32_t *) (item + Item_max_damage_property_offset) = 0; - *(int32_t *) (item + Item_max_stack_size_property_offset) = 1; + *(int32_t *) (item + Item_max_stack_size_property_offset) = 16; + *(unsigned char **) (item + Item_crafting_remaining_item_property_offset) = NULL; + + // Register + Item_items[*(int32_t *) (item + Item_id_property_offset)] = item; // Return return item; @@ -173,9 +179,9 @@ static void Item_initItems_injection(__attribute__((unused)) unsigned char *null // Change Max Stack Size Based On Auxiliary static int32_t ItemInstance_getMaxStackSize_injection(ItemInstance *item_instance) { - if (item_instance->id == *(int32_t *) (bucket + Item_id_property_offset) && item_instance->auxiliary == 0) { + if (item_instance->id == *(int32_t *) (bucket + Item_id_property_offset) && item_instance->auxiliary != 0) { // Custom Value - return 16; + return 1; } else { // Call Original Method return (*ItemInstance_getMaxStackSize)(item_instance); @@ -299,7 +305,7 @@ void init_bucket() { // Creative Inventory misc_run_on_creative_inventory_setup(Inventory_setupDefault_FillingContainer_addItem_call_injection); // Make Liquids Selectable - overwrite_call((void *) 0x7f5b0, (void *) Mob_pick_Level_clip_injection); + overwrite_call((void *) 0xab594, (void *) Mob_pick_Level_clip_injection); misc_run_on_tick(handle_tick); // Prevent Breaking Liquid overwrite_calls((void *) Minecraft_handleMouseDown, (void *) Minecraft_handleMouseDown_injection); @@ -307,6 +313,6 @@ void init_bucket() { misc_run_on_recipes_setup(Recipes_injection); // Custom Furnace Fuel overwrite_calls((void *) FurnaceTileEntity_getBurnDuration, (void *) FurnaceTileEntity_getBurnDuration_injection); - overwrite_call((void *) 0xd351c, (void *) FurnaceTileEntity_tick_ItemInstance_setNull_injection); + overwrite_call((void *) 0x14048c, (void *) FurnaceTileEntity_tick_ItemInstance_setNull_injection); } } diff --git a/mods/src/camera/camera.cpp b/mods/src/camera/camera.cpp index 6319b215..835085db 100644 --- a/mods/src/camera/camera.cpp +++ b/mods/src/camera/camera.cpp @@ -43,6 +43,6 @@ void init_camera() { // Enable TripodCameraRenderer overwrite_calls((void *) EntityRenderDispatcher, (void *) EntityRenderDispatcher_injection); // Display Smoke From TripodCamera Higher - overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection); + overwrite_call((void *) 0xbcf18, (void *) TripodCamera_tick_Level_addParticle_call_injection); } } diff --git a/mods/src/chat/chat.cpp b/mods/src/chat/chat.cpp index 6b753355..e203646f 100644 --- a/mods/src/chat/chat.cpp +++ b/mods/src/chat/chat.cpp @@ -87,7 +87,8 @@ static void CommandServer_parse_CommandServer_dispatchPacket_injection(unsigned // Handle ChatPacket Server-Side static void ServerSideNetworkHandler_handle_ChatPacket_injection(unsigned char *server_side_network_handler, RakNet_RakNetGUID *rak_net_guid, unsigned char *chat_packet) { - unsigned char *player = (*ServerSideNetworkHandler_getPlayer)(server_side_network_handler, rak_net_guid); + unsigned char *level = *(unsigned char **) (server_side_network_handler + ServerSideNetworkHandler_level_property_offset); + unsigned char *player = (*NetEventCallback_findPlayer)(server_side_network_handler, level, rak_net_guid); if (player != NULL) { char *username = *(char **) (player + Player_username_property_offset); char *message = *(char **) (chat_packet + ChatPacket_message_property_offset); @@ -138,9 +139,9 @@ void init_chat() { if (_chat_enabled) { // Disable Original ChatPacket Loopback unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x6b490, disable_chat_packet_loopback_patch); + patch((void *) 0x8c118, disable_chat_packet_loopback_patch); // Manually Send (And Loopback) ChatPacket - overwrite_call((void *) 0x6b518, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection); + overwrite_call((void *) 0x8c1a4, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection); // Re-Broadcast ChatPacket patch_address(ServerSideNetworkHandler_handle_ChatPacket_vtable_addr, (void *) ServerSideNetworkHandler_handle_ChatPacket_injection); // Send Messages On Input Tick diff --git a/mods/src/compat/bcm_host.c b/mods/src/compat/bcm_host.c index 954c4272..3e7a8c80 100644 --- a/mods/src/compat/bcm_host.c +++ b/mods/src/compat/bcm_host.c @@ -8,11 +8,11 @@ static void do_nothing() { // Patch bcm_host Calls __attribute__((constructor)) static void patch_bcm_host_calls() { // Disable bcm_host Calls - overwrite_call((void *) 0xdfec, (void *) do_nothing); // bcm_host_init - overwrite_call((void *) 0x12418, (void *) do_nothing); // bcm_host_deinit - overwrite_call((void *) 0x125a8, (void *) do_nothing); // graphics_get_display_size - overwrite_call((void *) 0x125dc, (void *) do_nothing); // vc_dispmanx_display_open - overwrite_call((void *) 0x125e8, (void *) do_nothing); // vc_dispmanx_update_start - overwrite_call((void *) 0x12618, (void *) do_nothing); // vc_dispmanx_element_add - overwrite_call((void *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync + overwrite_call((void *) 0xdbe8, (void *) do_nothing); // bcm_host_init + overwrite_call((void *) 0x11c54, (void *) do_nothing); // bcm_host_deinit + overwrite_call((void *) 0x11de4, (void *) do_nothing); // graphics_get_display_size + overwrite_call((void *) 0x11e18, (void *) do_nothing); // vc_dispmanx_display_open + overwrite_call((void *) 0x11e28, (void *) do_nothing); // vc_dispmanx_update_start + overwrite_call((void *) 0x11e58, (void *) do_nothing); // vc_dispmanx_element_add + overwrite_call((void *) 0x11e64, (void *) do_nothing); // vc_dispmanx_update_submit_sync } diff --git a/mods/src/compat/compat.c b/mods/src/compat/compat.c index 29e8f5f7..0c8249bb 100644 --- a/mods/src/compat/compat.c +++ b/mods/src/compat/compat.c @@ -29,7 +29,6 @@ HOOK(SDL_ShowCursor, int, (int toggle)) { #include #include -#include #include #include @@ -89,20 +88,12 @@ HOOK(SDL_PollEvent, int, (SDL_Event *event)) { } case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { - // Track Right-Click State - if (event->button.button == SDL_BUTTON_RIGHT) { - input_set_is_right_click(event->button.state != SDL_RELEASED); - } else if (event->button.button == SDL_BUTTON_LEFT) { + // Track Left-Click State + if (event->button.button == SDL_BUTTON_LEFT) { input_set_is_left_click(event->button.state != SDL_RELEASED); } break; } - case SDL_USEREVENT: { - // SDL_UserEvent Is Never Used In MCPI, So It Is Repurposed For Character Events - sign_key_press((char) event->user.code); - handled = 1; - break; - } } if (handled) { diff --git a/mods/src/compat/egl.c b/mods/src/compat/egl.c index 42fbf048..1042be80 100644 --- a/mods/src/compat/egl.c +++ b/mods/src/compat/egl.c @@ -23,17 +23,17 @@ static EGLBoolean eglSwapBuffers_injection(__attribute__((unused)) EGLDisplay di __attribute__((constructor)) static void patch_egl_calls() { // Disable EGL Calls unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x1250c, nop_patch); // eglTerminate - patch((void *) 0x12580, nop_patch); // eglBindAPI - overwrite_call((void *) 0x12638, (void *) eglCreateWindowSurface_injection); // eglCreateWindowSurface - patch((void *) 0x12578, nop_patch); // eglChooseConfig - patch((void *) 0x1255c, nop_patch); // eglInitialize - patch((void *) 0x124f0, nop_patch); // eglMakeCurrent #1 - patch((void *) 0x12654, nop_patch); // eglMakeCurrent #2 - overwrite_call((void *) 0x124dc, (void *) eglSwapBuffers_injection); // eglSwapBuffers #1 - overwrite_call((void *) 0x14b6c, (void *) eglSwapBuffers_injection); // eglSwapBuffers #2 - overwrite_call((void *) 0x1254c, (void *) eglGetDisplay_injection); // eglGetDisplay - patch((void *) 0x124fc, nop_patch); // eglDestroySurface #1 - patch((void *) 0x12504, nop_patch); // eglDestroySurface #2 - overwrite_call((void *) 0x12594, (void *) eglCreateContext_injection); // eglCreateContext + patch((void *) 0x11d3c, nop_patch); // eglTerminate + patch((void *) 0x11dbc, nop_patch); // eglBindAPI + overwrite_call((void *) 0x11e78, (void *) eglCreateWindowSurface_injection); // eglCreateWindowSurface + patch((void *) 0x11db4, nop_patch); // eglChooseConfig + patch((void *) 0x11d98, nop_patch); // eglInitialize + patch((void *) 0x11d20, nop_patch); // eglMakeCurrent #1 + patch((void *) 0x11e90, nop_patch); // eglMakeCurrent #2 + overwrite_call((void *) 0x11d0c, (void *) eglSwapBuffers_injection); // eglSwapBuffers #1 + overwrite_call((void *) 0x14ce4, (void *) eglSwapBuffers_injection); // eglSwapBuffers #2 + overwrite_call((void *) 0x11d7c, (void *) eglGetDisplay_injection); // eglGetDisplay + patch((void *) 0x11d2c, nop_patch); // eglDestroySurface #1 + patch((void *) 0x11d34, nop_patch); // eglDestroySurface #2 + overwrite_call((void *) 0x11dd0, (void *) eglCreateContext_injection); // eglCreateContext } diff --git a/mods/src/compat/x11.c b/mods/src/compat/x11.c index 27dbb73f..f246051c 100644 --- a/mods/src/compat/x11.c +++ b/mods/src/compat/x11.c @@ -23,6 +23,6 @@ static int XGetWindowAttributes_injection(__attribute__((unused)) void *display, // Patch X11 Calls __attribute__((constructor)) static void patch_x11_calls() { // Disable X11 Calls - overwrite_call((void *) 0x132a4, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes - overwrite_call((void *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates + overwrite_call((void *) 0x12f2c, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes + overwrite_call((void *) 0x12f64, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates } diff --git a/mods/src/creative/creative.cpp b/mods/src/creative/creative.cpp index 30a6df06..9c930cfd 100644 --- a/mods/src/creative/creative.cpp +++ b/mods/src/creative/creative.cpp @@ -1,3 +1,5 @@ +#include + #include #include @@ -37,7 +39,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsig // Add Tiles inventory_add_item(filling_container, *Tile_water, true); inventory_add_item(filling_container, *Tile_lava, true); - inventory_add_item(filling_container, *Tile_calmWater, true); inventory_add_item(filling_container, *Tile_calmLava, true); inventory_add_item(filling_container, *Tile_glowingObsidian, true); inventory_add_item(filling_container, *Tile_web, true); @@ -79,21 +80,37 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsig } #endif -// Hook Specific TileItem Constructor -static unsigned char *Tile_initTiles_TileItem_injection(unsigned char *tile_item, int32_t id) { +// Store All Default TileItems +static std::vector &get_default_tile_items() { + static std::vector tile_items; + return tile_items; +} +// Hook Specific TileItem :;operator new +static unsigned char *Tile_initTiles_operator_new_injection(__attribute__((unused)) uint32_t size) { // Call Original Method - unsigned char *ret = (*TileItem)(tile_item, id); + unsigned char *ret = (unsigned char *) ::operator new(AUX_DATA_TILE_ITEM_SIZE); - // Switch VTable - *(unsigned char **) tile_item = AuxDataTileItem_vtable; - // Configure Item - *(bool *) (tile_item + Item_is_stacked_by_data_property_offset) = true; - *(int32_t *) (tile_item + Item_max_damage_property_offset) = 0; - *(unsigned char **) (tile_item + AuxDataTileItem_icon_tile_property_offset) = Tile_tiles[id + 0x100]; + // Store + get_default_tile_items().push_back(ret); // Return return ret; } +// Modify All Default TileItems +static void Tile_initTiles_injection(__attribute__((unused)) unsigned char *null) { + // Loop + for (unsigned char *tile_item : get_default_tile_items()) { + // Get ID + int32_t id = *(int32_t *) (tile_item + Item_id_property_offset); + // Switch VTable + *(unsigned char **) tile_item = AuxDataTileItem_vtable; + // Configure Item + *(bool *) (tile_item + Item_is_stacked_by_data_property_offset) = true; + *(int32_t *) (tile_item + Item_max_damage_property_offset) = 0; + *(unsigned char **) (tile_item + AuxDataTileItem_icon_tile_property_offset) = Tile_tiles[id]; + } + get_default_tile_items().clear(); +} // Check Restriction Status static int is_restricted = 1; @@ -112,11 +129,10 @@ void init_creative() { // Use AuxDataTileItem by default instead of TileItem, so tiles in the Creative // Inventory can have arbitrary auxiliary values. { - // Fix Size - unsigned char size_patch[4] = {AUX_DATA_TILE_ITEM_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #AUX_DATA_TILE_ITEM_SIZE" - patch((void *) 0xc6f64, size_patch); - // Hook Constructor - overwrite_call((void *) 0xc6f74, (void *) Tile_initTiles_TileItem_injection); + // Hook TileItem ::operator new To Store TileItems + overwrite_call((void *) 0x1295a4, (void *) Tile_initTiles_operator_new_injection); + // Modify Stored TileItems + misc_run_on_internal_after_tiles_setup(Tile_initTiles_injection); } } @@ -124,34 +140,35 @@ void init_creative() { if (feature_has("Remove Creative Mode Restrictions", server_disabled)) { unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" // Remove Restrictions - patch((void *) 0x43ee8, nop_patch); - patch((void *) 0x43f3c, nop_patch); - patch((void *) 0x43f8c, nop_patch); - patch((void *) 0x43fd8, nop_patch); - patch((void *) 0x99010, nop_patch); + patch((void *) 0x59e68, nop_patch); + patch((void *) 0x59ebc, nop_patch); + patch((void *) 0x59f10, nop_patch); + unsigned char allow_eating_patch[4] = {0x02, 0x00, 0x00, 0xea}; // "b 0xddcbc" + patch((void *) 0xddcac, allow_eating_patch); // Fix UI - patch((void *) 0x341c0, nop_patch); - patch((void *) 0x3adb4, nop_patch); - patch((void *) 0x3b374, nop_patch); + patch((void *) 0x4cb88, nop_patch); + unsigned char fix_ui_patch[4] = {0x05, 0x00, 0x55, 0xe1}; // "cmp r5, r5" + patch((void *) 0x4bf20, fix_ui_patch); // Fix Inventory + patch((void *) 0xcce90, nop_patch); + patch((void *) 0xd5548, nop_patch); + unsigned char inv_creative_check_r3_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3" + patch((void *) 0xd497c, inv_creative_check_r3_patch); + unsigned char inv_creative_check_r5_patch[4] = {0x05, 0x00, 0x55, 0xe1}; // "cmp r5, r5" + patch((void *) 0xd4d94, inv_creative_check_r5_patch); + patch((void *) 0xd50ac, nop_patch); patch((void *) 0x8d080, nop_patch); patch((void *) 0x8d090, nop_patch); - patch((void *) 0x91d48, nop_patch); - patch((void *) 0x92098, nop_patch); - unsigned char inv_creative_check_r3_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3" - patch((void *) 0x923c0, inv_creative_check_r3_patch); - patch((void *) 0x92828, nop_patch); - patch((void *) 0x92830, nop_patch); // Display Slot Count - patch((void *) 0x1e3f4, nop_patch); - unsigned char slot_count_patch[4] = {0x18, 0x00, 0x00, 0xea}; // "b 0x27110" - patch((void *) 0x270a8, slot_count_patch); - patch((void *) 0x33954, nop_patch); + patch((void *) 0x23d4c, nop_patch); + patch((void *) 0x2c570, nop_patch); + patch((void *) 0x3eec0, nop_patch); // Maximize Creative Inventory Stack Size - unsigned char maximize_stack_patch[4] = {0xff, 0xc0, 0xa0, 0xe3}; // "mov r12, 0xff" - patch((void *) 0x8e104, maximize_stack_patch); + unsigned char maximize_stack_patch[4] = {0xff, 0x60, 0xa0, 0xe3}; // "mov r6, 0xff" + patch((void *) 0xccf80, maximize_stack_patch); // Allow Nether Reactor - patch((void *) 0xc0290, nop_patch); + unsigned char nether_reactor_patch[4] = {0x00, 0x00, 0xa0, 0xe3}; // "mov r0, #0x0" + patch((void *) 0x12283c, nether_reactor_patch); // Disable Other Restrictions is_restricted = 0; } diff --git a/mods/src/game-mode/game-mode.c b/mods/src/game-mode/game-mode.c index 8123e339..121e1d69 100644 --- a/mods/src/game-mode/game-mode.c +++ b/mods/src/game-mode/game-mode.c @@ -14,14 +14,14 @@ static void set_is_survival(int new_is_survival) { // Correct Inventpry UI unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1" - patch((void *) 0x16efc, inventory_patch); + patch((void *) 0x178c0, inventory_patch); // Use Correct Size For GameMode Object unsigned char size_patch[4] = {new_is_survival ? SURVIVAL_MODE_SIZE : CREATOR_MODE_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #SURVIVAL_MODE_SIZE" or "mov r0, #CREATOR_MODE_SIZE" - patch((void *) 0x16ee4, size_patch); + patch((void *) 0x178a8, size_patch); // Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor - overwrite_call((void *) 0x16ef4, new_is_survival ? SurvivalMode : CreatorMode); + overwrite_call((void *) 0x178b8, new_is_survival ? SurvivalMode : CreatorMode); is_survival = new_is_survival; } @@ -54,11 +54,11 @@ void init_game_mode() { overwrite_calls((void *) Minecraft_setIsCreativeMode, (void *) Minecraft_setIsCreativeMode_injection); // Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning) - overwrite_call((void *) 0x16f84, (void *) ServerLevel); + overwrite_call((void *) 0x17950, (void *) ServerLevel); // Allocate Correct Size For ServerLevel uint32_t level_size = SERVER_LEVEL_SIZE; - patch_address((void *) 0x17004, (void *) level_size); + patch_address((void *) 0x17a38, (void *) level_size); // Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing overwrite_calls((void *) Minecraft_getCreator, (void *) Minecraft_getCreator_injection); @@ -72,7 +72,7 @@ void init_game_mode() { // Allow Joining Survival Servers if (feature_has("Allow Joining Survival Servers", server_enabled)) { - unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea}; // "b 0x6dcb4" - patch((void *) 0x6dc70, server_patch); + unsigned char server_patch[4] = {0x16, 0x00, 0x00, 0xea}; // "b 0x8e998" + patch((void *) 0x8e938, server_patch); } } diff --git a/mods/src/home/home.c b/mods/src/home/home.c index 201ae15b..3170c81c 100644 --- a/mods/src/home/home.c +++ b/mods/src/home/home.c @@ -24,10 +24,8 @@ __attribute__((destructor)) static void _free_home() { // Init void init_home() { // Store Data In ~/.minecraft-pi Instead Of ~/.minecraft - patch_address((void *) default_path, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA); + patch_address((void *) full_data_path, (void *) home_get()); // The override code resolves assets manually, // making changing directory redundant. - unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0xe0ac, nop_patch); } diff --git a/mods/src/init/init.c b/mods/src/init/init.c index 129030bc..3ae158b0 100644 --- a/mods/src/init/init.c +++ b/mods/src/init/init.c @@ -15,7 +15,6 @@ __attribute__((constructor)) static void init() { init_multiplayer(); init_sound(); init_input(); - init_sign(); init_creative(); init_camera(); init_touch(); diff --git a/mods/src/input/bow.c b/mods/src/input/bow.c deleted file mode 100644 index a0f2bb9c..00000000 --- a/mods/src/input/bow.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -#include -#include "input-internal.h" -#include - -// Store Right-Click Status -static int is_right_click = 0; -void input_set_is_right_click(int val) { - is_right_click = val; -} - -// Enable Bow & Arrow Fix -static int fix_bow = 0; - -// Handle Bow & Arrow -static void _handle_bow(unsigned char *minecraft) { - if (fix_bow && !is_right_click) { - // GameMode Is Offset From minecraft By 0x160 - // Player Is Offset From minecraft By 0x18c - unsigned char *game_mode = *(unsigned char **) (minecraft + Minecraft_game_mode_property_offset); - unsigned char *player = *(unsigned char **) (minecraft + Minecraft_player_property_offset); - if (player != NULL && game_mode != NULL && (*Player_isUsingItem)(player)) { - unsigned char *game_mode_vtable = *(unsigned char **) game_mode; - GameMode_releaseUsingItem_t GameMode_releaseUsingItem = *(GameMode_releaseUsingItem_t *) (game_mode_vtable + GameMode_releaseUsingItem_vtable_offset); - (*GameMode_releaseUsingItem)(game_mode, player); - } - } -} - -// Init -void _init_bow() { - // Enable Bow & Arrow Fix - fix_bow = feature_has("Fix Bow & Arrow", server_disabled); - input_run_on_tick(_handle_bow); -} diff --git a/mods/src/input/input-internal.h b/mods/src/input/input-internal.h index 2b081c8a..efea5937 100644 --- a/mods/src/input/input-internal.h +++ b/mods/src/input/input-internal.h @@ -5,7 +5,6 @@ extern "C" { #endif __attribute__((visibility("internal"))) void _init_attack(); -__attribute__((visibility("internal"))) void _init_bow(); __attribute__((visibility("internal"))) void _init_misc(); __attribute__((visibility("internal"))) void _init_toggle(); __attribute__((visibility("internal"))) void _init_drop(); diff --git a/mods/src/input/input.cpp b/mods/src/input/input.cpp index 34303b52..ce24ed6e 100644 --- a/mods/src/input/input.cpp +++ b/mods/src/input/input.cpp @@ -40,9 +40,6 @@ void init_input() { // Item Dropping _init_drop(); - // Enable Bow & Arrow Fix - _init_bow(); - // Loop overwrite_calls((void *) Minecraft_tickInput, (void *) Minecraft_tickInput_injection); diff --git a/mods/src/input/misc.c b/mods/src/input/misc.c index 769d0b58..7cf01e7e 100644 --- a/mods/src/input/misc.c +++ b/mods/src/input/misc.c @@ -88,7 +88,7 @@ void _init_misc() { overwrite_calls((void *) Gui_handleClick, (void *) Gui_handleClick_injection); } // Disable Item Dropping Using The Cursor When Cursor Is Hidden - overwrite_call((void *) 0x27800, (void *) Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection); + overwrite_call((void *) 0x2b130, (void *) Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection); input_run_on_tick(_handle_back); input_run_on_tick(_handle_mouse_grab); diff --git a/mods/src/misc/api.cpp b/mods/src/misc/api.cpp index bc2e88a8..7d74d799 100644 --- a/mods/src/misc/api.cpp +++ b/mods/src/misc/api.cpp @@ -83,6 +83,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsig // Run Functions On Tiles Setup SETUP_CALLBACK(tiles_setup); +SETUP_CALLBACK(internal_after_tiles_setup); // Handle Custom Tiles Setup Behavior static void Tile_initTiles_injection() { // Run Functions @@ -90,6 +91,9 @@ static void Tile_initTiles_injection() { // Call Original Method (*Tile_initTiles)(); + + // Run Functions + handle_misc_internal_after_tiles_setup(NULL); } // Run Functions On Items Setup @@ -113,7 +117,7 @@ void _init_misc_api() { overwrite_calls((void *) Recipes, (void *) Recipes_injection); overwrite_calls((void *) FurnaceRecipes, (void *) FurnaceRecipes_injection); // Handle Custom Creative Inventory Setup Behavior - overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection); + overwrite_call((void *) 0xcdcf4, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection); // Handle Custom Item/Tile Init Behavior overwrite_calls((void *) Tile_initTiles, (void *) Tile_initTiles_injection); overwrite_calls((void *) Item_initItems, (void *) Item_initItems_injection); diff --git a/mods/src/misc/misc.c b/mods/src/misc/misc.c index 69a708f1..0c5fca70 100644 --- a/mods/src/misc/misc.c +++ b/mods/src/misc/misc.c @@ -36,17 +36,6 @@ static void Gui_renderHearts_GuiComponent_blit_hearts_injection(unsigned char *c // Call Original Method (*GuiComponent_blit)(component, x_dest, y_dest, x_src, y_src, width_dest, height_dest, width_src, height_src); } -static void Gui_renderHearts_GuiComponent_blit_armor_injection(unsigned char *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { - unsigned char *minecraft = *(unsigned char **) (component + Gui_minecraft_property_offset); - x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH; - float width = ((float) *(int32_t *) (minecraft + Minecraft_screen_width_property_offset)) * *InvGuiScale; - float height = ((float) *(int32_t *) (minecraft + Minecraft_screen_height_property_offset)) * *InvGuiScale; - x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH; - y_dest -= DEFAULT_HUD_PADDING; - y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING; - // Call Original Method - (*GuiComponent_blit)(component, x_dest, y_dest, x_src, y_src, width_dest, height_dest, width_src, height_src); -} static void Gui_renderBubbles_GuiComponent_blit_injection(unsigned char *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { unsigned char *minecraft = *(unsigned char **) (component + Gui_minecraft_property_offset); x_dest -= DEFAULT_HUD_PADDING; @@ -297,6 +286,11 @@ int32_t misc_get_real_selected_slot(unsigned char *player) { return selected_slot; } +// Stop Checking GL Renderer +static bool AppPlatform_isPowerVR_injection(__attribute__((unused)) unsigned char *app_platform) { + return 0; +} + // Init static void nop() { } @@ -304,17 +298,16 @@ void init_misc() { // 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", server_disabled)) { unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x63c98, invalid_item_background_patch); + patch((void *) 0x7f7e8, invalid_item_background_patch); } // Classic HUD if (feature_has("Classic HUD", server_disabled)) { use_classic_hud = 1; - overwrite_call((void *) 0x266f8, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); - overwrite_call((void *) 0x26758, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); - overwrite_call((void *) 0x267c8, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); - overwrite_call((void *) 0x2656c, (void *) Gui_renderHearts_GuiComponent_blit_armor_injection); - overwrite_call((void *) 0x268c4, (void *) Gui_renderBubbles_GuiComponent_blit_injection); + overwrite_call((void *) 0x2b730, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); + overwrite_call((void *) 0x2b8a4, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); + overwrite_call((void *) 0x2b788, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection); + overwrite_call((void *) 0x2ba80, (void *) Gui_renderBubbles_GuiComponent_blit_injection); } // Render Selected Item Text + Hide Chat Messages @@ -327,7 +320,7 @@ void init_misc() { // Translucent Toolbar if (feature_has("Translucent Toolbar", server_disabled)) { overwrite_calls((void *) Gui_renderToolBar, (void *) Gui_renderToolBar_injection); - overwrite_call((void *) 0x26c5c, (void *) Gui_renderToolBar_glColor4f_injection); + overwrite_call((void *) 0x2c130, (void *) Gui_renderToolBar_glColor4f_injection); } // Fix Screen Rendering When GUI is Hidden @@ -340,7 +333,7 @@ void init_misc() { overwrite_calls((void *) RakNet_RakString, (void *) RakNet_RakString_injection); // Print Error Message If RakNet Startup Fails - overwrite_call((void *) 0x73778, (void *) RakNetInstance_host_RakNet_RakPeer_Startup_injection); + overwrite_call((void *) 0x98014, (void *) RakNetInstance_host_RakNet_RakPeer_Startup_injection); // Fix Bug Where RakNetInstance Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection); @@ -359,7 +352,7 @@ void init_misc() { if (feature_has("Improved Cursor Rendering", server_disabled)) { // Disable Normal Cursor Rendering unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - patch((void *) 0x4a6c0, disable_cursor_patch); + patch((void *) 0x61afc, disable_cursor_patch); // Add Custom Cursor Rendering overwrite_calls((void *) GameRenderer_render, (void *) GameRenderer_render_injection); } @@ -379,6 +372,9 @@ void init_misc() { overwrite_calls((void *) sleepMs, (void *) nop); } + // Stop Checking GL Renderer + overwrite((void *) AppPlatform_isPowerVR, (void *) AppPlatform_isPowerVR_injection); + // Init C++ And Logging _init_misc_cpp(); _init_misc_logging(); diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 0318b497..d13d9621 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -75,10 +75,10 @@ void _init_misc_cpp() { // Improved Title Background if (feature_has("Improved Title Background", server_disabled)) { // Switch Background - overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection); - overwrite_call((void *) 0x3dee0, (void *) StartMenuScreen_render_Screen_renderBackground_injection); + overwrite_call((void *) 0x4a40c, (void *) StartMenuScreen_render_Screen_renderBackground_injection); + overwrite_call((void *) 0x52360, (void *) StartMenuScreen_render_Screen_renderBackground_injection); // Text Color - patch_address((void *) 0x397ac, (void *) 0xffffffff); - patch_address((void *) 0x3e10c, (void *) 0xffffffff); + patch_address((void *) 0x4a764, (void *) 0xffffffff); + patch_address((void *) 0x525f4, (void *) 0xffffffff); } } diff --git a/mods/src/options/options-internal.h b/mods/src/options/options-internal.h deleted file mode 100644 index 924c4e2c..00000000 --- a/mods/src/options/options-internal.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -__attribute__((visibility("internal"))) void _init_options_cpp(); -__attribute__((visibility("internal"))) extern unsigned char *stored_options; - -#ifdef __cplusplus -} -#endif diff --git a/mods/src/options/options.c b/mods/src/options/options.c index e5b068c1..af9129b5 100644 --- a/mods/src/options/options.c +++ b/mods/src/options/options.c @@ -5,7 +5,6 @@ #include #include -#include "options-internal.h" // Force Mob Spawning static bool LevelData_getSpawnMobs_injection(__attribute__((unused)) unsigned char *level_data) { @@ -44,43 +43,32 @@ __attribute__((destructor)) static void _free_safe_username() { free(safe_username); } +static int fancy_graphics; +static int peaceful_mode; static int anaglyph; +static int smooth_lighting; static int render_distance; +static int server_visible; // Configure Options -unsigned char *stored_options = NULL; -static void Options_initDefaultValue_injection(unsigned char *options) { +static void Minecraft_init_injection(unsigned char *this) { // Call Original Method - (*Options_initDefaultValue)(options); + (*Minecraft_init)(this); - // Default Graphics Settings -#ifndef MCPI_SERVER_MODE - *(options + Options_fancy_graphics_property_offset) = 1; - *(options + Options_ambient_occlusion_property_offset) = 1; -#endif - - // Store - stored_options = options; -} -static void Minecraft_init_injection(unsigned char *minecraft) { - // Call Original Method - (*Minecraft_init)(minecraft); - - unsigned char *options = minecraft + Minecraft_options_property_offset; + unsigned char *options = this + Minecraft_options_property_offset; + // Enable Fancy Graphics + *(options + Options_fancy_graphics_property_offset) = fancy_graphics; // Enable Crosshair In Touch GUI *(options + Options_split_controls_property_offset) = 1; + // Peaceful Mode + *(int32_t *) (options + Options_game_difficulty_property_offset) = peaceful_mode ? 0 : 2; // 3D Anaglyph *(options + Options_3d_anaglyph_property_offset) = anaglyph; + // Smooth Lighting + *(options + Options_ambient_occlusion_property_offset) = smooth_lighting; // Render Distance *(int32_t *) (options + Options_render_distance_property_offset) = render_distance; -} - -// Smooth Lighting -static void TileRenderer_tesselateBlockInWorld_injection(unsigned char *tile_renderer, unsigned char *tile, int32_t x, int32_t y, int32_t z) { - // Set Variable - *Minecraft_useAmbientOcclusion = *(stored_options + Options_ambient_occlusion_property_offset); - - // Call Original Method - (*TileRenderer_tesselateBlockInWorld)(tile_renderer, tile, x, y, z); + // Server Visible + *(options + Options_server_visible_property_offset) = server_visible; } // Init @@ -90,14 +78,19 @@ void init_options() { overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection); } + // Enable Fancy Graphics + fancy_graphics = feature_has("Fancy Graphics", server_disabled); + // Peaceful Mode + peaceful_mode = feature_has("Peaceful Mode", server_auto); // 3D Anaglyph anaglyph = feature_has("3D Anaglyph", server_disabled); // Render Distance render_distance = get_render_distance(); DEBUG("Setting Render Distance: %i", render_distance); + // Server Visible + server_visible = !feature_has("Disable Hosting LAN Worlds", server_disabled); // Set Options - overwrite_calls((void *) Options_initDefaultValue, (void *) Options_initDefaultValue_injection); overwrite_calls((void *) Minecraft_init, (void *) Minecraft_init_injection); // Change Username @@ -108,23 +101,26 @@ void init_options() { } safe_username = to_cp437(username); patch_address((void *) default_username, (void *) safe_username); + unsigned char username_length_patch[4] = {(unsigned char) strlen(safe_username), 0x20, 0xa0, 0xe3}; // "mov r2, #USERNAME_LENGTH" + patch((void *) 0x1ba2c, username_length_patch); // Disable Autojump By Default if (feature_has("Disable Autojump By Default", server_disabled)) { - unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" - patch((void *) 0x44b90, autojump_patch); + unsigned char autojump_patch[4] = {0x00, 0x00, 0xa0, 0xe3}; // "mov r0, #0x0" + patch((void *) 0x5b148, autojump_patch); } // Display Nametags By Default if (feature_has("Display Nametags By Default", server_disabled)) { // r6 = 0x1 - // r5 = 0x0 - unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5}; // "strb r6, [r0, #0x1d]" - patch((void *) 0xa6628, display_nametags_patch); + // r12 = 0x0 + unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc4, 0xe5}; // "strb r6, [r4, #0x1d]" + patch((void *) 0xf2d44, display_nametags_patch); } - // Smooth Lighting - overwrite_calls((void *) TileRenderer_tesselateBlockInWorld, (void *) TileRenderer_tesselateBlockInWorld_injection); - - // Init C++ - _init_options_cpp(); + // Enable Smooth Lighting + smooth_lighting = feature_has("Smooth Lighting", server_disabled); + if (smooth_lighting) { + unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3}; // "cmp r3, #0x1" + patch((void *) 0x73b74, smooth_lighting_patch); + } } diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp deleted file mode 100644 index f11831c9..00000000 --- a/mods/src/options/options.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include -#include -#include -#include - -#include - -#include -#include -#include "options-internal.h" - -#include - -// Fix Initial Option Button Rendering -// The calling function doesn't exist in MCPE v0.6.1, so its name is unknown. -static unsigned char *OptionsPane_unknown_toggle_creating_function_OptionButton_injection(unsigned char *option_button, unsigned char *option) { - // Call Original Method - unsigned char *ret = (*OptionButton)(option_button, option); - - // Setup Image - (*OptionButton_updateImage)(option_button, stored_options); - - // Return - return ret; -} - -// Actually Save options.txt -// Hook Last Options::addOptionToSaveOutput Call -static void Options_save_Options_addOptionToSaveOutput_injection(unsigned char *options, std::vector &data, std::string option, int32_t value) { - // Call Original Method - (*Options_addOptionToSaveOutput)(options, data, option, value); - - // Save Fancy Graphics - (*Options_addOptionToSaveOutput)(options, data, "gfx_fancygraphics", *(options + Options_fancy_graphics_property_offset)); - - // Save File - unsigned char *options_file = options + Options_options_file_property_offset; - (*OptionsFile_save)(options_file, data); -} - -// MCPI's OptionsFile::getOptionStrings is broken, this is the version in v0.7.0 -static std::vector OptionsFile_getOptionStrings_injection(unsigned char *options_file) { - // Get options.txt Path - std::string path = *(std::string *) (options_file + OptionsFile_options_txt_path_property_offset); - // Parse - std::vector ret; - FILE *stream = fopen(path.c_str(), "r"); - char line[128]; - if (stream != NULL) { - while (fgets(line, 0x80, stream) != NULL) { - size_t sVar1 = strlen(line); - if (2 < sVar1) { - std::stringstream string_stream(line); - while (true) { - std::string data; - std::getline(string_stream, data, ':'); - int iVar2 = data.find_last_not_of(" \n\r\t"); - data.erase(iVar2 + 1); - if (data.length() == 0) { - break; - } - ret.push_back(data); - } - } - } - fclose(stream); - } - return ret; -} - -// Get New options.txt Path -#ifndef MCPI_SERVER_MODE -static char *get_new_options_txt_path() { - static char *path = NULL; - // Path - if (path == NULL) { - safe_asprintf(&path, "%s/options.txt", home_get()); - } - // Return - return path; -} -// Free -__attribute__((destructor)) static void _free_new_options_txt_path() { - free(get_new_options_txt_path()); -} -#else -static char *get_new_options_txt_path() { - // Block options.txt On Servers - return (char *) "/dev/null"; -} -#endif - -// Modify Option Toggles -static void OptionsPane_unknown_toggle_creating_function_injection(unsigned char *options_pane, uint32_t group_id, std::string const& name, unsigned char *option) { - // Modify - std::string new_name = name; - if (name == "Fancy Graphics") { - option = Options_Option_GRAPHICS; - } else if (name == "Soft shadows") { - option = Options_Option_AMBIENT_OCCLUSION; - } else if (name == "Fancy Skies" || name == "Animated water") { - // These have no corresponding option, so disable the toggle. - return; - } else if (name == "Third person camera") { - // This isn't saved/loaded, so disable the toggle. - return; - } else if (name == "Lefty" || name == "Use touch screen" || name == "Split touch controls") { - // These toggles require touch support, so disable them. - return; - } else if (name == "Vibrate on destroy") { - // This toggle requires vibration support, so disable it. - return; - } else if (name == "Invert X-axis") { - // Fix Incorrect Name - new_name = "Invert Y-axis"; - } - - // Call Original Method - (*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, new_name, option); -} - -// Add Missing Options To Options::getBooleanValue -static bool Options_getBooleanValue_injection(unsigned char *options, unsigned char *option) { - // Check - if (option == Options_Option_GRAPHICS) { - return *(options + Options_fancy_graphics_property_offset); - } else { - // Call Original Method - return (*Options_getBooleanValue)(options, option); - } -} - -// Add Options Button Back To Classic Start Screen -static void StartMenuScreen_init_injection(unsigned char *screen) { - // Call Original Method - (*StartMenuScreen_init)(screen); - - // Add Button - std::vector *rendered_buttons = (std::vector *) (screen + Screen_rendered_buttons_property_offset); - std::vector *selectable_buttons = (std::vector *) (screen + Screen_selectable_buttons_property_offset); - unsigned char *options_button = screen + StartMenuScreen_options_button_property_offset; - rendered_buttons->push_back(options_button); - selectable_buttons->push_back(options_button); -} - -// Init C++ -void _init_options_cpp() { - // NOP - unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop" - - // Fix Options Screen - if (feature_has("Fix Options Screen", server_disabled)) { - // Fix Initial Option Button Rendering - overwrite_call((void *) 0x24510, (void *) OptionsPane_unknown_toggle_creating_function_OptionButton_injection); - - // "Gui Scale" slider is broken, so disable it. - patch((void *) 0x35a10, nop_patch); - // "Vibrate on destroy" is disabled, so "Feedback" is empty, so disable it. - patch((void *) 0x35960, nop_patch); - - // Disconnect "This works?" Slider From Difficulty - unsigned char this_works_slider_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" - patch((void *) 0x3577c, this_works_slider_patch); - - // Modify Option Toggles - overwrite_calls((void *) OptionsPane_unknown_toggle_creating_function, (void *) OptionsPane_unknown_toggle_creating_function_injection); - - // Add Missing Options To Options::getBooleanValue - overwrite_calls((void *) Options_getBooleanValue, (void *) Options_getBooleanValue_injection); - - // Add Options Button Back To Classic Start Screen - patch_address(StartMenuScreen_init_vtable_addr, (void *) StartMenuScreen_init_injection); - // Fix Classic UI Options Button Size - unsigned char classic_options_button_width_patch[4] = {0xa0, 0x00, 0xa0, 0xe3}; // "mov r0, #0xa0" - patch((void *) 0x39a98, classic_options_button_width_patch); - unsigned char classic_options_button_height_patch[4] = {0x18, 0x30, 0xa0, 0xe3}; // "mov r3, #0x18" - patch((void *) 0x39a9c, classic_options_button_height_patch); - // Fix Classic UI Buttons Spacing - { - // Join Button - unsigned char classic_join_button_spacing_patch[4] = {0x12, 0x20, 0x83, 0xe2}; // "add r2, r3, #0x12" - patch((void *) 0x39894, classic_join_button_spacing_patch); - // Start Button - unsigned char classic_start_button_spacing_patch[4] = {0x08, 0x20, 0x43, 0xe2}; // "sub r2, r3, #0x08" - patch((void *) 0x3988c, classic_start_button_spacing_patch); - // Options Button - unsigned char classic_options_button_spacing_patch[4] = {0x2c, 0x30, 0x83, 0xe2}; // "add r3, r3, #0x2c" - patch((void *) 0x39898, classic_options_button_spacing_patch); - } - } - - // Actually Save options.txt - overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection); - // Fix options.txt Path - patch_address((void *) options_txt_path, (void *) get_new_options_txt_path()); - // When Loading, options.txt Should Be Opened In Read Mode - patch_address((void *) options_txt_fopen_mode_when_loading, (void *) "r"); - // Fix OptionsFile::getOptionStrings - overwrite_calls((void *) OptionsFile_getOptionStrings, (void *) OptionsFile_getOptionStrings_injection); - - // Sensitivity Loading/Saving Is Broken, Disable It - patch((void *) 0x1931c, nop_patch); - patch((void *) 0x1973c, nop_patch); - - // Unsplit Touch Controls Breaks Things, Never Load/Save It - unsigned char cmp_r0_r0_patch[4] = {0x00, 0x00, 0x50, 0xe1}; // "cmp r0, r0" - patch((void *) 0x19378, cmp_r0_r0_patch); - patch((void *) 0x197cc, nop_patch); - - // Custom Username Is Loaded Manually, Disable Loading From options.txt - patch((void *) 0x192ac, nop_patch); - - // Replace "feedback_vibration" Loading/Saving With "gfx_ao" - { - // Replace String - static const char *new_feedback_vibration_options_txt_nam = "gfx_ao"; - patch_address((void *) feedback_vibration_options_txt_name_1, (void *) &new_feedback_vibration_options_txt_nam); - patch_address((void *) feedback_vibration_options_txt_name_2, (void *) &new_feedback_vibration_options_txt_nam); - // Loading - unsigned char gfx_ao_loading_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x10, 0x84, 0xe2}; // "add param_2, r4, #OFFSET" - patch((void *) 0x193b8, gfx_ao_loading_patch); - // Saving - unsigned char gfx_ao_saving_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x30, 0xd4, 0xe5}; // "ldrb r3, [r4, #OFFSET]" - patch((void *) 0x197f8, gfx_ao_saving_patch); - } - - // Disable "gfx_lowquality" Loading - patch((void *) 0x19414, nop_patch); - patch((void *) 0x1941c, nop_patch); -} diff --git a/mods/src/server/server.cpp b/mods/src/server/server.cpp index 4b7f9b4a..d311951c 100644 --- a/mods/src/server/server.cpp +++ b/mods/src/server/server.cpp @@ -79,10 +79,6 @@ static void start_world(unsigned char *minecraft) { // Log INFO("Loading World: %s", world_name.c_str()); - // Peaceful Mode - unsigned char *options = minecraft + Minecraft_options_property_offset; - *(int32_t *) (options + Options_game_difficulty_property_offset) = get_server_properties().get_bool("peaceful-mode", DEFAULT_PEACEFUL_MODE) ? 0 : 2; - // Specify Level Settings LevelSettings settings; settings.game_type = get_server_properties().get_int("game-mode", DEFAULT_GAME_MODE); @@ -98,6 +94,7 @@ static void start_world(unsigned char *minecraft) { // Open Port int port = get_server_properties().get_int("port", DEFAULT_PORT); INFO("Listening On: %i", port); + patch_address((void *) 0x16cd8, (void *) port); (*Minecraft_hostMultiplayer)(minecraft, port); } @@ -301,6 +298,15 @@ __attribute__((destructor)) static void _free_stdin_buffer() { stdin_buffer = NULL; } } +// Prevent STDIN From Being Closed +HOOK(close, int, (int fd)) { + if (fd != fileno(stdin)) { + ensure_close(); + return (*real_close)(fd); + } else { + return 0; + } +} // Handle Commands static void handle_commands(unsigned char *minecraft) { @@ -481,6 +487,9 @@ static const char *get_features() { loaded_features = true; features.clear(); + if (get_server_properties().get_bool("peaceful-mode", DEFAULT_PEACEFUL_MODE)) { + features += "Peaceful Mode|"; + } if (get_server_properties().get_bool("force-mob-spawning", DEFAULT_FORCE_MOB_SPAWNING)) { features += "Force Mob Spawning|"; } @@ -566,23 +575,23 @@ static void server_init() { // Prevent Main Player From Loading unsigned char player_patch[4] = {0x00, 0x20, 0xa0, 0xe3}; // "mov r2, #0x0" - patch((void *) 0x1685c, player_patch); + patch((void *) 0x16ef8, player_patch); // Start World On Launch misc_run_on_update(Minecraft_update_injection); // Set Max Players unsigned char max_players_patch[4] = {get_max_players(), 0x30, 0xa0, 0xe3}; // "mov r3, #MAX_PLAYERS" - patch((void *) 0x166d0, max_players_patch); + patch((void *) 0x16cc0, max_players_patch); // Custom Banned IP List overwrite((void *) RakNet_RakPeer_IsBanned, (void *) RakNet_RakPeer_IsBanned_injection); // Show The MineCon Icon Next To MOTD In Server List if (get_server_properties().get_bool("show-minecon-badge", DEFAULT_SHOW_MINECON_BADGE)) { - unsigned char minecon_badge_patch[4] = {0x04, 0x1a, 0x9f, 0xe5}; // "ldr r1, [0x741f0]" - patch((void *) 0x737e4, minecon_badge_patch); + unsigned char minecon_badge_patch[4] = {0x5c, 0x1a, 0x9f, 0xe5}; // "ldr r1, [0x98af0]" + patch((void *) 0x9808c, minecon_badge_patch); } // Log IPs - overwrite_call((void *) 0x75e54, (void *) ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection); + overwrite_call((void *) 0x9a63c, (void *) ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection); // Track TPS misc_run_on_tick(Minecraft_tick_injection); diff --git a/mods/src/sign/README.md b/mods/src/sign/README.md deleted file mode 100644 index 1f706602..00000000 --- a/mods/src/sign/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# ``sign`` Mod -This mod fixes sign placement. diff --git a/mods/src/sign/sign.cpp b/mods/src/sign/sign.cpp deleted file mode 100644 index 600743d1..00000000 --- a/mods/src/sign/sign.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include - -#include -#include -#include - -#include -#include -#include -#include - -// Handle Backspace -static int32_t sdl_key_to_minecraft_key_injection(int32_t sdl_key) { - if (sdl_key == SDLK_BACKSPACE) { - return 8; - } else { - // Call Original Method - return (*sdl_key_to_minecraft_key)(sdl_key); - } -} - -// Open Sign Screen -static void LocalPlayer_openTextEdit_injection(unsigned char *local_player, unsigned char *sign) { - if (*(int32_t *) (sign + TileEntity_id_property_offset) == 4) { - unsigned char *minecraft = *(unsigned char **) (local_player + LocalPlayer_minecraft_property_offset); - unsigned char *screen = (unsigned char *) ::operator new(TEXT_EDIT_SCREEN_SIZE); - ALLOC_CHECK(screen); - screen = (*TextEditScreen)(screen, sign); - (*Minecraft_setScreen)(minecraft, screen); - } -} - -// Store Text Input -std::vector input; -void sign_key_press(char key) { - input.push_back(key); -} -static void clear_input(__attribute__((unused)) unsigned char *minecraft) { - input.clear(); -} - -// Handle Text Input -static void TextEditScreen_updateEvents_injection(unsigned char *screen) { - // Call Original Method - (*Screen_updateEvents)(screen); - - if (!*(bool *)(screen + Screen_passthrough_input_property_offset)) { - unsigned char *vtable = *(unsigned char **) screen; - for (char key : input) { - // Handle Normal Key - (*(Screen_keyboardNewChar_t *) (vtable + Screen_keyboardNewChar_vtable_offset))(screen, key); - } - } - clear_input(NULL); -} - -// Init -void init_sign() { - if (feature_has("Fix Sign Placement", server_disabled)) { - // Handle Backspace - overwrite_calls((void *) sdl_key_to_minecraft_key, (void *) sdl_key_to_minecraft_key_injection); - // Fix Signs - patch_address(LocalPlayer_openTextEdit_vtable_addr, (void *) LocalPlayer_openTextEdit_injection); - patch_address(TextEditScreen_updateEvents_vtable_addr, (void *) TextEditScreen_updateEvents_injection); - // Clear Input On Input Tick - input_run_on_tick(clear_input); - } -} diff --git a/mods/src/textures/textures.cpp b/mods/src/textures/textures.cpp index bbf840cc..ccccc5a2 100644 --- a/mods/src/textures/textures.cpp +++ b/mods/src/textures/textures.cpp @@ -170,5 +170,5 @@ void init_textures() { } // Scale Animated Textures - overwrite_call((void *) 0x53274, (void *) Textures_tick_glTexSubImage2D_injection); + overwrite_call((void *) 0x6bfd0, (void *) Textures_tick_glTexSubImage2D_injection); } diff --git a/mods/src/touch/touch.cpp b/mods/src/touch/touch.cpp index 75bff32d..9edae41c 100644 --- a/mods/src/touch/touch.cpp +++ b/mods/src/touch/touch.cpp @@ -30,7 +30,7 @@ static int32_t Button_hovered_injection(__attribute__((unused)) unsigned char *b // Check return x >= button_x1 && x <= button_x2 && y >= button_y1 && y <= button_y2; } -static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(unsigned char *component, unsigned char *font, std::string const& text, int32_t x, int32_t y, int32_t color) { +static void Button_render_GuiComponent_drawCenteredString_injection(unsigned char *component, unsigned char *font, std::string const& text, int32_t x, int32_t y, int32_t color) { // Change Color On Hover if (color == 0xe0e0e0 && Button_hovered_injection(component, NULL, 0, 0)) { color = 0xffffa0; @@ -39,6 +39,15 @@ static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(un // Call Original Method (*GuiComponent_drawCenteredString)(component, font, text, x, y, color); } +static void Button_renderBg_GuiComponent_blit_injection(unsigned char *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { + // Change Color On Hover + if (y_src == 66 && Button_hovered_injection(component, NULL, 0, 0)) { + y_src += 20; + } + + // Call Original Method + (*GuiComponent_blit)(component, x_dest, y_dest, x_src, y_src, width_dest, height_dest, width_src, height_src); +} // Init void init_touch() { @@ -50,46 +59,50 @@ void init_touch() { // Force Correct Toolbar Size unsigned char toolbar_patch[4] = {0x01, 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" - patch((void *) 0x257b0, toolbar_patch); + patch((void *) 0x2a6cc, toolbar_patch); } else { // Force Touch Inventory if (feature_has("Force Touch GUI Inventory", server_disabled)) { - overwrite_call((void *) 0x2943c, (void *) operator_new_IngameBlockSelectionScreen_injection); - overwrite_call((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen); + overwrite_call((void *) 0x2f628, (void *) operator_new_IngameBlockSelectionScreen_injection); + overwrite_call((void *) 0x2f630, (void *) Touch_IngameBlockSelectionScreen); // Make "Craft" And "Armor" Buttons Use Classic GUI Style (Button And TButton Have The Same Size) - overwrite_call((void *) 0x3b060, (void *) Button); - overwrite_call((void *) 0x3b08c, (void *) Button); + overwrite_call((void *) 0x4c6fc, (void *) Button); } // Force Touch Button Behavior if (feature_has("Force Touch GUI Button Behavior", server_disabled)) { touch_buttons = 1; - overwrite_call((void *) 0x1baf4, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x1be40, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x1c470, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x1e868, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x290b8, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x29168, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x3e314, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x2cbc0, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x2ea7c, (void *) Minecraft_isTouchscreen_injection); - overwrite_call((void *) 0x4a438, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2007c, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2020c, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x20674, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2f200, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2fe9c, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x213bc, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x24250, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2f200, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x2f2a8, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x520c4, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x33cac, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x37e7c, (void *) Minecraft_isTouchscreen_injection); + overwrite_call((void *) 0x61a0c, (void *) Minecraft_isTouchscreen_injection); } } // Improved Button Hover Behavior if (touch_buttons && feature_has("Improved Button Hover Behavior", server_disabled)) { - overwrite((void *) Button_hovered, (void *) Button_hovered_injection); - overwrite_call((void *) 0x1ebd4, (void *) LargeImageButton_render_GuiComponent_drawCenteredString_injection); + overwrite_call((void *) 0x20190, (void *) Button_render_GuiComponent_drawCenteredString_injection); + overwrite_call((void *) 0x24108, (void *) Button_render_GuiComponent_drawCenteredString_injection); + overwrite_call((void *) 0x202d0, (void *) Button_renderBg_GuiComponent_blit_injection); + overwrite_call((void *) 0x20304, (void *) Button_renderBg_GuiComponent_blit_injection); } // Show Block Outlines 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" - patch((void *) 0x4a210, outline_patch); + patch((void *) 0x6183c, 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); + patch((void *) 0x60bdc, block_highlight_patch); } } diff --git a/mods/src/version/version.cpp b/mods/src/version/version.cpp index b492c8d1..613175ba 100644 --- a/mods/src/version/version.cpp +++ b/mods/src/version/version.cpp @@ -31,6 +31,8 @@ void init_version() { overwrite((void *) Common_getGameVersionString, (void *) Common_getGameVersionString_injection); // Normal GUI patch_address((void *) minecraft_pi_version, version_get()); + unsigned char normal_gui_version_length_patch[4] = {(unsigned char) strlen(version_get()), 0x20, 0xa0, 0xe3}; // "mov r2, #VERSION_LENGTH" + patch((void *) 0x4b11c, normal_gui_version_length_patch); // Log INFO("Starting Minecraft: Pi Edition (%s)", version_get()); diff --git a/symbols/include/symbols/minecraft.h b/symbols/include/symbols/minecraft.h index 1eab67e3..d1533816 100644 --- a/symbols/include/symbols/minecraft.h +++ b/symbols/include/symbols/minecraft.h @@ -13,60 +13,48 @@ typedef unsigned char bool; // Globals typedef void (*renderCursor_t)(float x, float y, unsigned char *minecraft); -static renderCursor_t renderCursor = (renderCursor_t) 0x480c4; +static renderCursor_t renderCursor = (renderCursor_t) 0x5f414; typedef void (*sleepMs_t)(int32_t x); -static sleepMs_t sleepMs = (sleepMs_t) 0x13cf4; +static sleepMs_t sleepMs = (sleepMs_t) 0x13a20; typedef int32_t (*sdl_key_to_minecraft_key_t)(int32_t sdl_key); -static sdl_key_to_minecraft_key_t sdl_key_to_minecraft_key = (sdl_key_to_minecraft_key_t) 0x1243c; +static sdl_key_to_minecraft_key_t sdl_key_to_minecraft_key = (sdl_key_to_minecraft_key_t) 0x11c78; -static char **default_path = (char **) 0xe264; // /.minecraft/ -static char **default_username = (char **) 0x18fd4; // StevePi -static char **minecraft_pi_version = (char **) 0x39d94; // v0.1.1 alpha -static char **options_txt_path = (char **) 0x19bc8; // options.txt -static char **options_txt_fopen_mode_when_loading = (char **) 0x19d24; // w -static char ***feedback_vibration_options_txt_name_1 = (char ***) 0x198a0; // feedback_vibration -static char ***feedback_vibration_options_txt_name_2 = (char ***) 0x194bc; // feedback_vibration +static char **full_data_path = (char **) 0xdd10; // . +static char **default_username = (char **) 0x1c250; // StevePi +static char **minecraft_pi_version = (char **) 0x4b2a0; // v0.1.0 alpha +static char **demo_level_name = (char **) 0x3a37c; // _DemoLevel -static unsigned char **Material_stone = (unsigned char **) 0x180a9c; // Material +static unsigned char **Item_flintAndSteel = (unsigned char **) 0x1da680; // Item +static unsigned char **Item_snowball = (unsigned char **) 0x1da770; // Item +static unsigned char **Item_shears = (unsigned char **) 0x1da7b0; // Item +static unsigned char **Item_egg = (unsigned char **) 0x1da790; // Item +static unsigned char **Item_dye_powder = (unsigned char **) 0x1da7a0; // Item +static unsigned char **Item_camera = (unsigned char **) 0x1da7cc; // Item -static unsigned char *SOUND_STONE = (unsigned char *) 0x181c80; // Tile::SoundType +static unsigned char **Tile_water = (unsigned char **) 0x1dfca4; // Tile +static unsigned char **Tile_lava = (unsigned char **) 0x1dfe30; // Tile +static unsigned char **Tile_calmWater = (unsigned char **) 0x1dfca8; // Tile +static unsigned char **Tile_calmLava = (unsigned char **) 0x1dfe34; // Tile +static unsigned char **Tile_glowingObsidian = (unsigned char **) 0x1e0014; // Tile +static unsigned char **Tile_web = (unsigned char **) 0x1dfe70; // Tile +static unsigned char **Tile_topSnow = (unsigned char **) 0x1dfc98; // Tile +static unsigned char **Tile_ice = (unsigned char **) 0x1dfee8; // Tile +static unsigned char **Tile_invisible_bedrock = (unsigned char **) 0x1dfef8; // Tile +static unsigned char **Tile_netherReactor = (unsigned char **) 0x1e0018; // Tile +static unsigned char **Tile_info_updateGame1 = (unsigned char **) 0x1dfdd4; // Tile +static unsigned char **Tile_info_updateGame2 = (unsigned char **) 0x1dfdd0; // Tile +static unsigned char **Tile_bedrock = (unsigned char **) 0x1dfe2c; // Tile +static unsigned char **Tile_tallgrass = (unsigned char **) 0x1dfe74; // Tile +static unsigned char **Tile_stoneSlab = (unsigned char **) 0x1dfdb8; // Tile -static unsigned char **Item_flintAndSteel = (unsigned char **) 0x17ba70; // Item -static unsigned char **Item_snowball = (unsigned char **) 0x17bbb0; // Item -static unsigned char **Item_shears = (unsigned char **) 0x17bbf0; // Item -static unsigned char **Item_egg = (unsigned char **) 0x17bbd0; // Item -static unsigned char **Item_dye_powder = (unsigned char **) 0x17bbe0; // Item -static unsigned char **Item_camera = (unsigned char **) 0x17bc14; // Item +static unsigned char **Tile_leaves = (unsigned char **) 0x1df374; // Tile +static unsigned char **Tile_leaves_carried = (unsigned char **) 0x1e0020; // Tile +static unsigned char **Tile_grass = (unsigned char **) 0x1dfc7c; // Tile +static unsigned char **Tile_grass_carried = (unsigned char **) 0x1e001c; // Tile -static unsigned char **Tile_water = (unsigned char **) 0x181b3c; // Tile -static unsigned char **Tile_lava = (unsigned char **) 0x181cc8; // Tile -static unsigned char **Tile_calmWater = (unsigned char **) 0x181b40; // Tile -static unsigned char **Tile_calmLava = (unsigned char **) 0x181ccc; // Tile -static unsigned char **Tile_glowingObsidian = (unsigned char **) 0x181dcc; // Tile -static unsigned char **Tile_web = (unsigned char **) 0x181d08; // Tile -static unsigned char **Tile_topSnow = (unsigned char **) 0x181b30; // Tile -static unsigned char **Tile_ice = (unsigned char **) 0x181d80; // Tile -static unsigned char **Tile_invisible_bedrock = (unsigned char **) 0x181d94; // Tile -static unsigned char **Tile_netherReactor = (unsigned char **) 0x181dd0; // Tile -static unsigned char **Tile_info_updateGame1 = (unsigned char **) 0x181c68; // Tile -static unsigned char **Tile_info_updateGame2 = (unsigned char **) 0x181c6c; // Tile -static unsigned char **Tile_bedrock = (unsigned char **) 0x181cc4; // Tile -static unsigned char **Tile_tallgrass = (unsigned char **) 0x181d0c; // Tile -static unsigned char **Tile_stoneSlab = (unsigned char **) 0x181b44; // Tile - -static unsigned char **Tile_leaves = (unsigned char **) 0x18120c; // Tile -static unsigned char **Tile_leaves_carried = (unsigned char **) 0x181dd8; // Tile -static unsigned char **Tile_grass = (unsigned char **) 0x181b14; // Tile -static unsigned char **Tile_grass_carried = (unsigned char **) 0x181dd4; // Tile - -static float *InvGuiScale = (float *) 0x135d98; - -static unsigned char *Options_Option_GRAPHICS = (unsigned char *) 0x136c2c; // Option -static unsigned char *Options_Option_AMBIENT_OCCLUSION = (unsigned char *) 0x136c38; // Option - -static bool *Minecraft_useAmbientOcclusion = (bool *) 0x136b90; +static float *InvGuiScale = (float *) 0x1949fc; // Structures @@ -93,130 +81,101 @@ struct RakNet_SystemAddress { // Tile -static unsigned char **Tile_tiles = (unsigned char **) 0x180e08; +static unsigned char **Tile_tiles = (unsigned char **) 0x1def70; typedef void (*Tile_initTiles_t)(); -static Tile_initTiles_t Tile_initTiles = (Tile_initTiles_t) 0xc358c; - -#define TILE_SIZE 0x5c -#define TILE_VTABLE_SIZE 0x104 - -static unsigned char *Tile_vtable = (unsigned char *) 0x115670; - -typedef unsigned char *(*Tile_t)(unsigned char *tile, int32_t id, int32_t texture, const void *material); -static Tile_t Tile = (Tile_t) 0xc33a0; - -typedef unsigned char *(*Tile_init_t)(unsigned char *tile); -static Tile_init_t Tile_init = (Tile_init_t) 0xc34dc; - -typedef unsigned char *(*Tile_setDestroyTime_t)(unsigned char *tile, float destroy_time); -static uint32_t Tile_setDestroyTime_vtable_offset = 0xf8; - -typedef unsigned char *(*Tile_setExplodeable_t)(unsigned char *tile, float explodeable); -static uint32_t Tile_setExplodeable_vtable_offset = 0xf4; - -typedef unsigned char *(*Tile_setSoundType_t)(unsigned char *tile, unsigned char *sound_type); -static uint32_t Tile_setSoundType_vtable_offset = 0xe8; - -typedef int32_t (*Tile_use_t)(unsigned char *tile, unsigned char *level, int32_t x, int32_t y, int32_t z, unsigned char *player); -static uint32_t Tile_use_vtable_offset = 0x98; +static Tile_initTiles_t Tile_initTiles = (Tile_initTiles_t) 0x125bac; static uint32_t Tile_id_property_offset = 0x8; // int32_t static uint32_t Tile_category_property_offset = 0x3c; // int32_t -// TileRenderer +// AppPlatform -typedef void (*TileRenderer_tesselateBlockInWorld_t)(unsigned char *tile_renderer, unsigned char *tile, int32_t x, int32_t y, int32_t z); -static TileRenderer_tesselateBlockInWorld_t TileRenderer_tesselateBlockInWorld = (TileRenderer_tesselateBlockInWorld_t) 0x59e30; - -// GameMode - -typedef void (*GameMode_releaseUsingItem_t)(unsigned char *game_mode, unsigned char *player); -static uint32_t GameMode_releaseUsingItem_vtable_offset = 0x5c; +typedef bool (*AppPlatform_isPowerVR_t)(unsigned char *app_platform); +static AppPlatform_isPowerVR_t AppPlatform_isPowerVR = (AppPlatform_isPowerVR_t) 0x12670; // Minecraft typedef void (*Minecraft_init_t)(unsigned char *minecraft); -static Minecraft_init_t Minecraft_init = (Minecraft_init_t) 0x1700c; +static Minecraft_init_t Minecraft_init = (Minecraft_init_t) 0x182c8; typedef void (*Minecraft_tickInput_t)(unsigned char *minecraft); -static Minecraft_tickInput_t Minecraft_tickInput = (Minecraft_tickInput_t) 0x15ffc; +static Minecraft_tickInput_t Minecraft_tickInput = (Minecraft_tickInput_t) 0x166a8; typedef void (*Minecraft_setIsCreativeMode_t)(unsigned char *, int32_t); -static Minecraft_setIsCreativeMode_t Minecraft_setIsCreativeMode = (Minecraft_setIsCreativeMode_t) 0x16ec4; +static Minecraft_setIsCreativeMode_t Minecraft_setIsCreativeMode = (Minecraft_setIsCreativeMode_t) 0x17888; typedef int32_t (*Minecraft_isTouchscreen_t)(unsigned char *minecraft); -static Minecraft_isTouchscreen_t Minecraft_isTouchscreen = (Minecraft_isTouchscreen_t) 0x1639c; +static Minecraft_isTouchscreen_t Minecraft_isTouchscreen = (Minecraft_isTouchscreen_t) 0x16b38; typedef void (*Minecraft_setScreen_t)(unsigned char *minecraft, unsigned char *screen); -static Minecraft_setScreen_t Minecraft_setScreen = (Minecraft_setScreen_t) 0x15d6c; +static Minecraft_setScreen_t Minecraft_setScreen = (Minecraft_setScreen_t) 0x16388; typedef void (*Minecraft_tick_t)(unsigned char *minecraft, int32_t param_1, int32_t param_2); -static Minecraft_tick_t Minecraft_tick = (Minecraft_tick_t) 0x16934; +static Minecraft_tick_t Minecraft_tick = (Minecraft_tick_t) 0x17030; typedef void (*Minecraft_update_t)(unsigned char *minecraft); -static Minecraft_update_t Minecraft_update = (Minecraft_update_t) 0x16b74; +static Minecraft_update_t Minecraft_update = (Minecraft_update_t) 0x172e4; typedef void (*Minecraft_hostMultiplayer_t)(unsigned char *minecraft, int32_t port); -static Minecraft_hostMultiplayer_t Minecraft_hostMultiplayer = (Minecraft_hostMultiplayer_t) 0x16664; +static Minecraft_hostMultiplayer_t Minecraft_hostMultiplayer = (Minecraft_hostMultiplayer_t) 0x16c50; typedef const char *(*Minecraft_getProgressMessage_t)(unsigned char *minecraft); -static Minecraft_getProgressMessage_t Minecraft_getProgressMessage = (Minecraft_getProgressMessage_t) 0x16e58; +static Minecraft_getProgressMessage_t Minecraft_getProgressMessage = (Minecraft_getProgressMessage_t) 0x17810; typedef uint32_t (*Minecraft_isLevelGenerated_t)(unsigned char *minecraft); -static Minecraft_isLevelGenerated_t Minecraft_isLevelGenerated = (Minecraft_isLevelGenerated_t) 0x16e6c; +static Minecraft_isLevelGenerated_t Minecraft_isLevelGenerated = (Minecraft_isLevelGenerated_t) 0x17824; typedef bool (*Minecraft_isCreativeMode_t)(unsigned char *minecraft); -static Minecraft_isCreativeMode_t Minecraft_isCreativeMode = (Minecraft_isCreativeMode_t) 0x17270; +static Minecraft_isCreativeMode_t Minecraft_isCreativeMode = (Minecraft_isCreativeMode_t) 0x17a48; typedef void (*Minecraft_releaseMouse_t)(unsigned char *minecraft); -static Minecraft_releaseMouse_t Minecraft_releaseMouse = (Minecraft_releaseMouse_t) 0x15d30; +static Minecraft_releaseMouse_t Minecraft_releaseMouse = (Minecraft_releaseMouse_t) 0x1634c; typedef void (*Minecraft_grabMouse_t)(unsigned char *minecraft); -static Minecraft_grabMouse_t Minecraft_grabMouse = (Minecraft_grabMouse_t) 0x15d10; +static Minecraft_grabMouse_t Minecraft_grabMouse = (Minecraft_grabMouse_t) 0x1632c; typedef void (*Minecraft_leaveGame_t)(unsigned char *minecraft, bool save_remote_level); -static Minecraft_leaveGame_t Minecraft_leaveGame = (Minecraft_leaveGame_t) 0x15ea0; +static Minecraft_leaveGame_t Minecraft_leaveGame = (Minecraft_leaveGame_t) 0x1653c; typedef int (*Minecraft_handleBack_t)(unsigned char *minecraft, bool do_nothing); static uint32_t Minecraft_handleBack_vtable_offset = 0x34; typedef unsigned char *(*Minecraft_getCreator_t)(unsigned char *minecraft); -static Minecraft_getCreator_t Minecraft_getCreator = (Minecraft_getCreator_t) 0x17538; +static Minecraft_getCreator_t Minecraft_getCreator = (Minecraft_getCreator_t) 0x17d74; typedef unsigned char *(*Minecraft_getLevelSource_t)(unsigned char *minecraft); -static Minecraft_getLevelSource_t Minecraft_getLevelSource = (Minecraft_getLevelSource_t) 0x16e84; +static Minecraft_getLevelSource_t Minecraft_getLevelSource = (Minecraft_getLevelSource_t) 0x1783c; typedef void (*Minecraft_handleMouseDown_t)(unsigned char *minecraft, int param_1, bool can_destroy); -static Minecraft_handleMouseDown_t Minecraft_handleMouseDown = (Minecraft_handleMouseDown_t) 0x1584c; +static Minecraft_handleMouseDown_t Minecraft_handleMouseDown = (Minecraft_handleMouseDown_t) 0x15dc8; static uint32_t Minecraft_screen_width_property_offset = 0x20; // int32_t static uint32_t Minecraft_screen_height_property_offset = 0x24; // int32_t -static uint32_t Minecraft_network_handler_property_offset = 0x174; // NetEventCallback * -static uint32_t Minecraft_rak_net_instance_property_offset = 0x170; // RakNetInstance * -static uint32_t Minecraft_level_property_offset = 0x188; // Level * -static uint32_t Minecraft_textures_property_offset = 0x164; // Textures * -static uint32_t Minecraft_game_mode_property_offset = 0x160; // GameMode * -static uint32_t Minecraft_player_property_offset = 0x18c; // LocalPlayer * -static uint32_t Minecraft_options_property_offset = 0x3c; // Options -static uint32_t Minecraft_hit_result_property_offset = 0xc38; // HitResult -static uint32_t Minecraft_progress_property_offset = 0xc60; // int32_t -static uint32_t Minecraft_command_server_property_offset = 0xcc0; // CommandServer * -static uint32_t Minecraft_screen_property_offset = 0xc10; // Screen * -static uint32_t Minecraft_gui_property_offset = 0x198; // Gui -static uint32_t Minecraft_pov_property_offset = 0x150; // Mob * -static uint32_t Minecraft_perf_renderer_property_offset = 0xcbc; // PerfRenderer * -static uint32_t Minecraft_targeted_x_property_offset = 0xc3c; // int32_t -static uint32_t Minecraft_targeted_y_property_offset = 0xc40; // int32_t -static uint32_t Minecraft_targeted_z_property_offset = 0xc44; // int32_t +static uint32_t Minecraft_network_handler_property_offset = 0x158; // NetEventCallback * +static uint32_t Minecraft_rak_net_instance_property_offset = 0x154; // RakNetInstance * +static uint32_t Minecraft_level_property_offset = 0x16c; // Level * +static uint32_t Minecraft_textures_property_offset = 0x148; // Textures * +static uint32_t Minecraft_game_mode_property_offset = 0x144; // GameMode * +static uint32_t Minecraft_player_property_offset = 0x170; // LocalPlayer * +static uint32_t Minecraft_options_property_offset = 0x28; // Options +static uint32_t Minecraft_hit_result_property_offset = 0xc1c; // HitResult +static uint32_t Minecraft_progress_property_offset = 0xc44; // int32_t +static uint32_t Minecraft_command_server_property_offset = 0xca4; // CommandServer * +static uint32_t Minecraft_screen_property_offset = 0xbf4; // Screen * +static uint32_t Minecraft_gui_property_offset = 0x17c; // Gui +static uint32_t Minecraft_pov_property_offset = 0x170; // Mob * +static uint32_t Minecraft_targeted_x_property_offset = 0xc20; // int32_t +static uint32_t Minecraft_targeted_y_property_offset = 0xc24; // int32_t +static uint32_t Minecraft_targeted_z_property_offset = 0xc28; // int32_t // GameRenderer typedef void (*GameRenderer_render_t)(unsigned char *game_renderer, float param_1); -static GameRenderer_render_t GameRenderer_render = (GameRenderer_render_t) 0x4a338; +static GameRenderer_render_t GameRenderer_render = (GameRenderer_render_t) 0x619c0; typedef void (*GameRenderer_setupCamera_t)(unsigned char *game_renderer, float param_1, int param_2); -static GameRenderer_setupCamera_t GameRenderer_setupCamera = (GameRenderer_setupCamera_t) 0x489f8; +static GameRenderer_setupCamera_t GameRenderer_setupCamera = (GameRenderer_setupCamera_t) 0x5fe80; static uint32_t GameRenderer_minecraft_property_offset = 0x4; // Minecraft * @@ -224,19 +183,19 @@ static uint32_t GameRenderer_minecraft_property_offset = 0x4; // Minecraft * typedef int (*Mouse_get_t)(); -static Mouse_get_t Mouse_getX = (Mouse_get_t) 0x1385c; -static Mouse_get_t Mouse_getY = (Mouse_get_t) 0x1386c; +static Mouse_get_t Mouse_getX = (Mouse_get_t) 0x13480; +static Mouse_get_t Mouse_getY = (Mouse_get_t) 0x13490; // CommandServer -static uint32_t CommandServer_minecraft_property_offset = 0x18; // Minecraft * +static uint32_t CommandServer_minecraft_property_offset = 0x14; // Minecraft * // ServerLevel #define SERVER_LEVEL_SIZE 0xb80 typedef unsigned char *(*ServerLevel_t)(unsigned char *server_level, unsigned char *storage, unsigned char *name, struct LevelSettings *settings, int param_4, unsigned char *dimension); -static ServerLevel_t ServerLevel = (ServerLevel_t) 0x7692c; +static ServerLevel_t ServerLevel = (ServerLevel_t) 0x9b6c4; // Packet @@ -244,16 +203,16 @@ typedef void (*Packet_read_t)(unsigned char *packet, unsigned char *bit_stream); // LoginPacket -static Packet_read_t LoginPacket_read = (Packet_read_t) 0x6e5f8; -static void *LoginPacket_read_vtable_addr = (void *) 0x108dcc; +static Packet_read_t LoginPacket_read = (Packet_read_t) 0x8fc4c; +static void *LoginPacket_read_vtable_addr = (void *) 0x169e64; static uint32_t LoginPacket_username_property_offset = 0xc; // RakString // StartGamePacket typedef void (*StartGamePacket_read_t)(unsigned char *packet, unsigned char *bit_stream); -static StartGamePacket_read_t StartGamePacket_read = (StartGamePacket_read_t) 0x72c58; -static void *StartGamePacket_read_vtable_addr = (void *) 0x109264; +static StartGamePacket_read_t StartGamePacket_read = (StartGamePacket_read_t) 0x96e50; +static void *StartGamePacket_read_vtable_addr = (void *) 0x16a2cc; static uint32_t StartGamePacket_game_mode_property_offset = 0x14; // int32_t @@ -267,16 +226,9 @@ static uint32_t HitResult_type_property_offset = 0x0; // Options -typedef void (*Options_initDefaultValue_t)(unsigned char *options); -static Options_initDefaultValue_t Options_initDefaultValue = (Options_initDefaultValue_t) 0x18a54; - -typedef bool (*Options_getBooleanValue_t)(unsigned char *options, unsigned char *option); -static Options_getBooleanValue_t Options_getBooleanValue = (Options_getBooleanValue_t) 0x1cd74; - -static uint32_t Options_options_file_property_offset = 0x10c; // OptionsFile static uint32_t Options_fancy_graphics_property_offset = 0x17; // unsigned char / bool -static uint32_t Options_split_controls_property_offset = 0x105; // int32_t static uint32_t Options_game_difficulty_property_offset = 0xe8; // int32_t +static uint32_t Options_split_controls_property_offset = 0x105; // unsigned char / bool static uint32_t Options_3d_anaglyph_property_offset = 0x15; // unsigned char / bool static uint32_t Options_ambient_occlusion_property_offset = 0x18; // unsigned char / bool static uint32_t Options_hide_gui_property_offset = 0xec; // unsigned char / bool @@ -285,21 +237,12 @@ static uint32_t Options_render_distance_property_offset = 0x10; // int32_t static uint32_t Options_sound_property_offset = 0x4; // int32_t static uint32_t Options_debug_property_offset = 0xee; // unsigned char / bool static uint32_t Options_server_visible_property_offset = 0x104; // unsigned char / bool -static uint32_t Options_username_property_offset = 0x100; // std::string - -// OptionButton - -typedef unsigned char *(*OptionButton_t)(unsigned char *option_button, unsigned char *option); -static OptionButton_t OptionButton = (OptionButton_t) 0x1c968; - -typedef void (*OptionButton_updateImage_t)(unsigned char *option_button, unsigned char *options); -static OptionButton_updateImage_t OptionButton_updateImage = (OptionButton_updateImage_t) 0x1ca58; // MouseBuildInput typedef int32_t (*MouseBuildInput_tickBuild_t)(unsigned char *mouse_build_input, unsigned char *player, uint32_t *build_action_intention_return); -static MouseBuildInput_tickBuild_t MouseBuildInput_tickBuild = (MouseBuildInput_tickBuild_t) 0x17c98; -static void *MouseBuildInput_tickBuild_vtable_addr = (void *) 0x102564; +static MouseBuildInput_tickBuild_t MouseBuildInput_tickBuild = (MouseBuildInput_tickBuild_t) 0x19118; +static void *MouseBuildInput_tickBuild_vtable_addr = (void *) 0x16405c; // ItemInstance @@ -310,28 +253,27 @@ typedef struct { } ItemInstance; typedef ItemInstance *(*ItemInstance_constructor_t)(ItemInstance *item_instance, unsigned char *item); -static ItemInstance_constructor_t ItemInstance_constructor_item = (ItemInstance_constructor_t) 0x9992c; -static ItemInstance_constructor_t ItemInstance_constructor_tile = (ItemInstance_constructor_t) 0x998e4; +static ItemInstance_constructor_t ItemInstance_constructor_item = (ItemInstance_constructor_t) 0xdf40c; +static ItemInstance_constructor_t ItemInstance_constructor_tile = (ItemInstance_constructor_t) 0xdf3c8; typedef ItemInstance *(*ItemInstance_constructor_extra_t)(ItemInstance *item_instance, unsigned char *item, int32_t count, int32_t auxiliary); -static ItemInstance_constructor_extra_t ItemInstance_constructor_tile_extra = (ItemInstance_constructor_extra_t) 0x99918; -static ItemInstance_constructor_extra_t ItemInstance_constructor_item_extra = (ItemInstance_constructor_extra_t) 0x99960; +static ItemInstance_constructor_extra_t ItemInstance_constructor_tile_extra = (ItemInstance_constructor_extra_t) 0xdf3fc; +static ItemInstance_constructor_extra_t ItemInstance_constructor_item_extra = (ItemInstance_constructor_extra_t) 0xdf440; typedef int32_t (*ItemInstance_getMaxStackSize_t)(ItemInstance *item_instance); -static ItemInstance_getMaxStackSize_t ItemInstance_getMaxStackSize = (ItemInstance_getMaxStackSize_t) 0x99ac8; +static ItemInstance_getMaxStackSize_t ItemInstance_getMaxStackSize = (ItemInstance_getMaxStackSize_t) 0xdf5b0; // Item #define ITEM_SIZE 0x24 -#define ITEM_VTABLE_SIZE 0x98 +#define ITEM_VTABLE_SIZE 0x94 -static unsigned char *Item_vtable = (unsigned char *) 0x10f128; +static unsigned char **Item_items = (unsigned char **) 0x1d9e80; + +static unsigned char *Item_vtable = (unsigned char *) 0x16fdf0; typedef void (*Item_initItems_t)(); -static Item_initItems_t Item_initItems = (Item_initItems_t) 0x94ed0; - -typedef unsigned char *(*Item_t)(unsigned char *item, int32_t id); -static Item_t Item = (Item_t) 0x99488; +static Item_initItems_t Item_initItems = (Item_initItems_t) 0xd99cc; typedef void (*Item_setIcon_t)(unsigned char *item, int32_t texture_x, int32_t texture_y); static uint32_t Item_setIcon_vtable_offset = 0x18; @@ -343,10 +285,13 @@ typedef int32_t (*Item_useOn_t)(unsigned char *item, ItemInstance *item_instance static uint32_t Item_useOn_vtable_offset = 0x20; static uint32_t Item_id_property_offset = 0x4; // int32_t +static uint32_t Item_is_hand_equipped_property_offset = 0x18; // unsigned char / bool static uint32_t Item_is_stacked_by_data_property_offset = 0x19; // unsigned char / bool static uint32_t Item_category_property_offset = 0x10; // int32_t static uint32_t Item_max_damage_property_offset = 0x8; // int32_t static uint32_t Item_max_stack_size_property_offset = 0x14; // int32_t +static uint32_t Item_crafting_remaining_item_property_offset = 0x1c; // Item * +static uint32_t Item_description_id_property_offset = 0x20; // std::string // TileItem @@ -357,7 +302,7 @@ static TileItem_t TileItem = (TileItem_t) 0xce3a4; #define AUX_DATA_TILE_ITEM_SIZE 0x2c -static unsigned char *AuxDataTileItem_vtable = (unsigned char *) 0x114a58; +static unsigned char *AuxDataTileItem_vtable = (unsigned char *) 0x175220; static uint32_t AuxDataTileItem_icon_tile_property_offset = 0x28; // Tile * @@ -377,10 +322,8 @@ static uint32_t Entity_old_pitch_property_offset = 0x4c; // float // Mob typedef void (*Mob_actuallyHurt_t)(unsigned char *entity, int32_t damage); -static Mob_actuallyHurt_t Mob_actuallyHurt = (Mob_actuallyHurt_t) 0x7f11c; -static uint32_t Mob_actuallyHurt_vtable_offset = 0x16c; - -typedef float (*Mob_getWalkingSpeedModifier_t)(unsigned char *entity); +static Mob_actuallyHurt_t Mob_actuallyHurt = (Mob_actuallyHurt_t) 0xab2d4; +static uint32_t Mob_actuallyHurt_vtable_offset = 0x1a0; typedef void (*Mob_die_t)(unsigned char *entity, unsigned char *cause); static uint32_t Mob_die_vtable_offset = 0x130; @@ -390,51 +333,47 @@ static uint32_t Mob_health_property_offset = 0xec; // int32_t // Player typedef int (*Player_isUsingItem_t)(unsigned char *player); -static Player_isUsingItem_t Player_isUsingItem = (Player_isUsingItem_t) 0x8f15c; +static Player_isUsingItem_t Player_isUsingItem = (Player_isUsingItem_t) 0xceb24; typedef void (*Player_drop_t)(unsigned char *player, ItemInstance *item_instance, bool is_death); -static uint32_t Player_drop_vtable_offset = 0x208; +static uint32_t Player_drop_vtable_offset = 0x1f8; -static Mob_getWalkingSpeedModifier_t Player_getWalkingSpeedModifier = (Mob_getWalkingSpeedModifier_t) 0x8ea0c; - -static uint32_t Player_username_property_offset = 0xbf4; // std::string -static uint32_t Player_inventory_property_offset = 0xbe0; // Inventory * +static uint32_t Player_username_property_offset = 0xbec; // std::string +static uint32_t Player_inventory_property_offset = 0xbd8; // Inventory * // LocalPlayer -static Mob_actuallyHurt_t LocalPlayer_actuallyHurt = (Mob_actuallyHurt_t) 0x44010; -static void *LocalPlayer_actuallyHurt_vtable_addr = (void *) 0x10639c; +static Mob_actuallyHurt_t LocalPlayer_actuallyHurt = (Mob_actuallyHurt_t) 0x59f48; +static void *LocalPlayer_actuallyHurt_vtable_addr = (void *) 0x1676d0; -static void *LocalPlayer_openTextEdit_vtable_addr = (void *) 0x106460; +static Mob_die_t LocalPlayer_die = (Mob_die_t) 0x5b208; +static void *LocalPlayer_die_vtable_addr = (void *) 0x167660; -static Mob_die_t LocalPlayer_die = (Mob_die_t) 0x45078; -static void *LocalPlayer_die_vtable_addr = (void *) 0x106360; - -static uint32_t LocalPlayer_minecraft_property_offset = 0xc90; // Minecraft * +static uint32_t LocalPlayer_minecraft_property_offset = 0xc58; // Minecraft * // ServerPlayer -static void *ServerPlayer_actuallyHurt_vtable_addr = (void *) 0x109fa4; +static void *ServerPlayer_actuallyHurt_vtable_addr = (void *) 0x16b020; -static uint32_t ServerPlayer_minecraft_property_offset = 0xc8c; // Minecraft * -static uint32_t ServerPlayer_guid_property_offset = 0xc08; // RakNetGUID +static uint32_t ServerPlayer_minecraft_property_offset = 0xc54; // Minecraft * +static uint32_t ServerPlayer_guid_property_offset = 0xc00; // RakNetGUID // Gui typedef void (*Gui_tick_t)(unsigned char *gui); -static Gui_tick_t Gui_tick = (Gui_tick_t) 0x27778; +static Gui_tick_t Gui_tick = (Gui_tick_t) 0x2b0b0; typedef void (*Gui_handleClick_t)(unsigned char *gui, int32_t param_2, int32_t param_3, int32_t param_4); -static Gui_handleClick_t Gui_handleClick = (Gui_handleClick_t) 0x2599c; +static Gui_handleClick_t Gui_handleClick = (Gui_handleClick_t) 0x2a8f0; typedef void (*Gui_renderOnSelectItemNameText_t)(unsigned char *gui, int32_t param_1, unsigned char *font, int32_t param_2); -static Gui_renderOnSelectItemNameText_t Gui_renderOnSelectItemNameText = (Gui_renderOnSelectItemNameText_t) 0x26aec; +static Gui_renderOnSelectItemNameText_t Gui_renderOnSelectItemNameText = (Gui_renderOnSelectItemNameText_t) 0x2bcb8; typedef void (*Gui_renderToolBar_t)(unsigned char *gui, float param_1, int32_t param_2, int32_t param_3); -static Gui_renderToolBar_t Gui_renderToolBar = (Gui_renderToolBar_t) 0x26c30; +static Gui_renderToolBar_t Gui_renderToolBar = (Gui_renderToolBar_t) 0x2c104; typedef void (*Gui_renderChatMessages_t)(unsigned char *gui, int32_t y_offset, uint32_t max_messages, bool disable_fading, unsigned char *font); -static Gui_renderChatMessages_t Gui_renderChatMessages = (Gui_renderChatMessages_t) 0x273d8; +static Gui_renderChatMessages_t Gui_renderChatMessages = (Gui_renderChatMessages_t) 0x2bed8; static uint32_t Gui_minecraft_property_offset = 0x9f4; // Minecraft * static uint32_t Gui_selected_item_text_timer_property_offset = 0x9fc; // float @@ -442,36 +381,36 @@ static uint32_t Gui_selected_item_text_timer_property_offset = 0x9fc; // float // Textures typedef void (*Textures_tick_t)(unsigned char *textures, bool param_1); -static Textures_tick_t Textures_tick = (Textures_tick_t) 0x531c4; +static Textures_tick_t Textures_tick = (Textures_tick_t) 0x6bee4; // GameMode Constructors #define CREATOR_MODE_SIZE 0x1c -static void *CreatorMode = (void *) 0x1a044; +static void *CreatorMode = (void *) 0x1d254; #define SURVIVAL_MODE_SIZE 0x24 -static void *SurvivalMode = (void *) 0x1b7d8; +static void *SurvivalMode = (void *) 0x1fecc; // LevelData typedef uint32_t (*LevelData_getSpawnMobs_t)(unsigned char *level_data); -static LevelData_getSpawnMobs_t LevelData_getSpawnMobs = (LevelData_getSpawnMobs_t) 0xbabec; +static LevelData_getSpawnMobs_t LevelData_getSpawnMobs = (LevelData_getSpawnMobs_t) 0x1171e0; // Level typedef void (*Level_saveLevelData_t)(unsigned char *level); -static Level_saveLevelData_t Level_saveLevelData = (Level_saveLevelData_t) 0xa2e94; +static Level_saveLevelData_t Level_saveLevelData = (Level_saveLevelData_t) 0xeef98; typedef void (*Level_setTileAndData_t)(unsigned char *level, int32_t x, int32_t y, int32_t z, int32_t id, int32_t data); -static Level_setTileAndData_t Level_setTileAndData = (Level_setTileAndData_t) 0xa38b4; +static Level_setTileAndData_t Level_setTileAndData = (Level_setTileAndData_t) 0xefa8c; typedef int32_t (*Level_getTile_t)(unsigned char *level, int32_t x, int32_t y, int32_t z); -static Level_getTile_t Level_getTile = (Level_getTile_t) 0xa3380; +static Level_getTile_t Level_getTile = (Level_getTile_t) 0xee670; typedef unsigned char *(*Level_getMaterial_t)(unsigned char *level, int32_t x, int32_t y, int32_t z); -static Level_getMaterial_t Level_getMaterial = (Level_getMaterial_t) 0xa27f8; +static Level_getMaterial_t Level_getMaterial = (Level_getMaterial_t) 0xee400; typedef void (*Level_clip_t)(unsigned char *level, unsigned char *param_1, unsigned char *param_2, bool param_3, bool clip_liquids); -static Level_clip_t Level_clip = (Level_clip_t) 0xa3db0; +static Level_clip_t Level_clip = (Level_clip_t) 0xf0038; static uint32_t Level_players_property_offset = 0x60; // std::vector @@ -483,136 +422,110 @@ static uint32_t Material_isSolid_vtable_offset = 0x8; // LevelRenderer typedef void (*LevelRenderer_render_t)(unsigned char *level_renderer, unsigned char *mob, int param_1, float delta); -static LevelRenderer_render_t LevelRenderer_render = (LevelRenderer_render_t) 0x4f710; +static LevelRenderer_render_t LevelRenderer_render = (LevelRenderer_render_t) 0x67604; typedef void (*LevelRenderer_renderDebug_t)(unsigned char *level_renderer, struct AABB *aabb, float delta); -static LevelRenderer_renderDebug_t LevelRenderer_renderDebug = (LevelRenderer_renderDebug_t) 0x4d310; +static LevelRenderer_renderDebug_t LevelRenderer_renderDebug = (LevelRenderer_renderDebug_t) 0x65c34; static uint32_t LevelRenderer_minecraft_property_offset = 0x4; // Minecraft * -// PerfRenderer - -typedef void (*PerfRenderer_debugFpsMeterKeyPress_t)(unsigned char *perf_renderer, int key); -static PerfRenderer_debugFpsMeterKeyPress_t PerfRenderer_debugFpsMeterKeyPress = (PerfRenderer_debugFpsMeterKeyPress_t) 0x79118; - -// TextEditScreen - -#define TEXT_EDIT_SCREEN_SIZE 0xa9 - -typedef unsigned char *(*TextEditScreen_t)(unsigned char *text_edit_screen, unsigned char *sign); -static TextEditScreen_t TextEditScreen = (TextEditScreen_t) 0x3a840; - -static void *TextEditScreen_updateEvents_vtable_addr = (void *) 0x10531c; - // ProgressScreen -#define PROGRESS_SCREEN_SIZE 0x4c +#define PROGRESS_SCREEN_SIZE 0x40 typedef unsigned char *(*ProgressScreen_t)(unsigned char *obj); -static ProgressScreen_t ProgressScreen = (ProgressScreen_t) 0x37044; +static ProgressScreen_t ProgressScreen = (ProgressScreen_t) 0x42a08; // OptionsScreen -static void *OptionsScreen_handleBackEvent_vtable_addr = (void *) 0x10499c; +static void *OptionsScreen_handleBackEvent_vtable_addr = (void *) 0x165fb8; // FurnaceScreen typedef int32_t (*FurnaceScreen_handleAddItem_t)(unsigned char *furnace_screen, int32_t slot, ItemInstance const *item); -static FurnaceScreen_handleAddItem_t FurnaceScreen_handleAddItem = (FurnaceScreen_handleAddItem_t) 0x327a0; +static FurnaceScreen_handleAddItem_t FurnaceScreen_handleAddItem = (FurnaceScreen_handleAddItem_t) 0x3c534; -static uint32_t FurnaceScreen_tile_entity_property_offset = 0x1d0; // FurnaceTileEntity * +static uint32_t FurnaceScreen_tile_entity_property_offset = 0x1b0; // FurnaceTileEntity * // FurnaceTileEntity typedef ItemInstance *(*FurnaceTileEntity_getItem_t)(unsigned char *furnace_tile_entity, int32_t slot); -static uint32_t FurnaceTileEntity_getItem_vtable_offset = 0x2c; +static uint32_t FurnaceTileEntity_getItem_vtable_offset = 0x28; // GuiComponent typedef void (*GuiComponent_blit_t)(unsigned char *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src); -static GuiComponent_blit_t GuiComponent_blit = (GuiComponent_blit_t) 0x282a4; +static GuiComponent_blit_t GuiComponent_blit = (GuiComponent_blit_t) 0x2e398; // Screen -typedef void (*Screen_updateEvents_t)(unsigned char *screen); -static Screen_updateEvents_t Screen_updateEvents = (Screen_updateEvents_t) 0x28eb8; - -typedef void (*Screen_keyboardNewChar_t)(unsigned char *screen, char key); -static uint32_t Screen_keyboardNewChar_vtable_offset = 0x70; - -typedef void (*Screen_keyPressed_t)(unsigned char *screen, int32_t key); -static uint32_t Screen_keyPressed_vtable_offset = 0x6c; - typedef void (*Screen_init_t)(unsigned char *screen); typedef void (*Screen_tick_t)(unsigned char *screen); typedef void (*Screen_render_t)(unsigned char *screen, int32_t param_1, int32_t param_2, float param_3); -static Screen_render_t Screen_render = (Screen_render_t) 0x28a00; +static Screen_render_t Screen_render = (Screen_render_t) 0x2eaf4; typedef int32_t (*Screen_handleBackEvent_t)(unsigned char *screen, bool param_1); static uint32_t Screen_minecraft_property_offset = 0x14; // Minecraft * static uint32_t Screen_rendered_buttons_property_offset = 0x18; // std::vector