2.3.1 Final

This commit is contained in:
TheBrokenRail 2022-03-14 21:51:38 -04:00
parent 3048b3bf50
commit 4c33b6da9a
6 changed files with 38 additions and 26 deletions

View File

@ -4,6 +4,8 @@
* Internal Refactor Of ``libreborn`` * Internal Refactor Of ``libreborn``
* Remove Use Of ``/bin/sh`` * Remove Use Of ``/bin/sh``
* Load Custom Mods First * Load Custom Mods First
* Use Zenity Dark Mode
* Add ``Improved Cursor Rendering`` Feature Flag (Enabled By Default)
**2.3.0** **2.3.0**
* Switch To AppImage For Packaging * Switch To AppImage For Packaging

View File

@ -32,3 +32,4 @@ TRUE Close Current Screen On Death
FALSE Disable Raw Mouse Motion (Not Recommended) FALSE Disable Raw Mouse Motion (Not Recommended)
TRUE Fix Furnace Not Checking Item Auxiliary TRUE Fix Furnace Not Checking Item Auxiliary
FALSE Disable Hosting LAN Worlds FALSE Disable Hosting LAN Worlds
TRUE Improved Cursor Rendering

View File

@ -141,6 +141,11 @@ static void load(char **ld_preload, char *folder) {
// Pre-Bootstrap // Pre-Bootstrap
void pre_bootstrap() { void pre_bootstrap() {
// GTK Dark Mode
#ifndef MCPI_HEADLESS_MODE
set_and_print_env("GTK_THEME", "Adwaita:dark");
#endif
// AppImage // AppImage
#ifdef MCPI_IS_APPIMAGE_BUILD #ifdef MCPI_IS_APPIMAGE_BUILD
char *owd = getenv("OWD"); char *owd = getenv("OWD");

View File

@ -72,7 +72,7 @@ add_library(death SHARED src/death/death.cpp)
target_link_libraries(death reborn-patch symbols feature) target_link_libraries(death reborn-patch symbols feature)
add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp src/misc/logging.cpp) add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp src/misc/logging.cpp)
target_link_libraries(misc reborn-patch symbols feature GLESv1_CM) target_link_libraries(misc reborn-patch symbols media-layer-core feature GLESv1_CM)
add_library(options SHARED src/options/options.c) add_library(options SHARED src/options/options.c)
target_link_libraries(options reborn-patch symbols feature) target_link_libraries(options reborn-patch symbols feature)

View File

@ -6,6 +6,7 @@
#include <libreborn/libreborn.h> #include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <SDL/SDL.h>
#include "../init/init.h" #include "../init/init.h"
#include "../feature/feature.h" #include "../feature/feature.h"
@ -179,6 +180,25 @@ static int32_t FurnaceScreen_handleAddItem_injection(unsigned char *furnace_scre
} }
} }
// Custom Cursor Rendering
//
// The default behavior for Touch GUI is to only render the cursor when the mouse is clicking, this fixes that.
// This also makes the cursor always render if the mouse is unlocked, instead of just when there is a Screen showing.
static void GameRenderer_render_injection(unsigned char *game_renderer, float param_1) {
// Call Original Method
(*GameRenderer_render)(game_renderer, param_1);
// Check If Cursor Should Render
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) {
// Get X And Y
float x = (*Mouse_getX)() * (*InvGuiScale);
float y = (*Mouse_getY)() * (*InvGuiScale);
// Render Cursor
unsigned char *minecraft = *(unsigned char **) (game_renderer + GameRenderer_minecraft_property_offset);
(*renderCursor)(x, y, minecraft);
}
}
// Init // Init
void init_misc() { void init_misc() {
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas) // Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
@ -216,6 +236,15 @@ void init_misc() {
overwrite_calls((void *) FurnaceScreen_handleAddItem, (void *) FurnaceScreen_handleAddItem_injection); overwrite_calls((void *) FurnaceScreen_handleAddItem, (void *) FurnaceScreen_handleAddItem_injection);
} }
// Improved Cursor Rendering
if (feature_has("Improved Cursor Rendering", 0)) {
// Disable Normal Cursor Rendering
unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x4a6c0, disable_cursor_patch);
// Add Custom Cursor Rendering
overwrite_calls((void *) GameRenderer_render, (void *) GameRenderer_render_injection);
}
// Init C++ And Logging // Init C++ And Logging
_init_misc_cpp(); _init_misc_cpp();
_init_misc_logging(); _init_misc_logging();

View File

@ -10,25 +10,6 @@ static int32_t Minecraft_isTouchscreen_injection(__attribute__((unused)) unsigne
return 1; return 1;
} }
// Custom Cursor Rendering
// The Default Behavior For Touch GUI Is To Only Render The Cursor When The Mouse Is Clicking, This Fixes That
static void GameRenderer_render_injection(unsigned char *game_renderer, float param_1) {
// Call Real Method
(*GameRenderer_render)(game_renderer, param_1);
// Render Cursor
unsigned char *minecraft = *(unsigned char **) (game_renderer + GameRenderer_minecraft_property_offset);
unsigned char *current_screen = *(unsigned char **) (minecraft + Minecraft_screen_property_offset);
// Check If Cursor Should Render
if (current_screen != NULL) {
// Get X And Y
float x = (*Mouse_getX)() * (*InvGuiScale);
float y = (*Mouse_getY)() * (*InvGuiScale);
// Render
(*renderCursor)(x, y, minecraft);
}
}
// Init // Init
void init_touch() { void init_touch() {
int touch_gui = feature_has("Touch GUI", 0); int touch_gui = feature_has("Touch GUI", 0);
@ -36,12 +17,6 @@ void init_touch() {
// Main UI // Main UI
overwrite((void *) Minecraft_isTouchscreen, (void *) Minecraft_isTouchscreen_injection); overwrite((void *) Minecraft_isTouchscreen, (void *) Minecraft_isTouchscreen_injection);
// Disable Normal Cursor Rendering
unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
patch((void *) 0x4a6c0, disable_cursor_patch);
// Add Custom Cursor Rendering
overwrite_calls((void *) GameRenderer_render, (void *) GameRenderer_render_injection);
// Force Correct Toolbar Size // Force Correct Toolbar Size
unsigned char toolbar_patch[4] = {0x01, 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" unsigned char toolbar_patch[4] = {0x01, 0x00, 0x50, 0xe3}; // "cmp r0, #0x1"
patch((void *) 0x257b0, toolbar_patch); patch((void *) 0x257b0, toolbar_patch);