Skip to content

fix(libSceNpTrophy2): return the icon error code instead of throwing - #15314

Open
MarcZX10 wants to merge 3 commits into
boykopovar:mainfrom
MarcZX10:r2/R20-trophy2-icons
Open

MarcZX10 wants to merge 3 commits into
boykopovar:mainfrom
MarcZX10:r2/R20-trophy2-icons

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon and sceNpTrophy2GetTrophyIcon threw a C++ exception when no icon file existed. They now return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND with the size zeroed. That error is the not-found answer by design, matching the sibling sceNpTrophy2GetRewardIcon and the debt entry that describes these functions. Its effect on a title is not measured here.

Commits:

  • da29f8c fix(libSceNpTrophy2): return the icon error code instead of throwing
  • 96a5aae test(libSceNpTrophy2): cover the game, group and trophy icon error codes

Tested

  • Host: Linux, archive build, lane 2, on the final head after rebasing onto current main.
  • ctest -R '^guest_nptrophy2$': 1 of 1 passed (guest_nptrophy2).
  • tools/check_conventions.py --base upstream/main and git diff --check upstream/main: clean.

Not verified

Checklist

  • Based on current main; no other open PR changes these icon functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon and
sceNpTrophy2GetTrophyIcon throw std::runtime_error when no icon is read.
A throw escapes the C ABI and stops the title, while the sibling
sceNpTrophy2GetRewardIcon zeroes the size and returns
SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND, which the technical debt entry
for libSceNpTrophy2 cites as the expected result of these calls.

The three functions now zero the size and return the same error code.
The guest test checks that the three icon queries that have no icon file
return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND with a zero size, which
the throwing versions did not satisfy.
@github-actions github-actions Bot added the prx label Nov 3, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi MarcZX10,

Thanks for turning the three icon throws into the error answer. Returning SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND with the size zeroed matches sceNpTrophy2GetRewardIcon and the KytyPS5 sibling calls its debt entry already cites, and the tests cover all three, including a null size.

Two changes before it can go in:

  1. sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon and sceNpTrophy2GetTrophyIcon now return that error unconditionally (GameInfo.cpp:67-75, GroupInfo.cpp:112-121, TrophyInfo.cpp:116-125): there is no file check, and the context, handle, id and buffer are ignored. That makes them silent stubs, which the contributing guide allows only to unblock a title and only where the effect is limited to the UI, and the description lists Unblocks: none. Please name the title and the UI effect this unblocks, or keep the calls explicitly unsupported until icons are read. Please also reword the description, which presents this as a fix for when the icon file is missing, to say that the answer is unconditional.
  2. docs/dev/debt/libSceNpTrophy2.md describes only sceNpTrophy2GetRewardIcon; it names the three changed exports just as the source of the inferred code. Please give them an entry of their own (or extend that one) saying they zero the size and return -2141898479 (0x80553911) whether or not an icon exists, inferred from KytyPS5 (libTrophy.cpp) and not measured on the console.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 96a5aae merged onto main a4eca2a · tested 2026-11-03 01:52 UTC · 25 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 834 passed · 3 failed (0 new, 3 also fail on main) · 59 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 896 of 3,591 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (452 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ unwrap_self 93.6 s, ⚠️ public_headers 90.1 s, ⚠️ agc_driver_indexed_copy 49.1 s, ⚠️ agc_driver_lazy_resolved_abi 45.2 s, ⚠️ check_skips 37.8 s
Failing on main too (3, not counted against this PR)
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
Passed on retry (3, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_emulated_color_compare: Timeout in the parallel run; also passed only on retry in 18 other runs in the last 7 days
public_headers: Timeout in the parallel run; also passed only on retry in 2 other runs in the last 7 days
trace_digest_TraceDigestTests_test_cli_rejects_invalid_event_fields_without_partial_output: Timeout in the parallel run; also passed only on retry in 20 other runs in the last 7 days
Validated but not compared (58, not in the main baseline's validation pass)
public_headers
public_headers_compile_0
public_headers_compile_10
public_headers_compile_12
public_headers_compile_14
public_headers_compile_16
public_headers_compile_18
public_headers_compile_19
public_headers_compile_2
public_headers_compile_20
public_headers_compile_21
public_headers_compile_22
public_headers_compile_23
public_headers_compile_24
public_headers_compile_25
public_headers_compile_26
public_headers_compile_27
public_headers_compile_28
public_headers_compile_29
public_headers_compile_30
public_headers_compile_31
public_headers_compile_32
public_headers_compile_33
public_headers_compile_34
public_headers_compile_35
public_headers_compile_36
public_headers_compile_37
public_headers_compile_38
public_headers_compile_39
public_headers_compile_4
public_headers_compile_40
public_headers_compile_41
public_headers_compile_42
public_headers_compile_43
public_headers_compile_44
public_headers_compile_45
public_headers_compile_46
public_headers_compile_47
public_headers_compile_48
public_headers_compile_49
public_headers_compile_50
public_headers_compile_51
public_headers_compile_52
public_headers_compile_53
public_headers_compile_54
public_headers_compile_55
public_headers_compile_56
public_headers_compile_57
public_headers_compile_58
public_headers_compile_59
public_headers_compile_6
public_headers_compile_60
public_headers_compile_61
public_headers_compile_62
public_headers_compile_63
public_headers_compile_8
trace_digest_TraceDigestTests_test_cli_rejects_invalid_event_fields_without_partial_output
trace_digest_TraceDigestTests_test_cli_rejects_invalid_summary_records_without_partial_output
Validation IDs already present on main (3 IDs in 329 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (329 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 321 more
VUID-vkCmdCopyImage-srcImage-01548 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
Skipped (59)
usage: check_skips.py [-h] [--job {linux,windows}] [--list] [--require-tests]
                      junit
check_skips.py: error: /home/ben/anyps5-gpu-ci/data/runs/pr-15314/96a5aaec7d7a-a4eca2a056bf/ctest.xml: testcase 'public_headers_compile_0' is notrun and was not run
Reproduce
git fetch origin 96a5aaec7d7af072aa8acd18aea2308c81833a5f a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8
git checkout a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8 && git merge --no-ff 96a5aaec7d7af072aa8acd18aea2308c81833a5f
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@bunbeans2-arch

Copy link
Copy Markdown
Contributor

A Windows run with GCC 16: Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release, this PR (96a5aaec7d) merged into main 7feb37e.

  • ✅ With this PR: guest_nptrophy2 passed 5 of 5.
  • ❌ Same tree with only GameInfo.cpp, GroupInfo.cpp and TrophyInfo.cpp put back to main (this PR's test kept, all three rebuilt): guest_nptrophy2 aborted in 5 of 5 runs (exit 0xc0000409, unhandled exception 'St13runtime_error', then abort() (SIGABRT)). So on Windows the old icon calls end the process, and the new checks catch that.
  • ✅ main 7feb37e alone (its own test and source): guest_nptrophy2 passed 3 of 3.

Looks good on Windows 👍

AI-assisted: yes (Claude Code)

@oneandonlydean oneandonlydean self-assigned this Nov 7, 2026
@JJenkx

JJenkx commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 96a5aaec7d, merged onto main 8ce7b561e4 (3dc0b9be46, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_nptrophy2 passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@Superseabas

Copy link
Copy Markdown
Contributor

#19532 builds on this PR and reads the icons from trophyNN.ucp. I think that covers both changes requested above:

  1. sceNpTrophy2GetGameIcon, GetGroupIcon, GetTrophyIcon and GetRewardIcon return the icon from the title's package. They zero the size and return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND only when the package has no such icon, or there is no package, so the answer is no longer unconditional. The icon file names come from a real trophy00.ucp, and feat(libSceNpTrophy2): read the game, group, trophy and reward icons from trophyNN.ucp #19532's description has the details.
  2. Its debt entry, "Trophy icons", covers all four calls and what isn't confirmed on the console. It replaces the sceNpTrophy2GetRewardIcon entry under Silent stubs.

#19532 merges this branch at 96a5aaec7d, so your two commits are part of it, including your checks in GuestNpTrophy2.cpp, with your authorship. Whichever you prefer:

AI-assisted: yes (Claude Code)

oneandonlydean pushed a commit that referenced this pull request Nov 13, 2026
…GuestCopyOut

sceNpTrophy2CreateContext, sceNpTrophy2CreateHandle and the
game/group/trophy info queries (single and array variants) wrote
directly into guest output pointers, so an unwritable context,
handle, details, data, array element or count faulted inside the
library.

CreateContext and CreateHandle now copy the produced id out with
GuestCopyOut_nid_no_patch and return SCE_NP_TROPHY2_INVALID_ARGUMENT
-equivalent (APS5_INVALID_ARG_EX) when it is not writable. The info
queries now fill a local struct and copy it out with
GuestCopyOut_nid_no_patch; the array variants copy each element and
the final count the same way, stopping (and leaving count untouched)
at the first unwritable element.

python3 tools/guest_pointer_audit.py libSceNpTrophy2 goes from 16
direct guest pointer accesses to 4, all of them the size parameter of
the four icon queries (out of scope; sceNpTrophy2GetRewardIcon's is
already covered by #15314).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 96a5aaec7d, applied with git apply (with -C1, context shifted) on main fd4aeed483 together with the other 27 PRs of one batch (#11049, #20072, #20406, #22100, #22892, #23774, #24199, #24495, #21180, #21221, #21486, #22597, #22839, #22895, #23550, #24672, #14573, #16873, #17113, #17879, #19183, #20057, #22066, #22219, #22781, #22958, #24478). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_nptrophy2 (1 test, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6522 tests) on the RTX 3080 has 8 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked, agc_storage_write_back_host_retile. Traced to other PRs of the batch, each by reverting it and testing again: #21486 (agc_driver_graphics, agc_graphics_profile_draw), #24672 (guest_kernel_sys_neo_mode); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_indexed_draw. The 2125 agc_/video tests on the iGPU have 5 failing: agc_driver_graphics, agc_driver_stencil_plane_memory, agc_driver_store_over_untracked, agc_graphics_profile_draw, agc_storage_write_back_host_retile (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@MarcZX10

Copy link
Copy Markdown
Contributor Author

@oneandonlydean @MarcZX10

Request 2 (debt entry): done. Pushed a06a91ae53 to fork/r2/R20-trophy2-icons. docs/dev/debt/libSceNpTrophy2.md now has one entry under Silent stubs for sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon and sceNpTrophy2GetTrophyIcon: they zero the size and return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND (-2141898479, 0x80553911) whether or not an icon exists, the arguments are ignored, and the value is inferred from KytyPS5 (libTrophy.cpp:464/483/502), not measured on the console. I edited the debt file directly because that is what CONTRIBUTING.md (line 80) says to do in this checkout.

Request 1 (unconditional answer, silent stub): decision needed, not changed yet. The three functions still return the error unconditionally. The options are:

  1. Keep them as they are and name the title and the UI effect that they unblock. I did not find one in the PR, so I did not invent one.
  2. Make them read the icon from the title's package, as feat(libSceNpTrophy2): read the game, group, trophy and reward icons from trophyNN.ucp #19532 does. Its reply on this PR says it builds on 96a5aaec7d and carries these commits. If so, the order of the two PRs needs a decision: this one merges first, or it is closed in favour of feat(libSceNpTrophy2): read the game, group, trophy and reward icons from trophyNN.ucp #19532.
  3. Keep the calls explicitly unsupported (NotImplemented_nid_no_patch(__func__)) until icons are read, and remove the silent stub.

@MarcZX10 please choose one. The description rewording (the request to say that the answer is unconditional) follows that choice; I have not changed the description.

Verification: python3 tools/check_conventions.py --base origin/main in the worktree: "All conventions checks passed." No code was changed and no build was run, so the debt-file edit is the only change in this push; guest_nptrophy2 was not re-run.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

@oneandonlydean

Request 1 (unconditional answer, silent stub): decided, no code change. The three functions keep their current behaviour: they return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND with the size zeroed, and that is the not-found answer by design, matching sceNpTrophy2GetRewardIcon. The reason is that returning it lets a title carry on, where a throw ended the process (the Windows GCC 16 run in this thread showed unhandled exception 'St13runtime_error' and SIGABRT on the old calls). The description now says so, and says that the effect on a title is not measured here.

Facts behind it, checked in the worktree at a06a91ae53:

  • The exports you named already call NotImplemented_nid_no_patch(__func__) in core/libs/prx/libSceNpTrophy2/Export.cpp (the BuildGroupIconUri, BuildRewardIconUri, BuildTrophyIconUri, GetTrpIconByUri, BuildBgImageIconUri and BuildTitleIconUri exports). Nothing there returns an error code.
  • The error return is in the real Get*Icon functions: src/GameInfo.cpp:74, src/GroupInfo.cpp:120, src/TrophyInfo.cpp:124, and sceNpTrophy2GetRewardIcon in src/Context.cpp:89.
  • docs/dev/debt/libSceNpTrophy2.md (line 5, from a06a91ae53) already lists the three as silent stubs and says the console's answer is not measured.

On the title and UI effect: I did not find one in this PR, so none is claimed. The PR description now says Unblocks: none, and the reply does not invent one.

Request 2 (debt entry) is already in a06a91ae53, as the earlier reply says.

Note: #19532 (by @Superseabas) builds on 96a5aaec7d and changes these calls to read the icon from the title's package. This PR keeps the current behaviour; that is a separate change, and it is not a reason to change this one.

Not verified here:

  • Whether the console returns 0x80553911 for a missing icon. Not measured; the debt entry says so.
  • No build or test was run in this pass: the only change is the PR description, and guest_nptrophy2 was not re-run.
  • Not run on Windows or macOS.

@github-actions github-actions Bot added the docs label Nov 24, 2026
Superseabas added a commit to Superseabas/AnyPS5 that referenced this pull request Nov 24, 2026
Superseabas added a commit to Superseabas/AnyPS5 that referenced this pull request Nov 24, 2026
…ykopovar#15314

The game, group and trophy icons are read from trophyNN.ucp, so the
Silent stubs entry boykopovar#15314 adds for them no longer holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Superseabas

Copy link
Copy Markdown
Contributor

#19532 now merges a06a91ae53 too, and its debt fragment removes the new Silent stubs entry for sceNpTrophy2GetGameIcon, GetGroupIcon and GetTrophyIcon, as it already did for GetRewardIcon. #19532 reads those icons from trophyNN.ucp, so the "whether or not an icon exists" wording would no longer hold once it lands. tools/debt_fold.py --check passes on its head, and on main with both PRs merged. So either order still works: this one first and #19532 after, or #19532 alone, since it carries your commits.

AI-assisted: yes (Claude Code)

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran guest_nptrophy2 with the patch applied on Linux. It passed the missing-icon cases for the game, group, and trophy APIs, including the zero size outputs and the optional-size case.

AI-assisted: yes.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs prx review queue Next in the maintainer review queue: checks pass, no open change request, no conflict

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants