Some Fixes
This commit is contained in:
parent
587ba38ffe
commit
f0005ff002
2
dependencies/imgui/src
vendored
2
dependencies/imgui/src
vendored
@ -1 +1 @@
|
||||
Subproject commit 551b6c4d662a3938f0cd197e79cc29922feec1ff
|
||||
Subproject commit f5f11e94be35078c3bbb5196f55269f88634b9bd
|
2
dependencies/minecraft-pi/CMakeLists.txt
vendored
2
dependencies/minecraft-pi/CMakeLists.txt
vendored
@ -9,7 +9,7 @@ FetchContent_Declare(
|
||||
minecraft-pi
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.1.tar.gz"
|
||||
)
|
||||
FetchContent_Populate(minecraft-pi)
|
||||
FetchContent_MakeAvailable(minecraft-pi)
|
||||
|
||||
# Install
|
||||
install(
|
||||
|
@ -54,6 +54,7 @@
|
||||
* `Fix Sugar Position In Hand` (Enabled By Default)
|
||||
* `Fix Reloading Textures On Resize` (Enabled By Default)
|
||||
* `Improved UI Scaling` (Enabled By Default)
|
||||
* `Text Rendering Fixes` (Enabled By Default)
|
||||
* Existing Functionality (All Enabled By Default)
|
||||
* `Fix Screen Rendering When Hiding HUD`
|
||||
* `Sanitize Usernames`
|
||||
@ -62,7 +63,6 @@
|
||||
* `Prevent Unnecessary Server Pinging`
|
||||
* `Proper OpenGL Buffer Generation`
|
||||
* `Fix Furnace Screen Visual Bug`
|
||||
* `Fix Text Wrapping`
|
||||
* `Fullscreen Support`
|
||||
* `Always Save Chest Tile Entities`
|
||||
* `Fix Transferring Durability When Using Items`
|
||||
|
@ -11,10 +11,14 @@
|
||||
void reborn_init_patch();
|
||||
|
||||
// Replace Call Located At start With A Call To target
|
||||
void overwrite_call(void *start, void *target, bool force_b_instruction = false);
|
||||
void overwrite_call_manual(void *addr, void *new_target, bool force_b_instruction = false);
|
||||
template <typename T>
|
||||
void overwrite_call(void *addr, __attribute__((unused)) T *target_type, typename T::ptr_type new_target, const bool force_b_instruction = false) {
|
||||
overwrite_call_manual(addr, (void *) new_target, force_b_instruction);
|
||||
}
|
||||
|
||||
// Replace All Calls To Method start With target
|
||||
void *overwrite_calls_manual(void *start, void *target, bool allow_no_callsites = false);
|
||||
void *overwrite_calls_manual(void *target, void *replacement, bool allow_no_callsites = false);
|
||||
template <typename T>
|
||||
void overwrite_calls(T *target, typename T::overwrite_type replacement) {
|
||||
DEBUG("Overwriting Method: %s", target->name);
|
||||
@ -27,28 +31,28 @@ void overwrite_calls(T *target, typename T::overwrite_type replacement) {
|
||||
void *reborn_thunk_enabler(void *target, void *thunk);
|
||||
|
||||
// Replace All Calls To start With target Within [to, from)
|
||||
void overwrite_calls_within_manual(void *from, void *to, void *start, void *target);
|
||||
void overwrite_calls_within_manual(void *from, void *to, const void *target, void *replacement);
|
||||
template <typename T>
|
||||
void overwrite_calls_within(void *from, void *to, T *start, typename T::ptr_type target) {
|
||||
overwrite_calls_within_manual(from, to, (void *) start->get(), (void *) target);
|
||||
void overwrite_calls_within(void *from, void *to, T *target, typename T::ptr_type replacement) {
|
||||
overwrite_calls_within_manual(from, to, (void *) target->get(), (void *) replacement);
|
||||
}
|
||||
|
||||
// Get Target Address From BL Instruction
|
||||
void *extract_from_bl_instruction(unsigned char *from);
|
||||
void *extract_from_bl_instruction(unsigned char *addr);
|
||||
|
||||
// Patch Instruction
|
||||
void patch(void *start, unsigned char patch[4]);
|
||||
void patch(void *addr, unsigned char patch[4]);
|
||||
|
||||
// Patch 4 Bytes Of Data
|
||||
void patch_address(void *start, void *target);
|
||||
void patch_address(void *addr, void *target);
|
||||
|
||||
// Patch VTable Entry
|
||||
// This does not affect subclasses.
|
||||
template <typename T>
|
||||
void patch_vtable(const T *start, typename T::ptr_type target) {
|
||||
DEBUG("Patching VTable: %s", start->name);
|
||||
if (start->enabled) {
|
||||
void patch_vtable(const T *target, typename T::ptr_type replacement) {
|
||||
DEBUG("Patching VTable: %s", target->name);
|
||||
if (target->enabled) {
|
||||
WARN("Use overwrite_calls() Instead!");
|
||||
}
|
||||
patch_address((void *) start->get_vtable_addr(), (void *) target);
|
||||
patch_address((void *) target->get_vtable_addr(), (void *) replacement);
|
||||
}
|
@ -31,8 +31,8 @@ static void *extract_from_bl_instruction(unsigned char *from, const uint32_t ins
|
||||
// Compute Target Address
|
||||
return from + 8 + offset;
|
||||
}
|
||||
void *extract_from_bl_instruction(unsigned char *from) {
|
||||
return extract_from_bl_instruction(from, *(uint32_t *) from);
|
||||
void *extract_from_bl_instruction(unsigned char *addr) {
|
||||
return extract_from_bl_instruction(addr, *(uint32_t *) addr);
|
||||
}
|
||||
|
||||
// Generate A BL Instruction
|
||||
|
@ -21,9 +21,9 @@ static void _overwrite_call_internal(void *start, void *target, const bool use_b
|
||||
// Increment Code Block Position
|
||||
increment_code_block();
|
||||
}
|
||||
void overwrite_call(void *start, void *target, const bool force_b_instruction) {
|
||||
const bool use_b_instruction = force_b_instruction || ((unsigned char *) start)[3] == B_INSTRUCTION;
|
||||
_overwrite_call_internal(start, target, use_b_instruction);
|
||||
void overwrite_call_manual(void *addr, void *new_target, const bool force_b_instruction) {
|
||||
const bool use_b_instruction = force_b_instruction || ((unsigned char *) addr)[3] == B_INSTRUCTION;
|
||||
_overwrite_call_internal(addr, new_target, use_b_instruction);
|
||||
}
|
||||
|
||||
// .rodata Information
|
||||
@ -51,7 +51,7 @@ static int _patch_vtables(void *target, void *replacement) {
|
||||
#undef scan_vtables
|
||||
|
||||
// Patch Calls Within Range
|
||||
static int _overwrite_calls_within_internal(void *from, void *to, void *target, void *replacement) {
|
||||
static int _overwrite_calls_within_internal(void *from, void *to, const void *target, void *replacement) {
|
||||
int found = 0;
|
||||
for (uintptr_t i = (uintptr_t) from; i < (uintptr_t) to; i = i + 4) {
|
||||
unsigned char *addr = (unsigned char *) i;
|
||||
@ -77,14 +77,14 @@ static int _overwrite_calls_within_internal(void *from, void *to, void *target,
|
||||
#define TEXT_END 0x1020c0
|
||||
// Overwrite All B(L) Intrusctions That Target The Specified Address
|
||||
#define NO_CALLSITE_ERROR() ERR("Unable To Find Callsites")
|
||||
void *overwrite_calls_manual(void *start, void *target, const bool allow_no_callsites) {
|
||||
void *overwrite_calls_manual(void *target, void *replacement, const bool allow_no_callsites) {
|
||||
// Add New Target To Code Block
|
||||
void *code_block = update_code_block(target);
|
||||
void *code_block = update_code_block(replacement);
|
||||
|
||||
// Patch Code
|
||||
int found = _overwrite_calls_within_internal((void *) TEXT_START, (void *) TEXT_END, start, code_block);
|
||||
int found = _overwrite_calls_within_internal((void *) TEXT_START, (void *) TEXT_END, target, code_block);
|
||||
// Patch VTables
|
||||
found += _patch_vtables(start, code_block);
|
||||
found += _patch_vtables(target, code_block);
|
||||
|
||||
// Increment Code Block Position
|
||||
increment_code_block();
|
||||
@ -97,7 +97,7 @@ void *overwrite_calls_manual(void *start, void *target, const bool allow_no_call
|
||||
// Return
|
||||
return code_block;
|
||||
}
|
||||
void overwrite_calls_within_manual(void *from /* inclusive */, void *to /* exclusive */, void *target, void *replacement) {
|
||||
void overwrite_calls_within_manual(void *from /* inclusive */, void *to /* exclusive */, const void *target, void *replacement) {
|
||||
// Add New Target To Code Block
|
||||
void *code_block = update_code_block(replacement);
|
||||
|
||||
@ -123,13 +123,13 @@ static void safe_mprotect(void *addr, const size_t len, const int prot) {
|
||||
ERR("Unable To Set Permissions: %p: %s", addr, strerror(errno));
|
||||
}
|
||||
}
|
||||
void patch(void *start, unsigned char patch[4]) {
|
||||
if (((uint32_t) start) % 4 != 0) {
|
||||
ERR("Invalid Address: %p", start);
|
||||
void patch(void *addr, unsigned char patch[4]) {
|
||||
if (uint32_t(addr) % 4 != 0) {
|
||||
ERR("Invalid Address: %p", addr);
|
||||
}
|
||||
|
||||
// Get Current Permissions
|
||||
segment_data &segment_data = get_data_for_addr(start);
|
||||
const segment_data &segment_data = get_data_for_addr(addr);
|
||||
int prot = PROT_READ;
|
||||
if (segment_data.is_executable) {
|
||||
prot |= PROT_EXEC;
|
||||
@ -139,25 +139,25 @@ void patch(void *start, unsigned char patch[4]) {
|
||||
}
|
||||
|
||||
// Allow Writing To Code Memory
|
||||
const uint32_t size = 4;
|
||||
safe_mprotect(start, size, prot | PROT_WRITE);
|
||||
constexpr uint32_t size = 4;
|
||||
safe_mprotect(addr, size, prot | PROT_WRITE);
|
||||
|
||||
// Patch
|
||||
unsigned char *data = (unsigned char *) start;
|
||||
unsigned char *data = (unsigned char *) addr;
|
||||
memcpy(data, patch, 4);
|
||||
|
||||
// Reset Code Memory Permissions
|
||||
safe_mprotect(start, size, prot);
|
||||
safe_mprotect(addr, size, prot);
|
||||
|
||||
// Clear ARM Instruction Cache
|
||||
__clear_cache(start, (void *) (((uintptr_t) start) + size));
|
||||
__clear_cache(addr, (void *) (((uintptr_t) addr) + size));
|
||||
}
|
||||
|
||||
// Patch Address
|
||||
void patch_address(void *start, void *target) {
|
||||
uint32_t addr = (uint32_t) target;
|
||||
unsigned char *patch_data = (unsigned char *) &addr;
|
||||
patch(start, patch_data);
|
||||
void patch_address(void *addr, void *target) {
|
||||
uint32_t target_addr = (uint32_t) target;
|
||||
unsigned char *patch_data = (unsigned char *) &target_addr;
|
||||
patch(addr, patch_data);
|
||||
}
|
||||
|
||||
// Thunks
|
||||
|
@ -108,7 +108,7 @@ CATEGORY Bug Fixes
|
||||
TRUE Fix Held Item Caching
|
||||
TRUE Fix Cobweb Lighting
|
||||
TRUE Fix Furnace Screen Visual Bug
|
||||
TRUE Fix Text Wrapping
|
||||
TRUE Text Rendering Fixes
|
||||
TRUE Fix Carried Grass's Bottom Texture
|
||||
TRUE Fix Screen Rendering When Hiding HUD
|
||||
TRUE Fix Sugar Position In Hand
|
||||
|
5
libreborn/src/util/env/servers.cpp
vendored
5
libreborn/src/util/env/servers.cpp
vendored
@ -3,6 +3,7 @@
|
||||
#include <limits>
|
||||
|
||||
#include <libreborn/env/servers.h>
|
||||
#include <libreborn/env/flags.h>
|
||||
#include <libreborn/util/util.h>
|
||||
|
||||
// Seperator
|
||||
@ -26,7 +27,7 @@ void ServerList::load(const std::string &str) {
|
||||
|
||||
// Iterate Lines
|
||||
std::string line;
|
||||
while (std::getline(server_list_file, line)) {
|
||||
while (std::getline(server_list_file, line, FLAG_SEPERATOR_CHAR)) {
|
||||
// Check Line
|
||||
if (!line.empty()) {
|
||||
// Parse
|
||||
@ -50,7 +51,7 @@ void ServerList::load(const std::string &str) {
|
||||
std::string ServerList::to_string() const {
|
||||
std::stringstream out;
|
||||
for (const Entry &entry : entries) {
|
||||
out << entry.first << PORT_SEPERATOR_CHAR << std::to_string(entry.second) << '\n';
|
||||
out << entry.first << PORT_SEPERATOR_CHAR << std::to_string(entry.second) << FLAG_SEPERATOR_CHAR;
|
||||
}
|
||||
return out.str();
|
||||
}
|
||||
|
@ -242,6 +242,6 @@ void init_atlas() {
|
||||
misc_run_on_init(generate_atlas);
|
||||
overwrite_calls(CropTile_getTexture2, CropTile_getTexture2_injection);
|
||||
overwrite_calls(ItemRenderer_renderGuiItem_two, ItemRenderer_renderGuiItem_two_injection);
|
||||
overwrite_call((void *) 0x26f50, (void *) Gui_renderToolBar_GuiComponent_blit_injection);
|
||||
overwrite_call((void *) 0x26f50, GuiComponent_blit, Gui_renderToolBar_GuiComponent_blit_injection);
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +359,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 *) 0x7f5b0, Level_clip, Mob_pick_Level_clip_injection);
|
||||
misc_run_on_tick(handle_tick);
|
||||
// Prevent Breaking Liquid
|
||||
overwrite_calls(Minecraft_handleMouseDown, Minecraft_handleMouseDown_injection);
|
||||
@ -367,7 +367,7 @@ void init_bucket() {
|
||||
misc_run_on_recipes_setup(Recipes_injection);
|
||||
// Custom Furnace Fuel
|
||||
overwrite_calls(FurnaceTileEntity_getBurnDuration, FurnaceTileEntity_getBurnDuration_injection);
|
||||
overwrite_call((void *) 0xd351c, (void *) FurnaceTileEntity_tick_ItemInstance_setNull_injection);
|
||||
overwrite_call((void *) 0xd351c, ItemInstance_setNull, FurnaceTileEntity_tick_ItemInstance_setNull_injection);
|
||||
// Language for milk
|
||||
misc_run_on_language_setup(Language_injection);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, con
|
||||
static void TripodCameraRenderer_render_EntityRenderer_bindTexture_injection(EntityRenderer *self, __attribute__((unused)) const std::string &file) {
|
||||
self->bindTexture("item/camera.png");
|
||||
}
|
||||
static void TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection() {
|
||||
static void TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection(__attribute__((unused)) TileRenderer *self, __attribute__((unused)) Tile *tile, __attribute__((unused)) int data, __attribute__((unused)) float x, __attribute__((unused)) float y, __attribute__((unused)) float z) {
|
||||
Tesselator *t = &Tesselator::instance;
|
||||
for (const float a : {-1.f, 1.f}) {
|
||||
for (const float b : {-1.f, 1.f}) {
|
||||
@ -62,11 +62,11 @@ void init_camera() {
|
||||
// Enable TripodCameraRenderer
|
||||
overwrite_calls(EntityRenderDispatcher_constructor, EntityRenderDispatcher_injection);
|
||||
// Display Smoke From TripodCamera Higher
|
||||
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
||||
overwrite_call((void *) 0x87dc4, Level_addParticle, TripodCamera_tick_Level_addParticle_call_injection);
|
||||
}
|
||||
// Camera Legs
|
||||
if (feature_has("Render Camera Legs", server_disabled)) {
|
||||
overwrite_call((void *) 0x659dc, (void *) TripodCameraRenderer_render_EntityRenderer_bindTexture_injection);
|
||||
overwrite_call((void *) 0x65a08, (void *) TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection);
|
||||
overwrite_call((void *) 0x659dc, EntityRenderer_bindTexture, TripodCameraRenderer_render_EntityRenderer_bindTexture_injection);
|
||||
overwrite_call((void *) 0x65a08, TileRenderer_tesselateCrossTexture, TripodCameraRenderer_render_TileRenderer_tesselateCrossTexture_injection);
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +56,10 @@ void chat_handle_packet_send(const Minecraft *minecraft, ChatPacket *packet) {
|
||||
}
|
||||
|
||||
// Manually Send (And Loopback) ChatPacket
|
||||
static void CommandServer_parse_CommandServer_dispatchPacket_injection(const CommandServer *command_server, Packet *packet) {
|
||||
static void CommandServer_parse_CommandServer_dispatchPacket_injection(CommandServer *command_server, Packet &packet) {
|
||||
const Minecraft *minecraft = command_server->minecraft;
|
||||
if (minecraft != nullptr) {
|
||||
chat_handle_packet_send(minecraft, (ChatPacket *) packet);
|
||||
chat_handle_packet_send(minecraft, (ChatPacket *) &packet);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ void init_chat() {
|
||||
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x6b490, disable_chat_packet_loopback_patch);
|
||||
// Manually Send (And Loopback) ChatPacket
|
||||
overwrite_call((void *) 0x6b518, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection);
|
||||
overwrite_call((void *) 0x6b518, CommandServer_dispatchPacket, CommandServer_parse_CommandServer_dispatchPacket_injection);
|
||||
// Re-Broadcast ChatPacket
|
||||
patch_vtable(ServerSideNetworkHandler_handle_ChatPacket, ServerSideNetworkHandler_handle_ChatPacket_injection);
|
||||
// Init UI
|
||||
|
@ -29,8 +29,8 @@ static void Gui_renderHearts_GuiComponent_blit_hearts_injection(GuiComponent *co
|
||||
std::remove_reference_t<GuiComponent_blit_t> get_blit_with_classic_hud_offset() {
|
||||
return use_classic_hud ? Gui_renderHearts_GuiComponent_blit_hearts_injection : GuiComponent_blit->get(false);
|
||||
}
|
||||
static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *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) {
|
||||
const Minecraft *minecraft = component->minecraft;
|
||||
static void Gui_renderHearts_GuiComponent_blit_armor_injection(GuiComponent *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) {
|
||||
const Minecraft *minecraft = ((Gui *) component)->minecraft;
|
||||
x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH;
|
||||
const float width = float(minecraft->screen_width) * Gui::InvGuiScale;
|
||||
const float height = float(minecraft->screen_height) * Gui::InvGuiScale;
|
||||
@ -40,8 +40,8 @@ static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, i
|
||||
// Call Original Method
|
||||
component->blit(x_dest, y_dest, x_src, y_src, width_dest, height_dest, width_src, height_src);
|
||||
}
|
||||
static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *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) {
|
||||
const Minecraft *minecraft = component->minecraft;
|
||||
static void Gui_renderBubbles_GuiComponent_blit_injection(GuiComponent *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) {
|
||||
const Minecraft *minecraft = ((Gui *) component)->minecraft;
|
||||
x_dest -= DEFAULT_HUD_PADDING;
|
||||
const float width = float(minecraft->screen_width) * Gui::InvGuiScale;
|
||||
const float height = float(minecraft->screen_height) * Gui::InvGuiScale;
|
||||
@ -110,7 +110,7 @@ static void Gui_renderSlotText_Font_draw_injection(Font *self, const char *raw_s
|
||||
color = 0xffffffff;
|
||||
}
|
||||
// Call
|
||||
(*func)->get(false)(self, string, x, y, color);
|
||||
(*func)->get(false)(self, string.c_str(), x, y, color);
|
||||
}
|
||||
|
||||
// Init
|
||||
@ -118,11 +118,11 @@ void init_classic_ui() {
|
||||
// Classic HUD
|
||||
if (feature_has("Classic HUD", server_disabled)) {
|
||||
use_classic_hud = true;
|
||||
overwrite_call((void *) 0x26758, (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 *) 0x266f8, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection);
|
||||
overwrite_call((void *) 0x267c8, (void *) Gui_renderHearts_GuiComponent_blit_hearts_injection);
|
||||
overwrite_call((void *) 0x26758, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_hearts_injection);
|
||||
overwrite_call((void *) 0x2656c, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_armor_injection);
|
||||
overwrite_call((void *) 0x268c4, GuiComponent_blit, Gui_renderBubbles_GuiComponent_blit_injection);
|
||||
overwrite_call((void *) 0x266f8, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_hearts_injection);
|
||||
overwrite_call((void *) 0x267c8, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_hearts_injection);
|
||||
}
|
||||
|
||||
// Classic Slot Count Location
|
||||
@ -131,12 +131,12 @@ void init_classic_ui() {
|
||||
patch((void *) 0x27074, nop_patch);
|
||||
patch((void *) 0x33984, nop_patch);
|
||||
patch((void *) 0x1e424, nop_patch);
|
||||
overwrite_call((void *) 0x1e4b8, (void *) Gui_renderSlotText_injection_inventory);
|
||||
overwrite_call((void *) 0x27100, (void *) Gui_renderSlotText_injection_toolbar);
|
||||
overwrite_call((void *) 0x339b4, (void *) Gui_renderSlotText_injection_classic_inventory);
|
||||
overwrite_call((void *) 0x2b268, (void *) Gui_renderSlotText_injection_furnace);
|
||||
overwrite_call((void *) 0x320c4, (void *) Gui_renderSlotText_injection_furnace);
|
||||
overwrite_call((void *) 0x25e84, (void *) Gui_renderSlotText_Font_draw_injection<&Font_draw>);
|
||||
overwrite_call((void *) 0x25e74, (void *) Gui_renderSlotText_Font_draw_injection<&Font_drawShadow>);
|
||||
overwrite_call((void *) 0x1e4b8, Gui_renderSlotText, Gui_renderSlotText_injection_inventory);
|
||||
overwrite_call((void *) 0x27100, Gui_renderSlotText, Gui_renderSlotText_injection_toolbar);
|
||||
overwrite_call((void *) 0x339b4, Gui_renderSlotText, Gui_renderSlotText_injection_classic_inventory);
|
||||
overwrite_call((void *) 0x2b268, Gui_renderSlotText, Gui_renderSlotText_injection_furnace);
|
||||
overwrite_call((void *) 0x320c4, Gui_renderSlotText, Gui_renderSlotText_injection_furnace);
|
||||
overwrite_call((void *) 0x25e84, Font_draw_raw, Gui_renderSlotText_Font_draw_injection<&Font_draw_raw>);
|
||||
overwrite_call((void *) 0x25e74, Font_drawShadow_raw, Gui_renderSlotText_Font_draw_injection<&Font_drawShadow_raw>);
|
||||
}
|
||||
}
|
@ -9,11 +9,11 @@ static void do_nothing() {
|
||||
// Patch bcm_host Calls
|
||||
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_manual((void *) 0xdfec, (void *) do_nothing); // bcm_host_init
|
||||
overwrite_call_manual((void *) 0x12418, (void *) do_nothing); // bcm_host_deinit
|
||||
overwrite_call_manual((void *) 0x125a8, (void *) do_nothing); // graphics_get_display_size
|
||||
overwrite_call_manual((void *) 0x125dc, (void *) do_nothing); // vc_dispmanx_display_open
|
||||
overwrite_call_manual((void *) 0x125e8, (void *) do_nothing); // vc_dispmanx_update_start
|
||||
overwrite_call_manual((void *) 0x12618, (void *) do_nothing); // vc_dispmanx_element_add
|
||||
overwrite_call_manual((void *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
||||
}
|
||||
|
@ -26,15 +26,15 @@ void _patch_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
|
||||
overwrite_call_manual((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
|
||||
overwrite_call_manual((void *) 0x124dc, (void *) eglSwapBuffers_injection); // eglSwapBuffers #1
|
||||
overwrite_call_manual((void *) 0x14b6c, (void *) eglSwapBuffers_injection); // eglSwapBuffers #2
|
||||
overwrite_call_manual((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
|
||||
overwrite_call_manual((void *) 0x12594, (void *) eglCreateContext_injection); // eglCreateContext
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static void SDL_Quit_injection() {
|
||||
// Patch SDL Calls
|
||||
void _patch_sdl_calls() {
|
||||
// Disable SDL Calls
|
||||
overwrite_call((void *) 0xe020, (void *) SDL_SetVideoMode_injection);
|
||||
overwrite_call((void *) 0x13284, (void *) SDL_GetWMInfo_injection);
|
||||
overwrite_call((void *) 0x12410, (void *) SDL_Quit_injection);
|
||||
overwrite_call_manual((void *) 0xe020, (void *) SDL_SetVideoMode_injection);
|
||||
overwrite_call_manual((void *) 0x13284, (void *) SDL_GetWMInfo_injection);
|
||||
overwrite_call_manual((void *) 0x12410, (void *) SDL_Quit_injection);
|
||||
}
|
||||
|
@ -24,6 +24,6 @@ static int XGetWindowAttributes_injection(__attribute__((unused)) void *display,
|
||||
// Patch X11 Calls
|
||||
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_manual((void *) 0x132a4, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes
|
||||
overwrite_call_manual((void *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void init_creative() {
|
||||
unsigned char size_patch[4] = {sizeof(AuxDataTileItem), 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);
|
||||
overwrite_call((void *) 0xc6f74, TileItem_constructor, Tile_initTiles_TileItem_injection);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ void init_creative() {
|
||||
void *addr = (void *) 0x27800;
|
||||
const void *func = extract_from_bl_instruction((unsigned char *) addr);
|
||||
if (func == Minecraft_isCreativeMode->backup) {
|
||||
overwrite_call(addr, (void *) Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection);
|
||||
overwrite_call(addr, Minecraft_isCreativeMode, Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection);
|
||||
} else {
|
||||
// Handled By input/misc.cpp
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ static void set_is_survival(const 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 ? survival_mode_constructor : creative_mode_constructor);
|
||||
overwrite_call_manual((void *) 0x16ef4, new_is_survival ? survival_mode_constructor : creative_mode_constructor);
|
||||
|
||||
is_survival = new_is_survival;
|
||||
}
|
||||
@ -62,7 +62,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(true));
|
||||
overwrite_call_manual((void *) 0x16f84, (void *) ServerLevel_constructor->get(true));
|
||||
|
||||
// Allocate Correct Size For ServerLevel
|
||||
constexpr uint32_t level_size = sizeof(ServerLevel);
|
||||
|
@ -86,6 +86,6 @@ void _init_misc() {
|
||||
// Disable Opening Inventory Using The Cursor When Cursor Is Hidden
|
||||
overwrite_calls(Gui_handleClick, 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 *) 0x27800, Minecraft_isCreativeMode, Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection);
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,6 @@ void _init_toggle() {
|
||||
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
||||
}
|
||||
if (feature_has("Hide Crosshair In Third-Person", server_disabled)) {
|
||||
overwrite_call((void *) 0x261b8, (void *) Gui_renderProgressIndicator_GuiComponent_blit_injection);
|
||||
overwrite_call((void *) 0x261b8, GuiComponent_blit, Gui_renderProgressIndicator_GuiComponent_blit_injection);
|
||||
}
|
||||
}
|
||||
|
@ -33,12 +33,15 @@ struct Callbacks {
|
||||
// Run Functions On Creative Inventory Setup
|
||||
SETUP_CALLBACK(creative_inventory_setup, FillingContainer *);
|
||||
// Handle Custom Creative Inventory Setup Behavior
|
||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container, ItemInstance *item_instance) {
|
||||
static int Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container, ItemInstance *item_instance) {
|
||||
// Call Original Method
|
||||
filling_container->addItem(item_instance);
|
||||
const int ret = filling_container->addItem(item_instance);
|
||||
|
||||
// Run Functions
|
||||
get_misc_creative_inventory_setup_functions().run(filling_container);
|
||||
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Track Frames
|
||||
@ -139,5 +142,5 @@ void misc_render_background(int color, const Minecraft *minecraft, const int x,
|
||||
// Init
|
||||
void _init_misc_api() {
|
||||
// Handle Custom Creative Inventory Setup Behavior
|
||||
overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
overwrite_call((void *) 0x8e0fc, FillingContainer_addItem, Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
#include <libreborn/patch.h>
|
||||
#include <libreborn/config.h>
|
||||
@ -337,7 +338,7 @@ static void PlayerRenderer_render_injection(PlayerRenderer *model_renderer, Enti
|
||||
}
|
||||
|
||||
// 3D Chests
|
||||
static int32_t Tile_getRenderShape_injection(Tile *tile) {
|
||||
static int32_t TileRenderer_tesselateInWorld_Tile_getRenderShape_injection(Tile *tile) {
|
||||
if (tile == Tile::chest) {
|
||||
// Don't Render "Simple" Chest Model
|
||||
return -1;
|
||||
@ -357,7 +358,7 @@ static ChestTileEntity *ChestTileEntity_injection(ChestTileEntity_constructor_t
|
||||
return tile_entity;
|
||||
}
|
||||
static bool is_rendering_chest = false;
|
||||
static void ModelPart_render_injection(ModelPart *model_part, float scale) {
|
||||
static void ChestRenderer_render_ModelPart_render_injection(ModelPart *model_part, float scale) {
|
||||
// Start
|
||||
is_rendering_chest = true;
|
||||
|
||||
@ -367,7 +368,7 @@ static void ModelPart_render_injection(ModelPart *model_part, float scale) {
|
||||
// Stop
|
||||
is_rendering_chest = false;
|
||||
}
|
||||
static void Tesselator_vertexUV_injection(Tesselator *self, const float x, const float y, const float z, const float u, float v) {
|
||||
static void PolygonQuad_render_Tesselator_vertexUV_injection(Tesselator *self, const float x, const float y, const float z, const float u, float v) {
|
||||
// Fix Chest Texture
|
||||
if (is_rendering_chest) {
|
||||
v /= 2;
|
||||
@ -523,7 +524,7 @@ void _init_misc_graphics() {
|
||||
});
|
||||
unsigned char fix_outline_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x4d830, fix_outline_patch);
|
||||
overwrite_call((void *) 0x4d764, (void *) LevelRenderer_render_AABB_glColor4f_injection);
|
||||
overwrite_call_manual((void *) 0x4d764, (void *) LevelRenderer_render_AABB_glColor4f_injection);
|
||||
}
|
||||
|
||||
// Properly Hide Block Outline
|
||||
@ -558,13 +559,13 @@ void _init_misc_graphics() {
|
||||
hijack_entity_rendering = true;
|
||||
}
|
||||
if (hijack_entity_rendering) {
|
||||
overwrite_call((void *) 0x606c0, (void *) EntityRenderDispatcher_render_EntityRenderer_render_injection);
|
||||
overwrite_call((void *) 0x606c0, EntityRenderer_render, EntityRenderDispatcher_render_EntityRenderer_render_injection);
|
||||
}
|
||||
|
||||
// Slightly Nicer Water Rendering
|
||||
if (feature_has("Improved Water Rendering", server_disabled)) {
|
||||
overwrite_call((void *) 0x49ed4, (void *) GameRenderer_render_glColorMask_injection);
|
||||
overwrite_call((void *) 0x4a18c, (void *) GameRenderer_render_LevelRenderer_render_injection);
|
||||
overwrite_call_manual((void *) 0x49ed4, (void *) GameRenderer_render_glColorMask_injection);
|
||||
overwrite_call((void *) 0x4a18c, LevelRenderer_render, GameRenderer_render_LevelRenderer_render_injection);
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x4a12c, nop_patch);
|
||||
}
|
||||
@ -581,12 +582,12 @@ void _init_misc_graphics() {
|
||||
|
||||
// 3D Chests
|
||||
if (feature_has("3D Chest Model", server_disabled)) {
|
||||
overwrite_call((void *) 0x5e830, (void *) Tile_getRenderShape_injection);
|
||||
overwrite_call((void *) 0x5e830, Tile_getRenderShape, TileRenderer_tesselateInWorld_Tile_getRenderShape_injection);
|
||||
overwrite_calls(ChestTileEntity_constructor, ChestTileEntity_injection);
|
||||
overwrite_call((void *) 0x6655c, (void *) ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x66568, (void *) ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x66574, (void *) ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x4278c, (void *) Tesselator_vertexUV_injection);
|
||||
overwrite_call((void *) 0x6655c, ModelPart_render, ChestRenderer_render_ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x66568, ModelPart_render, ChestRenderer_render_ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x66574, ModelPart_render, ChestRenderer_render_ModelPart_render_injection);
|
||||
overwrite_call((void *) 0x4278c, Tesselator_vertexUV, PolygonQuad_render_Tesselator_vertexUV_injection);
|
||||
unsigned char chest_model_patch[4] = {0x13, 0x20, 0xa0, 0xe3}; // "mov r2, #0x13"
|
||||
patch((void *) 0x66fc8, chest_model_patch);
|
||||
unsigned char chest_color_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
@ -603,7 +604,7 @@ void _init_misc_graphics() {
|
||||
// 3D Dropped Items
|
||||
if (feature_has("3D Dropped Items", server_disabled)) {
|
||||
overwrite_calls(ItemRenderer_render, ItemRenderer_render_injection);
|
||||
overwrite_call((void *) 0x4bf34, (void *) ItemInHandRenderer_renderItem_glTranslatef_injection);
|
||||
overwrite_call_manual((void *) 0x4bf34, (void *) ItemInHandRenderer_renderItem_glTranslatef_injection);
|
||||
}
|
||||
|
||||
// Vignette
|
||||
|
@ -16,7 +16,7 @@ void _init_misc_home() {
|
||||
// Store Data In ~/.minecraft-pi Instead Of ~/.minecraft
|
||||
patch_address(&Strings::default_path, (void *) get_home_subdirectory_for_game_data());
|
||||
// Use MCPI_HOME Instead Of $HOME
|
||||
overwrite_call((void *) 0xe0e4, (void *) getenv_HOME);
|
||||
overwrite_call_manual((void *) 0xe0e4, (void *) getenv_HOME);
|
||||
|
||||
// The override code resolves assets manually,
|
||||
// making changing directory redundant.
|
||||
|
@ -165,7 +165,7 @@ static void RandomLevelSource_buildSurface_injection(RandomLevelSource_buildSurf
|
||||
}
|
||||
|
||||
// Disable Hostile AI In Creative Mode
|
||||
static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
||||
static Entity *PathfinderMob_updateAi_PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
||||
// Call Original Method
|
||||
Entity *target = mob->findAttackTarget();
|
||||
|
||||
@ -456,7 +456,7 @@ void init_misc() {
|
||||
|
||||
// Print Error Message If RakNet Startup Fails
|
||||
if (feature_has("Log RakNet Startup Errors", server_enabled)) {
|
||||
overwrite_call((void *) 0x73778, (void *) RakNetInstance_host_RakNet_RakPeer_Startup_injection);
|
||||
overwrite_call((void *) 0x73778, RakNet_RakPeer_Startup, RakNetInstance_host_RakNet_RakPeer_Startup_injection);
|
||||
}
|
||||
|
||||
// Fix Furnace Not Checking Item Auxiliary When Inserting New Item
|
||||
@ -483,7 +483,7 @@ void init_misc() {
|
||||
|
||||
// Disable Hostile AI In Creative Mode
|
||||
if (feature_has("Disable Hostile AI In Creative Mode", server_enabled)) {
|
||||
overwrite_call((void *) 0x83b8c, (void *) PathfinderMob_findAttackTarget_injection);
|
||||
overwrite_call((void *) 0x83b8c, PathfinderMob_findAttackTarget, PathfinderMob_updateAi_PathfinderMob_findAttackTarget_injection);
|
||||
}
|
||||
|
||||
// Send The Full Level, Not Only Changed Chunks
|
||||
@ -507,7 +507,7 @@ void init_misc() {
|
||||
|
||||
// Implement Crafting Remainders
|
||||
if (feature_has("Implement Crafting Remainders", server_enabled)) {
|
||||
overwrite_call((void *) 0x2e230, (void *) PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_injection);
|
||||
overwrite_call((void *) 0x2e230, PaneCraftingScreen_recheckRecipes, PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_injection);
|
||||
overwrite_calls(Item_getCraftingRemainingItem, Item_getCraftingRemainingItem_injection);
|
||||
}
|
||||
|
||||
@ -532,31 +532,31 @@ void init_misc() {
|
||||
if (feature_has("Add Missing Language Strings", server_disabled)) {
|
||||
misc_run_on_language_setup(Language_injection);
|
||||
// Water/Lava Language Strings
|
||||
overwrite_call((void *) 0xc3b54, (void *) Tile_initTiles_std_string_constructor);
|
||||
overwrite_call((void *) 0xc3c7c, (void *) Tile_initTiles_std_string_constructor);
|
||||
overwrite_call_manual((void *) 0xc3b54, (void *) Tile_initTiles_std_string_constructor);
|
||||
overwrite_call_manual((void *) 0xc3c7c, (void *) Tile_initTiles_std_string_constructor);
|
||||
// Carried Tile Language Strings
|
||||
patch_address((void *) 0xc6674, (void *) "grassCarried");
|
||||
patch_address((void *) 0xc6684, (void *) "leavesCarried");
|
||||
// Invisible Bedrock Language String
|
||||
overwrite_call((void *) 0xc5f04, (void *) Tile_initTiles_Tile_init_invBedrock_injection);
|
||||
overwrite_call((void *) 0xc5f04, Tile_init, Tile_initTiles_Tile_init_invBedrock_injection);
|
||||
}
|
||||
|
||||
// Prevent Pigmen From Burning In The Sun
|
||||
if (feature_has("Fix Pigmen Burning In The Sun", server_enabled)) {
|
||||
fix_pigmen_burning = true;
|
||||
overwrite_call((void *) 0x89a1c, (void *) Zombie_aiStep_getBrightness_injection);
|
||||
overwrite_call((void *) 0x89a1c, Entity_getBrightness, Zombie_aiStep_getBrightness_injection);
|
||||
}
|
||||
|
||||
// Fix Door Duplication
|
||||
if (feature_has("Fix Door Duplication", server_enabled)) {
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0xbe230, nop_patch);
|
||||
overwrite_call((void *) 0xbe110, (void *) DoorTile_neighborChanged_Tile_spawnResources_injection);
|
||||
overwrite_call((void *) 0xbe110, DoorTile_spawnResources, DoorTile_neighborChanged_Tile_spawnResources_injection);
|
||||
}
|
||||
|
||||
// Fix Cobweb Lighting
|
||||
if (feature_has("Fix Cobweb Lighting", server_enabled)) {
|
||||
overwrite_call((void *) 0xc444c, (void *) Tile_initTiles_WebTile_setLightBlock_injection);
|
||||
overwrite_call((void *) 0xc444c, Tile_setLightBlock, Tile_initTiles_WebTile_setLightBlock_injection);
|
||||
}
|
||||
|
||||
// Fix Fire Immunity
|
||||
@ -589,12 +589,12 @@ void init_misc() {
|
||||
|
||||
// Rare Segfault
|
||||
if (feature_has("Fix Crash When Generating Certain Seeds", server_enabled)) {
|
||||
overwrite_call((void *) 0xb198c, (void *) Dimension_isValidSpawn_Level_getTopTile_injection);
|
||||
overwrite_call((void *) 0xb198c, Level_getTopTile, Dimension_isValidSpawn_Level_getTopTile_injection);
|
||||
}
|
||||
|
||||
// Fix Sugar Rendering
|
||||
if (feature_has("Fix Sugar Position In Hand", server_disabled)) {
|
||||
overwrite_call((void *) 0x976f8, (void *) Item_initItems_Item_handEquipped_injection);
|
||||
overwrite_call((void *) 0x976f8, Item_handEquipped, Item_initItems_Item_handEquipped_injection);
|
||||
}
|
||||
|
||||
// Disable overwrite_calls() After Minecraft::init
|
||||
|
@ -39,31 +39,31 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) {
|
||||
}
|
||||
#define PINK_HEART_FULL 70
|
||||
#define PINK_HEART_HALF 79
|
||||
static void Gui_renderHearts_GuiComponent_blit_overlay_empty_injection(Gui *gui, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2, const int32_t w1, const int32_t h1, const int32_t w2, const int32_t h2) {
|
||||
static void Gui_renderHearts_GuiComponent_blit_overlay_empty_injection(GuiComponent *gui, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2, const int32_t w1, const int32_t h1, const int32_t w2, const int32_t h2) {
|
||||
// Call Original Method
|
||||
get_blit_with_classic_hud_offset()((GuiComponent *) gui, x1, y1, x2, y2, w1, h1, w2, h2);
|
||||
get_blit_with_classic_hud_offset()(gui, x1, y1, x2, y2, w1, h1, w2, h2);
|
||||
// Render The Overlay
|
||||
if (heal_amount_drawing == 1) {
|
||||
// Half Heart
|
||||
get_blit_with_classic_hud_offset()((GuiComponent *) gui, x1, y1, PINK_HEART_HALF, 0, w1, h1, w2, h2);
|
||||
get_blit_with_classic_hud_offset()(gui, x1, y1, PINK_HEART_HALF, 0, w1, h1, w2, h2);
|
||||
heal_amount_drawing = 0;
|
||||
} else if (heal_amount_drawing > 0) {
|
||||
// Full Heart
|
||||
get_blit_with_classic_hud_offset()((GuiComponent *) gui, x1, y1, PINK_HEART_FULL, 0, w1, h1, w2, h2);
|
||||
get_blit_with_classic_hud_offset()(gui, x1, y1, PINK_HEART_FULL, 0, w1, h1, w2, h2);
|
||||
heal_amount_drawing -= 2;
|
||||
}
|
||||
}
|
||||
static void Gui_renderHearts_GuiComponent_blit_overlay_hearts_injection(Gui *gui, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2, const int32_t w1, const int32_t h1, const int32_t w2, const int32_t h2) {
|
||||
static void Gui_renderHearts_GuiComponent_blit_overlay_hearts_injection(GuiComponent *gui, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2, const int32_t w1, const int32_t h1, const int32_t w2, const int32_t h2) {
|
||||
// Offset the overlay
|
||||
if (x2 == 52) {
|
||||
heal_amount_drawing += 2;
|
||||
} else if (x2 == 61 && heal_amount) {
|
||||
// Half heart, flipped
|
||||
get_blit_with_classic_hud_offset()((GuiComponent *) gui, x1, y1, PINK_HEART_FULL, 0, w1, h1, w2, h2);
|
||||
get_blit_with_classic_hud_offset()(gui, x1, y1, PINK_HEART_FULL, 0, w1, h1, w2, h2);
|
||||
heal_amount_drawing += 1;
|
||||
}
|
||||
// Call Original Method
|
||||
get_blit_with_classic_hud_offset()((GuiComponent *) gui, x1, y1, x2, y2, w1, h1, w2, h2);
|
||||
get_blit_with_classic_hud_offset()(gui, x1, y1, x2, y2, w1, h1, w2, h2);
|
||||
heal_amount_drawing = std::min(heal_amount_drawing, heal_amount);
|
||||
}
|
||||
|
||||
@ -285,8 +285,8 @@ void _init_misc_ui() {
|
||||
// Food Overlay
|
||||
if (feature_has("Food Overlay", server_disabled)) {
|
||||
overwrite_calls(Gui_renderHearts, Gui_renderHearts_injection);
|
||||
overwrite_call((void *) 0x266f8, (void *) Gui_renderHearts_GuiComponent_blit_overlay_empty_injection);
|
||||
overwrite_call((void *) 0x267c8, (void *) Gui_renderHearts_GuiComponent_blit_overlay_hearts_injection);
|
||||
overwrite_call((void *) 0x266f8, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_overlay_empty_injection);
|
||||
overwrite_call((void *) 0x267c8, GuiComponent_blit, Gui_renderHearts_GuiComponent_blit_overlay_hearts_injection);
|
||||
}
|
||||
|
||||
// Render Selected Item Text + Hide Chat Messages
|
||||
@ -299,7 +299,7 @@ void _init_misc_ui() {
|
||||
// Translucent Toolbar
|
||||
if (feature_has("Translucent Toolbar", server_disabled)) {
|
||||
overwrite_calls(Gui_renderToolBar, Gui_renderToolBar_injection);
|
||||
overwrite_call((void *) 0x26c5c, (void *) Gui_renderToolBar_glColor4f_injection);
|
||||
overwrite_call_manual((void *) 0x26c5c, (void *) Gui_renderToolBar_glColor4f_injection);
|
||||
}
|
||||
|
||||
// Fix Screen Rendering When GUI is Hidden
|
||||
@ -358,9 +358,15 @@ void _init_misc_ui() {
|
||||
patch((void *) 0x173f0, nop_patch);
|
||||
}
|
||||
|
||||
// Text Bugs
|
||||
if (feature_has("Text Rendering Fixes", server_disabled)) {
|
||||
// Don't Wrap Text On '\r' Or '\t' Because They Are Actual Characters In MCPI
|
||||
if (feature_has("Fix Text Wrapping", server_disabled)) {
|
||||
patch_address(&Strings::text_wrapping_delimiter, (void *) " \n");
|
||||
// Fix Width Of "Masculine Ordinal Indicator"
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x24d6c, nop_patch);
|
||||
patch((void *) 0x24d70, nop_patch);
|
||||
patch((void *) 0x24d74, nop_patch);
|
||||
}
|
||||
|
||||
// Fix Invalid ItemInHandRenderer Texture Cache
|
||||
|
@ -139,8 +139,8 @@ void LevelRenderer_renderSameAsLast(LevelRenderer *self, const float delta) {
|
||||
void init_multidraw() {
|
||||
// Setup
|
||||
if (feature_has("Multidraw Rendering", server_disabled)) {
|
||||
overwrite_call((void *) 0x4e51c, (void *) setup_multidraw);
|
||||
overwrite_call((void *) 0x4e6f8, (void *) setup_multidraw);
|
||||
overwrite_call_manual((void *) 0x4e51c, (void *) setup_multidraw);
|
||||
overwrite_call_manual((void *) 0x4e6f8, (void *) setup_multidraw);
|
||||
overwrite_calls(LevelRenderer_renderChunks, LevelRenderer_renderChunks_injection);
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x479fc, nop_patch);
|
||||
|
@ -212,7 +212,7 @@ void init_options() {
|
||||
// options.txt
|
||||
if (feature_has("Fix options.txt Loading/Saving", server_enabled)) {
|
||||
// Actually Save options.txt
|
||||
overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection);
|
||||
overwrite_call((void *) 0x197fc, Options_addOptionToSaveOutput, Options_save_Options_addOptionToSaveOutput_injection);
|
||||
// Fix options.txt Path
|
||||
patch_address((void *) &Strings::options_txt_path, (void *) get_new_options_txt_path());
|
||||
// When Loading, options.txt Should Be Opened In Read Mode
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
// Fix Initial Option Button Rendering
|
||||
// The calling function doesn't exist in MCPE v0.6.1, so its name is unknown.
|
||||
static OptionButton *OptionsPane_unknown_toggle_creating_function_OptionButton_injection(OptionButton *option_button, Options_Option *option) {
|
||||
static OptionButton *OptionsPane_unknown_toggle_creating_function_OptionButton_injection(OptionButton *option_button, const Options_Option *option) {
|
||||
// Call Original Method
|
||||
OptionButton *ret = option_button->constructor(option);
|
||||
|
||||
@ -162,7 +162,7 @@ void _init_options_ui() {
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
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);
|
||||
overwrite_call((void *) 0x24510, OptionButton_constructor, OptionsPane_unknown_toggle_creating_function_OptionButton_injection);
|
||||
|
||||
// "Gui Scale" slider is broken, so disable it.
|
||||
patch((void *) 0x35a10, nop_patch);
|
||||
@ -180,7 +180,7 @@ void _init_options_ui() {
|
||||
overwrite_calls(Options_getBooleanValue, Options_getBooleanValue_injection);
|
||||
|
||||
// Fix Difficulty When Toggling
|
||||
overwrite_call((void *) 0x1cd00, (void *) OptionButton_toggle_Options_save_injection);
|
||||
overwrite_call((void *) 0x1cd00, Options_save, OptionButton_toggle_Options_save_injection);
|
||||
}
|
||||
|
||||
// Info Button
|
||||
|
@ -581,7 +581,7 @@ static void server_init() {
|
||||
}
|
||||
|
||||
// Log IPs
|
||||
overwrite_call((void *) 0x75e54, (void *) ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection);
|
||||
overwrite_call((void *) 0x75e54, ServerSideNetworkHandler_popPendingPlayer, ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection);
|
||||
|
||||
// Start Reading STDIN
|
||||
pthread_create(&read_stdin_thread_obj, nullptr, read_stdin_thread, nullptr);
|
||||
|
@ -116,20 +116,20 @@ static void TripodCameraRenderer_render_Tesselator_draw_injection(Tesselator *se
|
||||
// Init
|
||||
void _init_lighting() {
|
||||
overwrite_calls(LevelRenderer_renderEntities, LevelRenderer_renderEntities_injection);
|
||||
overwrite_call((void *) 0x4c04c, (void *) ItemInHandRenderer_render_glPopMatrix_injection);
|
||||
overwrite_call_manual((void *) 0x4c04c, (void *) ItemInHandRenderer_render_glPopMatrix_injection);
|
||||
overwrite_calls(ItemInHandRenderer_render, ItemInHandRenderer_render_injection);
|
||||
overwrite_call((void *) 0x4bedc, (void *) enable_rescale_normal);
|
||||
overwrite_call((void *) 0x4bf70, (void *) disable_rescale_normal);
|
||||
overwrite_call_manual((void *) 0x4bedc, (void *) enable_rescale_normal);
|
||||
overwrite_call_manual((void *) 0x4bf70, (void *) disable_rescale_normal);
|
||||
overwrite_calls(ItemRenderer_render, EntityRenderer_render_injection<ItemRenderer>);
|
||||
overwrite_calls(ArrowRenderer_render, EntityRenderer_render_injection<ArrowRenderer>);
|
||||
overwrite_calls(ItemSpriteRenderer_render, EntityRenderer_render_injection<ItemSpriteRenderer>);
|
||||
overwrite_calls(PaintingRenderer_render, EntityRenderer_render_injection<PaintingRenderer>);
|
||||
overwrite_call((void *) 0x641ec, (void *) enable_rescale_normal);
|
||||
overwrite_call((void *) 0x647a0, (void *) disable_rescale_normal);
|
||||
overwrite_call((void *) 0x62b08, (void *) FallingTileRenderer_render_TileRenderer_renderBlock_injection);
|
||||
overwrite_call((void *) 0x65754, (void *) TntRenderer_render_TileRenderer_renderTile_injection);
|
||||
overwrite_call_manual((void *) 0x641ec, (void *) enable_rescale_normal);
|
||||
overwrite_call_manual((void *) 0x647a0, (void *) disable_rescale_normal);
|
||||
overwrite_call((void *) 0x62b08, TileRenderer_renderBlock, FallingTileRenderer_render_TileRenderer_renderBlock_injection);
|
||||
overwrite_call((void *) 0x65754, TileRenderer_renderTile, TntRenderer_render_TileRenderer_renderTile_injection);
|
||||
overwrite_calls(MobRenderer_renderNameTag, MobRenderer_renderNameTag_injection);
|
||||
overwrite_calls(ArmorScreen_renderPlayer, ArmorScreen_renderPlayer_injection);
|
||||
overwrite_call((void *) 0x29d88, (void *) ArmorScreen_renderPlayer_glRotatef_injection);
|
||||
overwrite_call((void *) 0x65a10, (void *) TripodCameraRenderer_render_Tesselator_draw_injection);
|
||||
overwrite_call_manual((void *) 0x29d88, (void *) ArmorScreen_renderPlayer_glRotatef_injection);
|
||||
overwrite_call((void *) 0x65a10, Tesselator_draw, TripodCameraRenderer_render_Tesselator_draw_injection);
|
||||
}
|
@ -32,7 +32,7 @@ static void PolygonQuad_render_injection(PolygonQuad_render_t original, PolygonQ
|
||||
template <int nx, int ny, int nz> \
|
||||
static void add_normal_before_##name(uint32_t addr) { \
|
||||
std::remove_pointer_t<decltype(type##_##name)>::ptr_type func = type##_##name##_injection<nx, ny, nz>; \
|
||||
overwrite_call((void *) addr, (void *) func); \
|
||||
overwrite_call((void *) addr, type##_##name, func); \
|
||||
}
|
||||
add_normal_before(Tesselator, vertexUV)
|
||||
add_normal_before(Tesselator, vertex)
|
||||
|
@ -148,7 +148,7 @@ static void drawArrayVT_injection(const int buffer, const int vertices, int vert
|
||||
}
|
||||
|
||||
// Add Vertex
|
||||
static void Tesselator_vertex_injection(const Tesselator *self, const float x, const float y, const float z) {
|
||||
static void Tesselator_vertex_injection(Tesselator *self, const float x, const float y, const float z) {
|
||||
CustomVertex &vertex = CustomTesselator::instance.vertices[CustomTesselator::instance.vertex_count++];
|
||||
vertex.pos = {
|
||||
(self->offset_x + x) * self->sx,
|
||||
@ -195,9 +195,9 @@ void _init_custom_tesselator() {
|
||||
overwrite_calls(Tesselator_init, Tesselator_init_injection);
|
||||
overwrite_calls(Tesselator_clear, Tesselator_clear_injection);
|
||||
overwrite_calls(Tesselator_begin, Tesselator_begin_injection);
|
||||
overwrite_call((void *) Tesselator_end->backup, (void *) Tesselator_end_injection, true);
|
||||
overwrite_call((void *) Tesselator_draw->backup, (void *) Tesselator_draw_injection, true);
|
||||
overwrite_call((void *) Tesselator_vertex->backup, (void *) Tesselator_vertex_injection, true);
|
||||
overwrite_call((void *) Tesselator_normal->backup, (void *) Tesselator_normal_injection, true);
|
||||
overwrite_call((void *) Common_drawArrayVT->backup, (void *) drawArrayVT_injection, true);
|
||||
overwrite_call((void *) Tesselator_end->backup, Tesselator_end, Tesselator_end_injection, true);
|
||||
overwrite_call((void *) Tesselator_draw->backup, Tesselator_draw, Tesselator_draw_injection, true);
|
||||
overwrite_call((void *) Tesselator_vertex->backup, Tesselator_vertex, Tesselator_vertex_injection, true);
|
||||
overwrite_call((void *) Tesselator_normal->backup, Tesselator_normal, Tesselator_normal_injection, true);
|
||||
overwrite_call((void *) Common_drawArrayVT->backup, Common_drawArrayVT, drawArrayVT_injection, true);
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include <libreborn/patch.h>
|
||||
#include <symbols/minecraft.h>
|
||||
|
||||
@ -65,7 +67,7 @@ static void Player_username_assign_injection_2(std::string *target, const char *
|
||||
}
|
||||
|
||||
// Change Texture For HUD
|
||||
static int32_t Textures_loadAndBindTexture_injection(Textures *textures, __attribute__((unused)) std::string const& name) {
|
||||
static uint32_t Textures_loadAndBindTexture_injection(Textures *textures, __attribute__((unused)) std::string const& name) {
|
||||
// Change Texture
|
||||
static std::string new_texture;
|
||||
if (new_texture.length() == 0) {
|
||||
@ -82,14 +84,14 @@ void init_skin() {
|
||||
// Check Feature Flag
|
||||
if (feature_has("Load Custom Skins", server_disabled)) {
|
||||
// LocalPlayer
|
||||
overwrite_call((void *) 0x44c28, (void *) Player_username_assign_injection);
|
||||
overwrite_call_manual((void *) 0x44c28, (void *) Player_username_assign_injection);
|
||||
// RemotePlayer
|
||||
overwrite_call((void *) 0x6ce58, (void *) Player_username_assign_injection_2);
|
||||
overwrite_call_manual((void *) 0x6ce58, (void *) Player_username_assign_injection_2);
|
||||
// ServerPlayer
|
||||
overwrite_call((void *) 0x7639c, (void *) Player_username_assign_injection_2);
|
||||
overwrite_call_manual((void *) 0x7639c, (void *) Player_username_assign_injection_2);
|
||||
|
||||
// HUD
|
||||
overwrite_call((void *) 0x4c6d0, (void *) Textures_loadAndBindTexture_injection);
|
||||
overwrite_call((void *) 0x4c6d0, Textures_loadAndBindTexture, Textures_loadAndBindTexture_injection);
|
||||
|
||||
// Loader
|
||||
_init_skin_loader();
|
||||
|
@ -202,7 +202,7 @@ static DynamicTexture *create_fire_texture(const int a2) {
|
||||
static bool animated_water = false;
|
||||
static bool animated_lava = false;
|
||||
static bool animated_fire = false;
|
||||
static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
|
||||
static void Minecraft_init_Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
|
||||
// Call Original Method
|
||||
if (animated_water) {
|
||||
textures->addDynamicTexture(dynamic_texture);
|
||||
@ -228,5 +228,5 @@ void _init_textures_lava(const bool animated_water_param, const bool animated_la
|
||||
unsigned char disable_water_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x17094, disable_water_patch);
|
||||
}
|
||||
overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection);
|
||||
overwrite_call((void *) 0x170b4, Textures_addDynamicTexture, Minecraft_init_Textures_addDynamicTexture_injection);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ struct SplashLine {
|
||||
|
||||
// Add Splashes
|
||||
static std::string current_splash;
|
||||
static bool draw_splash(StartMenuScreen *screen, const float y_factor, const bool allow_bad_y_factor) {
|
||||
static bool draw_splash(const StartMenuScreen *screen, const float y_factor, const bool allow_bad_y_factor) {
|
||||
// Position
|
||||
const SplashLine line(screen, y_factor);
|
||||
const float x = line.origin_x();
|
||||
@ -121,9 +121,8 @@ static bool draw_splash(StartMenuScreen *screen, const float y_factor, const boo
|
||||
media_glScalef(scale, scale, 1);
|
||||
media_glTranslatef(-text_width / 2.0f, 0, 0);
|
||||
// Render
|
||||
float y_offset = float(-line_height) / 2.0f;
|
||||
y_offset += 1; // Make It Look Vertically Centered
|
||||
screen->drawString(screen->font, current_splash, 0, y_offset, 0xffff00);
|
||||
float y_offset = -float(line_height - 1) / 2.0f;
|
||||
screen->font->drawShadow(current_splash, 0, y_offset, 0xffff00);
|
||||
// Finish
|
||||
media_glPopMatrix();
|
||||
return true;
|
||||
|
@ -42,7 +42,7 @@ static void StartMenuScreen_init_injection(StartMenuScreen_init_t original, Star
|
||||
|
||||
// Add Functionality To Quit Button
|
||||
static void StartMenuScreen_buttonClicked_injection(StartMenuScreen_buttonClicked_t original, StartMenuScreen *screen, Button *button) {
|
||||
Button *quit_button = &screen->create_button;
|
||||
const Button *quit_button = &screen->create_button;
|
||||
if (button == quit_button) {
|
||||
// Quit
|
||||
compat_request_exit();
|
||||
@ -72,7 +72,7 @@ static float StartMenuScreen_render_Mth_min_injection(__attribute__((unused)) fl
|
||||
// Track Version Text Y
|
||||
int version_text_bottom;
|
||||
static int (*adjust_version_y)(const StartMenuScreen *) = nullptr;
|
||||
static void StartMenuScreen_render_GuiComponent_drawString_injection(GuiComponent *self, Font *font, const std::string &text, int x, int y, int color) {
|
||||
static void StartMenuScreen_render_GuiComponent_drawString_injection(GuiComponent *self, Font *font, const std::string &text, int x, int y, uint color) {
|
||||
// Adjust Position
|
||||
if (adjust_version_y) {
|
||||
y = adjust_version_y((StartMenuScreen *) self);
|
||||
@ -175,18 +175,18 @@ void init_title_screen() {
|
||||
// High-Resolution Title
|
||||
if (feature_has("Allow High-Resolution Title", server_disabled) || modern_logo) {
|
||||
// Touch
|
||||
overwrite_call((void *) 0x3df2c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x3df98, (void *) StartMenuScreen_render_Mth_min_injection);
|
||||
overwrite_call((void *) 0x3df2c, Textures_getTemporaryTextureData, StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x3df98, Mth_min, StartMenuScreen_render_Mth_min_injection);
|
||||
// Classic
|
||||
overwrite_call((void *) 0x3956c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x395d8, (void *) StartMenuScreen_render_Mth_min_injection);
|
||||
overwrite_call((void *) 0x3956c, Textures_getTemporaryTextureData, StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x395d8, Mth_min, StartMenuScreen_render_Mth_min_injection);
|
||||
}
|
||||
|
||||
// Better Scaling And Position
|
||||
bool hijack_version_rendering = false;
|
||||
if (feature_has("Improved Classic Title Positioning", server_disabled)) {
|
||||
overwrite_call((void *) 0x3956c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection_modern);
|
||||
overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||
overwrite_call((void *) 0x3956c, Textures_getTemporaryTextureData, StartMenuScreen_render_Textures_getTemporaryTextureData_injection_modern);
|
||||
overwrite_call((void *) 0x39528, StartMenuScreen_renderBackground, StartMenuScreen_render_Screen_renderBackground_injection);
|
||||
hijack_version_rendering = true;
|
||||
adjust_version_y = get_version_y;
|
||||
}
|
||||
@ -199,7 +199,7 @@ void init_title_screen() {
|
||||
|
||||
// Adjust And Record Version String Rendering
|
||||
if (hijack_version_rendering) {
|
||||
overwrite_call((void *) 0x39728, (void *) StartMenuScreen_render_GuiComponent_drawString_injection);
|
||||
overwrite_call((void *) 0x39728, GuiComponent_drawString, StartMenuScreen_render_GuiComponent_drawString_injection);
|
||||
}
|
||||
|
||||
// Init Welcome Screen
|
||||
|
@ -131,7 +131,7 @@ static Screen *create_welcome_screen() {
|
||||
}
|
||||
|
||||
// Show Welcome Screen
|
||||
static void NinecraftApp_init_ScreenChooser_setScreen_injection(ScreenChooser *self, int id) {
|
||||
static void NinecraftApp_init_ScreenChooser_setScreen_injection(ScreenChooser *self, uint id) {
|
||||
if (should_show_welcome()) {
|
||||
// Show Welcome Screen
|
||||
self->minecraft->setScreen(create_welcome_screen());
|
||||
@ -144,5 +144,5 @@ static void NinecraftApp_init_ScreenChooser_setScreen_injection(ScreenChooser *s
|
||||
// Init
|
||||
void _init_welcome() {
|
||||
// Hijack Start Screen
|
||||
overwrite_call((void *) 0x14a34, (void *) NinecraftApp_init_ScreenChooser_setScreen_injection);
|
||||
overwrite_call((void *) 0x14a34, ScreenChooser_setScreen, NinecraftApp_init_ScreenChooser_setScreen_injection);
|
||||
}
|
@ -9,9 +9,12 @@
|
||||
#include <symbols/minecraft.h>
|
||||
|
||||
// Enable Touch GUI
|
||||
static bool Minecraft_isTouchscreen_injection(__attribute__((unused)) Minecraft_isTouchscreen_t original, __attribute__((unused)) Minecraft *minecraft) {
|
||||
static bool Minecraft_isTouchscreen_call_injection(__attribute__((unused)) Minecraft *minecraft) {
|
||||
return true;
|
||||
}
|
||||
static bool Minecraft_isTouchscreen_injection(__attribute__((unused)) Minecraft_isTouchscreen_t original, __attribute__((unused)) Minecraft *minecraft) {
|
||||
return Minecraft_isTouchscreen_call_injection(minecraft);
|
||||
}
|
||||
|
||||
// IngameBlockSelectionScreen Memory Allocation Override
|
||||
static unsigned char *operator_new_IngameBlockSelectionScreen_injection(__attribute__((unused)) uint32_t size) {
|
||||
@ -33,7 +36,7 @@ static int32_t Button_hovered_injection(__attribute__((unused)) Button_hovered_t
|
||||
// Check
|
||||
return x >= button_x1 && x < button_x2 && y >= button_y1 && y < button_y2;
|
||||
}
|
||||
static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(GuiComponent *component, Font *font, const std::string &text, int32_t x, int32_t y, int32_t color) {
|
||||
static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(GuiComponent *component, Font *font, const std::string &text, int32_t x, int32_t y, uint32_t color) {
|
||||
// Change Color On Hover
|
||||
if (color == 0xe0e0e0 && Button_hovered_injection(nullptr, (Button *) component, nullptr, 0, 0)) {
|
||||
color = 0xffffa0;
|
||||
@ -73,33 +76,33 @@ void init_touch() {
|
||||
} else {
|
||||
// Force Touch Inventory
|
||||
if (feature_has("Force Touch UI Inventory", server_disabled)) {
|
||||
overwrite_call((void *) 0x2943c, (void *) operator_new_IngameBlockSelectionScreen_injection);
|
||||
overwrite_call((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen_constructor->get(true));
|
||||
overwrite_call_manual((void *) 0x2943c, (void *) operator_new_IngameBlockSelectionScreen_injection);
|
||||
overwrite_call_manual((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen_constructor->get(true));
|
||||
// Make "Craft" And "Armor" Buttons Use Classic GUI Style (Button And TButton Have The Same Size)
|
||||
overwrite_call((void *) 0x3b060, (void *) Button_constructor->get(true));
|
||||
overwrite_call((void *) 0x3b08c, (void *) Button_constructor->get(true));
|
||||
overwrite_call_manual((void *) 0x3b060, (void *) Button_constructor->get(true));
|
||||
overwrite_call_manual((void *) 0x3b08c, (void *) Button_constructor->get(true));
|
||||
}
|
||||
|
||||
// Force Touch Button Behavior
|
||||
if (feature_has("Force Touch UI Button Behavior", server_disabled)) {
|
||||
touch_buttons = true;
|
||||
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 *) 0x1baf4, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x1be40, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x1c470, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x1e868, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x290b8, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x29168, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x3e314, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x2cbc0, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x2ea7c, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
overwrite_call((void *) 0x4a438, Minecraft_isTouchscreen, Minecraft_isTouchscreen_call_injection);
|
||||
}
|
||||
}
|
||||
|
||||
// Improved Button Hover Behavior
|
||||
if (touch_buttons && feature_has("Improved Button Hover Behavior", server_disabled)) {
|
||||
overwrite_calls(Button_hovered, Button_hovered_injection);
|
||||
overwrite_call((void *) 0x1ebd4, (void *) LargeImageButton_render_GuiComponent_drawCenteredString_injection);
|
||||
overwrite_call((void *) 0x1ebd4, GuiComponent_drawCenteredString, LargeImageButton_render_GuiComponent_drawCenteredString_injection);
|
||||
}
|
||||
|
||||
// Show Block Outlines
|
||||
|
@ -1,4 +1,5 @@
|
||||
method std::string parse(ConnectedClient &client, const std::string &command) = 0x6aa8c;
|
||||
method void dispatchPacket(Packet &packet) = 0x6a548;
|
||||
|
||||
property Minecraft *minecraft = 0x18;
|
||||
property OffsetPosTranslator pos_translator = 0x1c;
|
||||
|
@ -2,7 +2,7 @@ vtable 0x102700;
|
||||
|
||||
method void tickInput() = 0x15ffc;
|
||||
method void setIsCreativeMode(int is_creative) = 0x16ec4;
|
||||
method int isTouchscreen() = 0x1639c;
|
||||
method bool isTouchscreen() = 0x1639c;
|
||||
method void setScreen(Screen *screen) = 0x15d6c;
|
||||
method void tick(int tick, int max_ticks) = 0x16934;
|
||||
method void hostMultiplayer(int port) = 0x16664;
|
||||
|
@ -1,4 +1,6 @@
|
||||
method int width(const std::string &string) = 0x24d4c;
|
||||
method void draw(const std::string &string, float x, float y, uint color) = 0x250e0;
|
||||
method void draw_raw(const char *string, float x, float y, uint color) = 0x25148;
|
||||
method void drawShadow(const std::string &string, float x, float y, uint color) = 0x250ec;
|
||||
method void drawShadow_raw(const char *string, float x, float y, uint color) = 0x25150;
|
||||
method void drawSlow(const char *text, float x, float y, uint color, bool param_1) = 0x24fa8;
|
@ -10,6 +10,7 @@ static-method ItemInstance *fromTag(CompoundTag *tag) = 0x9a124;
|
||||
method CompoundTag *save(CompoundTag *tag) = 0x9a31c;
|
||||
method int getMaxStackSize() = 0x99ac8;
|
||||
method bool isNull() = 0x999b0;
|
||||
method void setNull() = 0x999cc;
|
||||
|
||||
property int count = 0x0;
|
||||
property int id = 0x4;
|
||||
|
Loading…
Reference in New Issue
Block a user