ps5: handle PS4 saves natively (single PS5 takes both queues) #1

Merged
earthonion merged 0 commits from ps5-handle-ps4-saves into main 2026-05-13 23:12:56 -05:00
earthonion commented 2026-05-13 22:46:21 -05:00 (Migrated from git.etawen.dev)

Summary

Makes the PS5 worker process both PS5 and PS4 jobs natively. A single jailbroken PS5 can now drain both garlicsaves.com queues at once.

Why this works

garlic-savemgr already proves the PS5 can decrypt PS4 sealed keys via the same /dev/pfsmgr ioctl 0xc0845302 the PS5 worker uses. The only difference is where the sealed key lives:

  • PS5 save image → pfsSKKey magic embedded at offset 0x800 of the image
  • PS4 save image → 0x60 sealed-key bytes in a companion sdimg_<save>.bin file

After decryption, sceFsMountSaveData() mounts both formats identically.

Changes

src/ps5/savedata.c (+163 / -50)

  • detect_is_ps4() reads byte 0 of the save image (0x01=PS4, 0x02=PS5)
  • save_mount() branches: PS5 path is unchanged; PS4 path copies the companion .bin and loads the 0x60 sealed-key bytes
  • Same ioctl 0xc0845302 + sceFsMountSaveData() flow afterward

src/ps5/worker.c (+46 / -7)

  • Poll loop alternates ?platform=ps5 and ?platform=ps4 each tick; sleeps only after both return empty
  • After a job is found, resets to ps5-first so PS5 queue keeps priority
  • Dispatch declines PS4 encrypt / createsave (PS5 worker only produces PS5-format PFS images via sceFsCreatePprPfsSaveDataImage) — HTOS keeps those queued for a real PS4 worker
  • PS4 decrypt / resign / reregion / keyset all work via the new mount path

No server-side changes

HTOS-web /api/worker/next already accepts ?platform=ps4 and filters by params.platform (see routes/api.py:190). No server patch required.

Test plan

  • Build: make ps5 → garlic-worker-ps5.elf (verified locally, 172KB, no warnings)
  • Run on real PS5 (on supported firmware via P2JB)
  • Pull a PS5 decrypt job → confirm still works
  • Pull a PS4 decrypt job → confirm sdimg_* + .bin mount succeeds
  • Pull a PS4 resign job → confirm sealed-key roundtrip
  • Pull a PS4 encrypt/createsave job → confirm worker declines and HTOS re-queues
  • Monitor last_platform in worker_keys — should flip between ps4/ps5 based on whichever queue had the job

Followups (not in this PR)

  • PS4 encrypt / createsave support on PS5 (would need PS4 PFS creation, which garlic-savemgr does not do either)
  • Same dual-poll behavior in TCP direct-connect mode (currently TCP auth advertises only ps5)
## Summary Makes the PS5 worker process **both PS5 and PS4 jobs** natively. A single jailbroken PS5 can now drain both garlicsaves.com queues at once. ## Why this works `garlic-savemgr` already proves the PS5 can decrypt PS4 sealed keys via the same `/dev/pfsmgr` ioctl `0xc0845302` the PS5 worker uses. The only difference is *where the sealed key lives*: - PS5 save image → `pfsSKKey` magic embedded at offset `0x800` of the image - PS4 save image → 0x60 sealed-key bytes in a companion `sdimg_<save>.bin` file After decryption, `sceFsMountSaveData()` mounts both formats identically. ## Changes ### `src/ps5/savedata.c` (+163 / -50) - `detect_is_ps4()` reads byte 0 of the save image (`0x01`=PS4, `0x02`=PS5) - `save_mount()` branches: PS5 path is unchanged; PS4 path copies the companion `.bin` and loads the 0x60 sealed-key bytes - Same `ioctl 0xc0845302` + `sceFsMountSaveData()` flow afterward ### `src/ps5/worker.c` (+46 / -7) - Poll loop alternates `?platform=ps5` and `?platform=ps4` each tick; sleeps only after both return empty - After a job is found, resets to ps5-first so PS5 queue keeps priority - Dispatch declines PS4 `encrypt` / `createsave` (PS5 worker only produces PS5-format PFS images via `sceFsCreatePprPfsSaveDataImage`) — HTOS keeps those queued for a real PS4 worker - PS4 `decrypt` / `resign` / `reregion` / `keyset` all work via the new mount path ## No server-side changes HTOS-web `/api/worker/next` already accepts `?platform=ps4` and filters by `params.platform` (see `routes/api.py:190`). No server patch required. ## Test plan - [ ] Build: `make ps5` → `garlic-worker-ps5.elf` (verified locally, 172KB, no warnings) - [ ] Run on real PS5 (on supported firmware via P2JB) - [ ] Pull a PS5 decrypt job → confirm still works - [ ] Pull a PS4 decrypt job → confirm `sdimg_*` + `.bin` mount succeeds - [ ] Pull a PS4 resign job → confirm sealed-key roundtrip - [ ] Pull a PS4 encrypt/createsave job → confirm worker declines and HTOS re-queues - [ ] Monitor `last_platform` in `worker_keys` — should flip between `ps4`/`ps5` based on whichever queue had the job ## Followups (not in this PR) - PS4 `encrypt` / `createsave` support on PS5 (would need PS4 PFS creation, which `garlic-savemgr` does not do either) - Same dual-poll behavior in TCP direct-connect mode (currently TCP `auth` advertises only ps5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
git-etawen-dev-earthonion/garlic-worker!1
No description provided.