Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Split CONTRIBUTING into rules, building and releasing

Leonardo Lobatof8a21cf0cca9
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index e97b167..9839804 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,42 +1,45 @@
-<!-- Thanks for contributing! Read CONTRIBUTING.md for setup and testing.
- Keep each PR focused, and tell us what you tested. -->
+<!-- Thanks for contributing! Read CONTRIBUTING.md first: one pull request, one change.
+ Describe only what is in this pull request, and say what you tested. -->
## Problem
-<!-- What was wrong or missing from the user's point of view?
- Link an issue if there is one. -->
+<!-- What was wrong or missing from a player's point of view?
+ Link the issue. If there is none, this paragraph is the issue. -->
## What changed
-<!-- Describe the resulting behavior in a few sentences.
+<!-- Describe the resulting behaviour in a few sentences, not the functions you edited.
For UI changes, include a screenshot or short video when useful. -->
## How it was tested
<!-- Describe what you did and what happened.
- For console tests, include firmware, runtime kit, and game/App ID
- where relevant. Attach logs for launch or runtime changes.
+ For console tests, include firmware, runtime kit, and game/App ID.
+ Attach logs for launch or runtime changes.
Host tests and PS5 builds are useful, but aren't console testing.
If you couldn't test on a console, leave that box unchecked
- and say what still needs checking. Mark unrelated checks N/A.
-
- For submodule pin changes, try a fresh recursive checkout and build
- to check that the pinned commits and required inputs are available. -->
+ and say what still needs checking. Mark unrelated checks N/A. -->
- [ ] Host tests pass: `ctest --preset homebrew-host --output-on-failure`
- [ ] PS5 package builds: `scripts/build-homebrew-ps5.sh`
- [ ] Tested on a PS5, with steps and results described above
-- [ ] Added or updated tests for changed behavior, where applicable
+- [ ] Added or updated tests for changed behaviour, where applicable
+
+## Scope
+
+- [ ] This pull request does one thing. Unrelated fixes and features are in their own pull requests.
+- [ ] It targets `main` and is rebased on it.
+- [ ] It does not change the version, the runtime kit pin (`src/runtime/kit_trust.h`, the kit entry in
+ `dependencies.lock.json`) or release files.
## Submodule changes
<!-- Delete this section if no submodule pins changed.
- For each changed pin, explain why and link the commits or comparison.
+ For each changed pin, link the merged pull request on the fork.
Link an upstream PR when the change is useful upstream. -->
-- [ ] Submodule changes are committed and pushed before this PR,
- so the pinned commits are fetchable from the configured remotes
+- [ ] Each new pin is a commit already on the fork's `main`
- [ ] Playden's submodule pointers and corresponding revision records
are updated together, including `dependencies.lock.json`
- [ ] For ps5-homebrew-ui, the revisions in `scripts/build-homebrew.sh`
@@ -44,6 +47,7 @@
## AI tools
-<!-- Did you use an AI coding tool? Which one, with which model?
- Writing all the code with AI is a perfectly fine answer.
- Either way, you've read and run the result yourself. -->
+<!-- Did you use an AI coding tool? Which one, with which model, and roughly
+ how much of the change did it write? "All of it" is a fine answer.
+ Either way, you've read the result, checked this description against
+ the diff, and run it yourself. -->
diff --git a/CLAUDE.md b/CLAUDE.md
index 3a19f3a..50cd547 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -89,12 +89,25 @@ the same call:
`scripts/build-homebrew.sh` and `cmake/HomebrewUI.cmake`.
- Wine is not forked. Wine changes are new patch files in prospero-win's `wine/patches/`.
- The kit builds only on Linux x86-64. Changes meant for upstream must not name Playden, its paths, pins or issues.
-- See CONTRIBUTING.md › Dependencies for the full workflow.
+- See docs/building.md › Dependencies for the full workflow.
## Conventions
- Match surrounding style. Source files carry GPL-3.0-or-later SPDX headers.
- Reusable UI fixes belong in ps5-homebrew-ui, product behaviour here.
-- Commit format: see CONTRIBUTING.md › Code and commits. A commit that resolves an issue says `Fixes #N` (`Refs #N`
+- Commit format: see CONTRIBUTING.md › Commits. A commit that resolves an issue says `Fixes #N` (`Refs #N`
for partial work).
- History is linear: rebase and fast-forward, no merge commits.
+
+## Pull requests
+
+These rules are for every contributor's agent (full text in CONTRIBUTING.md):
+
+- One pull request, one change. Do not bundle a second feature or an unrelated fix; tell the user to open another
+ pull request for it.
+- Target `main`, rebased on it.
+- Never change the version (`CMakeLists.txt`, `PLAYDEN_PRERELEASE`), the runtime kit pin (`src/runtime/kit_trust.h`,
+ the kit entry in `dependencies.lock.json`) or release files. Only the maintainer releases kits.
+- Move a submodule pin only to a commit already on that fork's `main`.
+- Fill in `.github/PULL_REQUEST_TEMPLATE.md`. Describe only what is in the diff and only tests that were actually run;
+ say plainly what was not tested on a console.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 90c83e4..d7cb3df 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,10 +1,19 @@
# Contributing to Playden for PS5
-Playden is a controller-first launcher for Windows games on a jailbroken PS5. It signs in to Steam, downloads
-games, prepares a private Wine bottle for each one with [prospero-win](https://github.com/mpereiraesaa/prospero-win),
-and registers each game as its own PS5 title.
+Thanks for helping! Playden is maintained by one person in spare time, and most testing means sitting in front of
+a PS5. The rules below are here so a change can be understood, tested and released quickly. They are not meant to
+be gatekeeping; they make the review easier for everyone.
-This guide covers setup, builds, tests, running on a console, and how to change a dependency.
+- [Ways to help](#ways-to-help)
+- [Report a game test](#report-a-game-test)
+- [One pull request, one change](#one-pull-request-one-change)
+- [Files that stay out of pull requests](#files-that-stay-out-of-pull-requests)
+- [Before you open a pull request](#before-you-open-a-pull-request)
+- [Describe the problem and what you tested](#describe-the-problem-and-what-you-tested)
+- [Commits](#commits)
+- [Using AI tools](#using-ai-tools)
+
+To build Playden, run its tests or put it on a console, see [docs/building.md](docs/building.md).
## Ways to help
@@ -13,9 +22,9 @@ This guide covers setup, builds, tests, running on a console, and how to change
- **Add a recipe for a game.** A recipe tells Playden how to start one game. See
[Community recipes](docs/community-recipes.md) for the format, the shipped recipes and the registry values a
recipe may set.
-- **Fix a bug or add a feature.** Look for an open issue, or open one to discuss a bigger change first.
+- **Fix a bug or add a feature.** Look for an open issue. For a large change, open an issue first (see below).
- **Improve the upstream projects.** Many fixes belong in prospero-win, ps5-homebrew-ui or PS5_Mesa. See
- [Dependencies](#dependencies).
+ [Dependencies](docs/building.md#dependencies).
## Report a game test
@@ -37,255 +46,104 @@ This guide covers setup, builds, tests, running on a console, and how to change
5. [Open a test report](../../issues/new?template=test-report.yml), paste the table and attach the zip. The
[sample report](docs/sample-test-report.md) shows what to fill in.
-## Requirements
+## One pull request, one change
-- macOS on Apple Silicon (the only host the build supports today).
-- Xcode command line tools.
-- Homebrew packages: `brew install cmake ninja pkgconf sdl2-compat llvm@18 python`.
- LLVM 18 builds the PS5 code. Apple clang builds the macOS host.
-- About 2 GB of free space for `deps/` and `build/`.
-- A checkout path without symbolic links. Playden refuses symlinked paths when it reads its data, so two tests fail
- in a link such as macOS `/tmp` (use `/private/tmp` or a folder in your home directory).
-- For console work: a jailbroken PS5, preferably on firmware 13.60, the version we test on (see [Running on a console](#running-on-a-console)).
+A pull request fixes one bug or adds one feature. If you find yourself writing "also", "additionally" or "while I
+was there" in the description, split it.
-## Get the source
+- A pull request that adds a feature does not also fix unrelated bugs, even small ones. Open a second pull request
+ for the fix. Small fixes are easy to review on their own and can ship right away.
+- A pull request that fixes a bug does not also refactor, rename or reformat code it did not need to touch.
+- If two changes are independent, they are two pull requests. If one needs the other, open the one it needs first
+ and mention it in the second.
+- A change to a fork in `third_party/` or to the kit is its own pull request on that project, before the Playden
+ one (see [Files that stay out of pull requests](#files-that-stay-out-of-pull-requests)).
-```sh
-git clone --recursive https://github.com/leolobato/playden-ps5.git
-cd playden-ps5
-scripts/fetch-deps.sh
-```
+A good rule of thumb: if a reviewer could reasonably want to merge half of the pull request and reject the other
+half, it should have been two. Google's [Small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html)
+guide explains why.
-`--recursive` checks out the submodules in `third_party/`. Most of them are forks that carry our patches on a
-`main` branch (see [Dependencies](#dependencies)).
+**Open an issue first** for large changes: a new feature, anything that touches Steam sign-in or credentials, the
+runtime kit, the title shell contract or the install pipeline. Describe the problem and the approach. This keeps you
+from spending a weekend on something that conflicts with work in progress or with where the project is going.
-`scripts/fetch-deps.sh` downloads the prebuilt PS5 toolchain pieces into `deps/`: two PS5 payload SDK releases, the
-ps5-opengl SDK and the LLVM compiler-rt builtins. It checks every download against the SHA-256 in
-`dependencies.lock.json`. You can run it again at any time; it skips what is already correct.
+Pull requests target `main`. Rebase on `main` rather than merging it in: the history is linear.
-## Build and test on macOS
+## Files that stay out of pull requests
-```sh
-scripts/build-homebrew.sh
-cmake --build --preset homebrew-host
-ctest --preset homebrew-host --output-on-failure
-build/homebrew-host/playden-homebrew
-```
+These are changed only at release time. Including them conflicts with every other open pull request or breaks
+consoles that update:
-The first run also builds curl and Mbed TLS from pinned source archives. The host app signs in to Steam like the
-console app does and stores its data under `build/homebrew-host/playden-data`.
+- **The version**: `project(PlaydenLauncher VERSION …)` in `CMakeLists.txt` and `PLAYDEN_PRERELEASE`.
+- **The runtime kit**: its pin in `src/runtime/kit_trust.h` and its entry in `dependencies.lock.json`. Playden accepts
+ only the pinned kit, so a pin to a kit that is not released stops games from starting for every player. A change
+ that needs a new kit (a Wine patch, a new library) goes to prospero-win, and the issue says so; kits are built and
+ released with Playden releases.
+- **Fork pins**: a submodule in `third_party/` may only point at a commit already on that fork's `main`. The pull
+ request on the fork comes first; once it is merged, a Playden pull request may move the pin.
+- **Prebuilt binaries** (DLLs and other files in `runtime/`): the pull request includes the source and the build
+ script. The binaries are rebuilt and their hashes checked before merging.
+- **Releases, tags and release notes** ([docs/releasing.md](docs/releasing.md)).
-You do not need a console or a Steam account for the tests. To see the screens with synthetic data, use the
-simulation mode:
+A merged pull request ships in the next release.
-```sh
-build/homebrew-host/playden-homebrew --simulation --scenario signed-out
-```
-
-## Build the PS5 package
+## Before you open a pull request
```sh
-scripts/build-lapy-helper.sh
-scripts/build-homebrew-ps5.sh
+ctest --preset homebrew-host --output-on-failure # host tests (macOS)
+scripts/build-homebrew-ps5.sh # PS5 package, for code that runs on the console
```
-The first script builds the root helper that gives the title access to `/data`. The second builds the launcher
-title `FAKE77031` into `build/homebrew-ps5/dist/FAKE77031`, with the two small payloads it sends to the payload
-loader (the title remover and the self-update's relaunch payload). Neither script contacts a console.
-
-The build checks the pinned revisions and hashes. If it stops with a mismatch, do not edit the hash: find out why
-the input changed. The PS5 build is reproducible, so the same sources give the same `eboot.bin` in any checkout.
-
-`FAKE77031` is allocated to Playden. Do not use it for another application.
-
-## Running on a console
-
-You need:
-
-- A jailbroken PS5 (for example with the WebKit autoloader). We test on firmware 13.60; other versions are untested.
-- These payloads loaded after each boot. The versions are the ones we test with:
+[docs/building.md](docs/building.md) explains the setup. New behaviour comes with tests; changed behaviour comes with
+changed tests. Many tests have a `*_native_policy` twin that runs the console code paths on the host: keep both
+passing.
- | Payload | Version | What it is for |
- | --- | --- | --- |
- | [kstuff](https://github.com/EchoStretch/kstuff-lite) | kstuff-lite 1.11 | Required: without it every title fails with CE-100008-9. |
- | [ShadowMountPlus](https://github.com/drakmor/ShadowMountPlus) | v1.7-beta5fix1 (v1.7beta2 also works) | Registers folder titles under `/data/homebrew`. |
- | [elfldr](https://github.com/ps5-payload-dev/elfldr) | v0.26 | ELF loader on port 9021; runs the root helper. |
- | [zftpd](https://github.com/seregonwar/zftpd) | 1.6.0 | FTP on port 2120; the console tools use it. |
- | [ps5-web-file-manager](https://github.com/owendswang/ps5-web-file-manager) | v1.9 | Port 8888; useful for recovery. |
-- The Mac and the PS5 on the same network. Pass the PS5's address to the console tools with `--host <PS5 IP>`.
+Match the style of the code around your change. Product behaviour belongs in this repository; reusable UI fixes
+belong in ps5-homebrew-ui.
-If zftpd does not start after a reboot, delete the stale `/data/zftpd/instance.pid` and start it again.
-
-### Install or update the launcher
-
-The first time, copy `build/homebrew-ps5/dist/FAKE77031` to `/data/homebrew/FAKE77031` on the console.
-ShadowMountPlus registers it in about 10 seconds. After that, update only the changed files:
-
-```sh
-python3 tools/console_title_deploy.py --host <PS5 IP> deploy build/homebrew-ps5/dist/FAKE77031 \
- --backup build/console-backups/<name>
-```
-
-The tool backs up each console file it replaces. `restore` puts a backup back. It never touches game downloads,
-logs or user data.
-
-### The runtime kit
-
-Games run with a runtime kit: the Wine runtime, a prepared bottle template and the per-game title files. The
-launcher accepts only the kit whose manifest is pinned in `dependencies.lock.json` and `src/runtime/kit_trust.cpp`.
-
-Most people install the kit from a release download. To install a kit on the console:
-
-```sh
-python3 tools/console_kit_upload.py <kit folder> --host <PS5 IP> --replace
-```
+## Describe the problem and what you tested
-The upload verifies every file by read-back before it switches to the new kit.
+Fill in the [pull request template](.github/PULL_REQUEST_TEMPLATE.md). The description answers, in this order:
-### Build the kit
+1. **What was wrong**, from a player's point of view. "Games installed on a USB drive lose their saves after an
+ update" is a problem. "Refactor the cloud mapping" is not.
+2. **Why it happened**, briefly, if you know.
+3. **What changed** in behaviour. Not a list of functions edited.
+4. **How you tested it**, on a console: firmware, kit, the game and its App ID, what you did and what happened.
+ Attach logs for launch or runtime changes. Host tests and a PS5 build are necessary but are not console testing.
+ If you could not test something on a console, say so.
-The kit builds on a **Linux x86-64 machine or VM**: Wine, Mesa and the PS5 libraries do not build on macOS. The
-maintainer uses an Ubuntu VM and packages and uploads the kit from the Mac.
+Describe only what is in the pull request. Link the issue it addresses; if there is none, the first paragraph is
+the issue.
-The build is prospero-win's tools, run in this order:
+## Commits
-1. `tools/build_host_wine.sh`: Wine for the host (PE modules, winebuild) with the patch series.
-2. `tools/build_wine_ps5.sh`: Wine's Unix side for the PS5, linked to RADV from
- [PS5_Vulkan](https://github.com/mpereiraesaa/PS5_Vulkan) / [PS5_Mesa](https://github.com/mpereiraesaa/PS5_Mesa).
-3. `tools/build_tls_ps5.sh`: schannel through GnuTLS.
-4. `tools/build_wowprospero.sh` and `tools/build_wow64native.sh`: 32-bit support.
-5. `tools/build_mesa_zink.sh`: Mesa WGL/Zink for OpenGL games.
-6. `tools/build_native.sh` (on the Mac): the per-game title shell, with the Lapy root helper.
-7. `tools/package_playden_kit.py`: package and validate the kit.
+- Subject under 60 characters. In the body, `-` bullets that describe the visible behaviour, not the diff.
+- A commit that resolves an issue says `Fixes #N` in its body; partial work says `Refs #N`.
+- Each commit builds and passes the tests on its own, and the commits tell the story of the change. Fixup and
+ "address review" commits are fine during review; they are squashed before merging.
-[`tools/kit-h/`](tools/kit-h/README.md) has the scripts that built kit H and its revisions up to r6, the kit this release uses. They are a record, not a turnkey build:
-they reuse inputs from earlier kits that are not in this repository (a template bottle prepared from Half-Life 2, an
-earlier kit's runtime file list) and carry the maintainer's local paths. A build from a clean machine is not
-documented end to end yet.
+## Using AI tools
-### Logs
+**You are welcome to use AI coding tools.** Most of Playden was written with them. Two things to keep in mind:
-Playden writes its logs to `/data/playden/logs/` (`runtime.log`, `launch.log`, `cloud.log` and others). The first
-startup lines (`native-startup.log`), written before the root grant, stay in the app's own `logs/` folder. User data
-is in `/data/playden/user/` and games are in `/data/playden-games/`.
-Game bottles are private to their titles. When Playden starts, it copies the newest game session report to
-`logs/title-<TITLE>.log`.
+1. **Say so.** The pull request template asks which tool and model you used and roughly how much of the change it
+ wrote. This is not a judgement; it tells the maintainer where to look harder.
+2. **You are the author.** You must be able to explain why each change is there, and you must have run the result
+ on a PS5.
-## Dependencies
+AI tools are especially prone to the problems this page is about. They bundle unrelated features into one change,
+bump versions and pins, fix nearby things nobody asked about, and write long, confident descriptions of changes
+that were never verified, or that are not in the diff at all. Before you open the pull request, check that it does
+one thing and that every sentence in the description is true.
-| Location | What | How it is pinned |
-| --- | --- | --- |
-| `third_party/<fork>` | Patched projects: `prospero-win`, `ps5-homebrew-ui`, `ps5-opengl`, `prospero-foundation`, `PS5-Lapy-JB-Daemon` | Submodule commit on the fork's `main` branch |
-| `third_party/ps5-native-app-boilerplate` | Native title tooling | Submodule commit (upstream) |
-| `third_party/{stb,sqlite3,zstd,lzma-sdk,…}` | Small vendored sources | File hashes in `dependencies.lock.json` |
-| `deps/` | Prebuilt SDKs and builtins | Download hashes in `dependencies.lock.json` |
+Coding agents read [CLAUDE.md](CLAUDE.md) (also `AGENTS.md`), which repeats these rules for them.
-To see our commits in a fork, run `git log --oneline upstream/main..main` in its submodule (after
-`git remote add upstream <upstream URL>` and a fetch).
-
-### Change a forked dependency
-
-1. Work in the submodule on its `main` branch:
-
- ```sh
- cd third_party/prospero-win
- git switch main
- # edit, test, commit
- ```
-
-2. Update the pin in Playden and anything that records the revision (`dependencies.lock.json`, and for
- ps5-homebrew-ui the revision in `scripts/build-homebrew.sh` and `cmake/HomebrewUI.cmake`). Commit the submodule
- change with it.
-3. Push the fork branch before you push Playden, so the pin is fetchable. For prospero-win, the fork is
- [leolobato/prospero-win](https://github.com/leolobato/prospero-win).
-4. Send the change upstream when it is useful there. When upstream merges it, rebase the fork's `main` onto
- upstream and drop the commit from our branch.
-
-Commits on a fork's `main` are temporary patches that wait for upstream. Larger work can sit on its own
-fork branch based on the fork's `main` (for example `feat/74-media-backend`) until it is ready to merge there.
-
-To send a change upstream, branch from `upstream/main` and replay only that change. Leave out fork-only commits
-and anything that names Playden: our console paths (`/data/playden-*`), profile `[environment]` support, kit
-pins and links to our issues or notes. Follow upstream's `CONTRIBUTING.md` and pull request template, and run its
-CI checks (`make all`, `make sanitize`) on Linux.
-
-To take a new upstream version, merge or rebase upstream into the fork's `main`, test, and move the pin.
-
-### Patch a downloaded dependency
-
-The downloads in `deps/` are used unmodified. If one needs a patch, turn it into a fork: add its source as a
-submodule on a `main` branch, add a build step that writes the result into `deps/`, and pin the result
-in `dependencies.lock.json`. You can attach the built result to the fork as a release, so others download it
-instead of building it.
-
-### Change Wine
-
-Wine is not forked. prospero-win pins an upstream Wine commit and applies the patch series in
-`wine/patches/` on top of it. Our Wine changes are patch files in that series, on our prospero-win fork.
-
-To write or change a Wine patch:
-
-1. Make a scratch Wine branch: check out the pinned Wine commit and apply the series as commits.
-2. Make your change there with normal git tools.
-3. Export it with `git format-patch` into prospero-win's `wine/patches/`, with the next free number.
-4. Check the series: `tools/build_wine_ps5.sh --check-patches` in prospero-win.
-5. Commit only the patch file on the fork's `main`.
-
-When prospero-win moves to a newer Wine, merge it into our branch and refresh only our patch files if they no
-longer apply. Rebuilding the runtime and the kit follows prospero-win's `docs/WINE_PS5_BUILD.md` (Linux host).
-
-## Code and commits
-
-- Match the style of the code around your change. Keep product behaviour in this repository and reusable UI fixes
- in ps5-homebrew-ui.
-- Add or update tests with each change. Run the host tests before you send a change.
-- A build or upload is not console acceptance. Say what you ran on a console, and keep the logs.
-- Commit subjects under 60 characters. In the body, use `-` bullets that describe the visible behaviour.
-
-## Publish a release
-
-Playden updates itself from the latest GitHub release (`releases/latest`, which leaves out drafts and
-pre-releases). Players who enable Beta updates use the releases list, including betas. Every release needs its update manifest:
-
-1. Raise the version in `CMakeLists.txt` (`project(PlaydenLauncher VERSION …)`) and build the PS5 package. The
- version becomes `param.json`'s `contentVersion` and the version Playden compares.
-2. Make the two zips as before: `playden-ps5-<version>.zip` (with the `FAKE77031` folder inside
- `playden-ps5-<version>/`) and `playden-kit-<kit version>.zip` (with the kit folder, named after its `kit_id`,
- inside `playden-kit-<kit version>/`, for example `playden-kit-0.13/playden-kit/`).
-3. Write the manifest:
-
- ```sh
- python3 tools/write_update_manifest.py --app-zip playden-ps5-<version>.zip \
- --kit-zip playden-kit-<kit version>.zip --kit-revision <kit version> --min-from <oldest version> \
- --notes "A short summary of the release." --out playden-update.json
- ```
+## Review
- `--notes` is the summary the update dialog shows: plain text (no Markdown) of at most 400 characters, such as the
- first line of the release notes. The dialog links to the release page, as a QR code, for the full notes. The tool
- refuses a kit that `dependencies.lock.json` does not pin. `--min-from` is the oldest version that can update
- to this one; older versions are told to install by hand.
-4. Attach `playden-update.json` and both zips to the release, then publish it. GitHub records each file's SHA-256,
- and Playden checks the downloads against it. If the kit did not change, the kit zip may be left out: consoles
- that already have that kit download only the app, and the others take the zip from an older release that has it.
- Playden 0.7.0 and older look only in the new release, so keep the zip while a version that old can update to it
- without having the kit (or raise `--min-from`).
-
-For a beta, keep the numeric version in `project()` (for example `0.7.1`) and configure with
-`-DPLAYDEN_PRERELEASE=beta.1`. The package writes `playden-version` as `0.7.1-beta.1`; About, the updater and log
-bundles use it. PS5's `param.json` cannot represent a pre-release: `contentVersion` stays `00.007.001` for all
-0.7.1 betas and the stable release. Set `PLAYDEN_PRERELEASE` back to empty for stable builds. Name the app zip
-`playden-ps5-0.7.1-beta.1.zip`, pass `--tag v0.7.1-beta.1` to the manifest tool to verify it matches the package,
-and **mark the GitHub release as a pre-release; never use `--latest` for a beta**. `--min-from` may name a beta.
-The kit pin and trust rules are the same as for stable releases.
-
-To try an update on a console without publishing, put `release.json` (from `--release-json`, with
-`--allow-other-kit` for a test kit), `playden-update.json` and the zips in `/data/homebrew/FAKE77031/dev/update-local/`.
-Playden then reads the release from there instead of GitHub. Delete the folder afterwards.
-
-## Maintainer notes
-
-The maintainer's status notes, plans and console evidence are kept in a separate repository. Comments in the code
-that name a `results/<run>` folder refer to it.
+Expect a few questions, and possibly a request to split the pull request. Reviews can take a while, because testing
+means sitting in front of a console. A pull request that follows this page gets through much faster, because it can
+be understood and tested in one sitting. Thanks for your patience, and for contributing!
## License
diff --git a/README.md b/README.md
index e58c94a..52760ce 100644
--- a/README.md
+++ b/README.md
@@ -195,7 +195,7 @@ python3 tools/console_kit_upload.py ../playden-kit-<version> --host <PS5 IP> --r
```
The kit is built on a **Linux x86-64 machine or VM** from prospero-win, Wine, Mesa and DXVK. To build it yourself,
-see [Build the kit](CONTRIBUTING.md#build-the-kit). The scripts are a record of how we built it, not a turnkey build
+see [Build the kit](docs/building.md#build-the-kit). The scripts are a record of how we built it, not a turnkey build
yet, so most people should use the release download.
### Saves and game configs over FTP
@@ -400,8 +400,9 @@ I keep a fork of each, with Playden's changes on the fork's `main` branch, and s
## Contributing
-Contributions are welcome. [CONTRIBUTING.md](CONTRIBUTING.md) explains the development setup, the tests, the
-console workflow, and how to change a forked dependency or a Wine patch.
+Contributions are welcome. [CONTRIBUTING.md](CONTRIBUTING.md) explains how to report a game test and the rules for
+pull requests (one change per pull request). [docs/building.md](docs/building.md) covers the development setup, the
+tests, the console workflow, and how to change a forked dependency or a Wine patch.
## License
diff --git a/docs/building.md b/docs/building.md
new file mode 100644
index 0000000..cb05ffc
--- /dev/null
+++ b/docs/building.md
@@ -0,0 +1,217 @@
+# Building and running Playden
+
+How to build Playden, run its tests, put it on a console, and change one of its dependencies. For the rules on
+pull requests, see [CONTRIBUTING.md](../CONTRIBUTING.md).
+
+- [Requirements](#requirements)
+- [Get the source](#get-the-source)
+- [Build and test on macOS](#build-and-test-on-macos)
+- [Build the PS5 package](#build-the-ps5-package)
+- [Run on a console](#run-on-a-console)
+- [Build the kit](#build-the-kit)
+- [Dependencies](#dependencies)
+
+## Requirements
+
+- macOS on Apple Silicon (the only host the build supports today).
+- Xcode command line tools.
+- Homebrew packages: `brew install cmake ninja pkgconf sdl2-compat llvm@18 python`.
+ LLVM 18 builds the PS5 code. Apple clang builds the macOS host.
+- About 2 GB of free space for `deps/` and `build/`.
+- A checkout path without symbolic links. Playden refuses symlinked paths when it reads its data, so two tests fail
+ in a link such as macOS `/tmp` (use `/private/tmp` or a folder in your home directory).
+- For console work: a jailbroken PS5, preferably on firmware 13.60, the version we test on (see
+ [Run on a console](#run-on-a-console)).
+
+## Get the source
+
+```sh
+git clone --recursive https://github.com/leolobato/playden-ps5.git
+cd playden-ps5
+scripts/fetch-deps.sh
+```
+
+`--recursive` checks out the submodules in `third_party/`. Most of them are forks that carry our patches on a
+`main` branch (see [Dependencies](#dependencies)).
+
+`scripts/fetch-deps.sh` downloads the prebuilt PS5 toolchain pieces into `deps/`: two PS5 payload SDK releases, the
+ps5-opengl SDK and the LLVM compiler-rt builtins. It checks every download against the SHA-256 in
+`dependencies.lock.json`. You can run it again at any time; it skips what is already correct.
+
+## Build and test on macOS
+
+```sh
+scripts/build-homebrew.sh
+cmake --build --preset homebrew-host
+ctest --preset homebrew-host --output-on-failure
+build/homebrew-host/playden-homebrew
+```
+
+The first run also builds curl and Mbed TLS from pinned source archives. The host app signs in to Steam like the
+console app does and stores its data under `build/homebrew-host/playden-data`.
+
+You do not need a console or a Steam account for the tests. To see the screens with synthetic data, use the
+simulation mode:
+
+```sh
+build/homebrew-host/playden-homebrew --simulation --scenario signed-out
+```
+
+Each test is its own executable. To run one, pass its name: `ctest --preset homebrew-host -R '^runtime_launch_service$'`.
+A new `tests/<name>_test.cpp` is registered with `add_test` in the matching `cmake/*.cmake`.
+
+## Build the PS5 package
+
+```sh
+scripts/build-lapy-helper.sh
+scripts/build-homebrew-ps5.sh
+```
+
+The first script builds the root helper that gives the title access to `/data`. The second builds the launcher
+title `FAKE77031` into `build/homebrew-ps5/dist/FAKE77031`, with the two small payloads it sends to the payload
+loader (the title remover and the self-update's relaunch payload). Neither script contacts a console.
+
+The build checks the pinned revisions and hashes. If it stops with a mismatch, do not edit the hash: find out why
+the input changed. The PS5 build is reproducible, so the same sources give the same `eboot.bin` in any checkout.
+
+`FAKE77031` is allocated to Playden. Do not use it for another application.
+
+## Run on a console
+
+You need:
+
+- A jailbroken PS5 (for example with the WebKit autoloader). We test on firmware 13.60; other versions are untested.
+- These payloads loaded after each boot. The versions are the ones we test with:
+
+ | Payload | Version | What it is for |
+ | --- | --- | --- |
+ | [kstuff](https://github.com/EchoStretch/kstuff-lite) | kstuff-lite 1.11 | Required: without it every title fails with CE-100008-9. |
+ | [ShadowMountPlus](https://github.com/drakmor/ShadowMountPlus) | v1.7-beta5fix1 (v1.7beta2 also works) | Registers folder titles under `/data/homebrew`. |
+ | [elfldr](https://github.com/ps5-payload-dev/elfldr) | v0.26 | ELF loader on port 9021; runs the root helper. |
+ | [zftpd](https://github.com/seregonwar/zftpd) | 1.6.0 | FTP on port 2120; the console tools use it. |
+ | [ps5-web-file-manager](https://github.com/owendswang/ps5-web-file-manager) | v1.9 | Port 8888; useful for recovery. |
+- The Mac and the PS5 on the same network. Pass the PS5's address to the console tools with `--host <PS5 IP>`.
+
+If zftpd does not start after a reboot, delete the stale `/data/zftpd/instance.pid` and start it again.
+
+### Install or update the launcher
+
+The first time, copy `build/homebrew-ps5/dist/FAKE77031` to `/data/homebrew/FAKE77031` on the console.
+ShadowMountPlus registers it in about 10 seconds. After that, update only the changed files:
+
+```sh
+python3 tools/console_title_deploy.py --host <PS5 IP> deploy build/homebrew-ps5/dist/FAKE77031 \
+ --backup build/console-backups/<name>
+```
+
+The tool backs up each console file it replaces. `restore` puts a backup back. It never touches game downloads,
+logs or user data.
+
+### Install the runtime kit
+
+Games run with a runtime kit: the Wine runtime, a prepared bottle template and the per-game title files. The
+launcher accepts only the kit whose manifest is pinned in `dependencies.lock.json` and `src/runtime/kit_trust.h`.
+
+Most people install the kit from a release download. To install a kit on the console:
+
+```sh
+python3 tools/console_kit_upload.py <kit folder> --host <PS5 IP> --replace
+```
+
+The upload verifies every file by read-back before it switches to the new kit.
+
+### Logs
+
+Playden writes its logs to `/data/playden/logs/` (`runtime.log`, `launch.log`, `cloud.log` and others). The first
+startup lines (`native-startup.log`), written before the root grant, stay in the app's own `logs/` folder. User data
+is in `/data/playden/user/` and games are in `/data/playden-games/`.
+
+Game bottles are private to their titles. When Playden starts, it copies the newest game session report to
+`logs/title-<TITLE>.log`. `python3 tools/collect_logs.py --host <PS5 IP>` collects them into a zip.
+
+## Build the kit
+
+The kit builds on a **Linux x86-64 machine or VM**: Wine, Mesa and the PS5 libraries do not build on macOS. The
+maintainer uses an Ubuntu VM and packages and uploads the kit from the Mac.
+
+The build is prospero-win's tools, run in this order:
+
+1. `tools/build_host_wine.sh`: Wine for the host (PE modules, winebuild) with the patch series.
+2. `tools/build_wine_ps5.sh`: Wine's Unix side for the PS5, linked to RADV from
+ [PS5_Vulkan](https://github.com/mpereiraesaa/PS5_Vulkan) / [PS5_Mesa](https://github.com/mpereiraesaa/PS5_Mesa).
+3. `tools/build_tls_ps5.sh`: schannel through GnuTLS.
+4. `tools/build_wowprospero.sh` and `tools/build_wow64native.sh`: 32-bit support.
+5. `tools/build_mesa_zink.sh`: Mesa WGL/Zink for OpenGL games.
+6. `tools/build_native.sh` (on the Mac): the per-game title shell, with the Lapy root helper.
+7. `tools/package_playden_kit.py`: package and validate the kit.
+
+[`tools/kit-h/`](../tools/kit-h/README.md) has the scripts that built kit H and its revisions. They are a record, not
+a turnkey build: they reuse inputs from earlier kits that are not in this repository (a template bottle prepared
+from Half-Life 2, an earlier kit's runtime file list) and carry the maintainer's local paths. A build from a clean machine is not
+documented end to end yet.
+
+## Dependencies
+
+| Location | What | How it is pinned |
+| --- | --- | --- |
+| `third_party/<fork>` | Patched projects: `prospero-win`, `ps5-homebrew-ui`, `ps5-opengl`, `prospero-foundation`, `PS5-Lapy-JB-Daemon` | Submodule commit on the fork's `main` branch |
+| `third_party/ps5-native-app-boilerplate` | Native title tooling | Submodule commit (upstream) |
+| `third_party/{stb,sqlite3,zstd,lzma-sdk,…}` | Small vendored sources | File hashes in `dependencies.lock.json` |
+| `deps/` | Prebuilt SDKs and builtins | Download hashes in `dependencies.lock.json` |
+
+To see our commits in a fork, run `git log --oneline upstream/main..main` in its submodule (after
+`git remote add upstream <upstream URL>` and a fetch).
+
+### Change a forked dependency
+
+1. Work in the submodule on its `main` branch:
+
+ ```sh
+ cd third_party/prospero-win
+ git switch main
+ # edit, test, commit
+ ```
+
+2. Open a pull request on the fork (for prospero-win, [leolobato/prospero-win](https://github.com/leolobato/prospero-win)).
+ Playden can only pin a commit that is on the fork's `main`.
+3. Once it is merged, move the pin in Playden together with everything that records the revision:
+ `dependencies.lock.json`, and for ps5-homebrew-ui the revision in `scripts/build-homebrew.sh` and
+ `cmake/HomebrewUI.cmake`.
+4. Send the change upstream when it is useful there. When upstream merges it, the fork's `main` is rebased onto
+ upstream and the commit drops out.
+
+Commits on a fork's `main` are temporary patches that wait for upstream. Larger work can sit on its own
+fork branch based on the fork's `main` (for example `feat/74-media-backend`) until it is ready to merge there.
+
+To send a change upstream, branch from `upstream/main` and replay only that change. Leave out fork-only commits
+and anything that names Playden: our console paths (`/data/playden-*`), profile `[environment]` support, kit
+pins and links to our issues or notes. Follow upstream's `CONTRIBUTING.md` and pull request template, and run its
+CI checks (`make all`, `make sanitize`) on Linux.
+
+To take a new upstream version, merge or rebase upstream into the fork's `main`, test, and move the pin.
+
+### Patch a downloaded dependency
+
+The downloads in `deps/` are used unmodified. If one needs a patch, turn it into a fork: add its source as a
+submodule on a `main` branch, add a build step that writes the result into `deps/`, and pin the result
+in `dependencies.lock.json`. You can attach the built result to the fork as a release, so others download it
+instead of building it.
+
+### Change Wine
+
+Wine is not forked. prospero-win pins an upstream Wine commit and applies the patch series in
+`wine/patches/` on top of it. Our Wine changes are patch files in that series, on our prospero-win fork.
+
+To write or change a Wine patch:
+
+1. Make a scratch Wine branch: check out the pinned Wine commit and apply the series as commits.
+2. Make your change there with normal git tools.
+3. Export it with `git format-patch` into prospero-win's `wine/patches/`, with the next free number.
+4. Check the series: `tools/build_wine_ps5.sh --check-patches` in prospero-win.
+5. Commit only the patch file on the fork's `main`.
+
+A Wine patch reaches players only in a new kit, and kits are built and released with Playden releases (see
+[CONTRIBUTING.md › Files that stay out of pull requests](../CONTRIBUTING.md#files-that-stay-out-of-pull-requests)).
+
+When prospero-win moves to a newer Wine, merge it into our branch and refresh only our patch files if they no
+longer apply. Rebuilding the runtime and the kit follows prospero-win's `docs/WINE_PS5_BUILD.md` (Linux host).
diff --git a/docs/releasing.md b/docs/releasing.md
new file mode 100644
index 0000000..b20f638
--- /dev/null
+++ b/docs/releasing.md
@@ -0,0 +1,52 @@
+# Publishing a release
+
+Maintainer steps. Contributors do not need this page.
+
+Playden updates itself from the latest GitHub release (`releases/latest`, which leaves out drafts and
+pre-releases). Players who enable Beta updates use the releases list, including betas. Every release needs its
+update manifest:
+
+1. Raise the version in `CMakeLists.txt` (`project(PlaydenLauncher VERSION …)`) and build the PS5 package. The
+ version becomes `param.json`'s `contentVersion` and the version Playden compares.
+2. Make the two zips: `playden-ps5-<version>.zip` (with the `FAKE77031` folder inside `playden-ps5-<version>/`) and
+ `playden-kit-<kit version>.zip` (with the kit folder, named after its `kit_id`, inside
+ `playden-kit-<kit version>/`, for example `playden-kit-0.13/playden-kit/`).
+3. Write the manifest:
+
+ ```sh
+ python3 tools/write_update_manifest.py --app-zip playden-ps5-<version>.zip \
+ --kit-zip playden-kit-<kit version>.zip --kit-revision <kit version> --min-from <oldest version> \
+ --notes "A short summary of the release." --out playden-update.json
+ ```
+
+ `--notes` is the summary the update dialog shows: plain text (no Markdown) of at most 400 characters, such as the
+ first line of the release notes. The dialog links to the release page, as a QR code, for the full notes. The tool
+ refuses a kit that `dependencies.lock.json` does not pin. `--min-from` is the oldest version that can update
+ to this one; older versions are told to install by hand.
+4. Attach `playden-update.json` and both zips to the release, then publish it. GitHub records each file's SHA-256,
+ and Playden checks the downloads against it. If the kit did not change, the kit zip may be left out: consoles
+ that already have that kit download only the app, and the others take the zip from an older release that has it.
+ Playden 0.7.0 and older look only in the new release, so keep the zip while a version that old can update to it
+ without having the kit (or raise `--min-from`).
+
+## Betas
+
+Keep the numeric version in `project()` (for example `0.7.1`) and configure with `-DPLAYDEN_PRERELEASE=beta.1`. The
+package writes `playden-version` as `0.7.1-beta.1`; About, the updater and log bundles use it. PS5's `param.json`
+cannot represent a pre-release: `contentVersion` stays `00.007.001` for all 0.7.1 betas and the stable release. Set
+`PLAYDEN_PRERELEASE` back to empty for stable builds.
+
+Name the app zip `playden-ps5-0.7.1-beta.1.zip`, pass `--tag v0.7.1-beta.1` to the manifest tool to verify it matches
+the package, and **mark the GitHub release as a pre-release; never use `--latest` for a beta**. `--min-from` may name
+a beta. The kit pin and trust rules are the same as for stable releases.
+
+## Try an update without publishing
+
+Put `release.json` (from `--release-json`, with `--allow-other-kit` for a test kit), `playden-update.json` and the
+zips in `/data/homebrew/FAKE77031/dev/update-local/`. Playden then reads the release from there instead of GitHub.
+Delete the folder afterwards.
+
+## Maintainer notes
+
+The maintainer's status notes, plans and console evidence are kept in a separate repository. Comments in the code
+that name a `results/<run>` folder refer to it.