feat(loader): support local DLC entitlement configuration #1697

Closed
github-bot wants to merge 2 commits from gh-pr/1697/head into gh-pr/1697/base
Owner

@⁠herrMirto on GitHub · 2026-10-19 09:39 UTC · original
herrMirto:feat/local-additional-content-entitlements → main · +262 −18 · 8 files · 2 commits · closed without merging

Read license-only PSAL/NO_EXTRA_DATA entries from app0/dlc_emu.ini
and expose them through additional-content lookup and listing APIs.

This supports DLC content already included in the game files and local
mod testing that depends on additional-content entitlement queries.

  • Filter entries by game title and service label.
  • Keep license-only entries separate from installed DLC packages.
  • Prefer installed content when entitlement labels collide.
  • Reject malformed and unsupported configuration entries.
  • Add regression coverage for parsing, lookup, listing and reload.

This does not install DLC files, load mods, or provide online entitlement
validation.

**@⁠herrMirto** on GitHub · 2026-10-19 09:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1697) `herrMirto:feat/local-additional-content-entitlements` → `main` · +262 −18 · 8 files · 2 commits · closed without merging Read license-only PSAL/NO_EXTRA_DATA entries from app0/dlc_emu.ini and expose them through additional-content lookup and listing APIs. This supports DLC content already included in the game files and local mod testing that depends on additional-content entitlement queries. - Filter entries by game title and service label. - Keep license-only entries separate from installed DLC packages. - Prefer installed content when entitlement labels collide. - Reject malformed and unsupported configuration entries. - Add regression coverage for parsing, lookup, listing and reload. This does not install DLC files, load mods, or provide online entitlement validation.
Use the archive-aware file API to read dlc_emu.ini and enforce the
64 KiB limit against the opened member's uncompressed size. Reject
incomplete reads before parsing local entitlement declarations.

Add archive-backed entitlement regressions and a focused headless test
mode. Document the loader, parser, API responses and fixture contracts.

Validation:
- kernel_file_system_tests --add-content-only passed.
- archive_file_tests passed.
- git diff --check passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:03:35 +00:00
github-bot closed this pull request 2026-11-26 10:03:35 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 10:02 UTC · original · edited 2026-10-19 12:21 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a0660fa4-51b8-4d7f-b88b-0daaf9a84b40
📥 Commits

Reviewing files that changed from the base of the PR and between bef220fbf0 and bec42cfff1.

📒 Files selected for processing: 8
  • src/common/additionalContent.cpp
  • src/common/additionalContent.h
  • src/emulator.cpp
  • src/libs/libNpEntitlementAccess.cpp
  • src/loader/additionalContent.cpp
  • src/loader/additionalContent.h
  • tests/ArchiveTestFixture.h
  • tests/KernelFileSystemTests.cpp
🚧 Files skipped from review as they are similar to previous changes: 4
  • src/common/additionalContent.h
  • src/emulator.cpp
  • src/loader/additionalContent.h
  • src/libs/libNpEntitlementAccess.cpp

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

📝 Walkthrough

The change reads validated, title-local PSAL entries from dlc_emu.ini and loads them alongside add-on content. Local entries that match installed add-content labels are removed. Entitlement lookups and listings expose remaining local entries for service label 0 with license-only package type and download status values. Tests cover parsing, API behavior, title reloads, file-size limits, archive-backed configurations, and installed-entry precedence.

Suggested reviewers: pipe530

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to bec42

No actionable issue remains identified for this change; it is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: loader support for local DLC entitlement configuration.
Description check Passed The description directly explains the local entitlement parsing, filtering, API exposure, precedence rules, validation, and regression coverage described by the changeset.
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.
  • Autofix · 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-19 10:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1697#issuecomment-6264654135) · edited 2026-10-19 12:21 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/1697?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `a0660fa4-51b8-4d7f-b88b-0daaf9a84b40` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between bef220fbf0270d2e66220a537b19410f59079854 and bec42cfff17089e2d7246212b0161442568b394a. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 8</strong></summary> <dl> <dd> * `src/common/additionalContent.cpp` * `src/common/additionalContent.h` * `src/emulator.cpp` * `src/libs/libNpEntitlementAccess.cpp` * `src/loader/additionalContent.cpp` * `src/loader/additionalContent.h` * `tests/ArchiveTestFixture.h` * `tests/KernelFileSystemTests.cpp` </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes: 4</strong></summary> <dl> <dd> * src/common/additionalContent.h * src/emulator.cpp * src/loader/additionalContent.h * src/libs/libNpEntitlementAccess.cpp </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The change reads validated, title-local PSAL entries from `dlc_emu.ini` and loads them alongside add-on content. Local entries that match installed add-content labels are removed. Entitlement lookups and listings expose remaining local entries for service label 0 with license-only package type and download status values. Tests cover parsing, API behavior, title reloads, file-size limits, archive-backed configurations, and installed-entry precedence. **Suggested reviewers:** `pipe530` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"bec42cfff17089e2d7246212b0161442568b394a" --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>bec42</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `bec42` --> <!-- final_review_risk_coverage:{"sourceCommitId":"bec42cfff17089e2d7246212b0161442568b394a","coveredCommitId":"bec42cfff17089e2d7246212b0161442568b394a","kind":"reviewed"} --> No actionable issue remains identified for this change; it is mergeable after normal checks. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 8 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely identifies the main change: loader support for local DLC entitlement configuration. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the local entitlement parsing, filtering, API exposure, precedence rules, validation, and regression coverage described by the changeset. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> </dd> </dl> </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">Autofix</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=1697)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [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) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 10:02 UTC · original · edited 2026-10-19 12:18 UTC
On src/common/additionalContent.cpp line 116 (outdated):

@@ -109,4 +109,75 @@ std::vector<AddContentEntry> FindAddContent(const std::filesystem::path& dir,
 	return entries;
 }
 
+std::vector<AddContentEntry> ReadLocalEntitlements(const std::filesystem::path& file,
+                                                  const std::string& title_id) {
+	std::error_code ec;
+	const auto size = std::filesystem::file_size(file, ec);
+	if (title_id.size() != 9 || ec || size > 64 * 1024) {

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect how app0_dir is constructed and whether archive roots reach Emulator::Run.
rg -n -C 4 'MakeArchivePath\s*\(|app0_dir\s*=|RunOptions\s*\{' src tests
rg -n -C 3 'ReadLocalEntitlements\s*\(|Common::File::Size\s*\(' src tests

Repository: KytyPS5/KytyPS5

Length of output: 14003


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- src/common/additionalContent.cpp ---'
nl -ba src/common/additionalContent.cpp | sed -n '108,190p'
printf '%s\n' '--- src/loader/additionalContent.cpp ---'
nl -ba src/loader/additionalContent.cpp | sed -n '1,32p'
printf '%s\n' '--- Emulator::Run and AddContentLoad callers ---'
rg -n -C 8 -F -e 'AddContentLoad(' -e 'Emulator::Run(' -e 'RunOptions' src
printf '%s\n' '--- archive-aware API declarations ---'
nl -ba src/common/file.h | sed -n '1,150p'
nl -ba src/common/archive.h | sed -n '25,50p'

Repository: KytyPS5/KytyPS5

Length of output: 16805


Read archive-backed title configurations through the repository file API.

Emulator::Run passes archive-backed app0_dir values to AddContentLoad. The resulting dlc_emu.ini path is an archive member, but ReadLocalEntitlements uses std::filesystem::file_size and std::ifstream. The size check or read can fail, so local entitlements are discarded. Use Common::File::Size and Common::File for both operations.

✅ Addressed in commit bec42cf

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 10:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1697#discussion_r4312524387) · edited 2026-10-19 12:18 UTC On `src/common/additionalContent.cpp` line 116 (outdated): ```diff @@ -109,4 +109,75 @@ std::vector<AddContentEntry> FindAddContent(const std::filesystem::path& dir, return entries; } +std::vector<AddContentEntry> ReadLocalEntitlements(const std::filesystem::path& file, + const std::string& title_id) { + std::error_code ec; + const auto size = std::filesystem::file_size(file, ec); + if (title_id.size() != 9 || ec || size > 64 * 1024) { ``` **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect how app0_dir is constructed and whether archive roots reach Emulator::Run. rg -n -C 4 'MakeArchivePath\s*\(|app0_dir\s*=|RunOptions\s*\{' src tests rg -n -C 3 'ReadLocalEntitlements\s*\(|Common::File::Size\s*\(' src tests ``` Repository: KytyPS5/KytyPS5 Length of output: 14003 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- src/common/additionalContent.cpp ---' nl -ba src/common/additionalContent.cpp | sed -n '108,190p' printf '%s\n' '--- src/loader/additionalContent.cpp ---' nl -ba src/loader/additionalContent.cpp | sed -n '1,32p' printf '%s\n' '--- Emulator::Run and AddContentLoad callers ---' rg -n -C 8 -F -e 'AddContentLoad(' -e 'Emulator::Run(' -e 'RunOptions' src printf '%s\n' '--- archive-aware API declarations ---' nl -ba src/common/file.h | sed -n '1,150p' nl -ba src/common/archive.h | sed -n '25,50p' ``` Repository: KytyPS5/KytyPS5 Length of output: 16805 --- </details> **Read archive-backed title configurations through the repository file API.** `Emulator::Run` passes archive-backed `app0_dir` values to `AddContentLoad`. The resulting `dlc_emu.ini` path is an archive member, but `ReadLocalEntitlements` uses `std::filesystem::file_size` and `std::ifstream`. The size check or read can fail, so local entitlements are discarded. Use `Common::File::Size` and `Common::File` for both operations. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:f231a0017fa382c7e754c3ae --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit bec42cf
Author
Owner

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff150479-7f3f-4bcb-8904-d11db3c02e89
📥 Commits

Reviewing files that changed from the base of the PR and between e5f0ee7fc2 and bef220fbf0.

📒 Files selected for processing: 7
  • src/common/additionalContent.cpp
  • src/common/additionalContent.h
  • src/emulator.cpp
  • src/libs/libNpEntitlementAccess.cpp
  • src/loader/additionalContent.cpp
  • src/loader/additionalContent.h
  • tests/KernelFileSystemTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 10:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1697#pullrequestreview-5569902915) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `ff150479-7f3f-4bcb-8904-d11db3c02e89` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between e5f0ee7fc2fb4ce88c6abb2fa02296404e2fe2a6 and bef220fbf0270d2e66220a537b19410f59079854. </details> <details> <summary>📒 Files selected for processing: 7</summary> * `src/common/additionalContent.cpp` * `src/common/additionalContent.h` * `src/emulator.cpp` * `src/libs/libNpEntitlementAccess.cpp` * `src/loader/additionalContent.cpp` * `src/loader/additionalContent.h` * `tests/KernelFileSystemTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=60b80fda-0b9a-460a-8d2d-30ee27732bda attempt=51473029-d5d1-415d-8275-0ac5ba581f29 batch=1/1 -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.