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)
|
if(NOT TRAMPOLINE_HEADERS_ONLY)
|
||||||
# Check Architecture
|
# Check Architecture
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
check_symbol_exists("__arm__" "" NO_RUNTIME_NEEDED)
|
||||||
|
if(NOT NO_RUNTIME_NEEDED)
|
||||||
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
||||||
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
||||||
|
|
||||||
# Include Correct Sub-Project
|
# Include Correct Sub-Project
|
||||||
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
||||||
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
||||||
@ -26,6 +27,7 @@ if(NOT TRAMPOLINE_HEADERS_ONLY)
|
|||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unsupported Architecture")
|
message(FATAL_ERROR "Unsupported Architecture")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# No-Op Install Function
|
# No-Op Install Function
|
||||||
function(install_runtime)
|
function(install_runtime)
|
||||||
|
10
README.md
10
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.
|
||||||
|
|
||||||
@ -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.
|
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