feat(libkernel_sys): answer sceKernelIsNeoMode from the param.sfo Neo-mode attribute #12427

Merged
simnJS merged 2 commits from upstream-pr/12427 into main 2026-10-30 01:30:28 +00:00
simnJS commented 2026-10-28 13:15:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simnJS on 2026-10-28T13:15:14Z.


What

sceKernelIsNeoMode threw NotImplemented on main. Gang Beasts (CUSA04865) calls it first among the stops listed in discussions/7941, and inFAMOUS Second Son (CUSA00223) imports it (discussions/8214).

It now answers from the title's metadata:

  • Title with param.sfo (PS4): returns bit 23 (0x00800000) of ATTRIBUTE, the title's PS4 Pro (Neo) mode support, and 0 when the key is absent.
    • shadPS4 answers IsNeo() && support_neo_mode.
    • Its PSFAttributes puts support_neo_mode at bit 23, read from ATTRIBUTE in emulator.cpp, 0 when the key is absent.
    • main already answers as a Neo console: sceKernelHasNeoMode and sceKernelIsAuthenticNeo return 1, the constants #9172 read in the 13.60 module. shadPS4 returns IsNeo() from both, so the title bit alone decides here.
  • Title with param.json (PS5): still throws. What a PS5 application gets is unknown, and the PS5 module's body for this export has not been read.
  • No metadata: the existing param.json or param.sfo not found error, as for the other metadata queries.

To make the attribute reachable, the param.sfo parser in libkernel now reads the ATTRIBUTE integer, and libkernel exposes it as GetAppParamSfoAttribute_nid_no_patch. That accessor returns false for a title loaded from param.json. Every prx library links libkernel, and libSceVideoOut already reads GetAppAttribute3_nid_no_patch the same way.

Not measured on a console. The PS4 FW 10.71 base-model measurement in discussions/7941 (0) is for a console without Neo mode, so it does not settle this case. The debt entry in docs/dev/debt/libkernel_sys.md records both points. The param.sfo entry in docs/dev/debt/libkernel.md now lists ATTRIBUTE.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release, BUILD_TESTING=ON, on main 750cf6cf48. No title run: the titles that import it are PS4 titles, which do not start on main yet.

  • New guest_kernel_sys_neo_mode: one process per case, each in its own app0/sce_sys:
    • ATTRIBUTE 0x00800000 gives 1 on two calls;
    • 0xFFFFFFFF gives 1;
    • other bits without bit 23 (0x00004002) give 0;
    • param.sfo without ATTRIBUTE gives 0;
    • param.json alone throws sceKernelIsNeoMode not implemented;
    • param.json beside a Neo-mode param.sfo throws (param.json wins);
    • no metadata throws param.json or param.sfo not found.
  • param_sfo_parser checks:
    • ATTRIBUTE absent gives 0;
    • 0x00800000 is read as is;
    • -1 keeps all 32 bits;
    • a text ATTRIBUTE is ignored;
    • a short one is refused.
  • param_json_parser checks that param.json gives no param.sfo attribute.
  • Ten runs each, all passing, with a rebuild between two rounds:
    • guest_kernel_sys_neo_mode, param_sfo_parser, param_json_parser, guest_app_info;
    • guest_kernel_sys, guest_kernel_sys_constants, guest_kernel_sys_console_identity, guest_kernel_sys_cpumode, guest_kernel_sys_sdk_version.
  • Control, with main's throwing body for sceKernelIsNeoMode and the parser without ATTRIBUTE:
    • guest_kernel_sys_neo_mode fails on its first case (sceKernelIsNeoMode not implemented);
    • param_sfo_parser fails (An absent ATTRIBUTE is not 0).
  • public_headers and public_headers_compile_*: 65/65 pass. relinker builds; it compiles ParamJsonParser.cpp and only reads the title.
  • python tools/check_conventions.py --base origin/main with this title and body: all checks pass. python tools/pr_overlap.py --branch feat/kernel-is-neo-mode: no conflicting lines or exports. #10335 also adds an include to Export.Discovery.cpp; git merge-tree with its head is clean. The PRs it could not compare already conflict with main. Of those, the ones touching Export.Discovery.cpp (#10657, #11031, #11034, #11212, #11216, #11267, #12130) change other functions.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5051091738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12427). Originally posted by [simnJS](https://github.com/simnJS) on 2026-10-28T13:15:14Z. --- ### What `sceKernelIsNeoMode` threw `NotImplemented` on `main`. Gang Beasts (CUSA04865) calls it first among the stops listed in [discussions/7941](https://github.com/boykopovar/AnyPS5/discussions/7941#discussioncomment-19045601), and inFAMOUS Second Son (CUSA00223) imports it ([discussions/8214](https://github.com/boykopovar/AnyPS5/discussions/8214)). It now answers from the title's metadata: - **Title with `param.sfo` (PS4):** returns bit 23 (`0x00800000`) of `ATTRIBUTE`, the title's PS4 Pro (Neo) mode support, and 0 when the key is absent. - [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/core/libraries/kernel/process.cpp#L29-L35) answers `IsNeo() && support_neo_mode`. - Its [`PSFAttributes`](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/common/elf_info.h#L50-L51) puts `support_neo_mode` at bit 23, read from `ATTRIBUTE` in [emulator.cpp](https://github.com/shadps4-emu/shadPS4/blob/3eecea94ddaca360b19f4b800523b609a8b2ffcc/src/emulator.cpp#L410-L412), 0 when the key is absent. - `main` already answers as a Neo console: `sceKernelHasNeoMode` and `sceKernelIsAuthenticNeo` return 1, the constants #9172 read in the 13.60 module. shadPS4 returns `IsNeo()` from both, so the title bit alone decides here. - **Title with `param.json` (PS5):** still throws. What a PS5 application gets is unknown, and the PS5 module's body for this export has not been read. - **No metadata:** the existing `param.json or param.sfo not found` error, as for the other metadata queries. To make the attribute reachable, the `param.sfo` parser in libkernel now reads the `ATTRIBUTE` integer, and libkernel exposes it as `GetAppParamSfoAttribute_nid_no_patch`. That accessor returns false for a title loaded from `param.json`. Every prx library links libkernel, and libSceVideoOut already reads `GetAppAttribute3_nid_no_patch` the same way. Not measured on a console. The PS4 FW 10.71 base-model measurement in discussions/7941 (0) is for a console without Neo mode, so it does not settle this case. The debt entry in `docs/dev/debt/libkernel_sys.md` records both points. The `param.sfo` entry in `docs/dev/debt/libkernel.md` now lists `ATTRIBUTE`. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release, `BUILD_TESTING=ON`, on `main` `750cf6cf48`. No title run: the titles that import it are PS4 titles, which do not start on `main` yet. - New `guest_kernel_sys_neo_mode`: one process per case, each in its own `app0/sce_sys`: - `ATTRIBUTE` `0x00800000` gives 1 on two calls; - `0xFFFFFFFF` gives 1; - other bits without bit 23 (`0x00004002`) give 0; - `param.sfo` without `ATTRIBUTE` gives 0; - `param.json` alone throws `sceKernelIsNeoMode not implemented`; - `param.json` beside a Neo-mode `param.sfo` throws (`param.json` wins); - no metadata throws `param.json or param.sfo not found`. - `param_sfo_parser` checks: - `ATTRIBUTE` absent gives 0; - `0x00800000` is read as is; - `-1` keeps all 32 bits; - a text `ATTRIBUTE` is ignored; - a short one is refused. - `param_json_parser` checks that `param.json` gives no `param.sfo` attribute. - Ten runs each, all passing, with a rebuild between two rounds: - `guest_kernel_sys_neo_mode`, `param_sfo_parser`, `param_json_parser`, `guest_app_info`; - `guest_kernel_sys`, `guest_kernel_sys_constants`, `guest_kernel_sys_console_identity`, `guest_kernel_sys_cpumode`, `guest_kernel_sys_sdk_version`. - Control, with `main`'s throwing body for `sceKernelIsNeoMode` and the parser without `ATTRIBUTE`: - `guest_kernel_sys_neo_mode` fails on its first case (`sceKernelIsNeoMode not implemented`); - `param_sfo_parser` fails (`An absent ATTRIBUTE is not 0`). - `public_headers` and `public_headers_compile_*`: 65/65 pass. `relinker` builds; it compiles `ParamJsonParser.cpp` and only reads the title. - `python tools/check_conventions.py --base origin/main` with this title and body: all checks pass. `python tools/pr_overlap.py --branch feat/kernel-is-neo-mode`: no conflicting lines or exports. #10335 also adds an include to `Export.Discovery.cpp`; `git merge-tree` with its head is clean. The PRs it could not compare already conflict with `main`. Of those, the ones touching `Export.Discovery.cpp` (#10657, #11031, #11034, #11212, #11216, #11267, #12130) change other functions. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-29 08:47:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:47:17Z.

Review: APPROVED


Re-reviewed exact head af7d8d38c1bf5f988973b8987f1a3695f417eb64. The new Windows report completes the remaining focused-platform check: guest_kernel_sys_neo_mode, param_json_parser, and param_sfo_parser pass 3/3. Earlier QEMU runs on the implementation head also passed those targets; this PR intentionally answers only from the SFO path, leaves JSON-selected titles unimplemented, and does not infer a PS5 answer. The current-main merge preview is clean. Hosted Windows, relinker matrix, conventions, and report checks pass; the Linux/product job is skipped. I did not rerun the tests locally or validate on a console/title.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695001100 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12427#pullrequestreview-5695001100). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:47:17Z. **Review:** APPROVED --- Re-reviewed exact head `af7d8d38c1bf5f988973b8987f1a3695f417eb64`. The new Windows report completes the remaining focused-platform check: `guest_kernel_sys_neo_mode`, `param_json_parser`, and `param_sfo_parser` pass 3/3. Earlier QEMU runs on the implementation head also passed those targets; this PR intentionally answers only from the SFO path, leaves JSON-selected titles unimplemented, and does not infer a PS5 answer. The current-main merge preview is clean. Hosted Windows, relinker matrix, conventions, and report checks pass; the Linux/product job is skipped. I did not rerun the tests locally or validate on a console/title.
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.

Reference
boykopovar/AnyPS5!12427
No description provided.