From ef3292c5e07818d3a4a898a925e67585c1277883 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 22 Nov 2024 03:30:34 -0500 Subject: [PATCH] Change Flag Grouping --- docs/CHANGELOG.md | 6 ++- .../src/util/flags/available-feature-flags | 48 +++++++++++-------- mods/src/input/keys.cpp | 8 +++- mods/src/input/misc.cpp | 19 ++++---- mods/src/options/options.cpp | 2 +- 5 files changed, 51 insertions(+), 32 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3d74886366..fd83604b79 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -52,6 +52,7 @@ * `Increase Render Chunk Size` (Enabled By Default) * `Proper Entity Shading` (Enabled By Default) * `Fix Sugar Position In Hand` (Enabled By Default) + * `Fix Reloading Textures On Resize` (Enabled By Default) * Existing Functionality (All Enabled By Default) * `Fix Screen Rendering When Hiding HUD` * `Sanitize Usernames` @@ -73,13 +74,16 @@ * `Enable Text Input` * `Update Default Options` * `Fix options.txt Loading/Saving` - * `Fix Reloading Textures On Resize` + * `Extend Supported Keycodes` * Split Up `Remove Creative Mode Restrictions` Feature Flag * `Remove Creative Mode Restrictions` (Disabled By Default) * `Display Slot Count In Creative Mode` (Disabled By Default) * `Force Survival Mode Inventory UI` (Disabled By Default) * `Force Survival Mode Inventory Behavior` (Disabled By Default) * `Maximize Creative Mode Inventory Stack Size` (Disabled By Default) +* Split Up `Miscellaneous Input Fixes` Feature Flag + * `Fix Escape Key Handling` (Enabled By Default) + * `Stop Locked Mouse From Interacting With HUD` (Enabled By Default) * Rename Feature Flags * `Disable Buggy Held Item Caching` To `Fix Held Item Caching` * `Disable 'gui_blocks' Atlas` To `Regenerate "gui_blocks" Atlas` diff --git a/libreborn/src/util/flags/available-feature-flags b/libreborn/src/util/flags/available-feature-flags index d6de6bd5ee..2a9233b97a 100644 --- a/libreborn/src/util/flags/available-feature-flags +++ b/libreborn/src/util/flags/available-feature-flags @@ -76,16 +76,14 @@ CATEGORY Textures TRUE Animated Lava TRUE Animated Fire CATEGORY Input - TRUE Fix Bow & Arrow - TRUE Fix Attacking TRUE Disable Autojump By Default - TRUE Miscellaneous Input Fixes TRUE Bind "Q" Key To Item Dropping TRUE Bind Common Toggleable Options To Function Keys FALSE Disable Raw Mouse Motion (Not Recommended) FALSE Disable Speed Bridging FALSE Disable Creative Mode Mining Delay TRUE Enable Text Input + TRUE Extend Supported Keycodes CATEGORY Multiplayer CATEGORY Chat TRUE Implement Chat @@ -105,25 +103,33 @@ CATEGORY Gameplay TRUE Implement Sound Engine TRUE Generate Caves CATEGORY Bug Fixes - TRUE Fix Furnace Not Checking Item Auxiliary - TRUE Fix Held Item Caching - TRUE Fix Pigmen Burning In The Sun - TRUE Fix Carried Grass's Bottom Texture - TRUE Fix Screen Rendering When Hiding HUD - TRUE Fix Door Duplication - TRUE Fix Cobweb Lighting - TRUE Fix Sneaking Syncing - TRUE Fix Fire Immunity - TRUE Fix Fire Syncing - TRUE Fix Sunlight Not Properly Setting Mobs On Fire - TRUE Patch RakNet Security Bug - TRUE Prevent Unnecessary Server Pinging - TRUE Fix Furnace Screen Visual Bug - TRUE Fix Text Wrapping - TRUE Fix Transferring Durability When Using Items - TRUE Fix Switching Perspective While Sneaking + CATEGORY Visual + TRUE Fix Held Item Caching + TRUE Fix Cobweb Lighting + TRUE Fix Furnace Screen Visual Bug + TRUE Fix Text Wrapping + TRUE Fix Carried Grass's Bottom Texture + TRUE Fix Screen Rendering When Hiding HUD + TRUE Fix Sugar Position In Hand + TRUE Fix Switching Perspective While Sneaking + CATEGORY Network + TRUE Patch RakNet Security Bug + TRUE Prevent Unnecessary Server Pinging + TRUE Fix Fire Syncing + TRUE Fix Sneaking Syncing + CATEGORY Input + TRUE Fix Bow & Arrow + TRUE Fix Attacking + TRUE Fix Escape Key Handling + TRUE Stop Locked Mouse From Interacting With HUD + CATEGORY Gameplay + TRUE Fix Furnace Not Checking Item Auxiliary + TRUE Fix Pigmen Burning In The Sun + TRUE Fix Door Duplication + TRUE Fix Fire Immunity + TRUE Fix Sunlight Not Properly Setting Mobs On Fire + TRUE Fix Transferring Durability When Using Items TRUE Fix Crash When Generating Certain Seeds - TRUE Fix Sugar Position In Hand TRUE Fix Reloading Textures On Resize TRUE Fix options.txt Loading/Saving CATEGORY Logging diff --git a/mods/src/input/keys.cpp b/mods/src/input/keys.cpp index dd4106838a..c2cd9d193f 100644 --- a/mods/src/input/keys.cpp +++ b/mods/src/input/keys.cpp @@ -1,6 +1,10 @@ #include +#include + #include + #include + #include #include "input-internal.h" @@ -20,5 +24,7 @@ static int32_t sdl_key_to_minecraft_key_injection(Common_sdl_key_to_minecraft_ke // Init void _init_keys() { - overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection); + if (feature_has("Extend Supported Keycodes", server_disabled)) { + overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection); + } } \ No newline at end of file diff --git a/mods/src/input/misc.cpp b/mods/src/input/misc.cpp index b6638e8f1a..6efddfe8e1 100644 --- a/mods/src/input/misc.cpp +++ b/mods/src/input/misc.cpp @@ -66,14 +66,8 @@ static void Gui_handleClick_injection(Gui_handleClick_t original, Gui *gui, cons // Init void _init_misc() { - if (feature_has("Miscellaneous Input Fixes", server_disabled)) { - // Fix OptionsScreen Ignoring The Back Button - patch_vtable(OptionsScreen_handleBackEvent, OptionsScreen_handleBackEvent_injection); - // Fix "Sleeping Beauty" Bug - patch_vtable(InBedScreen_handleBackEvent, InBedScreen_handleBackEvent_injection); - // Disable Opening Inventory Using The Cursor When Cursor Is Hidden - overwrite_calls(Gui_handleClick, Gui_handleClick_injection); - // Proper Back Button Handling + // Proper Back Button Handling + if (feature_has("Fix Escape Key Handling", server_disabled)) { misc_run_on_key_press([](Minecraft *mc, const int key) { if (key == MC_KEY_ESCAPE) { _handle_back(mc); @@ -82,6 +76,15 @@ void _init_misc() { return false; } }); + // Fix OptionsScreen Ignoring The Back Button + patch_vtable(OptionsScreen_handleBackEvent, OptionsScreen_handleBackEvent_injection); + // Fix "Sleeping Beauty" Bug (https://discord.com/channels/740287937727561779/761048906242981948/1164426402318270474) + patch_vtable(InBedScreen_handleBackEvent, InBedScreen_handleBackEvent_injection); + } + // Fix UI When Mouse Is Locked + if (feature_has("Stop Locked Mouse From Interacting With HUD", server_disabled)) { + // 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); } diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp index 683a7c538c..667803b8a7 100644 --- a/mods/src/options/options.cpp +++ b/mods/src/options/options.cpp @@ -210,7 +210,7 @@ void init_options() { overwrite_calls(TileRenderer_tesselateBlockInWorld, TileRenderer_tesselateBlockInWorld_injection); // options.txt - if (feature_has("Fix options.txt Loading/Saving", server_disabled)) { + if (feature_has("Fix options.txt Loading/Saving", server_enabled)) { // Actually Save options.txt overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection); // Fix options.txt Path