trophy: support count, sum and min UDS stats (Prince of Persia: The L… #2122
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2122
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2122/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Alexey-Izilianov on GitHub · 2026-11-05 07:46 UTC · original
Alexey-Izilianov:trophy-uds-aggregated-stats→main· +274 −76 · 4 files · 2 commits · closed without mergingCompletes the UDS stat support from #1705.
Game: Prince of Persia: The Lost Crown (PPSA10067)
Problem: #1705 showed the game's
uds00.ucpcarriescountstatisticsbeside the int64 maximum landed in
7e70761f.LoadUdsRulesstill skips everysum,countandminaggregation, so those trophies can never unlock; thereported
UpdateNbSpikesKillsevent only reaches the game's maximum stat.Change:
UdsRulereplaces itsmaximumflag with anAggregation(latest, max,min, sum, count).
LoadUdsRulesaccepts unsignedsum,minandcountdefinitions; signedint64stats stay restricted tomaxwith an explicitminValue, exactlyas before. Count extraction rules need no
action.input— they tallymatching events. Bounded definitions (with a non-default range) are still
skipped, because their clamping semantics are unverified.
ApplyUdsEventaggregates accordingly: maxima keep their initial-valuefloor, minima start from the first event and only drop, sums and counts
accumulate from their
initialValuewith saturation at the stat type'srange instead of overflowing, and the accumulated value feeds the trophy
conditions as before.
UnlockData::stats, saved asstatValues; the previousmaxStatssave key still loads, so existing unlock files keep their data.NpUniversalDataSystemPostEventnow feeds every event (not only events withinteger properties) into the rules, since count rules see events without
properties. Guests still never record or save anything.
TrophyProgressreports no progress forle/ltconditions: a value thatdrops toward its target has no rising progress to show. Reported progress
(
_UpdateTrophyProgress) and other conditions behave as before.Testing:
trophy_system_testsgainsTestAggregatedStats: maxima with seed,width-mismatched inputs, count events with and without properties, initial
values seeding sums and tallies, sum accumulation with strict threshold,
saturation for both the stat range and a narrower type, min behaviour
including the
leboundary, persistence round-trip, and loading an oldmaxStatssave file.sum rules to be accepted.
launcher builds).
welcome, especially for one of the kill-count trophies of #1705.
@coderabbitai[bot] on GitHub · 2026-11-05 07:50 UTC · original · edited 2026-11-05 08:14 UTC
Walkthrough
UDS rules now support
latest,max,min,sum, andcountaggregations. Event processing updates a unified stats map, including count rules for events without integer properties. Unlock data saves values asstatValuesand can load the legacymaxStatskey. Trophy progress reads the unified stats map.Suggested reviewers:
nmzik,pipe530Change: Feature
Merge Risk:
Low · up to
29034Some trophies can show zero progress despite a configured starting value. Initialize those stats on load before merging, or accept this bounded display issue.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 15 functions across 4 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
@coderabbitai[bot] on GitHub · 2026-11-05 07:50 UTC · original · reviewed
6e629155-9701-4e12-afdc-e3b3a521d151Reviewing files that changed from the base of the PR and between
07e87b950aand5798379817.src/common/trophies.cppsrc/common/trophies.hsrc/libs/libTrophy.cpptests/TrophySystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -168,2 +168,2 @@if (rule.maximum) {auto& value = unlocks.max_stats[rule.stat_id];if (rule.aggregation == Trophies::Aggregation::Max) {auto& value = unlocks.stats[rule.stat_id];@coderabbitai[bot] on GitHub · 2026-11-05 08:14 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 14333
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42339
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42652
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 22848
Initialize
SumandCountstats when loading trophy state.When a progressive trophy references a
SumorCountrule with a nonzeroinitialValue,NpTrophy2GetTrophyInforeports progress0until the first matching event.LoadTrophyStatealready makes the configured initial value visible forMaxrules. Apply the same load-boundary initialization toSumandCount.Suggested fix
Committable suggestion
@coderabbitai[bot] on GitHub · 2026-11-05 08:14 UTC · original · reviewed
Actionable comments posted: 1
42d5bb22-c163-4ab8-9324-c033867cc998Reviewing files that changed from the base of the PR and between
07e87b950aand29034ab6b0.src/common/trophies.cppsrc/common/trophies.hsrc/libs/libTrophy.cpptests/TrophySystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
@Nmzik on GitHub · 2026-11-05 10:52 UTC · original
Game doesnt utilize any of it
Pull request closed