Skip to content

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

C++

Put the app folder at the top of the release zip

Leonardo Lobatoefefee1bd4f2
diff --git a/README.md b/README.md
index d8b06c4..5083f70 100644
--- a/README.md
+++ b/README.md
@@ -113,7 +113,8 @@ Other versions can work, but these are the ones we know.
## Install
Download `playden-ps5-<version>.zip` from the latest [release](../../releases): the Playden app (`FAKE77031`) and
-the console tools used below. Unzip it. Installing takes one copy over the network, the app folder. Playden
+the console tools used below. Unzip it into a folder of its own, `playden-ps5-<version>` (most unzip tools make it;
+with `unzip` on the command line, use `unzip playden-ps5-<version>.zip -d playden-ps5-<version>`). Installing takes one copy over the network, the app folder. Playden
downloads its runtime kit on its first start, and after that it updates itself (see [Update Playden](#update-playden)).
Like other PS5 homebrew, Playden is a folder in `/data/homebrew/`, and
diff --git a/cmake/HomebrewPS5.cmake b/cmake/HomebrewPS5.cmake
index af64c56..c977a41 100644
--- a/cmake/HomebrewPS5.cmake
+++ b/cmake/HomebrewPS5.cmake
@@ -287,6 +287,9 @@ function(playden_add_homebrew_ps5_title)
${native_helper_package_commands}
COMMAND "${CMAKE_COMMAND}" -E make_directory "${app}/trust"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${PLAYDEN_STEAM_CA_BUNDLE}" "${app}/trust/cacert.pem"
+ # The app folder is the whole download (ProsperoStore, self-update), so the licenses travel inside it.
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_SOURCE_DIR}/LICENSE"
+ "${CMAKE_SOURCE_DIR}/THIRD_PARTY_NOTICES.md" "${app}/"
COMMAND "${host_tool}" self --sign --in "${out}/eboot.elf" --out "${app}/eboot.bin" --magic 0x1D3D154F
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${libc_prx}" "${app}/sce_module/libc.prx"
COMMAND "${CMAKE_COMMAND}" -DAPP_DIR=${app} -DTITLE_ID=${PLAYDEN_PS5_TITLE_ID}
@@ -296,7 +299,8 @@ function(playden_add_homebrew_ps5_title)
"${CMAKE_SOURCE_DIR}/cmake/WriteNativePackageIdentity.cmake"
"${CMAKE_SOURCE_DIR}/sce_sys/icon0.png" "${CMAKE_SOURCE_DIR}/assets/branding/generic-title-icon.png"
"${CMAKE_SOURCE_DIR}/sce_sys/pic0.dds" "${CMAKE_SOURCE_DIR}/sce_sys/pic1.dds"
- "${PLAYDEN_STEAM_CA_BUNDLE}" ${package_inputs}
+ "${PLAYDEN_STEAM_CA_BUNDLE}" "${CMAKE_SOURCE_DIR}/LICENSE" "${CMAKE_SOURCE_DIR}/THIRD_PARTY_NOTICES.md"
+ ${package_inputs}
VERBATIM)
add_custom_target(playden-homebrew-ps5-package ALL DEPENDS "${stamp}")
endfunction()
diff --git a/docs/releasing.md b/docs/releasing.md
index b20f638..d6a7aa5 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -8,9 +8,16 @@ 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/`).
+2. Make the zips:
+ - `playden-ps5-<version>.zip`: the `FAKE77031` folder at the top of the archive, with `tools/` (the console
+ tools), `README.md`, `COMPATIBILITY.md`, `LICENSE` and `THIRD_PARTY_NOTICES.md` next to it. The ProsperoStore
+ catalog needs the app folder at the top (see its
+ [artifact formats](https://github.com/darkxex/ps5-homebrew-catalog/blob/main/docs/artifact-formats.md)) and
+ ignores the rest; a store install copies only the app folder, so the package build puts `LICENSE` and
+ `THIRD_PARTY_NOTICES.md` inside it too. Playden 0.6.0 and newer unpack the folder the manifest's `prefix` names,
+ so they update from this layout as well. Releases up to 0.7.1 had everything inside `playden-ps5-<version>/`.
+ - `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
@@ -23,7 +30,8 @@ update manifest:
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,
+4. Attach `playden-update.json` and the zips to the release, then publish it. Never replace an asset of a
+ published release: the ProsperoStore catalog pins it by its SHA-256. 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
diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cpp
index 88306a5..db40549 100644
--- a/tests/homebrew_live_model_test.cpp
+++ b/tests/homebrew_live_model_test.cpp
@@ -1122,11 +1122,11 @@ void live_root_access_missing() {
{"stable launcher source is invalid: assets root is unavailable", true, "Playden's app folder is incomplete",
"Copy the whole app folder"},
{"stable launcher source identity does not match", true, "Playden can't start", "restart the PS5"},
- {"launcher is not installed in /data/homebrew/PPSA97031; helper stage=done status=0 error=0", true,
- "Install Playden on console storage", "Playden runs only from /data/homebrew/PPSA97031, on the console's"},
- {"launcher is not installed in /data/homebrew/PPSA97031", false, "Install Playden on console storage",
+ {"launcher is not installed in /data/homebrew/FAKE77031; helper stage=done status=0 error=0", true,
+ "Install Playden on console storage", "Playden runs only from /data/homebrew/FAKE77031, on the console's"},
+ {"launcher is not installed in /data/homebrew/FAKE77031", false, "Install Playden on console storage",
"set Settings > Install location to /data/homebrew, hold Uninstall"},
- {"launcher is not installed in /data/homebrew/PPSA97031", false, "Install Playden on console storage",
+ {"launcher is not installed in /data/homebrew/FAKE77031", false, "Install Playden on console storage",
"move the app folder to /data/homebrew."},
};
for (const auto& item : cases) {
diff --git a/tests/self_update_release_test.cpp b/tests/self_update_release_test.cpp
index d2c8f49..c268dbb 100644
--- a/tests/self_update_release_test.cpp
+++ b/tests/self_update_release_test.cpp
@@ -9,7 +9,7 @@ static const std::string kSha(64, 'a');
static std::string Manifest(const std::string& app_override = {}, const std::string& kit_override = {}) {
const std::string app = app_override.empty()
- ? R"({"version":"0.3.0","title_id":"FAKE77031","min_from":"0.2.0","asset":"playden-ps5-0.3.0.zip","prefix":"playden-ps5-0.3.0/FAKE77031/"})"
+ ? R"({"version":"0.3.0","title_id":"FAKE77031","min_from":"0.2.0","asset":"playden-ps5-0.3.0.zip","prefix":"FAKE77031/"})"
: app_override;
const std::string kit = kit_override.empty()
? R"({"kit_id":"playden-kit","revision":"0.13","manifest_sha256":")" + kSha +
@@ -46,7 +46,7 @@ int main() {
CHECK(manifest);
CHECK(manifest->app_version == (Version{0, 3, 0}) && manifest->min_from == (Version{0, 2, 0}));
CHECK(manifest->title_id == "FAKE77031" && manifest->app_asset == "playden-ps5-0.3.0.zip");
- CHECK(manifest->app_prefix == "playden-ps5-0.3.0/FAKE77031/");
+ CHECK(manifest->app_prefix == "FAKE77031/");
CHECK(manifest->kit.kit_id == "playden-kit" && manifest->kit.revision == "0.13" && manifest->kit.manifest_sha256 == kSha);
CHECK(manifest->kit.prefix == "playden-kit-0.13/playden-kit/" && manifest->notes == "Faster downloads.");
diff --git a/tests/self_update_service_test.cpp b/tests/self_update_service_test.cpp
index 13fd569..9531904 100644
--- a/tests/self_update_service_test.cpp
+++ b/tests/self_update_service_test.cpp
@@ -87,14 +87,16 @@ struct Server {
};
std::string AppZip(const std::string& version_text, const std::string& content_version, const std::string& full_version = "") {
- const std::string top = "playden-ps5-" + version_text + "/";
- return zip_fixture::Build({{top + "tools/console_title_deploy.py", "py"},
- {top + "FAKE77031/eboot.bin", "eboot " + version_text},
- {top + "FAKE77031/playden-version", full_version.empty() ? version_text + "\n" : full_version},
- {top + "FAKE77031/sce_sys/param.json",
+ // The app folder at the top, as ProsperoStore installs it, with the tools next to it (0.7.1 and older zips had
+ // both one folder down).
+ return zip_fixture::Build({{"tools/console_title_deploy.py", "py"},
+ {"FAKE77031/LICENSE", "license"},
+ {"FAKE77031/eboot.bin", "eboot " + version_text},
+ {"FAKE77031/playden-version", full_version.empty() ? version_text + "\n" : full_version},
+ {"FAKE77031/sce_sys/param.json",
R"({"titleId":"FAKE77031","contentVersion":")" + content_version + R"("})"},
- {top + "FAKE77031/assets/a.txt", "asset " + version_text},
- {top + "FAKE77031/logs/", "", 040755}});
+ {"FAKE77031/assets/a.txt", "asset " + version_text},
+ {"FAKE77031/logs/", "", 040755}});
}
std::string KitZip() {
@@ -111,8 +113,7 @@ void Publish(Server& server, const std::string& tag, const std::string& min_from
const std::string kit = KitZip();
const std::string manifest =
R"({"format":1,"app":{"version":")" + version_text + R"(","title_id":"FAKE77031","min_from":")" + min_from +
- R"(","asset":"playden-ps5-)" + version_text + R"(.zip","prefix":"playden-ps5-)" + version_text +
- R"(/FAKE77031/"},"kit":{"kit_id":"kitid","revision":")" + kit_revision + R"(","manifest_sha256":")" + kKitSha +
+ R"(","asset":"playden-ps5-)" + version_text + R"(.zip","prefix":"FAKE77031/"},"kit":{"kit_id":"kitid","revision":")" + kit_revision + R"(","manifest_sha256":")" + kKitSha +
R"(","asset":"playden-kit-h-r9.zip","prefix":"playden-kit-h-r9/kitid/"},"notes":"New things."})";
server.files[kDownload + "playden-update.json"] = manifest;
server.files[kDownload + "playden-ps5-" + version_text + ".zip"] = app;
diff --git a/tests/write_update_manifest_test.py b/tests/write_update_manifest_test.py
index 697f6fe..4eb03d7 100644
--- a/tests/write_update_manifest_test.py
+++ b/tests/write_update_manifest_test.py
@@ -27,10 +27,12 @@ def main():
manifest = json.dumps({"kit_id": "playden-kit", "files": []}).encode()
sha = hashlib.sha256(manifest).hexdigest()
(root / "lock.json").write_text(json.dumps({"prospero_kit": {"kit_id": "playden-kit", "manifest_sha256": sha}}))
- app = root / "playden-ps5-0.3.0.zip"
+ app = root / "FAKE77031.zip"
with zipfile.ZipFile(app, "w") as archive:
- archive.writestr("playden-ps5-0.3.0/tools/x.py", "")
- archive.writestr("playden-ps5-0.3.0/FAKE77031/sce_sys/param.json",
+ archive.writestr("tools/x.py", "")
+ archive.writestr("README.md", "")
+ archive.writestr("FAKE77031/LICENSE", "")
+ archive.writestr("FAKE77031/sce_sys/param.json",
json.dumps({"titleId": "FAKE77031", "contentVersion": "00.003.000"}))
kit = root / "playden-kit-0.13.zip"
with zipfile.ZipFile(kit, "w") as archive:
@@ -44,7 +46,7 @@ def main():
update = json.loads(out.read_text())
check(update == {"format": 1,
"app": {"version": "0.3.0", "title_id": "FAKE77031", "min_from": "0.2.0",
- "asset": "playden-ps5-0.3.0.zip", "prefix": "playden-ps5-0.3.0/FAKE77031/"},
+ "asset": "FAKE77031.zip", "prefix": "FAKE77031/"},
"kit": {"kit_id": "playden-kit", "revision": "0.13", "manifest_sha256": sha,
"asset": "playden-kit-0.13.zip", "prefix": "playden-kit-0.13/playden-kit/"},
"notes": "New things."}, "manifest content")
@@ -57,11 +59,11 @@ def main():
result = run(*common, "--notes", "New things.", "--release-json", str(release))
listing = json.loads(release.read_text())
check(listing["tag_name"] == "v0.3.0" and [a["name"] for a in listing["assets"]] ==
- ["playden-update.json", "playden-ps5-0.3.0.zip", "playden-kit-0.13.zip"], "local release")
+ ["playden-update.json", "FAKE77031.zip", "playden-kit-0.13.zip"], "local release")
check(all(a["digest"].startswith("sha256:") and a["size"] > 0 for a in listing["assets"]), "digests")
# Full beta identity lives alongside the numeric PS5 version.
with zipfile.ZipFile(app, "w") as archive:
- prefix = "playden-ps5-0.3.0/FAKE77031/"
+ prefix = "FAKE77031/"
archive.writestr(prefix + "sce_sys/param.json",
json.dumps({"titleId": "FAKE77031", "contentVersion": "00.007.001"}))
archive.writestr(prefix + "playden-version", "0.7.1-beta.2\n")
@@ -74,6 +76,19 @@ def main():
check(run(*common, "--tag", "v0.7.1").returncode != 0, "tag mismatch refused")
for bad in ("0.7.1-beta.0", "0.7.1-beta.01", "0.7.1-rc.1", "0.7.1+meta", "0.7.1\n"):
check(run(*common, "--min-from", bad).returncode != 0, "invalid version refused: " + repr(bad))
+ # The app folder is at the top (0.7.1 and older zips had it one folder down), alone of its kind, and named
+ # after the title id.
+ for names in (["playden-ps5-0.3.0/FAKE77031/sce_sys/param.json"],
+ ["FAKE77031/sce_sys/param.json", "FAKE00001/sce_sys/param.json"],
+ ["PPSA97031/sce_sys/param.json"]):
+ with zipfile.ZipFile(app, "w") as archive:
+ for name in names:
+ archive.writestr(name, json.dumps({"titleId": "FAKE77031", "contentVersion": "00.003.000"}))
+ check(run(*common).returncode != 0, "app zip layout refused: " + repr(names))
+ with zipfile.ZipFile(app, "w") as archive:
+ archive.writestr("FAKE77031/sce_sys/param.json",
+ json.dumps({"titleId": "FAKE77031", "contentVersion": "00.003.000"}))
+ check(run(*common).returncode == 0, "app zip layout accepted")
# A kit the lock does not pin is refused unless a test allows it.
(root / "lock.json").write_text(json.dumps({"prospero_kit": {"kit_id": "playden-kit", "manifest_sha256": "0" * 64}}))
check(run(*common).returncode != 0, "unpinned kit refused")
diff --git a/tools/write_update_manifest.py b/tools/write_update_manifest.py
index e60b0a0..257890c 100755
--- a/tools/write_update_manifest.py
+++ b/tools/write_update_manifest.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
"""Write playden-update.json, the release asset Playden's self-update reads.
-Run it on the two release zips before publishing a GitHub release, and attach its output to the
+Run it on the app zip (the FAKE77031/ app folder at the top, tools and documents next to it) and the kit zip before publishing a GitHub release, and attach its output to the
release next to them:
- python3 tools/write_update_manifest.py --app-zip playden-ps5-0.3.0.zip \\
+ python3 tools/write_update_manifest.py --app-zip FAKE77031.zip \\
--kit-zip playden-kit-0.10.zip --kit-revision 0.10 --min-from 0.2.0 \\
--notes "Faster downloads and simpler game settings." --out playden-update.json
@@ -35,6 +35,16 @@ def version(text):
return ".".join(str(int(part)) for part in match.groups()[:3]) + (f"-beta.{match[4]}" if match[4] else "")
+def app_prefix(archive):
+ """The "<title id>/" app folder at the top of the app zip, the layout ProsperoStore installs. Tools and
+ documents may sit next to it."""
+ found = sorted({name[: -len("sce_sys/param.json")] for name in archive.namelist()
+ if name.endswith("/sce_sys/param.json") and name.count("/") == 2})
+ if len(found) != 1 or found[0] in ("./", "../"):
+ raise SystemExit(f"{archive.filename}: needs exactly one <title id>/sce_sys/param.json at the top, found {found}")
+ return found[0]
+
+
def inner_prefix(archive, marker):
"""The "<top>/<inner>/" folder holding marker, as Playden's FindInnerPrefix finds it."""
for name in archive.namelist():
@@ -86,11 +96,11 @@ def main(argv=None):
args = parser.parse_args(argv)
with zipfile.ZipFile(args.app_zip) as app:
- app_prefix = inner_prefix(app, "sce_sys/param.json")
- param = json.loads(app.read(app_prefix + "sce_sys/param.json"))
+ prefix = app_prefix(app)
+ param = json.loads(app.read(prefix + "sce_sys/param.json"))
numeric_version = version(param["contentVersion"])
try:
- full_text = app.read(app_prefix + "playden-version").decode("ascii")
+ full_text = app.read(prefix + "playden-version").decode("ascii")
app_version = version(full_text.removesuffix("\n"))
except KeyError:
app_version = numeric_version # Packages predating full version metadata.
@@ -101,6 +111,8 @@ def main(argv=None):
title_id = param["titleId"]
if not re.fullmatch(r"[A-Z]{4}\d{5}", title_id):
raise SystemExit(f"unexpected title id {title_id!r}")
+ if prefix != title_id + "/":
+ raise SystemExit(f"app folder {prefix!r} is not named after the title id {title_id!r}")
with zipfile.ZipFile(args.kit_zip) as kit:
kit_prefix = inner_prefix(kit, "manifest.json")
@@ -121,7 +133,7 @@ def main(argv=None):
update = {
"format": 1,
"app": {"version": app_version, "title_id": title_id, "min_from": version(args.min_from),
- "asset": args.app_zip.name, "prefix": app_prefix},
+ "asset": args.app_zip.name, "prefix": prefix},
"kit": {"kit_id": kit_id, "revision": args.kit_revision, "manifest_sha256": kit_sha,
"asset": args.kit_zip.name, "prefix": kit_prefix},
"notes": notes,