Changes
This commit is contained in:
parent
fb5508e369
commit
5751a5a0c1
@ -11,9 +11,10 @@ target_include_directories(trampoline-headers INTERFACE include)
|
||||
if(NOT TRAMPOLINE_HEADERS_ONLY)
|
||||
# Check Architecture
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists("__arm__" "" NO_RUNTIME_NEEDED)
|
||||
if(NOT NO_RUNTIME_NEEDED)
|
||||
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
||||
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
||||
|
||||
# Include Correct Sub-Project
|
||||
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
||||
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
||||
@ -26,6 +27,7 @@ if(NOT TRAMPOLINE_HEADERS_ONLY)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported Architecture")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# No-Op Install Function
|
||||
function(install_runtime)
|
||||
|
10
README.md
10
README.md
@ -1,5 +1,5 @@
|
||||
# MCPI Runtime
|
||||
**Fact:** MCPI is a 32-bit ARM binary.
|
||||
# MCPI-Reborn Runtime
|
||||
**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.
|
||||
|
||||
@ -17,3 +17,9 @@ QEMU emulates ARM code so MCPI can run on x86 hardware. And the patch adds a sys
|
||||
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.
|
||||
|
||||
### 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 "memory.h"
|
||||
#include "trampoline.h"
|
||||
#include "pipe.h"
|
||||
#include "signals.h"
|
||||
|
||||
@ -37,7 +36,6 @@ int main(__attribute__((unused)) int argc, char *argv[]) {
|
||||
// Setup Trampoline
|
||||
init_signals(pid);
|
||||
init_memory(pid);
|
||||
init_trampoline();
|
||||
|
||||
// Start Pipes
|
||||
init_pipe_host(pid);
|
||||
|
@ -46,6 +46,7 @@ void init_pipe_host(pid_t guest_pid) {
|
||||
// Wait For Commands
|
||||
trampoline_pipe_arguments cmd = {};
|
||||
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];
|
||||
size_t position = 0;
|
||||
while (position < cmd.length) {
|
||||
|
@ -13,6 +13,11 @@ uint32_t trampoline(uint32_t id, const unsigned char *args) {
|
||||
|
||||
// Init
|
||||
void init_trampoline() {
|
||||
static bool is_setup = false;
|
||||
if (is_setup) {
|
||||
return;
|
||||
}
|
||||
is_setup = true;
|
||||
// Open Library
|
||||
void *handle = dlopen("libmedia-layer-trampoline.so", RTLD_NOW);
|
||||
if (handle != nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user