From d859a16b5ab4bba480396c6b7f3e0d3c7c5b791e Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 25 Jun 2022 17:30:08 -0400 Subject: [PATCH] Initial SDK Support --- CMakeLists.txt | 8 + example-mod/.gitignore | 1 + example-mod/CMakeLists.txt | 15 + example-mod/README.md | 9 + example-mod/expanded-creative.cpp | 651 ++++++++++++++++++ launcher/src/bootstrap.c | 45 ++ libreborn/CMakeLists.txt | 13 +- libreborn/include/libreborn/config.h.in | 1 + libreborn/include/libreborn/patch.h | 2 + libreborn/src/patch/patch.c | 19 +- media-layer/CMakeLists.txt | 12 +- media-layer/core/CMakeLists.txt | 6 +- media-layer/gles/CMakeLists.txt | 8 +- media-layer/proxy/CMakeLists.txt | 2 + mods/CMakeLists.txt | 67 +- mods/include/mods/chat/chat.h | 19 + mods/{src => include/mods}/compat/compat.h | 0 .../{src => include/mods}/creative/creative.h | 0 mods/{src => include/mods}/feature/feature.h | 0 mods/{src => include/mods}/home/home.h | 0 mods/{src => include/mods}/init/init.h | 0 mods/{src => include/mods}/input/input.h | 6 - mods/{src => include/mods}/misc/misc.h | 3 - .../{src => include/mods}/override/override.h | 0 .../mods}/server/server_properties.h | 0 mods/{src => include/mods}/sign/sign.h | 0 mods/{src => include/mods}/version/version.h | 0 mods/src/atlas/atlas.cpp | 4 +- mods/src/benchmark/benchmark.cpp | 6 +- mods/src/camera/camera.cpp | 6 +- mods/src/chat/{chat.h => chat-internal.h} | 7 +- mods/src/chat/chat.cpp | 15 +- mods/src/chat/ui.c | 3 +- mods/src/compat/compat.c | 12 +- mods/src/creative/creative.cpp | 6 +- mods/src/death/death.cpp | 4 +- mods/src/feature/feature.c | 2 +- .../{game-mode.h => game-mode-internal.h} | 0 mods/src/game-mode/game-mode.c | 6 +- mods/src/game-mode/ui.cpp | 2 +- mods/src/home/home.c | 4 +- mods/src/init/init.c | 2 +- mods/src/input/attack.c | 5 +- mods/src/input/bow.c | 5 +- mods/src/input/drop.cpp | 7 +- mods/src/input/input-internal.h | 15 + mods/src/input/input.cpp | 7 +- mods/src/input/misc.c | 7 +- mods/src/input/toggle.c | 5 +- mods/src/misc/logging.cpp | 3 +- mods/src/misc/misc-internal.h | 12 + mods/src/misc/misc.c | 7 +- mods/src/misc/misc.cpp | 5 +- mods/src/multiplayer/multiplayer.cpp | 6 +- .../options/{options.h => options-internal.h} | 0 mods/src/options/options.c | 6 +- mods/src/options/options.cpp | 6 +- mods/src/override/override.c | 4 +- mods/src/server/server.cpp | 12 +- mods/src/server/server_properties.cpp | 2 +- mods/src/sign/sign.cpp | 8 +- mods/src/sound/repository.cpp | 2 +- mods/src/sound/{sound.h => sound-internal.h} | 0 mods/src/sound/sound.cpp | 8 +- mods/src/test/test.c | 4 +- mods/src/textures/textures.cpp | 6 +- mods/src/touch/touch.cpp | 4 +- mods/src/version/version.cpp | 4 +- scripts/build.sh | 4 +- symbols/CMakeLists.txt | 11 +- 70 files changed, 987 insertions(+), 144 deletions(-) create mode 100644 example-mod/.gitignore create mode 100644 example-mod/CMakeLists.txt create mode 100644 example-mod/README.md create mode 100644 example-mod/expanded-creative.cpp create mode 100644 mods/include/mods/chat/chat.h rename mods/{src => include/mods}/compat/compat.h (100%) rename mods/{src => include/mods}/creative/creative.h (100%) rename mods/{src => include/mods}/feature/feature.h (100%) rename mods/{src => include/mods}/home/home.h (100%) rename mods/{src => include/mods}/init/init.h (100%) rename mods/{src => include/mods}/input/input.h (58%) rename mods/{src => include/mods}/misc/misc.h (71%) rename mods/{src => include/mods}/override/override.h (100%) rename mods/{src => include/mods}/server/server_properties.h (100%) rename mods/{src => include/mods}/sign/sign.h (100%) rename mods/{src => include/mods}/version/version.h (100%) rename mods/src/chat/{chat.h => chat-internal.h} (66%) rename mods/src/game-mode/{game-mode.h => game-mode-internal.h} (100%) create mode 100644 mods/src/input/input-internal.h create mode 100644 mods/src/misc/misc-internal.h rename mods/src/options/{options.h => options-internal.h} (100%) rename mods/src/sound/{sound.h => sound-internal.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe1dd0d1b..a67dc3163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,9 @@ endif() set(MCPI_INSTALL_DIR "lib/${MCPI_VARIANT_NAME}") set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib") set(MCPI_BIN_DIR "${MCPI_INSTALL_DIR}/bin") +set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk") +set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib") +set(MCPI_SDK_INCLUDE_DIR "${MCPI_SDK_DIR}/include") # Build Mode if(NOT CMAKE_BUILD_TYPE) @@ -159,3 +162,8 @@ endif() if(BUILD_NATIVE_COMPONENTS) add_subdirectory(images) endif() + +# Install SDK +if(BUILD_ARM_COMPONENTS) + install(EXPORT sdk DESTINATION "${MCPI_SDK_DIR}" EXPORT_LINK_INTERFACE_LIBRARIES) +endif() diff --git a/example-mod/.gitignore b/example-mod/.gitignore new file mode 100644 index 000000000..378eac25d --- /dev/null +++ b/example-mod/.gitignore @@ -0,0 +1 @@ +build diff --git a/example-mod/CMakeLists.txt b/example-mod/CMakeLists.txt new file mode 100644 index 000000000..9a50be0ce --- /dev/null +++ b/example-mod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.16.0) + +# Build For ARM +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) + +# Start Project +project(expanded-creative) + +# Include SDK +include("$ENV{HOME}/.minecraft-pi/sdk/lib/minecraft-pi-reborn-client/sdk/sdk.cmake") + +# Build +add_library(expanded-creative SHARED expanded-creative.cpp) +target_link_libraries(expanded-creative mods-headers reborn-patch symbols) diff --git a/example-mod/README.md b/example-mod/README.md new file mode 100644 index 000000000..0925ab979 --- /dev/null +++ b/example-mod/README.md @@ -0,0 +1,9 @@ +# Example Mod +This is an example of a mod that cane be built using the modding SDK. + +This specific mod adds even more items and blocks to the Creative Inventory. It was originally by [@Bigjango13](https://github.com/bigjango13). + +## The SDK +The modding SDK is a collection of exported CMake targets that allows anyone to create their own MCPI mod! + +It is copied to ``~/.minecraft-pi/sdk/lib/minecraft-pi-reborn-client/sdk/sdk.cmake`` whenever MCPI-Reborn is started. diff --git a/example-mod/expanded-creative.cpp b/example-mod/expanded-creative.cpp new file mode 100644 index 000000000..d3f219645 --- /dev/null +++ b/example-mod/expanded-creative.cpp @@ -0,0 +1,651 @@ +// Headers + +#include +#include +#include + +// The Actual Mod + +static FillingContainer_addItem_t original_mod; +static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(unsigned char *filling_container, ItemInstance *item_instance) { + // Call Original Modified Method + int32_t ret = (*original_mod)(filling_container, item_instance); + + ItemInstance *fire_instance = new ItemInstance; + ALLOC_CHECK(fire_instance); + fire_instance->count = 255; + fire_instance->auxiliary = 0; + fire_instance->id = 51; + (*FillingContainer_addItem)(filling_container, fire_instance); + + ItemInstance *mushroomStew_instance = new ItemInstance; + ALLOC_CHECK(mushroomStew_instance); + mushroomStew_instance->count = 255; + mushroomStew_instance->auxiliary = 0; + mushroomStew_instance->id = 282; + (*FillingContainer_addItem)(filling_container, mushroomStew_instance); + + ItemInstance *steak_instance = new ItemInstance; + ALLOC_CHECK(steak_instance); + steak_instance->count = 255; + steak_instance->auxiliary = 0; + steak_instance->id = 364; + (*FillingContainer_addItem)(filling_container, steak_instance); + + ItemInstance *cookedChicken_instance = new ItemInstance; + ALLOC_CHECK(cookedChicken_instance); + cookedChicken_instance->count = 255; + cookedChicken_instance->auxiliary = 0; + cookedChicken_instance->id = 366; + (*FillingContainer_addItem)(filling_container, cookedChicken_instance); + + ItemInstance *porkCooked_instance = new ItemInstance; + ALLOC_CHECK(porkCooked_instance); + porkCooked_instance->count = 255; + porkCooked_instance->auxiliary = 0; + porkCooked_instance->id = 320; + (*FillingContainer_addItem)(filling_container, porkCooked_instance); + + ItemInstance *apple_instance = new ItemInstance; + ALLOC_CHECK(apple_instance); + apple_instance->count = 255; + apple_instance->auxiliary = 0; + apple_instance->id = 260; + (*FillingContainer_addItem)(filling_container, apple_instance); + + ItemInstance *tallGrass_instance = new ItemInstance; + ALLOC_CHECK(tallGrass_instance); + tallGrass_instance->count = 255; + tallGrass_instance->auxiliary = 0; + tallGrass_instance->id = 31; + (*FillingContainer_addItem)(filling_container, tallGrass_instance); + + ItemInstance *crops_instance = new ItemInstance; + ALLOC_CHECK(crops_instance); + crops_instance->count = 255; + crops_instance->auxiliary = 0; + crops_instance->id = 59; + (*FillingContainer_addItem)(filling_container, crops_instance); + + ItemInstance *farmland_instance = new ItemInstance; + ALLOC_CHECK(farmland_instance); + farmland_instance->count = 255; + farmland_instance->auxiliary = 0; + farmland_instance->id = 60; + (*FillingContainer_addItem)(filling_container, farmland_instance); + + ItemInstance *activeFurnace_instance = new ItemInstance; + ALLOC_CHECK(activeFurnace_instance); + activeFurnace_instance->count = 255; + activeFurnace_instance->auxiliary = 0; + activeFurnace_instance->id = 62; + (*FillingContainer_addItem)(filling_container, activeFurnace_instance); + + ItemInstance *ironDoor_instance = new ItemInstance; + ALLOC_CHECK(ironDoor_instance); + ironDoor_instance->count = 255; + ironDoor_instance->auxiliary = 0; + ironDoor_instance->id = 330; + (*FillingContainer_addItem)(filling_container, ironDoor_instance); + + ItemInstance *activeRedstoneOre_instance = new ItemInstance; + ALLOC_CHECK(activeRedstoneOre_instance); + activeRedstoneOre_instance->count = 255; + activeRedstoneOre_instance->auxiliary = 0; + activeRedstoneOre_instance->id = 74; + (*FillingContainer_addItem)(filling_container, activeRedstoneOre_instance); + + ItemInstance *pumkinStem_instance = new ItemInstance; + ALLOC_CHECK(pumkinStem_instance); + pumkinStem_instance->count = 255; + pumkinStem_instance->auxiliary = 0; + pumkinStem_instance->id = 105; + (*FillingContainer_addItem)(filling_container, pumkinStem_instance); + + ItemInstance *newGrass_instance = new ItemInstance; + ALLOC_CHECK(newGrass_instance); + newGrass_instance->count = 255; + newGrass_instance->auxiliary = 0; + newGrass_instance->id = 253; + (*FillingContainer_addItem)(filling_container, newGrass_instance); + + ItemInstance *reserved6_instance = new ItemInstance; + ALLOC_CHECK(reserved6_instance); + reserved6_instance->count = 255; + reserved6_instance->auxiliary = 0; + reserved6_instance->id = 1; + (*FillingContainer_addItem)(filling_container, reserved6_instance); + + ItemInstance *doubleStoneSlab_instance = new ItemInstance; + ALLOC_CHECK(doubleStoneSlab_instance); + doubleStoneSlab_instance->count = 255; + doubleStoneSlab_instance->auxiliary = 0; + doubleStoneSlab_instance->id = 43; + (*FillingContainer_addItem)(filling_container, doubleStoneSlab_instance); + + ItemInstance *arrow_instance = new ItemInstance; + ALLOC_CHECK(arrow_instance); + arrow_instance->count = 255; + arrow_instance->auxiliary = 0; + arrow_instance->id = 262; + (*FillingContainer_addItem)(filling_container, arrow_instance); + + ItemInstance *coal_instance = new ItemInstance; + ALLOC_CHECK(coal_instance); + coal_instance->count = 255; + coal_instance->auxiliary = 0; + coal_instance->id = 263; + (*FillingContainer_addItem)(filling_container, coal_instance); + + ItemInstance *diamond_instance = new ItemInstance; + ALLOC_CHECK(diamond_instance); + diamond_instance->count = 255; + diamond_instance->auxiliary = 0; + diamond_instance->id = 264; + (*FillingContainer_addItem)(filling_container, diamond_instance); + + ItemInstance *ironIngot_instance = new ItemInstance; + ALLOC_CHECK(ironIngot_instance); + ironIngot_instance->count = 255; + ironIngot_instance->auxiliary = 0; + ironIngot_instance->id = 265; + (*FillingContainer_addItem)(filling_container, ironIngot_instance); + + ItemInstance *goldIngot_instance = new ItemInstance; + ALLOC_CHECK(goldIngot_instance); + goldIngot_instance->count = 255; + goldIngot_instance->auxiliary = 0; + goldIngot_instance->id = 266; + (*FillingContainer_addItem)(filling_container, goldIngot_instance); + + ItemInstance *woodSword_instance = new ItemInstance; + ALLOC_CHECK(woodSword_instance); + woodSword_instance->count = 255; + woodSword_instance->auxiliary = 0; + woodSword_instance->id = 268; + (*FillingContainer_addItem)(filling_container, woodSword_instance); + + ItemInstance *woodShovel_instance = new ItemInstance; + ALLOC_CHECK(woodShovel_instance); + woodShovel_instance->count = 255; + woodShovel_instance->auxiliary = 0; + woodShovel_instance->id = 269; + (*FillingContainer_addItem)(filling_container, woodShovel_instance); + + ItemInstance *woodPickaxe_instance = new ItemInstance; + ALLOC_CHECK(woodPickaxe_instance); + woodPickaxe_instance->count = 255; + woodPickaxe_instance->auxiliary = 0; + woodPickaxe_instance->id = 270; + (*FillingContainer_addItem)(filling_container, woodPickaxe_instance); + + ItemInstance *woodAxe_instance = new ItemInstance; + ALLOC_CHECK(woodAxe_instance); + woodAxe_instance->count = 255; + woodAxe_instance->auxiliary = 0; + woodAxe_instance->id = 271; + (*FillingContainer_addItem)(filling_container, woodAxe_instance); + + ItemInstance *stoneSword_instance = new ItemInstance; + ALLOC_CHECK(stoneSword_instance); + stoneSword_instance->count = 255; + stoneSword_instance->auxiliary = 0; + stoneSword_instance->id = 272; + (*FillingContainer_addItem)(filling_container, stoneSword_instance); + + ItemInstance *stoneShovel_instance = new ItemInstance; + ALLOC_CHECK(stoneShovel_instance); + stoneShovel_instance->count = 255; + stoneShovel_instance->auxiliary = 0; + stoneShovel_instance->id = 273; + (*FillingContainer_addItem)(filling_container, stoneShovel_instance); + + ItemInstance *stonePickaxe_instance = new ItemInstance; + ALLOC_CHECK(stonePickaxe_instance); + stonePickaxe_instance->count = 255; + stonePickaxe_instance->auxiliary = 0; + stonePickaxe_instance->id = 274; + (*FillingContainer_addItem)(filling_container, stonePickaxe_instance); + + ItemInstance *stoneAxe_instance = new ItemInstance; + ALLOC_CHECK(stoneAxe_instance); + stoneAxe_instance->count = 255; + stoneAxe_instance->auxiliary = 0; + stoneAxe_instance->id = 275; + (*FillingContainer_addItem)(filling_container, stoneAxe_instance); + + ItemInstance *shovelIron_instance = new ItemInstance; + ALLOC_CHECK(shovelIron_instance); + shovelIron_instance->count = 255; + shovelIron_instance->auxiliary = 0; + shovelIron_instance->id = 256; + (*FillingContainer_addItem)(filling_container, shovelIron_instance); + + ItemInstance *ironPick_instance = new ItemInstance; + ALLOC_CHECK(ironPick_instance); + ironPick_instance->count = 255; + ironPick_instance->auxiliary = 0; + ironPick_instance->id = 257; + (*FillingContainer_addItem)(filling_container, ironPick_instance); + + ItemInstance *ironAxe_instance = new ItemInstance; + ALLOC_CHECK(ironAxe_instance); + ironAxe_instance->count = 255; + ironAxe_instance->auxiliary = 0; + ironAxe_instance->id = 258; + (*FillingContainer_addItem)(filling_container, ironAxe_instance); + + ItemInstance *diamondSword_instance = new ItemInstance; + ALLOC_CHECK(diamondSword_instance); + diamondSword_instance->count = 255; + diamondSword_instance->auxiliary = 0; + diamondSword_instance->id = 276; + (*FillingContainer_addItem)(filling_container, diamondSword_instance); + + ItemInstance *diamondShovel_instance = new ItemInstance; + ALLOC_CHECK(diamondShovel_instance); + diamondShovel_instance->count = 255; + diamondShovel_instance->auxiliary = 0; + diamondShovel_instance->id = 277; + (*FillingContainer_addItem)(filling_container, diamondShovel_instance); + + ItemInstance *diamondPickaxe_instance = new ItemInstance; + ALLOC_CHECK(diamondPickaxe_instance); + diamondPickaxe_instance->count = 255; + diamondPickaxe_instance->auxiliary = 0; + diamondPickaxe_instance->id = 278; + (*FillingContainer_addItem)(filling_container, diamondPickaxe_instance); + + ItemInstance *diamondAxe_instance = new ItemInstance; + ALLOC_CHECK(diamondAxe_instance); + diamondAxe_instance->count = 255; + diamondAxe_instance->auxiliary = 0; + diamondAxe_instance->id = 279; + (*FillingContainer_addItem)(filling_container, diamondAxe_instance); + + ItemInstance *magicWand_instance = new ItemInstance; + ALLOC_CHECK(magicWand_instance); + magicWand_instance->count = 255; + magicWand_instance->auxiliary = 0; + magicWand_instance->id = 280; + (*FillingContainer_addItem)(filling_container, magicWand_instance); + + ItemInstance *bowl_instance = new ItemInstance; + ALLOC_CHECK(bowl_instance); + bowl_instance->count = 255; + bowl_instance->auxiliary = 0; + bowl_instance->id = 281; + (*FillingContainer_addItem)(filling_container, bowl_instance); + + ItemInstance *goldSword_instance = new ItemInstance; + ALLOC_CHECK(goldSword_instance); + goldSword_instance->count = 255; + goldSword_instance->auxiliary = 0; + goldSword_instance->id = 283; + (*FillingContainer_addItem)(filling_container, goldSword_instance); + + ItemInstance *goldShovel_instance = new ItemInstance; + ALLOC_CHECK(goldShovel_instance); + goldShovel_instance->count = 255; + goldShovel_instance->auxiliary = 0; + goldShovel_instance->id = 284; + (*FillingContainer_addItem)(filling_container, goldShovel_instance); + + ItemInstance *goldPickaxe_instance = new ItemInstance; + ALLOC_CHECK(goldPickaxe_instance); + goldPickaxe_instance->count = 255; + goldPickaxe_instance->auxiliary = 0; + goldPickaxe_instance->id = 285; + (*FillingContainer_addItem)(filling_container, goldPickaxe_instance); + + ItemInstance *goldAxe_instance = new ItemInstance; + ALLOC_CHECK(goldAxe_instance); + goldAxe_instance->count = 255; + goldAxe_instance->auxiliary = 0; + goldAxe_instance->id = 286; + (*FillingContainer_addItem)(filling_container, goldAxe_instance); + + ItemInstance *string_instance = new ItemInstance; + ALLOC_CHECK(string_instance); + string_instance->count = 255; + string_instance->auxiliary = 0; + string_instance->id = 287; + (*FillingContainer_addItem)(filling_container, string_instance); + + ItemInstance *feather_instance = new ItemInstance; + ALLOC_CHECK(feather_instance); + feather_instance->count = 255; + feather_instance->auxiliary = 0; + feather_instance->id = 288; + (*FillingContainer_addItem)(filling_container, feather_instance); + + ItemInstance *gunpowder_instance = new ItemInstance; + ALLOC_CHECK(gunpowder_instance); + gunpowder_instance->count = 255; + gunpowder_instance->auxiliary = 0; + gunpowder_instance->id = 289; + (*FillingContainer_addItem)(filling_container, gunpowder_instance); + + ItemInstance *woodHoe_instance = new ItemInstance; + ALLOC_CHECK(woodHoe_instance); + woodHoe_instance->count = 255; + woodHoe_instance->auxiliary = 0; + woodHoe_instance->id = 290; + (*FillingContainer_addItem)(filling_container, woodHoe_instance); + + ItemInstance *stoneHoe_instance = new ItemInstance; + ALLOC_CHECK(stoneHoe_instance); + stoneHoe_instance->count = 255; + stoneHoe_instance->auxiliary = 0; + stoneHoe_instance->id = 291; + (*FillingContainer_addItem)(filling_container, stoneHoe_instance); + + ItemInstance *flint1_instance = new ItemInstance; + ALLOC_CHECK(flint1_instance); + flint1_instance->count = 255; + flint1_instance->auxiliary = 0; + flint1_instance->id = 292; + (*FillingContainer_addItem)(filling_container, flint1_instance); + + ItemInstance *diamondHoe_instance = new ItemInstance; + ALLOC_CHECK(diamondHoe_instance); + diamondHoe_instance->count = 255; + diamondHoe_instance->auxiliary = 0; + diamondHoe_instance->id = 293; + (*FillingContainer_addItem)(filling_container, diamondHoe_instance); + + ItemInstance *goldHoe_instance = new ItemInstance; + ALLOC_CHECK(goldHoe_instance); + goldHoe_instance->count = 255; + goldHoe_instance->auxiliary = 0; + goldHoe_instance->id = 294; + (*FillingContainer_addItem)(filling_container, goldHoe_instance); + + ItemInstance *seeds_instance = new ItemInstance; + ALLOC_CHECK(seeds_instance); + seeds_instance->count = 255; + seeds_instance->auxiliary = 0; + seeds_instance->id = 295; + (*FillingContainer_addItem)(filling_container, seeds_instance); + + ItemInstance *wheat_instance = new ItemInstance; + ALLOC_CHECK(wheat_instance); + wheat_instance->count = 255; + wheat_instance->auxiliary = 0; + wheat_instance->id = 296; + (*FillingContainer_addItem)(filling_container, wheat_instance); + + ItemInstance *bread_instance = new ItemInstance; + ALLOC_CHECK(bread_instance); + bread_instance->count = 255; + bread_instance->auxiliary = 0; + bread_instance->id = 297; + (*FillingContainer_addItem)(filling_container, bread_instance); + + ItemInstance *diamondHelm_instance = new ItemInstance; + ALLOC_CHECK(diamondHelm_instance); + diamondHelm_instance->count = 255; + diamondHelm_instance->auxiliary = 0; + diamondHelm_instance->id = 310; + (*FillingContainer_addItem)(filling_container, diamondHelm_instance); + + ItemInstance *diamondChest_instance = new ItemInstance; + ALLOC_CHECK(diamondChest_instance); + diamondChest_instance->count = 255; + diamondChest_instance->auxiliary = 0; + diamondChest_instance->id = 311; + (*FillingContainer_addItem)(filling_container, diamondChest_instance); + + ItemInstance *diamondLeg_instance = new ItemInstance; + ALLOC_CHECK(diamondLeg_instance); + diamondLeg_instance->count = 255; + diamondLeg_instance->auxiliary = 0; + diamondLeg_instance->id = 312; + (*FillingContainer_addItem)(filling_container, diamondLeg_instance); + + ItemInstance *diamondBoot_instance = new ItemInstance; + ALLOC_CHECK(diamondBoot_instance); + diamondBoot_instance->count = 255; + diamondBoot_instance->auxiliary = 0; + diamondBoot_instance->id = 313; + (*FillingContainer_addItem)(filling_container, diamondBoot_instance); + + ItemInstance *leatherCap_instance = new ItemInstance; + ALLOC_CHECK(leatherCap_instance); + leatherCap_instance->count = 255; + leatherCap_instance->auxiliary = 0; + leatherCap_instance->id = 298; + (*FillingContainer_addItem)(filling_container, leatherCap_instance); + + ItemInstance *leatherShirt_instance = new ItemInstance; + ALLOC_CHECK(leatherShirt_instance); + leatherShirt_instance->count = 255; + leatherShirt_instance->auxiliary = 0; + leatherShirt_instance->id = 299; + (*FillingContainer_addItem)(filling_container, leatherShirt_instance); + + ItemInstance *leatherPants_instance = new ItemInstance; + ALLOC_CHECK(leatherPants_instance); + leatherPants_instance->count = 255; + leatherPants_instance->auxiliary = 0; + leatherPants_instance->id = 300; + (*FillingContainer_addItem)(filling_container, leatherPants_instance); + + ItemInstance *leatherBoots_instance = new ItemInstance; + ALLOC_CHECK(leatherBoots_instance); + leatherBoots_instance->count = 255; + leatherBoots_instance->auxiliary = 0; + leatherBoots_instance->id = 301; + (*FillingContainer_addItem)(filling_container, leatherBoots_instance); + + ItemInstance *chainHelm_instance = new ItemInstance; + ALLOC_CHECK(chainHelm_instance); + chainHelm_instance->count = 255; + chainHelm_instance->auxiliary = 0; + chainHelm_instance->id = 302; + (*FillingContainer_addItem)(filling_container, chainHelm_instance); + + ItemInstance *chainShirt_instance = new ItemInstance; + ALLOC_CHECK(chainShirt_instance); + chainShirt_instance->count = 255; + chainShirt_instance->auxiliary = 0; + chainShirt_instance->id = 303; + (*FillingContainer_addItem)(filling_container, chainShirt_instance); + + ItemInstance *chainLegs_instance = new ItemInstance; + ALLOC_CHECK(chainLegs_instance); + chainLegs_instance->count = 255; + chainLegs_instance->auxiliary = 0; + chainLegs_instance->id = 304; + (*FillingContainer_addItem)(filling_container, chainLegs_instance); + + ItemInstance *chainBoots_instance = new ItemInstance; + ALLOC_CHECK(chainBoots_instance); + chainBoots_instance->count = 255; + chainBoots_instance->auxiliary = 0; + chainBoots_instance->id = 305; + (*FillingContainer_addItem)(filling_container, chainBoots_instance); + + ItemInstance *goldHelm_instance = new ItemInstance; + ALLOC_CHECK(goldHelm_instance); + goldHelm_instance->count = 255; + goldHelm_instance->auxiliary = 0; + goldHelm_instance->id = 314; + (*FillingContainer_addItem)(filling_container, goldHelm_instance); + + ItemInstance *goldChest_instance = new ItemInstance; + ALLOC_CHECK(goldChest_instance); + goldChest_instance->count = 255; + goldChest_instance->auxiliary = 0; + goldChest_instance->id = 315; + (*FillingContainer_addItem)(filling_container, goldChest_instance); + + ItemInstance *goldLegs_instance = new ItemInstance; + ALLOC_CHECK(goldLegs_instance); + goldLegs_instance->count = 255; + goldLegs_instance->auxiliary = 0; + goldLegs_instance->id = 316; + (*FillingContainer_addItem)(filling_container, goldLegs_instance); + + ItemInstance *goldBoots_instance = new ItemInstance; + ALLOC_CHECK(goldBoots_instance); + goldBoots_instance->count = 255; + goldBoots_instance->auxiliary = 0; + goldBoots_instance->id = 317; + (*FillingContainer_addItem)(filling_container, goldBoots_instance); + + ItemInstance *ironHelm_instance = new ItemInstance; + ALLOC_CHECK(ironHelm_instance); + ironHelm_instance->count = 255; + ironHelm_instance->auxiliary = 0; + ironHelm_instance->id = 306; + (*FillingContainer_addItem)(filling_container, ironHelm_instance); + + ItemInstance *ironChest_instance = new ItemInstance; + ALLOC_CHECK(ironChest_instance); + ironChest_instance->count = 255; + ironChest_instance->auxiliary = 0; + ironChest_instance->id = 307; + (*FillingContainer_addItem)(filling_container, ironChest_instance); + + ItemInstance *ironLegs_instance = new ItemInstance; + ALLOC_CHECK(ironLegs_instance); + ironLegs_instance->count = 255; + ironLegs_instance->auxiliary = 0; + ironLegs_instance->id = 308; + (*FillingContainer_addItem)(filling_container, ironLegs_instance); + + ItemInstance *ironBoots_instance = new ItemInstance; + ALLOC_CHECK(ironBoots_instance); + ironBoots_instance->count = 255; + ironBoots_instance->auxiliary = 0; + ironBoots_instance->id = 309; + (*FillingContainer_addItem)(filling_container, ironBoots_instance); + + ItemInstance *flint2_instance = new ItemInstance; + ALLOC_CHECK(flint2_instance); + flint2_instance->count = 255; + flint2_instance->auxiliary = 0; + flint2_instance->id = 318; + (*FillingContainer_addItem)(filling_container, flint2_instance); + + ItemInstance *porkRaw_instance = new ItemInstance; + ALLOC_CHECK(porkRaw_instance); + porkRaw_instance->count = 255; + porkRaw_instance->auxiliary = 0; + porkRaw_instance->id = 319; + (*FillingContainer_addItem)(filling_container, porkRaw_instance); + + ItemInstance *leather_instance = new ItemInstance; + ALLOC_CHECK(leather_instance); + leather_instance->count = 255; + leather_instance->auxiliary = 0; + leather_instance->id = 334; + (*FillingContainer_addItem)(filling_container, leather_instance); + + ItemInstance *clayBrick_instance = new ItemInstance; + ALLOC_CHECK(clayBrick_instance); + clayBrick_instance->count = 255; + clayBrick_instance->auxiliary = 0; + clayBrick_instance->id = 336; + (*FillingContainer_addItem)(filling_container, clayBrick_instance); + + ItemInstance *clay_instance = new ItemInstance; + ALLOC_CHECK(clay_instance); + clay_instance->count = 255; + clay_instance->auxiliary = 0; + clay_instance->id = 337; + (*FillingContainer_addItem)(filling_container, clay_instance); + + ItemInstance *notepad_instance = new ItemInstance; + ALLOC_CHECK(notepad_instance); + notepad_instance->count = 255; + notepad_instance->auxiliary = 0; + notepad_instance->id = 339; + (*FillingContainer_addItem)(filling_container, notepad_instance); + + ItemInstance *book_instance = new ItemInstance; + ALLOC_CHECK(book_instance); + book_instance->count = 255; + book_instance->auxiliary = 0; + book_instance->id = 340; + (*FillingContainer_addItem)(filling_container, book_instance); + + ItemInstance *slimeball_instance = new ItemInstance; + ALLOC_CHECK(slimeball_instance); + slimeball_instance->count = 255; + slimeball_instance->auxiliary = 0; + slimeball_instance->id = 341; + (*FillingContainer_addItem)(filling_container, slimeball_instance); + + ItemInstance *compass_instance = new ItemInstance; + ALLOC_CHECK(compass_instance); + compass_instance->count = 255; + compass_instance->auxiliary = 0; + compass_instance->id = 345; + (*FillingContainer_addItem)(filling_container, compass_instance); + + ItemInstance *clock_instance = new ItemInstance; + ALLOC_CHECK(clock_instance); + clock_instance->count = 255; + clock_instance->auxiliary = 0; + clock_instance->id = 347; + (*FillingContainer_addItem)(filling_container, clock_instance); + + ItemInstance *glowDust_instance = new ItemInstance; + ALLOC_CHECK(glowDust_instance); + glowDust_instance->count = 255; + glowDust_instance->auxiliary = 0; + glowDust_instance->id = 348; + (*FillingContainer_addItem)(filling_container, glowDust_instance); + + ItemInstance *bone_instance = new ItemInstance; + ALLOC_CHECK(bone_instance); + bone_instance->count = 255; + bone_instance->auxiliary = 0; + bone_instance->id = 352; + (*FillingContainer_addItem)(filling_container, bone_instance); + + ItemInstance *sugar_instance = new ItemInstance; + ALLOC_CHECK(sugar_instance); + sugar_instance->count = 255; + sugar_instance->auxiliary = 0; + sugar_instance->id = 353; + (*FillingContainer_addItem)(filling_container, sugar_instance); + + ItemInstance *melon_instance = new ItemInstance; + ALLOC_CHECK(melon_instance); + melon_instance->count = 255; + melon_instance->auxiliary = 0; + melon_instance->id = 360; + (*FillingContainer_addItem)(filling_container, melon_instance); + + ItemInstance *beefRaw_instance = new ItemInstance; + ALLOC_CHECK(beefRaw_instance); + beefRaw_instance->count = 255; + beefRaw_instance->auxiliary = 0; + beefRaw_instance->id = 363; + (*FillingContainer_addItem)(filling_container, beefRaw_instance); + + ItemInstance *chickenRaw_instance = new ItemInstance; + ALLOC_CHECK(chickenRaw_instance); + chickenRaw_instance->count = 255; + chickenRaw_instance->auxiliary = 0; + chickenRaw_instance->id = 365; + (*FillingContainer_addItem)(filling_container, chickenRaw_instance); + + // Return + return ret; +} + +// Init +HOOK(init_creative, void, ()) { + ensure_init_creative(); + (*real_init_creative)(); + + INFO("Loading Expanded Creative Mod"); + + void *point = (void *) 0x8e0fc; + original_mod = (FillingContainer_addItem_t) extract_from_bl_instruction((unsigned char *) point); + overwrite_call(point, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection); +} diff --git a/launcher/src/bootstrap.c b/launcher/src/bootstrap.c index 39df1910c..5b304ad4e 100644 --- a/launcher/src/bootstrap.c +++ b/launcher/src/bootstrap.c @@ -225,6 +225,48 @@ void pre_bootstrap(int argc, char *argv[]) { sigaction(SIGTERM, &act_sigterm, NULL); } +// Copy SDK Into ~/.minecraft-pi +static void run_simple_command(const char *const command[], const char *error) { + int status = 0; + char *output = run_command(command, &status); + if (output != NULL) { + free(output); + } + if (!is_exit_status_success(status)) { + ERR("%s", error); + } +} +static void copy_sdk(char *binary_directory) { + // Output Directory + char *output = NULL; + safe_asprintf(&output, "%s" HOME_SUBDIRECTORY_FOR_GAME_DATA "/sdk/" MCPI_SDK_DIR, getenv("HOME")); + // Source Directory + char *source = NULL; + safe_asprintf(&source, "%s/sdk/.", binary_directory); + + // Clean + { + const char *const command[] = {"rm", "-rf", output, NULL}; + run_simple_command(command, "Unable To Clean SDK Output Directory"); + } + + // Make Directory + { + const char *const command[] = {"mkdir", "-p", output, NULL}; + run_simple_command(command, "Unable To Create SDK Output Directory"); + } + + // Copy + { + const char *const command[] = {"cp", "-ar", source, output, NULL}; + run_simple_command(command, "Unable To Copy SDK"); + } + + // Free + free(output); + free(source); +} + // Bootstrap void bootstrap(int argc, char *argv[]) { INFO("Configuring Game..."); @@ -232,6 +274,9 @@ void bootstrap(int argc, char *argv[]) { // Get Binary Directory char *binary_directory = get_binary_directory(); + // Copy SDK + copy_sdk(binary_directory); + // Set MCPI_REBORN_ASSETS_PATH { char *assets_path = realpath("/proc/self/exe", NULL); diff --git a/libreborn/CMakeLists.txt b/libreborn/CMakeLists.txt index 6f713b0dc..a08a2e3bd 100644 --- a/libreborn/CMakeLists.txt +++ b/libreborn/CMakeLists.txt @@ -6,7 +6,13 @@ configure_file(include/libreborn/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/includ # Util add_library(reborn-util STATIC src/util/elf.c src/util/exec.c src/util/string.c src/util/util.c) -target_include_directories(reborn-util PUBLIC include PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") +target_include_directories( + reborn-util + PUBLIC + "$" + "$" + "$" +) # Patch if(BUILD_ARM_COMPONENTS) @@ -15,4 +21,9 @@ if(BUILD_ARM_COMPONENTS) target_compile_definitions(reborn-patch PUBLIC -DREBORN_HAS_PATCH_CODE) # Install install(TARGETS reborn-patch DESTINATION "${MCPI_LIB_DIR}") + # SDK + install(TARGETS reborn-patch EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") + install(TARGETS reborn-util EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") + install(DIRECTORY "include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/libreborn") + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/libreborn") endif() diff --git a/libreborn/include/libreborn/config.h.in b/libreborn/include/libreborn/config.h.in index cb738ebcd..50a81d08f 100644 --- a/libreborn/include/libreborn/config.h.in +++ b/libreborn/include/libreborn/config.h.in @@ -7,3 +7,4 @@ #cmakedefine MCPI_USE_GLES1_COMPATIBILITY_LAYER #cmakedefine MCPI_APP_TITLE "@MCPI_APP_TITLE@" #cmakedefine MCPI_VERSION "@MCPI_VERSION@" +#cmakedefine MCPI_SDK_DIR "@MCPI_SDK_DIR@" diff --git a/libreborn/include/libreborn/patch.h b/libreborn/include/libreborn/patch.h index 268e60e80..06e5403ce 100644 --- a/libreborn/include/libreborn/patch.h +++ b/libreborn/include/libreborn/patch.h @@ -14,6 +14,8 @@ void _overwrite_call(const char *file, int line, void *start, void *target); void _overwrite_calls(const char *file, int line, void *start, void *target); #define overwrite_calls(start, target) _overwrite_calls(__FILE__, __LINE__, start, target); +void *extract_from_bl_instruction(unsigned char *from); + void _overwrite(const char *file, int line, void *start, void *target); #define overwrite(start, target) _overwrite(__FILE__, __LINE__, start, target); diff --git a/libreborn/src/patch/patch.c b/libreborn/src/patch/patch.c index 91ffcea98..cef815690 100644 --- a/libreborn/src/patch/patch.c +++ b/libreborn/src/patch/patch.c @@ -91,7 +91,7 @@ static void increment_code_block() { code_block_remaining = code_block_remaining - CODE_SIZE; } -// Overwrite Specific BL Instruction +// Overwrite Specific B(L) Instruction void _overwrite_call(const char *file, int line, void *start, void *target) { // Add New Target To Code Block update_code_block(target); @@ -105,7 +105,7 @@ void _overwrite_call(const char *file, int line, void *start, void *target) { increment_code_block(); } -// Overwrite Function Calls +// Overwrite All B(L) Intrusctions That Target The Specified Address void _overwrite_calls(const char *file, int line, void *start, void *target) { // Add New Target To Code Block update_code_block(target); @@ -128,6 +128,21 @@ void _overwrite_calls(const char *file, int line, void *start, void *target) { } } +// Extract Target Address From B(L) Instruction +void *extract_from_bl_instruction(unsigned char *from) { + unsigned char *pc = ((unsigned char *) from) + 8; + + int32_t target = 0; + unsigned char *target_array = (unsigned char *) ⌖ + target_array[0] = from[0]; + target_array[1] = from[1]; + target_array[2] = from[2]; + + int32_t offset = target << 2; + + return (void *) (pc + offset); +} + // Overwrite Function // NOTE: "start" Must Be At Least 8 Bytes Long void _overwrite(const char *file, int line, void *start, void *target) { diff --git a/media-layer/CMakeLists.txt b/media-layer/CMakeLists.txt index 260331514..8900ad414 100644 --- a/media-layer/CMakeLists.txt +++ b/media-layer/CMakeLists.txt @@ -6,7 +6,17 @@ project(media-layer) # Add Headers add_library(media-layer-headers INTERFACE) -target_include_directories(media-layer-headers INTERFACE include) +target_include_directories( + media-layer-headers + INTERFACE + "$" + "$" +) +# SDK +if(BUILD_ARM_COMPONENTS) + install(TARGETS media-layer-headers EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") + install(DIRECTORY "include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/media-layer") +endif() # Add GLESv1_CM Stubs Or Compatibility Layer add_subdirectory(gles) diff --git a/media-layer/core/CMakeLists.txt b/media-layer/core/CMakeLists.txt index 0990fb349..d09cc408c 100644 --- a/media-layer/core/CMakeLists.txt +++ b/media-layer/core/CMakeLists.txt @@ -17,19 +17,21 @@ if(NOT MCPI_USE_MEDIA_LAYER_PROXY AND BUILD_ARM_COMPONENTS) set_target_properties(media-layer-core-real PROPERTIES OUTPUT_NAME "media-layer-core") # Install install(TARGETS media-layer-core-real DESTINATION "${MCPI_LIB_DIR}") + install(TARGETS media-layer-core-real EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") # Create Alias Target For Linking add_library(media-layer-core ALIAS media-layer-core-real) + set_target_properties(media-layer-core-real PROPERTIES EXPORT_NAME media-layer-core) endif() # Configure Media Layer Core If Built if(TARGET media-layer-core-real) # Link - target_link_libraries(media-layer-core-real media-layer-headers reborn-util pthread dl) + target_link_libraries(media-layer-core-real PUBLIC media-layer-headers PUBLIC reborn-util PUBLIC pthread PUBLIC dl) if(NOT MCPI_HEADLESS_MODE) # OpenAL find_library(OPENAL_LIBRARY NAMES openal REQUIRED) # Link - target_link_libraries(media-layer-core-real png12_static "${OPENAL_LIBRARY}" m GLESv1_CM glfw) + target_link_libraries(media-layer-core-real PRIVATE png12_static PRIVATE "${OPENAL_LIBRARY}" PRIVATE m PUBLIC GLESv1_CM PRIVATE glfw) endif() endif() diff --git a/media-layer/gles/CMakeLists.txt b/media-layer/gles/CMakeLists.txt index 1426959bb..b690e2a80 100644 --- a/media-layer/gles/CMakeLists.txt +++ b/media-layer/gles/CMakeLists.txt @@ -19,8 +19,12 @@ else() # Add GLESv1_CM Stubs For Linking add_library(GLESv1_CM SHARED src/stubs.c) # Install Fake GLESv1_CM Stubs In Server Mode - if(MCPI_HEADLESS_MODE AND BUILD_ARM_COMPONENTS) - install(TARGETS GLESv1_CM DESTINATION "${MCPI_LIB_DIR}") + if(BUILD_ARM_COMPONENTS) + if(MCPI_HEADLESS_MODE) + install(TARGETS GLESv1_CM DESTINATION "${MCPI_LIB_DIR}") + endif() + # SDK + install(TARGETS GLESv1_CM EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") endif() endif() diff --git a/media-layer/proxy/CMakeLists.txt b/media-layer/proxy/CMakeLists.txt index ecacb6700..8ae9d0da5 100644 --- a/media-layer/proxy/CMakeLists.txt +++ b/media-layer/proxy/CMakeLists.txt @@ -22,6 +22,8 @@ if(BUILD_ARM_COMPONENTS) install_symlink("libmedia-layer-core.so" "${MCPI_LIB_DIR}/libGLESv1_CM.so.1") # Install install(TARGETS media-layer-proxy-server DESTINATION "${MCPI_LIB_DIR}") + install(TARGETS media-layer-proxy-server EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") # Create Alias Target For Linking add_library(media-layer-core ALIAS media-layer-proxy-server) + set_target_properties(media-layer-proxy-server PROPERTIES EXPORT_NAME media-layer-core) endif() diff --git a/mods/CMakeLists.txt b/mods/CMakeLists.txt index 6a3d7df74..28e330929 100644 --- a/mods/CMakeLists.txt +++ b/mods/CMakeLists.txt @@ -1,30 +1,42 @@ project(mods) +## Headers +add_library(mods-headers INTERFACE) +target_include_directories( + mods-headers + INTERFACE + "$" + "$" +) +# SDK +install(TARGETS mods-headers EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") +install(DIRECTORY "include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/mods") + ## Mods add_library(compat SHARED src/compat/compat.c src/compat/egl.c src/compat/x11.c src/compat/bcm_host.c) -target_link_libraries(compat reborn-patch media-layer-core) +target_link_libraries(compat mods-headers reborn-patch media-layer-core) add_library(readdir SHARED src/readdir/readdir.c) add_library(feature SHARED src/feature/feature.c) -target_link_libraries(feature reborn-patch) +target_link_libraries(feature mods-headers reborn-patch) add_library(version SHARED src/version/version.cpp) -target_link_libraries(version reborn-patch symbols) +target_link_libraries(version mods-headers reborn-patch symbols) add_library(chat SHARED src/chat/chat.cpp src/chat/ui.c) -target_link_libraries(chat reborn-patch symbols feature) +target_link_libraries(chat mods-headers reborn-patch symbols feature) add_library(creative SHARED src/creative/creative.cpp) -target_link_libraries(creative reborn-patch symbols feature) +target_link_libraries(creative mods-headers reborn-patch symbols feature) add_library(game-mode SHARED src/game-mode/game-mode.c src/game-mode/ui.cpp) -target_link_libraries(game-mode reborn-patch symbols feature) +target_link_libraries(game-mode mods-headers reborn-patch symbols feature) if(MCPI_SERVER_MODE) add_library(server SHARED src/server/server.cpp src/server/server_properties.cpp) - target_link_libraries(server reborn-patch symbols feature home misc compat dl media-layer-core pthread) + target_link_libraries(server mods-headers reborn-patch symbols feature home misc compat dl media-layer-core pthread) else() target_link_libraries(compat input sign chat home dl) @@ -33,53 +45,53 @@ else() target_link_libraries(game-mode pthread media-layer-core) add_library(multiplayer SHARED src/multiplayer/multiplayer.cpp) - target_link_libraries(multiplayer reborn-patch symbols home feature) + target_link_libraries(multiplayer mods-headers reborn-patch symbols home feature) add_library(sound SHARED src/sound/sound.cpp src/sound/repository.cpp) - target_link_libraries(sound reborn-patch symbols feature override media-layer-core) + target_link_libraries(sound mods-headers reborn-patch symbols feature override media-layer-core) add_library(camera SHARED src/camera/camera.cpp) - target_link_libraries(camera reborn-patch symbols media-layer-core feature home) + target_link_libraries(camera mods-headers reborn-patch symbols media-layer-core feature home) add_library(input SHARED src/input/input.cpp src/input/bow.c src/input/attack.c src/input/toggle.c src/input/misc.c src/input/drop.cpp) - target_link_libraries(input reborn-patch symbols creative feature media-layer-core) + target_link_libraries(input mods-headers reborn-patch symbols creative feature media-layer-core) add_library(sign SHARED src/sign/sign.cpp) - target_link_libraries(sign reborn-patch symbols feature input) + target_link_libraries(sign mods-headers reborn-patch symbols feature input) add_library(touch SHARED src/touch/touch.cpp) - target_link_libraries(touch reborn-patch symbols feature) + target_link_libraries(touch mods-headers reborn-patch symbols feature) add_library(override SHARED src/override/override.c) - target_link_libraries(override reborn-patch symbols dl home) + target_link_libraries(override mods-headers reborn-patch symbols dl home) add_library(textures SHARED src/textures/textures.cpp) - target_link_libraries(textures reborn-patch symbols media-layer-core feature misc) + target_link_libraries(textures mods-headers reborn-patch symbols media-layer-core feature misc) add_library(atlas SHARED src/atlas/atlas.cpp) - target_link_libraries(atlas reborn-patch symbols feature GLESv1_CM) + target_link_libraries(atlas mods-headers reborn-patch symbols feature GLESv1_CM) add_library(benchmark SHARED src/benchmark/benchmark.cpp) - target_link_libraries(benchmark reborn-patch symbols compat misc media-layer-core) + target_link_libraries(benchmark mods-headers reborn-patch symbols compat misc media-layer-core) endif() add_library(death SHARED src/death/death.cpp) -target_link_libraries(death reborn-patch symbols feature) +target_link_libraries(death mods-headers reborn-patch symbols feature) add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp src/misc/logging.cpp) -target_link_libraries(misc reborn-patch symbols media-layer-core feature GLESv1_CM) +target_link_libraries(misc mods-headers reborn-patch symbols media-layer-core feature GLESv1_CM) add_library(options SHARED src/options/options.c src/options/options.cpp) -target_link_libraries(options reborn-patch symbols feature home) +target_link_libraries(options mods-headers reborn-patch symbols feature home) add_library(home SHARED src/home/home.c) -target_link_libraries(home reborn-patch symbols) +target_link_libraries(home mods-headers reborn-patch symbols) add_library(test SHARED src/test/test.c) -target_link_libraries(test reborn-patch home) +target_link_libraries(test mods-headers reborn-patch home) add_library(init SHARED src/init/init.c) -target_link_libraries(init compat game-mode misc death options chat creative home version test media-layer-core) +target_link_libraries(init mods-headers compat game-mode misc death options chat creative home version test media-layer-core) if(MCPI_SERVER_MODE) target_link_libraries(init server) else() @@ -87,9 +99,12 @@ else() endif() ## Install Mods -install(TARGETS init compat readdir feature game-mode misc death options chat creative home version test DESTINATION "${MCPI_INSTALL_DIR}/mods") +set(MODS_TO_INSTALL init compat readdir feature game-mode misc death options chat creative home version test) if(MCPI_SERVER_MODE) - install(TARGETS server DESTINATION "${MCPI_INSTALL_DIR}/mods") + list(APPEND MODS_TO_INSTALL server) else() - install(TARGETS multiplayer sound override camera input sign touch textures atlas benchmark DESTINATION "${MCPI_INSTALL_DIR}/mods") + list(APPEND MODS_TO_INSTALL multiplayer sound override camera input sign touch textures atlas benchmark) endif() +install(TARGETS ${MODS_TO_INSTALL} DESTINATION "${MCPI_INSTALL_DIR}/mods") +# SDK +install(TARGETS ${MODS_TO_INSTALL} EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") diff --git a/mods/include/mods/chat/chat.h b/mods/include/mods/chat/chat.h new file mode 100644 index 000000000..4e2a90d02 --- /dev/null +++ b/mods/include/mods/chat/chat.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MCPI_SERVER_MODE +void chat_open(); +unsigned int chat_get_counter(); +#endif + +// Override using the HOOK() macro to provide customized chat behavior. +void chat_send_message(unsigned char *server_side_network_handler, char *username, char *message); + +#ifdef __cplusplus +} +#endif diff --git a/mods/src/compat/compat.h b/mods/include/mods/compat/compat.h similarity index 100% rename from mods/src/compat/compat.h rename to mods/include/mods/compat/compat.h diff --git a/mods/src/creative/creative.h b/mods/include/mods/creative/creative.h similarity index 100% rename from mods/src/creative/creative.h rename to mods/include/mods/creative/creative.h diff --git a/mods/src/feature/feature.h b/mods/include/mods/feature/feature.h similarity index 100% rename from mods/src/feature/feature.h rename to mods/include/mods/feature/feature.h diff --git a/mods/src/home/home.h b/mods/include/mods/home/home.h similarity index 100% rename from mods/src/home/home.h rename to mods/include/mods/home/home.h diff --git a/mods/src/init/init.h b/mods/include/mods/init/init.h similarity index 100% rename from mods/src/init/init.h rename to mods/include/mods/init/init.h diff --git a/mods/src/input/input.h b/mods/include/mods/input/input.h similarity index 58% rename from mods/src/input/input.h rename to mods/include/mods/input/input.h index 83fe11026..1771a2faf 100644 --- a/mods/src/input/input.h +++ b/mods/include/mods/input/input.h @@ -17,12 +17,6 @@ void input_set_is_left_click(int val); void input_set_mouse_grab_state(int state); -__attribute__((visibility("internal"))) void _init_attack(); -__attribute__((visibility("internal"))) void _init_bow(); -__attribute__((visibility("internal"))) void _init_misc(); -__attribute__((visibility("internal"))) void _init_toggle(); -__attribute__((visibility("internal"))) void _init_drop(); - #ifdef __cplusplus } #endif diff --git a/mods/src/misc/misc.h b/mods/include/mods/misc/misc.h similarity index 71% rename from mods/src/misc/misc.h rename to mods/include/mods/misc/misc.h index 66d1a44e3..efcf61222 100644 --- a/mods/src/misc/misc.h +++ b/mods/include/mods/misc/misc.h @@ -10,9 +10,6 @@ void misc_run_on_tick(misc_update_function_t function); void Level_saveLevelData_injection(unsigned char *level); -__attribute__((visibility("internal"))) void _init_misc_cpp(); -__attribute__((visibility("internal"))) void _init_misc_logging(); - #ifdef __cplusplus } #endif diff --git a/mods/src/override/override.h b/mods/include/mods/override/override.h similarity index 100% rename from mods/src/override/override.h rename to mods/include/mods/override/override.h diff --git a/mods/src/server/server_properties.h b/mods/include/mods/server/server_properties.h similarity index 100% rename from mods/src/server/server_properties.h rename to mods/include/mods/server/server_properties.h diff --git a/mods/src/sign/sign.h b/mods/include/mods/sign/sign.h similarity index 100% rename from mods/src/sign/sign.h rename to mods/include/mods/sign/sign.h diff --git a/mods/src/version/version.h b/mods/include/mods/version/version.h similarity index 100% rename from mods/src/version/version.h rename to mods/include/mods/version/version.h diff --git a/mods/src/atlas/atlas.cpp b/mods/src/atlas/atlas.cpp index f0c883717..acaa233a0 100644 --- a/mods/src/atlas/atlas.cpp +++ b/mods/src/atlas/atlas.cpp @@ -3,8 +3,8 @@ #include #include -#include "../feature/feature.h" -#include "../init/init.h" +#include +#include // Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled static void ItemRenderer_renderGuiItemCorrect_injection(unsigned char *font, unsigned char *textures, ItemInstance *item_instance, int32_t param_1, int32_t param_2) { diff --git a/mods/src/benchmark/benchmark.cpp b/mods/src/benchmark/benchmark.cpp index 62f75679b..b71715831 100644 --- a/mods/src/benchmark/benchmark.cpp +++ b/mods/src/benchmark/benchmark.cpp @@ -6,9 +6,9 @@ #include #include -#include "../init/init.h" -#include "../compat/compat.h" -#include "../misc/misc.h" +#include +#include +#include // --benchmark: Activate Benchmark static bool active = false; diff --git a/mods/src/camera/camera.cpp b/mods/src/camera/camera.cpp index 2679fd5be..f00b69328 100644 --- a/mods/src/camera/camera.cpp +++ b/mods/src/camera/camera.cpp @@ -2,9 +2,9 @@ #include #include -#include "../feature/feature.h" -#include "../home/home.h" -#include "../init/init.h" +#include +#include +#include // Take Screenshot Using TripodCamera static void AppPlatform_linux_saveScreenshot_injection(__attribute__((unused)) unsigned char *app_platform, __attribute__((unused)) std::string const& path, __attribute__((unused)) int32_t width, __attribute__((unused)) int32_t height) { diff --git a/mods/src/chat/chat.h b/mods/src/chat/chat-internal.h similarity index 66% rename from mods/src/chat/chat.h rename to mods/src/chat/chat-internal.h index 8c8d6debf..436d6b49e 100644 --- a/mods/src/chat/chat.h +++ b/mods/src/chat/chat-internal.h @@ -6,15 +6,10 @@ extern "C" { #endif -#ifndef MCPI_SERVER_MODE -void chat_open(); -unsigned int chat_get_counter(); -#endif // #ifndef MCPI_SERVER_MODE - __attribute__((visibility("internal"))) extern int _chat_enabled; #ifndef MCPI_SERVER_MODE __attribute__((visibility("internal"))) void _chat_queue_message(char *message); -#endif // #ifndef MCPI_SERVER_MODE +#endif #ifdef __cplusplus } diff --git a/mods/src/chat/chat.cpp b/mods/src/chat/chat.cpp index 284a48bfa..92022f7bd 100644 --- a/mods/src/chat/chat.cpp +++ b/mods/src/chat/chat.cpp @@ -14,12 +14,13 @@ #include #endif -#include "../init/init.h" -#include "../feature/feature.h" +#include +#include #ifndef MCPI_SERVER_MODE -#include "../input/input.h" +#include #endif -#include "chat.h" +#include "chat-internal.h" +#include // Store If Chat is Enabled int _chat_enabled = 0; @@ -49,7 +50,7 @@ static void send_api_chat_command(unsigned char *minecraft, char *str) { #endif // Send Message To Players -static void send_message(unsigned char *server_side_network_handler, char *username, char *message) { +void chat_send_message(unsigned char *server_side_network_handler, char *username, char *message) { char *full_message = NULL; safe_asprintf(&full_message, "<%s> %s", username, message); sanitize_string(&full_message, MAX_CHAT_MESSAGE_LENGTH, 0); @@ -68,7 +69,7 @@ static void CommandServer_parse_CommandServer_dispatchPacket_injection(unsigned // Hosting Multiplayer char *message = *(char **) (packet + ChatPacket_message_property_offset); unsigned char *server_side_network_handler = *(unsigned char **) (minecraft + Minecraft_network_handler_property_offset); - send_message(server_side_network_handler, *default_username, message); + chat_send_message(server_side_network_handler, *default_username, message); } else { // Client RakNetInstance_send_t RakNetInstance_send = *(RakNetInstance_send_t *) (rak_net_instance_vtable + RakNetInstance_send_vtable_offset); @@ -83,7 +84,7 @@ static void ServerSideNetworkHandler_handle_ChatPacket_injection(unsigned char * if (player != NULL) { char *username = *(char **) (player + Player_username_property_offset); char *message = *(char **) (chat_packet + ChatPacket_message_property_offset); - send_message(server_side_network_handler, username, message); + chat_send_message(server_side_network_handler, username, message); } } diff --git a/mods/src/chat/ui.c b/mods/src/chat/ui.c index 55e4b2e5a..bb790942c 100644 --- a/mods/src/chat/ui.c +++ b/mods/src/chat/ui.c @@ -11,7 +11,8 @@ #include -#include "chat.h" +#include "chat-internal.h" +#include // Run Command static char *run_command_proper(const char *command[], int *return_code) { diff --git a/mods/src/compat/compat.c b/mods/src/compat/compat.c index fad37fef9..7aed30609 100644 --- a/mods/src/compat/compat.c +++ b/mods/src/compat/compat.c @@ -2,8 +2,8 @@ #include #include -#include "compat.h" -#include "../init/init.h" +#include +#include #include @@ -12,10 +12,10 @@ #include -#include "../input/input.h" -#include "../sign/sign.h" -#include "../chat/chat.h" -#include "../home/home.h" +#include +#include +#include +#include // Custom Title HOOK(SDL_WM_SetCaption, void, (__attribute__((unused)) const char *title, const char *icon)) { diff --git a/mods/src/creative/creative.cpp b/mods/src/creative/creative.cpp index 1f4f1ebdf..b4b75fae1 100644 --- a/mods/src/creative/creative.cpp +++ b/mods/src/creative/creative.cpp @@ -1,9 +1,9 @@ #include #include -#include "../init/init.h" -#include "../feature/feature.h" -#include "creative.h" +#include +#include +#include #ifndef MCPI_SERVER_MODE // Add Item To Inventory diff --git a/mods/src/death/death.cpp b/mods/src/death/death.cpp index 72487e373..c70c7e22b 100644 --- a/mods/src/death/death.cpp +++ b/mods/src/death/death.cpp @@ -3,8 +3,8 @@ #include #include -#include "../init/init.h" -#include "../feature/feature.h" +#include +#include // Death Messages static std::string get_death_message(unsigned char *player) { diff --git a/mods/src/feature/feature.c b/mods/src/feature/feature.c index 2e5a6b2fe..451a4706f 100644 --- a/mods/src/feature/feature.c +++ b/mods/src/feature/feature.c @@ -3,7 +3,7 @@ #include -#include "feature.h" +#include // Check For Feature int _feature_has(const char *name) { diff --git a/mods/src/game-mode/game-mode.h b/mods/src/game-mode/game-mode-internal.h similarity index 100% rename from mods/src/game-mode/game-mode.h rename to mods/src/game-mode/game-mode-internal.h diff --git a/mods/src/game-mode/game-mode.c b/mods/src/game-mode/game-mode.c index 17abb1ab2..2cf233261 100644 --- a/mods/src/game-mode/game-mode.c +++ b/mods/src/game-mode/game-mode.c @@ -1,6 +1,6 @@ -#include "game-mode.h" -#include "../init/init.h" -#include "../feature/feature.h" +#include "game-mode-internal.h" +#include +#include #include #include diff --git a/mods/src/game-mode/ui.cpp b/mods/src/game-mode/ui.cpp index 4958d704e..b6332a414 100644 --- a/mods/src/game-mode/ui.cpp +++ b/mods/src/game-mode/ui.cpp @@ -13,7 +13,7 @@ #include #include -#include "game-mode.h" +#include "game-mode-internal.h" // Run Command static char *run_command_proper(const char *command[], bool allow_empty) { diff --git a/mods/src/home/home.c b/mods/src/home/home.c index fa9610b28..201ae15b1 100644 --- a/mods/src/home/home.c +++ b/mods/src/home/home.c @@ -3,8 +3,8 @@ #include #include -#include "home.h" -#include "../init/init.h" +#include +#include // Get MCPI Home Directory char *home_get() { diff --git a/mods/src/init/init.c b/mods/src/init/init.c index 9ab35bd16..64772ff8d 100644 --- a/mods/src/init/init.c +++ b/mods/src/init/init.c @@ -1,6 +1,6 @@ #include -#include "init.h" +#include #include diff --git a/mods/src/input/attack.c b/mods/src/input/attack.c index 2afb7ee68..d91fbaf76 100644 --- a/mods/src/input/attack.c +++ b/mods/src/input/attack.c @@ -1,8 +1,9 @@ #include #include -#include "../feature/feature.h" -#include "input.h" +#include +#include "input-internal.h" +#include // Store Left Click (0 = Not Pressed, 1 = Pressed, 2 = Repeat) // This Is Set To Repeat After First Attempted Left-Click Build Interaction diff --git a/mods/src/input/bow.c b/mods/src/input/bow.c index 157237a8d..a0f2bb9c8 100644 --- a/mods/src/input/bow.c +++ b/mods/src/input/bow.c @@ -1,8 +1,9 @@ #include #include -#include "../feature/feature.h" -#include "input.h" +#include +#include "input-internal.h" +#include // Store Right-Click Status static int is_right_click = 0; diff --git a/mods/src/input/drop.cpp b/mods/src/input/drop.cpp index 3f96a7580..939299be8 100644 --- a/mods/src/input/drop.cpp +++ b/mods/src/input/drop.cpp @@ -1,9 +1,10 @@ #include #include -#include "input.h" -#include "../feature/feature.h" -#include "../creative/creative.h" +#include "input-internal.h" +#include +#include +#include // Enable Item Dropping static int enable_drop = 0; diff --git a/mods/src/input/input-internal.h b/mods/src/input/input-internal.h new file mode 100644 index 000000000..2b081c8a0 --- /dev/null +++ b/mods/src/input/input-internal.h @@ -0,0 +1,15 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("internal"))) void _init_attack(); +__attribute__((visibility("internal"))) void _init_bow(); +__attribute__((visibility("internal"))) void _init_misc(); +__attribute__((visibility("internal"))) void _init_toggle(); +__attribute__((visibility("internal"))) void _init_drop(); + +#ifdef __cplusplus +} +#endif diff --git a/mods/src/input/input.cpp b/mods/src/input/input.cpp index c7b5ef7d5..34303b520 100644 --- a/mods/src/input/input.cpp +++ b/mods/src/input/input.cpp @@ -4,9 +4,10 @@ #include #include -#include "../feature/feature.h" -#include "../init/init.h" -#include "input.h" +#include +#include +#include "input-internal.h" +#include // Run Functions On Input Tick static std::vector &get_input_tick_functions() { diff --git a/mods/src/input/misc.c b/mods/src/input/misc.c index 5be260f63..769d0b58c 100644 --- a/mods/src/input/misc.c +++ b/mods/src/input/misc.c @@ -1,9 +1,10 @@ #include #include -#include "input.h" -#include "../feature/feature.h" -#include "../creative/creative.h" +#include "input-internal.h" +#include +#include +#include // Enable Miscellaneous Input Fixes static int enable_misc = 0; diff --git a/mods/src/input/toggle.c b/mods/src/input/toggle.c index 70e2b88a1..955acb2d3 100644 --- a/mods/src/input/toggle.c +++ b/mods/src/input/toggle.c @@ -1,8 +1,9 @@ #include #include -#include "input.h" -#include "../feature/feature.h" +#include "input-internal.h" +#include +#include // Enable Toggles static int enable_toggles = 0; diff --git a/mods/src/misc/logging.cpp b/mods/src/misc/logging.cpp index f930ba463..4554e8b05 100644 --- a/mods/src/misc/logging.cpp +++ b/mods/src/misc/logging.cpp @@ -3,7 +3,8 @@ #include #include -#include "misc.h" +#include "misc-internal.h" +#include // Print Chat To Log static bool Gui_addMessage_recursing = false; diff --git a/mods/src/misc/misc-internal.h b/mods/src/misc/misc-internal.h new file mode 100644 index 000000000..16cff902f --- /dev/null +++ b/mods/src/misc/misc-internal.h @@ -0,0 +1,12 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("internal"))) void _init_misc_cpp(); +__attribute__((visibility("internal"))) void _init_misc_logging(); + +#ifdef __cplusplus +} +#endif diff --git a/mods/src/misc/misc.c b/mods/src/misc/misc.c index 0f2a6c774..4750462d0 100644 --- a/mods/src/misc/misc.c +++ b/mods/src/misc/misc.c @@ -10,9 +10,10 @@ #include #include -#include "../init/init.h" -#include "../feature/feature.h" -#include "misc.h" +#include +#include +#include "misc-internal.h" +#include // Maximum Username Length #define MAX_USERNAME_LENGTH 16 diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index a86367aa9..3fce748ed 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -8,8 +8,9 @@ #include #include -#include "../feature/feature.h" -#include "misc.h" +#include +#include "misc-internal.h" +#include // Read Asset File static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injection(__attribute__((unused)) unsigned char *app_platform, std::string const& path) { diff --git a/mods/src/multiplayer/multiplayer.cpp b/mods/src/multiplayer/multiplayer.cpp index b687ea4b9..336408534 100644 --- a/mods/src/multiplayer/multiplayer.cpp +++ b/mods/src/multiplayer/multiplayer.cpp @@ -12,9 +12,9 @@ #include -#include "../home/home.h" -#include "../init/init.h" -#include "../feature/feature.h" +#include +#include +#include // Load Server List struct server_list_entry { diff --git a/mods/src/options/options.h b/mods/src/options/options-internal.h similarity index 100% rename from mods/src/options/options.h rename to mods/src/options/options-internal.h diff --git a/mods/src/options/options.c b/mods/src/options/options.c index ef2a35f22..fe460246d 100644 --- a/mods/src/options/options.c +++ b/mods/src/options/options.c @@ -3,9 +3,9 @@ #include #include -#include "../feature/feature.h" -#include "../init/init.h" -#include "options.h" +#include +#include +#include "options-internal.h" // Force Mob Spawning static bool LevelData_getSpawnMobs_injection(__attribute__((unused)) unsigned char *level_data) { diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp index 991082149..f11831c9d 100644 --- a/mods/src/options/options.cpp +++ b/mods/src/options/options.cpp @@ -5,9 +5,9 @@ #include -#include "../feature/feature.h" -#include "../home/home.h" -#include "options.h" +#include +#include +#include "options-internal.h" #include diff --git a/mods/src/override/override.c b/mods/src/override/override.c index 7a562eafe..5d88228ea 100644 --- a/mods/src/override/override.c +++ b/mods/src/override/override.c @@ -8,8 +8,8 @@ #include -#include "override.h" -#include "../home/home.h" +#include +#include // Hook access HOOK(access, int, (const char *pathname, int mode)) { diff --git a/mods/src/server/server.cpp b/mods/src/server/server.cpp index 776d6d37e..49baa0e28 100644 --- a/mods/src/server/server.cpp +++ b/mods/src/server/server.cpp @@ -21,13 +21,13 @@ #include -#include "server_properties.h" +#include -#include "../feature/feature.h" -#include "../init/init.h" -#include "../home/home.h" -#include "../compat/compat.h" -#include "../misc/misc.h" +#include +#include +#include +#include +#include // --only-generate: Ony Generate World And Then Exit static bool only_generate = false; diff --git a/mods/src/server/server_properties.cpp b/mods/src/server/server_properties.cpp index 5496f6955..40948f15a 100644 --- a/mods/src/server/server_properties.cpp +++ b/mods/src/server/server_properties.cpp @@ -1,4 +1,4 @@ -#include "server_properties.h" +#include static bool is_true(std::string const& val) { return (val == "true" || val == "yes" || val == "1"); diff --git a/mods/src/sign/sign.cpp b/mods/src/sign/sign.cpp index dfb9fc197..561695a63 100644 --- a/mods/src/sign/sign.cpp +++ b/mods/src/sign/sign.cpp @@ -3,10 +3,10 @@ #include #include -#include "../init/init.h" -#include "../feature/feature.h" -#include "../input/input.h" -#include "sign.h" +#include +#include +#include +#include // Open Sign Screen static void LocalPlayer_openTextEdit_injection(unsigned char *local_player, unsigned char *sign) { diff --git a/mods/src/sound/repository.cpp b/mods/src/sound/repository.cpp index 5d7a6de1e..fc3b2f196 100644 --- a/mods/src/sound/repository.cpp +++ b/mods/src/sound/repository.cpp @@ -7,7 +7,7 @@ #include #include -#include "sound.h" +#include "sound-internal.h" // Sound Repository Extracted From MCPE 0.6.1 APK static std::unordered_map> repository = { diff --git a/mods/src/sound/sound.h b/mods/src/sound/sound-internal.h similarity index 100% rename from mods/src/sound/sound.h rename to mods/src/sound/sound-internal.h diff --git a/mods/src/sound/sound.cpp b/mods/src/sound/sound.cpp index ea7c8b467..a593afd2e 100644 --- a/mods/src/sound/sound.cpp +++ b/mods/src/sound/sound.cpp @@ -4,10 +4,10 @@ #include #include -#include "sound.h" -#include "../feature/feature.h" -#include "../override/override.h" -#include "../init/init.h" +#include "sound-internal.h" +#include +#include +#include // Resolve Source File Path #define SOURCE_FILE_BASE "data/libminecraftpe.so" diff --git a/mods/src/test/test.c b/mods/src/test/test.c index c44627bb8..46c983c14 100644 --- a/mods/src/test/test.c +++ b/mods/src/test/test.c @@ -4,8 +4,8 @@ #include -#include "../home/home.h" -#include "../init/init.h" +#include +#include void run_tests() { // Test ~/.minecraft-pi Permissions diff --git a/mods/src/textures/textures.cpp b/mods/src/textures/textures.cpp index ee05d0db7..bbf840ccb 100644 --- a/mods/src/textures/textures.cpp +++ b/mods/src/textures/textures.cpp @@ -7,9 +7,9 @@ #include #include -#include "../misc/misc.h" -#include "../feature/feature.h" -#include "../init/init.h" +#include +#include +#include // Animated Water static void Minecraft_tick_injection(unsigned char *minecraft) { diff --git a/mods/src/touch/touch.cpp b/mods/src/touch/touch.cpp index 02d0e04be..e92a58ae8 100644 --- a/mods/src/touch/touch.cpp +++ b/mods/src/touch/touch.cpp @@ -1,7 +1,7 @@ #include -#include "../feature/feature.h" -#include "../init/init.h" +#include +#include #include diff --git a/mods/src/version/version.cpp b/mods/src/version/version.cpp index 4b2760c63..b492c8d10 100644 --- a/mods/src/version/version.cpp +++ b/mods/src/version/version.cpp @@ -1,8 +1,8 @@ #include #include -#include "version.h" -#include "../init/init.h" +#include +#include // Get New Version char *version_get() { diff --git a/scripts/build.sh b/scripts/build.sh index 65855ab44..5a3f66b1e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,7 +5,7 @@ set -e # Build build() { # Use Build Dir - if [ ! -d "build/${MODE}-${ARCH}" ]; then + if [ ! -f "build/${MODE}-${ARCH}/arm/build.ninja" ] || [ ! -f "build/${MODE}-${ARCH}/native/build.ninja" ]; then ./scripts/setup.sh "${MODE}" "${ARCH}" fi cd "build/${MODE}-${ARCH}" @@ -34,7 +34,7 @@ build() { # Build For ARM armhf_build() { # Use Build Dir - if [ ! -d "build/${MODE}-armhf" ]; then + if [ ! -f "build/${MODE}-armhf/build.ninja" ]; then ./scripts/setup.sh "${MODE}" armhf fi cd "build/${MODE}-armhf" diff --git a/symbols/CMakeLists.txt b/symbols/CMakeLists.txt index 89bb94acf..080cdb914 100644 --- a/symbols/CMakeLists.txt +++ b/symbols/CMakeLists.txt @@ -1,7 +1,16 @@ project(symbols) add_library(symbols INTERFACE) -target_include_directories(symbols INTERFACE include) +target_include_directories( + symbols + INTERFACE + "$" + "$" +) # Disable C++11 String ABI target_compile_definitions(symbols INTERFACE -D_GLIBCXX_USE_CXX11_ABI=0) + +# SDK +install(TARGETS symbols EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}") +install(DIRECTORY "include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/symbols")