Improve Comments

This commit is contained in:
TheBrokenRail 2020-10-26 15:58:28 -04:00
parent 465f3cce81
commit 19e2ded9bf
10 changed files with 35 additions and 17 deletions

View File

@ -1,7 +1,9 @@
.git
.gitignore
Dockerfile
README.md
data
install.sh
build.sh
/.git
/.gitignore
/Dockerfile*
/Jenkinsfile
/out
/LICENSE
*.md
/debian
/scripts

View File

@ -7,6 +7,9 @@ Minecraft: Pi Edition has no symbols so you must patch the hex address of an ins
## 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``.
## 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).

View File

@ -4,5 +4,12 @@ This is a project allowing Minecraft: Pi Edition to be run without a Raspberry P
## Setup
[View Binaries](https://jenkins.thebrokenrail.com/job/minecraft-pi-docker/job/master/lastSuccessfulBuild/artifact/out/)
### Packages
| Package | Description |
| --- | --- |
| ``minecraft-pi-server`` | 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 Raspberry Pi) |
## Modding
[View Modding](MODDING.md)

View File

@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.13.0)
project(mods)
add_compile_options(-Wall -Wextra -Werror)
add_link_options(-Wl,--no-undefined)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_subdirectory(../core core)

View File

@ -27,6 +27,9 @@ extern "C" {
\
__attribute__((__used__)) return_type name args
#define INFO(msg, ...) fprintf(stderr, "[INFO]: " msg "\n", __VA_ARGS__);
#define ERR(msg, ...) fprintf(stderr, "[ERR]: " msg "\n", __VA_ARGS__); exit(1);
void *_overwrite(const char *file, int line, void *start, void *target);
#define overwrite(start, target) _overwrite(__FILE__, __LINE__, start, target);

View File

@ -41,8 +41,7 @@ static void store_x11_window() {
// Handle GLFW Error
static void glfw_error(__attribute__((unused)) int error, const char *description) {
fprintf(stderr, "[ERR] GLFW Error: %s\n", description);
exit(1);
ERR("GLFW Error: %s", description);
}
// Convert GLFW Key To SDL Key

View File

@ -70,6 +70,7 @@ void _patch(const char *file, int line, void *start, unsigned char patch[]) {
mprotect((void *) page_start, end - page_start, PROT_READ | PROT_EXEC);
// Clear ARM Instruction Cache
__clear_cache(start, (void *) end);
}

View File

@ -163,8 +163,7 @@ int extra_get_mode() {
} else if (strcmp("server", mode) == 0) {
return 2;
} else {
fprintf(stderr, "[ERR] Inavlid MCPI_MODE: %s\n", mode);
exit(1);
ERR("Inavlid MCPI_MODE: %s", mode);
}
}
@ -249,7 +248,11 @@ __attribute__((constructor)) static void init() {
username = get_username();
fprintf(stderr, "Setting Username: %s\n", username);
}
patch_address((void *) 0x18fd4, (void *) username);
char **default_username = (char **) 0x18fd4;
if (strcmp(*default_username, "StevePi") != 0) {
ERR("%s", "Default Username Is Invalid");
}
patch_address((void *) default_username, (void *) username);
if (extra_has_feature("Disable Autojump By Default")) {
// Disable Autojump By Default

View File

@ -7,6 +7,8 @@
#include <libcore/libcore.h>
// Minecraft: Pi Edition Was Not Compiled With 64-Bit Filesystem Support, So This Shims readdir() To Read Directories Properly
#define FILENAME_SIZE 256
HOOK(readdir, struct dirent *, (DIR *dirp)) {

View File

@ -35,8 +35,6 @@ static ProgressScreen_t ProgressScreen = (ProgressScreen_t) 0x37044;
typedef void (*Minecraft_setScreen_t)(unsigned char *minecraft, unsigned char *screen);
static Minecraft_setScreen_t Minecraft_setScreen = (Minecraft_setScreen_t) 0x15d6c;
#define INFO(msg, ...) fprintf(stderr, "[INFO]: " msg "\n", __VA_ARGS__);
// Store Minecraft For Exit
static unsigned char *stored_minecraft = NULL;
@ -233,8 +231,7 @@ void server_init() {
}
if (!properties_file.is_open()) {
fprintf(stderr, "[ERR]: Unable To Open server.properties\n");
exit(1);
ERR("%s", "Unable To Open server.properties");
}
// Load Properties