Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
77a272ea43 | |||
ad94343132 | |||
176b04bf8c |
@ -30,7 +30,7 @@ endif()
|
||||
include(cmake/util.cmake)
|
||||
|
||||
# Specify Variant Name
|
||||
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
|
||||
set(MCPI_VARIANT_NAME "minecraft-pi-reborn-legacy")
|
||||
if(MCPI_SERVER_MODE)
|
||||
set(MCPI_VARIANT_NAME "${MCPI_VARIANT_NAME}-server")
|
||||
else()
|
||||
|
@ -9,7 +9,7 @@ RUN \
|
||||
|
||||
# Copy AppImage
|
||||
RUN mkdir /app
|
||||
ADD ./out/minecraft-pi-reborn-server-*-amd64.AppImage /app
|
||||
ADD ./out/minecraft-pi-reborn-legacy-server-*-amd64.AppImage /app
|
||||
|
||||
# Extract AppImage
|
||||
WORKDIR /app
|
||||
|
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -22,11 +22,11 @@ pipeline {
|
||||
stage('Publish') {
|
||||
steps {
|
||||
sh 'apt-get update && apt-get install -y docker.io'
|
||||
sh 'docker build --no-cache --tag thebrokenrail/minecraft-pi-reborn-server .'
|
||||
sh 'docker build --no-cache --tag thebrokenrail/minecraft-pi-reborn-legacy-server .'
|
||||
withCredentials([usernamePassword(credentialsId: 'docker_hub_login', usernameVariable: 'DOCKER_HUB_USERNAME', passwordVariable: 'DOCKER_HUB_PASSWORD')]) {
|
||||
sh 'docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"'
|
||||
}
|
||||
sh 'docker push thebrokenrail/minecraft-pi-reborn-server'
|
||||
sh 'docker push thebrokenrail/minecraft-pi-reborn-legacy-server'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<img alt="Start Screen" src="images/start.png">
|
||||
</p>
|
||||
|
||||
# Minecraft: Pi Edition: Reborn
|
||||
# Minecraft: Pi Edition: Reborn Legacy
|
||||
Minecraft: Pi Edition Modding Project
|
||||
|
||||
## Documentation
|
||||
|
2
dependencies/minecraft-pi/CMakeLists.txt
vendored
2
dependencies/minecraft-pi/CMakeLists.txt
vendored
@ -7,7 +7,7 @@ include(FetchContent)
|
||||
# Download
|
||||
FetchContent_Declare(
|
||||
minecraft-pi
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.1.tar.gz"
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.0.tar.gz"
|
||||
)
|
||||
FetchContent_Populate(minecraft-pi)
|
||||
|
||||
|
BIN
dependencies/minecraft-pi/minecraft-pi-0.1.0.tar.gz
vendored
Normal file
BIN
dependencies/minecraft-pi/minecraft-pi-0.1.0.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz
vendored
BIN
dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz
vendored
Binary file not shown.
@ -1,15 +1,15 @@
|
||||
# Dedicated Server
|
||||
The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment. It loads settings from a ``server.properties`` file.
|
||||
|
||||
This server is also compatible with MCPE Alpha v0.6.1.
|
||||
This server is also compatible with MCPE Alpha v0.5.0.
|
||||
|
||||
## Setup
|
||||
|
||||
### Debian Package
|
||||
To use, install and run ``minecraft-pi-reborn-server``. It will generate the world and ``server.properties`` in the current directory.
|
||||
To use, install and run ``minecraft-pi-reborn-legacy-server``. It will generate the world and ``server.properties`` in the current directory.
|
||||
|
||||
### Docker Image
|
||||
An official Docker image is also provided: [thebrokenrail/minecraft-pi-reborn-server](https://hub.docker.com/r/thebrokenrail/minecraft-pi-reborn-server).
|
||||
An official Docker image is also provided: [thebrokenrail/minecraft-pi-reborn-legacy-server](https://hub.docker.com/r/thebrokenrail/minecraft-pi-reborn-legacy-server).
|
||||
|
||||
## Server Limitations
|
||||
* Player data is not saved because of limitations with MCPE LAN worlds
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Manual Installation
|
||||
[Download Packages Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/)
|
||||
[Download Packages Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/legacy/lastSuccessfulBuild/artifact/out/)
|
||||
|
||||
## Picking A Package
|
||||
|
||||
### Name Format
|
||||
```
|
||||
minecraft-pi-reborn-<Variant>_X.Y.Z_<Architecture>
|
||||
minecraft-pi-reborn-legacy-<Variant>_X.Y.Z_<Architecture>
|
||||
```
|
||||
|
||||
### Picking A Variant
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Sound
|
||||
One of MCPI-Reborn's main modifications is a sound-engine since MCPI doesn't include one by default[^1]. However, it can't be used out-of-box because MCPI doesn't contain any sound data and MCPI-Reborn can't include it because of copyright.
|
||||
|
||||
MCPE's sound data can be extracted from any MCPE v0.6.1[^2] APK file, just place its `libminecraftpe.so` into `~/.minecraft-pi/overrides` and you should have sound!
|
||||
MCPE's sound data can be extracted from any MCPE v0.5.0[^2] APK file, just place its `libminecraftpe.so` into `~/.minecraft-pi/overrides` and you should have sound!
|
||||
|
||||
[^1]: The mute button is just leftover code from MCPE, it doesn't actually do anything in un-modded MCPI, however it is connected to MCPI-Reborn's sound-engine.
|
||||
[^2]: This isn't a hard limit, an MCPE v0.8.1 APK would probably work, but don't rely on it.
|
||||
|
BIN
images/start.png
BIN
images/start.png
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@ -12,21 +12,21 @@ if(BUILD_NATIVE_COMPONENTS)
|
||||
# Install
|
||||
install(TARGETS launcher DESTINATION "${MCPI_INSTALL_DIR}")
|
||||
install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_VARIANT_NAME}")
|
||||
set(ICON_PATH "data/com.thebrokenrail.MCPIReborn.png")
|
||||
set(ICON_PATH "data/com.thebrokenrail.MCPIRebornLegacy.png")
|
||||
set(ICON_TARGET_PATH "share/icons/hicolor/scalable/apps")
|
||||
if(NOT MCPI_SERVER_MODE)
|
||||
install(DIRECTORY "data/client/" DESTINATION ".")
|
||||
install(
|
||||
FILES "${ICON_PATH}"
|
||||
DESTINATION "${ICON_TARGET_PATH}"
|
||||
RENAME "com.thebrokenrail.MCPIRebornClient.png"
|
||||
RENAME "com.thebrokenrail.MCPIRebornLegacyClient.png"
|
||||
)
|
||||
else()
|
||||
install(DIRECTORY "data/server/" DESTINATION ".")
|
||||
install(
|
||||
FILES "${ICON_PATH}"
|
||||
DESTINATION "${ICON_TARGET_PATH}"
|
||||
RENAME "com.thebrokenrail.MCPIRebornServer.png"
|
||||
RENAME "com.thebrokenrail.MCPIRebornLegacyServer.png"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,16 +1,17 @@
|
||||
TRUE Touch GUI
|
||||
TRUE Fix Bow & Arrow
|
||||
TRUE Fix Attacking
|
||||
FALSE Force Mob Spawning
|
||||
TRUE Fancy Graphics
|
||||
TRUE Disable Autojump By Default
|
||||
TRUE Display Nametags By Default
|
||||
TRUE Fix Sign Placement
|
||||
TRUE Show Block Outlines
|
||||
FALSE Expand Creative Inventory
|
||||
FALSE Remove Creative Mode Restrictions
|
||||
FALSE Peaceful Mode
|
||||
TRUE Animated Water
|
||||
TRUE Remove Invalid Item Background
|
||||
TRUE Disable "gui_blocks" Atlas
|
||||
TRUE Smooth Lighting
|
||||
FALSE 3D Anaglyph
|
||||
TRUE Fix Camera Rendering
|
||||
TRUE Implement Chat
|
||||
@ -28,8 +29,8 @@ TRUE Implement Sound Engine
|
||||
TRUE Close Current Screen On Death
|
||||
FALSE Disable Raw Mouse Motion (Not Recommended)
|
||||
TRUE Fix Furnace Not Checking Item Auxiliary
|
||||
FALSE Disable Hosting LAN Worlds
|
||||
TRUE Improved Cursor Rendering
|
||||
FALSE Disable V-Sync
|
||||
TRUE Fix Options Screen
|
||||
FALSE Force Touch Inventory
|
||||
TRUE Fix Pause Menu
|
@ -1,10 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Minecraft: Pi Edition: Reborn (Client)
|
||||
Comment=Fun with Blocks
|
||||
Icon=com.thebrokenrail.MCPIRebornClient
|
||||
StartupNotify=false
|
||||
StartupWMClass=Minecraft: Pi Edition: Reborn
|
||||
Exec=minecraft-pi-reborn-client
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;
|
@ -0,0 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Name=Minecraft: Pi Edition: Reborn Legacy (Client)
|
||||
Comment=Fun with Blocks
|
||||
Icon=com.thebrokenrail.MCPIRebornLegacyClient
|
||||
StartupNotify=false
|
||||
StartupWMClass=Minecraft: Pi Edition: Reborn Legacy
|
||||
Exec=minecraft-pi-reborn-legacy-client
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;
|
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>com.thebrokenrail.MCPIRebornClient</id>
|
||||
<name>Minecraft: Pi Edition: Reborn (Client)</name>
|
||||
<id>com.thebrokenrail.MCPIRebornLegacyClient</id>
|
||||
<name>Minecraft: Pi Edition: Reborn Legacy (Client)</name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<summary>Fun with Blocks</summary>
|
||||
<description><p>Minecraft: Pi Edition Modding Project.</p><p>NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.</p></description>
|
||||
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn</url>
|
||||
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/src/branch/legacy</url>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/raw/branch/master/images/start.png</image>
|
||||
<image>https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/raw/branch/legacy/images/start.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornClient.desktop</launchable>
|
||||
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornLegacyClient.desktop</launchable>
|
||||
<provides>
|
||||
<id>com.thebrokenrail.MCPIRebornClient.desktop</id>
|
||||
<id>com.thebrokenrail.MCPIRebornLegacyClient.desktop</id>
|
||||
</provides>
|
||||
<project_license>LicenseRef-proprietary</project_license>
|
||||
<developer_name>TheBrokenRail & Mojang AB</developer_name>
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Minecraft: Pi Edition: Reborn Legacy (Server)
|
||||
Comment=Fun with Blocks
|
||||
Icon=com.thebrokenrail.MCPIRebornLegacyServer
|
||||
Exec=minecraft-pi-reborn-legacy-server
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Categories=Game;
|
||||
NoDisplay=true
|
@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Minecraft: Pi Edition: Reborn (Server)
|
||||
Comment=Fun with Blocks
|
||||
Icon=com.thebrokenrail.MCPIRebornServer
|
||||
Exec=minecraft-pi-reborn-server
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Categories=Game;
|
||||
NoDisplay=true
|
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>com.thebrokenrail.MCPIRebornServer</id>
|
||||
<name>Minecraft: Pi Edition: Reborn (Server)</name>
|
||||
<id>com.thebrokenrail.MCPIRebornLegacyServer</id>
|
||||
<name>Minecraft: Pi Edition: Reborn Legacy (Server)</name>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<summary>Fun with Blocks</summary>
|
||||
<description><p>Minecraft: Pi Edition Modding Project.</p><p>NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.</p></description>
|
||||
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn</url>
|
||||
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornServer.desktop</launchable>
|
||||
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/src/branch/legacy</url>
|
||||
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornLegacyServer.desktop</launchable>
|
||||
<provides>
|
||||
<id>com.thebrokenrail.MCPIRebornServer.desktop</id>
|
||||
<id>com.thebrokenrail.MCPIRebornLegacyServer.desktop</id>
|
||||
</provides>
|
||||
<project_license>LicenseRef-proprietary</project_license>
|
||||
<developer_name>TheBrokenRail & Mojang AB</developer_name>
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define GUI_TITLE "Minecraft: Pi Edition: Reborn"
|
||||
#define GUI_TITLE "Minecraft: Pi Edition: Reborn Legacy"
|
||||
|
@ -28,7 +28,7 @@ if(MCPI_SERVER_MODE)
|
||||
add_library(server SHARED src/server/server.cpp src/server/server_properties.cpp)
|
||||
target_link_libraries(server reborn-patch symbols feature home misc compat dl media-layer-core pthread)
|
||||
else()
|
||||
target_link_libraries(compat input sign chat home dl)
|
||||
target_link_libraries(compat input chat home dl)
|
||||
|
||||
target_link_libraries(chat input)
|
||||
|
||||
@ -41,12 +41,9 @@ else()
|
||||
add_library(camera SHARED src/camera/camera.cpp)
|
||||
target_link_libraries(camera reborn-patch symbols media-layer-core feature home)
|
||||
|
||||
add_library(input SHARED src/input/input.cpp src/input/bow.c src/input/attack.c src/input/toggle.c src/input/misc.c src/input/drop.cpp)
|
||||
add_library(input SHARED src/input/input.cpp src/input/attack.c src/input/toggle.c src/input/misc.c src/input/drop.cpp)
|
||||
target_link_libraries(input reborn-patch symbols creative feature media-layer-core)
|
||||
|
||||
add_library(sign SHARED src/sign/sign.cpp)
|
||||
target_link_libraries(sign reborn-patch symbols feature input)
|
||||
|
||||
add_library(touch SHARED src/touch/touch.cpp)
|
||||
target_link_libraries(touch reborn-patch symbols feature)
|
||||
|
||||
@ -74,8 +71,8 @@ target_link_libraries(death reborn-patch symbols feature)
|
||||
add_library(misc SHARED src/misc/misc.c src/misc/misc.cpp src/misc/logging.cpp)
|
||||
target_link_libraries(misc reborn-patch symbols media-layer-core feature GLESv1_CM)
|
||||
|
||||
add_library(options SHARED src/options/options.c src/options/options.cpp)
|
||||
target_link_libraries(options reborn-patch symbols feature home)
|
||||
add_library(options SHARED src/options/options.c)
|
||||
target_link_libraries(options reborn-patch symbols feature)
|
||||
|
||||
add_library(home SHARED src/home/home.c)
|
||||
target_link_libraries(home reborn-patch symbols)
|
||||
@ -88,7 +85,7 @@ target_link_libraries(init compat game-mode misc death options chat creative hom
|
||||
if(MCPI_SERVER_MODE)
|
||||
target_link_libraries(init server)
|
||||
else()
|
||||
target_link_libraries(init multiplayer sound camera input sign touch textures atlas)
|
||||
target_link_libraries(init multiplayer sound camera input touch textures atlas)
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
target_link_libraries(init benchmark)
|
||||
endif()
|
||||
@ -99,7 +96,7 @@ install(TARGETS init compat readdir feature game-mode misc death options chat cr
|
||||
if(MCPI_SERVER_MODE)
|
||||
install(TARGETS server DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
else()
|
||||
install(TARGETS multiplayer sound override camera input sign touch textures atlas DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
install(TARGETS multiplayer sound override camera input touch textures atlas DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
install(TARGETS benchmark DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
endif()
|
||||
|
@ -68,9 +68,9 @@ static void Tesselator_colorABGR_injection(unsigned char *tesselator, int32_t co
|
||||
// Call Original Method
|
||||
(*Tesselator_colorABGR)(tesselator, color);
|
||||
}
|
||||
static void Tesselator_begin_injection(unsigned char *tesselator, int32_t mode) {
|
||||
static void Tesselator_begin_injection(unsigned char *tesselator) {
|
||||
// Call Original Method
|
||||
(*Tesselator_begin)(tesselator, mode);
|
||||
(*Tesselator_begin)(tesselator);
|
||||
|
||||
// Fix Furnace UI
|
||||
if (item_color_fix_mode != 0) {
|
||||
@ -124,15 +124,15 @@ void init_atlas() {
|
||||
|
||||
// Disable The gui_blocks Atlas Which Contains Pre-Rendered Textures For Blocks In The Inventory
|
||||
if (feature_has("Disable \"gui_blocks\" Atlas", server_disabled)) {
|
||||
unsigned char disable_gui_blocks_atlas_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x63c2c, disable_gui_blocks_atlas_patch);
|
||||
unsigned char disable_gui_blocks_atlas_patch[4] = {0x45, 0x00, 0x00, 0xea}; // "b 0x7f740"
|
||||
patch((void *) 0x7f624, disable_gui_blocks_atlas_patch);
|
||||
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled
|
||||
overwrite_calls((void *) ItemRenderer_renderGuiItemCorrect, (void *) ItemRenderer_renderGuiItemCorrect_injection);
|
||||
// Fix Furnace UI
|
||||
overwrite_calls((void *) Tesselator_colorABGR, (void *) Tesselator_colorABGR_injection);
|
||||
overwrite_calls((void *) Tesselator_begin, (void *) Tesselator_begin_injection);
|
||||
overwrite_calls((void *) Tesselator_color, (void *) Tesselator_color_injection);
|
||||
overwrite_call((void *) 0x32324, (void *) FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection);
|
||||
overwrite_call((void *) 0x1e21c, (void *) InventoryPane_renderBatch_Tesselator_color_injection);
|
||||
overwrite_call((void *) 0x3bff4, (void *) FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection);
|
||||
overwrite_call((void *) 0x23c0c, (void *) InventoryPane_renderBatch_Tesselator_color_injection);
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,6 @@ void init_camera() {
|
||||
// Enable TripodCameraRenderer
|
||||
overwrite_calls((void *) EntityRenderDispatcher, (void *) EntityRenderDispatcher_injection);
|
||||
// Display Smoke From TripodCamera Higher
|
||||
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
||||
overwrite_call((void *) 0xbcf18, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,8 @@ static void CommandServer_parse_CommandServer_dispatchPacket_injection(unsigned
|
||||
|
||||
// Handle ChatPacket Server-Side
|
||||
static void ServerSideNetworkHandler_handle_ChatPacket_injection(unsigned char *server_side_network_handler, RakNet_RakNetGUID *rak_net_guid, unsigned char *chat_packet) {
|
||||
unsigned char *player = (*ServerSideNetworkHandler_getPlayer)(server_side_network_handler, rak_net_guid);
|
||||
unsigned char *level = *(unsigned char **) (server_side_network_handler + ServerSideNetworkHandler_level_property_offset);
|
||||
unsigned char *player = (*NetEventCallback_findPlayer)(server_side_network_handler, level, rak_net_guid);
|
||||
if (player != NULL) {
|
||||
char *username = *(char **) (player + Player_username_property_offset);
|
||||
char *message = *(char **) (chat_packet + ChatPacket_message_property_offset);
|
||||
@ -123,9 +124,9 @@ void init_chat() {
|
||||
if (_chat_enabled) {
|
||||
// Disable Original ChatPacket Loopback
|
||||
unsigned char disable_chat_packet_loopback_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x6b490, disable_chat_packet_loopback_patch);
|
||||
patch((void *) 0x8c118, disable_chat_packet_loopback_patch);
|
||||
// Manually Send (And Loopback) ChatPacket
|
||||
overwrite_call((void *) 0x6b518, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection);
|
||||
overwrite_call((void *) 0x8c1a4, (void *) CommandServer_parse_CommandServer_dispatchPacket_injection);
|
||||
// Re-Broadcast ChatPacket
|
||||
patch_address(ServerSideNetworkHandler_handle_ChatPacket_vtable_addr, (void *) ServerSideNetworkHandler_handle_ChatPacket_injection);
|
||||
// Send Messages On Input Tick
|
||||
|
@ -8,11 +8,11 @@ static void do_nothing() {
|
||||
// Patch bcm_host Calls
|
||||
__attribute__((constructor)) static void patch_bcm_host_calls() {
|
||||
// Disable bcm_host Calls
|
||||
overwrite_call((void *) 0xdfec, (void *) do_nothing); // bcm_host_init
|
||||
overwrite_call((void *) 0x12418, (void *) do_nothing); // bcm_host_deinit
|
||||
overwrite_call((void *) 0x125a8, (void *) do_nothing); // graphics_get_display_size
|
||||
overwrite_call((void *) 0x125dc, (void *) do_nothing); // vc_dispmanx_display_open
|
||||
overwrite_call((void *) 0x125e8, (void *) do_nothing); // vc_dispmanx_update_start
|
||||
overwrite_call((void *) 0x12618, (void *) do_nothing); // vc_dispmanx_element_add
|
||||
overwrite_call((void *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
||||
overwrite_call((void *) 0xdbe8, (void *) do_nothing); // bcm_host_init
|
||||
overwrite_call((void *) 0x11c54, (void *) do_nothing); // bcm_host_deinit
|
||||
overwrite_call((void *) 0x11de4, (void *) do_nothing); // graphics_get_display_size
|
||||
overwrite_call((void *) 0x11e18, (void *) do_nothing); // vc_dispmanx_display_open
|
||||
overwrite_call((void *) 0x11e28, (void *) do_nothing); // vc_dispmanx_update_start
|
||||
overwrite_call((void *) 0x11e58, (void *) do_nothing); // vc_dispmanx_element_add
|
||||
overwrite_call((void *) 0x11e64, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <media-layer/core.h>
|
||||
|
||||
#include "../input/input.h"
|
||||
#include "../sign/sign.h"
|
||||
#include "../chat/chat.h"
|
||||
#include "../home/home.h"
|
||||
|
||||
@ -84,20 +83,12 @@ HOOK(SDL_PollEvent, int, (SDL_Event *event)) {
|
||||
}
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP: {
|
||||
// Track Right-Click State
|
||||
if (event->button.button == SDL_BUTTON_RIGHT) {
|
||||
input_set_is_right_click(event->button.state != SDL_RELEASED);
|
||||
} else if (event->button.button == SDL_BUTTON_LEFT) {
|
||||
// Track Left-Click State
|
||||
if (event->button.button == SDL_BUTTON_LEFT) {
|
||||
input_set_is_left_click(event->button.state != SDL_RELEASED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDL_USEREVENT: {
|
||||
// SDL_UserEvent Is Never Used In MCPI, So It Is Repurposed For Character Events
|
||||
sign_key_press((char) event->user.code);
|
||||
handled = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
|
@ -23,17 +23,17 @@ static EGLBoolean eglSwapBuffers_injection(__attribute__((unused)) EGLDisplay di
|
||||
__attribute__((constructor)) static void patch_egl_calls() {
|
||||
// Disable EGL Calls
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x1250c, nop_patch); // eglTerminate
|
||||
patch((void *) 0x12580, nop_patch); // eglBindAPI
|
||||
overwrite_call((void *) 0x12638, (void *) eglCreateWindowSurface_injection); // eglCreateWindowSurface
|
||||
patch((void *) 0x12578, nop_patch); // eglChooseConfig
|
||||
patch((void *) 0x1255c, nop_patch); // eglInitialize
|
||||
patch((void *) 0x124f0, nop_patch); // eglMakeCurrent #1
|
||||
patch((void *) 0x12654, nop_patch); // eglMakeCurrent #2
|
||||
overwrite_call((void *) 0x124dc, (void *) eglSwapBuffers_injection); // eglSwapBuffers #1
|
||||
overwrite_call((void *) 0x14b6c, (void *) eglSwapBuffers_injection); // eglSwapBuffers #2
|
||||
overwrite_call((void *) 0x1254c, (void *) eglGetDisplay_injection); // eglGetDisplay
|
||||
patch((void *) 0x124fc, nop_patch); // eglDestroySurface #1
|
||||
patch((void *) 0x12504, nop_patch); // eglDestroySurface #2
|
||||
overwrite_call((void *) 0x12594, (void *) eglCreateContext_injection); // eglCreateContext
|
||||
patch((void *) 0x11d3c, nop_patch); // eglTerminate
|
||||
patch((void *) 0x11dbc, nop_patch); // eglBindAPI
|
||||
overwrite_call((void *) 0x11e78, (void *) eglCreateWindowSurface_injection); // eglCreateWindowSurface
|
||||
patch((void *) 0x11db4, nop_patch); // eglChooseConfig
|
||||
patch((void *) 0x11d98, nop_patch); // eglInitialize
|
||||
patch((void *) 0x11d20, nop_patch); // eglMakeCurrent #1
|
||||
patch((void *) 0x11e90, nop_patch); // eglMakeCurrent #2
|
||||
overwrite_call((void *) 0x11d0c, (void *) eglSwapBuffers_injection); // eglSwapBuffers #1
|
||||
overwrite_call((void *) 0x14ce4, (void *) eglSwapBuffers_injection); // eglSwapBuffers #2
|
||||
overwrite_call((void *) 0x11d7c, (void *) eglGetDisplay_injection); // eglGetDisplay
|
||||
patch((void *) 0x11d2c, nop_patch); // eglDestroySurface #1
|
||||
patch((void *) 0x11d34, nop_patch); // eglDestroySurface #2
|
||||
overwrite_call((void *) 0x11dd0, (void *) eglCreateContext_injection); // eglCreateContext
|
||||
}
|
||||
|
@ -23,6 +23,6 @@ static int XGetWindowAttributes_injection(__attribute__((unused)) void *display,
|
||||
// Patch X11 Calls
|
||||
__attribute__((constructor)) static void patch_x11_calls() {
|
||||
// Disable X11 Calls
|
||||
overwrite_call((void *) 0x132a4, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes
|
||||
overwrite_call((void *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
||||
overwrite_call((void *) 0x12f2c, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes
|
||||
overwrite_call((void *) 0x12f64, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <vector>
|
||||
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <symbols/minecraft.h>
|
||||
|
||||
@ -20,6 +22,7 @@ static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(un
|
||||
int32_t ret = (*FillingContainer_addItem)(filling_container, item_instance);
|
||||
|
||||
// Add Items
|
||||
inventory_add_item(filling_container, *Item_sign, false);
|
||||
inventory_add_item(filling_container, *Item_flintAndSteel, false);
|
||||
inventory_add_item(filling_container, *Item_snowball, false);
|
||||
inventory_add_item(filling_container, *Item_egg, false);
|
||||
@ -39,7 +42,6 @@ static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(un
|
||||
// Add Tiles
|
||||
inventory_add_item(filling_container, *Tile_water, true);
|
||||
inventory_add_item(filling_container, *Tile_lava, true);
|
||||
inventory_add_item(filling_container, *Tile_calmWater, true);
|
||||
inventory_add_item(filling_container, *Tile_calmLava, true);
|
||||
inventory_add_item(filling_container, *Tile_glowingObsidian, true);
|
||||
inventory_add_item(filling_container, *Tile_web, true);
|
||||
@ -83,21 +85,40 @@ static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(un
|
||||
}
|
||||
#endif
|
||||
|
||||
// Hook Specific TileItem Constructor
|
||||
static unsigned char *Tile_initTiles_TileItem_injection(unsigned char *tile_item, int32_t id) {
|
||||
// Store All Default TileItems
|
||||
static std::vector<unsigned char *> &get_default_tile_items() {
|
||||
static std::vector<unsigned char *> tile_items;
|
||||
return tile_items;
|
||||
}
|
||||
// Hook Specific TileItem :;operator new
|
||||
static unsigned char *Tile_initTiles_operator_new_injection(__attribute__((unused)) uint32_t size) {
|
||||
// Call Original Method
|
||||
unsigned char *ret = (*TileItem)(tile_item, id);
|
||||
unsigned char *ret = (unsigned char *) ::operator new(AUX_DATA_TILE_ITEM_SIZE);
|
||||
|
||||
// Switch VTable
|
||||
*(unsigned char **) tile_item = AuxDataTileItem_vtable;
|
||||
// Configure Item
|
||||
*(bool *) (tile_item + Item_is_stacked_by_data_property_offset) = true;
|
||||
*(int32_t *) (tile_item + Item_max_damage_property_offset) = 0;
|
||||
*(unsigned char **) (tile_item + AuxDataTileItem_icon_tile_property_offset) = Tile_tiles[id + 0x100];
|
||||
// Store
|
||||
get_default_tile_items().push_back(ret);
|
||||
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
// Modify All Default TileItems
|
||||
static void Tile_initTiles_injection() {
|
||||
// Call Original Method
|
||||
(*Tile_initTiles)();
|
||||
|
||||
// Loop
|
||||
for (unsigned char *tile_item : get_default_tile_items()) {
|
||||
// Get ID
|
||||
int32_t id = *(int32_t *) (tile_item + Item_id_property_offset);
|
||||
// Switch VTable
|
||||
*(unsigned char **) tile_item = AuxDataTileItem_vtable;
|
||||
// Configure Item
|
||||
*(bool *) (tile_item + Item_is_stacked_by_data_property_offset) = true;
|
||||
*(int32_t *) (tile_item + Item_max_damage_property_offset) = 0;
|
||||
*(unsigned char **) (tile_item + AuxDataTileItem_icon_tile_property_offset) = Tile_tiles[id];
|
||||
}
|
||||
get_default_tile_items().clear();
|
||||
}
|
||||
|
||||
// Check Restriction Status
|
||||
static int is_restricted = 1;
|
||||
@ -110,17 +131,16 @@ void init_creative() {
|
||||
// Add Extra Items To Creative Inventory (Only Replace Specific Function Call)
|
||||
if (feature_has("Expand Creative Inventory", server_enabled)) {
|
||||
#ifndef MCPI_SERVER_MODE
|
||||
overwrite_call((void *) 0x8e0fc, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
overwrite_call((void *) 0xcdcf4, (void *) Inventory_setupDefault_FillingContainer_addItem_call_injection);
|
||||
#endif
|
||||
|
||||
// Use AuxDataTileItem by default instead of TileItem, so tiles in the Creative
|
||||
// Inventory can have arbitrary auxiliary values.
|
||||
{
|
||||
// Fix Size
|
||||
unsigned char size_patch[4] = {AUX_DATA_TILE_ITEM_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #AUX_DATA_TILE_ITEM_SIZE"
|
||||
patch((void *) 0xc6f64, size_patch);
|
||||
// Hook Constructor
|
||||
overwrite_call((void *) 0xc6f74, (void *) Tile_initTiles_TileItem_injection);
|
||||
// Hook TileItem ::operator new To Store TileItems
|
||||
overwrite_call((void *) 0x1295a4, (void *) Tile_initTiles_operator_new_injection);
|
||||
// Modify Stored TileItems
|
||||
overwrite_calls((void *) Tile_initTiles, (void *) Tile_initTiles_injection);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,34 +148,35 @@ void init_creative() {
|
||||
if (feature_has("Remove Creative Mode Restrictions", server_disabled)) {
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
// Remove Restrictions
|
||||
patch((void *) 0x43ee8, nop_patch);
|
||||
patch((void *) 0x43f3c, nop_patch);
|
||||
patch((void *) 0x43f8c, nop_patch);
|
||||
patch((void *) 0x43fd8, nop_patch);
|
||||
patch((void *) 0x99010, nop_patch);
|
||||
patch((void *) 0x59e68, nop_patch);
|
||||
patch((void *) 0x59ebc, nop_patch);
|
||||
patch((void *) 0x59f10, nop_patch);
|
||||
unsigned char allow_eating_patch[4] = {0x02, 0x00, 0x00, 0xea}; // "b 0xddcbc"
|
||||
patch((void *) 0xddcac, allow_eating_patch);
|
||||
// Fix UI
|
||||
patch((void *) 0x341c0, nop_patch);
|
||||
patch((void *) 0x3adb4, nop_patch);
|
||||
patch((void *) 0x3b374, nop_patch);
|
||||
patch((void *) 0x4cb88, nop_patch);
|
||||
unsigned char fix_ui_patch[4] = {0x05, 0x00, 0x55, 0xe1}; // "cmp r5, r5"
|
||||
patch((void *) 0x4bf20, fix_ui_patch);
|
||||
// Fix Inventory
|
||||
patch((void *) 0xcce90, nop_patch);
|
||||
patch((void *) 0xd5548, nop_patch);
|
||||
unsigned char inv_creative_check_r3_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3"
|
||||
patch((void *) 0xd497c, inv_creative_check_r3_patch);
|
||||
unsigned char inv_creative_check_r5_patch[4] = {0x05, 0x00, 0x55, 0xe1}; // "cmp r5, r5"
|
||||
patch((void *) 0xd4d94, inv_creative_check_r5_patch);
|
||||
patch((void *) 0xd50ac, nop_patch);
|
||||
patch((void *) 0x8d080, nop_patch);
|
||||
patch((void *) 0x8d090, nop_patch);
|
||||
patch((void *) 0x91d48, nop_patch);
|
||||
patch((void *) 0x92098, nop_patch);
|
||||
unsigned char inv_creative_check_r3_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3"
|
||||
patch((void *) 0x923c0, inv_creative_check_r3_patch);
|
||||
patch((void *) 0x92828, nop_patch);
|
||||
patch((void *) 0x92830, nop_patch);
|
||||
// Display Slot Count
|
||||
patch((void *) 0x1e3f4, nop_patch);
|
||||
unsigned char slot_count_patch[4] = {0x18, 0x00, 0x00, 0xea}; // "b 0x27110"
|
||||
patch((void *) 0x270a8, slot_count_patch);
|
||||
patch((void *) 0x33954, nop_patch);
|
||||
patch((void *) 0x23d4c, nop_patch);
|
||||
patch((void *) 0x2c570, nop_patch);
|
||||
patch((void *) 0x3eec0, nop_patch);
|
||||
// Maximize Creative Inventory Stack Size
|
||||
unsigned char maximize_stack_patch[4] = {0xff, 0xc0, 0xa0, 0xe3}; // "mov r12, 0xff"
|
||||
patch((void *) 0x8e104, maximize_stack_patch);
|
||||
unsigned char maximize_stack_patch[4] = {0xff, 0x60, 0xa0, 0xe3}; // "mov r6, 0xff"
|
||||
patch((void *) 0xccf80, maximize_stack_patch);
|
||||
// Allow Nether Reactor
|
||||
patch((void *) 0xc0290, nop_patch);
|
||||
unsigned char nether_reactor_patch[4] = {0x00, 0x00, 0xa0, 0xe3}; // "mov r0, #0x0"
|
||||
patch((void *) 0x12283c, nether_reactor_patch);
|
||||
// Disable Other Restrictions
|
||||
is_restricted = 0;
|
||||
}
|
||||
|
@ -14,14 +14,14 @@ static void set_is_survival(int new_is_survival) {
|
||||
|
||||
// Correct Inventpry UI
|
||||
unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1"
|
||||
patch((void *) 0x16efc, inventory_patch);
|
||||
patch((void *) 0x178c0, inventory_patch);
|
||||
|
||||
// Use Correct Size For GameMode Object
|
||||
unsigned char size_patch[4] = {new_is_survival ? SURVIVAL_MODE_SIZE : CREATOR_MODE_SIZE, 0x00, 0xa0, 0xe3}; // "mov r0, #SURVIVAL_MODE_SIZE" or "mov r0, #CREATOR_MODE_SIZE"
|
||||
patch((void *) 0x16ee4, size_patch);
|
||||
patch((void *) 0x178a8, size_patch);
|
||||
|
||||
// Replace Default CreatorMode Constructor With CreatorMode Or SurvivalMode Constructor
|
||||
overwrite_call((void *) 0x16ef4, new_is_survival ? SurvivalMode : CreatorMode);
|
||||
overwrite_call((void *) 0x178b8, new_is_survival ? SurvivalMode : CreatorMode);
|
||||
|
||||
is_survival = new_is_survival;
|
||||
}
|
||||
@ -54,11 +54,11 @@ void init_game_mode() {
|
||||
overwrite_calls((void *) Minecraft_setIsCreativeMode, (void *) Minecraft_setIsCreativeMode_injection);
|
||||
|
||||
// Replace CreatorLevel With ServerLevel (This Fixes Beds And Mob Spawning)
|
||||
overwrite_call((void *) 0x16f84, (void *) ServerLevel);
|
||||
overwrite_call((void *) 0x17950, (void *) ServerLevel);
|
||||
|
||||
// Allocate Correct Size For ServerLevel
|
||||
uint32_t level_size = SERVER_LEVEL_SIZE;
|
||||
patch_address((void *) 0x17004, (void *) level_size);
|
||||
patch_address((void *) 0x17a38, (void *) level_size);
|
||||
|
||||
// Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing
|
||||
overwrite_calls((void *) Minecraft_getCreator, (void *) Minecraft_getCreator_injection);
|
||||
@ -69,7 +69,7 @@ void init_game_mode() {
|
||||
|
||||
// Allow Joining Survival Servers
|
||||
if (feature_has("Allow Joining Survival Servers", server_enabled)) {
|
||||
unsigned char server_patch[4] = {0x0f, 0x00, 0x00, 0xea}; // "b 0x6dcb4"
|
||||
patch((void *) 0x6dc70, server_patch);
|
||||
unsigned char server_patch[4] = {0x16, 0x00, 0x00, 0xea}; // "b 0x8e998"
|
||||
patch((void *) 0x8e938, server_patch);
|
||||
}
|
||||
}
|
||||
|
@ -9,17 +9,19 @@ static unsigned char *get_minecraft_from_screen(unsigned char *screen) {
|
||||
return *(unsigned char **) (screen + Screen_minecraft_property_offset);
|
||||
}
|
||||
|
||||
// Redirect Create World Button To SimpleLevelChooseScreen
|
||||
// Redirect Create World Button To DemoLevelChooseScreen
|
||||
#define WORLD_NAME "world"
|
||||
static void SelectWorldScreen_tick_injection(unsigned char *screen) {
|
||||
bool create_world = *(bool *) (screen + SelectWorldScreen_should_create_world_property_offset);
|
||||
if (create_world) {
|
||||
// Get New World Name
|
||||
free(*demo_level_name);
|
||||
std::string new_name = (*SelectWorldScreen_getUniqueLevelName)(screen, WORLD_NAME);
|
||||
// Create SimpleLevelChooseScreen
|
||||
unsigned char *new_screen = (unsigned char *) ::operator new(SIMPLE_LEVEL_CHOOSE_SCREEN_SIZE);
|
||||
patch_address((void *) demo_level_name, (void *) strdup(new_name.c_str()));
|
||||
// Create DemoLevelChooseScreen
|
||||
unsigned char *new_screen = (unsigned char *) ::operator new(DEMO_LEVEL_CHOOSE_SCREEN_SIZE);
|
||||
ALLOC_CHECK(new_screen);
|
||||
(*SimpleChooseLevelScreen)(new_screen, new_name);
|
||||
(*DemoChooseLevelScreen)(new_screen);
|
||||
// Set Screen
|
||||
unsigned char *minecraft = get_minecraft_from_screen(screen);
|
||||
(*Minecraft_setScreen)(minecraft, new_screen);
|
||||
@ -33,11 +35,13 @@ static void Touch_SelectWorldScreen_tick_injection(unsigned char *screen) {
|
||||
bool create_world = *(bool *) (screen + Touch_SelectWorldScreen_should_create_world_property_offset);
|
||||
if (create_world) {
|
||||
// Get New World Name
|
||||
free(*demo_level_name);
|
||||
std::string new_name = (*Touch_SelectWorldScreen_getUniqueLevelName)(screen, WORLD_NAME);
|
||||
// Create SimpleLevelChooseScreen
|
||||
unsigned char *new_screen = (unsigned char *) ::operator new(SIMPLE_LEVEL_CHOOSE_SCREEN_SIZE);
|
||||
patch_address((void *) demo_level_name, (void *) strdup(new_name.c_str()));
|
||||
// Create DemoLevelChooseScreen
|
||||
unsigned char *new_screen = (unsigned char *) ::operator new(DEMO_LEVEL_CHOOSE_SCREEN_SIZE);
|
||||
ALLOC_CHECK(new_screen);
|
||||
(*SimpleChooseLevelScreen)(new_screen, new_name);
|
||||
(*DemoChooseLevelScreen)(new_screen);
|
||||
// Set Screen
|
||||
unsigned char *minecraft = get_minecraft_from_screen(screen);
|
||||
(*Minecraft_setScreen)(minecraft, new_screen);
|
||||
@ -52,8 +56,16 @@ void _init_game_mode_cpp() {
|
||||
// Hijack Create World Button
|
||||
patch_address(SelectWorldScreen_tick_vtable_addr, (void *) SelectWorldScreen_tick_injection);
|
||||
patch_address(Touch_SelectWorldScreen_tick_vtable_addr, (void *) Touch_SelectWorldScreen_tick_injection);
|
||||
// Make The SimpleChooseLevelScreen Back Button Go To SelectWorldScreen Instead Of StartMenuScreen
|
||||
unsigned char simple_choose_level_screen_back_button_patch[4] = {0x05, 0x10, 0xa0, 0xe3}; // "mov r1, #0x5"
|
||||
patch((void *) 0x31144, simple_choose_level_screen_back_button_patch);
|
||||
patch((void *) 0x3134c, simple_choose_level_screen_back_button_patch);
|
||||
// Make The DemoChooseLevelScreen Back Button Go To SelectWorldScreen Instead Of StartMenuScreen
|
||||
unsigned char demo_choose_level_screen_back_button_patch[4] = {0x05, 0x10, 0xa0, 0xe3}; // "mov r1, #0x5"
|
||||
patch((void *) 0x3a298, demo_choose_level_screen_back_button_patch);
|
||||
patch((void *) 0x39fa0, demo_choose_level_screen_back_button_patch);
|
||||
}
|
||||
// Reset Level Name
|
||||
__attribute__((constructor)) static void _reset_level_name() {
|
||||
patch_address((void *) demo_level_name, NULL);
|
||||
}
|
||||
// Free Level Name
|
||||
__attribute__((destructor)) static void _free_level_name() {
|
||||
free(*demo_level_name);
|
||||
}
|
||||
|
@ -24,11 +24,9 @@ __attribute__((destructor)) static void _free_home() {
|
||||
// Init
|
||||
void init_home() {
|
||||
// Store Data In ~/.minecraft-pi Instead Of ~/.minecraft
|
||||
patch_address((void *) default_path, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA);
|
||||
patch_address((void *) full_data_path, (void *) home_get());
|
||||
|
||||
// Change Directory To Binary Directory Manually
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0xe0ac, nop_patch);
|
||||
// Change Directory To Binary Directory
|
||||
char *binary_directory = get_mcpi_directory();
|
||||
if (chdir(binary_directory) != 0) {
|
||||
ERR("Unable To Change Directory: %s", strerror(errno));
|
||||
|
@ -13,7 +13,6 @@ __attribute__((constructor)) static void init() {
|
||||
init_multiplayer();
|
||||
init_sound();
|
||||
init_input();
|
||||
init_sign();
|
||||
init_creative();
|
||||
init_camera();
|
||||
init_touch();
|
||||
|
@ -13,7 +13,6 @@ void init_server();
|
||||
void init_multiplayer();
|
||||
void init_sound();
|
||||
void init_input();
|
||||
void init_sign();
|
||||
void init_creative();
|
||||
void init_camera();
|
||||
void init_touch();
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <symbols/minecraft.h>
|
||||
|
||||
#include "../feature/feature.h"
|
||||
#include "input.h"
|
||||
|
||||
// Store Right-Click Status
|
||||
static int is_right_click = 0;
|
||||
void input_set_is_right_click(int val) {
|
||||
is_right_click = val;
|
||||
}
|
||||
|
||||
// Enable Bow & Arrow Fix
|
||||
static int fix_bow = 0;
|
||||
|
||||
// Handle Bow & Arrow
|
||||
static void _handle_bow(unsigned char *minecraft) {
|
||||
if (fix_bow && !is_right_click) {
|
||||
// GameMode Is Offset From minecraft By 0x160
|
||||
// Player Is Offset From minecraft By 0x18c
|
||||
unsigned char *game_mode = *(unsigned char **) (minecraft + Minecraft_game_mode_property_offset);
|
||||
unsigned char *player = *(unsigned char **) (minecraft + Minecraft_player_property_offset);
|
||||
if (player != NULL && game_mode != NULL && (*Player_isUsingItem)(player)) {
|
||||
unsigned char *game_mode_vtable = *(unsigned char **) game_mode;
|
||||
GameMode_releaseUsingItem_t GameMode_releaseUsingItem = *(GameMode_releaseUsingItem_t *) (game_mode_vtable + GameMode_releaseUsingItem_vtable_offset);
|
||||
(*GameMode_releaseUsingItem)(game_mode, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
void _init_bow() {
|
||||
// Enable Bow & Arrow Fix
|
||||
fix_bow = feature_has("Fix Bow & Arrow", server_disabled);
|
||||
input_run_on_tick(_handle_bow);
|
||||
}
|
@ -39,9 +39,6 @@ void init_input() {
|
||||
// Item Dropping
|
||||
_init_drop();
|
||||
|
||||
// Enable Bow & Arrow Fix
|
||||
_init_bow();
|
||||
|
||||
// Loop
|
||||
overwrite_calls((void *) Minecraft_tickInput, (void *) Minecraft_tickInput_injection);
|
||||
|
||||
|
@ -7,7 +7,6 @@ extern "C" {
|
||||
typedef void (*input_tick_function_t)(unsigned char *minecraft);
|
||||
void input_run_on_tick(input_tick_function_t function);
|
||||
|
||||
void input_set_is_right_click(int val);
|
||||
void input_hide_gui();
|
||||
void input_third_person();
|
||||
int input_back();
|
||||
@ -18,7 +17,6 @@ void input_set_is_left_click(int val);
|
||||
void input_set_mouse_grab_state(int state);
|
||||
|
||||
__attribute__((visibility("internal"))) void _init_attack();
|
||||
__attribute__((visibility("internal"))) void _init_bow();
|
||||
__attribute__((visibility("internal"))) void _init_misc();
|
||||
__attribute__((visibility("internal"))) void _init_toggle();
|
||||
__attribute__((visibility("internal"))) void _init_drop();
|
||||
|
@ -87,7 +87,7 @@ void _init_misc() {
|
||||
overwrite_calls((void *) Gui_handleClick, (void *) Gui_handleClick_injection);
|
||||
}
|
||||
// Disable Item Dropping Using The Cursor When Cursor Is Hidden
|
||||
overwrite_call((void *) 0x27800, (void *) Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection);
|
||||
overwrite_call((void *) 0x2b130, (void *) Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection);
|
||||
|
||||
input_run_on_tick(_handle_back);
|
||||
input_run_on_tick(_handle_mouse_grab);
|
||||
|
@ -201,12 +201,17 @@ static void GameRenderer_render_injection(unsigned char *game_renderer, float pa
|
||||
}
|
||||
}
|
||||
|
||||
// Stop Checking GL Renderer
|
||||
static bool AppPlatform_isPowerVR_injection(__attribute__((unused)) unsigned char *app_platform) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Init
|
||||
void init_misc() {
|
||||
// Remove Invalid Item Background (A Red Background That Appears For Items That Are Not Included In The gui_blocks Atlas)
|
||||
if (feature_has("Remove Invalid Item Background", server_disabled)) {
|
||||
unsigned char invalid_item_background_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x63c98, invalid_item_background_patch);
|
||||
patch((void *) 0x7f7e8, invalid_item_background_patch);
|
||||
}
|
||||
|
||||
// Render Selected Item Text + Hide Chat Messages
|
||||
@ -223,7 +228,7 @@ void init_misc() {
|
||||
overwrite_calls((void *) RakNet_RakString, (void *) RakNet_RakString_injection);
|
||||
|
||||
// Print Error Message If RakNet Startup Fails
|
||||
overwrite_call((void *) 0x73778, (void *) RakNetInstance_host_RakNet_RakPeer_Startup_injection);
|
||||
overwrite_call((void *) 0x98014, (void *) RakNetInstance_host_RakNet_RakPeer_Startup_injection);
|
||||
|
||||
// Fix Bug Where RakNetInstance Starts Pinging Potential Servers Before The "Join Game" Screen Is Opened
|
||||
overwrite_calls((void *) RakNetInstance, (void *) RakNetInstance_injection);
|
||||
@ -242,7 +247,7 @@ void init_misc() {
|
||||
if (feature_has("Improved Cursor Rendering", server_disabled)) {
|
||||
// Disable Normal Cursor Rendering
|
||||
unsigned char disable_cursor_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0x4a6c0, disable_cursor_patch);
|
||||
patch((void *) 0x61afc, disable_cursor_patch);
|
||||
// Add Custom Cursor Rendering
|
||||
overwrite_calls((void *) GameRenderer_render, (void *) GameRenderer_render_injection);
|
||||
}
|
||||
@ -252,6 +257,9 @@ void init_misc() {
|
||||
media_disable_vsync();
|
||||
}
|
||||
|
||||
// Stop Checking GL Renderer
|
||||
overwrite((void *) AppPlatform_isPowerVR, (void *) AppPlatform_isPowerVR_injection);
|
||||
|
||||
// Init C++ And Logging
|
||||
_init_misc_cpp();
|
||||
_init_misc_logging();
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "../feature/feature.h"
|
||||
#include "../init/init.h"
|
||||
#include "options.h"
|
||||
|
||||
// Force Mob Spawning
|
||||
static bool LevelData_getSpawnMobs_injection(__attribute__((unused)) unsigned char *level_data) {
|
||||
@ -42,36 +41,32 @@ static char *get_username() {
|
||||
return username;
|
||||
}
|
||||
|
||||
static int fancy_graphics;
|
||||
static int peaceful_mode;
|
||||
static int anaglyph;
|
||||
static int smooth_lighting;
|
||||
static int render_distance;
|
||||
static int server_visible;
|
||||
// Configure Options
|
||||
unsigned char *stored_options = NULL;
|
||||
static void Options_initDefaultValue_injection(unsigned char *options) {
|
||||
static void Minecraft_init_injection(unsigned char *this) {
|
||||
// Call Original Method
|
||||
(*Options_initDefaultValue)(options);
|
||||
(*Minecraft_init)(this);
|
||||
|
||||
unsigned char *options = this + Minecraft_options_property_offset;
|
||||
// Enable Fancy Graphics
|
||||
*(options + Options_fancy_graphics_property_offset) = fancy_graphics;
|
||||
// Enable Crosshair In Touch GUI
|
||||
*(options + Options_split_controls_property_offset) = 1;
|
||||
// Peaceful Mode
|
||||
*(int32_t *) (options + Options_game_difficulty_property_offset) = peaceful_mode ? 0 : 2;
|
||||
// 3D Anaglyph
|
||||
*(options + Options_3d_anaglyph_property_offset) = anaglyph;
|
||||
// Smooth Lighting
|
||||
*(options + Options_ambient_occlusion_property_offset) = smooth_lighting;
|
||||
// Render Distance
|
||||
*(int32_t *) (options + Options_render_distance_property_offset) = render_distance;
|
||||
|
||||
// Default Graphics Settings
|
||||
*(options + Options_fancy_graphics_property_offset) = 1;
|
||||
*(options + Options_ambient_occlusion_property_offset) = 1;
|
||||
|
||||
// Store
|
||||
stored_options = options;
|
||||
}
|
||||
|
||||
// Smooth Lighting
|
||||
static void TileRenderer_tesselateBlockInWorld_injection(unsigned char *tile_renderer, unsigned char *tile, int32_t x, int32_t y, int32_t z) {
|
||||
// Set Variable
|
||||
*Minecraft_useAmbientOcclusion = *(stored_options + Options_ambient_occlusion_property_offset);
|
||||
|
||||
// Call Original Method
|
||||
(*TileRenderer_tesselateBlockInWorld)(tile_renderer, tile, x, y, z);
|
||||
// Server Visible
|
||||
*(options + Options_server_visible_property_offset) = server_visible;
|
||||
}
|
||||
|
||||
// Init
|
||||
@ -81,6 +76,10 @@ void init_options() {
|
||||
overwrite((void *) LevelData_getSpawnMobs, (void *) LevelData_getSpawnMobs_injection);
|
||||
}
|
||||
|
||||
// Enable Fancy Graphics
|
||||
fancy_graphics = feature_has("Fancy Graphics", server_disabled);
|
||||
// Peaceful Mode
|
||||
peaceful_mode = feature_has("Peaceful Mode", server_auto);
|
||||
// 3D Anaglyph
|
||||
anaglyph = feature_has("3D Anaglyph", server_disabled);
|
||||
// Render Distance
|
||||
@ -90,9 +89,11 @@ void init_options() {
|
||||
#else
|
||||
render_distance = 3;
|
||||
#endif
|
||||
// Server Visible
|
||||
server_visible = !feature_has("Disable Hosting LAN Worlds", server_disabled);
|
||||
|
||||
// Set Options
|
||||
overwrite_calls((void *) Options_initDefaultValue, (void *) Options_initDefaultValue_injection);
|
||||
overwrite_calls((void *) Minecraft_init, (void *) Minecraft_init_injection);
|
||||
|
||||
// Change Username
|
||||
const char *username = get_username();
|
||||
@ -103,23 +104,26 @@ void init_options() {
|
||||
ERR("Default Username Is Invalid");
|
||||
}
|
||||
patch_address((void *) default_username, (void *) username);
|
||||
unsigned char username_length_patch[4] = {(unsigned char) strlen(username), 0x20, 0xa0, 0xe3}; // "mov r2, #USERNAME_LENGTH"
|
||||
patch((void *) 0x1ba2c, username_length_patch);
|
||||
|
||||
// Disable Autojump By Default
|
||||
if (feature_has("Disable Autojump By Default", server_disabled)) {
|
||||
unsigned char autojump_patch[4] = {0x00, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0"
|
||||
patch((void *) 0x44b90, autojump_patch);
|
||||
unsigned char autojump_patch[4] = {0x00, 0x00, 0xa0, 0xe3}; // "mov r0, #0x0"
|
||||
patch((void *) 0x5b148, autojump_patch);
|
||||
}
|
||||
// Display Nametags By Default
|
||||
if (feature_has("Display Nametags By Default", server_disabled)) {
|
||||
// r6 = 0x1
|
||||
// r5 = 0x0
|
||||
unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc0, 0xe5}; // "strb r6, [r0, #0x1d]"
|
||||
patch((void *) 0xa6628, display_nametags_patch);
|
||||
// r12 = 0x0
|
||||
unsigned char display_nametags_patch[4] = {0x1d, 0x60, 0xc4, 0xe5}; // "strb r6, [r4, #0x1d]"
|
||||
patch((void *) 0xf2d44, display_nametags_patch);
|
||||
}
|
||||
|
||||
// Smooth Lighting
|
||||
overwrite_calls((void *) TileRenderer_tesselateBlockInWorld, (void *) TileRenderer_tesselateBlockInWorld_injection);
|
||||
|
||||
// Init C++
|
||||
_init_options_cpp();
|
||||
// Enable Smooth Lighting
|
||||
smooth_lighting = feature_has("Smooth Lighting", server_disabled);
|
||||
if (smooth_lighting) {
|
||||
unsigned char smooth_lighting_patch[4] = {0x01, 0x00, 0x53, 0xe3}; // "cmp r3, #0x1"
|
||||
patch((void *) 0x73b74, smooth_lighting_patch);
|
||||
}
|
||||
}
|
||||
|
@ -1,226 +0,0 @@
|
||||