|
1 | | -# PlayStation 2 port |
| 1 | +# PS2 port |
2 | 2 |
|
3 | | -The PS2 port is packaged through Docker, so the repository does not need a |
4 | | -local ps2dev toolchain. With the original game |
5 | | -files present under `tmp/ShadowFlare`, run: |
| 3 | +## Build |
| 4 | + |
| 5 | +Install PS2DEV and `genisoimage`, then set its environment variables: |
| 6 | + |
| 7 | +```sh |
| 8 | +export PS2DEV="$HOME/ps2dev" |
| 9 | +export PS2SDK="$PS2DEV/ps2sdk" |
| 10 | +export GSKIT="$PS2DEV/gsKit" |
| 11 | +export PATH="$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin" |
| 12 | +``` |
| 13 | + |
| 14 | +On Ubuntu or WSL, install the PS2DEV prebuilt toolchain and build: |
6 | 15 |
|
7 | 16 | ```sh |
| 17 | +sudo apt-get update && sudo apt-get install -y curl cmake genisoimage |
| 18 | +mkdir -p "$PS2DEV" |
| 19 | +curl -fL https://github.com/ps2dev/ps2dev/releases/download/latest/ps2dev-ubuntu-latest.tar.gz \ |
| 20 | + | tar -xz --strip-components=1 -C "$PS2DEV" |
8 | 21 | sh tools/ps2/build-iso.sh |
9 | 22 | ``` |
10 | 23 |
|
11 | | -The first run builds the `openshadowflare-ps2` image from |
12 | | -`tools/ps2/Dockerfile`; later runs reuse it. The generated disc files, |
13 | | -including `openshadowflare.iso`, are written to `build/ps2`. |
| 24 | +The archive is published on [PS2DEV releases](https://github.com/ps2dev/ps2dev/releases). |
| 25 | + |
| 26 | +The default output, `build/ps2/openshadowflare.iso`, is data-free and suitable |
| 27 | +for CI and distribution. It loads an owned `ShadowFlare` data directory placed |
| 28 | +beside the ISO in PCSX2, or at the root of a FAT32 USB drive on PS2 hardware: |
| 29 | + |
| 30 | +```text |
| 31 | +<PCSX2 ISO folder>/ |
| 32 | + openshadowflare.iso |
| 33 | + ShadowFlare/ |
| 34 | + SFlare.Cfg |
| 35 | + System/ |
| 36 | + Scenario/ |
| 37 | + Save/ |
| 38 | + Player/ |
| 39 | + Map/ |
| 40 | + Character/ |
| 41 | +
|
| 42 | +FAT32 USB drive/ |
| 43 | + ShadowFlare/ |
| 44 | + SFlare.Cfg |
| 45 | + ... |
| 46 | +``` |
| 47 | + |
| 48 | +PCSX2 maps its ISO folder to the `host0:` device. The PS2 ISO includes the |
| 49 | +USB drivers required to use `mass:` on hardware. Copy the owned game data: |
| 50 | + |
| 51 | +```sh |
| 52 | +# PCSX2: copy next to build/ps2/openshadowflare.iso. |
| 53 | +cp -a /path/to/ShadowFlare build/ps2/ |
| 54 | + |
| 55 | +# PS2 hardware: copy to the root of a mounted FAT32 USB drive. |
| 56 | +cp -a /path/to/ShadowFlare /media/$USER/PS2USB/ |
| 57 | +``` |
| 58 | + |
| 59 | +Alternatively, create a private all-in-one disc from an owned retail |
| 60 | +installation: |
| 61 | + |
| 62 | +```sh |
| 63 | +sh tools/ps2/build-iso.sh --data-dir /path/to/ShadowFlare |
| 64 | +``` |
| 65 | + |
| 66 | +## Type portability |
14 | 67 |
|
15 | | -Use `--build-image` to force a rebuild of the Docker image after changing the |
16 | | -toolchain setup, and `--data-dir` or `--out-dir` to override the default input |
17 | | -or output locations. |
| 68 | +On PS2DEV, `std::int32_t` is `long`, not `int`. Use typed literals such as |
| 69 | +`std::int32_t{0}` with `std::min`, `std::max`, and `std::clamp`; their |
| 70 | +arguments must have the same type. Format fixed-width integers with `PRId32` |
| 71 | +from `<cinttypes>` rather than `%d`. |
0 commit comments