Finally At A Nice Point
Some checks failed
CI / Build (AMD64, Server) (push) Successful in 19m56s
CI / Build (AMD64, Client) (push) Successful in 20m12s
CI / Build (ARM64, Server) (push) Successful in 18m59s
CI / Build (ARM64, Client) (push) Successful in 19m26s
CI / Build (ARMHF, Server) (push) Failing after 4m33s
CI / Build (ARMHF, Client) (push) Failing after 4m47s
CI / Release (push) Has been skipped
CI / Test (Server) (push) Successful in 19m1s
CI / Test (Client) (push) Successful in 21m52s
CI / Build Example Mods (push) Successful in 11m17s

This commit is contained in:
TheBrokenRail 2024-06-08 16:30:39 -04:00
parent d52c16e722
commit a0f32a15a7
18 changed files with 71 additions and 75 deletions

6
.gitmodules vendored
View File

@ -22,6 +22,6 @@
[submodule "dependencies/symbol-processor/src"]
path = dependencies/symbol-processor/src
url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/symbol-processor.git
[submodule "dependencies/trampoline/src"]
path = dependencies/trampoline/src
url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/trampoline.git
[submodule "dependencies/runtime/src"]
path = dependencies/runtime/src
url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/runtime.git

View File

@ -38,12 +38,6 @@ else()
set(BUILD_MEDIA_LAYER_CORE "${BUILD_ARM_COMPONENTS}")
endif()
# Trampoline Host
set(MCPI_USE_TRAMPOLINE_HOST FALSE)
if(BUILD_NATIVE_COMPONENTS AND (MCPI_USE_MEDIA_LAYER_TRAMPOLINE OR NOT IS_ARM_TARGETING))
set(MCPI_USE_TRAMPOLINE_HOST TRUE)
endif()
# Specify Variant Name
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
if(MCPI_SERVER_MODE)

View File

@ -49,15 +49,17 @@ if("${toolchain_dir}/bin/arm-none-linux-gnueabihf-gcc" IS_NEWER_THAN "${sysroot_
file(REMOVE_RECURSE "${sysroot_dir}/usr/lib/gconv")
# Strip Files
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*")
foreach(file IN LISTS files)
execute_process(COMMAND "${toolchain_dir}/bin/arm-none-linux-gnueabihf-strip" "${file}" RESULT_VARIABLE ret)
# Check Result
if(NOT ret EQUAL 0)
# Delete Invalid Files
file(REMOVE "${file}")
endif()
endforeach()
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*")
foreach(file IN LISTS files)
execute_process(COMMAND "${toolchain_dir}/bin/arm-none-linux-gnueabihf-strip" "${file}" RESULT_VARIABLE ret)
# Check Result
if(NOT ret EQUAL 0)
# Delete Invalid Files
file(REMOVE "${file}")
endif()
endforeach()
endif()
endif()
# Install Sysroot (Skipping Empty Directories)

View File

@ -16,8 +16,8 @@ endif()
if(BUILD_NATIVE_COMPONENTS OR (BUILD_MEDIA_LAYER_CORE AND NOT MCPI_HEADLESS_MODE))
add_subdirectory(LIEF)
endif()
# Trampoline
add_subdirectory(trampoline)
# Extra Runtime
add_subdirectory(runtime)
# GLFW
if(BUILD_MEDIA_LAYER_CORE AND NOT MCPI_HEADLESS_MODE)
add_subdirectory(glfw)

16
dependencies/runtime/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,16 @@
project(runtime)
## Extra Runtime
# QEMU
set(QEMU_VERSION "9.0.0")
set(RUNTIME_QEMU_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz")
if(NOT BUILD_NATIVE_COMPONENTS)
set(TRAMPOLINE_HEADERS_ONLY TRUE)
endif()
# Build
add_subdirectory(src)
# Install
install_runtime("${MCPI_BIN_DIR}" "${MCPI_LEGAL_DIR}")

1
dependencies/runtime/src vendored Submodule

@ -0,0 +1 @@
Subproject commit e6839074fd2eec91c5bb2e08705f2f235a568f74

View File

@ -1,16 +0,0 @@
project(trampoline)
## Trampoline Host
# QEMU
set(QEMU_VERSION "9.0.0")
set(TRAMPOLINE_QEMU_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz")
if(NOT MCPI_USE_TRAMPOLINE_HOST)
set(TRAMPOLINE_HEADERS_ONLY TRUE)
endif()
# Build
add_subdirectory(src)
# Install
install_trampoline("${MCPI_BIN_DIR}" "${MCPI_LEGAL_DIR}")

@ -1 +0,0 @@
Subproject commit 50d94d52998ba361c5d89d1b21f7eafd972f3f4e

View File

@ -19,10 +19,7 @@ if(NOT MCPI_SERVER_MODE)
src/client/available-feature-flags # Show In IDE
)
endif()
target_link_libraries(launcher reborn-util LIB_LIEF)
if(MCPI_USE_TRAMPOLINE_HOST)
target_link_libraries(launcher trampoline-headers)
endif()
target_link_libraries(launcher reborn-util LIB_LIEF trampoline-headers)
# RPath
set_target_properties(launcher PROPERTIES INSTALL_RPATH "$ORIGIN/lib/native")
target_link_options(launcher PRIVATE "LINKER:--disable-new-dtags")

View File

@ -10,7 +10,6 @@
#include "patchelf.h"
#define MCPI_BINARY "minecraft-pi"
#define QEMU_BINARY "qemu-arm"
#define REQUIRED_PAGE_SIZE 4096
@ -151,14 +150,6 @@ void bootstrap() {
mcpi_ld_path += binary_directory + "/sysroot/usr/lib:";
mcpi_ld_path += binary_directory + "/sysroot/usr/lib/arm-linux-gnueabihf:";
#endif
// Add Host LD_LIBRARY_PATH
{
char *value = getenv("LD_LIBRARY_PATH");
if (value != nullptr && strlen(value) > 0) {
mcpi_ld_path += value;
}
}
}
}
@ -177,12 +168,12 @@ void bootstrap() {
// Arguments
std::vector<std::string> args;
// Use Trampoline Host If Needed
#ifdef MCPI_USE_TRAMPOLINE_HOST
args.push_back("trampoline");
// Use Extra If Needed
#ifdef MCPI_BUILD_RUNTIME
args.push_back("runtime");
#endif
// Fix QEMU Bug
#ifdef MCPI_USE_QEMU
#ifdef MCPI_RUNTIME_IS_QEMU
args.push_back("-B");
args.push_back("0x40000"); // Arbitrary Value (Aligns To 4k And 16k Page Sizes)
#endif

View File

@ -8,6 +8,7 @@
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/prctl.h>
#include <libreborn/libreborn.h>
@ -110,6 +111,9 @@ void setup_crash_report() {
// Create New Process Group
setpgid(0, 0);
// Kill Child If Parent Exits First
prctl(PR_SET_PDEATHSIG, SIGKILL);
// Continue Execution
} else {
// Parent Process

View File

@ -2,10 +2,6 @@
#include <libreborn/libreborn.h>
#include <sys/stat.h>
#ifdef MCPI_USE_NATIVE_TRAMPOLINE
#include <trampoline/types.h>
#endif
#include "bootstrap.h"
#include "options/parser.h"
#include "crash-report.h"
@ -28,9 +24,6 @@ static void setup_environment(const options_t &options) {
#else
bind_to_env("_MCPI_ONLY_GENERATE", options.only_generate);
#endif
#ifdef MCPI_USE_NATIVE_TRAMPOLINE
bind_to_env(TRAMPOLINE_USE_PIPES_ENV, !options.use_ptrace_trampoline);
#endif
// GTK Dark Mode
#ifndef MCPI_HEADLESS_MODE

View File

@ -73,14 +73,6 @@ std::string bootstrap_mods(const std::string &binary_directory) {
load(preload, mods_folder);
}
// Add LD_PRELOAD
{
const char *value = getenv("LD_PRELOAD");
if (value != nullptr && strlen(value) > 0) {
preload += value;
}
}
// Return
return preload;
}

View File

@ -9,7 +9,4 @@ OPTION(print_available_feature_flags, "print-available-feature-flags", -6, "Prin
OPTION(benchmark, "benchmark", -7, "Run Benchmark")
#else
OPTION(only_generate, "only-generate", -8, "Generate World And Exit")
#endif
#ifdef MCPI_USE_NATIVE_TRAMPOLINE
OPTION(use_ptrace_trampoline, "use-ptrace-trampoline", -9, "Use PTrace For Calling Host Functions Instead Of Pipes")
#endif

View File

@ -13,6 +13,5 @@
#cmakedefine MCPI_VARIANT_NAME "@MCPI_VARIANT_NAME@"
#cmakedefine MCPI_SDK_DIR "@MCPI_SDK_DIR@"
#cmakedefine MCPI_SKIN_SERVER "@MCPI_SKIN_SERVER@"
#cmakedefine MCPI_USE_TRAMPOLINE_HOST
#cmakedefine MCPI_DISCORD_INVITE "@MCPI_DISCORD_INVITE@"
#cmakedefine MCPI_DOCUMENTATION "@MCPI_DOCUMENTATION@"

View File

@ -319,6 +319,23 @@ CALL_GL_POINTER(41, glTexCoordPointer)
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
void glDisableClientState(const GLenum array) {
gl_state.get_array_enabled(array) = false;
// Not needed when using compatibility layer
#ifndef MCPI_USE_GLES1_COMPATIBILITY_LAYER
switch (array) {
case GL_VERTEX_ARRAY: {
gl_array_details.glVertexPointer.size = -1;
break;
}
case GL_COLOR_ARRAY: {
gl_array_details.glColorPointer.size = -1;
break;
}
case GL_TEXTURE_COORD_ARRAY: {
gl_array_details.glTexCoordPointer.size = -1;
break;
}
}
#endif
}
#endif
@ -349,6 +366,12 @@ void glBindBuffer(const GLenum target, const GLuint buffer) {
} else {
ERR("Unsupported Buffer Binding: %u", target);
}
// Not needed when using compatibility layer
#ifndef MCPI_USE_GLES1_COMPATIBILITY_LAYER
gl_array_details.glVertexPointer.size = -1;
gl_array_details.glColorPointer.size = -1;
gl_array_details.glTexCoordPointer.size = -1;
#endif
}
#endif
@ -676,6 +699,10 @@ static int get_glGetIntegerv_params_size(GLenum pname) {
#endif
CALL(61, glGetIntegerv, void, (GLenum pname, GLint *params))
#ifdef MEDIA_LAYER_TRAMPOLINE_GUEST
if (pname == GL_TEXTURE_BINDING_2D) {
params[0] = gl_state.bound_texture;
return;
}
trampoline(false, pname, uint32_t(params));
#else
GLenum pname = args.next<GLenum>();

View File

@ -69,7 +69,7 @@ uint32_t _raw_trampoline(const uint32_t id, const bool allow_early_return, const
// Configure Method
static int use_syscall = -1;
if (use_syscall == -1) {
use_syscall = getenv(TRAMPOLINE_USE_PIPES_ENV) == nullptr;
use_syscall = getenv(TRAMPOLINE_ARGUMENTS_PIPE_ENV) == nullptr;
}
// Use Correct Method
if (use_syscall) {

View File

@ -1,3 +1,3 @@
extends Tile;
vtable 0x110fd0;
vtable 0x111ec0;