diff --git a/dependencies/symbol-processor/src b/dependencies/symbol-processor/src index 46c486e5..6f792dfb 160000 --- a/dependencies/symbol-processor/src +++ b/dependencies/symbol-processor/src @@ -1 +1 @@ -Subproject commit 46c486e56a15334ccc4bd52bcc9ab1bfbcb7d27e +Subproject commit 6f792dfb167e48e2e80b8484ac51261ab976b22d diff --git a/libreborn/include/libreborn/patch.h b/libreborn/include/libreborn/patch.h index cac7abdc..65732955 100644 --- a/libreborn/include/libreborn/patch.h +++ b/libreborn/include/libreborn/patch.h @@ -15,10 +15,10 @@ void overwrite_call(void *start, void *target); // Replace All Calls To Method start With target void *overwrite_calls_manual(void *start, void *target, bool allow_no_callsites = false); template -void overwrite_calls(T &target, typename T::overwrite_type replacement) { - DEBUG("Overwriting Method: %s", target.get_name()); - if (!target.overwrite(replacement)) { - ERR("Unable To Overwrite Method: %s", target.get_name()); +void overwrite_calls(T *target, typename T::overwrite_type replacement) { + DEBUG("Overwriting Method: %s", target->get_name()); + if (!target->overwrite(replacement)) { + ERR("Unable To Overwrite Method: %s", target->get_name()); } } @@ -44,9 +44,9 @@ void patch_address(void *start, void *target); // Patch VTable Entry // This does not affect subclasses. template -void patch_vtable(const T &start, typename T::ptr_type target) { - DEBUG("Patching VTable: %s", start.get_name()); - patch_address((void *) start.get_vtable_addr(), (void *) target); +void patch_vtable(const T *start, typename T::ptr_type target) { + DEBUG("Patching VTable: %s", start->get_name()); + patch_address((void *) start->get_vtable_addr(), (void *) target); } #endif diff --git a/mods/src/bucket/bucket.cpp b/mods/src/bucket/bucket.cpp index 4da16580..6f45beb3 100644 --- a/mods/src/bucket/bucket.cpp +++ b/mods/src/bucket/bucket.cpp @@ -136,7 +136,7 @@ static int BucketItem_getUseDuration(__attribute__((unused)) FoodItem *item, Ite static ItemInstance BucketItem_useTimeDepleted(FoodItem *item, ItemInstance *item_instance, Level *level, Player *player) { if (item_instance->auxiliary == 1) { - *item_instance = FoodItem_useTimeDepleted.get()(item, item_instance, level, player); + *item_instance = FoodItem_useTimeDepleted->get()(item, item_instance, level, player); // Set it to a empty bucket item_instance->auxiliary = 0; item_instance->count = 1; @@ -154,7 +154,7 @@ static bool BucketItem_isFood(__attribute__((unused)) FoodItem *item) { static ItemInstance *BucketItem_use(FoodItem *item, ItemInstance *item_instance, __attribute__((unused)) Level *level, Player *player) { if (item_instance->auxiliary == 1) { - return FoodItem_use.get()(item, item_instance, level, player); + return FoodItem_use->get()(item, item_instance, level, player); } return item_instance; } @@ -188,7 +188,7 @@ static FoodItem *create_bucket(int32_t id, int32_t texture_x, int32_t texture_y, // Construct FoodItem *item = new FoodItem; ALLOC_CHECK(item); - Item_constructor.get()((Item *) item, id); // FoodItem's Constructor Was Inlined + Item_constructor->get()((Item *) item, id); // FoodItem's Constructor Was Inlined // Set VTable item->vtable = get_bucket_vtable(); diff --git a/mods/src/death/death.cpp b/mods/src/death/death.cpp index 40b236f6..792066a2 100644 --- a/mods/src/death/death.cpp +++ b/mods/src/death/death.cpp @@ -93,7 +93,7 @@ static void Player_actuallyHurt_injection(Self *player, int32_t damage) { int32_t old_health = player->health; // Call Original Method - Mob_actuallyHurt.get()((Mob *) player, damage); + Mob_actuallyHurt->get()((Mob *) player, damage); if (is_hurt) { return; } @@ -122,7 +122,7 @@ void init_death() { // Death Messages if (feature_has("Implement Death Messages", server_auto)) { patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) { - Player_die_injection(Player_die.get(), player, cause); + Player_die_injection(Player_die->get(), player, cause); }); overwrite_calls(LocalPlayer_die, Player_die_injection); patch_vtable(LocalPlayer_actuallyHurt, Player_actuallyHurt_injection); diff --git a/mods/src/game-mode/game-mode.cpp b/mods/src/game-mode/game-mode.cpp index c6847908..c5d32129 100644 --- a/mods/src/game-mode/game-mode.cpp +++ b/mods/src/game-mode/game-mode.cpp @@ -21,7 +21,7 @@ static void set_is_survival(bool new_is_survival) { patch((void *) 0x16ee4, size_patch); // Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor - overwrite_call((void *) 0x16ef4, new_is_survival ? (void *) SurvivalMode_constructor.get() : (void *) CreatorMode_constructor.get()); + overwrite_call((void *) 0x16ef4, new_is_survival ? (void *) SurvivalMode_constructor->get() : (void *) CreatorMode_constructor->get()); is_survival = new_is_survival; } @@ -54,7 +54,7 @@ void init_game_mode() { overwrite_calls(Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection); // Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning) - overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor.get()); + overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor->get()); // Allocate Correct Size For ServerLevel uint32_t level_size = sizeof(ServerLevel); diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 8d2c9971..ed1527af 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -90,7 +90,7 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) { original(gui); } static GuiComponent_blit_t get_blit_with_classic_hud_offset() { - return use_classic_hud ? Gui_renderHearts_GuiComponent_blit_hearts_injection : GuiComponent_blit.get(); + return use_classic_hud ? Gui_renderHearts_GuiComponent_blit_hearts_injection : GuiComponent_blit->get(); } #define PINK_HEART_FULL 70 #define PINK_HEART_HALF 79 diff --git a/mods/src/title-screen/title-screen.cpp b/mods/src/title-screen/title-screen.cpp index d9dba760..9d33ea39 100644 --- a/mods/src/title-screen/title-screen.cpp +++ b/mods/src/title-screen/title-screen.cpp @@ -70,7 +70,7 @@ static Screen *last_screen = nullptr; static std::string current_splash; static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) { // Call Original Method - Screen_render.get()(screen, x, y, param_1); + Screen_render->get()(screen, x, y, param_1); // Load Splashes static std::vector splashes; @@ -83,28 +83,28 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x } // Display Splash - if (splashes.size() > 0) { + if (!splashes.empty()) { // Pick Splash if (last_screen != screen) { last_screen = screen; current_splash = splashes[rand() % splashes.size()]; } // Choose Position - float multiplier = touch_gui ? 0.5f : 1.0f; - float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier); - float splash_y = 4.0f + (36.0f * multiplier); - float max_width = 86; - float max_scale = 2.0f; + const float multiplier = touch_gui ? 0.5f : 1.0f; + const float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier); + const float splash_y = 4.0f + (36.0f * multiplier); + const float max_width = 86; + const float max_scale = 2.0f; // Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718) glPushMatrix(); // Position glTranslatef(splash_x, splash_y, 0.0f); glRotatef(-20.0f, 0.0f, 0.0f, 1.0f); // Scale - int textWidth = screen->font->width(current_splash); - float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f; + const int textWidth = screen->font->width(current_splash); + const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f; float scale = max_scale - Mth::abs(0.1f * Mth::sin(2.0f * float(M_PI) * timeMS)); - float real_text_width = textWidth * max_scale; + const float real_text_width = textWidth * max_scale; if (real_text_width > max_width) { scale *= max_width / real_text_width; } diff --git a/mods/src/touch/touch.cpp b/mods/src/touch/touch.cpp index 85cb6813..4dc9cd96 100644 --- a/mods/src/touch/touch.cpp +++ b/mods/src/touch/touch.cpp @@ -73,10 +73,10 @@ void init_touch() { // 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_constructor.get()); + overwrite_call((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen_constructor->get()); // Make "Craft" And "Armor" Buttons Use Classic GUI Style (Button And TButton Have The Same Size) - overwrite_call((void *) 0x3b060, (void *) Button_constructor.get()); - overwrite_call((void *) 0x3b08c, (void *) Button_constructor.get()); + overwrite_call((void *) 0x3b060, (void *) Button_constructor->get()); + overwrite_call((void *) 0x3b08c, (void *) Button_constructor->get()); } // Force Touch Button Behavior diff --git a/test b/test deleted file mode 100755 index 2133302f..00000000 Binary files a/test and /dev/null differ diff --git a/test.cpp b/test.cpp deleted file mode 100644 index 87636c6d..00000000 --- a/test.cpp +++ /dev/null @@ -1,12 +0,0 @@ -class A { - void hi() {} - int a; -}; - -class B : public A { - virtual void bye() {} -}; - -int main() { - B b; -}