From f53f405bddfe5d4acee568a4a96f7980989f1c08 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 24 May 2024 04:44:53 -0400 Subject: [PATCH] The Compiler Strikes Back! --- dependencies/symbol-processor/src | 2 +- libreborn/include/libreborn/patch.h | 60 +++++++------------------- mods/include/mods/misc/misc.h | 53 ++++------------------- mods/src/bucket/bucket.cpp | 2 +- mods/src/camera/camera.cpp | 2 +- mods/src/death/death.cpp | 4 +- mods/src/game-mode/ui.cpp | 4 +- mods/src/input/attack.cpp | 2 +- mods/src/misc/api.cpp | 54 +++++++++++++++++++++++ mods/src/misc/misc.cpp | 32 +++++++------- mods/src/multiplayer/multiplayer.cpp | 2 +- mods/src/options/options.cpp | 2 +- mods/src/options/ui.cpp | 8 ++-- mods/src/server/server.cpp | 2 +- mods/src/textures/headless.cpp | 2 +- mods/src/textures/textures.cpp | 2 +- mods/src/title-screen/title-screen.cpp | 4 +- 17 files changed, 113 insertions(+), 124 deletions(-) diff --git a/dependencies/symbol-processor/src b/dependencies/symbol-processor/src index eb49f25f..8249a305 160000 --- a/dependencies/symbol-processor/src +++ b/dependencies/symbol-processor/src @@ -1 +1 @@ -Subproject commit eb49f25fa45842ebff448cbadd347c883e66efb6 +Subproject commit 8249a305df07a0b087b44341afa8c3b27ad7a156 diff --git a/libreborn/include/libreborn/patch.h b/libreborn/include/libreborn/patch.h index 3583c7ec..5cfd8dc2 100644 --- a/libreborn/include/libreborn/patch.h +++ b/libreborn/include/libreborn/patch.h @@ -4,6 +4,9 @@ #if defined(REBORN_HAS_PATCH_CODE) && defined(__cplusplus) +#include +#include + // Init void reborn_init_patch(); @@ -12,58 +15,25 @@ void _overwrite_call(const char *file, int line, void *start, void *target); #define overwrite_call(...) \ _overwrite_call(__FILE__, __LINE__, __VA_ARGS__) -// Make Sure Function Is Only Called Once -template -static void _only_call_once() { - static bool _has_run = false; - if (_has_run) { - ERR("\"Fancy\" overwrite*() Functions Can Only Be Called Once"); - } - _has_run = true; -} - // Replace All Calls To Method start With target void *_overwrite_calls_manual(const char *file, int line, void *start, void *target); #define overwrite_calls_manual(...) \ _overwrite_calls_manual(__FILE__, __LINE__, __VA_ARGS__) -template -static void _overwrite_calls(const char *file, int line, start_t (*create_helper)(overwrite_t, start_t), start_t &start, overwrite_t target) { - _only_call_once(); - start_t helper = create_helper(target, start); - start = (start_t) _overwrite_calls_manual(file, line, (void *) start, (void *) helper); +template +static void _overwrite_calls(const char *file, int line, std::string (*set_overwrite)(const overwrite_t &, const std::function &), const overwrite_t &target) { + std::string ret = set_overwrite(target, [&file, &line](void *start, void *target2) { + return _overwrite_calls_manual(file, line, start, target2); + }); + if (!ret.empty()) { + ERR("%s", ret.c_str()); + } } #define overwrite_calls(start, ...) \ _overwrite_calls< \ - __COUNTER__, \ - start##_t, \ __overwrite_##start##_t \ >( \ __FILE__, __LINE__, \ - __create_overwrite_helper_for_##start, \ - start, \ - __VA_ARGS__ \ - ) - -// Replace All Calls To Virtual Method start With target -template -static void _overwrite_virtual_calls(const char *file, int line, start_t (*create_helper)(overwrite_t, start_t), bool (*is_overwritable)(), start_t start, overwrite_t target) { - _only_call_once(); - if (!is_overwritable()) { - ERR("Virtual Method Is Not Overwritable"); - } - start_t helper = create_helper(target, start); - _overwrite_calls_manual(file, line, (void *) start, (void *) helper); -} -#define overwrite_virtual_calls(start, ...) \ - _overwrite_virtual_calls< \ - __COUNTER__, \ - start##_t, \ - __overwrite_##start##_t \ - >( \ - __FILE__, __LINE__, \ - __create_overwrite_helper_for_##start, \ - __is_overwritable_##start, \ - *start##_vtable_addr, \ + __set_overwrite_for_##start, \ __VA_ARGS__ \ ) @@ -77,7 +47,7 @@ void _overwrite_calls_within(const char *file, int line, void *from, void *to, s } #define overwrite_calls_within(from, to, start, ...) \ _overwrite_calls_within< \ - start##_t \ + __raw_##start##_t \ >( \ __FILE__, __LINE__, \ from, to, \ @@ -98,7 +68,7 @@ void _overwrite(const char *file, int line, start_t start, start_t target) { } #define overwrite(start, ...) \ _overwrite< \ - start##_t \ + __raw_##start##_t \ >( \ __FILE__, __LINE__, \ start, \ @@ -123,7 +93,7 @@ void _patch_vtable(const char *file, int line, start_t *start, start_t target) { } #define patch_vtable(start, ...) \ _patch_vtable< \ - start##_t \ + __raw_##start##_t \ >( \ __FILE__, __LINE__, \ start##_vtable_addr, \ diff --git a/mods/include/mods/misc/misc.h b/mods/include/mods/misc/misc.h index 9f0609bc..74f73286 100644 --- a/mods/include/mods/misc/misc.h +++ b/mods/include/mods/misc/misc.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -14,47 +15,11 @@ void misc_run_on_creative_inventory_setup(misc_update_function_FillingContainer_ extern bool is_in_chat; } -#define misc_run_on_update(...) \ - overwrite_virtual_calls(Minecraft_update, [](Minecraft_update_t _original, Minecraft *_self) { \ - _original(_self); \ - (__VA_ARGS__)(_self); \ - }) -#define misc_run_on_tick(...) \ - overwrite_calls(Minecraft_tick, [](Minecraft_tick_t _original, Minecraft *_self, int _tick, int _max_ticks) { \ - _original(_self, _tick, _max_ticks); \ - (__VA_ARGS__)(_self); \ - }) -#define misc_run_on_recipes_setup(...) \ - overwrite_calls(Recipes_constructor, [](Recipes_constructor_t _original, Recipes *_self) { \ - _original(_self); \ - (__VA_ARGS__)(_self); \ - return _self; \ - }) -#define misc_run_on_furnace_recipes_setup(...) \ - overwrite_calls(FurnaceRecipes_constructor, [](FurnaceRecipes_constructor_t _original, FurnaceRecipes *_self) { \ - _original(_self); \ - (__VA_ARGS__)(_self); \ - return _self; \ - }) -#define misc_run_on_tiles_setup(...) \ - overwrite_calls(Tile_initTiles, [](Tile_initTiles_t _original) { \ - (__VA_ARGS__)(); \ - _original(); \ - }) -#define misc_run_on_items_setup(...) \ - overwrite_calls(Item_initItems, [](Item_initItems_t _original) { \ - _original(); \ - (__VA_ARGS__)(); \ - }) -#define misc_run_on_language_setup(...) \ - overwrite_calls(I18n_loadLanguage, [](I18n_loadLanguage_t _original, AppPlatform *_self, std::string _language_name) { \ - _original(_self, _language_name); \ - (__VA_ARGS__)(); \ - }) -#define misc_run_on_game_key_press(...) \ - overwrite_calls(Gui_handleKeyPressed, [](Gui_handleKeyPressed_t _original, Gui *_self, int _key) { \ - if ((__VA_ARGS__)(_self->minecraft, _key)) { \ - return; \ - } \ - _original(_self, _key); \ - }) +void misc_run_on_update(const std::function &func); +void misc_run_on_tick(const std::function &func); +void misc_run_on_recipes_setup(const std::function &func); +void misc_run_on_furnace_recipes_setup(const std::function &func); +void misc_run_on_tiles_setup(const std::function &func); +void misc_run_on_items_setup(const std::function &func); +void misc_run_on_language_setup(const std::function &func); +void misc_run_on_game_key_press(const std::function &func); diff --git a/mods/src/bucket/bucket.cpp b/mods/src/bucket/bucket.cpp index 50e04f51..99173795 100644 --- a/mods/src/bucket/bucket.cpp +++ b/mods/src/bucket/bucket.cpp @@ -355,7 +355,7 @@ void init_bucket() { // Change Max Stack Size Based On Auxiliary overwrite_calls(ItemInstance_getMaxStackSize, ItemInstance_getMaxStackSize_injection); // Enable milking - overwrite_virtual_calls(Cow_interact, Cow_interact_injection); + overwrite_calls(Cow_interact, Cow_interact_injection); // Creative Inventory misc_run_on_creative_inventory_setup(Inventory_setupDefault_FillingContainer_addItem_call_injection); // Make Liquids Selectable diff --git a/mods/src/camera/camera.cpp b/mods/src/camera/camera.cpp index c1a76984..8cbb4bd0 100644 --- a/mods/src/camera/camera.cpp +++ b/mods/src/camera/camera.cpp @@ -36,7 +36,7 @@ static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std // Init void init_camera() { // Implement AppPlatform_linux::saveScreenshot So Cameras Work - overwrite_virtual_calls(AppPlatform_saveScreenshot, AppPlatform_saveScreenshot_injection); + overwrite_calls(AppPlatform_saveScreenshot, AppPlatform_saveScreenshot_injection); // Fix Camera Rendering if (feature_has("Fix Camera Rendering", server_disabled)) { diff --git a/mods/src/death/death.cpp b/mods/src/death/death.cpp index ad7ed265..a761f098 100644 --- a/mods/src/death/death.cpp +++ b/mods/src/death/death.cpp @@ -131,10 +131,10 @@ void init_death() { patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) { ServerPlayer_die_injection(*Player_die_vtable_addr, player, cause); }); - overwrite_virtual_calls(LocalPlayer_die, LocalPlayer_die_injection); + overwrite_calls(LocalPlayer_die, LocalPlayer_die_injection); patch_vtable(LocalPlayer_actuallyHurt, LocalPlayer_actuallyHurt_injection); patch_vtable(ServerPlayer_actuallyHurt, ServerPlayer_actuallyHurt_injection); - overwrite_virtual_calls(Mob_hurt, Mob_hurt_injection); + overwrite_calls(Mob_hurt, Mob_hurt_injection); } // Fix TNT diff --git a/mods/src/game-mode/ui.cpp b/mods/src/game-mode/ui.cpp index 944c85df..709417df 100644 --- a/mods/src/game-mode/ui.cpp +++ b/mods/src/game-mode/ui.cpp @@ -252,6 +252,6 @@ create_SelectWorldScreen_tick_injection(Touch_) // Init void _init_game_mode_ui() { // Hijack Create World Button - overwrite_virtual_calls(SelectWorldScreen_tick, SelectWorldScreen_tick_injection); - overwrite_virtual_calls(Touch_SelectWorldScreen_tick, Touch_SelectWorldScreen_tick_injection); + overwrite_calls(SelectWorldScreen_tick, SelectWorldScreen_tick_injection); + overwrite_calls(Touch_SelectWorldScreen_tick, Touch_SelectWorldScreen_tick_injection); } diff --git a/mods/src/input/attack.cpp b/mods/src/input/attack.cpp index 5056afec..bb1108c9 100644 --- a/mods/src/input/attack.cpp +++ b/mods/src/input/attack.cpp @@ -56,7 +56,7 @@ static ItemInstance *Player_attack_Inventory_getSelected_injection(Inventory *in void _init_attack() { // Allow Attacking Mobs if (feature_has("Fix Attacking", server_disabled)) { - overwrite_virtual_calls(MouseBuildInput_tickBuild, MouseBuildInput_tickBuild_injection); + overwrite_calls(MouseBuildInput_tickBuild, MouseBuildInput_tickBuild_injection); // Fix Holding Attack overwrite_call((void *) 0x8fc1c, (void *) Player_attack_Entity_hurt_injection); diff --git a/mods/src/misc/api.cpp b/mods/src/misc/api.cpp index d9bdbfbb..cbe594d9 100644 --- a/mods/src/misc/api.cpp +++ b/mods/src/misc/api.cpp @@ -38,6 +38,60 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli handle_misc_creative_inventory_setup(filling_container); } +// API +void misc_run_on_update(const std::function &func) { + overwrite_calls(Minecraft_update, [func](Minecraft_update_t original, Minecraft *self) { + original(self); + func(self); + }); +} +void misc_run_on_tick(const std::function &func) { + overwrite_calls(Minecraft_tick, [func](Minecraft_tick_t original, Minecraft *self, int tick, int max_ticks) { + original(self, tick, max_ticks); + func(self); + }); +} +void misc_run_on_recipes_setup(const std::function &func) { + overwrite_calls(Recipes_constructor, [func](Recipes_constructor_t original, Recipes *self) { + original(self); + func(self); + return self; + }); +} +void misc_run_on_furnace_recipes_setup(const std::function &func) { + overwrite_calls(FurnaceRecipes_constructor, [func](FurnaceRecipes_constructor_t original, FurnaceRecipes *self) { + original(self); + func(self); + return self; + }); +} +void misc_run_on_tiles_setup(const std::function &func) { + overwrite_calls(Tile_initTiles, [func](Tile_initTiles_t original) { + func(); + original(); + }); +} +void misc_run_on_items_setup(const std::function &func) { + overwrite_calls(Item_initItems, [func](Item_initItems_t original) { + original(); + func(); + }); +} +void misc_run_on_language_setup(const std::function &func) { + overwrite_calls(I18n_loadLanguage, [func](I18n_loadLanguage_t original, AppPlatform *self, std::string language_name) { + original(self, language_name); + func(); + }); +} +void misc_run_on_game_key_press(const std::function &func) { + overwrite_calls(Gui_handleKeyPressed, [func](Gui_handleKeyPressed_t original, Gui *self, int key) { + if (func(self->minecraft, key)) { + return; + } + original(self, key); + }); +} + // Render Fancy Background void misc_render_background(int color, Minecraft *minecraft, int x, int y, int width, int height) { // https://github.com/ReMinecraftPE/mcpe/blob/f0d65eaecec1b3fe9c2f2b251e114a890c54ab77/source/client/gui/components/RolledSelectionList.cpp#L169-L179 diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 997c4621..22cf7273 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -463,8 +463,8 @@ static void RandomLevelSource_buildSurface_injection(RandomLevelSource_buildSurf } // No Block Tinting -template -static int32_t Tile_getColor_injection(__attribute__((unused)) T original, __attribute__((unused)) S *self, __attribute__((unused)) LevelSource *level_source, __attribute__((unused)) int x, __attribute__((unused)) int y, __attribute__((unused)) int z) { +template +static int32_t Tile_getColor_injection(__attribute__((unused)) std::function original, __attribute__((unused)) T *self, __attribute__((unused)) LevelSource *level_source, __attribute__((unused)) int x, __attribute__((unused)) int y, __attribute__((unused)) int z) { return 0xffffff; } @@ -796,10 +796,10 @@ void init_misc() { } // Fix Screen Rendering When GUI is Hidden - overwrite_virtual_calls(Screen_render, Screen_render_injection); + overwrite_calls(Screen_render, Screen_render_injection); // Sanitize Username - overwrite_virtual_calls(LoginPacket_read, LoginPacket_read_injection); + overwrite_calls(LoginPacket_read, LoginPacket_read_injection); // Fix RakNet::RakString Security Bug overwrite_calls_manual((void *) RakNet_RakString_constructor, (void *) RakNet_RakString_injection); @@ -812,7 +812,7 @@ void init_misc() { // Close Current Screen On Death To Prevent Bugs if (feature_has("Close Current Screen On Death", server_disabled)) { - overwrite_virtual_calls(LocalPlayer_die, LocalPlayer_die_injection); + overwrite_calls(LocalPlayer_die, LocalPlayer_die_injection); } // Fix Furnace Not Checking Item Auxiliary When Inserting New Item @@ -875,7 +875,7 @@ void init_misc() { // Change Grass Color if (feature_has("Add Biome Colors To Grass", server_disabled)) { patch_vtable(GrassTile_getColor, GrassTile_getColor_injection); - overwrite_virtual_calls(TallGrass_getColor, TallGrass_getColor_injection); + overwrite_calls(TallGrass_getColor, TallGrass_getColor_injection); } // Generate Caves @@ -885,11 +885,11 @@ void init_misc() { // Disable Block Tinting if (feature_has("Disable Block Tinting", server_disabled)) { - overwrite_virtual_calls(GrassTile_getColor, Tile_getColor_injection); - overwrite_virtual_calls(TallGrass_getColor, Tile_getColor_injection); - overwrite_virtual_calls(StemTile_getColor, Tile_getColor_injection); - overwrite_virtual_calls(LeafTile_getColor, Tile_getColor_injection); - overwrite_virtual_calls(LiquidTile_getColor, Tile_getColor_injection); + overwrite_calls(GrassTile_getColor, Tile_getColor_injection); + overwrite_calls(TallGrass_getColor, Tile_getColor_injection); + overwrite_calls(StemTile_getColor, Tile_getColor_injection); + overwrite_calls(LeafTile_getColor, Tile_getColor_injection); + overwrite_calls(LiquidTile_getColor, Tile_getColor_injection); } // Custom GUI Scale @@ -924,7 +924,7 @@ void init_misc() { // Animation overwrite_calls(ContainerMenu_constructor, ContainerMenu_injection); - overwrite_virtual_calls(ContainerMenu_destructor_complete, ContainerMenu_destructor_injection); + overwrite_calls(ContainerMenu_destructor_complete, ContainerMenu_destructor_injection); } patch_address((void *) 0x115b48, (void *) ChestTileEntity_shouldSave_injection); @@ -951,7 +951,7 @@ void init_misc() { // Java Light Ramp if (feature_has("Use Java Beta 1.3 Light Ramp", server_disabled)) { - overwrite_virtual_calls(Dimension_updateLightRamp, Dimension_updateLightRamp_injection); + overwrite_calls(Dimension_updateLightRamp, Dimension_updateLightRamp_injection); } // Fix used items transferring durability @@ -970,18 +970,18 @@ void init_misc() { // Implement AppPlatform::readAssetFile So Translations Work if (feature_has("Load Language Files", server_enabled)) { - overwrite_virtual_calls(AppPlatform_readAssetFile, AppPlatform_readAssetFile_injection); + overwrite_calls(AppPlatform_readAssetFile, AppPlatform_readAssetFile_injection); } // Fix Pause Menu if (feature_has("Fix Pause Menu", server_disabled)) { // Add Missing Buttons To Pause Menu - overwrite_virtual_calls(PauseScreen_init, PauseScreen_init_injection); + overwrite_calls(PauseScreen_init, PauseScreen_init_injection); } // Implement Crafting Remainders overwrite_call((void *) 0x2e230, (void *) PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_injection); - overwrite_virtual_calls(Item_getCraftingRemainingItem, Item_getCraftingRemainingItem_injection); + overwrite_calls(Item_getCraftingRemainingItem, Item_getCraftingRemainingItem_injection); // Replace 2011 std::sort With Optimized(TM) Code if (feature_has("Optimized Chunk Sorting", server_enabled)) { diff --git a/mods/src/multiplayer/multiplayer.cpp b/mods/src/multiplayer/multiplayer.cpp index 54864e47..41049620 100644 --- a/mods/src/multiplayer/multiplayer.cpp +++ b/mods/src/multiplayer/multiplayer.cpp @@ -130,6 +130,6 @@ static void RakNetInstance_pingForHosts_injection(RakNetInstance_pingForHosts_t void init_multiplayer() { // Inject Code if (feature_has("External Server Support", server_disabled)) { - overwrite_virtual_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection); + overwrite_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection); } } diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp index 6824e3e1..47c33d9f 100644 --- a/mods/src/options/options.cpp +++ b/mods/src/options/options.cpp @@ -167,7 +167,7 @@ void init_options() { // Set Options overwrite_calls(Options_initDefaultValue, Options_initDefaultValue_injection); - overwrite_virtual_calls(Minecraft_init, Minecraft_init_injection); + overwrite_calls(Minecraft_init, Minecraft_init_injection); // Change Username const char *username = get_username(); diff --git a/mods/src/options/ui.cpp b/mods/src/options/ui.cpp index 6d9df683..3da803a2 100644 --- a/mods/src/options/ui.cpp +++ b/mods/src/options/ui.cpp @@ -186,12 +186,12 @@ void _init_options_ui() { // Info Button if (feature_has("Add Reborn Info To Options", server_disabled)) { // Add Button - overwrite_virtual_calls(OptionsScreen_init, OptionsScreen_init_injection); + overwrite_calls(OptionsScreen_init, OptionsScreen_init_injection); // Position Button - overwrite_virtual_calls(OptionsScreen_setupPositions, OptionsScreen_setupPositions_injection); + overwrite_calls(OptionsScreen_setupPositions, OptionsScreen_setupPositions_injection); // Handle Click - overwrite_virtual_calls(OptionsScreen_buttonClicked, OptionsScreen_buttonClicked_injection); + overwrite_calls(OptionsScreen_buttonClicked, OptionsScreen_buttonClicked_injection); // Cleanup - overwrite_virtual_calls(OptionsScreen_removed, OptionsScreen_removed_injection); + overwrite_calls(OptionsScreen_removed, OptionsScreen_removed_injection); } } diff --git a/mods/src/server/server.cpp b/mods/src/server/server.cpp index 9de78e9b..5f29ce07 100644 --- a/mods/src/server/server.cpp +++ b/mods/src/server/server.cpp @@ -568,7 +568,7 @@ static void server_init() { unsigned char max_players_patch[4] = {get_max_players(), 0x30, 0xa0, 0xe3}; // "mov r3, #MAX_PLAYERS" patch((void *) 0x166d0, max_players_patch); // Custom Banned IP List - overwrite_virtual_calls(RakNet_RakPeer_IsBanned, RakNet_RakPeer_IsBanned_injection); + overwrite_calls(RakNet_RakPeer_IsBanned, 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)) { diff --git a/mods/src/textures/headless.cpp b/mods/src/textures/headless.cpp index b893af54..20276ba8 100644 --- a/mods/src/textures/headless.cpp +++ b/mods/src/textures/headless.cpp @@ -19,5 +19,5 @@ static Texture AppPlatform_linux_loadTexture_injection(__attribute__((unused)) A // Init void init_textures() { // Disable Texture Loading - overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection); + overwrite_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection); } diff --git a/mods/src/textures/textures.cpp b/mods/src/textures/textures.cpp index be80a0f6..3dc3f114 100644 --- a/mods/src/textures/textures.cpp +++ b/mods/src/textures/textures.cpp @@ -234,5 +234,5 @@ void init_textures() { overwrite_call((void *) 0x53274, (void *) Textures_tick_glTexSubImage2D_injection); // Load Textures - overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection); + overwrite_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection); } diff --git a/mods/src/title-screen/title-screen.cpp b/mods/src/title-screen/title-screen.cpp index b87ef57f..934e74fd 100644 --- a/mods/src/title-screen/title-screen.cpp +++ b/mods/src/title-screen/title-screen.cpp @@ -133,7 +133,7 @@ void init_title_screen() { // Improved Classic Title Screen if (feature_has("Improved Classic Title Screen", server_disabled)) { // Add Options Button Back To Classic Start Screen - overwrite_virtual_calls(StartMenuScreen_init, StartMenuScreen_init_injection); + overwrite_calls(StartMenuScreen_init, StartMenuScreen_init_injection); // Fix Classic UI Button Size unsigned char classic_button_height_patch[4] = {0x18, 0x30, 0xa0, 0xe3}; // "mov r3, #0x18" @@ -157,7 +157,7 @@ void init_title_screen() { patch_address((void *) &Strings::classic_create_button_text, (void *) "Quit"); // Add Functionality To Quit Button - overwrite_virtual_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection); + overwrite_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection); } // Add Splashes