Tweak
This commit is contained in:
parent
e837610380
commit
036d0a0653
2
dependencies/symbol-processor/src
vendored
2
dependencies/symbol-processor/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 46c486e56a15334ccc4bd52bcc9ab1bfbcb7d27e
|
Subproject commit 6f792dfb167e48e2e80b8484ac51261ab976b22d
|
@ -15,10 +15,10 @@ void overwrite_call(void *start, void *target);
|
|||||||
// Replace All Calls To Method start With target
|
// 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 *start, void *target, bool allow_no_callsites = false);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void overwrite_calls(T &target, typename T::overwrite_type replacement) {
|
void overwrite_calls(T *target, typename T::overwrite_type replacement) {
|
||||||
DEBUG("Overwriting Method: %s", target.get_name());
|
DEBUG("Overwriting Method: %s", target->get_name());
|
||||||
if (!target.overwrite(replacement)) {
|
if (!target->overwrite(replacement)) {
|
||||||
ERR("Unable To Overwrite Method: %s", target.get_name());
|
ERR("Unable To Overwrite Method: %s", target->get_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +44,9 @@ void patch_address(void *start, void *target);
|
|||||||
// Patch VTable Entry
|
// Patch VTable Entry
|
||||||
// This does not affect subclasses.
|
// This does not affect subclasses.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void patch_vtable(const T &start, typename T::ptr_type target) {
|
void patch_vtable(const T *start, typename T::ptr_type target) {
|
||||||
DEBUG("Patching VTable: %s", start.get_name());
|
DEBUG("Patching VTable: %s", start->get_name());
|
||||||
patch_address((void *) start.get_vtable_addr(), (void *) target);
|
patch_address((void *) start->get_vtable_addr(), (void *) target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -136,7 +136,7 @@ static int BucketItem_getUseDuration(__attribute__((unused)) FoodItem *item, Ite
|
|||||||
|
|
||||||
static ItemInstance BucketItem_useTimeDepleted(FoodItem *item, ItemInstance *item_instance, Level *level, Player *player) {
|
static ItemInstance BucketItem_useTimeDepleted(FoodItem *item, ItemInstance *item_instance, Level *level, Player *player) {
|
||||||
if (item_instance->auxiliary == 1) {
|
if (item_instance->auxiliary == 1) {
|
||||||
*item_instance = FoodItem_useTimeDepleted.get()(item, item_instance, level, player);
|
*item_instance = FoodItem_useTimeDepleted->get()(item, item_instance, level, player);
|
||||||
// Set it to a empty bucket
|
// Set it to a empty bucket
|
||||||
item_instance->auxiliary = 0;
|
item_instance->auxiliary = 0;
|
||||||
item_instance->count = 1;
|
item_instance->count = 1;
|
||||||
@ -154,7 +154,7 @@ static bool BucketItem_isFood(__attribute__((unused)) FoodItem *item) {
|
|||||||
|
|
||||||
static ItemInstance *BucketItem_use(FoodItem *item, ItemInstance *item_instance, __attribute__((unused)) Level *level, Player *player) {
|
static ItemInstance *BucketItem_use(FoodItem *item, ItemInstance *item_instance, __attribute__((unused)) Level *level, Player *player) {
|
||||||
if (item_instance->auxiliary == 1) {
|
if (item_instance->auxiliary == 1) {
|
||||||
return FoodItem_use.get()(item, item_instance, level, player);
|
return FoodItem_use->get()(item, item_instance, level, player);
|
||||||
}
|
}
|
||||||
return item_instance;
|
return item_instance;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ static FoodItem *create_bucket(int32_t id, int32_t texture_x, int32_t texture_y,
|
|||||||
// Construct
|
// Construct
|
||||||
FoodItem *item = new FoodItem;
|
FoodItem *item = new FoodItem;
|
||||||
ALLOC_CHECK(item);
|
ALLOC_CHECK(item);
|
||||||
Item_constructor.get()((Item *) item, id); // FoodItem's Constructor Was Inlined
|
Item_constructor->get()((Item *) item, id); // FoodItem's Constructor Was Inlined
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
item->vtable = get_bucket_vtable();
|
item->vtable = get_bucket_vtable();
|
||||||
|
@ -93,7 +93,7 @@ static void Player_actuallyHurt_injection(Self *player, int32_t damage) {
|
|||||||
int32_t old_health = player->health;
|
int32_t old_health = player->health;
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Mob_actuallyHurt.get()((Mob *) player, damage);
|
Mob_actuallyHurt->get()((Mob *) player, damage);
|
||||||
if (is_hurt) {
|
if (is_hurt) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ void init_death() {
|
|||||||
// Death Messages
|
// Death Messages
|
||||||
if (feature_has("Implement Death Messages", server_auto)) {
|
if (feature_has("Implement Death Messages", server_auto)) {
|
||||||
patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) {
|
patch_vtable(ServerPlayer_die, [](ServerPlayer *player, Entity *cause) {
|
||||||
Player_die_injection<ServerPlayer, Player>(Player_die.get(), player, cause);
|
Player_die_injection<ServerPlayer, Player>(Player_die->get(), player, cause);
|
||||||
});
|
});
|
||||||
overwrite_calls(LocalPlayer_die, Player_die_injection<LocalPlayer, LocalPlayer>);
|
overwrite_calls(LocalPlayer_die, Player_die_injection<LocalPlayer, LocalPlayer>);
|
||||||
patch_vtable(LocalPlayer_actuallyHurt, Player_actuallyHurt_injection);
|
patch_vtable(LocalPlayer_actuallyHurt, Player_actuallyHurt_injection);
|
||||||
|
@ -21,7 +21,7 @@ static void set_is_survival(bool new_is_survival) {
|
|||||||
patch((void *) 0x16ee4, size_patch);
|
patch((void *) 0x16ee4, size_patch);
|
||||||
|
|
||||||
// Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor
|
// Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor
|
||||||
overwrite_call((void *) 0x16ef4, new_is_survival ? (void *) SurvivalMode_constructor.get() : (void *) CreatorMode_constructor.get());
|
overwrite_call((void *) 0x16ef4, new_is_survival ? (void *) SurvivalMode_constructor->get() : (void *) CreatorMode_constructor->get());
|
||||||
|
|
||||||
is_survival = new_is_survival;
|
is_survival = new_is_survival;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ void init_game_mode() {
|
|||||||
overwrite_calls(Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
|
overwrite_calls(Minecraft_setIsCreativeMode, Minecraft_setIsCreativeMode_injection);
|
||||||
|
|
||||||
// Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning)
|
// Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning)
|
||||||
overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor.get());
|
overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor->get());
|
||||||
|
|
||||||
// Allocate Correct Size For ServerLevel
|
// Allocate Correct Size For ServerLevel
|
||||||
uint32_t level_size = sizeof(ServerLevel);
|
uint32_t level_size = sizeof(ServerLevel);
|
||||||
|
@ -90,7 +90,7 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) {
|
|||||||
original(gui);
|
original(gui);
|
||||||
}
|
}
|
||||||
static GuiComponent_blit_t get_blit_with_classic_hud_offset() {
|
static GuiComponent_blit_t get_blit_with_classic_hud_offset() {
|
||||||
return use_classic_hud ? Gui_renderHearts_GuiComponent_blit_hearts_injection : GuiComponent_blit.get();
|
return use_classic_hud ? Gui_renderHearts_GuiComponent_blit_hearts_injection : GuiComponent_blit->get();
|
||||||
}
|
}
|
||||||
#define PINK_HEART_FULL 70
|
#define PINK_HEART_FULL 70
|
||||||
#define PINK_HEART_HALF 79
|
#define PINK_HEART_HALF 79
|
||||||
|
@ -70,7 +70,7 @@ static Screen *last_screen = nullptr;
|
|||||||
static std::string current_splash;
|
static std::string current_splash;
|
||||||
static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) {
|
static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Screen_render.get()(screen, x, y, param_1);
|
Screen_render->get()(screen, x, y, param_1);
|
||||||
|
|
||||||
// Load Splashes
|
// Load Splashes
|
||||||
static std::vector<std::string> splashes;
|
static std::vector<std::string> splashes;
|
||||||
@ -83,28 +83,28 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display Splash
|
// Display Splash
|
||||||
if (splashes.size() > 0) {
|
if (!splashes.empty()) {
|
||||||
// Pick Splash
|
// Pick Splash
|
||||||
if (last_screen != screen) {
|
if (last_screen != screen) {
|
||||||
last_screen = screen;
|
last_screen = screen;
|
||||||
current_splash = splashes[rand() % splashes.size()];
|
current_splash = splashes[rand() % splashes.size()];
|
||||||
}
|
}
|
||||||
// Choose Position
|
// Choose Position
|
||||||
float multiplier = touch_gui ? 0.5f : 1.0f;
|
const float multiplier = touch_gui ? 0.5f : 1.0f;
|
||||||
float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier);
|
const float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier);
|
||||||
float splash_y = 4.0f + (36.0f * multiplier);
|
const float splash_y = 4.0f + (36.0f * multiplier);
|
||||||
float max_width = 86;
|
const float max_width = 86;
|
||||||
float max_scale = 2.0f;
|
const float max_scale = 2.0f;
|
||||||
// Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718)
|
// Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718)
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
// Position
|
// Position
|
||||||
glTranslatef(splash_x, splash_y, 0.0f);
|
glTranslatef(splash_x, splash_y, 0.0f);
|
||||||
glRotatef(-20.0f, 0.0f, 0.0f, 1.0f);
|
glRotatef(-20.0f, 0.0f, 0.0f, 1.0f);
|
||||||
// Scale
|
// Scale
|
||||||
int textWidth = screen->font->width(current_splash);
|
const int textWidth = screen->font->width(current_splash);
|
||||||
float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f;
|
const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f;
|
||||||
float scale = max_scale - Mth::abs(0.1f * Mth::sin(2.0f * float(M_PI) * timeMS));
|
float scale = max_scale - Mth::abs(0.1f * Mth::sin(2.0f * float(M_PI) * timeMS));
|
||||||
float real_text_width = textWidth * max_scale;
|
const float real_text_width = textWidth * max_scale;
|
||||||
if (real_text_width > max_width) {
|
if (real_text_width > max_width) {
|
||||||
scale *= max_width / real_text_width;
|
scale *= max_width / real_text_width;
|
||||||
}
|
}
|
||||||
|
@ -73,10 +73,10 @@ void init_touch() {
|
|||||||
// Force Touch Inventory
|
// Force Touch Inventory
|
||||||
if (feature_has("Force Touch GUI Inventory", server_disabled)) {
|
if (feature_has("Force Touch GUI Inventory", server_disabled)) {
|
||||||
overwrite_call((void *) 0x2943c, (void *) operator_new_IngameBlockSelectionScreen_injection);
|
overwrite_call((void *) 0x2943c, (void *) operator_new_IngameBlockSelectionScreen_injection);
|
||||||
overwrite_call((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen_constructor.get());
|
overwrite_call((void *) 0x29444, (void *) Touch_IngameBlockSelectionScreen_constructor->get());
|
||||||
// Make "Craft" And "Armor" Buttons Use Classic GUI Style (Button And TButton Have The Same Size)
|
// Make "Craft" And "Armor" Buttons Use Classic GUI Style (Button And TButton Have The Same Size)
|
||||||
overwrite_call((void *) 0x3b060, (void *) Button_constructor.get());
|
overwrite_call((void *) 0x3b060, (void *) Button_constructor->get());
|
||||||
overwrite_call((void *) 0x3b08c, (void *) Button_constructor.get());
|
overwrite_call((void *) 0x3b08c, (void *) Button_constructor->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force Touch Button Behavior
|
// Force Touch Button Behavior
|
||||||
|
Loading…
Reference in New Issue
Block a user