├── .gitea
└── workflows
│ └── build.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── README.md
├── VERSION
├── cmake
├── cpack
│ ├── appimage.cmake
│ └── packaging.cmake
├── options
│ ├── core-options.cmake
│ ├── extra-options.cmake
│ └── paths.cmake
├── toolchain
│ ├── amd64-toolchain.cmake
│ ├── arm64-toolchain.cmake
│ ├── armhf-toolchain.cmake
│ ├── base-toolchain.cmake
│ └── prebuilt
│ │ ├── armhf-toolchain.cmake
│ │ └── sysroot.cmake
└── util
│ ├── export.cmake
│ ├── io.cmake
│ ├── resource.c.in
│ └── util.cmake
├── dependencies
├── CMakeLists.txt
├── LIEF
│ └── CMakeLists.txt
├── glfw
│ └── CMakeLists.txt
├── imgui
│ ├── CMakeLists.txt
│ ├── fix-hidpi.patch
│ └── glad
│ │ ├── CMakeLists.txt
│ │ └── include
│ │ └── GL
│ │ └── gl.h
├── minecraft-pi
│ ├── CMakeLists.txt
│ └── minecraft-pi-0.1.1.tar.gz
├── runtime
│ └── CMakeLists.txt
├── stb_image
│ ├── CMakeLists.txt
│ └── src
│ │ └── stb_image_impl.c
├── symbol-processor
│ └── CMakeLists.txt
└── utf8cpp
│ └── CMakeLists.txt
├── docs
├── API.md
├── CHANGELOG.md
├── CONTROLS.md
├── CREDITS.md
├── CUSTOM_SKINS.md
├── DEDICATED_SERVER.md
├── GETTING_STARTED.md
├── README.md
├── TERMINOLOGY.md
└── modding
│ ├── ADVANCED.md
│ ├── BEGINNER.md
│ ├── GHIDRA.md
│ ├── INTERMEDIATE.md
│ ├── MY_FIRST_MOD.md
│ └── README.md
├── example-mods
├── README.md
├── build.sh
├── chat-commands
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── src
│ │ ├── chat-commands.cpp
│ │ └── server-console-command.cpp
├── custom-block
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── src
│ │ └── custom-block.cpp
├── expanded-creative
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── src
│ │ └── expanded-creative.cpp
└── recipes
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── src
│ └── recipes.cpp
├── images
├── CMakeLists.txt
├── background.png
├── icon.png
├── modern_logo.png
├── mojang
│ ├── chest.png
│ ├── grasscolor.png
│ ├── shadow.png
│ └── vignette.png
└── screenshots
│ ├── launcher.png
│ └── start.png
├── launcher
├── CMakeLists.txt
├── data
│ ├── appstream.xml
│ └── launcher.desktop
└── src
│ ├── bootstrap
│ ├── assets.cpp
│ ├── bootstrap.cpp
│ ├── bootstrap.h
│ ├── debug.cpp
│ ├── mods.cpp
│ └── patchelf.cpp
│ ├── client
│ ├── cache.cpp
│ ├── cache.h
│ ├── configuration.cpp
│ ├── configuration.h
│ └── ui
│ │ ├── about.cpp
│ │ ├── advanced.cpp
│ │ ├── main.cpp
│ │ ├── servers.cpp
│ │ └── window.cpp
│ ├── logger
│ ├── crash-report.cpp
│ ├── logger.cpp
│ └── logger.h
│ ├── main.cpp
│ ├── options
│ ├── option-list.h
│ ├── parser.cpp
│ └── parser.h
│ ├── ui
│ ├── color.cpp
│ ├── frame.cpp
│ └── frame.h
│ ├── updater
│ ├── appimage.cpp
│ ├── updater.cpp
│ └── updater.h
│ └── util
│ ├── env.cpp
│ ├── install.cpp
│ ├── sdk.cpp
│ ├── util.cpp
│ └── util.h
├── libreborn
├── CMakeLists.txt
├── include
│ └── libreborn
│ │ ├── config.h
│ │ ├── env
│ │ ├── env.h
│ │ ├── flags.h
│ │ ├── list.h
│ │ └── servers.h
│ │ ├── log.h
│ │ ├── patch.h
│ │ └── util
│ │ ├── exec.h
│ │ ├── glfw.h
│ │ ├── io.h
│ │ ├── string.h
│ │ └── util.h
└── src
│ ├── fake-libpng
│ ├── empty.c
│ └── empty.vers
│ ├── patch
│ ├── code-block.cpp
│ ├── instruction.cpp
│ ├── patch-internal.h
│ ├── patch.cpp
│ └── segments.cpp
│ └── util
│ ├── config.cpp.in
│ ├── cp437.cpp
│ ├── env
│ ├── env.cpp
│ ├── flags
│ │ ├── available-feature-flags
│ │ ├── flags.cpp
│ │ └── node.cpp
│ └── servers.cpp
│ ├── exec.cpp
│ ├── glfw.cpp
│ ├── log.cpp
│ ├── string.cpp
│ └── util.cpp
├── media-layer
├── CMakeLists.txt
├── core
│ ├── CMakeLists.txt
│ └── src
│ │ ├── audio
│ │ ├── api.cpp
│ │ ├── audio.h
│ │ ├── engine.cpp
│ │ └── file.cpp
│ │ ├── base.cpp
│ │ └── window
│ │ ├── cursor.cpp
│ │ ├── events.cpp
│ │ ├── gles.cpp
│ │ ├── media.cpp
│ │ ├── media.h
│ │ ├── offscreen.cpp
│ │ └── util.cpp
├── include
│ ├── EGL
│ │ └── egl.h
│ ├── GLES
│ │ └── gl.h
│ ├── SDL
│ │ ├── SDL.h
│ │ ├── SDL_events.h
│ │ ├── SDL_keysym.h
│ │ ├── SDL_syswm.h
│ │ └── SDL_version.h
│ ├── X11
│ │ └── Xlib.h
│ └── media-layer
│ │ ├── audio.h
│ │ └── core.h
└── trampoline
│ ├── CMakeLists.txt
│ └── src
│ ├── GLESv1_CM.cpp
│ ├── common
│ └── common.h
│ ├── guest
│ └── guest.h
│ ├── host
│ ├── host.cpp
│ └── host.h
│ └── media-layer-core.cpp
├── mods
├── CMakeLists.txt
├── include
│ └── mods
│ │ ├── api
│ │ └── api.h
│ │ ├── atlas
│ │ └── atlas.h
│ │ ├── bucket
│ │ └── bucket.h
│ │ ├── chat
│ │ └── chat.h
│ │ ├── classic-ui
│ │ └── classic-ui.h
│ │ ├── compat
│ │ └── compat.h
│ │ ├── creative
│ │ └── creative.h
│ │ ├── feature
│ │ ├── feature.h
│ │ └── server.h
│ │ ├── fps
│ │ └── fps.h
│ │ ├── game-mode
│ │ └── game-mode.h
│ │ ├── init
│ │ └── init.h
│ │ ├── input
│ │ ├── input.h
│ │ └── key-list.h
│ │ ├── misc
│ │ └── misc.h
│ │ ├── multidraw
│ │ └── multidraw.h
│ │ ├── multiplayer
│ │ └── packets.h
│ │ ├── options
│ │ └── options.h
│ │ ├── override
│ │ └── override.h
│ │ ├── screenshot
│ │ └── screenshot.h
│ │ ├── server
│ │ ├── properties.h
│ │ └── server.h
│ │ ├── sound
│ │ └── sound.h
│ │ ├── text-input-box
│ │ ├── TextInputBox.h
│ │ └── TextInputScreen.h
│ │ ├── textures
│ │ └── textures.h
│ │ ├── title-screen
│ │ └── title-screen.h
│ │ ├── touch
│ │ └── touch.h
│ │ └── version
│ │ └── version.h
└── src
│ ├── api
│ ├── README.md
│ ├── api.cpp
│ ├── compat.cpp
│ ├── diagram.drawio
│ ├── events.cpp
│ ├── internal.h
│ ├── misc.cpp
│ └── socket.cpp
│ ├── atlas
│ ├── README.md
│ └── atlas.cpp
│ ├── benchmark
│ ├── README.md
│ └── benchmark.cpp
│ ├── bucket
│ ├── README.md
│ └── bucket.cpp
│ ├── cake
│ ├── README.md
│ └── cake.cpp
│ ├── camera
│ ├── README.md
│ └── camera.cpp
│ ├── chat
│ ├── README.md
│ ├── chat.cpp
│ ├── internal.h
│ └── ui.cpp
│ ├── classic-ui
│ ├── README.md
│ └── classic-ui.cpp
│ ├── compat
│ ├── README.md
│ ├── compat.cpp
│ ├── internal.h
│ ├── readdir.cpp
│ ├── sdl.cpp
│ └── stubs
│ │ ├── bcm_host.cpp
│ │ ├── egl.cpp
│ │ ├── sdl.cpp
│ │ └── x11.cpp
│ ├── creative
│ ├── README.md
│ └── creative.cpp
│ ├── death
│ ├── README.md
│ └── death.cpp
│ ├── f3
│ ├── README.md
│ └── f3.cpp
│ ├── feature
│ ├── README.md
│ └── feature.cpp
│ ├── fps
│ ├── README.md
│ └── fps.cpp
│ ├── game-mode
│ ├── README.md
│ ├── game-mode.cpp
│ ├── internal.h
│ └── ui.cpp
│ ├── init
│ ├── README.md
│ └── init.cpp
│ ├── input
│ ├── README.md
│ ├── attack.cpp
│ ├── bow.cpp
│ ├── drop.cpp
│ ├── input.cpp
│ ├── internal.h
│ ├── keys.cpp
│ ├── misc.cpp
│ └── toggle.cpp
│ ├── misc
│ ├── README.md
│ ├── api.cpp
│ ├── base64.cpp
│ ├── graphics.cpp
│ ├── home.cpp
│ ├── internal.h
│ ├── logging.cpp
│ ├── misc.cpp
│ ├── tinting.cpp
│ └── ui.cpp
│ ├── multidraw
│ ├── README.md
│ ├── buffer.cpp
│ ├── buffer.h
│ ├── glue.cpp
│ ├── storage.cpp
│ └── storage.h
│ ├── multiplayer
│ ├── README.md
│ ├── internal.h
│ ├── inventory.cpp
│ ├── loading
│ │ ├── init.cpp
│ │ ├── internal.h
│ │ ├── misc.cpp
│ │ ├── packets.cpp
│ │ ├── terrain.cpp
│ │ └── thread.cpp
│ ├── misc.cpp
│ ├── raknet.cpp
│ ├── server-list.cpp
│ └── syncing.cpp
│ ├── options
│ ├── README.md
│ ├── info.cpp
│ ├── internal.h
│ ├── options.cpp
│ └── ui.cpp
│ ├── override
│ ├── README.md
│ └── override.cpp
│ ├── screenshot
│ ├── README.md
│ └── screenshot.cpp
│ ├── server
│ ├── README.md
│ ├── blacklist.cpp
│ ├── commands.cpp
│ ├── internal.h
│ ├── playerdata.cpp
│ ├── properties.cpp
│ └── server.cpp
│ ├── shading
│ ├── README.md
│ ├── init.cpp
│ ├── internal.h
│ ├── lighting.cpp
│ ├── normals.cpp
│ └── tesselator.cpp
│ ├── skin
│ ├── README.md
│ ├── internal.h
│ ├── loader.cpp
│ └── skin.cpp
│ ├── sound
│ ├── README.md
│ ├── internal.h
│ ├── repository.cpp
│ └── sound.cpp
│ ├── text-input-box
│ ├── README.md
│ ├── TextInputBox.cpp
│ └── TextInputScreen.cpp
│ ├── textures
│ ├── README.md
│ ├── headless.cpp
│ ├── internal.h
│ ├── lava.cpp
│ └── textures.cpp
│ ├── title-screen
│ ├── README.md
│ ├── internal.h
│ ├── splashes.cpp
│ ├── splashes.txt
│ ├── title-screen.cpp
│ └── welcome.cpp
│ ├── touch
│ ├── README.md
│ └── touch.cpp
│ └── version
│ ├── README.md
│ └── version.cpp
├── scripts
├── build.mjs
├── fix-appimage-for-docker.sh
├── get-changelog.mjs
├── install-dependencies.mjs
├── lib
│ ├── options.mjs
│ └── util.mjs
├── screenshot.sh
└── test.sh
├── symbols
├── CMakeLists.txt
└── src
│ ├── api
│ ├── CommandServer.def
│ ├── ConnectedClient.def
│ └── OffsetPosTranslator.def
│ ├── app-platform
│ ├── AppPlatform.def
│ ├── AppPlatform_linux.def
│ └── AppPlatform_readAssetFile_return_value.def
│ ├── entity
│ ├── Arrow.def
│ ├── ArrowRenderer.def
│ ├── CameraEntity.def
│ ├── Entity.def
│ ├── EntityFactory.def
│ ├── EntityRenderDispatcher.def
│ ├── EntityRenderer.def
│ ├── FallingTile.def
│ ├── HumanoidMobRenderer.def
│ ├── ItemEntity.def
│ ├── ItemSpriteRenderer.def
│ ├── Mob.def
│ ├── MobFactory.def
│ ├── MobRenderer.def
│ ├── Particle.def
│ ├── PathfinderMob.def
│ ├── PrimedTnt.def
│ ├── Throwable.def
│ ├── TripodCamera.def
│ ├── TripodCameraRenderer.def
│ ├── animal
│ │ ├── AgableMob.def
│ │ ├── Animal.def
│ │ ├── Chicken.def
│ │ ├── Cow.def
│ │ ├── Pig.def
│ │ └── Sheep.def
│ ├── model
│ │ ├── HumanoidModel.def
│ │ ├── ModelPart.def
│ │ ├── PolygonQuad.def
│ │ └── VertexPT.def
│ ├── monster
│ │ ├── Creeper.def
│ │ ├── Monster.def
│ │ ├── PigZombie.def
│ │ ├── Skeleton.def
│ │ ├── Spider.def
│ │ └── Zombie.def
│ ├── painting
│ │ ├── HangingEntity.def
│ │ ├── Motive.def
│ │ ├── Painting.def
│ │ └── PaintingRenderer.def
│ └── player
│ │ ├── Abilities.def
│ │ ├── LocalPlayer.def
│ │ ├── Player.def
│ │ ├── PlayerRenderer.def
│ │ ├── RemotePlayer.def
│ │ └── ServerPlayer.def
│ ├── game
│ ├── GameRenderer.def
│ ├── Minecraft.def
│ ├── NinecraftApp.def
│ ├── mode
│ │ ├── CreatorMode.def
│ │ ├── GameMode.def
│ │ ├── SurvivalMode.def
│ │ └── creator
│ │ │ ├── Creator.def
│ │ │ ├── EventList_Item.def
│ │ │ ├── EventList_TileEvent.def
│ │ │ ├── ICreator.def
│ │ │ └── TileEvent.def
│ └── options
│ │ ├── Options.def
│ │ ├── OptionsFile.def
│ │ └── Options_Option.def
│ ├── gui
│ ├── Font.def
│ ├── Gui.def
│ ├── GuiMessage.def
│ ├── components
│ │ ├── Button.def
│ │ ├── GuiComponent.def
│ │ ├── ImageButton.def
│ │ ├── IntRectangle.def
│ │ ├── OptionButton.def
│ │ ├── OptionsPane.def
│ │ ├── RectangleArea.def
│ │ ├── ScrollingPane.def
│ │ └── Touch_TButton.def
│ └── screens
│ │ ├── ArmorScreen.def
│ │ ├── DisconnectionScreen.def
│ │ ├── FurnaceScreen.def
│ │ ├── InBedScreen.def
│ │ ├── OptionsScreen.def
│ │ ├── PaneCraftingScreen.def
│ │ ├── PauseScreen.def
│ │ ├── ProgressScreen.def
│ │ ├── Screen.def
│ │ ├── ScreenChooser.def
│ │ ├── SelectWorldScreen.def
│ │ ├── SimpleChooseLevelScreen.def
│ │ ├── StartMenuScreen.def
│ │ ├── TextEditScreen.def
│ │ ├── Touch_IngameBlockSelectionScreen.def
│ │ ├── Touch_SelectWorldScreen.def
│ │ ├── Touch_StartMenuScreen.def
│ │ └── WorkbenchScreen.def
│ ├── input
│ ├── IBuildInput.def
│ ├── IMoveInput.def
│ ├── Keyboard.def
│ ├── Mouse.def
│ └── MouseBuildInput.def
│ ├── item
│ ├── ArmorItem.def
│ ├── ArmorMaterial.def
│ ├── AuxDataTileItem.def
│ ├── DiggerItem.def
│ ├── FoodItem.def
│ ├── Item.def
│ ├── ItemInHandRenderer.def
│ ├── ItemInstance.def
│ ├── ItemRenderer.def
│ ├── TileItem.def
│ └── TilePlanterItem.def
│ ├── level
│ ├── Biome.def
│ ├── BiomeSource.def
│ ├── ChunkCache.def
│ ├── ChunkSource.def
│ ├── ChunkStorage.def
│ ├── CreatorLevel.def
│ ├── DataLayer.def
│ ├── Dimension.def
│ ├── DistanceChunkSorter.def
│ ├── ExternalFileLevelStorage.def
│ ├── ExternalFileLevelStorageSource.def
│ ├── Level.def
│ ├── LevelChunk.def
│ ├── LevelData.def
│ ├── LevelListener.def
│ ├── LevelSettings.def
│ ├── LevelSource.def
│ ├── LevelStorage.def
│ ├── LevelStorageSource.def
│ ├── LevelSummary.def
│ ├── LightLayer.def
│ ├── Material.def
│ ├── MultiPlayerLevel.def
│ ├── PerformanceTestChunkSource.def
│ ├── RandomLevelSource.def
│ ├── Region.def
│ ├── RegionFile.def
│ ├── ServerLevel.def
│ ├── container
│ │ ├── Container.def
│ │ ├── ContainerMenu.def
│ │ ├── FillingContainer.def
│ │ └── Inventory.def
│ ├── feature
│ │ ├── Feature.def
│ │ ├── LargeCaveFeature.def
│ │ └── LargeFeature.def
│ └── renderer
│ │ ├── Chunk.def
│ │ ├── LevelRenderer.def
│ │ ├── ParticleEngine.def
│ │ ├── RenderChunk.def
│ │ └── RenderList.def
│ ├── misc
│ ├── AABB.def
│ ├── CThread.def
│ ├── Common.def
│ ├── CompoundTag.def
│ ├── Config.def
│ ├── HitResult.def
│ ├── I18n.def
│ ├── Mth.def
│ ├── PerfRenderer.def
│ ├── Pos.def
│ ├── Random.def
│ ├── SimpleFoodData.def
│ ├── SoundEngine.def
│ ├── Strings.def
│ ├── Tag.def
│ ├── Tesselator.def
│ ├── Util.def
│ └── Vec3.def
│ ├── network
│ ├── ClientSideNetworkHandler.def
│ ├── NetEventCallback.def
│ ├── PingedCompatibleServer.def
│ ├── RakNetInstance.def
│ ├── ServerSideNetworkHandler.def
│ ├── packet
│ │ ├── ChatPacket.def
│ │ ├── ChunkDataPacket.def
│ │ ├── ContainerSetContentPacket.def
│ │ ├── LoginPacket.def
│ │ ├── MessagePacket.def
│ │ ├── MinecraftPackets.def
│ │ ├── MovePlayerPacket.def
│ │ ├── Packet.def
│ │ ├── PlayerActionPacket.def
│ │ ├── PlayerEquipmentPacket.def
│ │ ├── ReadyPacket.def
│ │ ├── RemovePlayerPacket.def
│ │ ├── RequestChunkPacket.def
│ │ ├── SendInventoryPacket.def
│ │ ├── SetEntityMotionPacket.def
│ │ ├── SetSpawnPositionPacket.def
│ │ ├── SignUpdatePacket.def
│ │ ├── StartGamePacket.def
│ │ ├── UpdateBlockPacket.def
│ │ └── UseItemPacket.def
│ └── raknet
│ │ ├── RakNet.h
│ │ ├── RakNet_AddressOrGUID.def
│ │ ├── RakNet_BitStream.def
│ │ ├── RakNet_RakNetGUID.def
│ │ ├── RakNet_RakPeer.def
│ │ ├── RakNet_RakString.def
│ │ ├── RakNet_RakString_SharedString.def
│ │ └── RakNet_SystemAddress.def
│ ├── recipes
│ ├── CItem.def
│ ├── FurnaceRecipes.def
│ ├── Recipes.def
│ ├── Recipes_Type.def
│ └── ReqItem.def
│ ├── textures
│ ├── DynamicTexture.def
│ ├── Texture.def
│ └── Textures.def
│ └── tile
│ ├── Bush.def
│ ├── CarriedTile.def
│ ├── ChestTile.def
│ ├── CropTile.def
│ ├── DoorTile.def
│ ├── EntityTile.def
│ ├── GrassTile.def
│ ├── HeavyTile.def
│ ├── LeafTile.def
│ ├── LiquidTile.def
│ ├── StemTile.def
│ ├── TallGrass.def
│ ├── Tile.def
│ ├── TileRenderer.def
│ ├── Tile_SoundType.def
│ ├── TorchTile.def
│ └── entity
│ ├── ChestTileEntity.def
│ ├── FurnaceTileEntity.def
│ ├── SignTileEntity.def
│ ├── TileEntity.def
│ ├── TileEntityFactory.def
│ ├── TileEntityRenderDispatcher.def
│ └── TileEntityRenderer.def
└── tools
├── .gitignore
└── CMakeLists.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | /out
2 | /debian/tmp
3 | /.vscode
4 | /build*
5 | /CMakeLists.txt.user
6 | *.autosave
7 | /AppImageBuilder.yml
8 | /appimage-builder-cache
9 | /appimage-build
10 | /AppDir
11 | /*.zsync
12 | /*.AppImage
13 | /core*
14 | /qemu_*
15 | /example-mods/out
16 | /.testing-tmp
17 | /cmake-build-*
18 | /.idea
19 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dependencies/glfw/src"]
2 | path = dependencies/glfw/src
3 | url = https://github.com/glfw/glfw.git
4 | [submodule "dependencies/LIEF/src"]
5 | path = dependencies/LIEF/src
6 | url = https://github.com/lief-project/LIEF.git
7 | [submodule "dependencies/stb_image/include"]
8 | path = dependencies/stb_image/include
9 | url = https://github.com/nothings/stb.git
10 | [submodule "dependencies/utf8cpp/src"]
11 | path = dependencies/utf8cpp/src
12 | url = https://github.com/nemtrif/utfcpp.git
13 | [submodule "archives"]
14 | path = archives
15 | url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/archives.git
16 | shallow = true
17 | [submodule "dependencies/symbol-processor/src"]
18 | path = dependencies/symbol-processor/src
19 | url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/symbol-processor.git
20 | [submodule "dependencies/runtime/src"]
21 | path = dependencies/runtime/src
22 | url = https://gitea.thebrokenrail.com/minecraft-pi-reborn/runtime.git
23 | [submodule "dependencies/imgui/src"]
24 | path = dependencies/imgui/src
25 | url = https://github.com/ocornut/imgui.git
26 | ignore = dirty
27 | [submodule "dependencies/imgui/glad/src"]
28 | path = dependencies/imgui/glad/src
29 | url = https://github.com/Dav1dde/glad.git
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 TheBrokenRail
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | # Minecraft: Pi Edition: Reborn [](https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/actions)
12 | Minecraft: Pi Edition: Reborn (also known as MCPI-Reborn) is modding project for [Minecraft: Pi Edition](https://minecraft.wiki/w/Pi_Edition). It serves the dual-purpose of porting it to modern hardware and enhancing the game itself.
13 |
14 | Get started [here](docs/GETTING_STARTED.md)!
15 |
16 | ## Documentation
17 | [View Documentation](docs/README.md)
18 |
--------------------------------------------------------------------------------
/VERSION:
--------------------------------------------------------------------------------
1 | 3.0.0
2 |
--------------------------------------------------------------------------------
/cmake/cpack/appimage.cmake:
--------------------------------------------------------------------------------
1 | # Package
2 | set(APPIMAGE_ARCH "unknown")
3 | if(CPACK_MCPI_ARCH STREQUAL "armhf")
4 | set(APPIMAGE_ARCH "arm")
5 | elseif(CPACK_MCPI_ARCH STREQUAL "arm64")
6 | set(APPIMAGE_ARCH "aarch64")
7 | elseif(CPACK_MCPI_ARCH STREQUAL "amd64")
8 | set(APPIMAGE_ARCH "x86_64")
9 | endif()
10 | execute_process(
11 | COMMAND
12 | "${CMAKE_COMMAND}" "-E" "env"
13 | "ARCH=${APPIMAGE_ARCH}"
14 | "VERSION=${CPACK_MCPI_VERSION}"
15 | "appimagetool"
16 | "--updateinformation" "zsync|${CPACK_MCPI_REPO}/releases/download/latest/${CPACK_PACKAGE_FILE_NAME_ZSYNC}${CPACK_MCPI_APPIMAGE_ZSYNC_EXT}"
17 | "${CPACK_TEMPORARY_DIRECTORY}"
18 | "${CPACK_PACKAGE_FILE_NAME}${CPACK_MCPI_APPIMAGE_EXT}"
19 | WORKING_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}"
20 | COMMAND_ERROR_IS_FATAL ANY
21 | )
22 |
23 | # Rename ZSync File
24 | file(RENAME "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_MCPI_APPIMAGE_ZSYNC_EXT}" "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME_ZSYNC}${CPACK_MCPI_APPIMAGE_ZSYNC_EXT}")
25 |
26 | # Summary Message
27 | function(check_file name)
28 | if(EXISTS "${CPACK_PACKAGE_DIRECTORY}/${name}")
29 | message(STATUS "Generated: ${name}")
30 | else()
31 | message(FATAL_ERROR "Missing File: ${name}")
32 | endif()
33 | endfunction()
34 | check_file("${CPACK_PACKAGE_FILE_NAME}${CPACK_MCPI_APPIMAGE_EXT}")
35 | check_file("${CPACK_PACKAGE_FILE_NAME_ZSYNC}${CPACK_MCPI_APPIMAGE_ZSYNC_EXT}")
36 |
--------------------------------------------------------------------------------
/cmake/options/core-options.cmake:
--------------------------------------------------------------------------------
1 | # Build Mode
2 | set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
3 | set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
4 | if(MCPI_BUILD_MODE STREQUAL "arm")
5 | set(BUILD_ARM_COMPONENTS TRUE)
6 | set(BUILD_NATIVE_COMPONENTS FALSE)
7 | elseif(MCPI_BUILD_MODE STREQUAL "native")
8 | set(BUILD_ARM_COMPONENTS FALSE)
9 | set(BUILD_NATIVE_COMPONENTS TRUE)
10 | else()
11 | message(FATAL_ERROR "Invalid Mode")
12 | endif()
13 |
14 | # Specify Options
15 | set(MCPI_OPTIONS "")
16 | function(mcpi_option name description type default)
17 | set(full_name "MCPI_${name}")
18 | set("${full_name}" "${default}" CACHE "${type}" "${description}")
19 | list(APPEND MCPI_OPTIONS "-D${full_name}:${type}=${${full_name}}")
20 | set(MCPI_OPTIONS "${MCPI_OPTIONS}" PARENT_SCOPE)
21 | endfunction()
22 |
23 | # Clear External CFLAGS When Building ARM Components
24 | if(BUILD_ARM_COMPONENTS)
25 | unset(ENV{CFLAGS})
26 | unset(ENV{CXXFLAGS})
27 | endif()
--------------------------------------------------------------------------------
/cmake/options/paths.cmake:
--------------------------------------------------------------------------------
1 | # Specify Installation Paths
2 | set(MCPI_INSTALL_DIR "lib/${MCPI_APP_NAME}")
3 | set(MCPI_LEGAL_DIR "${MCPI_INSTALL_DIR}/legal") # For Software Licenses
4 | set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk")
5 | set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib")
6 | set(MCPI_SDK_INCLUDE_DIR "${MCPI_SDK_DIR}/include")
7 |
8 | # Library Directory
9 | set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib")
10 | if(BUILD_ARM_COMPONENTS)
11 | string(APPEND MCPI_LIB_DIR "/arm")
12 | elseif(BUILD_NATIVE_COMPONENTS)
13 | string(APPEND MCPI_LIB_DIR "/native")
14 | endif()
15 |
16 | # Share Directory
17 | set(MCPI_SHARE_DIR "share")
18 | if(MCPI_IS_APPIMAGE_BUILD)
19 | string(PREPEND MCPI_SHARE_DIR "usr/")
20 | endif()
21 |
22 | # Specify Default Installation Prefix
23 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
24 | set(DEFAULT_PREFIX "/usr")
25 | if(MCPI_IS_APPIMAGE_BUILD)
26 | set(DEFAULT_PREFIX "/")
27 | elseif(MCPI_IS_FLATPAK_BUILD)
28 | set(DEFAULT_PREFIX "/app")
29 | endif()
30 | set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "Install Prefix" FORCE)
31 | set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
32 | endif()
33 |
--------------------------------------------------------------------------------
/cmake/toolchain/amd64-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Compile For x86_64
2 | include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
3 | # Use x86_64 Cross-Compiler
4 | setup_toolchain("x86_64-linux-gnu")
5 | # Details
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "x86_64")
8 |
--------------------------------------------------------------------------------
/cmake/toolchain/arm64-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Compile For ARM64
2 | include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
3 | # Use ARM64 Cross-Compiler
4 | setup_toolchain("aarch64-linux-gnu")
5 | # Details
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
8 |
--------------------------------------------------------------------------------
/cmake/toolchain/armhf-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Compile For ARM
2 | include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
3 | # Use ARM Cross-Compiler
4 | setup_toolchain("arm-linux-gnueabihf")
5 | # Details
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "arm")
8 |
--------------------------------------------------------------------------------
/cmake/toolchain/base-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Setup Toolchain
2 | macro(setup_toolchain target)
3 | # Target Variants
4 | set(target_variants "${target}")
5 | macro(add_target_variant value)
6 | string(REPLACE "-linux" "-${value}-linux" target_variant "${target}")
7 | list(APPEND target_variants "${target_variant}")
8 | endmacro()
9 | add_target_variant(unknown)
10 | add_target_variant(none)
11 | add_target_variant(pc)
12 |
13 | # Find Compiler
14 | macro(find_compiler output name)
15 | set(possible_names "")
16 | foreach(possible_target IN LISTS target_variants)
17 | list(APPEND possible_names "${possible_target}-${name}")
18 | endforeach()
19 | find_program(
20 | "${output}"
21 | NAMES ${possible_names}
22 | NO_CACHE
23 | )
24 | if("${${output}}" STREQUAL "${output}-NOTFOUND")
25 | message(FATAL_ERROR "Unable To Find ${name}")
26 | endif()
27 | endmacro()
28 | find_compiler(CMAKE_C_COMPILER "gcc")
29 | find_compiler(CMAKE_CXX_COMPILER "g++")
30 |
31 | # Extra
32 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
33 | # Custom Search Paths
34 | set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}" "/usr")
35 | # pkg-config
36 | set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/${target}/pkgconfig:/usr/${target}/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig")
37 | endmacro()
38 |
--------------------------------------------------------------------------------
/cmake/toolchain/prebuilt/armhf-toolchain.cmake:
--------------------------------------------------------------------------------
1 | # Target
2 | set(target "arm-linux-gnueabihf")
3 |
4 | # Pick Archive
5 | get_arch(arch)
6 | set(toolchain_name "arm-toolchain-${arch}")
7 | set(toolchain_dir "${CMAKE_CURRENT_BINARY_DIR}/${toolchain_name}")
8 | set(toolchain_file "${CMAKE_CURRENT_LIST_DIR}/../../../archives/${toolchain_name}.tar.xz")
9 |
10 | # Sysroot
11 | include("${CMAKE_CURRENT_LIST_DIR}/sysroot.cmake")
12 |
13 | # Extract If Needed
14 | file(SHA256 "${toolchain_file}" toolchain_hash)
15 | if(NOT (DEFINED CACHE{MCPI_TOOLCHAIN_HASH} AND toolchain_hash STREQUAL MCPI_TOOLCHAIN_HASH))
16 | force_set(MCPI_TOOLCHAIN_HASH "${toolchain_hash}" INTERNAL)
17 | message(STATUS "Extracting Toolchain...")
18 | file(REMOVE_RECURSE "${toolchain_dir}")
19 | file(ARCHIVE_EXTRACT INPUT "${toolchain_file}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" TOUCH)
20 |
21 | # Force Toolchain
22 | file(WRITE "${toolchain_dir}/toolchain.cmake"
23 | "set(CMAKE_C_COMPILER \"\${CMAKE_CURRENT_LIST_DIR}/bin/${target}-gcc\")\n"
24 | "set(CMAKE_CXX_COMPILER \"\${CMAKE_CURRENT_LIST_DIR}/bin/${target}-g++\")\n"
25 | "set(CMAKE_SYSTEM_NAME \"Linux\")\n"
26 | "set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n"
27 | "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n"
28 | )
29 | force_set(MCPI_CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" FILEPATH)
30 | set(MCPI_FORCE_ARM_REBUILD TRUE)
31 |
32 | # Sysroot
33 | build_sysroot()
34 | endif()
--------------------------------------------------------------------------------
/cmake/util/io.cmake:
--------------------------------------------------------------------------------
1 | # Make Directory
2 | function(set_and_mkdir name dir)
3 | set("${name}" "${dir}" PARENT_SCOPE)
4 | file(MAKE_DIRECTORY "${dir}")
5 | endfunction()
6 |
7 | # Download File With Error-Checking
8 | function(safe_download name url out)
9 | file(DOWNLOAD
10 | "${url}"
11 | "${out}"
12 | STATUS status
13 | )
14 | list(GET status 0 status_code)
15 | list(GET status 1 error_message)
16 | if(NOT status_code EQUAL 0)
17 | message(FATAL_ERROR "Unable To Download ${name}: ${error_message}")
18 | else()
19 | message(STATUS "Downloaded ${name}: ${out}")
20 | endif()
21 | endfunction()
22 |
23 | # Symlink Function
24 | function(install_symlink target link)
25 | cmake_path(GET link PARENT_PATH parent)
26 | if(parent STREQUAL "")
27 | set(parent ".")
28 | endif()
29 | file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/symlink/${parent}")
30 | file(CREATE_LINK "${target}" "${CMAKE_BINARY_DIR}/symlink/${link}" SYMBOLIC)
31 | install(FILES "${CMAKE_BINARY_DIR}/symlink/${link}" DESTINATION "${parent}")
32 | endfunction()
--------------------------------------------------------------------------------
/cmake/util/resource.c.in:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | const unsigned char ${name}[] = {
4 | ${data}
5 | };
6 | const size_t ${name}_len = sizeof(${name});
--------------------------------------------------------------------------------
/dependencies/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(dependencies)
2 |
3 | # stb_image
4 | if(BUILD_ARM_COMPONENTS)
5 | add_subdirectory(stb_image)
6 | endif()
7 | # Minecraft: Pi Edition
8 | if(BUILD_ARM_COMPONENTS AND NOT MCPI_OPEN_SOURCE_ONLY)
9 | add_subdirectory(minecraft-pi)
10 | endif()
11 | # LIEF
12 | if(BUILD_NATIVE_COMPONENTS OR BUILD_MEDIA_LAYER_CORE)
13 | add_subdirectory(LIEF)
14 | endif()
15 | # Extra Runtime
16 | add_subdirectory(runtime)
17 | # GLFW
18 | if(BUILD_NATIVE_COMPONENTS OR BUILD_MEDIA_LAYER_CORE)
19 | add_subdirectory(glfw)
20 | endif()
21 | # ImGui
22 | if(BUILD_NATIVE_COMPONENTS)
23 | add_subdirectory(imgui)
24 | endif()
25 | # UTF8-CPP
26 | add_subdirectory(utf8cpp)
27 | # Symbol Processor
28 | if(BUILD_ARM_COMPONENTS)
29 | add_subdirectory(symbol-processor)
30 | endif()
31 |
--------------------------------------------------------------------------------
/dependencies/LIEF/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(LIEF)
2 |
3 | # Silence Warnings
4 | add_compile_options(-w -Wno-psabi)
5 |
6 | ## LIEF
7 |
8 | # Options
9 | force_set(LIEF_C_API FALSE BOOL)
10 | force_set(LIEF_EXAMPLES FALSE BOOL)
11 | force_set(LIEF_PYTHON_API FALSE BOOL)
12 | force_set(LIEF_TESTS FALSE BOOL)
13 | force_set(LIEF_USE_CCACHE FALSE BOOL)
14 | force_set(LIEF_LOGGING FALSE BOOL)
15 | force_set(LIEF_LOGGING_DEBUG FALSE BOOL)
16 | force_set(LIEF_ENABLE_JSON FALSE BOOL)
17 | force_set(LIEF_ELF TRUE BOOL)
18 | force_set(LIEF_PE FALSE BOOL)
19 | force_set(LIEF_MACHO FALSE BOOL)
20 | force_set(LIEF_DEX FALSE BOOL)
21 | force_set(LIEF_ART FALSE BOOL)
22 | force_set(LIEF_OAT FALSE BOOL)
23 | force_set(LIEF_VDEX FALSE BOOL)
24 |
25 | # Download
26 | set(MESSAGE_QUIET TRUE)
27 | add_subdirectory(src EXCLUDE_FROM_ALL SYSTEM)
28 | unset(MESSAGE_QUIET)
29 |
30 | # Install
31 | setup_library(LIB_LIEF TRUE TRUE)
32 |
33 | # License
34 | install(FILES src/LICENSE DESTINATION "${MCPI_LEGAL_DIR}/LIEF")
35 |
36 | # Fix Flags
37 | function(fix_flags property)
38 | get_target_property(flags LIB_LIEF "${property}")
39 | list(REMOVE_ITEM flags "_GLIBCXX_USE_CXX11_ABI=1")
40 | set_target_properties(LIB_LIEF PROPERTIES "${property}" "${flags}")
41 | endfunction()
42 | fix_flags(COMPILE_DEFINITIONS)
43 | fix_flags(INTERFACE_COMPILE_DEFINITIONS)
--------------------------------------------------------------------------------
/dependencies/glfw/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(glfw)
2 |
3 | # Silence Warnings
4 | add_compile_options(-w)
5 |
6 | ## GLFW
7 |
8 | # Download
9 | force_set(GLFW_BUILD_EXAMPLES FALSE BOOL)
10 | force_set(GLFW_BUILD_TESTS FALSE BOOL)
11 | force_set(GLFW_BUILD_DOCS FALSE BOOL)
12 | force_set(GLFW_INSTALL FALSE BOOL)
13 | force_set(GLFW_BUILD_WIN32 FALSE BOOL)
14 | force_set(GLFW_BUILD_COCOA FALSE BOOL)
15 | force_set(GLFW_BUILD_X11 TRUE BOOL)
16 | force_set(GLFW_BUILD_WAYLAND TRUE BOOL)
17 | force_set(GLFW_LIBRARY_TYPE "SHARED" STRING)
18 | set(MESSAGE_QUIET TRUE)
19 | add_subdirectory(src EXCLUDE_FROM_ALL SYSTEM)
20 | unset(MESSAGE_QUIET)
21 |
22 | # Install
23 | setup_library(glfw TRUE TRUE)
24 |
25 | # License
26 | install(FILES src/LICENSE.md DESTINATION "${MCPI_LEGAL_DIR}/GLFW")
27 |
--------------------------------------------------------------------------------
/dependencies/imgui/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(imgui)
2 |
3 | # Silence Warnings
4 | add_compile_options(-w)
5 |
6 | ## ImGui
7 |
8 | # Build
9 | add_library(imgui SHARED
10 | src/imgui.cpp
11 | src/imgui_draw.cpp
12 | src/imgui_tables.cpp
13 | src/imgui_widgets.cpp
14 | src/misc/cpp/imgui_stdlib.cpp
15 | src/backends/imgui_impl_glfw.cpp
16 | src/backends/imgui_impl_opengl2.cpp
17 | )
18 | setup_header_dirs(imgui
19 | "${CMAKE_CURRENT_SOURCE_DIR}/src"
20 | "${CMAKE_CURRENT_SOURCE_DIR}/src/backends"
21 | "${CMAKE_CURRENT_SOURCE_DIR}/src/misc/cpp"
22 | )
23 |
24 | # OpenGL
25 | add_subdirectory(glad)
26 | target_link_libraries(imgui PUBLIC glfw glad)
27 |
28 | # Fonts
29 | embed_resource(imgui src/misc/fonts/Roboto-Medium.ttf)
30 | embed_resource(imgui src/misc/fonts/Cousine-Regular.ttf)
31 |
32 | # Configure
33 | target_compile_definitions(imgui PUBLIC
34 | IMGUI_DISABLE_DEMO_WINDOWS
35 | IMGUI_DISABLE_DEBUG_TOOLS
36 | IMGUI_DISABLE_DEFAULT_FONT
37 | IMGUI_DISABLE_OBSOLETE_FUNCTIONS
38 | )
39 |
40 | # Patch
41 | execute_process(
42 | COMMAND "patch" "-p1" "--forward" "--reject-file=-"
43 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
44 | INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/fix-hidpi.patch"
45 | OUTPUT_QUIET
46 | )
47 |
48 | # Install
49 | setup_library(imgui TRUE FALSE)
50 |
51 | # License
52 | install(FILES src/LICENSE.txt src/docs/FONTS.md DESTINATION "${MCPI_LEGAL_DIR}/ImGui")
53 |
--------------------------------------------------------------------------------
/dependencies/imgui/glad/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(imgui-glad)
2 |
3 | # Directories
4 | set_and_mkdir(GLAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/glad")
5 | set_and_mkdir(GLAD_SRC_DIR "${GLAD_DIR}/src")
6 | set_and_mkdir(GLAD_INCLUDE_DIR "${GLAD_DIR}/include")
7 |
8 | # Files
9 | set(GLAD_SOURCES
10 | "${GLAD_INCLUDE_DIR}/KHR/khrplatform.h"
11 | "${GLAD_INCLUDE_DIR}/glad/glad.h"
12 | "${GLAD_SRC_DIR}/glad.c"
13 | )
14 |
15 | # Find Python
16 | find_package(Python REQUIRED QUIET)
17 |
18 | # Generate
19 | add_custom_command(OUTPUT ${GLAD_SOURCES}
20 | COMMAND "${Python_EXECUTABLE}"
21 | ARGS "-m" "glad"
22 | "--out" "${GLAD_DIR}"
23 | "--api" "gl=1.1"
24 | "--generator" "c"
25 | "--reproducible"
26 | "--quiet"
27 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
28 | VERBATIM
29 | )
30 |
31 | # Build
32 | add_library(glad SHARED ${GLAD_SOURCES})
33 | target_compile_definitions(glad
34 | PUBLIC GLAD_GLAPI_EXPORT
35 | PRIVATE GLAD_GLAPI_EXPORT_BUILD
36 | )
37 |
38 | # Link
39 | target_link_libraries(glad PRIVATE dl)
40 |
41 | # Headers
42 | setup_header_dirs(glad
43 | "${GLAD_INCLUDE_DIR}"
44 | "${CMAKE_CURRENT_SOURCE_DIR}/include"
45 | )
46 |
47 | # Install
48 | setup_library(glad TRUE FALSE)
--------------------------------------------------------------------------------
/dependencies/imgui/glad/include/GL/gl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
--------------------------------------------------------------------------------
/dependencies/minecraft-pi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(minecraft-pi)
2 |
3 | include(FetchContent)
4 |
5 | ## Minecraft: Pi Edition
6 |
7 | # Download
8 | FetchContent_Declare(minecraft-pi
9 | URL "${CMAKE_CURRENT_SOURCE_DIR}/minecraft-pi-0.1.1.tar.gz"
10 | )
11 | FetchContent_MakeAvailable(minecraft-pi)
12 |
13 | # Install
14 | install(
15 | DIRECTORY "${minecraft-pi_SOURCE_DIR}/"
16 | DESTINATION "${MCPI_INSTALL_DIR}/game"
17 | USE_SOURCE_PERMISSIONS
18 | REGEX "api" EXCLUDE
19 | )
20 | install_symlink("game/minecraft-pi" "${MCPI_INSTALL_DIR}/minecraft-pi")
21 |
--------------------------------------------------------------------------------
/dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/dependencies/minecraft-pi/minecraft-pi-0.1.1.tar.gz
--------------------------------------------------------------------------------
/dependencies/runtime/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(runtime)
2 |
3 | ## Extra Runtime
4 |
5 | # Build
6 | add_subdirectory(src)
--------------------------------------------------------------------------------
/dependencies/stb_image/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(stb_image)
2 |
3 | # Silence Warnings
4 | add_compile_options(-w)
5 |
6 | ## stb_image
7 |
8 | # Build
9 | add_library(stb_image SHARED src/stb_image_impl.c)
10 | target_link_libraries(stb_image PRIVATE m)
11 | target_compile_definitions(stb_image PUBLIC STBI_ONLY_PNG)
12 | setup_header_dirs(stb_image "${CMAKE_CURRENT_SOURCE_DIR}/include")
13 |
14 | # Install
15 | setup_library(stb_image TRUE TRUE)
16 |
17 | # License
18 | install(FILES include/LICENSE DESTINATION "${MCPI_LEGAL_DIR}/stb_image")
19 |
--------------------------------------------------------------------------------
/dependencies/stb_image/src/stb_image_impl.c:
--------------------------------------------------------------------------------
1 | #define STB_IMAGE_IMPLEMENTATION
2 | #define STB_IMAGE_WRITE_IMPLEMENTATION
3 |
4 | #include "stb_image.h"
5 | #include "stb_image_write.h"
6 |
--------------------------------------------------------------------------------
/dependencies/symbol-processor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(symbol-processor)
2 |
3 | # Install Dependencies
4 | set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/src")
5 | set(NODE_MODULES "${SRC}/node_modules")
6 | execute_process(
7 | COMMAND npm ci --silent
8 | WORKING_DIRECTORY "${SRC}"
9 | COMMAND_ERROR_IS_FATAL ANY
10 | )
11 |
--------------------------------------------------------------------------------
/dependencies/utf8cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(utf8cpp)
2 |
3 | # Silence Warnings
4 | add_compile_options(-w)
5 |
6 | ## stb_image
7 |
8 | # Build
9 | add_subdirectory(src EXCLUDE_FROM_ALL)
10 |
11 | # License
12 | install(FILES src/LICENSE DESTINATION "${MCPI_LEGAL_DIR}/UTF8-CPP")
13 |
--------------------------------------------------------------------------------
/docs/CONTROLS.md:
--------------------------------------------------------------------------------
1 | # In-Game Controls
2 |
3 | ## Keyboard & Mouse
4 | | Action | Function |
5 | | --- | --- |
6 | | W | Move Forward |
7 | | A | Move Left |
8 | | S | Move Backward |
9 | | D | Move Right |
10 | | Space | Jump |
11 | | Shift | Sneak |
12 | | E | Open Inventory |
13 | | Q | Drop Item |
14 | | Ctrl+Q | Drop Item Stack |
15 | | 1-9 | Select Item In Toolbar/Hotbar |
16 | | Escape | Pause |
17 | | Tab | Lock/Unlock Mouse |
18 | | F11 | Fullscreen |
19 | | F2 | Screenshot |
20 | | F1 | Hide GUI |
21 | | F5 | Change Perspective |
22 | | T | Open Chat |
23 | | Mouse Movement | Camera Control |
24 | | Scroll Wheel | Cycle Selected Item In Toolbar |
25 | | Left-CLick | Attack/Destroy |
26 | | Right-Click | Use Item/Place Block |
27 |
--------------------------------------------------------------------------------
/docs/CREDITS.md:
--------------------------------------------------------------------------------
1 | # Credits
2 | | Project | Reason |
3 | | --- | --- |
4 | | [mhsjlw/mcpilauncher](https://web.archive.org/web/20220727030722/https://github.com/mhsjlw/mcpilauncher/blob/master/trampoline/trampoline.c) | Information On Getting Minecraft: Pi Edition To Run On Desktop Linux |
5 | | [Phirel's Survival Patch](https://www.minecraftforum.net/forums/minecraft-editions/minecraft-pi-edition/1960005-survival-mode-patch) | Information On Survival Mode Support |
6 | | [zhuowei/MinecraftPEModWiki](https://github.com/zhuowei/MinecraftPEModWiki/wiki/How-some-unlocks-are-made) | Information On Smooth Lighting Support |
7 | | [zhuowei/RaspberryJuice](https://github.com/zhuowei/RaspberryJuice) | Design Of RaspberryJuice Extended API |
8 | | [Ghidra](https://ghidra-sre.org) | Used For Decompiling Minecraft: Pi Edition |
9 | | [RetDec](https://retdec.com) | Used For Decompiling Minecraft: Pi Edition |
10 | | [minecraft-linux/mcpelauncher-core](https://github.com/minecraft-linux/mcpelauncher-core/blob/6b5e17b5685a612143297ae4595bdd12327284f3/src/patch_utils.cpp#L42) | Original Function Overwrite Code |
11 | | [Hooking C Functions at Runtime - Thomas Finch](http://thomasfinch.me/blog/2015/07/24/Hooking-C-Functions-At-Runtime.html) | Original Patching Code |
12 | | [ReMinecraftPE](https://github.com/ReMinecraftPE/mcpe) | A Lot Of Decompiled Code |
13 | | [Bigjango](https://github.com/Bigjango13) | A Ton Of Programming Contributions |
--------------------------------------------------------------------------------
/docs/CUSTOM_SKINS.md:
--------------------------------------------------------------------------------
1 | # Custom Skins
2 | MCPI-Reborn supports downloading custom skins from [a central skin server](https://github.com/MCPI-Revival/Skins). Skins are downloaded based on the current MCPI username.
3 |
4 | > [!NOTE]
5 | > This *does not* cache skins and *will not* work without internet access.
6 |
7 | Custom skins can be disabled using the `Load Custom Skins` feature flag.
8 |
--------------------------------------------------------------------------------
/docs/DEDICATED_SERVER.md:
--------------------------------------------------------------------------------
1 | # Dedicated Server
2 | The dedicated server is a version of Minecraft: Pi Edition modified to run in a headless environment.
3 | It loads settings from a `server.properties` file.
4 |
5 | Compatibility with vanilla MCPE/MCPI can be enabled;
6 | however, this will break compatibility with many configurations of MCPI-Reborn.
7 |
8 | ## Setup
9 | To use, run the normal AppImage with the `--server` argument. It will generate the world and `server.properties` in the current directory.
10 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Documentation
2 | * [View Getting Started](GETTING_STARTED.md)
3 | * [View Dedicated Server](DEDICATED_SERVER.md)
4 | * [View Credits](CREDITS.md)
5 | * [View Terminology](TERMINOLOGY.md)
6 | * [View In-Game Controls](CONTROLS.md)
7 | * [View Custom Skins](CUSTOM_SKINS.md)
8 | * [View API](API.md)
9 | * [View Changelog](CHANGELOG.md)
10 | * [View Modding Guide](modding/README.md)
--------------------------------------------------------------------------------
/docs/TERMINOLOGY.md:
--------------------------------------------------------------------------------
1 | # Terminology
2 | | Name | Description |
3 | | --- | --- |
4 | | MCPI | Shorthand for Minecraft: Pi Edition |
5 | | MCPE | Shorthand for Minecraft: Pocket Edition |
6 | | Host Architecture | The native architecture of the CPU that MCPI-Reborn will be running on |
7 | | Native Component | A component that *can* be compiled for the host architecture |
8 | | ARM Component | A component that *must* be compiled for ARM |
9 | | Server Mode | A mode where MCPI is patched into behaving like a dedicated server |
10 | | Client Mode | The normal behavior of MCPI |
11 | | Stub | An implementation of a library where all functions either do nothing or error |
12 |
--------------------------------------------------------------------------------
/docs/modding/README.md:
--------------------------------------------------------------------------------
1 | # Modding Guide
2 | In addition to various built-in mods, MCPI-Reborn includes an SDK for creating custom mods.
3 |
4 | This tutorial explains how to set up and use it.
5 |
6 | ## Chapters
7 | 1. [My First Mod](MY_FIRST_MOD.md)
8 | 2. [Beginner Modding](BEGINNER.md)
9 | 3. [Intermediate Modding](INTERMEDIATE.md)
10 | 4. [Introduction To Ghidra](GHIDRA.md)
11 | 5. [Advanced Modding](ADVANCED.md)
12 |
13 | ## Examples
14 | Example mods can be found [here](../../example-mods).
--------------------------------------------------------------------------------
/example-mods/README.md:
--------------------------------------------------------------------------------
1 | # Example Mods
2 | These are example mods that can be built using the modding SDK.
3 |
4 | * **Expanded Creative Mod**: This mod adds even more items and blocks to the Creative Inventory. It was originally by [@Bigjango13](https://github.com/bigjango13).
5 | * **Chat Commands Mod**: This mod makes a chat message starting with `\` handled by the MCPI API.
6 | * **Recipes Mod**: This mod adds custom recipes.
7 | * **Custom Block Mod**: This mod adds a custom block.
--------------------------------------------------------------------------------
/example-mods/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | # Create Output Directory
6 | cd "$(dirname "$0")"
7 | ROOT="$(pwd)"
8 | OUT="${ROOT}/out"
9 | rm -rf "${OUT}"
10 | mkdir -p "${OUT}"
11 |
12 | # Build
13 | build() {
14 | cd "${ROOT}/$1"
15 | # Build
16 | rm -rf build
17 | mkdir build
18 | cd build
19 | cmake -GNinja ..
20 | cmake --build .
21 | # Copy Result
22 | cp lib*.so "${OUT}"
23 | }
24 | build chat-commands
25 | build expanded-creative
26 | build recipes
27 | build custom-block
--------------------------------------------------------------------------------
/example-mods/chat-commands/.gitignore:
--------------------------------------------------------------------------------
1 | /cmake-build-*
2 | /.idea
3 | /build
4 |
--------------------------------------------------------------------------------
/example-mods/chat-commands/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16.0)
2 |
3 | # Build For ARM
4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "arm")
8 |
9 | # Start Project
10 | project(chat-commands)
11 |
12 | # Include SDK
13 | include("$ENV{HOME}/.minecraft-pi/sdk/lib/minecraft-pi-reborn/sdk/sdk.cmake")
14 |
15 | # Build
16 | add_library(chat-commands SHARED
17 | src/chat-commands.cpp
18 | src/server-console-command.cpp
19 | )
20 | target_link_libraries(chat-commands mods reborn-util symbols)
21 |
--------------------------------------------------------------------------------
/example-mods/chat-commands/src/server-console-command.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | // Add Server Command
6 | HOOK(server_get_commands, std::vector *, (Minecraft *minecraft, ServerSideNetworkHandler *server_side_network_handler)) {
7 | // Call Original Method
8 | std::vector *commands = real_server_get_commands()(minecraft, server_side_network_handler);
9 | // Add Command
10 | commands->push_back({
11 | .name = "greet",
12 | .comment = "Example Custom Command",
13 | .callback = [](MCPI_UNUSED const std::string &cmd) {
14 | INFO("Hello World!");
15 | }
16 | });
17 | // Return
18 | return commands;
19 | }
--------------------------------------------------------------------------------
/example-mods/custom-block/.gitignore:
--------------------------------------------------------------------------------
1 | /cmake-build-*
2 | /.idea
3 | /build
4 |
--------------------------------------------------------------------------------
/example-mods/custom-block/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16.0)
2 |
3 | # Build For ARM
4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "arm")
8 |
9 | # Start Project
10 | project(custom-block)
11 |
12 | # Include SDK
13 | include("$ENV{HOME}/.minecraft-pi/sdk/lib/minecraft-pi-reborn/sdk/sdk.cmake")
14 |
15 | # Build
16 | add_library(custom-block SHARED src/custom-block.cpp)
17 | target_link_libraries(custom-block mods symbols)
18 |
--------------------------------------------------------------------------------
/example-mods/custom-block/src/custom-block.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | // Custom Tile
5 | struct CustomBlock final : CustomTile {
6 | // Constructor
7 | CustomBlock(): CustomTile(252, 30, Material::glass) {}
8 |
9 | // On Use
10 | bool use(Level *level, int x, int y, int z, Player *player) override {
11 | if (!level->is_client_side) {
12 | player->displayClientMessage("Hello World!");
13 | }
14 | return true;
15 | }
16 | };
17 | static constexpr const char *description_id = "custom_block";
18 | static Tile *block;
19 |
20 | // Init
21 | __attribute__((constructor)) static void init_custom_block() {
22 | // Construct Block
23 | misc_run_on_tiles_setup([]() {
24 | block = (new CustomBlock())->self;
25 | block->init();
26 | block->setDescriptionId(description_id);
27 | });
28 | // Add To Creative Inventory
29 | misc_run_on_creative_inventory_setup([](FillingContainer *inventory) {
30 | inventory->addItem(new ItemInstance {
31 | .count = 1,
32 | .id = block->id,
33 | .auxiliary = 0
34 | });
35 | });
36 | // Add Language String
37 | misc_run_on_language_setup([]() {
38 | I18n::_strings[std::string("tile.") + description_id + ".name"] = "Custom Block";
39 | });
40 | }
--------------------------------------------------------------------------------
/example-mods/expanded-creative/.gitignore:
--------------------------------------------------------------------------------
1 | /cmake-build-*
2 | /.idea
3 | /build
4 |
--------------------------------------------------------------------------------
/example-mods/expanded-creative/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16.0)
2 |
3 | # Build For ARM
4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "arm")
8 |
9 | # Start Project
10 | project(expanded-creative)
11 |
12 | # Include SDK
13 | include("$ENV{HOME}/.minecraft-pi/sdk/lib/minecraft-pi-reborn/sdk/sdk.cmake")
14 |
15 | # Build
16 | add_library(expanded-creative SHARED src/expanded-creative.cpp)
17 | target_link_libraries(expanded-creative mods reborn-util symbols)
18 |
--------------------------------------------------------------------------------
/example-mods/recipes/.gitignore:
--------------------------------------------------------------------------------
1 | /cmake-build-*
2 | /.idea
3 | /build
4 |
--------------------------------------------------------------------------------
/example-mods/recipes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16.0)
2 |
3 | # Build For ARM
4 | set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
5 | set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
6 | set(CMAKE_SYSTEM_NAME "Linux")
7 | set(CMAKE_SYSTEM_PROCESSOR "arm")
8 |
9 | # Start Project
10 | project(recipes)
11 |
12 | # Include SDK
13 | include("$ENV{HOME}/.minecraft-pi/sdk/lib/minecraft-pi-reborn/sdk/sdk.cmake")
14 |
15 | # Build
16 | add_library(recipes SHARED src/recipes.cpp)
17 | target_link_libraries(recipes mods reborn-util symbols)
18 |
--------------------------------------------------------------------------------
/images/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(images)
2 |
3 | # Logo
4 | install(
5 | FILES "modern_logo.png"
6 | DESTINATION "${MCPI_INSTALL_DIR}/data/images/gui"
7 | )
8 |
9 | # Title Background
10 | install(
11 | FILES "background.png"
12 | DESTINATION "${MCPI_INSTALL_DIR}/data/images/gui"
13 | RENAME "titleBG.png"
14 | )
15 |
16 | # Mojang Textures
17 | install(
18 | FILES "mojang/chest.png"
19 | DESTINATION "${MCPI_INSTALL_DIR}/data/images/item"
20 | )
21 | install(
22 | FILES "mojang/shadow.png" "mojang/vignette.png" "mojang/grasscolor.png"
23 | DESTINATION "${MCPI_INSTALL_DIR}/data/images/misc"
24 | )
25 |
26 | # Icon
27 | set(ICON_DIR "${MCPI_SHARE_DIR}/icons/hicolor/512x512/apps")
28 | set(ICON_NAME "${MCPI_APP_ID}.png")
29 | install(
30 | FILES "icon.png"
31 | DESTINATION "${ICON_DIR}"
32 | RENAME "${ICON_NAME}"
33 | )
34 | set(ICON_PATH "${ICON_DIR}/${ICON_NAME}")
35 | cmake_path(RELATIVE_PATH ICON_PATH BASE_DIRECTORY "${MCPI_INSTALL_DIR}")
36 | target_compile_definitions(launcher PRIVATE "ICON_PATH=\"${ICON_PATH}\"")
37 |
38 | # AppImage
39 | if(MCPI_IS_APPIMAGE_BUILD)
40 | install_symlink("${ICON_DIR}/${MCPI_APP_ID}.png" "${MCPI_APP_ID}.png")
41 | install_symlink("${MCPI_APP_ID}.png" ".DirIcon")
42 | endif()
43 |
--------------------------------------------------------------------------------
/images/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/background.png
--------------------------------------------------------------------------------
/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/icon.png
--------------------------------------------------------------------------------
/images/modern_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/modern_logo.png
--------------------------------------------------------------------------------
/images/mojang/chest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/mojang/chest.png
--------------------------------------------------------------------------------
/images/mojang/grasscolor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/mojang/grasscolor.png
--------------------------------------------------------------------------------
/images/mojang/shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/mojang/shadow.png
--------------------------------------------------------------------------------
/images/mojang/vignette.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/mojang/vignette.png
--------------------------------------------------------------------------------
/images/screenshots/launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/screenshots/launcher.png
--------------------------------------------------------------------------------
/images/screenshots/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/images/screenshots/start.png
--------------------------------------------------------------------------------
/launcher/data/launcher.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=${MCPI_APP_TITLE}
3 | Comment=Fun with Blocks
4 | Icon=${MCPI_APP_ID}
5 | Exec=${MCPI_APP_NAME}
6 | Type=Application
7 | Categories=Game;
8 | Terminal=false
9 | StartupNotify=false
10 | StartupWMClass=${MCPI_APP_ID}
--------------------------------------------------------------------------------
/launcher/src/bootstrap/assets.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "bootstrap.h"
4 | #include "../util/util.h"
5 |
6 | // Setup Asset Paths
7 | static void setup_path(const char *env_name, std::string assets_path) {
8 | chop_last_component(assets_path);
9 | assets_path += "/data";
10 | set_and_print_env(env_name, assets_path.c_str());
11 | }
12 | void bootstrap_assets(const std::string &original_game_binary) {
13 | setup_path(_MCPI_REBORN_ASSETS_PATH_ENV, safe_realpath("/proc/self/exe"));
14 | setup_path(_MCPI_VANILLA_ASSETS_PATH_ENV, original_game_binary);
15 | }
--------------------------------------------------------------------------------
/launcher/src/bootstrap/bootstrap.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | void bootstrap();
7 | // Debugging
8 | void print_debug_information();
9 | // Mods
10 | std::vector bootstrap_mods(const std::string &binary_directory);
11 | // Assets
12 | void bootstrap_assets(const std::string &original_game_binary);
13 | // ELF
14 | extern const std::string patched_exe_path;
15 | std::string get_new_linker(const std::string &binary_directory);
16 | std::vector get_ld_path(const std::string &binary_directory);
17 | void patch_mcpi_elf_dependencies(const std::string &original_path, const std::string &interpreter, const std::vector &rpath, const std::vector &mods);
--------------------------------------------------------------------------------
/launcher/src/bootstrap/debug.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "bootstrap.h"
6 |
7 | // Debug Information
8 | static void run_debug_command(const char *const command[], const char *prefix) {
9 | int status = 0;
10 | const std::vector *output = run_command(command, &status);
11 | if (!is_exit_status_success(status)) {
12 | ERR("Unable To Gather Debug Information");
13 | }
14 | std::string output_str = (const char *) output->data();
15 | delete output;
16 | // Trim
17 | const std::string::size_type length = output_str.length();
18 | if (length > 0 && output_str[length - 1] == '\n') {
19 | output_str.pop_back();
20 | }
21 | // Print
22 | DEBUG("%s: %s", prefix, output_str.c_str());
23 | }
24 | void print_debug_information() {
25 | // System Information
26 | constexpr const char *const command[] = {"uname", "-a", nullptr};
27 | run_debug_command(command, "System Information");
28 |
29 | // Version
30 | DEBUG("Reborn Version: %s", reborn_get_fancy_version().c_str());
31 |
32 | // Architecture
33 | std::string arch = reborn_config.general.arch;
34 | for (char &c : arch) {
35 | c = char(std::toupper(c));
36 | }
37 | DEBUG("Reborn Target Architecture: %s", arch.c_str());
38 | }
--------------------------------------------------------------------------------
/launcher/src/client/cache.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // Cache Version
6 | #define CACHE_VERSION 1
7 |
8 | // Load Cache
9 | struct State;
10 | State load_cache();
11 |
12 | // Save Cache
13 | void write_cache(std::ostream &stream, const State &state);
14 | void save_cache(const State &state);
15 |
16 | // Wipe Cache
17 | void wipe_cache();
18 |
--------------------------------------------------------------------------------
/launcher/src/logger/logger.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | std::string get_logs_folder();
6 | void setup_logger();
7 | void show_report(const char *log_filename);
--------------------------------------------------------------------------------
/launcher/src/options/option-list.h:
--------------------------------------------------------------------------------
1 | OPTION(debug, "debug", 'd', "Enable Debug Logging")
2 | OPTION(copy_sdk, "copy-sdk", -2, "Extract Modding SDK And Exit")
3 | OPTION(disable_logger, "disable-logger", -1, "Disable Logger (And Crash Report Dialog)")
4 | OPTION(use_default, "default", -3, "Skip Client-Mode Configuration Dialog")
5 | OPTION(no_cache, "no-cache", -4, "Disable Client-Mode Configuration Cache")
6 | OPTION(wipe_cache, "wipe-cache", -5, "Wipe Cached Client-Mode Configuration And Exit")
7 | OPTION(print_available_feature_flags, "print-available-feature-flags", -6, "Print Available Client-Mode Feature Flags")
8 | OPTION(benchmark, "benchmark", -7, "Run Client-Mode Benchmark")
9 | OPTION(only_generate, "only-generate", -8, "Generate World And Exit (Server-Mode Only)")
10 | OPTION(force_headless, "force-headless", -9, "Force Disable Game Rendering")
11 | OPTION(force_non_headless, "force-non-headless", -10, "Force Enable Game Rendering")
12 | OPTION(server_mode, "server", -11, "Run In Server-Mode")
13 | OPTION(run_update, "update", -13, "Run Updater (If Available)")
14 | OPTION(run_install, "install-desktop-entry", -14, "Install Desktop File And Icon")
--------------------------------------------------------------------------------
/launcher/src/options/parser.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define OPTION(name, ...) bool name;
4 | struct options_t {
5 | #include "option-list.h"
6 | };
7 | #undef OPTION
8 | options_t parse_options(int argc, char *argv[]);
--------------------------------------------------------------------------------
/launcher/src/ui/frame.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // UI Frame
10 | struct Frame {
11 | Frame(const char *title, int width, int height);
12 | virtual ~Frame();
13 | // Prevent Copying
14 | Frame(const Frame &) = delete;
15 | Frame &operator=(const Frame &) = delete;
16 | // Run
17 | int run();
18 | virtual int render() = 0;
19 | protected:
20 | // API For Sub-Classes
21 | ImFont *monospace = nullptr;
22 | static float get_frame_width(const char *str);
23 | static void draw_right_aligned_buttons(const std::vector &buttons, const std::function &callback, bool should_actually_center = false);
24 | static constexpr const char *quit_text = "Quit";
25 | private:
26 | // Properties
27 | GLFWwindow *window = nullptr;
28 | // Internal Methods
29 | float get_scale();
30 | void setup_style(float scale);
31 | static void patch_colors(ImGuiStyle &style);
32 | };
--------------------------------------------------------------------------------
/launcher/src/updater/updater.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | // Update Status
7 | enum class UpdateStatus {
8 | NOT_STARTED,
9 | CHECKING,
10 | UP_TO_DATE,
11 | DOWNLOADING,
12 | RESTART_NEEDED,
13 | ERROR
14 | };
15 |
16 | // Updater
17 | struct Updater {
18 | // Instance
19 | static Updater *instance;
20 |
21 | // Constructor
22 | Updater();
23 | virtual ~Updater() = default;
24 |
25 | // Methods
26 | [[nodiscard]] std::string get_status() const;
27 | void log_status(bool is_ui) const;
28 | [[nodiscard]] bool can_start() const;
29 | void start();
30 | void run();
31 |
32 | protected:
33 | // Implementation
34 | virtual std::optional check() = 0;
35 | virtual bool download(const std::string &version) = 0;
36 | virtual void restart() = 0;
37 |
38 | private:
39 | // Properties
40 | UpdateStatus status = UpdateStatus::NOT_STARTED;
41 | };
--------------------------------------------------------------------------------
/launcher/src/util/env.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "util.h"
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | // Profile Directory
10 | void setup_home() {
11 | const char *custom_profile_directory = getenv(MCPI_PROFILE_DIRECTORY_ENV);
12 | std::string home;
13 | if (custom_profile_directory != nullptr) {
14 | // Custom Directory
15 | home = safe_realpath(custom_profile_directory);
16 | } else if (!reborn_is_server()) {
17 | // Ensure $HOME
18 | const char *value = getenv("HOME");
19 | if (value == nullptr) {
20 | ERR("$HOME Is Not Set");
21 | }
22 | home = value;
23 | // Flatpak
24 | if (reborn_config.packaging == RebornConfig::PackagingType::FLATPAK) {
25 | home += std::string("/.var/app/") + reborn_config.app.id;
26 | }
27 | } else {
28 | // Set Home To The Current Directory, So World Data Is Stored There
29 | char *launch_directory = getcwd(nullptr, 0);
30 | if (launch_directory == nullptr) {
31 | IMPOSSIBLE();
32 | }
33 | home = launch_directory;
34 | free(launch_directory);
35 | }
36 | // Set
37 | set_and_print_env(_MCPI_HOME_ENV, home.c_str());
38 | }
--------------------------------------------------------------------------------
/launcher/src/util/util.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | // Paths
7 | void chop_last_component(std::string &str);
8 | std::string safe_realpath(const std::string &path);
9 | bool read_directory(const std::string &path, const std::function &callback, bool allow_nonexistent_dir = false);
10 | void make_directory(std::string path);
11 | void copy_file(const std::string &src, const std::string &dst, bool log = false);
12 |
13 | // Binary
14 | std::string get_binary();
15 | std::string get_binary_directory();
16 | std::string get_appimage_path();
17 |
18 | // SDK
19 | void copy_sdk(const std::string &binary_directory, bool force);
20 |
21 | // Copying Desktop File
22 | bool is_desktop_file_installed();
23 | void copy_desktop_file();
24 |
25 | // Environment
26 | void setup_home();
--------------------------------------------------------------------------------
/libreborn/include/libreborn/config.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // Config
6 | struct RebornConfig {
7 | // General
8 | struct {
9 | const char *version;
10 | const char *author;
11 | const char *arch;
12 | } general;
13 |
14 | // App Information
15 | struct {
16 | const char *title;
17 | const char *id;
18 | const char *name;
19 | } app;
20 |
21 | // Extra Options
22 | struct {
23 | const char *skin_server;
24 | const char *discord_invite;
25 | const char *repo_url;
26 | } extra;
27 |
28 | // Documentation
29 | struct {
30 | const char *base;
31 | const char *getting_started;
32 | const char *changelog;
33 | } docs;
34 |
35 | // Internal
36 | struct {
37 | bool use_prebuilt_armhf_toolchain;
38 | const char *sdk_dir;
39 | } internal;
40 |
41 | // Packaging
42 | enum class PackagingType {
43 | NONE,
44 | APPIMAGE,
45 | FLATPAK,
46 | DEBIAN
47 | };
48 | PackagingType packaging;
49 | struct {
50 | const char *json_url;
51 | const char *version_placeholder;
52 | const char *download_url;
53 | } appimage;
54 | };
55 | extern const RebornConfig reborn_config;
56 |
57 | // Fancy Version Name
58 | std::string reborn_get_fancy_version();
59 |
60 | // Runtime Configuration
61 | bool reborn_is_headless();
62 | bool reborn_is_server();
--------------------------------------------------------------------------------
/libreborn/include/libreborn/env/env.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #define ENV(name, ...) constexpr const char *name##_ENV = #name;
6 | #include "list.h"
7 | #undef ENV
8 |
9 | bool is_env_var_internal(const char *env);
10 | void clear_internal_env_vars();
11 |
12 | // Set Environmental Variable
13 | void setenv_safe(const char *name, const char *value);
14 | void set_and_print_env(const char *name, const char *value);
15 |
16 | // Get Value
17 | const char *require_env(const char *name);
18 |
19 | // Convert Variable To Value And Vice-Versa
20 | struct Flags;
21 | struct ServerList;
22 | #define overload(type) \
23 | std::string obj_to_env_value(const type &obj); \
24 | void env_value_to_obj(type &out, const char *value)
25 | overload(std::string);
26 | overload(float);
27 | overload(Flags);
28 | overload(ServerList);
29 | #undef overload
--------------------------------------------------------------------------------
/libreborn/include/libreborn/env/list.h:
--------------------------------------------------------------------------------
1 | // Configure Client
2 | ENV(MCPI_FEATURE_FLAGS, "Client-Mode Feature Flags")
3 | ENV(MCPI_USERNAME, "Player Username")
4 | ENV(MCPI_RENDER_DISTANCE, "Render Distance")
5 | ENV(MCPI_SERVER_LIST, "Server List")
6 | // Game Assets
7 | ENV(_MCPI_REBORN_ASSETS_PATH, "")
8 | ENV(_MCPI_VANILLA_ASSETS_PATH, "")
9 | // Command Line Arguments
10 | ENV(_MCPI_BENCHMARK, "")
11 | ENV(_MCPI_ONLY_GENERATE, "")
12 | // Logging
13 | ENV(_MCPI_LOG_FD, "")
14 | ENV(MCPI_DEBUG, "Enable Debug Logging")
15 | // Server/Headless
16 | ENV(_MCPI_SERVER_MODE, "")
17 | ENV(_MCPI_FORCE_HEADLESS, "")
18 | ENV(_MCPI_FORCE_NON_HEADLESS, "")
19 | // Extra Configuration
20 | ENV(MCPI_SKIN_SERVER, "Custom Skin Server")
21 | ENV(MCPI_API_PORT, "Custom API Port")
22 | ENV(MCPI_BLOCK_OUTLINE_WIDTH, "Custom Width For Block Outline (In Pixels)")
23 | ENV(MCPI_GUI_SCALE, "Custom GUI Scale")
24 | ENV(MCPI_BINARY, "Custom Game Binary")
25 | // $HOME
26 | ENV(_MCPI_HOME, "")
27 | ENV(MCPI_PROFILE_DIRECTORY, "Custom Profile Directory")
28 | // Lock File
29 | ENV(_MCPI_LOCK_FD, "")
--------------------------------------------------------------------------------
/libreborn/include/libreborn/env/servers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | // Parse servers.txt
8 | struct ServerList {
9 | ServerList();
10 | // Type
11 | typedef unsigned short port_t;
12 | typedef std::pair Entry;
13 | // Load
14 | static port_t parse_port(const std::string &s);
15 | void load(const std::string &str);
16 | // Save
17 | [[nodiscard]] std::string to_string() const;
18 | // Entries
19 | std::vector entries;
20 | };
--------------------------------------------------------------------------------
/libreborn/include/libreborn/log.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | // Log File
8 | int reborn_get_log_fd();
9 | void reborn_set_log(int fd);
10 | // Debug Logging
11 | extern const char *reborn_debug_tag;
12 | int reborn_get_debug_fd();
13 |
14 | // Logging
15 | #define INFO(format, ...) fprintf(stderr, "[INFO]: " format "\n", ##__VA_ARGS__)
16 | #define WARN(format, ...) fprintf(stderr, "[WARN]: " format "\n", ##__VA_ARGS__)
17 | #define DEBUG(format, ...) dprintf(reborn_get_debug_fd(), "[DEBUG]: %s" format "\n", reborn_debug_tag, ##__VA_ARGS__)
18 | #define ERR(format, ...) \
19 | ({ \
20 | fprintf(stderr, "[ERR]: (%s:%i): " format "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
21 | _exit(EXIT_FAILURE); \
22 | })
23 | #define IMPOSSIBLE() ERR("This Should Never Be Called")
24 | #define CONDITIONAL_ERR(is_error, ...) \
25 | ({ \
26 | if ((is_error)) { \
27 | ERR(__VA_ARGS__); \
28 | } else { \
29 | WARN(__VA_ARGS__); \
30 | } \
31 | })
32 |
--------------------------------------------------------------------------------
/libreborn/include/libreborn/util/exec.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | // fork() With I/O
11 | struct Process {
12 | static constexpr int fd_count = 3;
13 | Process(pid_t pid_, const std::array &fds_);
14 | // Close
15 | void close_fd(int i);
16 | [[nodiscard]] int close();
17 | // Data
18 | const pid_t pid;
19 | const std::array fds;
20 | std::unordered_set closed;
21 | };
22 | std::optional fork_with_stdio();
23 | void poll_fds(const std::vector &fds, const std::function &on_data);
24 |
25 | // Safe execvpe()
26 | __attribute__((noreturn)) void safe_execvpe(const char *const argv[], const char *const envp[]);
27 |
28 | // Run Command And Get Output
29 | std::vector *run_command(const char *const command[], int *exit_status);
30 | bool is_exit_status_success(int status);
31 |
32 | // Get Exit Status String
33 | std::string get_exit_status_string(int status);
34 |
35 | // Open URL
36 | void open_url(const std::string &url);
--------------------------------------------------------------------------------
/libreborn/include/libreborn/util/glfw.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // GLFW Helpers
4 | #ifndef GLFW_VERSION_MAJOR
5 | #error "Missing GLFW"
6 | #endif
7 |
8 | void init_glfw();
9 | GLFWwindow *create_glfw_window(const char *title, int width, int height);
10 | void cleanup_glfw(GLFWwindow *window);
11 | void get_glfw_scale(GLFWwindow *window, float *x_scale, float *y_scale);
--------------------------------------------------------------------------------
/libreborn/include/libreborn/util/io.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // Safe Version Of pipe()
6 | struct Pipe {
7 | Pipe();
8 | const int read;
9 | const int write;
10 | };
11 |
12 | // Lock File
13 | int lock_file(const char *file);
14 | void unlock_file(int fd);
15 |
16 | // Safe write()
17 | void safe_write(int fd, const void *buf, size_t size);
--------------------------------------------------------------------------------
/libreborn/include/libreborn/util/string.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // Sanitize String
6 | void sanitize_string(std::string &str, int max_length, bool allow_newlines);
7 |
8 | // CP437
9 | unsigned char utf32_to_cp437(char32_t codepoint);
10 | std::string to_cp437(const std::string &input);
11 | std::string from_cp437(const std::string &input);
12 |
13 | // Format Time
14 | std::string format_time(const char *fmt);
15 | std::string format_time(const char *fmt, int time);
16 |
17 | // Trimming
18 | void trim(std::string &str);
--------------------------------------------------------------------------------
/libreborn/src/fake-libpng/empty.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MCPI-Revival/minecraft-pi-reborn/5975d165b0726b14c337f3056c83951305d07678/libreborn/src/fake-libpng/empty.c
--------------------------------------------------------------------------------
/libreborn/src/fake-libpng/empty.vers:
--------------------------------------------------------------------------------
1 | PNG12_0 { global: *; };
2 |
--------------------------------------------------------------------------------
/libreborn/src/patch/patch-internal.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef __arm__
4 | #error "Patching Code Is ARM Only"
5 | #endif
6 |
7 | #include
8 |
9 | // Segments
10 | struct segment_data {
11 | void *start;
12 | void *end;
13 | bool is_executable;
14 | bool is_writable;
15 | };
16 | MCPI_INTERNAL segment_data &get_data_for_addr(void *addr);
17 | MCPI_INTERNAL void add_segment(segment_data data);
18 |
19 | // Code Block
20 | MCPI_INTERNAL void *update_code_block(void *target);
21 | MCPI_INTERNAL void increment_code_block();
22 |
23 | // BL Instruction Magic Number
24 | #define BL_INSTRUCTION 0xeb
25 | #define B_INSTRUCTION 0xea
26 | MCPI_INTERNAL bool is_branch_instruction(unsigned char opcode);
27 | MCPI_INTERNAL uint32_t generate_bl_instruction(void *from, void *to, unsigned char opcode = BL_INSTRUCTION);
28 |
--------------------------------------------------------------------------------
/libreborn/src/util/log.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | // Debug Tag
9 | const char *reborn_debug_tag = "";
10 |
11 | // Log File
12 | static constexpr int unset_fd = -1;
13 | static int log_fd = unset_fd;
14 | int reborn_get_log_fd() {
15 | if (log_fd != unset_fd) {
16 | return log_fd;
17 | }
18 | // Open Log File
19 | const char *fd_str = getenv(_MCPI_LOG_FD_ENV);
20 | log_fd = fd_str ? std::stoi(fd_str) : -2;
21 | // Return
22 | return reborn_get_log_fd();
23 | }
24 | void reborn_set_log(const int fd) {
25 | // Set Variable
26 | log_fd = unset_fd;
27 | setenv_safe(_MCPI_LOG_FD_ENV, fd >= 0 ? std::to_string(fd).c_str() : nullptr);
28 | }
29 |
30 | // Debug Logging
31 | static bool should_print_debug_to_stderr() {
32 | return getenv(MCPI_DEBUG_ENV) != nullptr;
33 | }
34 | int reborn_get_debug_fd() {
35 | return should_print_debug_to_stderr() ? STDERR_FILENO : reborn_get_log_fd();
36 | }
--------------------------------------------------------------------------------
/media-layer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(media-layer)
2 |
3 | # Add Headers
4 | add_library(media-layer-headers INTERFACE)
5 | setup_header_dirs(media-layer-headers "${CMAKE_CURRENT_SOURCE_DIR}/include")
6 | setup_library(media-layer-headers FALSE TRUE)
7 |
8 | # Add Core
9 | if(BUILD_MEDIA_LAYER_CORE)
10 | add_subdirectory(core)
11 | endif()
12 |
13 | # Add Trampoline
14 | if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE)
15 | add_subdirectory(trampoline)
16 | endif()
17 |
--------------------------------------------------------------------------------
/media-layer/core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(media-layer-core)
2 |
3 | # Build
4 | add_library(media-layer-core SHARED
5 | src/base.cpp
6 | src/window/media.cpp
7 | src/window/cursor.cpp
8 | src/window/util.cpp
9 | src/window/events.cpp
10 | src/window/offscreen.cpp
11 | src/window/gles.cpp
12 | src/audio/api.cpp
13 | src/audio/engine.cpp
14 | src/audio/file.cpp
15 | )
16 |
17 | # Install
18 | setup_library(media-layer-core TRUE TRUE)
19 |
20 | # Link
21 | find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
22 | target_link_libraries(media-layer-core
23 | PUBLIC
24 | media-layer-headers
25 | reborn-util
26 | dl
27 | PRIVATE
28 | "${OPENAL_LIBRARY}"
29 | m
30 | glfw
31 | LIB_LIEF
32 | )
33 |
--------------------------------------------------------------------------------
/media-layer/core/src/audio/audio.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | MCPI_INTERNAL void _media_audio_delete_sources();
6 |
7 | MCPI_INTERNAL void _media_audio_init();
8 | MCPI_INTERNAL void _media_audio_cleanup();
9 | MCPI_INTERNAL int _media_audio_is_loaded();
10 |
11 | MCPI_INTERNAL ALuint _media_audio_get_buffer(const char *source, const char *name);
12 | MCPI_INTERNAL void _media_audio_delete_buffers();
--------------------------------------------------------------------------------
/media-layer/core/src/base.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include "window/media.h"
6 |
7 | // SDL Is Replaced With GLFW
8 | int media_SDL_Init(MCPI_UNUSED uint32_t flags) {
9 | return 0;
10 | }
11 |
12 | // Event Queue
13 | static std::queue queue;
14 | int media_SDL_PollEvent(SDL_Event *event) {
15 | // Handle External Events
16 | _media_handle_media_SDL_PollEvent();
17 |
18 | // Poll Event
19 | int ret;
20 | if (!queue.empty()) {
21 | *event = queue.front();
22 | queue.pop();
23 | ret = 1;
24 | } else {
25 | ret = 0;
26 | }
27 | return ret;
28 | }
29 | int media_SDL_PushEvent(const SDL_Event *event) {
30 | queue.push(*event);
31 | return 1;
32 | }
33 |
--------------------------------------------------------------------------------
/media-layer/core/src/window/media.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define GLFW_INCLUDE_NONE
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | // Interactivity
15 | MCPI_INTERNAL extern bool is_interactable;
16 |
17 | // Window
18 | MCPI_INTERNAL extern GLFWwindow *glfw_window;
19 |
20 | // Cursor
21 | MCPI_INTERNAL void _media_update_cursor();
22 | MCPI_INTERNAL extern bool ignore_relative_motion;
23 | MCPI_INTERNAL extern bool raw_mouse_motion_enabled;
24 |
25 | // Events
26 | MCPI_INTERNAL void _media_register_event_listeners();
27 | MCPI_INTERNAL void _media_handle_media_SDL_PollEvent();
28 | MCPI_INTERNAL void _media_glfw_motion(GLFWwindow *window, double xpos, double ypos);
--------------------------------------------------------------------------------
/media-layer/core/src/window/offscreen.cpp:
--------------------------------------------------------------------------------
1 | #include "media.h"
2 |
3 | #include
4 |
5 | // Offscreen Rendering
6 | static GLFWwindow *offscreen_window = nullptr;
7 | void media_begin_offscreen_render(const int width, const int height) {
8 | if (!glfw_window) {
9 | IMPOSSIBLE();
10 | }
11 | // Setup GLFW
12 | glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
13 | glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
14 | glfwWindowHint(GLFW_ALPHA_BITS, 8);
15 | glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
16 | glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
17 | glfwWindowHint(GLFW_ALPHA_BITS, 8);
18 | // Open Window
19 | offscreen_window = glfwCreateWindow(width, height, "Offscreen Rendering", nullptr, glfw_window);
20 | if (!offscreen_window) {
21 | ERR("Unable To Create Offscreen Window");
22 | }
23 | // Switch Context
24 | glfwMakeContextCurrent(offscreen_window);
25 | media_context_id++;
26 | // Check Framebuffer Size
27 | int fb_width;
28 | int fb_height;
29 | glfwGetFramebufferSize(offscreen_window, &fb_width, &fb_height);
30 | if (fb_width != width || fb_height != height) {
31 | ERR("Offscreen Framebuffer Has Invalid Size");
32 | }
33 | }
34 | void media_end_offscreen_render() {
35 | // Destroy Window
36 | glfwDestroyWindow(offscreen_window);
37 | offscreen_window = nullptr;
38 | // Switch Context
39 | glfwMakeContextCurrent(glfw_window);
40 | media_context_id++;
41 | }
--------------------------------------------------------------------------------
/media-layer/include/EGL/egl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | #define EGL_TRUE 1
8 |
9 | typedef unsigned int EGLenum;
10 | typedef unsigned int EGLBoolean;
11 | typedef void *EGLDisplay;
12 | typedef void *EGLConfig;
13 | typedef void *EGLSurface;
14 | typedef void *EGLContext;
15 | typedef int32_t EGLint;
16 |
17 | typedef void *EGLNativeDisplayType;
18 | typedef XID EGLNativeWindowType;
19 | typedef EGLNativeWindowType NativeWindowType;
20 | typedef EGLNativeDisplayType NativeDisplayType;
--------------------------------------------------------------------------------
/media-layer/include/SDL/SDL.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 |
5 | #include
6 |
7 | #include "SDL_keysym.h"
8 | #include "SDL_events.h"
9 | #include "SDL_syswm.h"
10 | #include "SDL_version.h"
11 |
12 | int media_SDL_Init(uint32_t flags);
13 | int media_SDL_PollEvent(SDL_Event *event);
14 | int media_SDL_PushEvent(const SDL_Event *event);
15 | void media_SDL_WM_SetCaption(const char *title, const char *icon);
16 |
17 | typedef enum {
18 | SDL_GRAB_QUERY = -1,
19 | SDL_GRAB_OFF = 0,
20 | SDL_GRAB_ON = 1,
21 | SDL_GRAB_FULLSCREEN
22 | } SDL_GrabMode;
23 | SDL_GrabMode media_SDL_WM_GrabInput(SDL_GrabMode mode);
24 |
25 | #define SDL_QUERY (-1)
26 | #define SDL_IGNORE 0
27 | #define SDL_DISABLE 0
28 | #define SDL_ENABLE 1
29 | int media_SDL_ShowCursor(int toggle);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/media-layer/include/SDL/SDL_keysym.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef enum {
4 | SDLK_UNKNOWN = 0,
5 | SDLK_BACKSPACE = 8,
6 | SDLK_TAB = 9,
7 | SDLK_RETURN = 13,
8 | SDLK_ESCAPE = 27,
9 | SDLK_SPACE = 32,
10 | SDLK_0 = 48,
11 | SDLK_1 = 49,
12 | SDLK_2 = 50,
13 | SDLK_3 = 51,
14 | SDLK_4 = 52,
15 | SDLK_5 = 53,
16 | SDLK_6 = 54,
17 | SDLK_7 = 55,
18 | SDLK_8 = 56,
19 | SDLK_9 = 57,
20 | SDLK_a = 97,
21 | SDLK_d = 100,
22 | SDLK_e = 101,
23 | SDLK_q = 113,
24 | SDLK_s = 115,
25 | SDLK_t = 116,
26 | SDLK_w = 119,
27 | SDLK_DELETE = 127,
28 | SDLK_UP = 273,
29 | SDLK_DOWN = 274,
30 | SDLK_RIGHT = 275,
31 | SDLK_LEFT = 276,
32 | SDLK_F1 = 282,
33 | SDLK_F2 = 283,
34 | SDLK_F3 = 284,
35 | SDLK_F5 = 286,
36 | SDLK_F11 = 292,
37 | SDLK_F12 = 293,
38 | SDLK_RSHIFT = 303,
39 | SDLK_LSHIFT = 304
40 | } SDLKey;
41 |
42 | typedef enum {
43 | KMOD_NONE = 0x0,
44 | KMOD_LSHIFT = 0x1,
45 | KMOD_RSHIFT = 0x2,
46 | KMOD_LCTRL = 0x40,
47 | KMOD_RCTRL = 0x80,
48 | KMOD_LALT = 0x100,
49 | KMOD_RALT = 0x200
50 | } SDLMod;
51 |
52 | #define KMOD_SHIFT (KMOD_LSHIFT | KMOD_RSHIFT)
53 | #define KMOD_CTRL (KMOD_LCTRL | KMOD_RCTRL)
54 | #define KMOD_ALT (KMOD_LALT | KMOD_RALT)
55 |
--------------------------------------------------------------------------------
/media-layer/include/SDL/SDL_syswm.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "SDL_version.h"
6 |
7 | typedef enum {
8 | SDL_SYSWM_X11
9 | } SDL_SYSWM_TYPE;
10 |
11 | typedef struct SDL_SysWMinfo {
12 | SDL_version version;
13 | SDL_SYSWM_TYPE subsystem;
14 | union {
15 | struct {
16 | void *display;
17 | XID window;
18 | void (*lock_func)();
19 | void (*unlock_func)();
20 | XID fswindow;
21 | XID wmwindow;
22 | void *gfxdisplay;
23 | } x11;
24 | } info;
25 | } SDL_SysWMinfo;
26 |
--------------------------------------------------------------------------------
/media-layer/include/SDL/SDL_version.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | typedef struct SDL_version {
6 | uint8_t major;
7 | uint8_t minor;
8 | uint8_t patch;
9 | } SDL_version;
10 |
--------------------------------------------------------------------------------
/media-layer/include/X11/Xlib.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef unsigned long XID;
4 | typedef struct {
5 | int x, y;
6 | int width, height;
7 | int border_width;
8 | int depth;
9 | void *visual;
10 | XID root;
11 | int clazz;
12 | int bit_gravity;
13 | int win_gravity;
14 | int backing_store;
15 | unsigned long backing_planes;
16 | unsigned long backing_pixel;
17 | int save_under;
18 | XID colormap;
19 | int map_installed;
20 | int map_state;
21 | long all_event_masks;
22 | long your_event_mask;
23 | long do_not_propagate_mask;
24 | int override_redirect;
25 | void *screen;
26 | } XWindowAttributes;
27 |
--------------------------------------------------------------------------------
/media-layer/include/media-layer/audio.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | void media_audio_update(float volume, float x, float y, float z, float yaw);
8 | void media_audio_play(const char *source, const char *name, float x, float y, float z, float pitch, float volume, int is_ui);
9 |
10 | #ifdef __cplusplus
11 | }
12 | #endif
13 |
--------------------------------------------------------------------------------
/media-layer/include/media-layer/core.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | // Default Window Size
8 | #define DEFAULT_WIDTH 840
9 | #define DEFAULT_HEIGHT 480
10 |
11 | // SDL User Events
12 | #define USER_EVENT_CHARACTER 0 // data1 = 8-Bit Character
13 | #define USER_EVENT_REAL_KEY 1 // data1 = SDL_RELEASED/PRESSED, data2 = GLFW Key Code
14 |
15 | void media_toggle_fullscreen();
16 | void media_swap_buffers();
17 | void media_cleanup();
18 | void media_get_framebuffer_size(int *width, int *height);
19 | void media_set_interactable(int toggle);
20 | void media_disable_vsync();
21 | void media_set_raw_mouse_motion_enabled(int enabled);
22 | int media_has_extension(const char *name);
23 | void media_begin_offscreen_render(int width, int height);
24 | void media_end_offscreen_render();
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/media-layer/trampoline/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(media-layer-trampoline)
2 |
3 | # Common Sources
4 | set(MEDIA_LAYER_TRAMPOLINE_SRC src/media-layer-core.cpp src/GLESv1_CM.cpp)
5 |
6 | # Build
7 | if(BUILD_NATIVE_COMPONENTS)
8 | # Host Component
9 | add_library("${TRAMPOLINE_LIBRARY_NAME}" src/host/host.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC})
10 | target_link_libraries("${TRAMPOLINE_LIBRARY_NAME}"
11 | reborn-util
12 | media-layer-core
13 | trampoline-headers
14 | )
15 | target_compile_definitions("${TRAMPOLINE_LIBRARY_NAME}" PRIVATE MEDIA_LAYER_TRAMPOLINE_HOST)
16 | # Install
17 | setup_library("${TRAMPOLINE_LIBRARY_NAME}" TRUE TRUE)
18 | elseif(BUILD_ARM_COMPONENTS)
19 | # Guest Component
20 | add_library(media-layer-core SHARED ${MEDIA_LAYER_TRAMPOLINE_SRC})
21 | target_link_libraries(media-layer-core
22 | PUBLIC
23 | media-layer-headers
24 | PRIVATE
25 | reborn-util
26 | trampoline
27 | )
28 | target_compile_definitions(media-layer-core PRIVATE MEDIA_LAYER_TRAMPOLINE_GUEST)
29 | # Install
30 | setup_library(media-layer-core TRUE TRUE)
31 | endif()
32 |
--------------------------------------------------------------------------------
/media-layer/trampoline/src/common/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | #if __BYTE_ORDER != __LITTLE_ENDIAN
9 | #error "Only Little Endian Is Supported"
10 | #endif
11 |
12 | static_assert(sizeof(int) == sizeof(int32_t));
13 | #define block_pointer(T) static_assert(!std::is_pointer::value, "Do Not Use Raw Pointers Here")
14 |
15 | #if defined(MEDIA_LAYER_TRAMPOLINE_HOST)
16 | #include "../host/host.h"
17 | #elif defined(MEDIA_LAYER_TRAMPOLINE_GUEST)
18 | #include "../guest/guest.h"
19 | #else
20 | #error "Invalid Configuration"
21 | #endif
--------------------------------------------------------------------------------
/media-layer/trampoline/src/host/host.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "host.h"
4 |
5 | // Registration
6 | static handler_t *handlers[256];
7 | void _add_handler(const unsigned char id, handler_t *handler) {
8 | if (handlers[id]) {
9 | ERR("Conflicting Trampolines For ID: %i", (int) id);
10 | }
11 | handlers[id] = handler;
12 | }
13 |
14 | // Trampoline
15 | uint32_t trampoline(const trampoline_writer_t writer, const uint32_t id, const unsigned char *args) {
16 | return handlers[id](writer, args);
17 | }
--------------------------------------------------------------------------------
/mods/include/mods/api/api.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | extern "C" {
7 | void api_add_chat_event(const Player *sender, const std::string &message);
8 | void api_update_entity_position(const Entity *entity, const RakNet_RakNetGUID *guid = nullptr);
9 | }
--------------------------------------------------------------------------------
/mods/include/mods/atlas/atlas.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 | void atlas_update_tile(Textures *textures, int texture, const unsigned char *pixels);
5 | }
--------------------------------------------------------------------------------
/mods/include/mods/bucket/bucket.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern bool buckets_enabled;
4 |
--------------------------------------------------------------------------------
/mods/include/mods/chat/chat.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | extern "C" {
6 | // Override using the HOOK() macro to provide customized chat behavior.
7 | void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetworkHandler *server_side_network_handler, const RakNet_RakNetGUID &rak_net_guid, ChatPacket *chat_packet);
8 | void chat_send_message_to_clients(ServerSideNetworkHandler *server_side_network_handler, const Player *sender, const char *message);
9 | void chat_handle_packet_send(const Minecraft *minecraft, ChatPacket *packet);
10 | bool chat_is_sending();
11 | }
12 |
--------------------------------------------------------------------------------
/mods/include/mods/classic-ui/classic-ui.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | extern "C" {
6 | std::remove_reference_t get_blit_with_classic_hud_offset();
7 | int get_classic_hud_y_offset(Minecraft *minecraft);
8 | }
--------------------------------------------------------------------------------
/mods/include/mods/compat/compat.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 | int compat_check_exit_requested();
5 | void compat_request_exit();
6 | }
--------------------------------------------------------------------------------
/mods/include/mods/creative/creative.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 | extern void *const Gui_tick_Minecraft_isCreativeMode_addr;
5 | }
--------------------------------------------------------------------------------
/mods/include/mods/feature/feature.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Flags In Server-Mode
4 | static constexpr bool server_enabled = true;
5 | static constexpr bool server_disabled = false;
6 | extern bool feature_server_flags_set;
7 | #define FLAG(name) extern bool server_##name
8 | #include "server.h"
9 | #undef FLAG
10 | #define server_is_not_vanilla_compatible (!server_is_vanilla_compatible)
11 |
12 | // Check If The Flag Is Enabled
13 | extern "C" {
14 | bool feature_has(const char *name, bool enabled_in_server_mode);
15 | }
16 |
--------------------------------------------------------------------------------
/mods/include/mods/feature/server.h:
--------------------------------------------------------------------------------
1 | FLAG(is_vanilla_compatible);
2 | FLAG(force_mob_spawning);
3 | FLAG(generate_caves);
4 | FLAG(death_messages);
--------------------------------------------------------------------------------
/mods/include/mods/fps/fps.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern double fps;
4 | extern double tps;
--------------------------------------------------------------------------------
/mods/include/mods/game-mode/game-mode.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | int get_seed_from_string(std::string str);
--------------------------------------------------------------------------------
/mods/include/mods/init/init.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 | void init_version();
5 | void init_compat();
6 | void init_server();
7 | void init_server_flags();
8 | void init_multiplayer();
9 | void init_benchmark();
10 | void init_sound();
11 | void init_input();
12 | void init_camera();
13 | void init_atlas();
14 | void init_title_screen();
15 | void init_skin();
16 | void init_fps();
17 | void init_touch();
18 | void init_textures();
19 | void init_creative();
20 | void init_game_mode();
21 | void init_misc();
22 | void init_death();
23 | void init_options();
24 | void init_chat();
25 | void init_bucket();
26 | void init_cake();
27 | void init_override();
28 | void init_screenshot();
29 | void init_f3();
30 | void init_multidraw();
31 | void init_classic_ui();
32 | void init_api();
33 | void init_shading();
34 | }
35 |
--------------------------------------------------------------------------------
/mods/include/mods/input/input.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | extern "C" {
4 | void input_set_is_right_click(int val);
5 | void input_set_is_ctrl(bool val);
6 |
7 | enum {
8 | #define KEY(name, value) MC_KEY_##name = (value),
9 | #include "key-list.h"
10 | #undef KEY
11 | };
12 | }
--------------------------------------------------------------------------------
/mods/include/mods/input/key-list.h:
--------------------------------------------------------------------------------
1 | // MCPI Seems To Use https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
2 | KEY(BACKSPACE, 0x8)
3 | KEY(DELETE, 0x2e)
4 | KEY(LEFT, 0x25)
5 | KEY(UP, 0x26)
6 | KEY(RIGHT, 0x27)
7 | KEY(DOWN, 0x28)
8 | KEY(F1, 0x70)
9 | KEY(F2, 0x71)
10 | KEY(F3, 0x72)
11 | KEY(F5, 0x74)
12 | KEY(F11, 0x7a)
13 | KEY(RETURN, 0xd)
14 | KEY(t, 0x54)
15 | KEY(q, 0x51)
16 | KEY(ESCAPE, 0x1b)
--------------------------------------------------------------------------------
/mods/include/mods/multidraw/multidraw.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | extern "C" {
6 | void LevelRenderer_renderSameAsLast(LevelRenderer *self, float delta);
7 | }
8 |
--------------------------------------------------------------------------------
/mods/include/mods/multiplayer/packets.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Used To Designate Special Behavior
4 | void multiplayer_negate(int &x);
5 |
6 | // Armor Inventory Size
7 | static constexpr int multiplayer_armor_size = 4;
8 |
9 | // ContainerSetContentPacket IDs
10 |
11 | // Used To Overwrite Inventory
12 | static constexpr unsigned char multiplayer_inventory_container_id = 0; // This Is Also A Valid Container ID
13 | // Used To Overwrite Armor
14 | // This Is Added By Reborn
15 | static constexpr unsigned char multiplayer_armor_container_id = 200;
--------------------------------------------------------------------------------
/mods/include/mods/options/options.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // Sound
6 | static constexpr const char *info_sound_data_loaded = "Loaded";
7 | extern std::string info_sound_data_state;
8 |
9 | // Difficulty
10 | static constexpr int difficulty_normal = 2;
11 | static constexpr int difficulty_peaceful = 0;
--------------------------------------------------------------------------------
/mods/include/mods/override/override.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | extern "C" {
6 | std::string override_get_path(std::string filename);
7 | }
--------------------------------------------------------------------------------
/mods/include/mods/screenshot/screenshot.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | struct Gui;
4 |
5 | extern "C" {
6 | void screenshot_take(Gui *gui);
7 | }
--------------------------------------------------------------------------------
/mods/include/mods/server/properties.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include