Improve Hades II compatibility #964

Manually merged
github merged 1 commit from gh-pr/964/head into gh-pr/964/base 2026-11-26 09:38:28 +00:00
Owner

@⁠nomolao2-cell on GitHub · 2026-10-01 22:13 UTC · original
nomolao2-cell:hades2fixes → main · +47 −1 · 7 files · 1 commits · merged 2026-10-02 10:37 UTC

Problem

Hades II (PS5 title ID PPSA36082, version 01.006.000) called an unresolved kernel import during startup. The emulator then crashed shortly after the title screen with a host access violation.

After startup was fixed, RenderDoc captures showed graphical artifacts during gameplay, including black patches and flickering. The command processor was also encountering pixel-shader register state used by the game but not handled by KytyPS5.

Fix

  • Implement the La9uyZv4Kvw kernel import used by Hades II to obtain its guest CPU-availability mask.
  • Handle the pixel-shader user-data address registers and auxiliary table address registers used by Hades II's indirect shader-register commands.
  • Keep mapped guest buffers active in the buffer cache while synchronizing ranges used by GPU buffer-device-address reads, preventing their mappings from being evicted between draws.
  • Recognize zero clears for R16G16B16A16_SFLOAT render targets so cleared images do not retain stale contents.

Scope

These are emulator-side kernel, command-processor, buffer-cache, and image-clear compatibility changes.

No game files, guest binaries, or game assets are modified. This does not include the separate Intel Astro Bot fixes.

Testing

  • Local Windows Release build (kyty_emulator) — passed.
  • Manual test environment: Intel Core i5-13600KF, NVIDIA GeForce RTX 3070, 32 GB RAM.
  • Game tested: Hades II, PS5 title ID PPSA36082, version 01.006.000.
  • Hades II reached gameplay after the startup fix; RenderDoc captures were used to inspect the graphics artifacts.
  • Automated tests and Linux/macOS CI have not been run for this branch yet.

BEFORE

Captura de pantalla 2026-09-29 201918

AFTER

image

No regression found at my end.

AI use disclosure

Codex assisted with investigating the Hades II startup crash and RenderDoc-captured graphics artifacts, preparing the compatibility changes, and checking the local Windows Release build. The resulting diff was inspected, and manual Hades II testing was performed on the PC listed above.

**@⁠nomolao2-cell** on GitHub · 2026-10-01 22:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/964) `nomolao2-cell:hades2fixes` → `main` · +47 −1 · 7 files · 1 commits · merged 2026-10-02 10:37 UTC ## Problem Hades II (PS5 title ID PPSA36082, version 01.006.000) called an unresolved kernel import during startup. The emulator then crashed shortly after the title screen with a host access violation. After startup was fixed, RenderDoc captures showed graphical artifacts during gameplay, including black patches and flickering. The command processor was also encountering pixel-shader register state used by the game but not handled by KytyPS5. ## Fix - Implement the `La9uyZv4Kvw` kernel import used by Hades II to obtain its guest CPU-availability mask. - Handle the pixel-shader user-data address registers and auxiliary table address registers used by Hades II's indirect shader-register commands. - Keep mapped guest buffers active in the buffer cache while synchronizing ranges used by GPU buffer-device-address reads, preventing their mappings from being evicted between draws. - Recognize zero clears for `R16G16B16A16_SFLOAT` render targets so cleared images do not retain stale contents. ## Scope These are emulator-side kernel, command-processor, buffer-cache, and image-clear compatibility changes. No game files, guest binaries, or game assets are modified. This does not include the separate Intel Astro Bot fixes. ## Testing - Local Windows Release build (`kyty_emulator`) — passed. - Manual test environment: Intel Core i5-13600KF, NVIDIA GeForce RTX 3070, 32 GB RAM. - Game tested: Hades II, PS5 title ID PPSA36082, version 01.006.000. - Hades II reached gameplay after the startup fix; RenderDoc captures were used to inspect the graphics artifacts. - Automated tests and Linux/macOS CI have not been run for this branch yet. ## BEFORE <img width="1260" height="730" alt="Captura de pantalla 2026-09-29 201918" src="https://github.com/user-attachments/assets/069526e8-6a5e-4be9-bee8-fdf2bcf83c47" /> ## AFTER <img width="1270" height="750" alt="image" src="https://github.com/user-attachments/assets/e2654cef-4da7-4d4b-ba82-c8995ea15680" /> No regression found at my end. ## AI use disclosure Codex assisted with investigating the Hades II startup crash and RenderDoc-captured graphics artifacts, preparing the compatibility changes, and checking the local Windows Release build. The resulting diff was inspected, and manual Hades II testing was performed on the PC listed above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:24 +00:00
github manually merged commit 1625888b6c into gh-pr/964/base 2026-11-26 09:38:28 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-01 22:22 UTC · original

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 98b5a885-0976-4280-965c-d836378571b8

📥 Commits

Reviewing files that changed from the base of the PR and between b3e419ff11 and 57759af62222b96715494400557dd546bad2937b.

📒 Files selected for processing (7)
  • src/graphics/guest_gpu/command_processor/pm4Dispatch.cpp
  • src/graphics/guest_gpu/command_processor/pm4Handlers.cpp
  • src/graphics/guest_gpu/hardwareContext.h
  • src/graphics/guest_gpu/pm4.h
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/libs/libKernel.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.


📝 Walkthrough

Walkthrough

The change adds pixel-shader user-data and auxiliary-table address storage and register dispatch. It also updates buffer LRU handling during range synchronization, adds handling for zero packed half-float color clears, and registers a kernel function that returns the available CPU mask.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 57759

No actionable merge-blocking issue remains in these compatibility changes. Normal build and platform checks remain appropriate before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 57759

This is a bounded compatibility change. No new privilege or sensitive-data access was demonstrated, but the undocumented interface and incomplete memory-lifetime coverage warrant a low rather than minimal risk assessment.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The relevant exposure is guest-controlled commands reaching host-process memory and graphics resources. The inspected paths affect emulator execution, cached GPU mappings, and image contents. Deployment isolation, host sandboxing, and any multi-tenant exposure are not established by the supplied evidence.

Security Findings and Attack Paths

  • observed — Indirect shader-register parsing casts a guest-supplied address to a host pointer and reads the register list before dispatch. This parser predates the PR and was unchanged in the immediate-parent comparison. Existing supported registers already traversed it; the new handlers only store address words. This inherited trust assumption is an architecture fact, not a demonstrated PR-introduced vulnerability.

Trust Boundaries and Controls

  • observed — The new dispatch mappings constrain address-word indices to 0 and 1. Each update replaces one 32-bit half while preserving the other, making repetition of the same write idempotent. Both addresses initialize to zero, and command-processor reset replaces shader state with its defaults. These storage operations do not themselves dereference the stored addresses.

Resilience and Maintainability Implications

  • observed — The inspected existing cleanup path drains active GPU work and priority operations before invalidating memory and removing mapped ranges. Buffer deletion unregisters page-table ownership and defers resource destruction when scheduling is active. The new LRU touch does not replace these cleanup responsibilities; complete coverage of other callers and failure schedules remains unresolved.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary changes, which improve Hades II compatibility across startup, graphics, and emulator behavior.
Description check ✅ Passed The description directly explains the Hades II startup and graphics issues, the implemented fixes, scope, and testing results. It is clearly related to 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.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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-01 22:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/964#issuecomment-5941854501) <!-- 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/964?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> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `98b5a885-0976-4280-965c-d836378571b8` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between b3e419ff1101999525fa2d061ada1d102cf788b1 and 57759af62222b96715494400557dd546bad2937b. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `src/graphics/guest_gpu/command_processor/pm4Dispatch.cpp` * `src/graphics/guest_gpu/command_processor/pm4Handlers.cpp` * `src/graphics/guest_gpu/hardwareContext.h` * `src/graphics/guest_gpu/pm4.h` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.h` * `src/libs/libKernel.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> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The change adds pixel-shader user-data and auxiliary-table address storage and register dispatch. It also updates buffer LRU handling during range synchronization, adds handling for zero packed half-float color clears, and registers a kernel function that returns the available CPU mask. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"57759af62222b96715494400557dd546bad2937b" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `57759` <!-- final_review_risk_coverage:{"sourceCommitId":"57759af62222b96715494400557dd546bad2937b","coveredCommitId":"57759af62222b96715494400557dd546bad2937b","kind":"reviewed"} --> No actionable merge-blocking issue remains in these compatibility changes. Normal build and platform checks remain appropriate before merging. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `57759` This is a bounded compatibility change. No new privilege or sensitive-data access was demonstrated, but the undocumented interface and incomplete memory-lifetime coverage warrant a low rather than minimal risk assessment. **Retained concerns** No architecture-level concerns identified. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The relevant exposure is guest-controlled commands reaching host-process memory and graphics resources. The inspected paths affect emulator execution, cached GPU mappings, and image contents. Deployment isolation, host sandboxing, and any multi-tenant exposure are not established by the supplied evidence. **Security Findings and Attack Paths** - _observed_ — Indirect shader-register parsing casts a guest-supplied address to a host pointer and reads the register list before dispatch. This parser predates the PR and was unchanged in the immediate-parent comparison. Existing supported registers already traversed it; the new handlers only store address words. This inherited trust assumption is an architecture fact, not a demonstrated PR-introduced vulnerability. **Trust Boundaries and Controls** - _observed_ — The new dispatch mappings constrain address-word indices to 0 and 1. Each update replaces one 32-bit half while preserving the other, making repetition of the same write idempotent. Both addresses initialize to zero, and command-processor reset replaces shader state with its defaults. These storage operations do not themselves dereference the stored addresses. **Resilience and Maintainability Implications** - _observed_ — The inspected existing cleanup path drains active GPU work and priority operations before invalidating memory and removing mapped ranges. Buffer deletion unregisters page-table ownership and defers resource destruction when scheduling is active. The new LRU touch does not replace these cleanup responsibilities; complete coverage of other callers and failure schedules remains unresolved. </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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 7 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly and concisely summarizes the primary changes, which improve Hades II compatibility across startup, graphics, and emulator behavior. | | Description check | ✅ Passed | The description directly explains the Hades II startup and graphics issues, the implemented fixes, scope, and testing results. It is clearly related to 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. | </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 is currently an internal CodeRabbit preview. <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=964)! 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 -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-02 10:37 UTC · original

@⁠nomolao2-cell Thanks

**@⁠Nmzik** on GitHub · 2026-10-02 10:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/964#issuecomment-5950547715) @⁠nomolao2-cell Thanks
This discussion has been locked. Commenting is limited to contributors.
No description provided.