Events other than the trophy events go through the title's
sce_sys/uds/udsNN.ucp: stats_definition.json gives the statistics that
keep their latest uint32 or uint64 value, and stats_extraction.json the
event property ($.name, dotted for nested objects) that sets each one.
Statistics are kept per user and service label in
_trophy/<user id>_<service label>.stats.txt next to the unlocks.
After each event that sets a statistic, every trophy's unlockCondition
(ge, gt, le or lt against its targetValue) is checked on the values that
event set and the stored values of the other statistics, so a later
event setting the same statistic cannot hide what this one reached.
Reached trophies unlock through the same path as _UnlockTrophy.
Progressive trophies report their statistic as progress, and
APS5_TRACE_UDS prints each statistic an event sets. A missing udsNN.ucp
is ignored and a malformed one is logged once.
Events and property objects keep their typed properties instead of
dropping them. PostEvent records an _UnlockTrophy event with an int32
_trophy_id for the user and service label of its context, logs why a
trophy event is ignored, and prints every posted event with
APS5_TRACE_UDS.
The title's sce_sys/trophy2/trophyNN.ucp is read on first use with a
bounds-checked .ucp reader and a small JSON reader. tropconf.json gives
each trophy's grade, group, hidden and reward flags, platinum and
unlock condition, and tropmeta_<tag>.json its texts in the console
language, then en-US, then the file's default language. Contexts
remember their user and service label, so the queries find the file.
The trophy, group and game queries report these names, grades, groups
and counts, list every trophy and group, and give progressive trophies
their target. Unlocks are not recorded yet, so every trophy reports as
locked and nothing is written to the host. A missing file is ignored
and a malformed one is logged once; either way the queries keep their
placeholders. A JSON document that nests deeper than 64 levels or holds
more than 1048576 values counts as malformed, which keeps the parsed
values to about 140 MiB.