Skip to content

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

Open
Thimo188 wants to merge 3 commits into
mainfrom
upstream-pr/15314
Open

Thimo188 wants to merge 3 commits into
mainfrom
upstream-pr/15314

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#15314, originally opened by MarcZX10.

Source commit: a06a91ae53144a79426b006fb4c64b6d765dba0b. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


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

Summary by CodeRabbit

  • Bug Fixes

    • Game, group, and trophy icon lookups now return a file-not-found error when an icon is unavailable, rather than causing an exception. The supplied size is reset to zero when applicable.
  • Documentation

    • Clarified the behavior of icon lookups when icon files are unavailable.

MarcZX10 and others added 3 commits November 2, 2026 23:26
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.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Trophy icon error handling

Layer / File(s) Summary
Icon error returns and checks
core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp, core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp, core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp, core/libs/tests/GuestNpTrophy2.cpp, docs/dev/debt/libSceNpTrophy2.md
The three icon functions return the icon-file-not-found error instead of throwing. Tests check the error returns and size reset. The documentation describes the functions as silent stubs and notes that the error value is inferred from sibling calls, not measured on-console.

Suggested reviewers: boykopovar, eaglebearerys

Change: Bug fix

Merge Risk: Minimal · up to a06a9

Missing trophy icons now return an error code instead of throwing an exception. The change is small and tested, and I found no merge-blocking risk.

Security architecture risk: Minimal · up to a06a9

Guest titles now receive an icon-not-found result instead of a C++ exception. The getters still do not load icons or change trophy state, and the PR does not add a new way for guests to access host data. Compatibility with the console’s exact error response remains unverified.

Security review details

Security Blast Radius

  • inferred — The reviewed production change affects how callers receive failure from the same three guest exports. It creates no new input-dependent path to a file read, icon-buffer write, or persistent state change in those getters.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 5
  • Waived: $1.25 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8913c6e8-0764-41bc-8331-4e4fba3e5c45
Commits

Reviewing files that changed from the base of the PR and between 5cf487d and a06a91a.

Files selected for processing: 5

  • core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp
  • core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp
  • core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp
  • core/libs/tests/GuestNpTrophy2.cpp
  • docs/dev/debt/libSceNpTrophy2.md

Limit details: You’ve used all 10 included reviews currently available.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants