Better Static Properties
This commit is contained in:
parent
b23f7f1618
commit
97bc124d72
2
dependencies/symbol-processor/src
vendored
2
dependencies/symbol-processor/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 603010e3cce7a7cce90b87da43e4c918047d14a2
|
Subproject commit fbb9b6d6da1a9dfa9290d420d1b2c34f91026111
|
@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled
|
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled
|
||||||
static void ItemRenderer_renderGuiItemCorrect_injection(ItemRenderer_renderGuiItemCorrect_t original, Font *font, Textures *textures, ItemInstance *item_instance, int32_t param_1, int32_t param_2) {
|
static void ItemRenderer_renderGuiItemCorrect_injection(ItemRenderer_renderGuiItemCorrect_t original, Font *font, Textures *textures, ItemInstance *item_instance, int32_t param_1, int32_t param_2) {
|
||||||
int32_t leaves_id = Tile_leaves->id;
|
int32_t leaves_id = Tile::leaves->id;
|
||||||
int32_t grass_id = Tile_grass->id;
|
int32_t grass_id = Tile::grass->id;
|
||||||
// Replace Rendered Item With Carried Variant
|
// Replace Rendered Item With Carried Variant
|
||||||
ItemInstance carried_item_instance;
|
ItemInstance carried_item_instance;
|
||||||
bool use_carried = false;
|
bool use_carried = false;
|
||||||
if (item_instance != nullptr) {
|
if (item_instance != nullptr) {
|
||||||
if (item_instance->id == leaves_id) {
|
if (item_instance->id == leaves_id) {
|
||||||
carried_item_instance.constructor_tile_extra(Tile_leaves_carried, item_instance->count, item_instance->auxiliary);
|
carried_item_instance.constructor_tile_extra(Tile::leaves_carried, item_instance->count, item_instance->auxiliary);
|
||||||
use_carried = true;
|
use_carried = true;
|
||||||
} else if (item_instance->id == grass_id) {
|
} else if (item_instance->id == grass_id) {
|
||||||
carried_item_instance.constructor_tile_extra(Tile_grass_carried, item_instance->count, item_instance->auxiliary);
|
carried_item_instance.constructor_tile_extra(Tile::grass_carried, item_instance->count, item_instance->auxiliary);
|
||||||
use_carried = true;
|
use_carried = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ static FoodItem *bucket = nullptr;
|
|||||||
|
|
||||||
// Description And Texture
|
// Description And Texture
|
||||||
static std::string BucketItem_getDescriptionId(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance) {
|
static std::string BucketItem_getDescriptionId(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance) {
|
||||||
if (item_instance->auxiliary == Tile_water->id) {
|
if (item_instance->auxiliary == Tile::water->id) {
|
||||||
return "item.bucketWater";
|
return "item.bucketWater";
|
||||||
} else if (item_instance->auxiliary == Tile_lava->id) {
|
} else if (item_instance->auxiliary == Tile::lava->id) {
|
||||||
return "item.bucketLava";
|
return "item.bucketLava";
|
||||||
} else if (item_instance->auxiliary == 1) {
|
} else if (item_instance->auxiliary == 1) {
|
||||||
return "item.bucketMilk";
|
return "item.bucketMilk";
|
||||||
@ -22,9 +22,9 @@ static std::string BucketItem_getDescriptionId(__attribute__((unused)) FoodItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_t auxiliary) {
|
static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_t auxiliary) {
|
||||||
if (auxiliary == Tile_water->id) {
|
if (auxiliary == Tile::water->id) {
|
||||||
return 75;
|
return 75;
|
||||||
} else if (auxiliary == Tile_lava->id) {
|
} else if (auxiliary == Tile::lava->id) {
|
||||||
return 76;
|
return 76;
|
||||||
} else if (auxiliary == 1) {
|
} else if (auxiliary == 1) {
|
||||||
return 77;
|
return 77;
|
||||||
@ -63,10 +63,10 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
|||||||
// Empty Bucket
|
// Empty Bucket
|
||||||
int32_t new_auxiliary = 0;
|
int32_t new_auxiliary = 0;
|
||||||
int32_t tile = level->getTile(x, y, z);
|
int32_t tile = level->getTile(x, y, z);
|
||||||
if (tile == Tile_calmWater->id) {
|
if (tile == Tile::calmWater->id) {
|
||||||
new_auxiliary = Tile_water->id;
|
new_auxiliary = Tile::water->id;
|
||||||
} else if (tile == Tile_calmLava->id) {
|
} else if (tile == Tile::calmLava->id) {
|
||||||
new_auxiliary = Tile_lava->id;
|
new_auxiliary = Tile::lava->id;
|
||||||
}
|
}
|
||||||
if (new_auxiliary != 0) {
|
if (new_auxiliary != 0) {
|
||||||
// Valid
|
// Valid
|
||||||
@ -114,7 +114,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
|||||||
if (material != nullptr) {
|
if (material != nullptr) {
|
||||||
valid = !material->isSolid();
|
valid = !material->isSolid();
|
||||||
}
|
}
|
||||||
if (item_instance->auxiliary != Tile_water->id && item_instance->auxiliary != Tile_lava->id) {
|
if (item_instance->auxiliary != Tile::water->id && item_instance->auxiliary != Tile::lava->id) {
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@ -242,8 +242,8 @@ static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int3
|
|||||||
}
|
}
|
||||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
||||||
inventory_add_item(filling_container, bucket, 0);
|
inventory_add_item(filling_container, bucket, 0);
|
||||||
inventory_add_item(filling_container, bucket, Tile_water->id);
|
inventory_add_item(filling_container, bucket, Tile::water->id);
|
||||||
inventory_add_item(filling_container, bucket, Tile_lava->id);
|
inventory_add_item(filling_container, bucket, Tile::lava->id);
|
||||||
inventory_add_item(filling_container, bucket, 1);
|
inventory_add_item(filling_container, bucket, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,9 +269,9 @@ static void handle_tick(Minecraft *minecraft) {
|
|||||||
|
|
||||||
// Prevent Breaking Liquid
|
// Prevent Breaking Liquid
|
||||||
static bool is_calm_liquid(int32_t id) {
|
static bool is_calm_liquid(int32_t id) {
|
||||||
if (id == Tile_calmWater->id) {
|
if (id == Tile::calmWater->id) {
|
||||||
return true;
|
return true;
|
||||||
} else if (id == Tile_calmLava->id) {
|
} else if (id == Tile::calmLava->id) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -320,7 +320,7 @@ static void Recipes_injection(Recipes *recipes) {
|
|||||||
|
|
||||||
// Custom Furnace Fuel
|
// Custom Furnace Fuel
|
||||||
static int32_t FurnaceTileEntity_getBurnDuration_injection(FurnaceTileEntity_getBurnDuration_t original, ItemInstance *item_instance) {
|
static int32_t FurnaceTileEntity_getBurnDuration_injection(FurnaceTileEntity_getBurnDuration_t original, ItemInstance *item_instance) {
|
||||||
if (item_instance->count > 0 && item_instance->id == bucket->id && item_instance->auxiliary == Tile_lava->id) {
|
if (item_instance->count > 0 && item_instance->id == bucket->id && item_instance->auxiliary == Tile::lava->id) {
|
||||||
return 20000;
|
return 20000;
|
||||||
} else {
|
} else {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
@ -341,7 +341,7 @@ static void FurnaceTileEntity_tick_ItemInstance_setNull_injection(ItemInstance *
|
|||||||
|
|
||||||
// Add the bucket name to the language file
|
// Add the bucket name to the language file
|
||||||
static void Language_injection(__attribute__((unused)) void *null) {
|
static void Language_injection(__attribute__((unused)) void *null) {
|
||||||
I18n__strings.insert(std::make_pair("item.bucketMilk.name", "Milk Bucket"));
|
I18n::_strings.insert(std::make_pair("item.bucketMilk.name", "Milk Bucket"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
|
@ -119,7 +119,7 @@ static void make_cake() {
|
|||||||
cake = new Tile;
|
cake = new Tile;
|
||||||
ALLOC_CHECK(cake);
|
ALLOC_CHECK(cake);
|
||||||
int texture = 122;
|
int texture = 122;
|
||||||
cake->constructor(92, texture, Material_dirt);
|
cake->constructor(92, texture, Material::dirt);
|
||||||
cake->texture = texture;
|
cake->texture = texture;
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
|
@ -52,7 +52,7 @@ void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) {
|
|||||||
// Hosting Multiplayer
|
// Hosting Multiplayer
|
||||||
const char *message = packet->message.c_str();
|
const char *message = packet->message.c_str();
|
||||||
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler;
|
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler;
|
||||||
chat_send_message(server_side_network_handler, Strings_default_username, (char *) message);
|
chat_send_message(server_side_network_handler, Strings::default_username, (char *) message);
|
||||||
} else {
|
} else {
|
||||||
// Client
|
// Client
|
||||||
rak_net_instance->send((Packet *) packet);
|
rak_net_instance->send((Packet *) packet);
|
||||||
|
@ -34,7 +34,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
|||||||
local_history = get_history();
|
local_history = get_history();
|
||||||
local_history.push_back("");
|
local_history.push_back("");
|
||||||
// Determine Max Length
|
// Determine Max Length
|
||||||
std::string prefix = _chat_get_prefix(Strings_default_username);
|
std::string prefix = _chat_get_prefix(Strings::default_username);
|
||||||
int max_length = MAX_CHAT_MESSAGE_LENGTH - prefix.length();
|
int max_length = MAX_CHAT_MESSAGE_LENGTH - prefix.length();
|
||||||
self->chat->setMaxLength(max_length);
|
self->chat->setMaxLength(max_length);
|
||||||
// Send Button
|
// Send Button
|
||||||
|
@ -24,10 +24,10 @@ static void inventory_add_item(FillingContainer *inventory, Tile *item) {
|
|||||||
// Expand Creative Inventory
|
// Expand Creative Inventory
|
||||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
||||||
// Add Items
|
// Add Items
|
||||||
inventory_add_item(filling_container, Item_flintAndSteel);
|
inventory_add_item(filling_container, Item::flintAndSteel);
|
||||||
inventory_add_item(filling_container, Item_snowball);
|
inventory_add_item(filling_container, Item::snowball);
|
||||||
inventory_add_item(filling_container, Item_egg);
|
inventory_add_item(filling_container, Item::egg);
|
||||||
inventory_add_item(filling_container, Item_shears);
|
inventory_add_item(filling_container, Item::shears);
|
||||||
// Dyes
|
// Dyes
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (i == 15) {
|
if (i == 15) {
|
||||||
@ -36,23 +36,23 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
}
|
}
|
||||||
ItemInstance *new_item_instance = new ItemInstance;
|
ItemInstance *new_item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(new_item_instance);
|
ALLOC_CHECK(new_item_instance);
|
||||||
new_item_instance = new_item_instance->constructor_item_extra(Item_dye_powder, 1, i);
|
new_item_instance = new_item_instance->constructor_item_extra(Item::dye_powder, 1, i);
|
||||||
filling_container->addItem(new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
inventory_add_item(filling_container, Item_camera);
|
inventory_add_item(filling_container, Item::camera);
|
||||||
// Add Tiles
|
// Add Tiles
|
||||||
inventory_add_item(filling_container, Tile_water);
|
inventory_add_item(filling_container, Tile::water);
|
||||||
inventory_add_item(filling_container, Tile_lava);
|
inventory_add_item(filling_container, Tile::lava);
|
||||||
inventory_add_item(filling_container, Tile_calmWater);
|
inventory_add_item(filling_container, Tile::calmWater);
|
||||||
inventory_add_item(filling_container, Tile_calmLava);
|
inventory_add_item(filling_container, Tile::calmLava);
|
||||||
inventory_add_item(filling_container, Tile_glowingObsidian);
|
inventory_add_item(filling_container, Tile::glowingObsidian);
|
||||||
inventory_add_item(filling_container, Tile_web);
|
inventory_add_item(filling_container, Tile::web);
|
||||||
inventory_add_item(filling_container, Tile_topSnow);
|
inventory_add_item(filling_container, Tile::topSnow);
|
||||||
inventory_add_item(filling_container, Tile_ice);
|
inventory_add_item(filling_container, Tile::ice);
|
||||||
inventory_add_item(filling_container, Tile_invisible_bedrock);
|
inventory_add_item(filling_container, Tile::invisible_bedrock);
|
||||||
inventory_add_item(filling_container, Tile_bedrock);
|
inventory_add_item(filling_container, Tile::bedrock);
|
||||||
inventory_add_item(filling_container, Tile_info_updateGame1);
|
inventory_add_item(filling_container, Tile::info_updateGame1);
|
||||||
inventory_add_item(filling_container, Tile_info_updateGame2);
|
inventory_add_item(filling_container, Tile::info_updateGame2);
|
||||||
// Nether Reactor
|
// Nether Reactor
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@ -61,7 +61,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
}
|
}
|
||||||
ItemInstance *new_item_instance = new ItemInstance;
|
ItemInstance *new_item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(new_item_instance);
|
ALLOC_CHECK(new_item_instance);
|
||||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_netherReactor, 1, i);
|
new_item_instance = new_item_instance->constructor_tile_extra(Tile::netherReactor, 1, i);
|
||||||
filling_container->addItem(new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
// Tall Grass
|
// Tall Grass
|
||||||
@ -72,14 +72,14 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
}
|
}
|
||||||
ItemInstance *new_item_instance = new ItemInstance;
|
ItemInstance *new_item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(new_item_instance);
|
ALLOC_CHECK(new_item_instance);
|
||||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_tallgrass, 1, i);
|
new_item_instance = new_item_instance->constructor_tile_extra(Tile::tallgrass, 1, i);
|
||||||
filling_container->addItem(new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
// Smooth Stone Slab
|
// Smooth Stone Slab
|
||||||
{
|
{
|
||||||
ItemInstance *new_item_instance = new ItemInstance;
|
ItemInstance *new_item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(new_item_instance);
|
ALLOC_CHECK(new_item_instance);
|
||||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_stoneSlab, 1, 6);
|
new_item_instance = new_item_instance->constructor_tile_extra(Tile::stoneSlab, 1, 6);
|
||||||
filling_container->addItem(new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ static TileItem *Tile_initTiles_TileItem_injection(TileItem *tile_item, int32_t
|
|||||||
// Configure Item
|
// Configure Item
|
||||||
tile_item->is_stacked_by_data = true;
|
tile_item->is_stacked_by_data = true;
|
||||||
tile_item->max_damage = 0;
|
tile_item->max_damage = 0;
|
||||||
((AuxDataTileItem *) tile_item)->icon_tile = Tile_tiles[id + 0x100];
|
((AuxDataTileItem *) tile_item)->icon_tile = Tile::tiles[id + 0x100];
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return tile_item;
|
return tile_item;
|
||||||
@ -119,7 +119,7 @@ void init_creative() {
|
|||||||
// Inventory can have arbitrary auxiliary values.
|
// Inventory can have arbitrary auxiliary values.
|
||||||
{
|
{
|
||||||
// Fix Size
|
// Fix Size
|
||||||
unsigned char size_patch[4] = {AUX_DATA_TILE_ITEM_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #AUX_DATA_TILE_ITEM_SIZE"
|
unsigned char size_patch[4] = {sizeof(AuxDataTileItem), 0x00, 0xa0, 0xe3}; // "mov r0, #AUX_DATA_TILE_ITEM_SIZE"
|
||||||
patch((void *) 0xc6f64, size_patch);
|
patch((void *) 0xc6f64, size_patch);
|
||||||
// Hook Constructor
|
// Hook Constructor
|
||||||
overwrite_call((void *) 0xc6f74, (void *) Tile_initTiles_TileItem_injection);
|
overwrite_call((void *) 0xc6f74, (void *) Tile_initTiles_TileItem_injection);
|
||||||
|
@ -17,7 +17,7 @@ static void set_is_survival(bool new_is_survival) {
|
|||||||
patch((void *) 0x16efc, inventory_patch);
|
patch((void *) 0x16efc, inventory_patch);
|
||||||
|
|
||||||
// Use Correct Size For GameMode Object
|
// Use Correct Size For GameMode Object
|
||||||
unsigned char size_patch[4] = {(unsigned char) (new_is_survival ? SURVIVAL_MODE_SIZE : CREATOR_MODE_SIZE), 0x00, 0xa0, 0xe3}; // "mov r0, #SURVIVAL_MODE_SIZE" or "mov r0, #CREATOR_MODE_SIZE"
|
unsigned char size_patch[4] = {(unsigned char) (new_is_survival ? sizeof(SurvivalMode) : sizeof(CreatorMode)), 0x00, 0xa0, 0xe3}; // "mov r0, #SURVIVAL_MODE_SIZE" or "mov r0, #CREATOR_MODE_SIZE"
|
||||||
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
|
||||||
@ -57,7 +57,7 @@ void init_game_mode() {
|
|||||||
overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor);
|
overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor);
|
||||||
|
|
||||||
// Allocate Correct Size For ServerLevel
|
// Allocate Correct Size For ServerLevel
|
||||||
uint32_t level_size = SERVER_LEVEL_SIZE;
|
uint32_t level_size = sizeof(ServerLevel);
|
||||||
patch_address((void *) 0x17004, (void *) level_size);
|
patch_address((void *) 0x17004, (void *) level_size);
|
||||||
|
|
||||||
// Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing
|
// Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing
|
||||||
|
@ -88,7 +88,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
|||||||
// Game Mode Description
|
// Game Mode Description
|
||||||
CreateWorldScreen *self = (CreateWorldScreen *) super;
|
CreateWorldScreen *self = (CreateWorldScreen *) super;
|
||||||
bool is_creative = self->game_mode->text == CREATIVE_STR;
|
bool is_creative = self->game_mode->text == CREATIVE_STR;
|
||||||
std::string description = is_creative ? Strings_creative_mode_description : Strings_survival_mode_description;
|
std::string description = is_creative ? Strings::creative_mode_description : Strings::survival_mode_description;
|
||||||
super->drawString(super->font, &description, self->game_mode->x, self->game_mode->y + self->game_mode->height + description_padding, 0xa0a0a0);
|
super->drawString(super->font, &description, self->game_mode->x, self->game_mode->y + self->game_mode->height + description_padding, 0xa0a0a0);
|
||||||
};
|
};
|
||||||
// Positioning
|
// Positioning
|
||||||
|
@ -24,7 +24,7 @@ __attribute__((destructor)) static void _free_home() {
|
|||||||
// Init
|
// Init
|
||||||
void init_home() {
|
void init_home() {
|
||||||
// Store Data In ~/.minecraft-pi Instead Of ~/.minecraft
|
// Store Data In ~/.minecraft-pi Instead Of ~/.minecraft
|
||||||
patch_address((void *) Strings_default_path_pointer, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA);
|
patch_address((void *) &Strings::default_path, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA);
|
||||||
|
|
||||||
// The override code resolves assets manually,
|
// The override code resolves assets manually,
|
||||||
// making changing directory redundant.
|
// making changing directory redundant.
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include <libreborn/libreborn.h>
|
#include <libreborn/libreborn.h>
|
||||||
#include <mods/init/init.h>
|
#include <mods/init/init.h>
|
||||||
#include <media-layer/core.h>
|
#include <media-layer/core.h>
|
||||||
#include <symbols/minecraft.h>
|
|
||||||
|
|
||||||
__attribute__((constructor)) static void init() {
|
__attribute__((constructor)) static void init() {
|
||||||
media_ensure_loaded();
|
media_ensure_loaded();
|
||||||
reborn_init_patch();
|
reborn_init_patch();
|
||||||
run_tests();
|
run_tests();
|
||||||
init_symbols();
|
|
||||||
init_version();
|
init_version();
|
||||||
init_compat();
|
init_compat();
|
||||||
#ifdef MCPI_SERVER_MODE
|
#ifdef MCPI_SERVER_MODE
|
||||||
|
@ -150,7 +150,7 @@ void misc_render_background(int color, Minecraft *minecraft, int x, int y, int w
|
|||||||
#endif
|
#endif
|
||||||
std::string texture = "gui/background.png";
|
std::string texture = "gui/background.png";
|
||||||
minecraft->textures->loadAndBindTexture(&texture);
|
minecraft->textures->loadAndBindTexture(&texture);
|
||||||
Tesselator *t = &Tesselator_instance;
|
Tesselator *t = &Tesselator::instance;
|
||||||
t->begin(7);
|
t->begin(7);
|
||||||
t->color(color, color, color, 255);
|
t->color(color, color, color, 255);
|
||||||
float x1 = x;
|
float x1 = x;
|
||||||
|
@ -37,8 +37,8 @@ static int use_classic_hud = 0;
|
|||||||
static void Gui_renderHearts_GuiComponent_blit_hearts_injection(GuiComponent *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
static void Gui_renderHearts_GuiComponent_blit_hearts_injection(GuiComponent *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
||||||
Minecraft *minecraft = ((Gui *) component)->minecraft;
|
Minecraft *minecraft = ((Gui *) component)->minecraft;
|
||||||
x_dest -= DEFAULT_HUD_PADDING;
|
x_dest -= DEFAULT_HUD_PADDING;
|
||||||
float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
|
float width = ((float) minecraft->screen_width) * Gui::InvGuiScale;
|
||||||
float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
|
float height = ((float) minecraft->screen_height) * Gui::InvGuiScale;
|
||||||
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
|
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
|
||||||
y_dest -= DEFAULT_HUD_PADDING;
|
y_dest -= DEFAULT_HUD_PADDING;
|
||||||
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
|
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
|
||||||
@ -48,8 +48,8 @@ static void Gui_renderHearts_GuiComponent_blit_hearts_injection(GuiComponent *co
|
|||||||
static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
||||||
Minecraft *minecraft = component->minecraft;
|
Minecraft *minecraft = component->minecraft;
|
||||||
x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH;
|
x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH;
|
||||||
float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
|
float width = ((float) minecraft->screen_width) * Gui::InvGuiScale;
|
||||||
float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
|
float height = ((float) minecraft->screen_height) * Gui::InvGuiScale;
|
||||||
x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH;
|
x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH;
|
||||||
y_dest -= DEFAULT_HUD_PADDING;
|
y_dest -= DEFAULT_HUD_PADDING;
|
||||||
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
|
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
|
||||||
@ -59,8 +59,8 @@ static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, i
|
|||||||
static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
|
||||||
Minecraft *minecraft = component->minecraft;
|
Minecraft *minecraft = component->minecraft;
|
||||||
x_dest -= DEFAULT_HUD_PADDING;
|
x_dest -= DEFAULT_HUD_PADDING;
|
||||||
float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
|
float width = ((float) minecraft->screen_width) * Gui::InvGuiScale;
|
||||||
float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
|
float height = ((float) minecraft->screen_height) * Gui::InvGuiScale;
|
||||||
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
|
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
|
||||||
y_dest -= DEFAULT_HUD_PADDING + DEFAULT_BUBBLES_PADDING + HUD_ELEMENT_HEIGHT;
|
y_dest -= DEFAULT_HUD_PADDING + DEFAULT_BUBBLES_PADDING + HUD_ELEMENT_HEIGHT;
|
||||||
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - HUD_ELEMENT_HEIGHT - NEW_HUD_PADDING;
|
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - HUD_ELEMENT_HEIGHT - NEW_HUD_PADDING;
|
||||||
@ -77,7 +77,7 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) {
|
|||||||
Inventory *inventory = gui->minecraft->player->inventory;
|
Inventory *inventory = gui->minecraft->player->inventory;
|
||||||
ItemInstance *held_ii = inventory->getSelected();
|
ItemInstance *held_ii = inventory->getSelected();
|
||||||
if (held_ii) {
|
if (held_ii) {
|
||||||
Item *held = Item_items[held_ii->id];
|
Item *held = Item::items[held_ii->id];
|
||||||
if (held->isFood() && held_ii->id) {
|
if (held->isFood() && held_ii->id) {
|
||||||
int nutrition = ((FoodItem *) held)->nutrition;
|
int nutrition = ((FoodItem *) held)->nutrition;
|
||||||
int cur_health = gui->minecraft->player->health;
|
int cur_health = gui->minecraft->player->health;
|
||||||
@ -149,7 +149,7 @@ static void Gui_renderChatMessages_injection(Gui_renderChatMessages_t original,
|
|||||||
// Calculate Selected Item Text Scale
|
// Calculate Selected Item Text Scale
|
||||||
Minecraft *minecraft = gui->minecraft;
|
Minecraft *minecraft = gui->minecraft;
|
||||||
int32_t screen_width = minecraft->screen_width;
|
int32_t screen_width = minecraft->screen_width;
|
||||||
float scale = ((float) screen_width) * Gui_InvGuiScale;
|
float scale = ((float) screen_width) * Gui::InvGuiScale;
|
||||||
// Render Selected Item Text
|
// Render Selected Item Text
|
||||||
gui->renderOnSelectItemNameText((int32_t) scale, font, y_offset - 0x13);
|
gui->renderOnSelectItemNameText((int32_t) scale, font, y_offset - 0x13);
|
||||||
}
|
}
|
||||||
@ -349,8 +349,8 @@ static void GameRenderer_render_injection(GameRenderer_render_t original, GameRe
|
|||||||
// Fix GL Mode
|
// Fix GL Mode
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
// Get X And Y
|
// Get X And Y
|
||||||
float x = Mouse::getX() * Gui_InvGuiScale;
|
float x = Mouse::getX() * Gui::InvGuiScale;
|
||||||
float y = Mouse::getY() * Gui_InvGuiScale;
|
float y = Mouse::getY() * Gui::InvGuiScale;
|
||||||
// Render Cursor
|
// Render Cursor
|
||||||
Minecraft *minecraft = game_renderer->minecraft;
|
Minecraft *minecraft = game_renderer->minecraft;
|
||||||
Common::renderCursor(x, y, minecraft);
|
Common::renderCursor(x, y, minecraft);
|
||||||
@ -494,7 +494,7 @@ static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
|||||||
|
|
||||||
// 3D Chests
|
// 3D Chests
|
||||||
static int32_t Tile_getRenderShape_injection(Tile *tile) {
|
static int32_t Tile_getRenderShape_injection(Tile *tile) {
|
||||||
if (tile == Tile_chest) {
|
if (tile == Tile::chest) {
|
||||||
// Don't Render "Simple" Chest Model
|
// Don't Render "Simple" Chest Model
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
@ -578,7 +578,7 @@ static void glColor4f_injection(__attribute__((unused)) GLfloat red, __attribute
|
|||||||
line_width = strtof(custom_line_width, nullptr);
|
line_width = strtof(custom_line_width, nullptr);
|
||||||
} else {
|
} else {
|
||||||
// Guess
|
// Guess
|
||||||
line_width = 1.5f / Gui_InvGuiScale;
|
line_width = 1.5f / Gui::InvGuiScale;
|
||||||
}
|
}
|
||||||
// Clamp Line Width
|
// Clamp Line Width
|
||||||
float range[2];
|
float range[2];
|
||||||
@ -686,7 +686,7 @@ void PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_inje
|
|||||||
CItem *item = self->item;
|
CItem *item = self->item;
|
||||||
for (size_t i = 0; i < item->ingredients.size(); i++) {
|
for (size_t i = 0; i < item->ingredients.size(); i++) {
|
||||||
ItemInstance requested_item_instance = item->ingredients[i].requested_item;
|
ItemInstance requested_item_instance = item->ingredients[i].requested_item;
|
||||||
Item *requested_item = Item_items[requested_item_instance.id];
|
Item *requested_item = Item::items[requested_item_instance.id];
|
||||||
ItemInstance *craftingRemainingItem = requested_item->getCraftingRemainingItem(&requested_item_instance);
|
ItemInstance *craftingRemainingItem = requested_item->getCraftingRemainingItem(&requested_item_instance);
|
||||||
if (craftingRemainingItem != nullptr) {
|
if (craftingRemainingItem != nullptr) {
|
||||||
// Add or drop remainder
|
// Add or drop remainder
|
||||||
|
@ -79,7 +79,7 @@ static void Minecraft_init_injection(Minecraft_init_t original, Minecraft *minec
|
|||||||
// Smooth Lighting
|
// Smooth Lighting
|
||||||
static bool TileRenderer_tesselateBlockInWorld_injection(TileRenderer_tesselateBlockInWorld_t original, TileRenderer *tile_renderer, Tile *tile, int32_t x, int32_t y, int32_t z) {
|
static bool TileRenderer_tesselateBlockInWorld_injection(TileRenderer_tesselateBlockInWorld_t original, TileRenderer *tile_renderer, Tile *tile, int32_t x, int32_t y, int32_t z) {
|
||||||
// Set Variable
|
// Set Variable
|
||||||
Minecraft_useAmbientOcclusion = stored_options->ambient_occlusion;
|
Minecraft::useAmbientOcclusion = stored_options->ambient_occlusion;
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return original(tile_renderer, tile, x, y, z);
|
return original(tile_renderer, tile, x, y, z);
|
||||||
@ -172,11 +172,11 @@ void init_options() {
|
|||||||
// Change Username
|
// Change Username
|
||||||
const char *username = get_username();
|
const char *username = get_username();
|
||||||
DEBUG("Setting Username: %s", username);
|
DEBUG("Setting Username: %s", username);
|
||||||
if (strcmp(Strings_default_username, "StevePi") != 0) {
|
if (strcmp(Strings::default_username, "StevePi") != 0) {
|
||||||
ERR("Default Username Is Invalid");
|
ERR("Default Username Is Invalid");
|
||||||
}
|
}
|
||||||
safe_username = to_cp437(username);
|
safe_username = to_cp437(username);
|
||||||
patch_address((void *) Strings_default_username_pointer, (void *) safe_username);
|
patch_address((void *) &Strings::default_username, (void *) safe_username);
|
||||||
|
|
||||||
// Disable Autojump By Default
|
// Disable Autojump By Default
|
||||||
if (feature_has("Disable Autojump By Default", server_disabled)) {
|
if (feature_has("Disable Autojump By Default", server_disabled)) {
|
||||||
@ -200,9 +200,9 @@ void init_options() {
|
|||||||
// Actually Save options.txt
|
// Actually Save options.txt
|
||||||
overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection);
|
overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection);
|
||||||
// Fix options.txt Path
|
// Fix options.txt Path
|
||||||
patch_address((void *) Strings_options_txt_path_pointer, (void *) get_new_options_txt_path());
|
patch_address((void *) &Strings::options_txt_path, (void *) get_new_options_txt_path());
|
||||||
// When Loading, options.txt Should Be Opened In Read Mode
|
// When Loading, options.txt Should Be Opened In Read Mode
|
||||||
patch_address((void *) Strings_options_txt_fopen_mode_when_loading_pointer, (void *) "r");
|
patch_address((void *) &Strings::options_txt_fopen_mode_when_loading, (void *) "r");
|
||||||
// Fix OptionsFile::getOptionStrings
|
// Fix OptionsFile::getOptionStrings
|
||||||
overwrite(OptionsFile_getOptionStrings, OptionsFile_getOptionStrings_injection);
|
overwrite(OptionsFile_getOptionStrings, OptionsFile_getOptionStrings_injection);
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ void init_options() {
|
|||||||
// Replace "feedback_vibration" Loading/Saving With "gfx_ao"
|
// Replace "feedback_vibration" Loading/Saving With "gfx_ao"
|
||||||
{
|
{
|
||||||
// Replace String
|
// Replace String
|
||||||
patch_address((void *) Strings_feedback_vibration_options_txt_name_pointer, (void *) "gfx_ao");
|
patch_address((void *) &Strings::feedback_vibration_options_txt_name, (void *) "gfx_ao");
|
||||||
// Loading
|
// Loading
|
||||||
unsigned char offset = (unsigned char) offsetof(Options, ambient_occlusion);
|
unsigned char offset = (unsigned char) offsetof(Options, ambient_occlusion);
|
||||||
unsigned char gfx_ao_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
|
unsigned char gfx_ao_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
|
||||||
@ -234,7 +234,7 @@ void init_options() {
|
|||||||
// Replace "gfx_lowquality" Loading With "gfx_anaglyph"
|
// Replace "gfx_lowquality" Loading With "gfx_anaglyph"
|
||||||
{
|
{
|
||||||
// Replace String
|
// Replace String
|
||||||
patch_address((void *) Strings_gfx_lowquality_options_txt_name_pointer, (void *) "gfx_anaglyph");
|
patch_address((void *) &Strings::gfx_lowquality_options_txt_name, (void *) "gfx_anaglyph");
|
||||||
// Loading
|
// Loading
|
||||||
unsigned char offset = (unsigned char) offsetof(Options, anaglyph_3d);
|
unsigned char offset = (unsigned char) offsetof(Options, anaglyph_3d);
|
||||||
unsigned char gfx_anaglyph_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
|
unsigned char gfx_anaglyph_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
|
||||||
|
@ -27,9 +27,9 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane_u
|
|||||||
std::string name = *name_ptr;
|
std::string name = *name_ptr;
|
||||||
std::string new_name = name;
|
std::string new_name = name;
|
||||||
if (name == "Fancy Graphics") {
|
if (name == "Fancy Graphics") {
|
||||||
option = &Options_Option_GRAPHICS;
|
option = &Options_Option::GRAPHICS;
|
||||||
} else if (name == "Soft shadows") {
|
} else if (name == "Soft shadows") {
|
||||||
option = &Options_Option_AMBIENT_OCCLUSION;
|
option = &Options_Option::AMBIENT_OCCLUSION;
|
||||||
} else if (name == "Fancy Skies" || name == "Animated water") {
|
} else if (name == "Fancy Skies" || name == "Animated water") {
|
||||||
// These have no corresponding option, so disable the toggle.
|
// These have no corresponding option, so disable the toggle.
|
||||||
return;
|
return;
|
||||||
@ -51,24 +51,24 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane_u
|
|||||||
original(options_pane, group_id, &new_name, option);
|
original(options_pane, group_id, &new_name, option);
|
||||||
|
|
||||||
// Add 3D Anaglyph
|
// Add 3D Anaglyph
|
||||||
if (option == &Options_Option_GRAPHICS) {
|
if (option == &Options_Option::GRAPHICS) {
|
||||||
std::string cpp_string = "3D Anaglyph";
|
std::string cpp_string = "3D Anaglyph";
|
||||||
original(options_pane, group_id, &cpp_string, &Options_Option_ANAGLYPH);
|
original(options_pane, group_id, &cpp_string, &Options_Option::ANAGLYPH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Peaceful Mode
|
// Add Peaceful Mode
|
||||||
if (option == &Options_Option_SERVER_VISIBLE) {
|
if (option == &Options_Option::SERVER_VISIBLE) {
|
||||||
std::string cpp_string = "Peaceful mode";
|
std::string cpp_string = "Peaceful mode";
|
||||||
original(options_pane, group_id, &cpp_string, &Options_Option_DIFFICULTY);
|
original(options_pane, group_id, &cpp_string, &Options_Option::DIFFICULTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Missing Options To Options::getBooleanValue
|
// Add Missing Options To Options::getBooleanValue
|
||||||
static bool Options_getBooleanValue_injection(Options_getBooleanValue_t original, Options *options, Options_Option *option) {
|
static bool Options_getBooleanValue_injection(Options_getBooleanValue_t original, Options *options, Options_Option *option) {
|
||||||
// Check
|
// Check
|
||||||
if (option == &Options_Option_GRAPHICS) {
|
if (option == &Options_Option::GRAPHICS) {
|
||||||
return options->fancy_graphics;
|
return options->fancy_graphics;
|
||||||
} else if (option == &Options_Option_DIFFICULTY) {
|
} else if (option == &Options_Option::DIFFICULTY) {
|
||||||
return options->game_difficulty == 0;
|
return options->game_difficulty == 0;
|
||||||
} else {
|
} else {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
|
@ -42,7 +42,7 @@ static void LocalPlayer_openTextEdit_injection(LocalPlayer *local_player, TileEn
|
|||||||
|
|
||||||
// Store Text Input
|
// Store Text Input
|
||||||
void sign_key_press(char key) {
|
void sign_key_press(char key) {
|
||||||
Keyboard__inputText.push_back(key);
|
Keyboard::_inputText.push_back(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
|
@ -69,7 +69,7 @@ static int32_t Textures_loadAndBindTexture_injection(Textures *textures, __attri
|
|||||||
// Change Texture
|
// Change Texture
|
||||||
static std::string new_texture;
|
static std::string new_texture;
|
||||||
if (new_texture.length() == 0) {
|
if (new_texture.length() == 0) {
|
||||||
std::string username = base64_encode(Strings_default_username);
|
std::string username = base64_encode(Strings::default_username);
|
||||||
new_texture = '$' + username;
|
new_texture = '$' + username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static DynamicTexture *create_lava_texture() {
|
|||||||
// Construct
|
// Construct
|
||||||
LavaTexture *texture = new LavaTexture;
|
LavaTexture *texture = new LavaTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
texture->super.constructor(Tile_lava->texture);
|
texture->super.constructor(Tile::lava->texture);
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_lava_texture_vtable();
|
texture->super.vtable = get_lava_texture_vtable();
|
||||||
// Setup
|
// Setup
|
||||||
@ -146,7 +146,7 @@ static DynamicTexture *create_lava_side_texture() {
|
|||||||
// Construct
|
// Construct
|
||||||
LavaSideTexture *texture = new LavaSideTexture;
|
LavaSideTexture *texture = new LavaSideTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
texture->super.constructor(Tile_lava->texture + 1);
|
texture->super.constructor(Tile::lava->texture + 1);
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_lava_side_texture_vtable();
|
texture->super.vtable = get_lava_side_texture_vtable();
|
||||||
// Setup
|
// Setup
|
||||||
@ -214,7 +214,7 @@ static DynamicTexture *create_fire_texture(int a2) {
|
|||||||
// Construct
|
// Construct
|
||||||
FireTexture *texture = new FireTexture;
|
FireTexture *texture = new FireTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
texture->super.constructor(Tile_fire->texture + (16 * a2));
|
texture->super.constructor(Tile::fire->texture + (16 * a2));
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_fire_texture_vtable();
|
texture->super.vtable = get_fire_texture_vtable();
|
||||||
// Setup Random
|
// Setup Random
|
||||||
|
@ -152,7 +152,7 @@ void init_title_screen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rename "Create" Button To "Quit"
|
// Rename "Create" Button To "Quit"
|
||||||
patch_address((void *) Strings_classic_create_button_text_pointer, (void *) "Quit");
|
patch_address((void *) &Strings::classic_create_button_text, (void *) "Quit");
|
||||||
|
|
||||||
// Add Functionality To Quit Button
|
// Add Functionality To Quit Button
|
||||||
overwrite_virtual_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection);
|
overwrite_virtual_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection);
|
||||||
|
@ -13,14 +13,14 @@ static int32_t Minecraft_isTouchscreen_injection(__attribute__((unused)) Minecra
|
|||||||
|
|
||||||
// IngameBlockSelectionScreen Memory Allocation Override
|
// IngameBlockSelectionScreen Memory Allocation Override
|
||||||
static unsigned char *operator_new_IngameBlockSelectionScreen_injection(__attribute__((unused)) uint32_t size) {
|
static unsigned char *operator_new_IngameBlockSelectionScreen_injection(__attribute__((unused)) uint32_t size) {
|
||||||
return (unsigned char *) ::operator new(TOUCH_INGAME_BLOCK_SELECTION_SCREEN_SIZE);
|
return (unsigned char *) ::operator new(sizeof(Touch_IngameBlockSelectionScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Improved Button Hover Behavior
|
// Improved Button Hover Behavior
|
||||||
static int32_t Button_hovered_injection(__attribute__((unused)) Button *button, __attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) int32_t click_x, __attribute__((unused)) int32_t click_y) {
|
static int32_t Button_hovered_injection(__attribute__((unused)) Button *button, __attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) int32_t click_x, __attribute__((unused)) int32_t click_y) {
|
||||||
// Get Mouse Position
|
// Get Mouse Position
|
||||||
int32_t x = Mouse::getX() * Gui_InvGuiScale;
|
int32_t x = Mouse::getX() * Gui::InvGuiScale;
|
||||||
int32_t y = Mouse::getY() * Gui_InvGuiScale;
|
int32_t y = Mouse::getY() * Gui::InvGuiScale;
|
||||||
|
|
||||||
// Get Button Position
|
// Get Button Position
|
||||||
int32_t button_x1 = button->x;
|
int32_t button_x1 = button->x;
|
||||||
|
@ -9,7 +9,7 @@ char *version_get() {
|
|||||||
static char *version = nullptr;
|
static char *version = nullptr;
|
||||||
// Load
|
// Load
|
||||||
if (version == nullptr) {
|
if (version == nullptr) {
|
||||||
safe_asprintf(&version, "%s / Reborn v%s", Strings_minecraft_pi_version, reborn_get_version());
|
safe_asprintf(&version, "%s / Reborn v%s", Strings::minecraft_pi_version, reborn_get_version());
|
||||||
}
|
}
|
||||||
// Return
|
// Return
|
||||||
return version;
|
return version;
|
||||||
@ -30,7 +30,7 @@ void init_version() {
|
|||||||
// Touch GUI
|
// Touch GUI
|
||||||
overwrite(Common_getGameVersionString, Common_getGameVersionString_injection);
|
overwrite(Common_getGameVersionString, Common_getGameVersionString_injection);
|
||||||
// Normal GUI
|
// Normal GUI
|
||||||
patch_address((void *) Strings_minecraft_pi_version_pointer, version_get());
|
patch_address((void *) &Strings::minecraft_pi_version, version_get());
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
INFO("Starting Minecraft: Pi Edition (%s)", version_get());
|
INFO("Starting Minecraft: Pi Edition (%s)", version_get());
|
||||||
|
Loading…
Reference in New Issue
Block a user