Fix On 64-Bit ARM Systems
All checks were successful
minecraft-pi-reborn/pipeline/head This commit looks good
All checks were successful
minecraft-pi-reborn/pipeline/head This commit looks good
This commit is contained in:
parent
80d5674781
commit
578bb1c89f
2
debian/client-arm
vendored
2
debian/client-arm
vendored
@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: armhf
|
||||
Depends: zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3
|
||||
Depends: libc6, libstdc++6, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3
|
||||
|
2
debian/client-arm64
vendored
2
debian/client-arm64
vendored
@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: arm64
|
||||
Depends: zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libc6-armhf-cross, libstdc++6-armhf-cross
|
||||
Depends: libc6, libstdc++6, libc6:armhf, libstdc++6:armhf, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3
|
||||
|
2
debian/client-x86_64
vendored
2
debian/client-x86_64
vendored
@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: amd64
|
||||
Depends: zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user-static
|
||||
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, qemu-user-static
|
||||
|
1
debian/server-arm
vendored
1
debian/server-arm
vendored
@ -4,3 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: armhf
|
||||
Depends: libc6, libstdc++6
|
||||
|
2
debian/server-arm64
vendored
2
debian/server-arm64
vendored
@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: arm64
|
||||
Depends: libc6-armhf-cross, libstdc++6-armhf-cross
|
||||
Depends: libc6, libstdc++6, libc6:armhf, libstdc++6:armhf
|
||||
|
2
debian/server-x86_64
vendored
2
debian/server-x86_64
vendored
@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
|
||||
Description: Fun with Blocks
|
||||
Homepage: https://www.minecraft.net/en-us/edition/pi
|
||||
Architecture: amd64
|
||||
Depends: libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user-static
|
||||
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user-static
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**2.1.7**
|
||||
* Fix On 64-Bit ARM Systems
|
||||
|
||||
**2.1.6**
|
||||
* Optimize Media Layer Proxy
|
||||
|
||||
|
@ -181,31 +181,26 @@ void bootstrap(int argc, char *argv[]) {
|
||||
free(new_ld_preload);
|
||||
}
|
||||
|
||||
// Free Binary Directory
|
||||
free(binary_directory);
|
||||
|
||||
// Start Game
|
||||
INFO("%s", "Starting Game...");
|
||||
|
||||
// Use Correct LibC
|
||||
#ifndef __ARM_ARCH
|
||||
setenv("QEMU_LD_PREFIX", "/usr/arm-linux-gnueabihf", 1);
|
||||
#endif
|
||||
|
||||
// Select Executable Interpreter
|
||||
#ifdef __ARM_ARCH
|
||||
// Create Arguments List
|
||||
char *new_argv[argc + 1];
|
||||
for (int i = 1; i <= argc; i++) {
|
||||
new_argv[i] = argv[i];
|
||||
}
|
||||
new_argv[0] = NULL; // Updated By safe_execvpe()
|
||||
// Run
|
||||
safe_execvpe_relative_to_binary(MCPI_NAME, new_argv, environ);
|
||||
#define EXE_INTERPRETER "/lib/ld-linux-armhf.so.3"
|
||||
#else
|
||||
// Use Static QEMU So It Isn't Affected By LD_* Variables
|
||||
#define QEMU_NAME "qemu-arm-static"
|
||||
// Use Correct LibC
|
||||
setenv("QEMU_LD_PREFIX", "/usr/arm-linux-gnueabihf", 1);
|
||||
#define EXE_INTERPRETER "qemu-arm-static"
|
||||
#endif
|
||||
|
||||
// Get Binary Directory
|
||||
binary_directory = get_binary_directory();
|
||||
// Create Full Path
|
||||
char *full_path = NULL;
|
||||
safe_asprintf(&full_path, "%s/" MCPI_NAME, binary_directory);
|
||||
|
||||
// Free Binary Directory
|
||||
free(binary_directory);
|
||||
|
||||
@ -217,6 +212,5 @@ void bootstrap(int argc, char *argv[]) {
|
||||
new_argv[0] = NULL; // Updated By safe_execvpe()
|
||||
new_argv[1] = full_path; // Path To MCPI
|
||||
// Run
|
||||
safe_execvpe(QEMU_NAME, new_argv, environ);
|
||||
#endif
|
||||
safe_execvpe(EXE_INTERPRETER, new_argv, environ);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ static unsigned char **Tile_web = (unsigned char **) 0x181d08;
|
||||
static unsigned char **Tile_topSnow = (unsigned char **) 0x181b30;
|
||||
static unsigned char **Tile_ice = (unsigned char **) 0x181d80;
|
||||
static unsigned char **Tile_invisible_bedrock = (unsigned char **) 0x181d94;
|
||||
static unsigned char **Tile_netherReactor = (unsigned char **) 0x181dd0;
|
||||
|
||||
static unsigned char **Tile_leaves = (unsigned char **) 0x18120c;
|
||||
static unsigned char **Tile_leaves_carried = (unsigned char **) 0x181dd8;
|
||||
|
@ -44,6 +44,9 @@ target_link_libraries(death reborn feature)
|
||||
add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp)
|
||||
target_link_libraries(misc reborn feature)
|
||||
|
||||
add_library(creative SHARED src/creative/creative.cpp)
|
||||
target_link_libraries(creative reborn feature)
|
||||
|
||||
add_library(options SHARED src/options/options.c)
|
||||
target_link_libraries(options reborn feature)
|
||||
|
||||
@ -69,7 +72,7 @@ add_library(test SHARED src/test/test.c)
|
||||
target_link_libraries(test reborn home)
|
||||
|
||||
add_library(init SHARED src/init/init.c)
|
||||
target_link_libraries(init compat game-mode camera input sign misc death options touch textures atlas chat home version test)
|
||||
target_link_libraries(init compat game-mode camera input sign misc creative death options touch textures atlas chat home version test)
|
||||
if(MCPI_SERVER_MODE)
|
||||
target_link_libraries(init server)
|
||||
else()
|
||||
@ -77,7 +80,7 @@ else()
|
||||
endif()
|
||||
|
||||
## Install Mods
|
||||
install(TARGETS init compat readdir feature override game-mode camera input sign misc death options touch textures atlas chat home version test DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
install(TARGETS init compat readdir feature override game-mode camera input sign misc creative death options touch textures atlas chat home version test DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
if(MCPI_SERVER_MODE)
|
||||
install(TARGETS server DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
else()
|
||||
|
2
mods/src/creative/README.md
Normal file
2
mods/src/creative/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# ``creative`` Mod
|
||||
This mod adds an optional feature flag to add more items to the Creative Mode inventory.
|
57
mods/src/creative/creative.cpp
Normal file
57
mods/src/creative/creative.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <libreborn/minecraft.h>
|
||||
|
||||
#include "../init/init.h"
|
||||
#include "../feature/feature.h"
|
||||
|
||||
// Add Item To Inventory
|
||||
static void inventory_add_item(unsigned char *inventory, unsigned char *item, bool is_tile) {
|
||||
ItemInstance *item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(item_instance);
|
||||
item_instance = (*(is_tile ? ItemInstance_constructor_tile : ItemInstance_constructor_item))(item_instance, item);
|
||||
(*FillingContainer_addItem)(inventory, item_instance);
|
||||
}
|
||||
|
||||
// Expand Creative Inventory
|
||||
static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(unsigned char *filling_container, ItemInstance *item_instance) {
|
||||
// Call Original
|
||||
int32_t ret = (*FillingContainer_addItem)(filling_container, item_instance);
|
||||
|
||||
// Add Items
|
||||
inventory_add_item(filling_container, *Item_flintAndSteel, false);
|
||||
inventory_add_item(filling_container, *Item_snowball, false);
|
||||
inventory_add_item(filling_container, *Item_egg, false);
|
||||
inventory_add_item(filling_container, *Item_shears, false);
|
||||
// Dyes
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (i == 15) {
|
||||
// Bonemeal Is Already In The Creative Inventory
|
||||
continue;
|
||||
}
|
||||
ItemInstance *new_item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = (*ItemInstance_constructor_item_extra)(new_item_instance, *Item_dye_powder, 1, i);
|
||||
(*FillingContainer_addItem)(filling_container, new_item_instance);
|
||||
}
|
||||
inventory_add_item(filling_container, *Item_camera, false);
|
||||
// Add Tiles
|
||||
inventory_add_item(filling_container, *Tile_water, true);
|
||||
inventory_add_item(filling_container, *Tile_lava, true);
|
||||
inventory_add_item(filling_container, *Tile_calmWater, true);
|
||||
inventory_add_item(filling_container, *Tile_calmLava, true);
|
||||
inventory_add_item(filling_container, *Tile_glowingObsidian, true);
|
||||
inventory_add_item(filling_container, *Tile_web, true);
|
||||
inventory_add_item(filling_container, *Tile_topSnow, true);
|
||||
inventory_add_item(filling_container, *Tile_ice, true);
|
||||
inventory_add_item(filling_container, *Tile_invisible_bedrock, true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Init
|
||||
void init_creative() {
|
||||
// Add Extra Items To Creative Inventory (Only Replace Specific Function Call)
|
||||
if (feature_has("Expand Creative Inventory", 0)) {
|
||||
overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ __attribute__((constructor)) static void init() {
|
||||
init_input();
|
||||
init_sign();
|
||||
init_misc();
|
||||
init_creative();
|
||||
init_death();
|
||||
init_camera();
|
||||
init_options();
|
||||
|
@ -15,6 +15,7 @@ void init_game_mode();
|
||||
void init_input();
|
||||
void init_sign();
|
||||
void init_misc();
|
||||
void init_creative();
|
||||
void init_death();
|
||||
void init_camera();
|
||||
void init_options();
|
||||
|
@ -4,5 +4,4 @@ This mod has several miscellaneous mods that are too small to be their own mod,
|
||||
* Sanitizing player usernames for invalid characters.
|
||||
* Removing the red background from unobtainable items in the inventory.
|
||||
* Loading the bundled language file.
|
||||
* Optionally expanding the Creative Inventory.
|
||||
* Printing chat messages to the log.
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <libreborn/minecraft.h>
|
||||
|
||||
#include "../init/init.h"
|
||||
#include "../feature/feature.h"
|
||||
#include "misc.h"
|
||||
#include "../init/init.h"
|
||||
|
||||
// Maximum Username Length
|
||||
#define MAX_USERNAME_LENGTH 16
|
||||
|
@ -5,12 +5,11 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <libreborn/minecraft.h>
|
||||
|
||||
#include "../feature/feature.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <libreborn/minecraft.h>
|
||||
|
||||
// Read Asset File
|
||||
static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injection(__attribute__((unused)) unsigned char *app_platform, std::string const& path) {
|
||||
// Read File
|
||||
@ -25,49 +24,6 @@ static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injectio
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Add Item To Inventory
|
||||
static void inventory_add_item(unsigned char *inventory, unsigned char *item, bool is_tile) {
|
||||
ItemInstance *item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(item_instance);
|
||||
item_instance = (*(is_tile ? ItemInstance_constructor_tile : ItemInstance_constructor_item))(item_instance, item);
|
||||
(*FillingContainer_addItem)(inventory, item_instance);
|
||||
}
|
||||
|
||||
// Expand Creative Inventory
|
||||
static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(unsigned char *filling_container, ItemInstance *item_instance) {
|
||||
// Call Original
|
||||
int32_t ret = (*FillingContainer_addItem)(filling_container, item_instance);
|
||||
|
||||
// Add Items
|
||||
inventory_add_item(filling_container, *Item_flintAndSteel, false);
|
||||
inventory_add_item(filling_container, *Item_snowball, false);
|
||||
inventory_add_item(filling_container, *Item_egg, false);
|
||||
inventory_add_item(filling_container, *Item_shears, false);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (i == 15) {
|
||||
// Bonemeal Is Already In The Creative Inventory
|
||||
continue;
|
||||
}
|
||||
ItemInstance *new_item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = (*ItemInstance_constructor_item_extra)(new_item_instance, *Item_dye_powder, 1, i);
|
||||
(*FillingContainer_addItem)(filling_container, new_item_instance);
|
||||
}
|
||||
inventory_add_item(filling_container, *Item_camera, false);
|
||||
// Add Tiles
|
||||
inventory_add_item(filling_container, *Tile_water, true);
|
||||
inventory_add_item(filling_container, *Tile_lava, true);
|
||||
inventory_add_item(filling_container, *Tile_calmWater, true);
|
||||
inventory_add_item(filling_container, *Tile_calmLava, true);
|
||||
inventory_add_item(filling_container, *Tile_glowingObsidian, true);
|
||||
inventory_add_item(filling_container, *Tile_web, true);
|
||||
inventory_add_item(filling_container, *Tile_topSnow, true);
|
||||
inventory_add_item(filling_container, *Tile_ice, true);
|
||||
inventory_add_item(filling_container, *Tile_invisible_bedrock, true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Print Chat To Log
|
||||
static bool Gui_addMessage_recursing = false;
|
||||
static void Gui_addMessage_injection(unsigned char *gui, std::string const& text) {
|
||||
@ -105,11 +61,6 @@ void _init_misc_cpp() {
|
||||
overwrite((void *) AppPlatform_readAssetFile, (void *) AppPlatform_readAssetFile_injection);
|
||||
}
|
||||
|
||||
// Add Extra Items To Creative Inventory (Only Replace Specific Function Call)
|
||||
if (feature_has("Expand Creative Inventory", 0)) {
|
||||
overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
}
|
||||
|
||||
// Print Chat To Log
|
||||
overwrite_calls((void *) Gui_addMessage, (void *) Gui_addMessage_injection);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user