diff --git a/.github/workflows/miyoo_mini_release.yml b/.github/workflows/miyoo_mini_release.yml
new file mode 100644
index 000000000..ced4d4dcf
--- /dev/null
+++ b/.github/workflows/miyoo_mini_release.yml
@@ -0,0 +1,50 @@
+name: Miyoo Mini Release Build
+
+on:
+ release:
+ types: [created]
+ workflow_dispatch:
+
+jobs:
+ miyoo-mini:
+ runs-on: ubuntu-22.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Install toolchain
+ working-directory: ${{github.workspace}}
+ run: sudo Packaging/miyoo_mini/setup_toolchain.sh
+
+ - name: Build
+ working-directory: ${{github.workspace}}
+ run: >
+ source Packaging/miyoo_mini/toolchain_env.sh &&
+ Packaging/miyoo_mini/build.sh
+
+ - name: Upload-OnionOS-Package
+ if: ${{ !env.ACT }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: devilutionx-onion-os.zip
+ path: build-miyoo-mini/devilutionx-onion-os.zip
+
+ - name: Upload-miniUI-Package
+ if: ${{ !env.ACT }}
+ uses: actions/upload-artifact@v2
+ with:
+ name: devilutionx-miniui.zip
+ path: build-miyoo-mini/devilutionx-miniui.zip
+
+ - name: Update Release
+ if: ${{ github.event_name == 'release' && github.event.action == 'created' && !env.ACT }}
+ uses: ncipollo/release-action@v1
+ with:
+ artifacts: "build-miyoo-mini/devilutionx-onion-os.zip,build-miyoo-mini/devilutionx-miniui.zip"
+ allowUpdates: true
+ omitBody: true
+ omitName: true
+ omitPrereleaseDuringUpdate: true
+ token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/CMake/Platforms.cmake b/CMake/Platforms.cmake
index b7ce46950..56e138f1b 100644
--- a/CMake/Platforms.cmake
+++ b/CMake/Platforms.cmake
@@ -18,7 +18,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|OpenBSD|DragonFly|NetBSD")
endif()
set(TARGET_PLATFORM host CACHE STRING "Target platform")
-set_property(CACHE TARGET_PLATFORM PROPERTY STRINGS host retrofw rg99 rg350 gkd350h cpigamesh)
+set_property(CACHE TARGET_PLATFORM PROPERTY STRINGS host retrofw rg99 rg350 gkd350h cpigamesh miyoo_mini)
if(TARGET_PLATFORM STREQUAL "retrofw")
include(platforms/retrofw)
elseif(TARGET_PLATFORM STREQUAL "rg99")
@@ -31,6 +31,8 @@ elseif(TARGET_PLATFORM STREQUAL "cpigamesh")
include(platforms/cpigamesh)
elseif(TARGET_PLATFORM STREQUAL "lepus")
include(platforms/lepus)
+elseif(TARGET_PLATFORM STREQUAL "miyoo_mini")
+ include(platforms/miyoo_mini)
endif()
if(NINTENDO_SWITCH)
diff --git a/CMake/platforms/miyoo_mini.cmake b/CMake/platforms/miyoo_mini.cmake
new file mode 100644
index 000000000..e3e31addc
--- /dev/null
+++ b/CMake/platforms/miyoo_mini.cmake
@@ -0,0 +1,30 @@
+set(BUILD_ASSETS_MPQ OFF)
+set(USE_SDL1 ON)
+set(NONET ON)
+set(DEVILUTIONX_SYSTEM_LIBSODIUM OFF)
+set(DEVILUTIONX_SYSTEM_BZIP2 OFF)
+
+set(SDL1_VIDEO_MODE_BPP 32)
+set(SDL1_VIDEO_MODE_FLAGS SDL_HWSURFACE)
+set(SDL1_FORCE_SVID_VIDEO_MODE ON)
+
+set(PREFILL_PLAYER_NAME ON)
+set(DEFAULT_AUDIO_SAMPLE_RATE 44100)
+
+# The mini's buttons are connected via GPIO and are mapped to keyboard inputs
+set(HAS_KBCTRL 1)
+set(KBCTRL_BUTTON_DPAD_LEFT SDLK_LEFT)
+set(KBCTRL_BUTTON_DPAD_RIGHT SDLK_RIGHT)
+set(KBCTRL_BUTTON_DPAD_UP SDLK_UP)
+set(KBCTRL_BUTTON_DPAD_DOWN SDLK_DOWN)
+set(KBCTRL_BUTTON_B SDLK_SPACE) # Select spell
+set(KBCTRL_BUTTON_A SDLK_LCTRL) # Attack
+set(KBCTRL_BUTTON_Y SDLK_LSHIFT) # cast spell
+set(KBCTRL_BUTTON_X SDLK_LALT) # pickup item
+set(KBCTRL_BUTTON_RIGHTSHOULDER SDLK_t) # use mana potion
+set(KBCTRL_BUTTON_LEFTSHOULDER SDLK_e) # use health potion
+set(KBCTRL_BUTTON_START SDLK_TAB) # Use L2 for panel hotkeys
+set(KBCTRL_BUTTON_BACK SDLK_BACKSPACE) # Use R2 for spell hotkeys
+
+# Map start to menu and select to automap.
+set(REMAP_KEYBOARD_KEYS "{SDLK_RETURN,SDLK_ESCAPE},{SDLK_RCTRL,SDLK_TAB}")
diff --git a/Packaging/miyoo_mini/build.sh b/Packaging/miyoo_mini/build.sh
new file mode 100755
index 000000000..bbe3e6a4b
--- /dev/null
+++ b/Packaging/miyoo_mini/build.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+declare -r PACKAGING_DIR=`cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P`
+declare -r CFLAGS="-O3 -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve -Wall"
+declare -r LDFLAGS="-lSDL -lmi_sys -lmi_gfx -s -lSDL -lSDL_image"
+declare -r BUILD_DIR="build-miyoo-mini"
+declare -r MIYOO_CUSTOM_SDL_REPO="https://github.com/Brocky/SDL-1.2-miyoo-mini.git"
+declare -r MIYOO_CUSTOM_SDL_BRANCH="miniui-miyoomini"
+
+main() {
+ # ensure we are in devilutionx root
+ cd "$PACKAGING_DIR/../.."
+
+ rm -f "$BUILD_DIR/CMakeCache.txt"
+ cmake_configure -DCMAKE_BUILD_TYPE=Release
+ cmake_build
+ package_onion
+ package_miniui
+}
+
+cmake_configure() {
+ cmake -S. -B"$BUILD_DIR" \
+ "-DTARGET_PLATFORM=miyoo_mini" \
+ -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
+ -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
+ -DBUILD_TESTING=OFF \
+ -DCMAKE_FIND_ROOT_PATH="/opt/miyoomini-toolchain/arm-linux-gnueabihf/sysroot" \
+ "$@"
+}
+
+cmake_build() {
+ cmake --build "$BUILD_DIR"
+}
+
+build_custom_sdl() {
+ # make clean folder for custom SDL build
+ rm -rf $BUILD_DIR/CustomSDL
+ mkdir $BUILD_DIR/CustomSDL
+
+ # clone the repo and build the lib
+ cd $BUILD_DIR/CustomSDL
+ git clone $MIYOO_CUSTOM_SDL_REPO --branch $MIYOO_CUSTOM_SDL_BRANCH --single-branch .
+ ./make.sh
+
+ # change back to devilutionx root
+ cd "$PACKAGING_DIR/../.."
+ cp -rfL "$BUILD_DIR/CustomSDL/build/.libs/libSDL-1.2.so.0" "$BUILD_DIR/OnionOS/Emu/PORTS/Binaries/Diablo.port/lib/libSDL-1.2.so.0"
+}
+
+prepare_onion_skeleton() {
+ mkdir -p $BUILD_DIR/OnionOS
+
+ # Copy basic skeleton
+ cp -rf Packaging/miyoo_mini/skeleton_OnionOS/* $BUILD_DIR/OnionOS
+
+ # ensure devilutionx asset dir
+ mkdir -p $BUILD_DIR/OnionOS/Emu/PORTS/Binaries/Diablo.port/assets
+
+ # ensure lib dir for custom SDL
+ mkdir -p $BUILD_DIR/OnionOS/Emu/PORTS/Binaries/Diablo.port/lib
+
+ # ensure config dir
+ mkdir -p $BUILD_DIR/OnionOS/Saves/CurrentProfile/config/DevilutionX
+
+ # ensure save dir
+ mkdir -p $BUILD_DIR/OnionOS/Saves/CurrentProfile/saves/DevilutionX
+}
+
+package_onion() {
+ prepare_onion_skeleton
+ build_custom_sdl
+ # copy assets
+ cp -rf $BUILD_DIR/assets/* $BUILD_DIR/OnionOS/Emu/PORTS/Binaries/Diablo.port/assets
+ # copy executable
+ cp -f $BUILD_DIR/devilutionx $BUILD_DIR/OnionOS/Emu/PORTS/Binaries/Diablo.port/devilutionx
+
+ rm -f $BUILD_DIR/onion.zip
+
+ cd $BUILD_DIR/OnionOS
+ zip -r ../devilutionx-onion-os.zip .
+ cd "$PACKAGING_DIR/../.."
+}
+
+prepare_miniui_skeleton() {
+ mkdir -p $BUILD_DIR/MiniUI
+
+ # copy basic skeleton
+ cp -rf Packaging/miyoo_mini/skeleton_MiniUI/* $BUILD_DIR/MiniUI
+
+ # ensure devilutionx asset dir
+ mkdir -p $BUILD_DIR/MiniUI/Diablo/assets
+}
+
+package_miniui() {
+ prepare_miniui_skeleton
+ # copy assets
+ cp -rf $BUILD_DIR/assets/* $BUILD_DIR/MiniUI/Diablo/assets
+ # copy executable
+ cp -f $BUILD_DIR/devilutionx $BUILD_DIR/MiniUI/Diablo/devilutionx
+
+ rm -f $BUILD_DIR/miniui.zip
+
+ cd $BUILD_DIR/MiniUI
+ zip -r ../devilutionx-miniui.zip .
+ cd "$PACKAGING_DIR/../.."
+}
+
+main
diff --git a/Packaging/miyoo_mini/setup_toolchain.sh b/Packaging/miyoo_mini/setup_toolchain.sh
new file mode 100755
index 000000000..40905d404
--- /dev/null
+++ b/Packaging/miyoo_mini/setup_toolchain.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+main() {
+ install_dependencies
+ install_toolchain
+}
+
+install_toolchain() {
+ TOOLCHAIN_VERSION=v0.0.2
+ TOOLCHAIN_TAR="miyoomini-toolchain.tar.xz"
+
+ TOOLCHAIN_ARCH=`uname -m`
+ if [ "$TOOLCHAIN_ARCH" = "aarch64" ]; then
+ TOOLCHAIN_REPO=miyoomini-toolchain-buildroot-aarch64
+ else
+ TOOLCHAIN_REPO=miyoomini-toolchain-buildroot
+ fi
+
+ TOOLCHAIN_URL="https://github.com/shauninman/$TOOLCHAIN_REPO/releases/download/$TOOLCHAIN_VERSION/$TOOLCHAIN_TAR"
+
+ cd /opt
+ wget "$TOOLCHAIN_URL"
+ echo "extracting remote toolchain $TOOLCHAIN_VERSION ($TOOLCHAIN_ARCH)"
+
+ tar xf "./$TOOLCHAIN_TAR"
+ rm -rf "./$TOOLCHAIN_TAR"
+}
+
+install_dependencies() {
+ apt-get -y update && apt-get -y install \
+ bc \
+ build-essential \
+ bzip2 \
+ bzr \
+ cmake \
+ cmake-curses-gui \
+ cpio \
+ git \
+ libncurses5-dev \
+ make \
+ rsync \
+ scons \
+ tree \
+ unzip \
+ wget \
+ zip
+}
+
+main
diff --git a/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/Diablo.m3u b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/Diablo.m3u
new file mode 100644
index 000000000..81669ea1c
--- /dev/null
+++ b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/Diablo.m3u
@@ -0,0 +1 @@
+launch.sh
\ No newline at end of file
diff --git a/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/launch.sh b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/launch.sh
new file mode 100644
index 000000000..a65e21faa
--- /dev/null
+++ b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/launch.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd "$(dirname "$0")"
+HOME="$USERDATA_PATH"
+
+if [ -f "DIABDAT.MPQ" ] || [ -f "spawn.mpq" ]; then
+ ./devilutionx
+else
+ show "okay.png"
+ say "Missing DIABDAT.MPQ!"$'\n\n'"Please see readme.txt"$'\n'"in the Diablo folder"$'\n'"on your SD card."$'\n'
+ confirm only
+fi
diff --git a/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/readme.txt b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/readme.txt
new file mode 100644
index 000000000..64a2e8a28
--- /dev/null
+++ b/Packaging/miyoo_mini/skeleton_MiniUI/Diablo/readme.txt
@@ -0,0 +1,37 @@
+devilutionx(Diablo port) for MiniUI
+====================================
+
+Installation
+--------
+- Copy this folder onto your SD card in the location /Roms/Native Games (SH)/
+
+For the full game:
+ - Get the DIABDAT.MPQ from either the CD or GOG release (https://github.com/diasurgical/devilutionX/wiki/Extracting-the-.MPQs-from-the-GoG-installer)
+ - Copy the DIABDAT.MPQ into this folder
+ - Optional: If you want to also play the Hellfire expansion, copy hellfire.mpq, hfmonk.mpq, hfmusic.mpq, hfvoice.mpq into this fodler aswell
+
+For the free shareware version:
+ - Get the spawn.mpq (https://github.com/diasurgical/devilutionx-assets/releases/download/v2/spawn.mpq)
+ - Copy the spawn.mpq into this folder
+
+Controls
+--------
+- D-Pad: move
+- A: Attack nearest enemy, talk to NPC, pickup/place in inventory, OK in menus
+- B: select spell, back in menus
+- X: pickup items, open chests and doors, use item in inventory
+- Y: cast spell, delete character in main menu
+- L: use health item from belt
+- R: use mana potion from belt
+- Start: game menu (alt: L2 + Up)
+- Select: toggle automap (alt: Start + Down)
+
+- L2 show quick acess overlay
+- L2 + Up: game menu
+- L2 + Down: toggle automap
+- L2 + Left: character sheet
+- L2 + Right: inventory
+- L2 + Y: quest log
+- L2 + B: spell book
+- R2 + D-Pad: simulate mouse
+- R2 + A;B;X;Y: spell hotkeys
diff --git a/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/Binaries/Diablo.port/launch.sh b/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/Binaries/Diablo.port/launch.sh
new file mode 100644
index 000000000..9741b1d69
--- /dev/null
+++ b/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/Binaries/Diablo.port/launch.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+progdir=`cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P`
+savedir="/mnt/SDCARD/Saves/CurrentProfile/saves/DevilutionX"
+configdir="/mnt/SDCARD/Saves/CurrentProfile/config/DevilutionX"
+
+cd $progdir
+
+if [ -f "./FILES_HERE/DIABDAT.MPQ" ] || [ -f "./FILES_HERE/spawn.mpq" ]; then
+ # Timer initialisation
+ cd /mnt/SDCARD/App/PlayActivity
+ ./playActivity "init"
+
+ export LD_LIBRARY_PATH="$progdir/lib:$LD_LIBRARY_PATH"
+ SDL_HIDE_BATTERY=1 $progdir/devilutionx --data-dir $progdir/FILES_HERE --save-dir $savedir --config-dir $configdir
+
+ # Timer registration
+ cd /mnt/SDCARD/App/PlayActivity
+ ./playActivity "Diablo"
+else
+ cd "/mnt/SDCARD/Emu/PORTS/Binaries/missingFile"
+ ./infoPanel
+fi
diff --git a/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/PORTS/Diablo.port b/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/PORTS/Diablo.port
new file mode 100644
index 000000000..e69de29bb
diff --git a/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/PORTS/Imgs/Diablo.png b/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/PORTS/Imgs/Diablo.png
new file mode 100644
index 000000000..027f298b3
Binary files /dev/null and b/Packaging/miyoo_mini/skeleton_OnionOS/Emu/PORTS/PORTS/Imgs/Diablo.png differ
diff --git a/Packaging/miyoo_mini/skeleton_OnionOS/readme.txt b/Packaging/miyoo_mini/skeleton_OnionOS/readme.txt
new file mode 100644
index 000000000..d3a65c85f
--- /dev/null
+++ b/Packaging/miyoo_mini/skeleton_OnionOS/readme.txt
@@ -0,0 +1,38 @@
+devilutionx(Diablo port) for OnionOS
+====================================
+
+Installation
+--------
+- Activate the Ports Collection inside the Onion Installer on your device
+- Copy everything from this archive to the root of your sd card
+
+For the full game:
+ - Get the DIABDAT.MPQ from either the CD or GOG release (https://github.com/diasurgical/devilutionX/wiki/Extracting-the-.MPQs-from-the-GoG-installer)
+ - Copy the DIABDAT.MPQ into Emu/PORTS/Binaries/Diablo.port/FILES_HERE
+ - Optional: If you want to also play the Hellfire expansion, copy hellfire.mpq, hfmonk.mpq, hfmusic.mpq, hfvoice.mpq into the same folder
+
+For the free shareware version:
+ - Get the spawn.mpq (https://github.com/diasurgical/devilutionx-assets/releases/download/v2/spawn.mpq)
+ - Copy the spawn.mpq into Emu/PORTS/Binaries/Diablo.port/FILES_HERE
+
+Controls
+--------
+- D-Pad: move
+- A: Attack nearest enemy, talk to NPC, pickup/place in inventory, OK in menus
+- B: select spell, back in menus
+- X: pickup items, open chests and doors, use item in inventory
+- Y: cast spell, delete character in main menu
+- L: use health item from belt
+- R: use mana potion from belt
+- Start: game menu (alt: L2 + Up)
+- Select: toggle automap (alt: Start + Down)
+
+- L2 show quick acess overlay
+- L2 + Up: game menu
+- L2 + Down: toggle automap
+- L2 + Left: character sheet
+- L2 + Right: inventory
+- L2 + Y: quest log
+- L2 + B: spell book
+- R2 + D-Pad: simulate mouse
+- R2 + A;B;X;Y: spell hotkeys
diff --git a/Packaging/miyoo_mini/toolchain_env.sh b/Packaging/miyoo_mini/toolchain_env.sh
new file mode 100755
index 000000000..4f9a9a82a
--- /dev/null
+++ b/Packaging/miyoo_mini/toolchain_env.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export PATH="/opt/miyoomini-toolchain/usr/bin:${PATH}:/opt/miyoomini-toolchain/usr/arm-linux-gnueabihf/sysroot/bin"
+export CROSS_COMPILE=/opt/miyoomini-toolchain/usr/bin/arm-linux-gnueabihf-
+export PREFIX=/opt/miyoomini-toolchain/usr/arm-linux-gnueabihf/sysroot/usr
+export UNION_PLATFORM=miyoomini
diff --git a/docs/building.md b/docs/building.md
index 3998fddde..675b39e57 100644
--- a/docs/building.md
+++ b/docs/building.md
@@ -476,6 +476,13 @@ Packaging/xbox-one/build.bat
[Xbox One/Series manual](manual/platforms/xbox-one.md)
+Miyoo Mini
+
+Building for Miyoo Mini must be run from inside the [Toolchain Docker image](https://github.com/MiyooMini/union-toolchain).
+Executing `Packaging/miyoo_mini/build.sh` will create the folder `build-miyoo-mini/SDROOT` which has the correct structure to be used with
+OnionOS Port Collection.
+
+
CMake build options
### General
diff --git a/docs/installing.md b/docs/installing.md
index 1a9c9dc7a..f6aad9e83 100644
--- a/docs/installing.md
+++ b/docs/installing.md
@@ -202,3 +202,12 @@ If you'd like to use this option, scan the QR code below.
~~~
+
+Miyoo Mini
+
+**Requires OnionOS to be installed**
+
+- Activate the ports collection by using the onion installer on the device
+- Copy the contents of the released .zip-file onto the root of your SD card
+- Copy the MPQ files to `/Emu/PORTS/Binaries/Diablo.port/FILES_HERE/`
+