fix(libSceNpTrophy2): accept greater-than filters in stat rules #18640

Merged
JJenkx merged 1 commit from upstream-pr/18640 into main 2026-11-12 14:17:31 +00:00
JJenkx commented 2026-11-11 23:28:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-11T23:28:16Z.


What

ParseStatRules keeps a statistics rule filtered by an event property only when the comparator is ==. Two titles here filter the rules for progressive trophies with >:

  • Demon's Souls (PPSA01341) feeds its three collection trophies (udsStatId 152, 153 and 154, targets 22, 30 and 12, all progressive) from DsCollection events:
    {"condition":{"eventName":"DsCollection","property":{"path":"$.rings","comparator":">","value":"-1"}},
     "action":{"input":"$.rings","output":{"statId":153}}}
    
  • Horizon Call of the Mountain (PPSA05666) feeds stats 24, 29 and 82 from ShotBlazeTarget, BuiltCairn and CompletedClimb with > 0. Each stat backs one progressive trophy and one other.

These rules are now skipped with a [trophy] ... filters DsCollection by more than its eventName line, so those six trophies never show progress, and a progressive trophy unlocks only through its statistic.

This adds a > filter with an integer bound, which may be negative. A property passes when its value is an integer above the bound. A negative property is read from its text, since an event property stores only non-negative values as numbers. Other comparators, and bounds that are not integers, are still skipped. == and > are the only comparators in the rule files of the 116 extracted titles here that have one.

Tested

  • np_trophy2_package_tests: the new testGreaterFilters keeps > -1 and > 0 rules, skips > with a non-integer bound and >=, and checks that a value equal to the bound does not pass, that a value above a negative bound passes, and that a latest stat is not reset by a value at the bound. It fails on main at the first check and passes with this change.
  • All 13 trophy and UDS tests (ctest -R 'trophy|uds|universal') pass on this head (43a54ba501), Linux, GCC 16, Release.
  • Not seen in a game: Demon's Souls does not post DsCollection in the first two minutes after boot, and no run here reached a point where it writes a trophy record.

#18642 also changes readRule and the libSceNpTrophy2 debt file. The code merges cleanly with it, but the two debt entries are on adjacent lines, so whichever lands second needs a one-line rebase.

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:5268383291 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18640). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-11T23:28:16Z. --- ### What `ParseStatRules` keeps a statistics rule filtered by an event property only when the comparator is `==`. Two titles here filter the rules for progressive trophies with `>`: - Demon's Souls (PPSA01341) feeds its three collection trophies (`udsStatId` 152, 153 and 154, targets 22, 30 and 12, all `progressive`) from `DsCollection` events: ```json {"condition":{"eventName":"DsCollection","property":{"path":"$.rings","comparator":">","value":"-1"}}, "action":{"input":"$.rings","output":{"statId":153}}} ``` - Horizon Call of the Mountain (PPSA05666) feeds stats 24, 29 and 82 from `ShotBlazeTarget`, `BuiltCairn` and `CompletedClimb` with `> 0`. Each stat backs one progressive trophy and one other. These rules are now skipped with a `[trophy] ... filters DsCollection by more than its eventName` line, so those six trophies never show progress, and a progressive trophy unlocks only through its statistic. This adds a `>` filter with an integer bound, which may be negative. A property passes when its value is an integer above the bound. A negative property is read from its text, since an event property stores only non-negative values as numbers. Other comparators, and bounds that are not integers, are still skipped. `==` and `>` are the only comparators in the rule files of the 116 extracted titles here that have one. ### Tested - `np_trophy2_package_tests`: the new `testGreaterFilters` keeps `> -1` and `> 0` rules, skips `>` with a non-integer bound and `>=`, and checks that a value equal to the bound does not pass, that a value above a negative bound passes, and that a `latest` stat is not reset by a value at the bound. It fails on main at the first check and passes with this change. - All 13 trophy and UDS tests (`ctest -R 'trophy|uds|universal'`) pass on this head (`43a54ba501`), Linux, GCC 16, Release. - Not seen in a game: Demon's Souls does not post `DsCollection` in the first two minutes after boot, and no run here reached a point where it writes a trophy record. ### Related #18642 also changes `readRule` and the libSceNpTrophy2 debt file. The code merges cleanly with it, but the two debt entries are on adjacent lines, so whichever lands second needs a one-line rebase. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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
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!18640
No description provided.