diff --git a/Jenkinsfile b/Jenkinsfile index 27a9d3dd..7df851ab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { withCredentials([usernamePassword(credentialsId: 'docker_hub_login', usernameVariable: 'DOCKER_HUB_USERNAME', passwordVariable: 'DOCKER_HUB_PASSWORD')]) { sh 'docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"' } - sh 'docker push thebrokenrail/minecraft-pi' + sh 'docker push thebrokenrail/minecraft-pi-reborn' } } stage('Package') { diff --git a/MODDING.md b/MODDING.md index 292c7e6f..006a8b8f 100644 --- a/MODDING.md +++ b/MODDING.md @@ -1,17 +1,17 @@ # Modding -Modding Minecraft: Pi Edition is possible by patching the binary at runtime. To make this easier ``minecraft-pi-docker`` includes a libary called ``libcore.so`` which provides several functions to help you patch the game. +Modding Minecraft: Pi Edition is possible by patching the binary at runtime. To make this easier ``minecraft-pi-reborn`` includes a library called ``libcore.so`` which provides several functions to help you patch the game. ## Hex Addresses Minecraft: Pi Edition has no symbols so you must patch the hex address of an instruction instead of using a function name. Hex addresses can be found using tools like [Ghidra](https://ghidra-sre.org) or [RetDec](https://retdec.com). To find out what a function does, you can find its equivalent in Minecraft: Pocket Edition 0.6.1 and use its name for reference because Minecraft: Pocket Edition 0.6.1 includes symbols. ## Loading Directories -``minecraft-pi-docker`` loads mods from two locations, ``/app/minecraft-pi/mods``, and ``~/.minecraft/mods``. The first location only exists in the Docker container and is immutable, so you should place your mods in ``~/.minecraft/mods`` which is mounted on the host as ``~/.minecraft-pi/mods``. +``minecraft-pi-reborn`` loads mods from two locations, ``/app/minecraft-pi/mods``, and ``~/.minecraft/mods``. The first location only exists in the Docker container and is immutable, so you should place your mods in ``~/.minecraft/mods`` which is mounted on the host as ``~/.minecraft-pi/mods``. ## C++ Strings Minecraft: Pi Edition was compiled with an old version of GCC, so when interacting with C++ strings, make sure you set ``-D_GLIBCXX_USE_CXX11_ABI=0``. ## ``libcore.so`` API -Header files and the shared library can be download from [Jenkins](https://jenkins.thebrokenrail.com/job/minecraft-pi-docker/job/master/lastSuccessfulBuild/artifact/out/lib). +Header files and the shared library can be download from [Jenkins](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/lib). ### ``void overwrite(void *start, void *target)`` This method replaces a function with another function. diff --git a/README.md b/README.md index 0f78e3a4..8ae807be 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# Minecraft: Pi Edition For Docker -This is a project allowing Minecraft: Pi Edition to be run without a Raspberry Pi using Docker. +# Minecraft: Pi Edition: Reborn +Minecraft: Pi Edition Modding Project ## Setup 1. Remove Old Minecraft: Pi Edition Package If Installed (``sudo apt remove minecraft-pi``) -2. Download Appropriate Package (See Table Below) From [Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-docker/job/master/lastSuccessfulBuild/artifact/out/deb/) +2. Download Appropriate Package (See Table Below) From [Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/deb/) 3. Install With ``sudo apt install ./`` ### Packages | Package | Description | | --- | --- | -| ``minecraft-pi-server`` | Minecraft Pi Edition Modded Into A Dedicated Server | -| ``minecraft-pi-virgl`` | Minecraft Pi Edition Using VirGL For Hardware Acceleration (Recommended For Desktop) | -| ``minecraft-pi-native`` | Minecraft: Pi Edition Using Docker Device Mounting For GPU Acceleration (Recommended For ARM Devices (ie. Raspberry Pi, PinePhone, etc)) | +| ``minecraft-pi-reborn-server`` | Minecraft Pi Edition Modded Into A Dedicated Server | +| ``minecraft-pi-reborn-virgl`` | Minecraft Pi Edition Using VirGL For Hardware Acceleration (Recommended For Desktop) | +| ``minecraft-pi-reborn-native`` | Minecraft: Pi Edition Using Docker Device Mounting For GPU Acceleration (Recommended For ARM Devices (ie. Raspberry Pi, PinePhone, etc)) | ### General Notes #### Docker Versions -While the distribution-provided version of Docker works fine on most systems, in rare cases it can be outdated and cause bugs. Before reporting a bug, try using the official builds of Docker. These can be installed by following your distribution's instructions at https://docs.docker.com/engine/install. +While the distribution-provided version of Docker is fine for most systems, in rare cases it can be outdated and cause bugs. Before reporting a bug, try using the official builds of Docker. These can be installed by following your distribution's instructions at https://docs.docker.com/engine/install. ### Specific Notes -#### Raspbian Buster +#### Debian/Raspbian Buster By default Raspbian Buster ships an older version of the package ``libseccomp2``. This package is used to block certain dangerous system calls from running inside Docker containers. The included version accidentally blocks the system call ``clock_gettime64``, this causes bugs inside Minecraft: Pi Edition. However, the Debian ``buster-backports`` repo includes an updated version. You can enable the ``buster-backports`` repo and update ``libseccomp2`` by running: ```sh @@ -36,7 +36,7 @@ sudo apt install -t buster-backports libseccomp2 ``` ### PinePhone (Mobian) -This supports running on a PinePhone using Mobian. However, you will need to attach a keyboard and mouse as Minecraft: Pi Edition does not have touch support. +This supports running on a PinePhone using Mobian. However, you will need to attach a keyboard and mouse because Minecraft: Pi Edition does not have touch support. ## Troubleshooting Crashes Game logs are located in ``/tmp/minecraft-pi``. @@ -58,7 +58,7 @@ This is also compatible with MCPE 0.6.1. ### Limitations - Player data is not saved because of limitations with MCPE LAN worlds - An easy workaround is to place your inventory in a chest before logging off -- Survival mode servers are only compatible with ``minecraft-pi-docker`` clients +- Survival mode servers are only compatible with ``minecraft-pi-reborn`` clients ## Modding [View Modding](MODDING.md) diff --git a/debian/client/native/DEBIAN/control b/debian/client/native/DEBIAN/control index 0a561980..5bceb983 100644 --- a/debian/client/native/DEBIAN/control +++ b/debian/client/native/DEBIAN/control @@ -1,4 +1,4 @@ -Package: minecraft-pi-native +Package: minecraft-pi-reborn-native Version: ${VERSION} Maintainer: TheBrokenRail Description: Fun with Blocks @@ -6,4 +6,4 @@ Homepage: https://www.minecraft.net/en-us/edition/pi Architecture: all Depends: ${DEPENDENCIES} Recommends: ${RECOMMENDED_DEPENDENCIES} -Conflicts: minecraft-pi, minecraft-pi-virgl +Conflicts: minecraft-pi, minecraft-pi-reborn-virgl diff --git a/debian/client/virgl/DEBIAN/control b/debian/client/virgl/DEBIAN/control index 784ed7e5..cfef9ccb 100644 --- a/debian/client/virgl/DEBIAN/control +++ b/debian/client/virgl/DEBIAN/control @@ -1,4 +1,4 @@ -Package: minecraft-pi-virgl +Package: minecraft-pi-reborn-virgl Version: ${VERSION} Maintainer: TheBrokenRail Description: Fun with Blocks @@ -6,4 +6,4 @@ Homepage: https://www.minecraft.net/en-us/edition/pi Architecture: all Depends: ${DEPENDENCIES}, virgl-server Recommends: ${RECOMMENDED_DEPENDENCIES} -Conflicts: minecraft-pi, minecraft-pi-native +Conflicts: minecraft-pi, minecraft-pi-reborn-native diff --git a/debian/server/DEBIAN/control b/debian/server/DEBIAN/control index dc622161..90c1bc35 100644 --- a/debian/server/DEBIAN/control +++ b/debian/server/DEBIAN/control @@ -1,4 +1,4 @@ -Package: minecraft-pi-server +Package: minecraft-pi-reborn-server Version: ${VERSION} Maintainer: TheBrokenRail Description: Fun with Blocks diff --git a/mods/CMakeLists.txt b/mods/CMakeLists.txt index 07824574..f6d54e0b 100644 --- a/mods/CMakeLists.txt +++ b/mods/CMakeLists.txt @@ -55,5 +55,7 @@ target_link_libraries(override dl) add_library(textures SHARED src/textures/textures.cpp) target_link_libraries(textures core feature GLESv1_CM) +add_library(test SHARED src/test/test.c) + add_library(init SHARED src/init/init.c) -target_link_libraries(init compat server game_mode camera input misc options textures) +target_link_libraries(init compat server game_mode camera input misc options textures test) diff --git a/mods/src/init/init.c b/mods/src/init/init.c index 1ad9610a..610958a1 100644 --- a/mods/src/init/init.c +++ b/mods/src/init/init.c @@ -1,6 +1,7 @@ #include "init.h" __attribute__((constructor)) static void init() { + run_tests(); init_compat(); init_server(); init_game_mode(); diff --git a/mods/src/init/init.h b/mods/src/init/init.h index d2a1fdbf..4da5fe34 100644 --- a/mods/src/init/init.h +++ b/mods/src/init/init.h @@ -6,6 +6,7 @@ extern "C" { #endif +void run_tests(); void init_compat(); void init_server(); void init_game_mode(); diff --git a/mods/src/test/test.c b/mods/src/test/test.c new file mode 100644 index 00000000..57fb1103 --- /dev/null +++ b/mods/src/test/test.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include "../init/init.h" + +// Types +typedef long long time64_t; +struct timespec64 { + time64_t tv_sec; + long tv_nsec; +}; +typedef long int time32_t; +struct timespec32 { + time32_t tv_sec; + long tv_nsec; +}; + +void run_tests() { + // Test clock_gettime64 + struct timespec64 ts64; + long out = syscall(SYS_clock_gettime64, CLOCK_MONOTONIC, &ts64); + if (out != 0) { + if (errno == ENOSYS) { + // clock_gettime64 Unsupported, Testing clock_gettime + struct timespec32 ts32; + out = syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts32); + if (out != 0) { + // Failure + ERR("Unable To Run clock_gettime Syscall: %s", strerror(errno)); + } + } else { + // Failure + ERR("Unable To Run clock_gettime64 Syscall: %s", strerror(errno)); + } + } +} \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index ea8b76c1..cb847d1c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,5 +2,5 @@ set -e -docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:client -f Dockerfile.client . -docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi:server -f Dockerfile.server . +docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi-reborn:client -f Dockerfile.client . +docker build ${DOCKER_BUILD_OPTIONS} --tag thebrokenrail/minecraft-pi-reborn:server -f Dockerfile.server .