Files
Mihawk e98cca409c Measure Sony's local processes for this title's frontends
../PS5_Proton found that a title can have Sony's service start a fresh
executable as a child of its application (sceSystemServiceAddLocalProcess
with the libc-only preload mask, a socket at the child's descriptor 3,
sceSystemServiceKillLocalProcess). This probe asks what that is worth
here.

- frontends/child-probe: a frontend program (SDL2, PS5_OpenGL) that the
  title hands over to with LoadExec, as it does ES-DE. It holds the
  display while running a headless child, keeps a child alive across
  its own LoadExec, then releases the display and starts a graphics
  child. "nogpu" mode starts one without ever opening the display.
- frontends/child-probe-helper: the headless child, freestanding C with
  only libkernel, reporting its PID and the memory it sees.
- tooling/native: --preload-prx-flags writes the preload mask into the
  process parameters (0x50), as PS5_Proton's patch to the same tool
  does. Without it the output is unchanged.

Result on the base PS5 (13.40): a headless child starts in 0.12 s and
closes cleanly (kill 0, gone from the list). It reads the same flexible
memory figure as the parent (one budget), and it does not survive the
parent's LoadExec. A graphics child fails before its code runs
(gbase_gvmsw_open 6978, PRX_PROCESS_STARTUP_FAILURE), whether or not
the parent ever opened the display, and Sony then kills the whole
application.

Evidence: evidence/child-processes/ (capture.json, expectation.json,
probe-run-1.jsonl, probe-run-2-nogpu.jsonl). Command:
  PS5_FRONTENDS='es-de picker child-probe' tools/build-title.sh
  tools/run-title.sh --no-build --relaunch-test=1 \
    --relaunch-image=es-de/child-probe.bin --watch 120
Gates: tools/verify.sh PASS (format unit build integration evidence).
2026-10-04 18:36:36 -04:00

44 lines
1.5 KiB
C++

/*
* ps5-native-app-boilerplate - Native PS5 dynamic-module writer interface.
* Copyright (C) 2026 BlackBearReloaded
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Declares conversion of an ordinary LLVM-linked PIE into the PS5 application
* ELF layout consumed by the FSELF wrapper.
*/
#pragma once
#include "elf_object.hpp"
#include <cstdint>
#include <limits>
#include <span>
#include <string>
#include <vector>
namespace ps5::module
{
struct Options
{
std::string entry = "_start";
std::string file_name = "eboot.elf";
std::uint32_t module_sdk = 0x02000009;
std::uint32_t companion_sdk = 0x08050001;
/* The libc heap the process parameters reserve: the most there is, unless a
* program that keeps its memory elsewhere (an OpenGL frontend) asks for less. */
std::uint64_t libc_heap_size = std::numeric_limits<std::uint64_t>::max();
/* The modules the system preloads for the process (its process parameters'
* pointer at 0x50): 0 leaves the pointer out and the system's full default list,
* VideoOut included. A headless helper asks for less (0x8000000000000002: libc
* only), as ../PS5_Proton measured for Sony's local processes. */
std::uint64_t preload_prx_flags = 0;
std::vector<std::string> version_components;
};
[[nodiscard]] elf::Bytes write_executable(const elf::Image &image, std::span<const elf::Stub> stubs,
const Options &options = {});
} // namespace ps5::module