Skip to content

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

C++

Give the app's executables the execute bit

Leonardo Lobato3224884c7e0d
diff --git a/README.md b/README.md
index 90593ad..86028b2 100644
--- a/README.md
+++ b/README.md
@@ -138,12 +138,16 @@ ShadowMountPlus adds its tile to the Home screen.
1. Copy the `FAKE77031` folder from `playden-ps5-<version>` into `/data/homebrew/` on the console. Use any FTP client
(FileZilla, Cyberduck, etc.) or the web file manager in a browser. Create `/data/homebrew` first if it isn't there.
- You do not need to `chmod` anything: Playden checks the folders it writes to and fixes their permissions before
- it writes. If it can't fix one, it names that folder. If your FTP client leaves out the empty `logs` and
+
+ **After an FTP copy, set `eboot.bin` and `sce_module/libc.prx` to `777`.** FTP uploads usually lose the zip's
+ modes, and without the execute bit the PS5 shows CE-107750-0.
+
+ You do not need to `chmod` anything else: Playden checks the folders it writes to and fixes their permissions
+ before it writes. If it can't fix one, it names that folder. If your FTP client leaves out the empty `logs` and
`playden-data` folders, Playden makes them again when it starts.
Or, from a computer with Python 3, run this in the `playden-ps5-<version>` folder. It creates the folders, copies
- only what changed, and keeps a backup of the files it replaces:
+ only what changed, keeps a backup of the files it replaces, and sets the modes itself:
```sh
python3 tools/console_title_deploy.py --host <PS5 IP> deploy --install FAKE77031 --backup backups/<name>
@@ -365,6 +369,8 @@ build/homebrew-host/playden-homebrew --simulation --scenario signed-out
Reload ShadowMountPlus.
Until the game is registered, its Cloud saves are not synced before its first launch.
- If every game hangs on its loading spinner, the ELF loader has stopped. Reload it.
+- If the PS5 shows CE-107750-0 when you press the Playden tile, check that `eboot.bin` has its execute bit (see
+ [Install Playden](#install-playden)). Playden can't repair this, because it never starts.
- If Playden can't start, its first screen says which step failed. The startup error under it is worth quoting
in a report:
- **Playden's app folder is incomplete:** files such as `lapy.elf` or `playden-package.identity` are missing
diff --git a/cmake/HomebrewPS5.cmake b/cmake/HomebrewPS5.cmake
index 527541d..21b9e9c 100644
--- a/cmake/HomebrewPS5.cmake
+++ b/cmake/HomebrewPS5.cmake
@@ -295,10 +295,13 @@ function(playden_add_homebrew_ps5_title)
"${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"
+ # Last, so it sees every file: the signing step and the copies above leave no execute bit.
+ COMMAND "${CMAKE_COMMAND}" -DAPP_DIR=${app} -P "${CMAKE_SOURCE_DIR}/cmake/SetPackageExecutableModes.cmake"
COMMAND "${CMAKE_COMMAND}" -DAPP_DIR=${app} -DTITLE_ID=${PLAYDEN_PS5_TITLE_ID}
-P "${CMAKE_SOURCE_DIR}/cmake/WriteNativePackageIdentity.cmake"
COMMAND "${CMAKE_COMMAND}" -E touch "${stamp}"
DEPENDS "${pie}" "${host_tool}" "${libc_prx}" "${CMAKE_SOURCE_DIR}/cmake/PackagePS5.cmake"
+ "${CMAKE_SOURCE_DIR}/cmake/SetPackageExecutableModes.cmake"
"${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"
diff --git a/cmake/HomebrewUI.cmake b/cmake/HomebrewUI.cmake
index a7b4932..5044885 100644
--- a/cmake/HomebrewUI.cmake
+++ b/cmake/HomebrewUI.cmake
@@ -708,6 +708,7 @@ if(BUILD_TESTING)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_test(NAME native_startup_order COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/test_native_startup_order.py")
+ add_test(NAME native_package_identity COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/test_native_package_identity.py")
add_test(NAME console_kit_upload COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/test_console_kit_upload.py")
add_test(NAME collect_logs COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/tests/test_collect_logs.py")
add_test(NAME ui_comparison_fixture
diff --git a/cmake/SetPackageExecutableModes.cmake b/cmake/SetPackageExecutableModes.cmake
new file mode 100644
index 0000000..039cd7f
--- /dev/null
+++ b/cmake/SetPackageExecutableModes.cmake
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Gives the app folder's executables mode 0755, whatever the build tools left. The names are the
+# same ones tools/console_title_deploy.py and the self-update (src/update/update_service.cpp) treat
+# as executable. The release zip keeps the modes of this folder.
+if(NOT DEFINED APP_DIR OR NOT IS_DIRECTORY "${APP_DIR}")
+ message(FATAL_ERROR "APP_DIR must be the app folder")
+endif()
+if(NOT EXISTS "${APP_DIR}/eboot.bin")
+ message(FATAL_ERROR "A signed eboot.bin is required")
+endif()
+file(GLOB_RECURSE executables LIST_DIRECTORIES false
+ "${APP_DIR}/eboot.bin" "${APP_DIR}/*.prx" "${APP_DIR}/*.elf")
+foreach(executable IN LISTS executables)
+ if(IS_SYMLINK "${executable}")
+ message(FATAL_ERROR "The package must not hold a symlink: ${executable}")
+ endif()
+ file(CHMOD "${executable}" PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+endforeach()
diff --git a/scripts/build-homebrew-ps5.sh b/scripts/build-homebrew-ps5.sh
index 835613a..7d8a157 100755
--- a/scripts/build-homebrew-ps5.sh
+++ b/scripts/build-homebrew-ps5.sh
@@ -45,4 +45,6 @@ bash "$environment" bash -c 'exec "$PS5_PAYLOAD_SDK/bin/prospero-cmake" "$@"' ba
-DPLAYDEN_TITLE_REMOVER_ELF="$title_remover" -DPLAYDEN_RELAUNCH_ELF="$relaunch" \
-DPLAYDEN_PS5_DEPS_DIR="$deps" -DPLAYDEN_HUI_SOURCE_DIR="$hui"
bash "$environment" cmake --build "$root/build/homebrew-ps5" --target playden-homebrew-ps5-package
+bash "$environment" env PLAYDEN_PACKAGE_DIR="$root/build/homebrew-ps5/dist/FAKE77031" \
+ python3 "$root/tests/test_native_package_identity.py"
echo "Selected Hui package (not deployed): $root/build/homebrew-ps5/dist/FAKE77031"
diff --git a/tests/test_native_package_identity.py b/tests/test_native_package_identity.py
index 3a6d96c..3b5c919 100644
--- a/tests/test_native_package_identity.py
+++ b/tests/test_native_package_identity.py
@@ -1,5 +1,7 @@
import hashlib
+import os
import pathlib
+import stat
import subprocess
import tempfile
import unittest
@@ -7,6 +9,10 @@ import unittest
ROOT = pathlib.Path(__file__).resolve().parents[1]
+def mode_of(path):
+ return stat.S_IMODE(path.stat().st_mode)
+
+
class NativePackageIdentityTests(unittest.TestCase):
def test_package_identity_binds_title_and_signed_binary(self):
with tempfile.TemporaryDirectory() as name:
@@ -36,6 +42,60 @@ class NativePackageIdentityTests(unittest.TestCase):
self.assertNotEqual(result.returncode, 0)
self.assertFalse((app / "playden-package.identity").exists())
+ def test_package_step_gives_executables_their_mode(self):
+ with tempfile.TemporaryDirectory() as name:
+ app = pathlib.Path(name)
+ executables = ("eboot.bin", "sce_module/libc.prx", "helper.elf", "runtime/module.prx")
+ others = ("sce_sys/param.json", "playden-version")
+ for relative in executables + others:
+ (app / relative).parent.mkdir(parents=True, exist_ok=True)
+ (app / relative).write_bytes(b"fixture")
+ (app / relative).chmod(0o644)
+ result = subprocess.run([
+ "cmake", f"-DAPP_DIR={app}", "-P", str(ROOT / "cmake/SetPackageExecutableModes.cmake")],
+ capture_output=True, text=True)
+ self.assertEqual(result.returncode, 0, result.stderr)
+ for relative in executables:
+ self.assertEqual(mode_of(app / relative), 0o755, relative)
+ for relative in others:
+ self.assertEqual(mode_of(app / relative), 0o644, relative)
+
+ def test_package_step_refuses_a_missing_binary_or_a_symlink(self):
+ script = str(ROOT / "cmake/SetPackageExecutableModes.cmake")
+ with tempfile.TemporaryDirectory() as name:
+ root = pathlib.Path(name)
+ app = root / "app"
+ app.mkdir()
+ result = subprocess.run(["cmake", f"-DAPP_DIR={app}", "-P", script], capture_output=True, text=True)
+ self.assertNotEqual(result.returncode, 0)
+ outside = root / "outside.prx"
+ outside.write_bytes(b"fixture")
+ outside.chmod(0o644)
+ (app / "eboot.bin").write_bytes(b"fixture")
+ (app / "linked.prx").symlink_to(outside)
+ result = subprocess.run(["cmake", f"-DAPP_DIR={app}", "-P", script], capture_output=True, text=True)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertEqual(mode_of(outside), 0o644)
+
+ def test_package_build_sets_modes_after_every_file_is_in_place(self):
+ build = (ROOT / "cmake/HomebrewPS5.cmake").read_text()
+ modes = build.index('-P "${CMAKE_SOURCE_DIR}/cmake/SetPackageExecutableModes.cmake"')
+ self.assertGreater(modes, build.index('--out "${app}/eboot.bin"'))
+ self.assertGreater(modes, build.index('"${app}/sce_module/libc.prx"'))
+ self.assertGreater(modes, build.index('${native_helper_package_commands}\n'))
+ self.assertLess(modes, build.index('-E touch "${stamp}"'))
+
+ # scripts/build-homebrew-ps5.sh sets PLAYDEN_PACKAGE_DIR, so every PS5 build checks its real package.
+ # A plain host run has no package to check, and must not read a stale one left by an older build.
+ @unittest.skipUnless(os.environ.get("PLAYDEN_PACKAGE_DIR"), "PLAYDEN_PACKAGE_DIR names no built package")
+ def test_built_package_keeps_its_execute_bits(self):
+ app = pathlib.Path(os.environ["PLAYDEN_PACKAGE_DIR"])
+ for relative in ("eboot.bin", "sce_module/libc.prx"):
+ self.assertTrue((app / relative).is_file(), relative)
+ for path in app.rglob("*"):
+ if path.name == "eboot.bin" or path.suffix in (".prx", ".elf"):
+ self.assertEqual(mode_of(path), 0o755, path)
+
if __name__ == "__main__":
unittest.main()