The Compiler Strikes Back!
This commit is contained in:
parent
60a5accff2
commit
f53f405bdd
2
dependencies/symbol-processor/src
vendored
2
dependencies/symbol-processor/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit eb49f25fa45842ebff448cbadd347c883e66efb6
|
Subproject commit 8249a305df07a0b087b44341afa8c3b27ad7a156
|
@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
#if defined(REBORN_HAS_PATCH_CODE) && defined(__cplusplus)
|
#if defined(REBORN_HAS_PATCH_CODE) && defined(__cplusplus)
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
void reborn_init_patch();
|
void reborn_init_patch();
|
||||||
|
|
||||||
@ -12,58 +15,25 @@ void _overwrite_call(const char *file, int line, void *start, void *target);
|
|||||||
#define overwrite_call(...) \
|
#define overwrite_call(...) \
|
||||||
_overwrite_call(__FILE__, __LINE__, __VA_ARGS__)
|
_overwrite_call(__FILE__, __LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
// Make Sure Function Is Only Called Once
|
|
||||||
template <int>
|
|
||||||
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
|
// Replace All Calls To Method start With target
|
||||||
void *_overwrite_calls_manual(const char *file, int line, void *start, void *target);
|
void *_overwrite_calls_manual(const char *file, int line, void *start, void *target);
|
||||||
#define overwrite_calls_manual(...) \
|
#define overwrite_calls_manual(...) \
|
||||||
_overwrite_calls_manual(__FILE__, __LINE__, __VA_ARGS__)
|
_overwrite_calls_manual(__FILE__, __LINE__, __VA_ARGS__)
|
||||||
template <int call_id, typename start_t, typename overwrite_t>
|
template <typename overwrite_t>
|
||||||
static void _overwrite_calls(const char *file, int line, start_t (*create_helper)(overwrite_t, start_t), start_t &start, overwrite_t target) {
|
static void _overwrite_calls(const char *file, int line, std::string (*set_overwrite)(const overwrite_t &, const std::function<void *(void *, void *)> &), const overwrite_t &target) {
|
||||||
_only_call_once<call_id>();
|
std::string ret = set_overwrite(target, [&file, &line](void *start, void *target2) {
|
||||||
start_t helper = create_helper(target, start);
|
return _overwrite_calls_manual(file, line, start, target2);
|
||||||
start = (start_t) _overwrite_calls_manual(file, line, (void *) start, (void *) helper);
|
});
|
||||||
|
if (!ret.empty()) {
|
||||||
|
ERR("%s", ret.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#define overwrite_calls(start, ...) \
|
#define overwrite_calls(start, ...) \
|
||||||
_overwrite_calls< \
|
_overwrite_calls< \
|
||||||
__COUNTER__, \
|
|
||||||
start##_t, \
|
|
||||||
__overwrite_##start##_t \
|
__overwrite_##start##_t \
|
||||||
>( \
|
>( \
|
||||||
__FILE__, __LINE__, \
|
__FILE__, __LINE__, \
|
||||||
__create_overwrite_helper_for_##start, \
|
__set_overwrite_for_##start, \
|
||||||
start, \
|
|
||||||
__VA_ARGS__ \
|
|
||||||
)
|
|
||||||
|
|
||||||
// Replace All Calls To Virtual Method start With target
|
|
||||||
template <int call_id, typename start_t, typename overwrite_t>
|
|
||||||
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<call_id>();
|
|
||||||
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, \
|
|
||||||
__VA_ARGS__ \
|
__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, ...) \
|
#define overwrite_calls_within(from, to, start, ...) \
|
||||||
_overwrite_calls_within< \
|
_overwrite_calls_within< \
|
||||||
start##_t \
|
__raw_##start##_t \
|
||||||
>( \
|
>( \
|
||||||
__FILE__, __LINE__, \
|
__FILE__, __LINE__, \
|
||||||
from, to, \
|
from, to, \
|
||||||
@ -98,7 +68,7 @@ void _overwrite(const char *file, int line, start_t start, start_t target) {
|
|||||||
}
|
}
|
||||||
#define overwrite(start, ...) \
|
#define overwrite(start, ...) \
|
||||||
_overwrite< \
|
_overwrite< \
|
||||||
start##_t \
|
__raw_##start##_t \
|
||||||
>( \
|
>( \
|
||||||
__FILE__, __LINE__, \
|
__FILE__, __LINE__, \
|
||||||
start, \
|
start, \
|
||||||
@ -123,7 +93,7 @@ void _patch_vtable(const char *file, int line, start_t *start, start_t target) {
|
|||||||
}
|
}
|
||||||
#define patch_vtable(start, ...) \
|
#define patch_vtable(start, ...) \
|
||||||
_patch_vtable< \
|
_patch_vtable< \
|
||||||
start##_t \
|
__raw_##start##_t \
|
||||||
>( \
|
>( \
|
||||||
__FILE__, __LINE__, \
|
__FILE__, __LINE__, \
|
||||||
start##_vtable_addr, \
|
start##_vtable_addr, \
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <symbols/minecraft.h>
|
#include <symbols/minecraft.h>
|
||||||
|
|
||||||
@ -14,47 +15,11 @@ void misc_run_on_creative_inventory_setup(misc_update_function_FillingContainer_
|
|||||||
extern bool is_in_chat;
|
extern bool is_in_chat;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define misc_run_on_update(...) \
|
void misc_run_on_update(const std::function<void(Minecraft *)> &func);
|
||||||
overwrite_virtual_calls(Minecraft_update, [](Minecraft_update_t _original, Minecraft *_self) { \
|
void misc_run_on_tick(const std::function<void(Minecraft *)> &func);
|
||||||
_original(_self); \
|
void misc_run_on_recipes_setup(const std::function<void(Recipes *)> &func);
|
||||||
(__VA_ARGS__)(_self); \
|
void misc_run_on_furnace_recipes_setup(const std::function<void(FurnaceRecipes *)> &func);
|
||||||
})
|
void misc_run_on_tiles_setup(const std::function<void()> &func);
|
||||||
#define misc_run_on_tick(...) \
|
void misc_run_on_items_setup(const std::function<void()> &func);
|
||||||
overwrite_calls(Minecraft_tick, [](Minecraft_tick_t _original, Minecraft *_self, int _tick, int _max_ticks) { \
|
void misc_run_on_language_setup(const std::function<void()> &func);
|
||||||
_original(_self, _tick, _max_ticks); \
|
void misc_run_on_game_key_press(const std::function<bool(Minecraft *, int)> &func);
|
||||||
(__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); \
|
|
||||||
})
|
|
||||||
|
@ -355,7 +355,7 @@ void init_bucket() {
|
|||||||
// Change Max Stack Size Based On Auxiliary
|
// Change Max Stack Size Based On Auxiliary
|
||||||
overwrite_calls(ItemInstance_getMaxStackSize, ItemInstance_getMaxStackSize_injection);
|
overwrite_calls(ItemInstance_getMaxStackSize, ItemInstance_getMaxStackSize_injection);
|
||||||
// Enable milking
|
// Enable milking
|
||||||
overwrite_virtual_calls(Cow_interact, Cow_interact_injection);
|
overwrite_calls(Cow_interact, Cow_interact_injection);
|
||||||
// Creative Inventory
|
// Creative Inventory
|
||||||
misc_run_on_creative_inventory_setup(Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
misc_run_on_creative_inventory_setup(Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||||
// Make Liquids Selectable
|
// Make Liquids Selectable
|
||||||
|
@ -36,7 +36,7 @@ static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std
|
|||||||
// Init
|
// Init
|
||||||
void init_camera() {
|
void init_camera() {
|
||||||
// Implement AppPlatform_linux::saveScreenshot So Cameras Work
|
// 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
|
// Fix Camera Rendering
|
||||||
if (feature_has("Fix Camera Rendering", server_disabled)) {
|
if (feature_has("Fix Camera Rendering", server_disabled)) {
|
||||||
|
@ -131,10 +131,10 @@ void init_death() {
|
|||||||
patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) {
|
patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) {
|
||||||
ServerPlayer_die_injection(*Player_die_vtable_addr, player, 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(LocalPlayer_actuallyHurt, LocalPlayer_actuallyHurt_injection);
|
||||||
patch_vtable(ServerPlayer_actuallyHurt, ServerPlayer_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
|
// Fix TNT
|
||||||
|
@ -252,6 +252,6 @@ create_SelectWorldScreen_tick_injection(Touch_)
|
|||||||
// Init
|
// Init
|
||||||
void _init_game_mode_ui() {
|
void _init_game_mode_ui() {
|
||||||
// Hijack Create World Button
|
// Hijack Create World Button
|
||||||
overwrite_virtual_calls(SelectWorldScreen_tick, SelectWorldScreen_tick_injection);
|
overwrite_calls(SelectWorldScreen_tick, SelectWorldScreen_tick_injection);
|
||||||
overwrite_virtual_calls(Touch_SelectWorldScreen_tick, Touch_SelectWorldScreen_tick_injection);
|
overwrite_calls(Touch_SelectWorldScreen_tick, Touch_SelectWorldScreen_tick_injection);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ static ItemInstance *Player_attack_Inventory_getSelected_injection(Inventory *in
|
|||||||
void _init_attack() {
|
void _init_attack() {
|
||||||
// Allow Attacking Mobs
|
// Allow Attacking Mobs
|
||||||
if (feature_has("Fix Attacking", server_disabled)) {
|
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
|
// Fix Holding Attack
|
||||||
overwrite_call((void *) 0x8fc1c, (void *) Player_attack_Entity_hurt_injection);
|
overwrite_call((void *) 0x8fc1c, (void *) Player_attack_Entity_hurt_injection);
|
||||||
|
@ -38,6 +38,60 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
handle_misc_creative_inventory_setup(filling_container);
|
handle_misc_creative_inventory_setup(filling_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// API
|
||||||
|
void misc_run_on_update(const std::function<void(Minecraft *)> &func) {
|
||||||
|
overwrite_calls(Minecraft_update, [func](Minecraft_update_t original, Minecraft *self) {
|
||||||
|
original(self);
|
||||||
|
func(self);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void misc_run_on_tick(const std::function<void(Minecraft *)> &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<void(Recipes *)> &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<void(FurnaceRecipes *)> &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<void()> &func) {
|
||||||
|
overwrite_calls(Tile_initTiles, [func](Tile_initTiles_t original) {
|
||||||
|
func();
|
||||||
|
original();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void misc_run_on_items_setup(const std::function<void()> &func) {
|
||||||
|
overwrite_calls(Item_initItems, [func](Item_initItems_t original) {
|
||||||
|
original();
|
||||||
|
func();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void misc_run_on_language_setup(const std::function<void()> &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<bool(Minecraft *, int)> &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
|
// Render Fancy Background
|
||||||
void misc_render_background(int color, Minecraft *minecraft, int x, int y, int width, int height) {
|
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
|
// https://github.com/ReMinecraftPE/mcpe/blob/f0d65eaecec1b3fe9c2f2b251e114a890c54ab77/source/client/gui/components/RolledSelectionList.cpp#L169-L179
|
||||||
|
@ -463,8 +463,8 @@ static void RandomLevelSource_buildSurface_injection(RandomLevelSource_buildSurf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No Block Tinting
|
// No Block Tinting
|
||||||
template <typename T, typename S>
|
template <typename T>
|
||||||
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) {
|
static int32_t Tile_getColor_injection(__attribute__((unused)) std::function<int(T *, LevelSource *, int, int, int)> original, __attribute__((unused)) T *self, __attribute__((unused)) LevelSource *level_source, __attribute__((unused)) int x, __attribute__((unused)) int y, __attribute__((unused)) int z) {
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,10 +796,10 @@ void init_misc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix Screen Rendering When GUI is Hidden
|
// Fix Screen Rendering When GUI is Hidden
|
||||||
overwrite_virtual_calls(Screen_render, Screen_render_injection);
|
overwrite_calls(Screen_render, Screen_render_injection);
|
||||||
|
|
||||||
// Sanitize Username
|
// Sanitize Username
|
||||||
overwrite_virtual_calls(LoginPacket_read, LoginPacket_read_injection);
|
overwrite_calls(LoginPacket_read, LoginPacket_read_injection);
|
||||||
|
|
||||||
// Fix RakNet::RakString Security Bug
|
// Fix RakNet::RakString Security Bug
|
||||||
overwrite_calls_manual((void *) RakNet_RakString_constructor, (void *) RakNet_RakString_injection);
|
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
|
// Close Current Screen On Death To Prevent Bugs
|
||||||
if (feature_has("Close Current Screen On Death", server_disabled)) {
|
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
|
// Fix Furnace Not Checking Item Auxiliary When Inserting New Item
|
||||||
@ -875,7 +875,7 @@ void init_misc() {
|
|||||||
// Change Grass Color
|
// Change Grass Color
|
||||||
if (feature_has("Add Biome Colors To Grass", server_disabled)) {
|
if (feature_has("Add Biome Colors To Grass", server_disabled)) {
|
||||||
patch_vtable(GrassTile_getColor, GrassTile_getColor_injection);
|
patch_vtable(GrassTile_getColor, GrassTile_getColor_injection);
|
||||||
overwrite_virtual_calls(TallGrass_getColor, TallGrass_getColor_injection);
|
overwrite_calls(TallGrass_getColor, TallGrass_getColor_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Caves
|
// Generate Caves
|
||||||
@ -885,11 +885,11 @@ void init_misc() {
|
|||||||
|
|
||||||
// Disable Block Tinting
|
// Disable Block Tinting
|
||||||
if (feature_has("Disable Block Tinting", server_disabled)) {
|
if (feature_has("Disable Block Tinting", server_disabled)) {
|
||||||
overwrite_virtual_calls(GrassTile_getColor, Tile_getColor_injection);
|
overwrite_calls(GrassTile_getColor, Tile_getColor_injection<GrassTile>);
|
||||||
overwrite_virtual_calls(TallGrass_getColor, Tile_getColor_injection);
|
overwrite_calls(TallGrass_getColor, Tile_getColor_injection<TallGrass>);
|
||||||
overwrite_virtual_calls(StemTile_getColor, Tile_getColor_injection);
|
overwrite_calls(StemTile_getColor, Tile_getColor_injection<StemTile>);
|
||||||
overwrite_virtual_calls(LeafTile_getColor, Tile_getColor_injection);
|
overwrite_calls(LeafTile_getColor, Tile_getColor_injection<LeafTile>);
|
||||||
overwrite_virtual_calls(LiquidTile_getColor, Tile_getColor_injection);
|
overwrite_calls(LiquidTile_getColor, Tile_getColor_injection<LiquidTile>);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom GUI Scale
|
// Custom GUI Scale
|
||||||
@ -924,7 +924,7 @@ void init_misc() {
|
|||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
overwrite_calls(ContainerMenu_constructor, ContainerMenu_injection);
|
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);
|
patch_address((void *) 0x115b48, (void *) ChestTileEntity_shouldSave_injection);
|
||||||
|
|
||||||
@ -951,7 +951,7 @@ void init_misc() {
|
|||||||
|
|
||||||
// Java Light Ramp
|
// Java Light Ramp
|
||||||
if (feature_has("Use Java Beta 1.3 Light Ramp", server_disabled)) {
|
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
|
// Fix used items transferring durability
|
||||||
@ -970,18 +970,18 @@ void init_misc() {
|
|||||||
|
|
||||||
// Implement AppPlatform::readAssetFile So Translations Work
|
// Implement AppPlatform::readAssetFile So Translations Work
|
||||||
if (feature_has("Load Language Files", server_enabled)) {
|
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
|
// Fix Pause Menu
|
||||||
if (feature_has("Fix Pause Menu", server_disabled)) {
|
if (feature_has("Fix Pause Menu", server_disabled)) {
|
||||||
// Add Missing Buttons To Pause Menu
|
// Add Missing Buttons To Pause Menu
|
||||||
overwrite_virtual_calls(PauseScreen_init, PauseScreen_init_injection);
|
overwrite_calls(PauseScreen_init, PauseScreen_init_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement Crafting Remainders
|
// Implement Crafting Remainders
|
||||||
overwrite_call((void *) 0x2e230, (void *) PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_injection);
|
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
|
// Replace 2011 std::sort With Optimized(TM) Code
|
||||||
if (feature_has("Optimized Chunk Sorting", server_enabled)) {
|
if (feature_has("Optimized Chunk Sorting", server_enabled)) {
|
||||||
|
@ -130,6 +130,6 @@ static void RakNetInstance_pingForHosts_injection(RakNetInstance_pingForHosts_t
|
|||||||
void init_multiplayer() {
|
void init_multiplayer() {
|
||||||
// Inject Code
|
// Inject Code
|
||||||
if (feature_has("External Server Support", server_disabled)) {
|
if (feature_has("External Server Support", server_disabled)) {
|
||||||
overwrite_virtual_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection);
|
overwrite_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ void init_options() {
|
|||||||
|
|
||||||
// Set Options
|
// Set Options
|
||||||
overwrite_calls(Options_initDefaultValue, Options_initDefaultValue_injection);
|
overwrite_calls(Options_initDefaultValue, Options_initDefaultValue_injection);
|
||||||
overwrite_virtual_calls(Minecraft_init, Minecraft_init_injection);
|
overwrite_calls(Minecraft_init, Minecraft_init_injection);
|
||||||
|
|
||||||
// Change Username
|
// Change Username
|
||||||
const char *username = get_username();
|
const char *username = get_username();
|
||||||
|
@ -186,12 +186,12 @@ void _init_options_ui() {
|
|||||||
// Info Button
|
// Info Button
|
||||||
if (feature_has("Add Reborn Info To Options", server_disabled)) {
|
if (feature_has("Add Reborn Info To Options", server_disabled)) {
|
||||||
// Add Button
|
// Add Button
|
||||||
overwrite_virtual_calls(OptionsScreen_init, OptionsScreen_init_injection);
|
overwrite_calls(OptionsScreen_init, OptionsScreen_init_injection);
|
||||||
// Position Button
|
// Position Button
|
||||||
overwrite_virtual_calls(OptionsScreen_setupPositions, OptionsScreen_setupPositions_injection);
|
overwrite_calls(OptionsScreen_setupPositions, OptionsScreen_setupPositions_injection);
|
||||||
// Handle Click
|
// Handle Click
|
||||||
overwrite_virtual_calls(OptionsScreen_buttonClicked, OptionsScreen_buttonClicked_injection);
|
overwrite_calls(OptionsScreen_buttonClicked, OptionsScreen_buttonClicked_injection);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
overwrite_virtual_calls(OptionsScreen_removed, OptionsScreen_removed_injection);
|
overwrite_calls(OptionsScreen_removed, OptionsScreen_removed_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ static void server_init() {
|
|||||||
unsigned char max_players_patch[4] = {get_max_players(), 0x30, 0xa0, 0xe3}; // "mov r3, #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 *) 0x166d0, max_players_patch);
|
||||||
// Custom Banned IP List
|
// 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
|
// Show The MineCon Icon Next To MOTD In Server List
|
||||||
if (get_server_properties().get_bool("show-minecon-badge", DEFAULT_SHOW_MINECON_BADGE)) {
|
if (get_server_properties().get_bool("show-minecon-badge", DEFAULT_SHOW_MINECON_BADGE)) {
|
||||||
|
@ -19,5 +19,5 @@ static Texture AppPlatform_linux_loadTexture_injection(__attribute__((unused)) A
|
|||||||
// Init
|
// Init
|
||||||
void init_textures() {
|
void init_textures() {
|
||||||
// Disable Texture Loading
|
// Disable Texture Loading
|
||||||
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
overwrite_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
||||||
}
|
}
|
||||||
|
@ -234,5 +234,5 @@ void init_textures() {
|
|||||||
overwrite_call((void *) 0x53274, (void *) Textures_tick_glTexSubImage2D_injection);
|
overwrite_call((void *) 0x53274, (void *) Textures_tick_glTexSubImage2D_injection);
|
||||||
|
|
||||||
// Load Textures
|
// Load Textures
|
||||||
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
overwrite_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ void init_title_screen() {
|
|||||||
// Improved Classic Title Screen
|
// Improved Classic Title Screen
|
||||||
if (feature_has("Improved Classic Title Screen", server_disabled)) {
|
if (feature_has("Improved Classic Title Screen", server_disabled)) {
|
||||||
// Add Options Button Back To Classic Start Screen
|
// 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
|
// Fix Classic UI Button Size
|
||||||
unsigned char classic_button_height_patch[4] = {0x18, 0x30, 0xa0, 0xe3}; // "mov r3, #0x18"
|
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");
|
patch_address((void *) &Strings::classic_create_button_text, (void *) "Quit");
|
||||||
|
|
||||||
// Add Functionality To Quit Button
|
// Add Functionality To Quit Button
|
||||||
overwrite_virtual_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection);
|
overwrite_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Splashes
|
// Add Splashes
|
||||||
|
Loading…
Reference in New Issue
Block a user