feat(run-report): write the run report when a game ends #14235
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14235"
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 oneandonlydean on 2026-11-01T02:30:04Z.
What
Writes the run report when a converted game ends:
anyps5-report.json, in the format of #14165. It holds the build revision and whether the build is modified, the game (title ID, content version, name), the machine (OS version, CPU model, memory), and the list of unimplemented functions that were called. It is on by default;--aps5-report=offorAPS5_REPORT=0turns it off (--aps5-report=on/APS5_REPORT=1forces it on for a process that is not a converted game). With the report off nothing is collected or written.This is the second of four PRs. It writes only what a run that ends through
exitcan know. Milestones, frame counts, GPU, shader and image-format counters are marked as not collected (coveragefalse); they come in the next PR. A run that crashes, aborts or is killed writes no report yet; that is the last PR.reports/<run id>/in the data folder. Written atomically (temporary file, then rename) through a folder walk that refuses links.exitand_exit; on Linux and macOS also when the entry returns or the host callsstd::exit(anatexithook). On Windows onlyexitand_exitwrite a report, because a DLL's exit handlers run inside the loader lock.NotImplemented_nid_no_patch(name)becomes a macro that also passes__FILE__and__LINE__, somissing.functionscan name the library and the source line. The definitions are parenthesised so the macro does not rewrite them. The rootCMakeLists.txtadds-fmacro-prefix-map=<source dir>/=for C++ on GCC and Clang so that the paths of first-party code in the binaries are source-tree relative:stringsfinds no absolute source-tree path forcore/,tools/ordemo/files in any library or test binary (test binaries still contain build-directory strings such as.../libs/unpatched). C sources of the third-party libraries are not covered by the flag and still carry their build path.libkernelsupplies the game metadata through a provider; each library that registers itself with the report is stamped with the same build revision, soanyps5.modifiedisnullrather than a guess when a library comes from another build.Tested
Linux only.
run_report_tests: 47 passed, 0 failed, 2 not run (the comma-decimal locale test, when no such locale is installed; the junction test, Windows only).tools/tests/test_run_report_schema.py27 tests,tools/tests/test_run_report_docs.py6 tests, andtools/tests/validate_run_report_dump.py(every report the test binary writes validates against the schema): 10 valid. ctest of the tests selected from this diff (6 CMake directories, including the root one) pluspublic_headers(65): 502 tests, 100% passed, none skipped. The new testchild-guest-root-not-fixed-at-loadruns in a child process (so no earlier test can have touched the path resolver); it fails on the previous process-detection code and passes now (see below).Cost of the report, a game-less entry (
run_report_tests --child exit), 300 runs, three rounds, report off versus on, median of the round medians: 1.46 ms off, 1.71 ms on, so about 0.25 ms added to a run that writes one report (no title measured).Not run: Windows and macOS (the platform code in
RunReport.cpp), and the junction test (Windows only); the comma-decimal locale test is skipped when no such locale is installed. Not tested with a title.A bug found on the way: detecting a game process by resolving
/app0/...through the runtime's path resolver from a static initialiser fixes libc's guest root at load time (it records the working directory on first use). Six existing tests that change directory afterwards failed (guest_fopen_errors,guest_record_lock_owners,guest_path_errors,guest_app_icon,guest_app_info,guest_directory_link_types). This PR checks<cwd>/app0/sce_sys/param.json|param.sfodirectly instead.Things reviewers may question
app0/sce_sys/param.jsonor.sfounder the current directory at load);APS5_REPORT=1forces it for anything else.NotImplemented_nid_no_patchmacro changes 24,572 call sites in 366 files without editing them. Any code that declares or definesNotImplemented_nid_no_patch(const char*)in a file that includesGeneral.hppmust write it as(NotImplemented_nid_no_patch)(...); a test that stubs it and links library sources also needs aNotImplementedAt_nid_no_patchstub. This PR updates the four such files onmain. Open PRs that add such a definition in a test file: #9803, #9970, #10378, #12741 and #13560 (each defines the stub in a test file that links library sources); they will fail to link until they addNotImplementedAt_nid_no_patch.__FILE__is embedded at each site; the prefix map above makes it source-relative for first-party C++ on GCC and Clang. MSVC has no equivalent flag, third-party C sources still embed their build path, and the schema test only runs wherejsonschemais installed (the workflow installs it;run_report_schemais registered in ctest only when Python has it).atexithook, so a return from the entry writes no report there. The Windows and macOS code has not been run.Finishwaits up to 3 seconds for a finish that is already in progress on another thread, and up to 1 second for the game metadata provider; a normal single-threaded exit does neither. Measured start-up and exit cost: see Tested.RunReport.cppis about 1,600 lines, of which roughly 400 are the platform path-safety code (WriteAtomically,ReadBounded,FolderIsReachable).RunReportRevision.hppand a CMake custom target stamp the revision intolibcand the libraries that register themselves.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T07:08:01Z.
Review: DISMISSED
Changes requested: this PR breaks the Emscripten portability build with a link error
The Emscripten
library-portabilityjob fails on this head at link time, and the cause is this PR. It changesNotImplemented_nid_no_patchincore/libs/prx/libc/include/General.hppinto a macro that calls a new function,NotImplementedAt_nid_no_patch(name, __FILE__, __LINE__). The Emscripten testemscripten_module_unwindcompileslibkernel/Module/src/Module.cpp, which uses that macro, and it defines onlyNotImplemented_nid_no_patch(core/libs/tests/emscripten/EmscriptenModuleUnwind.cpp, line 18). The new symbol is not defined in that link, so it fails.What I ran
a6bb84be17d6c58584ce6bdbfeb603cf462db496; base90cc8d57a5c98bc1ae1237c94516c025031c7c58. The PR touches the libc run-report files,General.hpp,General.cpp, the libc and root CMake files, a schema workflow and the docs (the full list was not counted).General.hppchange at the head (lines 15-17: the new declaration and the macro) and the base (line 15: the function). Read the new definition inGeneral.cpp(around lines 1020-1030).emscripten_module_unwind_teststarget incore/libs/tests/emscripten/CMakeLists.txt: it compilesEmscriptenModuleUnwind.cpp,libkernel/Module/src/Module.cppandlibSceSysmodule/Export.cpp. It does not compileGeneral.cpp.EmscriptenModuleUnwind.cppat the base and at the head: both defineNotImplemented_nid_no_patch(const char*)at line 18; neither definesNotImplementedAt_nid_no_patch.library-portabilityjob fails withwasm-ld: error: … undefined symbol: NotImplementedAt_nid_no_patchinemscripten_module_unwind_tests.dir/…/Module.cpp.o. NoNotImplementedAtappears anywhere in the base.windowswas cancelled; linux skipped.Results
library-portability(hosted)undefined symbol: NotImplementedAt_nid_no_patchinemscripten_module_unwind_tests; caused by the new macro inGeneral.hppNotImplementedAt_nid_no_patchdefined for the Emscripten testNotImplemented_nid_no_patchlibrary-portabilityfailed;windowscancelledRead-only check output
Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed with warnings (16). Stack check: passed, no errors. Hosted:
gh api repos/boykopovar/AnyPS5/commits/a6bb84be17d6c58584ce6bdbfeb603cf462db496/check-runs, and thelibrary-portabilityjob log.Negative control
Not run here. A negative control needs a local build, and code from this head is not run here.
Findings
Blocking
library-portabilityjob fails at link time on this head. The new macro inGeneral.hpp(lines 16-17) makesModule.cppcallNotImplementedAt_nid_no_patch, whichcore/libs/tests/emscripten/EmscriptenModuleUnwind.cppdoes not define. Fix one of these: defineNotImplementedAt_nid_no_patchin that test with the new signature, or keep the call sites linking as they did before. Then rerun thelibrary-portabilityjob.Non-blocking
Sources
github.com/boykopovar/AnyPS5@a6bb84be17/core/libs/prx/libc/include/General.hpp(lines 15-17)github.com/boykopovar/AnyPS5@a6bb84be17/core/libs/prx/libc/src/General.cpp(around lines 1020-1030)github.com/boykopovar/AnyPS5@a6bb84be17/core/libs/tests/emscripten/CMakeLists.txtgithub.com/boykopovar/AnyPS5@a6bb84be17/core/libs/tests/emscripten/EmscriptenModuleUnwind.cpp(line 18)library-portabilityjob ona6bb84be17Not verified
Module.cppwithoutGeneral.cpp.To get this to a good state
NotImplementedAt_nid_no_patchinEmscriptenModuleUnwind.cpp, or change the macro so the Emscripten target still links. Rerunlibrary-portability.