Skip to content

PS5: Find patches for fan translations and rebuilt discs by the game's own serial - #81

Open
dann1k wants to merge 1 commit into
Swordpdf:mainfrom
dann1k:serial-from-elf
Open

dann1k wants to merge 1 commit into
Swordpdf:mainfrom
dann1k:serial-from-elf

Conversation

@dann1k

@dann1k dann1k commented Oct 19, 2026 •

Copy link
Copy Markdown

Description of Changes

"Get patches and cheats" now also finds patches for fan translations and rebuilt discs. When no source has a file for the disc's own <serial>_<crc>, the downloader:

  1. tries the disc's serial, then the serials the game's executable names its memory card folder after (BASLUS-20500 → SLUS-20500);
  2. looks the serial up in each source's file list (GitHub's tree API, one request per source, kept for the run);
  3. if there is exactly one file for that serial, fetches it and saves it under the disc's own name, <disc serial>_<disc crc>_<serial>.pnach, so PCSX2 loads it for this disc.

Every group is renamed <name> (from <serial>_<crc>) and stays off. The file starts with a comment that it was made for another executable. The first serial anything is found for wins. Two files for one serial (two releases) are left alone, because there is no way to know which one the disc was made from.

Discs that already have their own file behave as before: no extra requests.

fe_ps5.cpp: the online patches' HTTP client accepts up to 8 MB from api.github.com (PCSX2's list is 1.4 MB today and growing). Everything else stays at 2 MB.

Rationale behind Changes

Patches are matched by serial and CRC, so they never show up for:

  • Fan translations. The executable is edited, so its CRC differs even though the code is the same. Example: GTA Liberty City Stories, Russian translation: SLUS-21423, CRC 3AF039F8; PCSX2 has SLUS-21423_7EA439F5.
  • Rebuilt discs that boot a renamed executable, e.g. NORG_RUS.00. The serial becomes NORG-RUS00, so there are no patches and no GameDB entry. Example: Red Dead Revolver, Russian NORG disc. Its executable contains BASLUS-20500 (and BESLES-52478), and its code is the US v1.03 one.

For both discs I checked by hand that the bytes at the patch addresses match the original release, renamed the files, and they work. This PR makes the app do the finding part. It does not check the code, which is why everything stays off and is labelled with where it came from.

Known limit: discs whose boot executable is only a language menu (e.g. the NORG Simpsons: Hit & Run, NORG_000.00 → NORG_RUS.00) have no serial in the file that is read, so they are still not found.

Why the file list (and not just the right serial)

Correcting the serial alone is not enough: the sources are fetched by the exact file name, CRC included, and the disc's CRC is not the original's.

Disc The app would ask for What the source has
Red Dead Revolver (NORG), serial from the executable SLUS-20500_87844524.pnach SLUS-20500_E169BAF8.pnach
GTA LCS (translation), serial already right SLUS-21423_3AF039F8.pnach SLUS-21423_7EA439F5.pnach

Both would be 404s. The original release's CRC isn't anywhere on the disc, so the only way to learn it is the list of files the source has for that serial. raw.githubusercontent.com serves files by name but can't list a folder, hence the tree API (one request per source, only when the disc's own file wasn't found).

So the PR fixes two separate things: a wrong serial (rebuilt discs, from the executable) and a different CRC (any edited executable, from the file list).

I also considered a few alternatives:

  • PCSX2's patches.zip would still need the same serial-to-files lookup.
  • An index file kept in this repo (serial -> file names) would avoid the API, but would need maintaining. Happy to switch to that if you prefer it.

Suggested Testing Steps

  • PC: ps5/frontend/host/test-patchdl.sh. All tests pass (existing + new ones). The new tests cover:

    • a translation that kept the serial;
    • a rebuild with two serials in it (only the first is used);
    • two releases of one serial (none taken);
    • GitHub's real JSON layout;
    • an HTTP 403 rate limit (reported, not cached, retried next time);
    • a disc with its own file (no list requested).

    I also ran the lookup functions on the real executables of both discs above against the live lists: they found SLUS-21423_7EA439F5.pnach and SLUS-20500_E169BAF8.pnach.

  • Console: not tested. I can't build the eboot (the modified SDK and driver aren't public). Worth checking:

    • "Get patches and cheats" on a translated disc and on a NORG disc;
    • the new groups showing on the sheet;
    • a normal disc still making exactly the old 3 requests.

Did you use AI to help find, test, or implement this issue or feature?

Yes. Claude (Claude Code) wrote the code and tests and checked the two discs' executables against the patches. I'm sending it because of my own discs. AI-PR-NOTICE.md is added as AGENTS.md asks; feel free to drop it.

…e's own serial (AI-assisted)

"Get patches and cheats" asks each source for the disc's own <serial>_<crc>. A fan translation changes the
executable, so its CRC differs and nothing is found; a rebuilt disc that boots NORG_RUS.00 instead of
SLUS_205.00 has no real serial at all. When nothing comes for the disc's own file, the downloader now
tries the disc's serial, then the serials the executable names its memory card folder after
("BASLUS-20500"). Each source's file list (GitHub's tree API, once a run) gives the files of that serial;
when there is exactly one, it is kept under the disc's own name (<disc serial>_<disc crc>_<serial>.pnach),
so PCSX2 loads it, with every group renamed "(from <serial>_<crc>)" and off. The first serial anything is
found for wins; two files for one serial (two releases) are left alone.

fe_ps5.cpp: the online patches' client takes up to 8 MB from api.github.com (PCSX2's list is 1.4 MB).

Tested on a PC (ps5/frontend/host/test-patchdl.sh, all passed, with the real executables of two discs and
the live file lists); not built for or tried on a console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dann1k dann1k changed the title ps5: find patches for fan translations and rebuilt discs by the game's own serial (AI-assisted) PS5: Find patches for fan translations and rebuilt discs by the game's own serial (AI-assisted) Oct 19, 2026
@dann1k dann1k changed the title PS5: Find patches for fan translations and rebuilt discs by the game's own serial (AI-assisted) PS5: Find patches for fan translations and rebuilt discs by the game's own serial Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant