diff --git a/.github/banner.png b/.github/banner.png new file mode 100644 index 000000000..bde6e0b12 Binary files /dev/null and b/.github/banner.png differ diff --git a/.gitignore b/.gitignore index bb3ea8bd0..40a690b02 100644 --- a/.gitignore +++ b/.gitignore @@ -379,11 +379,8 @@ MigrationBackup/ FodyWeavers.xsd # VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +.vscode/ +!.vscode/*.example.json *.code-workspace # Local History for Visual Studio Code diff --git a/.vscode/settings.json b/.vscode/settings.example.json similarity index 100% rename from .vscode/settings.json rename to .vscode/settings.example.json diff --git a/Minecraft.Client/redist64/binkawin64.asi b/Minecraft.Client/redist64/binkawin64.asi deleted file mode 100644 index f0574d9d8..000000000 Binary files a/Minecraft.Client/redist64/binkawin64.asi and /dev/null differ diff --git a/Minecraft.Client/redist64/mss64dolby.flt b/Minecraft.Client/redist64/mss64dolby.flt deleted file mode 100644 index 1842df34b..000000000 Binary files a/Minecraft.Client/redist64/mss64dolby.flt and /dev/null differ diff --git a/Minecraft.Client/redist64/mss64ds3d.flt b/Minecraft.Client/redist64/mss64ds3d.flt deleted file mode 100644 index 77a0f8aaf..000000000 Binary files a/Minecraft.Client/redist64/mss64ds3d.flt and /dev/null differ diff --git a/Minecraft.Client/redist64/mss64dsp.flt b/Minecraft.Client/redist64/mss64dsp.flt deleted file mode 100644 index 5b47b314e..000000000 Binary files a/Minecraft.Client/redist64/mss64dsp.flt and /dev/null differ diff --git a/Minecraft.Client/redist64/mss64eax.flt b/Minecraft.Client/redist64/mss64eax.flt deleted file mode 100644 index 18d0033db..000000000 Binary files a/Minecraft.Client/redist64/mss64eax.flt and /dev/null differ diff --git a/Minecraft.Client/redist64/mss64srs.flt b/Minecraft.Client/redist64/mss64srs.flt deleted file mode 100644 index 9412318ae..000000000 Binary files a/Minecraft.Client/redist64/mss64srs.flt and /dev/null differ diff --git a/Minecraft.World/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/ConsoleSaveFileOutputStream.cpp index c4812a734..8d05ee60c 100644 --- a/Minecraft.World/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileOutputStream.cpp @@ -66,7 +66,7 @@ void ConsoleSaveFileOutputStream::write(byteArray b) BOOL result = m_saveFile->writeFile( m_file, - &b.data, // data buffer + b.data, // data buffer b.length, // number of bytes to write &numberOfBytesWritten // number of bytes written ); diff --git a/README.md b/README.md index 81fa190d1..c94fc4a76 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,26 @@ -# MinecraftConsoles +![Legacy Edition Banner](.github/banner.png) +# MinecraftConsoles (Legacy Console Edition) [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/jrum7HhegA) -![Tutorial World](.github/TutorialWorld.png) +This project is based on source code of Minecraft Legacy Console Edition v1.6.0560.0 (TU19) with some fixes and improvements applied. -## Introduction +The current goal of MinecraftConsoles is to be a multi-platform base for further development, such as modding, backports, and anything else LCE. On top of that, we're working to make this a quality experience on Desktop with or without a controller while (long-term) retaining console support. -This project contains the source code of Minecraft Legacy Console Edition v1.6.0560.0 (TU19) with some fixes and improvements applied. +See our our [Contributor's Guide](./CONTRIBUTING.md) for more information on the goals of this project. ## Download Windows users can download our [Nightly Build](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly)! Simply download the `.zip` file and extract it to a folder where you'd like to keep the game. You can set your username in `username.txt` (you'll have to make this file) +If you're looking for Dedicated Server software, download its [Nightly Build here](https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly-dedicated-server). Similar instructions to the client more or less, though see further down in this README for more info on that. + ## Platform Support - **Windows**: Supported for building and running the project -- **macOS / Linux**: The Windows nightly build may run through Wine or CrossOver based on community reports, but this is unofficial and not currently tested by the maintainers +- **macOS / Linux**: The Windows nightly build will run through Wine or CrossOver based on community reports, but this is unofficial and not currently tested by the maintainers when pushing updates +- **Android**: The Windows nightly build does run but has stability / frametime pacing issues frequently reported +- **iOS**: No current support +- **All Consoles**: Console support remains in the code, but maintainers are not currently verifying console functionality / porting UI Changes to the console builds at this time. ## Features @@ -25,32 +31,13 @@ Windows users can download our [Nightly Build](https://github.com/smartcmd/Minec - Added a high-resolution timer path on Windows for smoother high-FPS gameplay timing - Device's screen resolution will be used as the game resolution instead of using a fixed resolution (1920x1080) - LAN Multiplayer & Discovery -- Added persistent username system via "username.txt" +- Dedicated Server Software (`Minecraft.Server.exe`) +- Added persistent username system via `username.txt` +- Decoupled usernames and UIDs to allow username changes +- Fixed various security issues present in the original codebase +- Splitscreen Multiplayer support (connect to dedicated servers, etc) +- In-game server management (Add Server button, etc) -## Multiplayer - -Basic LAN multiplayer is available on the Windows build - -- Hosting a multiplayer world automatically advertises it on the local network -- Other players on the same LAN can discover the session from the in-game Join Game menu -- Game connections use TCP port `25565` by default -- LAN discovery uses UDP port `25566` -- Add servers to your server list with the in-game Add Server button (temp) -- Rename yourself without losing data by keeping your `uid.dat` - -Parts of this feature are based on code from [LCEMP](https://github.com/LCEMP/LCEMP) (thanks!) - -### Launch Arguments - -| Argument | Description | -|--------------------|-----------------------------------------------------------------------------------------------------| -| `-name ` | Sets your in-game username. | -| `-fullscreen` | Launches the game in Fullscreen mode | - -Example: -``` -Minecraft.Client.exe -name Steve -fullscreen -``` ## Dedicated Server in Docker (Wine) @@ -183,6 +170,143 @@ Minecraft.Server.exe -seed 123456789 - **Open Debug Overlay**: `F4` - **Toggle Debug Console**: `F6` + +## Client Launch Arguments + +| Argument | Description | +|--------------------|-----------------------------------------------------------------------------------------------------| +| `-name ` | Overrides your in-game username. | +| `-fullscreen` | Launches the game in Fullscreen mode | + +Example: +``` +Minecraft.Client.exe -name Steve -fullscreen +``` + +## LAN Multiplayer +LAN multiplayer is available on the Windows build + +- Hosting a multiplayer world automatically advertises it on the local network +- Other players on the same LAN can discover the session from the in-game Join Game menu +- Game connections use TCP port `25565` by default +- LAN discovery uses UDP port `25566` +- Add servers to your server list with the in-game Add Server button (temp) +- Rename yourself without losing data by keeping your `uid.dat` +- Split-screen players can join in, even in Multiplayer + +Parts of this feature are based on code from [LCEMP](https://github.com/LCEMP/LCEMP) (thanks!) + +# Dedicated Server Software + + +## Dedicated Server in Docker (Wine) + +This repository includes a lightweight Docker setup for running the Windows dedicated server under Wine. +### Quick Start (No Build, Recommended) + +No local build is required. The container image is pulled from GHCR. + +```bash +./start-dedicated-server.sh +``` + +`start-dedicated-server.sh` does the following: +- uses `docker-compose.dedicated-server.ghcr.yml` +- pulls latest image, then starts the container + +If you want to skip pulling and just start: + +```bash +./start-dedicated-server.sh --no-pull +``` + +Equivalent manual command: + +```bash +docker compose -f docker-compose.dedicated-server.ghcr.yml up -d +``` + +### Local Build Mode (Optional) + +Use this only when you want to run your own locally built `Minecraft.Server` binary in Docker. +**A local build of `Minecraft.Server` is required for this mode.** + +```bash +docker compose -f docker-compose.dedicated-server.yml up -d --build +``` + +Useful environment variables: +- `XVFB_DISPLAY` (default: `:99`) +- `XVFB_SCREEN` (default: `64x64x16`, tiny virtual display used by Wine) + +Fixed server runtime behavior in container: +- executable path: `/srv/mc/Minecraft.Server.exe` +- bind IP: `0.0.0.0` +- server port: `25565` + +Persistent files are bind-mounted to host: +- `./server-data/server.properties` -> `/srv/mc/server.properties` +- `./server-data/GameHDD` -> `/srv/mc/Windows64/GameHDD` + +## About `server.properties` + +`Minecraft.Server` reads `server.properties` from the executable working directory (Docker image: `/srv/mc/server.properties`). +If the file is missing or contains invalid values, defaults are auto-generated/normalized on startup. + +Important keys: + +| Key | Values / Range | Default | Notes | +|-----|-----------------|---------|-------| +| `server-port` | `1-65535` | `25565` | Listen TCP port | +| `server-ip` | string | `0.0.0.0` | Bind address | +| `server-name` | string (max 16 chars) | `DedicatedServer` | Host display name | +| `max-players` | `1-8` | `8` | Public player slots | +| `level-name` | string | `world` | Display world name | +| `level-id` | safe ID string | derived from `level-name` | Save folder ID; normalized automatically | +| `level-seed` | int64 or empty | empty | Empty = random seed | +| `world-size` | `classic\|small\|medium\|large` | `classic` | World size preset for new worlds and expansion target for existing worlds | +| `log-level` | `debug\|info\|warn\|error` | `info` | Server log verbosity | +| `autosave-interval` | `5-3600` | `60` | Seconds between autosaves | +| `white-list` | `true/false` | `false` | Enable access list checks | +| `lan-advertise` | `true/false` | `false` | LAN session advertisement | + +Minimal example: + +```properties +server-name=DedicatedServer +server-port=25565 +max-players=8 +level-name=world +level-seed= +world-size=classic +log-level=info +white-list=false +lan-advertise=false +autosave-interval=60 +``` + +## Dedicated Server launch arguments + +The server loads base settings from `server.properties`, then CLI arguments override those values. + +| Argument | Description | +|----------|-------------| +| `-port <1-65535>` | Override `server-port` | +| `-ip ` | Override `server-ip` | +| `-bind ` | Alias of `-ip` | +| `-name ` | Override `server-name` (max 16 chars) | +| `-maxplayers <1-8>` | Override `max-players` | +| `-seed ` | Override `level-seed` | +| `-loglevel ` | Override `log-level` (`debug`, `info`, `warn`, `error`) | +| `-help` / `--help` / `-h` | Print usage and exit | + +Examples: + +```powershell +Minecraft.Server.exe -name MyServer -port 25565 -ip 0.0.0.0 -maxplayers 8 -loglevel info +Minecraft.Server.exe -seed 123456789 +``` + ## Build & Run 1. Install [Visual Studio 2022](https://aka.ms/vs/17/release/vs_community.exe). @@ -200,10 +324,6 @@ cmake --build build --config Debug --target MinecraftClient For more information, see [COMPILE.md](COMPILE.md). -## Known Issues - -- Native builds for platforms other than Windows have not been tested and are most likely non-functional. The Windows nightly build may still run on macOS and Linux through Wine or CrossOver, but that path is unofficial and not currently supported - ## Contributors Would you like to contribute to this project? Please read our [Contributor's Guide](CONTRIBUTING.md) before doing so! This document includes our current goals, standards for inclusions, rules, and more. diff --git a/x64/Debug/Effects.msscmp b/x64/Debug/Effects.msscmp deleted file mode 100644 index 8eb4b9155..000000000 Binary files a/x64/Debug/Effects.msscmp and /dev/null differ diff --git a/x64/Debug/redist64/binkawin64.asi b/x64/Debug/redist64/binkawin64.asi deleted file mode 100644 index d363b31db..000000000 Binary files a/x64/Debug/redist64/binkawin64.asi and /dev/null differ diff --git a/x64/Debug/redist64/mss64dolby.flt b/x64/Debug/redist64/mss64dolby.flt deleted file mode 100644 index 7e9eb6054..000000000 Binary files a/x64/Debug/redist64/mss64dolby.flt and /dev/null differ diff --git a/x64/Debug/redist64/mss64ds3d.flt b/x64/Debug/redist64/mss64ds3d.flt deleted file mode 100644 index c6a6a1252..000000000 Binary files a/x64/Debug/redist64/mss64ds3d.flt and /dev/null differ diff --git a/x64/Debug/redist64/mss64dsp.flt b/x64/Debug/redist64/mss64dsp.flt deleted file mode 100644 index 28caa28e9..000000000 Binary files a/x64/Debug/redist64/mss64dsp.flt and /dev/null differ diff --git a/x64/Debug/redist64/mss64eax.flt b/x64/Debug/redist64/mss64eax.flt deleted file mode 100644 index c91b6e163..000000000 Binary files a/x64/Debug/redist64/mss64eax.flt and /dev/null differ diff --git a/x64/Debug/redist64/mss64srs.flt b/x64/Debug/redist64/mss64srs.flt deleted file mode 100644 index 01baef15a..000000000 Binary files a/x64/Debug/redist64/mss64srs.flt and /dev/null differ diff --git a/x64/Release/Effects.msscmp b/x64/Release/Effects.msscmp deleted file mode 100644 index 8eb4b9155..000000000 Binary files a/x64/Release/Effects.msscmp and /dev/null differ diff --git a/x64/Release/redist64/binkawin64.asi b/x64/Release/redist64/binkawin64.asi deleted file mode 100644 index d363b31db..000000000 Binary files a/x64/Release/redist64/binkawin64.asi and /dev/null differ diff --git a/x64/Release/redist64/mss64dolby.flt b/x64/Release/redist64/mss64dolby.flt deleted file mode 100644 index 7e9eb6054..000000000 Binary files a/x64/Release/redist64/mss64dolby.flt and /dev/null differ diff --git a/x64/Release/redist64/mss64ds3d.flt b/x64/Release/redist64/mss64ds3d.flt deleted file mode 100644 index c6a6a1252..000000000 Binary files a/x64/Release/redist64/mss64ds3d.flt and /dev/null differ diff --git a/x64/Release/redist64/mss64dsp.flt b/x64/Release/redist64/mss64dsp.flt deleted file mode 100644 index 28caa28e9..000000000 Binary files a/x64/Release/redist64/mss64dsp.flt and /dev/null differ diff --git a/x64/Release/redist64/mss64eax.flt b/x64/Release/redist64/mss64eax.flt deleted file mode 100644 index c91b6e163..000000000 Binary files a/x64/Release/redist64/mss64eax.flt and /dev/null differ diff --git a/x64/Release/redist64/mss64srs.flt b/x64/Release/redist64/mss64srs.flt deleted file mode 100644 index 01baef15a..000000000 Binary files a/x64/Release/redist64/mss64srs.flt and /dev/null differ