devilutionX icon indicating copy to clipboard operation
devilutionX copied to clipboard

Build for PS2

Open AJenbo opened this issue 3 years ago • 8 comments

docker run -it -w /project -v $(pwd):/project ps2dev/ps2dev sh

apk add git make cmake gmp mpc1 mpfr

git config --global --add safe.directory /project

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/ps2dev/ps2sdk/ps2dev.cmake

cmake --build build -j $(nproc)

if you need to build the SDK (don't forget to clone and build ps2_drivers) you will also need this:

apk add musl-dev gcc bash

image

todo

  • [x] ReadOnlyTest() is creating a folder instead of a file, and fails to delete it, failing next lauch
  • [x] Resolution is 640x448 ~~instead of 640x480~~ which is the max PS2 can do
  • https://github.com/ps2dev/ps2sdk/pull/322
  • https://github.com/ps2dev/ps2sdk/pull/397
  • https://github.com/ps2dev/ps2sdk/pull/398
  • https://github.com/ps2dev/ps2sdk/pull/404
  • https://github.com/ps2dev/ps2sdk/pull/405
  • https://github.com/ps2dev/ps2sdk/pull/406
  • https://github.com/ps2dev/ps2sdk/pull/407
  • https://github.com/ps2dev/ps2sdk/pull/408
  • https://github.com/ps2dev/ps2sdk/pull/410
  • [ ] Remove unused player sounds to get below the 2MB audio limit
    • [ ] https://github.com/diasurgical/devilutionX/pull/5820
  • [ ] No audio on videos (works via audiolib, maybe just enable that again)
  • [ ] Writing saves fails on hardware
  • [ ] Wrong sounds are being played in various cases on hardware and there are clicks and pops

Side note

Initially we tried using SDL1.2, but the version provided by ps2sdk is 1.2.8 and we expect 1.2.10. There is also an issue with there port not correctly implementing Uint64. Solving that wasn't to big of an issue, but the game gets stuck during SDL_JoystickInit, so instead we for now have opted for SDL2 which went much smoother.

AJenbo avatar Aug 13 '22 14:08 AJenbo

The CLX stuff is done and PS2 SDK recently received lots of updates, might be a good time to give this another go!

set(BUILD_ASSETS_MPQ OFF)
set(UNPACKED_MPQS ON)

https://github.com/diasurgical/devilutionx-mpq-tools

glebm avatar Nov 05 '22 12:11 glebm

Slight update, the latest build chain fixes the ReadOnlyTest issue as well as remove the need for building the drivers. Currently the game is crashing for me when loading town.

AJenbo avatar Jan 17 '23 03:01 AJenbo

Everything appears to be working now with streaming audio (currently requires individual files and not using an MPQ)... but the PS2 only allows 16 files to be open at the same time meaning that we can't open all the needed audio files for streaming. So that's something we might have to look in to a solution for.

AJenbo avatar Jan 17 '23 23:01 AJenbo

It should now allow up to 128 open files https://github.com/ps2dev/ps2sdk/pull/396

glebm avatar Jan 18 '23 03:01 glebm