diff --git a/dependencies/symbol-processor/src b/dependencies/symbol-processor/src index 603010e3..fbb9b6d6 160000 --- a/dependencies/symbol-processor/src +++ b/dependencies/symbol-processor/src @@ -1 +1 @@ -Subproject commit 603010e3cce7a7cce90b87da43e4c918047d14a2 +Subproject commit fbb9b6d6da1a9dfa9290d420d1b2c34f91026111 diff --git a/mods/src/atlas/atlas.cpp b/mods/src/atlas/atlas.cpp index dd1f27e1..bd749c36 100644 --- a/mods/src/atlas/atlas.cpp +++ b/mods/src/atlas/atlas.cpp @@ -8,17 +8,17 @@ // 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) { - int32_t leaves_id = Tile_leaves->id; - int32_t grass_id = Tile_grass->id; + int32_t leaves_id = Tile::leaves->id; + int32_t grass_id = Tile::grass->id; // Replace Rendered Item With Carried Variant ItemInstance carried_item_instance; bool use_carried = false; if (item_instance != nullptr) { 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; } 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; } } diff --git a/mods/src/bucket/bucket.cpp b/mods/src/bucket/bucket.cpp index 5f6bf11a..f7f77039 100644 --- a/mods/src/bucket/bucket.cpp +++ b/mods/src/bucket/bucket.cpp @@ -11,9 +11,9 @@ static FoodItem *bucket = nullptr; // Description And Texture 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"; - } else if (item_instance->auxiliary == Tile_lava->id) { + } else if (item_instance->auxiliary == Tile::lava->id) { return "item.bucketLava"; } else if (item_instance->auxiliary == 1) { 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) { - if (auxiliary == Tile_water->id) { + if (auxiliary == Tile::water->id) { return 75; - } else if (auxiliary == Tile_lava->id) { + } else if (auxiliary == Tile::lava->id) { return 76; } else if (auxiliary == 1) { return 77; @@ -63,10 +63,10 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst // Empty Bucket int32_t new_auxiliary = 0; int32_t tile = level->getTile(x, y, z); - if (tile == Tile_calmWater->id) { - new_auxiliary = Tile_water->id; - } else if (tile == Tile_calmLava->id) { - new_auxiliary = Tile_lava->id; + if (tile == Tile::calmWater->id) { + new_auxiliary = Tile::water->id; + } else if (tile == Tile::calmLava->id) { + new_auxiliary = Tile::lava->id; } if (new_auxiliary != 0) { // Valid @@ -114,7 +114,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst if (material != nullptr) { 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; } 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) { inventory_add_item(filling_container, bucket, 0); - 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::water->id); + inventory_add_item(filling_container, bucket, Tile::lava->id); inventory_add_item(filling_container, bucket, 1); } @@ -269,9 +269,9 @@ static void handle_tick(Minecraft *minecraft) { // Prevent Breaking Liquid static bool is_calm_liquid(int32_t id) { - if (id == Tile_calmWater->id) { + if (id == Tile::calmWater->id) { return true; - } else if (id == Tile_calmLava->id) { + } else if (id == Tile::calmLava->id) { return true; } else { return false; @@ -320,7 +320,7 @@ static void Recipes_injection(Recipes *recipes) { // Custom Furnace Fuel 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; } else { // Call Original Method @@ -341,7 +341,7 @@ static void FurnaceTileEntity_tick_ItemInstance_setNull_injection(ItemInstance * // Add the bucket name to the language file 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 diff --git a/mods/src/cake/cake.cpp b/mods/src/cake/cake.cpp index 5af9af75..81111287 100644 --- a/mods/src/cake/cake.cpp +++ b/mods/src/cake/cake.cpp @@ -119,7 +119,7 @@ static void make_cake() { cake = new Tile; ALLOC_CHECK(cake); int texture = 122; - cake->constructor(92, texture, Material_dirt); + cake->constructor(92, texture, Material::dirt); cake->texture = texture; // Set VTable diff --git a/mods/src/chat/chat.cpp b/mods/src/chat/chat.cpp index 08e3c5f9..56c01702 100644 --- a/mods/src/chat/chat.cpp +++ b/mods/src/chat/chat.cpp @@ -52,7 +52,7 @@ void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) { // Hosting Multiplayer const char *message = packet->message.c_str(); 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 { // Client rak_net_instance->send((Packet *) packet); diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index a6c69e09..cdf04e82 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -34,7 +34,7 @@ CUSTOM_VTABLE(chat_screen, Screen) { local_history = get_history(); local_history.push_back(""); // 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(); self->chat->setMaxLength(max_length); // Send Button diff --git a/mods/src/creative/creative.cpp b/mods/src/creative/creative.cpp index d255799f..ee06b1b7 100644 --- a/mods/src/creative/creative.cpp +++ b/mods/src/creative/creative.cpp @@ -24,10 +24,10 @@ static void inventory_add_item(FillingContainer *inventory, Tile *item) { // Expand Creative Inventory static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) { // Add Items - inventory_add_item(filling_container, Item_flintAndSteel); - inventory_add_item(filling_container, Item_snowball); - inventory_add_item(filling_container, Item_egg); - inventory_add_item(filling_container, Item_shears); + inventory_add_item(filling_container, Item::flintAndSteel); + inventory_add_item(filling_container, Item::snowball); + inventory_add_item(filling_container, Item::egg); + inventory_add_item(filling_container, Item::shears); // Dyes for (int i = 0; i < 16; i++) { if (i == 15) { @@ -36,23 +36,23 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli } ItemInstance *new_item_instance = new ItemInstance; 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); } - inventory_add_item(filling_container, Item_camera); + inventory_add_item(filling_container, Item::camera); // Add Tiles - inventory_add_item(filling_container, Tile_water); - inventory_add_item(filling_container, Tile_lava); - inventory_add_item(filling_container, Tile_calmWater); - inventory_add_item(filling_container, Tile_calmLava); - inventory_add_item(filling_container, Tile_glowingObsidian); - inventory_add_item(filling_container, Tile_web); - inventory_add_item(filling_container, Tile_topSnow); - inventory_add_item(filling_container, Tile_ice); - inventory_add_item(filling_container, Tile_invisible_bedrock); - inventory_add_item(filling_container, Tile_bedrock); - inventory_add_item(filling_container, Tile_info_updateGame1); - inventory_add_item(filling_container, Tile_info_updateGame2); + inventory_add_item(filling_container, Tile::water); + inventory_add_item(filling_container, Tile::lava); + inventory_add_item(filling_container, Tile::calmWater); + inventory_add_item(filling_container, Tile::calmLava); + inventory_add_item(filling_container, Tile::glowingObsidian); + inventory_add_item(filling_container, Tile::web); + inventory_add_item(filling_container, Tile::topSnow); + inventory_add_item(filling_container, Tile::ice); + inventory_add_item(filling_container, Tile::invisible_bedrock); + inventory_add_item(filling_container, Tile::bedrock); + inventory_add_item(filling_container, Tile::info_updateGame1); + inventory_add_item(filling_container, Tile::info_updateGame2); // Nether Reactor for (int i = 0; i < 3; i++) { if (i == 0) { @@ -61,7 +61,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli } ItemInstance *new_item_instance = new ItemInstance; 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); } // Tall Grass @@ -72,14 +72,14 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli } ItemInstance *new_item_instance = new ItemInstance; 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); } // Smooth Stone Slab { ItemInstance *new_item_instance = new ItemInstance; 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); } } @@ -95,7 +95,7 @@ static TileItem *Tile_initTiles_TileItem_injection(TileItem *tile_item, int32_t // Configure Item tile_item->is_stacked_by_data = true; 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 tile_item; @@ -119,7 +119,7 @@ void init_creative() { // Inventory can have arbitrary auxiliary values. { // 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); // Hook Constructor overwrite_call((void *) 0xc6f74, (void *) Tile_initTiles_TileItem_injection); diff --git a/mods/src/game-mode/game-mode.cpp b/mods/src/game-mode/game-mode.cpp index 3fd20878..3dae0142 100644 --- a/mods/src/game-mode/game-mode.cpp +++ b/mods/src/game-mode/game-mode.cpp @@ -17,7 +17,7 @@ static void set_is_survival(bool new_is_survival) { patch((void *) 0x16efc, inventory_patch); // 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); // Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor @@ -57,7 +57,7 @@ void init_game_mode() { overwrite_call((void *) 0x16f84, (void *) ServerLevel_constructor); // 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); // Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing diff --git a/mods/src/game-mode/ui.cpp b/mods/src/game-mode/ui.cpp index a3a7d4a2..944c85df 100644 --- a/mods/src/game-mode/ui.cpp +++ b/mods/src/game-mode/ui.cpp @@ -88,7 +88,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) { // Game Mode Description CreateWorldScreen *self = (CreateWorldScreen *) super; 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); }; // Positioning diff --git a/mods/src/home/home.cpp b/mods/src/home/home.cpp index a8f0c866..fef1b4c3 100644 --- a/mods/src/home/home.cpp +++ b/mods/src/home/home.cpp @@ -24,7 +24,7 @@ __attribute__((destructor)) static void _free_home() { // Init void init_home() { // 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, // making changing directory redundant. diff --git a/mods/src/init/init.cpp b/mods/src/init/init.cpp index 148e1271..abee8037 100644 --- a/mods/src/init/init.cpp +++ b/mods/src/init/init.cpp @@ -1,13 +1,11 @@ #include #include #include -#include __attribute__((constructor)) static void init() { media_ensure_loaded(); reborn_init_patch(); run_tests(); - init_symbols(); init_version(); init_compat(); #ifdef MCPI_SERVER_MODE diff --git a/mods/src/misc/api.cpp b/mods/src/misc/api.cpp index 77870b9f..054ff385 100644 --- a/mods/src/misc/api.cpp +++ b/mods/src/misc/api.cpp @@ -150,7 +150,7 @@ void misc_render_background(int color, Minecraft *minecraft, int x, int y, int w #endif std::string texture = "gui/background.png"; minecraft->textures->loadAndBindTexture(&texture); - Tesselator *t = &Tesselator_instance; + Tesselator *t = &Tesselator::instance; t->begin(7); t->color(color, color, color, 255); float x1 = x; diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 2fdbb47f..48d65a2b 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -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) { Minecraft *minecraft = ((Gui *) component)->minecraft; x_dest -= DEFAULT_HUD_PADDING; - float width = ((float) minecraft->screen_width) * Gui_InvGuiScale; - float height = ((float) minecraft->screen_height) * Gui_InvGuiScale; + float width = ((float) minecraft->screen_width) * Gui::InvGuiScale; + float height = ((float) minecraft->screen_height) * Gui::InvGuiScale; x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2; y_dest -= DEFAULT_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) { Minecraft *minecraft = component->minecraft; x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH; - float width = ((float) minecraft->screen_width) * Gui_InvGuiScale; - float height = ((float) minecraft->screen_height) * Gui_InvGuiScale; + float width = ((float) minecraft->screen_width) * Gui::InvGuiScale; + float height = ((float) minecraft->screen_height) * Gui::InvGuiScale; x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH; y_dest -= DEFAULT_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) { Minecraft *minecraft = component->minecraft; x_dest -= DEFAULT_HUD_PADDING; - float width = ((float) minecraft->screen_width) * Gui_InvGuiScale; - float height = ((float) minecraft->screen_height) * Gui_InvGuiScale; + float width = ((float) minecraft->screen_width) * Gui::InvGuiScale; + float height = ((float) minecraft->screen_height) * Gui::InvGuiScale; x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2; 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; @@ -77,7 +77,7 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) { Inventory *inventory = gui->minecraft->player->inventory; ItemInstance *held_ii = inventory->getSelected(); if (held_ii) { - Item *held = Item_items[held_ii->id]; + Item *held = Item::items[held_ii->id]; if (held->isFood() && held_ii->id) { int nutrition = ((FoodItem *) held)->nutrition; 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 Minecraft *minecraft = gui->minecraft; 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 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 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Get X And Y - float x = Mouse::getX() * Gui_InvGuiScale; - float y = Mouse::getY() * Gui_InvGuiScale; + float x = Mouse::getX() * Gui::InvGuiScale; + float y = Mouse::getY() * Gui::InvGuiScale; // Render Cursor Minecraft *minecraft = game_renderer->minecraft; Common::renderCursor(x, y, minecraft); @@ -494,7 +494,7 @@ static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) { // 3D Chests static int32_t Tile_getRenderShape_injection(Tile *tile) { - if (tile == Tile_chest) { + if (tile == Tile::chest) { // Don't Render "Simple" Chest Model return -1; } else { @@ -578,7 +578,7 @@ static void glColor4f_injection(__attribute__((unused)) GLfloat red, __attribute line_width = strtof(custom_line_width, nullptr); } else { // Guess - line_width = 1.5f / Gui_InvGuiScale; + line_width = 1.5f / Gui::InvGuiScale; } // Clamp Line Width float range[2]; @@ -686,7 +686,7 @@ void PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_inje CItem *item = self->item; for (size_t i = 0; i < item->ingredients.size(); i++) { 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); if (craftingRemainingItem != nullptr) { // Add or drop remainder diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp index 3e02f954..6824e3e1 100644 --- a/mods/src/options/options.cpp +++ b/mods/src/options/options.cpp @@ -79,7 +79,7 @@ static void Minecraft_init_injection(Minecraft_init_t original, Minecraft *minec // 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) { // Set Variable - Minecraft_useAmbientOcclusion = stored_options->ambient_occlusion; + Minecraft::useAmbientOcclusion = stored_options->ambient_occlusion; // Call Original Method return original(tile_renderer, tile, x, y, z); @@ -172,11 +172,11 @@ void init_options() { // Change Username const char *username = get_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"); } 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 if (feature_has("Disable Autojump By Default", server_disabled)) { @@ -200,9 +200,9 @@ void init_options() { // Actually Save options.txt overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection); // 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 - 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 overwrite(OptionsFile_getOptionStrings, OptionsFile_getOptionStrings_injection); @@ -221,7 +221,7 @@ void init_options() { // Replace "feedback_vibration" Loading/Saving With "gfx_ao" { // 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 unsigned char offset = (unsigned char) offsetof(Options, ambient_occlusion); 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 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 unsigned char offset = (unsigned char) offsetof(Options, anaglyph_3d); unsigned char gfx_anaglyph_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET" diff --git a/mods/src/options/ui.cpp b/mods/src/options/ui.cpp index 1fa1de89..6d9df683 100644 --- a/mods/src/options/ui.cpp +++ b/mods/src/options/ui.cpp @@ -27,9 +27,9 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane_u std::string name = *name_ptr; std::string new_name = name; if (name == "Fancy Graphics") { - option = &Options_Option_GRAPHICS; + option = &Options_Option::GRAPHICS; } else if (name == "Soft shadows") { - option = &Options_Option_AMBIENT_OCCLUSION; + option = &Options_Option::AMBIENT_OCCLUSION; } else if (name == "Fancy Skies" || name == "Animated water") { // These have no corresponding option, so disable the toggle. return; @@ -51,24 +51,24 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane_u original(options_pane, group_id, &new_name, option); // Add 3D Anaglyph - if (option == &Options_Option_GRAPHICS) { + if (option == &Options_Option::GRAPHICS) { 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 - if (option == &Options_Option_SERVER_VISIBLE) { + if (option == &Options_Option::SERVER_VISIBLE) { 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 static bool Options_getBooleanValue_injection(Options_getBooleanValue_t original, Options *options, Options_Option *option) { // Check - if (option == &Options_Option_GRAPHICS) { + if (option == &Options_Option::GRAPHICS) { return options->fancy_graphics; - } else if (option == &Options_Option_DIFFICULTY) { + } else if (option == &Options_Option::DIFFICULTY) { return options->game_difficulty == 0; } else { // Call Original Method diff --git a/mods/src/sign/sign.cpp b/mods/src/sign/sign.cpp index bd36fe64..4def80b5 100644 --- a/mods/src/sign/sign.cpp +++ b/mods/src/sign/sign.cpp @@ -42,7 +42,7 @@ static void LocalPlayer_openTextEdit_injection(LocalPlayer *local_player, TileEn // Store Text Input void sign_key_press(char key) { - Keyboard__inputText.push_back(key); + Keyboard::_inputText.push_back(key); } // Init diff --git a/mods/src/skin/skin.cpp b/mods/src/skin/skin.cpp index aa920b5b..f86904df 100644 --- a/mods/src/skin/skin.cpp +++ b/mods/src/skin/skin.cpp @@ -69,7 +69,7 @@ static int32_t Textures_loadAndBindTexture_injection(Textures *textures, __attri // Change Texture static std::string new_texture; if (new_texture.length() == 0) { - std::string username = base64_encode(Strings_default_username); + std::string username = base64_encode(Strings::default_username); new_texture = '$' + username; } diff --git a/mods/src/textures/lava.cpp b/mods/src/textures/lava.cpp index a749b9d6..ab7b2a81 100644 --- a/mods/src/textures/lava.cpp +++ b/mods/src/textures/lava.cpp @@ -82,7 +82,7 @@ static DynamicTexture *create_lava_texture() { // Construct LavaTexture *texture = new LavaTexture; ALLOC_CHECK(texture); - texture->super.constructor(Tile_lava->texture); + texture->super.constructor(Tile::lava->texture); // Set VTable texture->super.vtable = get_lava_texture_vtable(); // Setup @@ -146,7 +146,7 @@ static DynamicTexture *create_lava_side_texture() { // Construct LavaSideTexture *texture = new LavaSideTexture; ALLOC_CHECK(texture); - texture->super.constructor(Tile_lava->texture + 1); + texture->super.constructor(Tile::lava->texture + 1); // Set VTable texture->super.vtable = get_lava_side_texture_vtable(); // Setup @@ -214,7 +214,7 @@ static DynamicTexture *create_fire_texture(int a2) { // Construct FireTexture *texture = new FireTexture; ALLOC_CHECK(texture); - texture->super.constructor(Tile_fire->texture + (16 * a2)); + texture->super.constructor(Tile::fire->texture + (16 * a2)); // Set VTable texture->super.vtable = get_fire_texture_vtable(); // Setup Random diff --git a/mods/src/title-screen/title-screen.cpp b/mods/src/title-screen/title-screen.cpp index 3f0f1690..18cb76b0 100644 --- a/mods/src/title-screen/title-screen.cpp +++ b/mods/src/title-screen/title-screen.cpp @@ -152,7 +152,7 @@ void init_title_screen() { } // 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 overwrite_virtual_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection); diff --git a/mods/src/touch/touch.cpp b/mods/src/touch/touch.cpp index e624772d..2088989d 100644 --- a/mods/src/touch/touch.cpp +++ b/mods/src/touch/touch.cpp @@ -13,14 +13,14 @@ static int32_t Minecraft_isTouchscreen_injection(__attribute__((unused)) Minecra // IngameBlockSelectionScreen Memory Allocation Override 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 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 - int32_t x = Mouse::getX() * Gui_InvGuiScale; - int32_t y = Mouse::getY() * Gui_InvGuiScale; + int32_t x = Mouse::getX() * Gui::InvGuiScale; + int32_t y = Mouse::getY() * Gui::InvGuiScale; // Get Button Position int32_t button_x1 = button->x; diff --git a/mods/src/version/version.cpp b/mods/src/version/version.cpp index a8308548..6260c621 100644 --- a/mods/src/version/version.cpp +++ b/mods/src/version/version.cpp @@ -9,7 +9,7 @@ char *version_get() { static char *version = nullptr; // Load 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 version; @@ -30,7 +30,7 @@ void init_version() { // Touch GUI overwrite(Common_getGameVersionString, Common_getGameVersionString_injection); // Normal GUI - patch_address((void *) Strings_minecraft_pi_version_pointer, version_get()); + patch_address((void *) &Strings::minecraft_pi_version, version_get()); // Log INFO("Starting Minecraft: Pi Edition (%s)", version_get());