diff --git a/.github/workflows/PS4.yml b/.github/workflows/PS4.yml new file mode 100644 index 000000000..ca8659cdc --- /dev/null +++ b/.github/workflows/PS4.yml @@ -0,0 +1,42 @@ +name: PS4 Release Build + +on: + push: + branches: + - master + pull_request: + types: [ opened, synchronize ] + release: + types: [created] + workflow_dispatch: + +jobs: + ps4: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Create Build Environment + run: > + sudo apt update && + sudo apt install -y wget cmake git gettext smpq && + wget https://github.com/PacBrew/pacbrew-pacman/releases/download/pacbrew-release-1.0/pacbrew-pacman-1.0.deb && + sudo dpkg -i pacbrew-pacman-1.0.deb && sudo pacbrew-pacman -Sy && + sudo pacbrew-pacman --noconfirm -S ps4-openorbis ps4-openorbis-portlibs && + echo "#include " | sudo tee /opt/pacbrew/ps4/openorbis/include/sys/endian.h + + - name: Build + working-directory: ${{github.workspace}} + shell: bash + run: Packaging/ps4/build.sh + + - name: Upload-Package + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v2 + with: + name: devilutionx.pkg + path: build-ps4/devilutionx.pkg + diff --git a/CMake/Platforms.cmake b/CMake/Platforms.cmake index 16422ae2f..24a6e67fb 100644 --- a/CMake/Platforms.cmake +++ b/CMake/Platforms.cmake @@ -48,6 +48,10 @@ if(VITA) include(platforms/vita) endif() +if(PS4) + include(platforms/ps4) +endif() + if(ANDROID) include(platforms/android) endif() diff --git a/CMake/platforms/ps4.cmake b/CMake/platforms/ps4.cmake new file mode 100644 index 000000000..aa39f6953 --- /dev/null +++ b/CMake/platforms/ps4.cmake @@ -0,0 +1,19 @@ +set(DISCORD_INTEGRATION OFF) +set(BUILD_TESTING OFF) +set(ASAN OFF) +set(UBSAN OFF) +SET(DISABLE_LTO ON) +set(NONET ON) +set(NOEXIT ON) +set(BUILD_ASSETS_MPQ ON) + +# Packbrew SDK provides SDL_image, but FindSDL2_image() fails to +# pick up its dependencies (with includes libjpeg, libwebp etc). +# One way to address this, is to do the following: +# +# target_link_libraries(${BIN_TARGET} PUBLIC ${PC_SDL2_image_LIBRARIES}) +# +# or simply use the in-tree copy as follows: +set(DEVILUTIONX_SYSTEM_SDL_IMAGE OFF) + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 1724a6482..8ba33c6d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,6 +337,15 @@ if(VITA) endif() +if(PS4) + add_custom_command( + TARGET devilutionx_mpq POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${DEVILUTIONX_MPQ} "${PROJECT_SOURCE_DIR}/Packaging/ps4/") + add_self(${BIN_TARGET}) + add_pkg(${BIN_TARGET} "${PROJECT_SOURCE_DIR}/Packaging/ps4" + "DVLX00001" "DevilutionX" "${PROJECT_VERSION}") +endif() + if(NINTENDO_3DS) set(APP_TITLE "DevilutionX") set(APP_DESCRIPTION "DevilutionX port for 3DS") diff --git a/Packaging/ps4/README.md b/Packaging/ps4/README.md new file mode 100644 index 000000000..5f5a4f60c --- /dev/null +++ b/Packaging/ps4/README.md @@ -0,0 +1,40 @@ +# devilutionX PS4 port + +## Prerequisites +- A Playstation 4 capable of running homebrew. +- Game assets from the Diablo game (diabdat.mpq), + or its [shareware][shareware] (spawn.mpq) + +## Installation +- Install the devilutionX PS4 pkg +- Copy the game assets (e.g., via ftp) to /user/data/diasurgical/devilution/ +- Launch the game + +## Known limitations + - No networking + +## Controls +- D-pad: move hero +- ○: attack nearby enemies, talk to townspeople and merchants, pickup/place + items in the inventory, OK while in main menu +- ×: select spell, back while in menus +- △: pickup items, open nearby chests and doors, use item in the inventory +- □: cast spell, delete character while in main menu +- L1: use health item from belt +- R1: use mana potion from belt +- L2: toggle character sheet +- R2: toggle inventory +- Left stick: move hero +- Right stick: move cursor +- L3: toggle auto map +- R3: click with cursor + +## Building from Source +Install the [PacBrew openorbis SDK][pacbrew-openorbis], then run the following + bash script. +```console +devilutionX$ ./Packaging/ps4/build.sh +``` + +[shareware]: http://ftp.blizzard.com/pub/demos/diablosw.exe +[pacbrew-openorbis]: https://github.com/PacBrew/pacbrew-packages diff --git a/Packaging/ps4/build.sh b/Packaging/ps4/build.sh new file mode 100755 index 000000000..663d45317 --- /dev/null +++ b/Packaging/ps4/build.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e +SCRIPTDIR="${BASH_SOURCE[0]}" +SCRIPTDIR="$(dirname "${SCRIPTDIR}")" + +cmake -S "${SCRIPTDIR}/../../" \ + -B build-ps4 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_TOOLCHAIN_FILE="/opt/pacbrew/ps4/openorbis/cmake/ps4.cmake" + +cmake --build build-ps4 -j $(getconf _NPROCESSORS_ONLN) +mv build-ps4/IV0001-DVLX00001_00-*.pkg build-ps4/devilutionx.pkg diff --git a/Packaging/ps4/sce_sys/icon0.png b/Packaging/ps4/sce_sys/icon0.png new file mode 100644 index 000000000..5a17714db Binary files /dev/null and b/Packaging/ps4/sce_sys/icon0.png differ