Add 3D Anaglyph To In-Game Options

This commit is contained in:
TheBrokenRail 2022-09-21 18:40:09 -04:00
parent 6994671c6d
commit 6378a18494
4 changed files with 26 additions and 13 deletions

View File

@ -11,7 +11,6 @@ FALSE Remove Creative Mode Restrictions
TRUE Animated Water TRUE Animated Water
TRUE Remove Invalid Item Background TRUE Remove Invalid Item Background
TRUE Disable "gui_blocks" Atlas TRUE Disable "gui_blocks" Atlas
FALSE 3D Anaglyph
TRUE Fix Camera Rendering TRUE Fix Camera Rendering
TRUE Implement Chat TRUE Implement Chat
FALSE Hide Chat Messages FALSE Hide Chat Messages

View File

@ -44,7 +44,6 @@ __attribute__((destructor)) static void _free_safe_username() {
free(safe_username); free(safe_username);
} }
static int anaglyph;
static int render_distance; static int render_distance;
// Configure Options // Configure Options
unsigned char *stored_options = NULL; unsigned char *stored_options = NULL;
@ -68,8 +67,6 @@ static void Minecraft_init_injection(unsigned char *minecraft) {
unsigned char *options = minecraft + Minecraft_options_property_offset; unsigned char *options = minecraft + Minecraft_options_property_offset;
// Enable Crosshair In Touch GUI // Enable Crosshair In Touch GUI
*(options + Options_split_controls_property_offset) = 1; *(options + Options_split_controls_property_offset) = 1;
// 3D Anaglyph
*(options + Options_3d_anaglyph_property_offset) = anaglyph;
// Render Distance // Render Distance
*(int32_t *) (options + Options_render_distance_property_offset) = render_distance; *(int32_t *) (options + Options_render_distance_property_offset) = render_distance;
} }
@ -90,8 +87,6 @@ void init_options() {
overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection); overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection);
} }
// 3D Anaglyph
anaglyph = feature_has("3D Anaglyph", server_disabled);
// Render Distance // Render Distance
render_distance = get_render_distance(); render_distance = get_render_distance();
DEBUG("Setting Render Distance: %i", render_distance); DEBUG("Setting Render Distance: %i", render_distance);

View File

@ -33,6 +33,9 @@ static void Options_save_Options_addOptionToSaveOutput_injection(unsigned char *
// Save Fancy Graphics // Save Fancy Graphics
(*Options_addOptionToSaveOutput)(options, data, "gfx_fancygraphics", *(options + Options_fancy_graphics_property_offset)); (*Options_addOptionToSaveOutput)(options, data, "gfx_fancygraphics", *(options + Options_fancy_graphics_property_offset));
// Save 3D Anaglyph
(*Options_addOptionToSaveOutput)(options, data, "gfx_anaglyph", *(options + Options_3d_anaglyph_property_offset));
// Save File // Save File
unsigned char *options_file = options + Options_options_file_property_offset; unsigned char *options_file = options + Options_options_file_property_offset;
(*OptionsFile_save)(options_file, data); (*OptionsFile_save)(options_file, data);
@ -117,6 +120,11 @@ static void OptionsPane_unknown_toggle_creating_function_injection(unsigned char
// Call Original Method // Call Original Method
(*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, new_name, option); (*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, new_name, option);
// Add 3D Anaglyph
if (option == Options_Option_GRAPHICS) {
(*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, "3D Anaglyph", Options_Option_ANAGLYPH);
}
} }
// Add Missing Options To Options::getBooleanValue // Add Missing Options To Options::getBooleanValue
@ -213,18 +221,27 @@ void _init_options_cpp() {
// Replace "feedback_vibration" Loading/Saving With "gfx_ao" // Replace "feedback_vibration" Loading/Saving With "gfx_ao"
{ {
// Replace String // Replace String
static const char *new_feedback_vibration_options_txt_nam = "gfx_ao"; static const char *new_feedback_vibration_options_txt_name = "gfx_ao";
patch_address((void *) feedback_vibration_options_txt_name_1, (void *) &new_feedback_vibration_options_txt_nam); patch_address((void *) feedback_vibration_options_txt_name_1, (void *) &new_feedback_vibration_options_txt_name);
patch_address((void *) feedback_vibration_options_txt_name_2, (void *) &new_feedback_vibration_options_txt_nam); patch_address((void *) feedback_vibration_options_txt_name_2, (void *) &new_feedback_vibration_options_txt_name);
// Loading // Loading
unsigned char gfx_ao_loading_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x10, 0x84, 0xe2}; // "add param_2, r4, #OFFSET" unsigned char gfx_ao_loading_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
patch((void *) 0x193b8, gfx_ao_loading_patch); patch((void *) 0x193b8, gfx_ao_loading_patch);
// Saving // Saving
unsigned char gfx_ao_saving_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x30, 0xd4, 0xe5}; // "ldrb r3, [r4, #OFFSET]" unsigned char gfx_ao_saving_patch[4] = {(unsigned char) Options_ambient_occlusion_property_offset, 0x30, 0xd4, 0xe5}; // "ldrb r3, [r4, #OFFSET]"
patch((void *) 0x197f8, gfx_ao_saving_patch); patch((void *) 0x197f8, gfx_ao_saving_patch);
} }
// Disable "gfx_lowquality" Loading // Replace "gfx_lowquality" Loading With "gfx_anaglyph"
{
// Replace String
static const char *new_gfx_lowquality_options_txt_name = "gfx_anaglyph";
patch_address((void *) gfx_lowquality_options_txt_name, (void *) &new_gfx_lowquality_options_txt_name);
// Loading
unsigned char gfx_anaglyph_loading_patch[4] = {(unsigned char) Options_3d_anaglyph_property_offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
patch((void *) 0x19400, gfx_anaglyph_loading_patch);
// Disable Loading Side Effects
patch((void *) 0x19414, nop_patch); patch((void *) 0x19414, nop_patch);
patch((void *) 0x1941c, nop_patch); patch((void *) 0x1941c, nop_patch);
}
} }

View File

@ -31,6 +31,7 @@ static char **options_txt_path = (char **) 0x19bc8; // options.txt
static char **options_txt_fopen_mode_when_loading = (char **) 0x19d24; // w static char **options_txt_fopen_mode_when_loading = (char **) 0x19d24; // w
static char ***feedback_vibration_options_txt_name_1 = (char ***) 0x198a0; // feedback_vibration static char ***feedback_vibration_options_txt_name_1 = (char ***) 0x198a0; // feedback_vibration
static char ***feedback_vibration_options_txt_name_2 = (char ***) 0x194bc; // feedback_vibration static char ***feedback_vibration_options_txt_name_2 = (char ***) 0x194bc; // feedback_vibration
static char ***gfx_lowquality_options_txt_name = (char ***) 0x194c4; // gfx_lowquality
static unsigned char **Material_stone = (unsigned char **) 0x180a9c; // Material static unsigned char **Material_stone = (unsigned char **) 0x180a9c; // Material
@ -68,6 +69,7 @@ static float *InvGuiScale = (float *) 0x135d98;
static unsigned char *Options_Option_GRAPHICS = (unsigned char *) 0x136c2c; // Option static unsigned char *Options_Option_GRAPHICS = (unsigned char *) 0x136c2c; // Option
static unsigned char *Options_Option_AMBIENT_OCCLUSION = (unsigned char *) 0x136c38; // Option static unsigned char *Options_Option_AMBIENT_OCCLUSION = (unsigned char *) 0x136c38; // Option
static unsigned char *Options_Option_ANAGLYPH = (unsigned char *) 0x136c08; // Option
static bool *Minecraft_useAmbientOcclusion = (bool *) 0x136b90; static bool *Minecraft_useAmbientOcclusion = (bool *) 0x136b90;