feat(tools): add a graphical launcher #3786
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3786"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Techx3 on 2026-10-11T16:42:24Z.
tools/launcher/anyps5_launcher.py is a Tkinter front end (Python standard library only) that lists the games in a folder, converts each one with the relinker on first run (decrypted ELF dumps only; a SELF is rejected with a message; hard-linking the game files into app0/ and copying the built .prx libraries), caches the result by a fingerprint of its inputs and runs it with the output in a log pane. It can also build AnyPS5 (submodules, configure, build, libs) and start another emulator on the selected game. Usage is documented in docs/user/USAGE.md.
Claude-Session: https://claude.ai/code/session_017Dqgm9nUKygsXzr6poJsHJ
What
An optional graphical front end,
tools/launcher/anyps5_launcher.py(Python 3.8+, standard library and Tkinter only), documented indocs/user/USAGE.md:sce_sys/).relinker [--windows] <eboot.elf> app.exe, hard-links the game files intoapp0/, copies the built.prxlibraries and, on Windows, the MinGW runtime DLLs), caches it by a fingerprint of its inputs and runs it with the output in a log pane andlast_run.log.libs), Reconvert, Run with emulator (command template with{elf},{dir},{id}), and an optionalenv.txtforAPS5_*switches.It does not change AnyPS5 itself; game folders are never modified.
Tested
Windows 11 with PPSA15552 (Dead Cells) and Dreaming Sarah: listing, conversion, cached reruns, library refresh after rebuilds,
env.txt. Linux: scanning and status on a sample folder.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Thanks for the reviews and the Windows run. Changes since:
Review (@adriadam10)
build()no longer touches Tk from the worker: it posts arefreshmessage thatpoll()handles on the Tk thread.tools/tests/test_launcher.py, registered in ctest (launcher), coveringscan_games(param.json, nested folders, SELF detection),extra_module_dirs/module_dirs,fingerprint,stage_source,build_compiler/mingw_dirsandemulator_command.SELF (@oneandonlydean)
unselfand its calls are gone; the launcher takes decrypted ELF dumps only and rejects a SELF executable or module with a message.Windows run (@tezzgod74)
build/CMakeCache.txt, thenPATH; a missing DLL now fails the run with a message instead of a warning and0xC0000135.tools/launcher/config.jsonis ignored explicitly.unselfdropped (above).download0/: the launcher does not create it.Also new: folders outside
sce_module/that hold.prxmodules (UnityMedia/Modules,Media/Plugins) are passed with--module-dir.Docs updated in
docs/user/USAGE.md. Rebased on current main; conventions check andtest_launcher.pypass.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T16:49:13Z.
Review: CHANGES_REQUESTED
Thanks for this. I checked that
scan_gamesfinds the title/ID on a real dump, thatunselfyields an ELF the relinker accepts (it rejects the raw SELF), and that the output layout matchesdocs/user/USAGE.md. Three things to fix:tools/launcher/anyps5_launcher.pylines 2-3, 195, 230 and 275-276 count; please remove them (the checklist item is ticked).build()runsself.refresh()inside the worker (line 598), andrefresh()callsself.dir_var.get()and writes the config (lines 513-514). Run the refresh from the Tk thread (e.g. post a message to the queue and handle it inpoll).unself,scan_games,fingerprintandemulator_commandare pure functions with no coverage, andunselfparses a binary format. Please add a Python test next to the tool (registered in ctest, seetools/check_test_registration.py) with a small synthetic SELF (valid, encrypted segment, compressed segment, bad program header index) and a game folder withparam.json.Windows conversion and running can't be exercised on our side; please attach a
last_run.logor a console log of a Windows run so it is on record.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:16:53Z.
Please drop the SELF extraction:
unself(tools/launcher/anyps5_launcher.py:194-227) and its two calls instage_source(lines 236, 251). The owner turned that down on #173 ("such tools already exist"), so the launcher should take ELF dumps only and reject a SELF with a message. That also removes the synthetic-SELF test asked for above; the other points stand.Imported from boykopovar/AnyPS5. Originally posted by tezzgod74 on 2026-10-12T05:54:50Z.
Windows run, as asked above. Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs r7), Python 3.13,
mainb42ef24e0built with-DANYPS5_ENABLE_SPIRV_TOOLS=ON, this PR at e95e9581. Title: DOOM Shareware homebrew (lowbit/ps5-doom v1.1.1, PPSA99666), the release folder as extracted (SELFeboot.bin, fSELFsce_module/libc.prx). I drove the launcher's own functions (scan_games,game_status,ensure_converted,launch) from a script rather than clicking the Tk window, with the cache outside the repository.scan_gamesparam.jsonensure_converted, first runlibc.prxas a guest module), lays outapp0/andlibs/: 1.0 slaunch, WinLibs not onPATH0xC0000135andlast_run.logholdsGetLastError: 126 - The specified module could not be found.launch, WinLibs onPATHANYPS5_GPU. I stopped each after 40 s.The same title converted by hand plays on both GPUs (menus, a new game, E1M1), see #4312.
Points from the run:
sync_libslooks for them next toshutil.which("g++"). When WinLibs is onPATHonly in the shell used for the build (here) and not in the launcher's environment, Play fails as above.build/CMakeCache.txtalready records the full path (CMAKE_CXX_COMPILER:STRING=F:/.../mingw64/bin/g++.exe); reading it, or failing the conversion with a clear message instead of a warning, would avoid the silent0xC0000135.config.jsonis not ignored.save_configwritestools/launcher/config.json, but.gitignorelists onlycache/,env.txtand__pycache__/, so the first Browse or Settings leaves an untracked file in the repository.unself(for the record, since it is to be dropped). Its ELF differs from one wherePT_SCE_VERSIONis taken from the container's tail only inside that segment (0xef528-0xef795ineboot.elf), which it leaves as zeros. DOOM runs with either.download0/doesn't need to be created by the launcher: DOOM created it on the first run.cache/<title id>/and reconvert over each other.last_run.log(iGPU run, 89 lines)AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Techx3 on 2026-10-13T14:57:30Z.
Windows test of the latest branch (
7b75adc86), Windows 11, MinGW build fromtools/mingw64, games folder with mixed dumps.Fixes found while testing on a real library, all pushed with tests (10 launcher tests pass,
check_conventions.pyclean):19e273cbb/7b75adc86: the MinGW runtime is found even whenCMAKE_CXX_COMPILERis a bareg++andpywhas no MinGW onPATH(falls back to the archiver path fromCMakeCache.txt).cf216374c/045a532c4: when a folder holds a SELFeboot.binplus a decrypted dump in a subfolder (decrypted/), the launcher uses the decrypted ELF and itssce_module/prx.f37b8e44d: nested dumps are no longer passed as--module-dir(relinker exited with code 2), the conversion output is kept inconvert.log, and the action bar and log stay visible when the window is small.Result with Quake II (PPSA09477, decrypted dump): conversion succeeds, the runtime layout is staged and
app.exestarts; it then stops on an unresolvedlibSceNpWebApi2import, which is missing onmainas well and not related to the launcher.last_run.log
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T08:11:06Z.
Small cache-invalidation fix for head
7b75adc8685edbffaa771e0d436543eaae694b8f(AI-assisted).fingerprint()truncatesst_mtimeto whole seconds. If an executable, guest module or relinker is replaced with different contents of the same size within that second, its fingerprint stays equal.game_status()uses that fingerprint to choose Ready vs Outdated, so it can keep a stale conversion.The production fix is one line: keep the available timestamp precision with
st_mtime_ns. This retains the existing metadata-based cache policy; it does not detect changes that also preserve the exact timestamp.Regression to add to the existing
LauncherTestsintools/tests/test_launcher.py:Windows 11, CPython 3.12.14, temporary local files: unchanged production plus this regression runs 11 tests and fails all three new subcases, with no errors; the one-line change passes 11/11, no skips (0.399 s). The test explicitly verifies equal size and whole-second timestamps while the subsecond timestamps differ. Original ten tests retained.
This used exact extracted PR tool/test files. No launcher GUI/window created, converted executable launched, game/GPU/native build, CMake/CTest or current-main composition tested. No separate PR opened or push to your branch.
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T12:16:56Z.
Another small, independent fix for head
7b75adc8685edbffaa771e0d436543eaae694b8f(AI-assisted): one non-objectsce_sys/param.jsonaborts the entirescan_games()call. JSON such asnullor[]parses successfully, thenread_param()raisesAttributeErrorondata.get. The refresh worker logs the error without posting the game list, so other valid folders are lost from that refresh too.The two-line guard below applies the existing missing/invalid-JSON fallback (empty title ID, folder name) to non-object JSON as well:
Regression for the existing
LauncherTestsintools/tests/test_launcher.py:Windows 11, CPython 3.12.14, synthetic folders and ELF headers: original ten tests plus this regression run 11 tests with five
AttributeErrorsubcase errors before the guard; with the guard, 11/11 pass, no skips (0.362 s). Each subcase rewrites the same invalid file and rescans alongside a valid title. Exact extracted PR tool/test files; tested independently of my earlier fingerprint fix. No GUI window, conversion, game/GPU, native build, CMake/CTest or current-main composition tested. No new PR or push to your branch.Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T12:21:59Z.
One-line library refresh fix for head
7b75adc8685edbffaa771e0d436543eaae694b8f(AI-assisted).sync_libs()only refreshes an existing same-sized.prxwhen the source mtime is newer. Selecting an older build or restoring libraries from a timestamp-preserving archive can therefore leave the previously cached implementation in use, even though the configured library directory now contains different bytes. The cachedensure_converted()path calls this function before launching.Compare timestamps for inequality instead of ordering, preserving available precision:
Regression for
LauncherTests(tools/tests/test_launcher.py), addingfrom unittest.mock import patchto the imports:Windows 11 / CPython 3.12.14, exact extracted PR files: original ten tests plus this regression run 11 tests; baseline fails the rollback subcase (
previousremains instead ofselected), while the newer-source control passes. With the one-line fix, 11/11 pass, no skips (0.341 s). Temporary synthetic files only;IS_WIN=Falseisolates the platform-independent PRX copy loop from MinGW DLL discovery. No native library loading, GUI, game/GPU, full build, CMake/CTest, current-main composition or combination with my previous two fixes tested. This retains metadata-based comparison: equal size and identical timestamps still do not detect content changes. MinGW DLL refresh and removal of obsolete libraries are outside this change. No new PR or push to your branch.Imported from boykopovar/AnyPS5. Originally posted by Techx3 on 2026-10-15T16:55:30Z.
Thanks @simonbronk, all three applied with your regressions in
dcea9d4c0:st_mtime_nsinfingerprint(), the non-objectparam.jsonguard inread_param(), and the inequality check insync_libs(). Rebased on currentmain; 13 launcher tests andcheck_conventions.pypass.@adriadam10 the three points from your review (docstrings, Tk from the worker, tests) and the Windows log are addressed above; could you take another look when you have time?
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T01:37:54Z.
Review: COMMENTED
macOS host check of head
dcea9d4c0(Apple M2 Max, macOS 27.2, Xcode/usr/bin/python33.9.6 with Tk 8.5), relinker-only build ofmainb5be95ff0.tools/tests/test_launcher.py: 13/13 pass on Python 3.9.6, both native arm64 and x86_64 under Rosetta.IS_WINis the only switch), so it writes a Linux ELF and cannot start it. I drovescan_games→ensure_converted→launchfrom a script on a synthetic game folder (the relinker'smain_fixture()ELF aseboot.elf,extra_args=--skip-sce-module):launch()lets thatOSErrorescape. Withextra_args=--macos --to-rosettathe same path writes a Mach-O (cf fa ed fe), so the workaround is the Settings field. The fix would be to pass--macoswhensys.platform == "darwin", next to--windows(with--to-rosettaon Apple silicon,--to-intelon Intel Macs, asUSAGE.mddescribes), and to note the default inUSAGE.md. Not urgent:main's runtime libraries don't build on macOS yet, so a macOS user can't run a converted game with this launcher today anyway.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by tezzgod74 on 2026-10-19T02:09:47Z.
Re-checked
dcea9d4cagainst the review and my earlier Windows report. Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs r7), Python 3.13,main324e0e48e. The launcher's functions were driven from a script with the cache outside the repository, as before.Review points, in the code at
dcea9d4c:#!linebuild()posts("refresh",)andpoll()runsrefresh()on the Tk threadtools/tests/test_launcher.py, 13 tests, passeboot.binis rejected:eboot.bin is a SELF; the launcher takes decrypted ELF dumps only.Windows run with DOOM Shareware (lowbit/ps5-doom v1.1.1, PPSA99666), unwrapped with
tools/unwrap_self.pyfrommain, WinLibs not onPATH:scan_gamesfinds it as an ELF dump;ensure_convertedrelinks it (libc.prxas a guest module) and writesconvert.log.PATH, which resolves point 1 of my earlier report (0xC0000135before).config.jsonis ignored and the cache key is the title ID plus a hash (points 2 and 5).launchstarts the game: it opens/app0/wads/doom1.wad, creates its swapchain and is still running when stopped after 40 s, withlast_run.logwritten. Onc4c2b3aa7it aborted at start-up withThread destructor callback is already registered, by hand as well as through the launcher. That was #7636, reverted by #7646, and is not the launcher's.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T15:15:40Z.
@adriadam10 could you take another look when you have time? We went through your three points from 10-11 against the current head
dcea9d4c01, and each looks addressed to us. The launcher tests pass locally (13/13), and the cleanup path is now sanitised beforermtree. Your change request is still open, so it's yours to re-review or dismiss. Whether the project wants a graphical launcher at all is also your call.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-24T23:57:51Z.
Review: APPROVED
Reviewed
dcea9d4c01311ffdff4046a4df2527898543e214againsta5e2a80c6bc3a460404267fe600e7e28d0664438. No actionable findings in this focused review.Source review: Inspected the complete launcher, CMake registration and usage documentation. Checked decrypted-ELF/SELF selection, module staging, cache identity and nanosecond fingerprints, refreshed library copies, subprocess argument construction and the worker-to-Tk queue boundary. Conversion errors are reported before marking a cache ready.
Validation: Windows, Python 3.11:
python -X utf8 tools/tests/test_launcher.py -vran 13 tests: 13 passed, 0 skipped. Conventions and whitespace passed. This is a new tool, so baseline has no launcher; the grafted suite's missing-module error is an absence check, not proof of regression sensitivity. The older registration checker does not support--scripts; its unsupported-option exit is a harness limitation. The new CMake add_test entry was inspected directly. Hosted relinker jobs succeeded on Windows, Linux and macOS; full-product jobs were skipped.Scope: Approval covers inspected Python logic and documented wiring. GUI interaction, real title conversion/play and full application builds were not exercised locally.
Pull request closed