From 5b792fbf3a352972655cf65d6fd065896206fd9f Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 19 Oct 2023 01:56:09 -0400 Subject: [PATCH] Add Feature Flag For Custom Skins --- launcher/src/client/available-feature-flags | 1 + mods/src/skin/skin.cpp | 25 ++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index f2232a329..128202c6e 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -48,3 +48,4 @@ FALSE Add Biome Colors To Grass TRUE Generate Caves FALSE Disable Block Tinting TRUE Disable Hostile AI In Creative Mode +TRUE Load Custom Skins diff --git a/mods/src/skin/skin.cpp b/mods/src/skin/skin.cpp index b97026387..a7275adc9 100644 --- a/mods/src/skin/skin.cpp +++ b/mods/src/skin/skin.cpp @@ -2,7 +2,7 @@ #include #include - +#include #include "skin-internal.h" // Base64 Encode (https://gist.github.com/tomykaira/f0fd86b6c73063283afe550bc5d77594) @@ -79,16 +79,19 @@ static int32_t Textures_loadAndBindTexture_injection(unsigned char *textures, __ // Init void init_skin() { - // LocalPlayer - overwrite_call((void *) 0x44c28, (void *) Player_username_assign_injection); - // RemotePlayer - overwrite_call((void *) 0x6ce58, (void *) Player_username_assign_injection_2); - // ServerPlayer - overwrite_call((void *) 0x7639c, (void *) Player_username_assign_injection_2); + // Check Feature Flag + if (feature_has("Load Custom Skins", server_disabled)) { + // LocalPlayer + overwrite_call((void *) 0x44c28, (void *) Player_username_assign_injection); + // RemotePlayer + overwrite_call((void *) 0x6ce58, (void *) Player_username_assign_injection_2); + // ServerPlayer + overwrite_call((void *) 0x7639c, (void *) Player_username_assign_injection_2); - // HUD - overwrite_call((void *) 0x4c6d0, (void *) Textures_loadAndBindTexture_injection); + // HUD + overwrite_call((void *) 0x4c6d0, (void *) Textures_loadAndBindTexture_injection); - // Loader - _init_skin_loader(); + // Loader + _init_skin_loader(); + } }