Map UDS events to trophies from dumped metadata; trophy viewer/overview improvements #1088

Manually merged
github merged 3 commits from gh-pr/1088/head into gh-pr/1088/base 2026-11-26 09:42:33 +00:00
Owner

@⁠Pipe530 on GitHub · 2026-10-05 23:16 UTC · original
Pipe530:pipe530-trophy-system-improvements → main · +1076 −182 · 16 files · 3 commits · merged 2026-10-06 13:45 UTC

Trophy events now use the input property, integer type, stat ID, and comparison recorded in the game’s dumped metadata. Supported extraction is limited to unfiltered, top-level unsigned latest values; other rules are skipped without name matching or guessed counter arithmetic.

  • Store trophy records separately in _Trophies/<titleId>/, retaining original UTC unlock timestamps and displaying local dates in the launcher.
  • Share grade-weighted progress calculations between the runtime and launcher.
  • Add the trophy overview, refresh the viewer and notification, conceal locked hidden trophy details, and align trophy/reload toolbar styling.
  • Replace trophy records atomically and cover extraction, comparisons, type mismatches, progress, and persistence with regression tests.

Validation: emulator and launcher build; ctest -R '^trophy_system$' passes; all 62 available trophy packages load; real-event target boundaries and toolbar light/dark rendering checked.

**@⁠Pipe530** on GitHub · 2026-10-05 23:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088) `Pipe530:pipe530-trophy-system-improvements` → `main` · +1076 −182 · 16 files · 3 commits · merged 2026-10-06 13:45 UTC Trophy events now use the input property, integer type, stat ID, and comparison recorded in the game’s dumped metadata. Supported extraction is limited to unfiltered, top-level unsigned `latest` values; other rules are skipped without name matching or guessed counter arithmetic. - Store trophy records separately in `_Trophies/<titleId>/`, retaining original UTC unlock timestamps and displaying local dates in the launcher. - Share grade-weighted progress calculations between the runtime and launcher. - Add the trophy overview, refresh the viewer and notification, conceal locked hidden trophy details, and align trophy/reload toolbar styling. - Replace trophy records atomically and cover extraction, comparisons, type mismatches, progress, and persistence with regression tests. Validation: emulator and launcher build; `ctest -R '^trophy_system$'` passes; all 62 available trophy packages load; real-event target boundaries and toolbar light/dark rendering checked.
Correlate each UDS event to its stat ID (uds00.ucp) and trophy target (trophy00.ucp) instead of a hard-coded event, store trophy JSON with unlock date/time outside _SaveData, and add a PS5-style toast, viewer and overview.

Co-authored-by: Copilot App <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:42:32 +00:00
github manually merged commit 345ef50b0f into gh-pr/1088/base 2026-11-26 09:42:33 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 23:23 UTC · original · edited 2026-10-06 13:50 UTC

Review in Change Stack →

📝 Walkthrough

Walkthrough

The trophy system now parses UDS event mappings, matches event counters to eligible trophies, and saves unlock dates. The launcher adds a game-level trophy overview and per-package trophy details, including progress, grades, earned dates, and hidden-trophy masking. Trophy notifications also receive a visual update, and a dedicated CTest executable covers package parsing, UDS mappings, and unlock persistence.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Feature

Merge Risk: 🟡 Moderate · up to f53bc

Existing trophies can appear locked, an unmapped event can incorrectly award a trophy, and the documented test workflow can fail. Resolve these issues before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f53bc

The identified risk is limited to local trophy history. The new save replacement can lose an existing record if interrupted or if the final rename fails. Moving storage also separates new trophy history from records in the previous location.

Retained concerns

  • Medium · reliability · inferred: Unlock persistence now deletes the existing destination before installing the completed temporary file. Interruption after deletion can strand the previous history, and rename failure followed by temporary-file cleanup can discard both versions. The loss affects the entire title/user/service record, rather than only the latest unlock. This weakens recovery and failure containment compared with the base’s direct filesystem rename.
Security review details

Security Blast Radius

  • inferred — The new event path reaches local unlock records and notifications for additional package-defined trophy categories. Each persistence operation replaces one title/user/service record. User and service values come from context inputs; filename scoping alone does not establish authenticated user isolation.

Trust Boundaries and Controls

  • observed — Registered-context checks and package membership constrain event-to-unlock processing. Counter thresholds and name matching are correlation rules, not independent proof of achievement: event names and counter properties are supplied through the guest-facing event API.

Resilience and Maintainability Implications

  • inferred — The newly destructive replacement compounds an existing recovery limitation: unlock state advances before saving, save failure only logs, and notifications still occur. Repeating the same unlock does not retry persistence in that process. This caller behavior predates the PR, but now operates with a replacement path that can remove previously valid history.

Hardening Proposals

  • proposed — Preserve the previous record until a platform-appropriate atomic replacement succeeds. Keep failed updates pending for retry, or commit authoritative in-memory state only after successful persistence, so notifications and duplicate suppression do not conceal an unsaved transition.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 9 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the data-driven UDS event-to-trophy mapping and the trophy viewer improvements.
Description check ✅ Passed The description covers the UDS metadata mapping, trophy persistence, viewer and overview changes, and regression tests described in the pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 9 files. (3 skipped: 3 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 23:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088#issuecomment-6005325427) · edited 2026-10-06 13:50 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1088?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The trophy system now parses UDS event mappings, matches event counters to eligible trophies, and saves unlock dates. The launcher adds a game-level trophy overview and per-package trophy details, including progress, grades, earned dates, and hidden-trophy masking. Trophy notifications also receive a visual update, and a dedicated CTest executable covers package parsing, UDS mappings, and unlock persistence. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"f53bce41c18f30744232d6ea527c31b5abb4a1e2" --> **Change:** Feature <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🟡 Moderate_ · up to `f53bc` <!-- final_review_risk_coverage:{"sourceCommitId":"f53bce41c18f30744232d6ea527c31b5abb4a1e2","coveredCommitId":"f53bce41c18f30744232d6ea527c31b5abb4a1e2","kind":"reviewed"} --> Existing trophies can appear locked, an unmapped event can incorrectly award a trophy, and the documented test workflow can fail. Resolve these issues before merging. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `f53bc` The identified risk is limited to local trophy history. The new save replacement can lose an existing record if interrupted or if the final rename fails. Moving storage also separates new trophy history from records in the previous location. **Retained concerns** - **Medium · reliability · inferred:** Unlock persistence now deletes the existing destination before installing the completed temporary file. Interruption after deletion can strand the previous history, and rename failure followed by temporary-file cleanup can discard both versions. The loss affects the entire title/user/service record, rather than only the latest unlock. This weakens recovery and failure containment compared with the base’s direct filesystem rename. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The new event path reaches local unlock records and notifications for additional package-defined trophy categories. Each persistence operation replaces one title/user/service record. User and service values come from context inputs; filename scoping alone does not establish authenticated user isolation. **Trust Boundaries and Controls** - _observed_ — Registered-context checks and package membership constrain event-to-unlock processing. Counter thresholds and name matching are correlation rules, not independent proof of achievement: event names and counter properties are supplied through the guest-facing event API. **Resilience and Maintainability Implications** - _inferred_ — The newly destructive replacement compounds an existing recovery limitation: unlock state advances before saving, save failure only logs, and notifications still occur. Repeating the same unlock does not retry persistence in that process. This caller behavior predates the PR, but now operates with a replacement path that can remove previously valid history. **Hardening Proposals** - _proposed_ — Preserve the previous record until a platform-appropriate atomic replacement succeeds. Keep failed updates pending for retry, or commit authoritative in-memory state only after successful persistence, so notifications and duplicate suppression do not conceal an unsaved transition. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 9 files. (3 skipped: 3… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Title check | ✅ Passed | The title clearly summarizes the data-driven UDS event-to-trophy mapping and the trophy viewer improvements. | | Description check | ✅ Passed | The description covers the UDS metadata mapping, trophy persistence, viewer and overview changes, and regression tests described in the pull request. | </details> <details> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 6.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 9 files. (3 skipped: 3 unsupported.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1088)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -413,6 +413,12 @@ add_executable(archive_file_tests EXCLUDE_FROM_ALL
target_link_libraries(archive_file_tests common ZArchive::zarchive)
target_include_directories(archive_file_tests PRIVATE ${inc_headers})
add_executable(trophy_system_tests EXCLUDE_FROM_ALL
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 23:23 UTC · original

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add trophy_system_tests to the kyty_tests target.

The executable is EXCLUDE_FROM_ALL. The kyty_tests aggregate target at Line 684-713 does not list it. A workflow that builds kyty_tests and then runs ctest will fail trophy_system because the binary is missing.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 23:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088#discussion_r4189894625) **📐 Maintainability & Code Quality** | **🟡 Minor** | **⚡ Quick win** **Add `trophy_system_tests` to the `kyty_tests` target.** The executable is `EXCLUDE_FROM_ALL`. The `kyty_tests` aggregate target at Line 684-713 does not list it. A workflow that builds `kyty_tests` and then runs `ctest` will fail `trophy_system` because the binary is missing. <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:d0153cbd702940a0d594cfa7 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -211,3 +248,3 @@
return {};
}
return root / "_SaveData" / title_id /
return root / "_Trophies" / title_id /
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 23:23 UTC · original

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Migrate or read existing unlock files from _SaveData.

UnlocksPath now resolves to _Trophies/<title_id> only. Users with unlocks saved under _SaveData/<title_id> from earlier builds will see their trophies as locked. A later unlock then writes a new file that does not contain the earlier unlocks. Add a fallback: if the new file is missing, load the legacy path, and save the result to the new path.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 23:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088#discussion_r4189894629) **🗄️ Data Integrity & Integration** | **🟠 Major** | **⚡ Quick win** **Migrate or read existing unlock files from `_SaveData`.** `UnlocksPath` now resolves to `_Trophies/<title_id>` only. Users with unlocks saved under `_SaveData/<title_id>` from earlier builds will see their trophies as locked. A later unlock then writes a new file that does not contain the earlier unlocks. Add a fallback: if the new file is missing, load the legacy path, and save the result to the new path. <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:e4549d1bfea628cd655779eb --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -264,0 +426,4 @@
}
}
return ids;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 23:23 UTC · original

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '330,420p' src/common/trophies.cpp
sed -n '740,770p' src/libs/libTrophy.cpp
sed -n '85,138p' tests/TrophySystemTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 7454


🏁 Script executed:

printf '%s\n' '--- declarations and callers ---'
rg -n -F -- 'FindUdsTrophy' src tests docs README* 2>/dev/null || test "$?" -le 1
rg -n -F -- 'event_stats' src/common src/libs tests docs README* 2>/dev/null || test "$?" -le 1
printf '%s\n' '--- fallback intent / UDS documentation ---'
rg -ni -- 'fallback|similar|similarity|stats_extraction|UDS event|universal data system|uds' docs src tests README* 2>/dev/null || test "$?" -le 1
printf '%s\n' '--- PR diff for relevant files ---'
git diff --unified=30 cdb64bfd4fb4d5312b2542a41a0070f25663166a f53bce41c18f30744232d6ea527c31b5abb4a1e2 -- src/common/trophies.cpp src/libs/libTrophy.cpp tests/TrophySystemTests.cpp
printf '%s\n' '--- current package loading and counter caller ---'
rg -n -C 8 -- 'LoadPackage|LoadUdsEventStats|FindUdsTrophies|RecordTrophyUnlock' src/common/trophies.cpp src/libs/libTrophy.cpp

Repository: KytyPS5/KytyPS5

Length of output: 41887


🏁 Script executed:

printf '%s\n' '--- similarity tokenization and matching ---'
nl -ba src/common/trophies.cpp | sed -n '300,410p'
printf '%s\n' '--- runtime load intent and unlock persistence ---'
nl -ba src/libs/libTrophy.cpp | sed -n '138,165p;248,275p;747,765p'
printf '%s\n' '--- test fixture and mapped-event checks ---'
nl -ba tests/TrophySystemTests.cpp | sed -n '48,135p'
printf '%s\n' '--- persistence save path after unlock ---'
rg -n -C 5 -- 'SaveUnlockData|state\.unlocks|unlocks\.unlocked' src/libs/libTrophy.cpp

Repository: KytyPS5/KytyPS5

Length of output: 16408


🏁 Script executed:

rg -n -F -- 'Words(' src/common/trophies.cpp
nl -ba src/common/trophies.cpp | sed -n '1,105p'
nl -ba src/common/trophies.cpp | sed -n '385,420p'

Repository: KytyPS5/KytyPS5

Length of output: 5839


Use name matching only when no UDS mappings are available.

When event_stats is nonempty but lacks the counter event, FindUdsTrophies still calls FindUdsTrophy. For example, COOLING__DIVED_FROM_DIVING_BOARD can match trophy 30 at counter 1. The runtime caller then records and saves the unlock, although the loaded mapping does not associate that event with a stat. Restrict name matching to an empty mapping.

Suggested fix
-	const auto stat = package.event_stats.find(std::string(event_name));
-	if (stat == package.event_stats.end()) {
+	if (package.event_stats.empty()) {
 		const auto fallback = FindUdsTrophy(package, event_name, counter);
 		return fallback ? std::vector<int> {*fallback} : std::vector<int> {};
 	}
+	const auto stat = package.event_stats.find(std::string(event_name));
+	if (stat == package.event_stats.end()) {
+		return {};
+	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

std::vector<int> FindUdsTrophies(const Package& package, std::string_view event_name,
                                 uint64_t counter) {
	if (package.event_stats.empty()) {
		const auto fallback = FindUdsTrophy(package, event_name, counter);
		return fallback ? std::vector<int> {*fallback} : std::vector<int> {};
	}
	const auto stat = package.event_stats.find(std::string(event_name));
	if (stat == package.event_stats.end()) {
		return {};
	}
	std::vector<int> ids;
	for (const auto& [id, trophy]: package.trophies) {
		if (trophy.uds_stat_id && stat->second.contains(*trophy.uds_stat_id) && trophy.target && counter >= *trophy.target) {
			ids.push_back(id);
		}
	}
	return ids;
}
**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 23:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088#discussion_r4189894642) **🗄️ Data Integrity & Integration** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '330,420p' src/common/trophies.cpp sed -n '740,770p' src/libs/libTrophy.cpp sed -n '85,138p' tests/TrophySystemTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 7454 --- 🏁 Script executed: ```bash printf '%s\n' '--- declarations and callers ---' rg -n -F -- 'FindUdsTrophy' src tests docs README* 2>/dev/null || test "$?" -le 1 rg -n -F -- 'event_stats' src/common src/libs tests docs README* 2>/dev/null || test "$?" -le 1 printf '%s\n' '--- fallback intent / UDS documentation ---' rg -ni -- 'fallback|similar|similarity|stats_extraction|UDS event|universal data system|uds' docs src tests README* 2>/dev/null || test "$?" -le 1 printf '%s\n' '--- PR diff for relevant files ---' git diff --unified=30 cdb64bfd4fb4d5312b2542a41a0070f25663166a f53bce41c18f30744232d6ea527c31b5abb4a1e2 -- src/common/trophies.cpp src/libs/libTrophy.cpp tests/TrophySystemTests.cpp printf '%s\n' '--- current package loading and counter caller ---' rg -n -C 8 -- 'LoadPackage|LoadUdsEventStats|FindUdsTrophies|RecordTrophyUnlock' src/common/trophies.cpp src/libs/libTrophy.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 41887 --- 🏁 Script executed: ```bash printf '%s\n' '--- similarity tokenization and matching ---' nl -ba src/common/trophies.cpp | sed -n '300,410p' printf '%s\n' '--- runtime load intent and unlock persistence ---' nl -ba src/libs/libTrophy.cpp | sed -n '138,165p;248,275p;747,765p' printf '%s\n' '--- test fixture and mapped-event checks ---' nl -ba tests/TrophySystemTests.cpp | sed -n '48,135p' printf '%s\n' '--- persistence save path after unlock ---' rg -n -C 5 -- 'SaveUnlockData|state\.unlocks|unlocks\.unlocked' src/libs/libTrophy.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 16408 --- 🏁 Script executed: ```bash rg -n -F -- 'Words(' src/common/trophies.cpp nl -ba src/common/trophies.cpp | sed -n '1,105p' nl -ba src/common/trophies.cpp | sed -n '385,420p' ``` Repository: KytyPS5/KytyPS5 Length of output: 5839 --- </details> **Use name matching only when no UDS mappings are available.** When `event_stats` is nonempty but lacks the counter event, `FindUdsTrophies` still calls `FindUdsTrophy`. For example, `COOLING__DIVED_FROM_DIVING_BOARD` can match trophy 30 at counter 1. The runtime caller then records and saves the unlock, although the loaded mapping does not associate that event with a stat. Restrict name matching to an empty mapping. <details> <summary>Suggested fix</summary> ```diff - const auto stat = package.event_stats.find(std::string(event_name)); - if (stat == package.event_stats.end()) { + if (package.event_stats.empty()) { const auto fallback = FindUdsTrophy(package, event_name, counter); return fallback ? std::vector<int> {*fallback} : std::vector<int> {}; } + const auto stat = package.event_stats.find(std::string(event_name)); + if (stat == package.event_stats.end()) { + return {}; + } ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion std::vector<int> FindUdsTrophies(const Package& package, std::string_view event_name, uint64_t counter) { if (package.event_stats.empty()) { const auto fallback = FindUdsTrophy(package, event_name, counter); return fallback ? std::vector<int> {*fallback} : std::vector<int> {}; } const auto stat = package.event_stats.find(std::string(event_name)); if (stat == package.event_stats.end()) { return {}; } std::vector<int> ids; for (const auto& [id, trophy]: package.trophies) { if (trophy.uds_stat_id && stat->second.contains(*trophy.uds_stat_id) && trophy.target && counter >= *trophy.target) { ids.push_back(id); } } return ids; } ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b5f43eec9e2ccd87424f7483 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 23:23 UTC · original · reviewed

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6825413-d396-4b39-bd03-3de4da2e25a6
📥 Commits

Reviewing files that changed from the base of the PR and between cdb64bfd4f and f53bce41c18f30744232d6ea527c31b5abb4a1e2.

⛔ Files ignored due to path filters (2)
  • assets/images/hidden-trophy.png is excluded by !**/*.png
  • src/launcher/icons/trophy.svg is excluded by !**/*.svg
📒 Files selected for processing (12)
  • CMakeLists.txt
  • src/common/trophies.cpp
  • src/common/trophies.h
  • src/graphics/presentation/systemOverlay.cpp
  • src/launcher/forms/configuration_list_widget.ui
  • src/launcher/include/configurationListWidget.h
  • src/launcher/include/trophyViewerDialog.h
  • src/launcher/resources.qrc
  • src/launcher/src/configurationListWidget.cpp
  • src/launcher/src/trophyViewerDialog.cpp
  • src/libs/libTrophy.cpp
  • tests/TrophySystemTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 23:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1088#pullrequestreview-5421880971) · **reviewed** **Actionable comments posted: 3** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `e6825413-d396-4b39-bd03-3de4da2e25a6` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between cdb64bfd4fb4d5312b2542a41a0070f25663166a and f53bce41c18f30744232d6ea527c31b5abb4a1e2. </details> <details> <summary>⛔ Files ignored due to path filters (2)</summary> * `assets/images/hidden-trophy.png` is excluded by `!**/*.png` * `src/launcher/icons/trophy.svg` is excluded by `!**/*.svg` </details> <details> <summary>📒 Files selected for processing (12)</summary> * `CMakeLists.txt` * `src/common/trophies.cpp` * `src/common/trophies.h` * `src/graphics/presentation/systemOverlay.cpp` * `src/launcher/forms/configuration_list_widget.ui` * `src/launcher/include/configurationListWidget.h` * `src/launcher/include/trophyViewerDialog.h` * `src/launcher/resources.qrc` * `src/launcher/src/configurationListWidget.cpp` * `src/launcher/src/trophyViewerDialog.cpp` * `src/libs/libTrophy.cpp` * `tests/TrophySystemTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=a1bdbaef-ac81-498f-b49a-cfd8cf3ea995 attempt=3304c465-acf1-4dfa-b033-a54071adf3b5 batch=1/1 -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.