Initial SDK Support

This commit is contained in:
TheBrokenRail 2022-06-25 17:30:08 -04:00
parent 78e17d8c18
commit d859a16b5a
70 changed files with 987 additions and 144 deletions

View File

@ -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()

1
example-mod/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

View File

@ -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)

9
example-mod/README.md Normal file
View File

@ -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.

View File

@ -0,0 +1,651 @@
// Headers
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include <mods/init/init.h>
// 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);
}

View File

@ -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);

View File

@ -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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/libreborn>"
)
# 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()

View File

@ -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@"

View File

@ -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);

View File

@ -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;
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) {

View File

@ -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
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/media-layer>"
)
# 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)

View File

@ -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()

View File

@ -19,9 +19,13 @@ 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)
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()
# Common

View File

@ -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()

View File

@ -1,30 +1,42 @@
project(mods)
## Headers
add_library(mods-headers INTERFACE)
target_include_directories(
mods-headers
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/mods>"
)
# 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}")

View File

@ -0,0 +1,19 @@
#pragma once
#include <libreborn/libreborn.h>
#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

View File

@ -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

View File

@ -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

View File

@ -3,8 +3,8 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "../init/init.h"
#include <mods/feature/feature.h>
#include <mods/init/init.h>
// 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) {

View File

@ -6,9 +6,9 @@
#include <media-layer/core.h>
#include <SDL/SDL.h>
#include "../init/init.h"
#include "../compat/compat.h"
#include "../misc/misc.h"
#include <mods/init/init.h>
#include <mods/compat/compat.h>
#include <mods/misc/misc.h>
// --benchmark: Activate Benchmark
static bool active = false;

View File

@ -2,9 +2,9 @@
#include <media-layer/core.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "../home/home.h"
#include "../init/init.h"
#include <mods/feature/feature.h>
#include <mods/home/home.h>
#include <mods/init/init.h>
// 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) {

View File

@ -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
}

View File

@ -14,12 +14,13 @@
#include <media-layer/core.h>
#endif
#include "../init/init.h"
#include "../feature/feature.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
#ifndef MCPI_SERVER_MODE
#include "../input/input.h"
#include <mods/input/input.h>
#endif
#include "chat.h"
#include "chat-internal.h"
#include <mods/chat/chat.h>
// 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);
}
}

View File

@ -11,7 +11,8 @@
#include <media-layer/core.h>
#include "chat.h"
#include "chat-internal.h"
#include <mods/chat/chat.h>
// Run Command
static char *run_command_proper(const char *command[], int *return_code) {

View File

@ -2,8 +2,8 @@
#include <signal.h>
#include <errno.h>
#include "compat.h"
#include "../init/init.h"
#include <mods/compat/compat.h>
#include <mods/init/init.h>
#include <libreborn/libreborn.h>
@ -12,10 +12,10 @@
#include <media-layer/core.h>
#include "../input/input.h"
#include "../sign/sign.h"
#include "../chat/chat.h"
#include "../home/home.h"
#include <mods/input/input.h>
#include <mods/sign/sign.h>
#include <mods/chat/chat.h>
#include <mods/home/home.h>
// Custom Title
HOOK(SDL_WM_SetCaption, void, (__attribute__((unused)) const char *title, const char *icon)) {

View File

@ -1,9 +1,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../init/init.h"
#include "../feature/feature.h"
#include "creative.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
#include <mods/creative/creative.h>
#ifndef MCPI_SERVER_MODE
// Add Item To Inventory

View File

@ -3,8 +3,8 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../init/init.h"
#include "../feature/feature.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
// Death Messages
static std::string get_death_message(unsigned char *player) {

View File

@ -3,7 +3,7 @@
#include <libreborn/libreborn.h>
#include "feature.h"
#include <mods/feature/feature.h>
// Check For Feature
int _feature_has(const char *name) {

View File

@ -1,6 +1,6 @@
#include "game-mode.h"
#include "../init/init.h"
#include "../feature/feature.h"
#include "game-mode-internal.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>

View File

@ -13,7 +13,7 @@
#include <symbols/minecraft.h>
#include <media-layer/core.h>
#include "game-mode.h"
#include "game-mode-internal.h"
// Run Command
static char *run_command_proper(const char *command[], bool allow_empty) {

View File

@ -3,8 +3,8 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "home.h"
#include "../init/init.h"
#include <mods/home/home.h>
#include <mods/init/init.h>
// Get MCPI Home Directory
char *home_get() {

View File

@ -1,6 +1,6 @@
#include <libreborn/libreborn.h>
#include "init.h"
#include <mods/init/init.h>
#include <media-layer/core.h>

View File

@ -1,8 +1,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "input.h"
#include <mods/feature/feature.h>
#include "input-internal.h"
#include <mods/input/input.h>
// Store Left Click (0 = Not Pressed, 1 = Pressed, 2 = Repeat)
// This Is Set To Repeat After First Attempted Left-Click Build Interaction

View File

@ -1,8 +1,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "input.h"
#include <mods/feature/feature.h>
#include "input-internal.h"
#include <mods/input/input.h>
// Store Right-Click Status
static int is_right_click = 0;

View File

@ -1,9 +1,10 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "input.h"
#include "../feature/feature.h"
#include "../creative/creative.h"
#include "input-internal.h"
#include <mods/input/input.h>
#include <mods/feature/feature.h>
#include <mods/creative/creative.h>
// Enable Item Dropping
static int enable_drop = 0;

View File

@ -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

View File

@ -4,9 +4,10 @@
#include <symbols/minecraft.h>
#include <media-layer/core.h>
#include "../feature/feature.h"
#include "../init/init.h"
#include "input.h"
#include <mods/feature/feature.h>
#include <mods/init/init.h>
#include "input-internal.h"
#include <mods/input/input.h>
// Run Functions On Input Tick
static std::vector<input_tick_function_t> &get_input_tick_functions() {

View File

@ -1,9 +1,10 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "input.h"
#include "../feature/feature.h"
#include "../creative/creative.h"
#include "input-internal.h"
#include <mods/input/input.h>
#include <mods/feature/feature.h>
#include <mods/creative/creative.h>
// Enable Miscellaneous Input Fixes
static int enable_misc = 0;

View File

@ -1,8 +1,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "input.h"
#include "../feature/feature.h"
#include "input-internal.h"
#include <mods/input/input.h>
#include <mods/feature/feature.h>
// Enable Toggles
static int enable_toggles = 0;

View File

@ -3,7 +3,8 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "misc.h"
#include "misc-internal.h"
#include <mods/misc/misc.h>
// Print Chat To Log
static bool Gui_addMessage_recursing = false;

View File

@ -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

View File

@ -10,9 +10,10 @@
#include <SDL/SDL.h>
#include <media-layer/core.h>
#include "../init/init.h"
#include "../feature/feature.h"
#include "misc.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
#include "misc-internal.h"
#include <mods/misc/misc.h>
// Maximum Username Length
#define MAX_USERNAME_LENGTH 16

View File

@ -8,8 +8,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "misc.h"
#include <mods/feature/feature.h>
#include "misc-internal.h"
#include <mods/misc/misc.h>
// Read Asset File
static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injection(__attribute__((unused)) unsigned char *app_platform, std::string const& path) {

View File

@ -12,9 +12,9 @@
#include <symbols/minecraft.h>
#include "../home/home.h"
#include "../init/init.h"
#include "../feature/feature.h"
#include <mods/home/home.h>
#include <mods/init/init.h>
#include <mods/feature/feature.h>
// Load Server List
struct server_list_entry {

View File

@ -3,9 +3,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../feature/feature.h"
#include "../init/init.h"
#include "options.h"
#include <mods/feature/feature.h>
#include <mods/init/init.h>
#include "options-internal.h"
// Force Mob Spawning
static bool LevelData_getSpawnMobs_injection(__attribute__((unused)) unsigned char *level_data) {

View File

@ -5,9 +5,9 @@
#include <libreborn/libreborn.h>
#include "../feature/feature.h"
#include "../home/home.h"
#include "options.h"
#include <mods/feature/feature.h>
#include <mods/home/home.h>
#include "options-internal.h"
#include <symbols/minecraft.h>

View File

@ -8,8 +8,8 @@
#include <libreborn/libreborn.h>
#include "override.h"
#include "../home/home.h"
#include <mods/override/override.h>
#include <mods/home/home.h>
// Hook access
HOOK(access, int, (const char *pathname, int mode)) {

View File

@ -21,13 +21,13 @@
#include <symbols/minecraft.h>
#include "server_properties.h"
#include <mods/server/server_properties.h>
#include "../feature/feature.h"
#include "../init/init.h"
#include "../home/home.h"
#include "../compat/compat.h"
#include "../misc/misc.h"
#include <mods/feature/feature.h>
#include <mods/init/init.h>
#include <mods/home/home.h>
#include <mods/compat/compat.h>
#include <mods/misc/misc.h>
// --only-generate: Ony Generate World And Then Exit
static bool only_generate = false;

View File

@ -1,4 +1,4 @@
#include "server_properties.h"
#include <mods/server/server_properties.h>
static bool is_true(std::string const& val) {
return (val == "true" || val == "yes" || val == "1");

View File

@ -3,10 +3,10 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../init/init.h"
#include "../feature/feature.h"
#include "../input/input.h"
#include "sign.h"
#include <mods/init/init.h>
#include <mods/feature/feature.h>
#include <mods/input/input.h>
#include <mods/sign/sign.h>
// Open Sign Screen
static void LocalPlayer_openTextEdit_injection(unsigned char *local_player, unsigned char *sign) {

View File

@ -7,7 +7,7 @@
#include <libreborn/libreborn.h>
#include <media-layer/audio.h>
#include "sound.h"
#include "sound-internal.h"
// Sound Repository Extracted From MCPE 0.6.1 APK
static std::unordered_map<std::string, std::vector<std::string>> repository = {

View File

@ -4,10 +4,10 @@
#include <symbols/minecraft.h>
#include <media-layer/audio.h>
#include "sound.h"
#include "../feature/feature.h"
#include "../override/override.h"
#include "../init/init.h"
#include "sound-internal.h"
#include <mods/feature/feature.h>
#include <mods/override/override.h>
#include <mods/init/init.h>
// Resolve Source File Path
#define SOURCE_FILE_BASE "data/libminecraftpe.so"

View File

@ -4,8 +4,8 @@
#include <libreborn/libreborn.h>
#include "../home/home.h"
#include "../init/init.h"
#include <mods/home/home.h>
#include <mods/init/init.h>
void run_tests() {
// Test ~/.minecraft-pi Permissions

View File

@ -7,9 +7,9 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "../misc/misc.h"
#include "../feature/feature.h"
#include "../init/init.h"
#include <mods/misc/misc.h>
#include <mods/feature/feature.h>
#include <mods/init/init.h>
// Animated Water
static void Minecraft_tick_injection(unsigned char *minecraft) {

View File

@ -1,7 +1,7 @@
#include <libreborn/libreborn.h>
#include "../feature/feature.h"
#include "../init/init.h"
#include <mods/feature/feature.h>
#include <mods/init/init.h>
#include <symbols/minecraft.h>

View File

@ -1,8 +1,8 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "version.h"
#include "../init/init.h"
#include <mods/version/version.h>
#include <mods/init/init.h>
// Get New Version
char *version_get() {

View File

@ -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"

View File

@ -1,7 +1,16 @@
project(symbols)
add_library(symbols INTERFACE)
target_include_directories(symbols INTERFACE include)
target_include_directories(
symbols
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/symbols>"
)
# 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")