From 9556d13791211a61cb798f64d13d92ec807d5d21 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 15 Feb 2024 23:02:44 -0500 Subject: [PATCH] Minor Tweaks --- dependencies/symbol-processor/src | 2 +- launcher/src/client/available-feature-flags | 1 + mods/src/misc/misc.c | 12 ++++++++---- symbols/CMakeLists.txt | 2 -- symbols/src/entity/Entity.def | 1 + symbols/src/entity/EntityRenderDispatcher.def | 2 ++ symbols/src/entity/EntityRenderer.def | 3 +++ symbols/src/item/ItemInHandRenderer.def | 2 -- symbols/src/level/container/Container.def | 2 ++ symbols/src/level/container/Inventory.def | 1 + symbols/src/tile/entity/TileEntity.def | 2 -- .../src/tile/entity/TileEntityRenderDispatcher.def | 2 +- 12 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dependencies/symbol-processor/src b/dependencies/symbol-processor/src index 8bca4b7ec6..225eb259fe 160000 --- a/dependencies/symbol-processor/src +++ b/dependencies/symbol-processor/src @@ -1 +1 @@ -Subproject commit 8bca4b7ec6aa28ef6fbc894d1f358468bcc4b321 +Subproject commit 225eb259fe00348044b7b9008a810204004701df diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index 4086ac1994..9222b00fc7 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -60,3 +60,4 @@ FALSE Food Overlay TRUE Add Splashes TRUE Display Date In Select World Screen TRUE Optimized Chunk Sorting +TRUE Disable Buggy Held Item Caching diff --git a/mods/src/misc/misc.c b/mods/src/misc/misc.c index 9cd0feaa30..332bd81d49 100644 --- a/mods/src/misc/misc.c +++ b/mods/src/misc/misc.c @@ -834,10 +834,14 @@ void init_misc() { overwrite_calls((void *) Player_stopUsingItem, (void *) Player_stopUsingItem_injection); // Fix invalid ItemInHandRenderer texture cache - uchar cmp_r7_patch[] = {0x07, 0x00, 0x57, 0xe1}; // "cmp r7,r7" - patch((void *) 0x4b938, cmp_r7_patch); - uchar moveq_r3_true_patch[] = {0x01, 0x30, 0xa0, 0x03}; // "moveq r3,#0x1" - patch((void *) 0x4b93c, moveq_r3_true_patch); + if (feature_has("Disable Buggy Held Item Caching", server_disabled)) { + // This works by forcing MCPI to always use the branch that enables using the + // cache, but then patches that as well to do the opposite + uchar ensure_equal_patch[] = {0x07, 0x00, 0x57, 0xe1}; // "cmp r7, r7" + patch((void *) 0x4b938, ensure_equal_patch); + uchar set_true_patch[] = {0x01, 0x30, 0xa0, 0x03}; // "moveq r3, #0x1" + patch((void *) 0x4b93c, set_true_patch); + } // Init C++ And Logging _init_misc_cpp(); diff --git a/symbols/CMakeLists.txt b/symbols/CMakeLists.txt index 2cd7abb01d..cabb173e11 100644 --- a/symbols/CMakeLists.txt +++ b/symbols/CMakeLists.txt @@ -232,5 +232,3 @@ install(TARGETS symbols DESTINATION "${MCPI_LIB_DIR}") # SDK install(TARGETS symbols EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") install(DIRECTORY "${INCLUDE_OUTPUT_DIR}/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/symbols") - -target_compile_options(symbols PUBLIC $<$:-Wno-invalid-offsetof>) diff --git a/symbols/src/entity/Entity.def b/symbols/src/entity/Entity.def index e9ca743dc4..ec7a88b41e 100644 --- a/symbols/src/entity/Entity.def +++ b/symbols/src/entity/Entity.def @@ -32,6 +32,7 @@ property float pitch = 0x44; property float old_yaw = 0x48; property float old_pitch = 0x4c; property AABB hitbox = 0x50; +property float height_offset = 0x68; property int fire_timer = 0xa0; property int renderer_id = 0xa8; property bool on_ground = 0xb2; diff --git a/symbols/src/entity/EntityRenderDispatcher.def b/symbols/src/entity/EntityRenderDispatcher.def index d678fc4652..355dc4508f 100644 --- a/symbols/src/entity/EntityRenderDispatcher.def +++ b/symbols/src/entity/EntityRenderDispatcher.def @@ -1,3 +1,5 @@ constructor () = 0x6096c; method void assign(uchar entity_id, EntityRenderer *renderer) = 0x6094c; +method void render(Entity *entity, float x, float y, float z, float rot, float unknown) = 0x60674; +static-method EntityRenderDispatcher *getInstance() = 0x60e90; diff --git a/symbols/src/entity/EntityRenderer.def b/symbols/src/entity/EntityRenderer.def index 6b4880befd..c02bbab668 100644 --- a/symbols/src/entity/EntityRenderer.def +++ b/symbols/src/entity/EntityRenderer.def @@ -2,3 +2,6 @@ virtual-method void render(Entity *entity, float param_2, float param_3, float p // Can be called without an EntityRenderer, just do EntityRenderer_bindTexture(NULL, &file); method void bindTexture(std::string *file) = 0x62540; + +// Globals +static-property EntityRenderDispatcher *entityRenderDispatcher = 0x137bc0; diff --git a/symbols/src/item/ItemInHandRenderer.def b/symbols/src/item/ItemInHandRenderer.def index aace45ef08..ac3f3ed723 100644 --- a/symbols/src/item/ItemInHandRenderer.def +++ b/symbols/src/item/ItemInHandRenderer.def @@ -5,5 +5,3 @@ property Minecraft *mc = 0x18; method void renderItem(Mob *mob, ItemInstance *item) = 0x4b824; method void render(float param_1) = 0x4bfcc; - -static-property ItemInHandRenderer **instance = 0x137bc0; diff --git a/symbols/src/level/container/Container.def b/symbols/src/level/container/Container.def index 3b89373490..b14460df69 100644 --- a/symbols/src/level/container/Container.def +++ b/symbols/src/level/container/Container.def @@ -2,3 +2,5 @@ virtual-method void startOpen() = 0x24; virtual-method void stopOpen() = 0x28; virtual-method ItemInstance *getItem(int slot) = 0x8; virtual-method void setItem(int slot, ItemInstance *item_instance) = 0xc; +virtual-method int getContainerSize() = 0x18; +virtual-method std::vector getSlotCopies() = 0x2c; diff --git a/symbols/src/level/container/Inventory.def b/symbols/src/level/container/Inventory.def index 1108f0b939..7a1158c1e7 100644 --- a/symbols/src/level/container/Inventory.def +++ b/symbols/src/level/container/Inventory.def @@ -5,5 +5,6 @@ method void selectSlot(int slot) = 0x8d13c; method ItemInstance *getSelected() = 0x8d134; // It's just FillingContainer_linkSlot with selectedSlot as linked_slot method bool moveToSelectedSlot(int unlinked_slot, bool push_aside) = 0x8d148; +method void setupDefault() = 0x8d164; property int selectedSlot = 0x28; diff --git a/symbols/src/tile/entity/TileEntity.def b/symbols/src/tile/entity/TileEntity.def index 68c0064119..a3f6a45f11 100644 --- a/symbols/src/tile/entity/TileEntity.def +++ b/symbols/src/tile/entity/TileEntity.def @@ -22,5 +22,3 @@ property bool is_client = 0x20; property int renderer_id = 0x24; property Tile *tile = 0x28; property bool pending_removal = 0x2c; -//property int tile = 0xd0; -//property int lifetime = 0xd8; diff --git a/symbols/src/tile/entity/TileEntityRenderDispatcher.def b/symbols/src/tile/entity/TileEntityRenderDispatcher.def index 92d67cd1b1..a4f52bad26 100644 --- a/symbols/src/tile/entity/TileEntityRenderDispatcher.def +++ b/symbols/src/tile/entity/TileEntityRenderDispatcher.def @@ -1,4 +1,4 @@ constructor () = 0x66f18; property Level *level = 0x4; -property std::map renderer_map = 0x24; +property std::map renderer_map = 0x24;