Changes
This commit is contained in:
parent
fb5508e369
commit
5751a5a0c1
@ -11,20 +11,22 @@ target_include_directories(trampoline-headers INTERFACE include)
|
|||||||
if(NOT TRAMPOLINE_HEADERS_ONLY)
|
if(NOT TRAMPOLINE_HEADERS_ONLY)
|
||||||
# Check Architecture
|
# Check Architecture
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
check_symbol_exists("__arm__" "" NO_RUNTIME_NEEDED)
|
||||||
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
if(NOT NO_RUNTIME_NEEDED)
|
||||||
|
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
||||||
# Include Correct Sub-Project
|
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
||||||
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
# Include Correct Sub-Project
|
||||||
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
||||||
target_compile_definitions(trampoline-headers INTERFACE MCPI_BUILD_RUNTIME)
|
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
||||||
if(USE_NATIVE_RUNTIME)
|
target_compile_definitions(trampoline-headers INTERFACE MCPI_BUILD_RUNTIME)
|
||||||
add_subdirectory(native)
|
if(USE_NATIVE_RUNTIME)
|
||||||
elseif(USE_QEMU_RUNTIME)
|
add_subdirectory(native)
|
||||||
add_subdirectory(qemu)
|
elseif(USE_QEMU_RUNTIME)
|
||||||
target_compile_definitions(trampoline-headers INTERFACE MCPI_RUNTIME_IS_QEMU)
|
add_subdirectory(qemu)
|
||||||
else()
|
target_compile_definitions(trampoline-headers INTERFACE MCPI_RUNTIME_IS_QEMU)
|
||||||
message(FATAL_ERROR "Unsupported Architecture")
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported Architecture")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# No-Op Install Function
|
# No-Op Install Function
|
||||||
|
12
README.md
12
README.md
@ -1,5 +1,5 @@
|
|||||||
# MCPI Runtime
|
# MCPI-Reborn Runtime
|
||||||
**Fact:** MCPI is a 32-bit ARM binary.
|
**Fact:** Minecraft: Pi Edition is a 32-bit ARM program.
|
||||||
|
|
||||||
**Another fact:** Most modern computers do not use 32-bit ARM and therefore cannot run MCPI natively.
|
**Another fact:** Most modern computers do not use 32-bit ARM and therefore cannot run MCPI natively.
|
||||||
|
|
||||||
@ -16,4 +16,10 @@ QEMU emulates ARM code so MCPI can run on x86 hardware. And the patch adds a sys
|
|||||||
### 64-Bit ARM Host
|
### 64-Bit ARM Host
|
||||||
QEMU is not necessary on this platform because it can already run 32-bit ARM code natively.
|
QEMU is not necessary on this platform because it can already run 32-bit ARM code natively.
|
||||||
|
|
||||||
Instead, the runtime is implemented as two processes: a parent and a child. The child becomes MCPI and can send graphics commands to the parent. And because the parent is 64-bit, 32-bit drivers are not needed.
|
Instead, the runtime is implemented as two processes: a parent and a child. The child becomes MCPI and can send graphics commands to the parent. And because the parent is 64-bit, 32-bit drivers are not needed.
|
||||||
|
|
||||||
|
### 32-Bit ARM Host
|
||||||
|
This project is unnecessary on this platform.
|
||||||
|
|
||||||
|
### Other Architectures
|
||||||
|
Any unlisted platforms are unsupported.
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "trampoline.h"
|
|
||||||
#include "pipe.h"
|
#include "pipe.h"
|
||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ int main(__attribute__((unused)) int argc, char *argv[]) {
|
|||||||
// Setup Trampoline
|
// Setup Trampoline
|
||||||
init_signals(pid);
|
init_signals(pid);
|
||||||
init_memory(pid);
|
init_memory(pid);
|
||||||
init_trampoline();
|
|
||||||
|
|
||||||
// Start Pipes
|
// Start Pipes
|
||||||
init_pipe_host(pid);
|
init_pipe_host(pid);
|
||||||
|
@ -46,6 +46,7 @@ void init_pipe_host(pid_t guest_pid) {
|
|||||||
// Wait For Commands
|
// Wait For Commands
|
||||||
trampoline_pipe_arguments cmd = {};
|
trampoline_pipe_arguments cmd = {};
|
||||||
while (read(arguments_pipe[PIPE_READ], &cmd, sizeof(trampoline_pipe_arguments)) > 0) {
|
while (read(arguments_pipe[PIPE_READ], &cmd, sizeof(trampoline_pipe_arguments)) > 0) {
|
||||||
|
init_trampoline(); // Only Init If Needed
|
||||||
static unsigned char args[MAX_TRAMPOLINE_ARGS_SIZE];
|
static unsigned char args[MAX_TRAMPOLINE_ARGS_SIZE];
|
||||||
size_t position = 0;
|
size_t position = 0;
|
||||||
while (position < cmd.length) {
|
while (position < cmd.length) {
|
||||||
|
@ -13,6 +13,11 @@ uint32_t trampoline(uint32_t id, const unsigned char *args) {
|
|||||||
|
|
||||||
// Init
|
// Init
|
||||||
void init_trampoline() {
|
void init_trampoline() {
|
||||||
|
static bool is_setup = false;
|
||||||
|
if (is_setup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
is_setup = true;
|
||||||
// Open Library
|
// Open Library
|
||||||
void *handle = dlopen("libmedia-layer-trampoline.so", RTLD_NOW);
|
void *handle = dlopen("libmedia-layer-trampoline.so", RTLD_NOW);
|
||||||
if (handle != nullptr) {
|
if (handle != nullptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user