fix(APR): correct guest resolution outputs, object layout and gather sizing #2789

Merged
tototomate123 merged 4 commits from upstream-pr/2789 into main 2026-10-11 07:32:22 +00:00
tototomate123 commented 2026-10-10 15:00:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tototomate123 on 2026-10-10T15:00:36Z.


What

Split from #1616, following its review. Set guest errno, invalidate failed file IDs/sizes and return the successful ForEach count. Match the 24-byte object: type at 0, cursor at 4, count at 8, capacity at 12 and pointer at 16, as asserted by ampr_emu; its 32-bit type word is represented as two 16-bit fields.

Compact gathers use 12 rather than 40 bytes to avoid HFW's 1 MiB buffer exhaustion. Opcode 29 and the three-word packing are AnyPS5 internal encoding, not console opcodes; existing 40-bit offsets and lengths 1 through 2^32 are retained. Keep that distinction in the header comment and record the reference/limits in TechnicalDebt. Three commits.

Tested

Linux x86-64, GCC 16.2.1, Release. guest_ampr_markers passes, including guest errno/failed output handling, constrained-buffer gather execution and size/offset boundary checks. Object field offsets are asserted at compile time. Conventions and whitespace checks pass on current main (5edae353).

Depends on

None for build. HFW integration also needs #2785 (relinker), #2786 (loader), #2787 (filesystem), #2788 (http), #2790 (shader). #1269 (media), #1339 (VRR), #1586 (unwind) and #1436 (imports) are now on main. Local image-table experiments are excluded; open #757 → #758 overlaps them, and #920 is closed without merging. Earlier combined integration reached menu/loading UI; these isolated branches have not been game-tested and gameplay is unverified.

Checklist

  • Based on current main; no duplicate implementation found beyond superseded #1616
  • One topic per PR
  • No code comments except technical debt
  • Unimplemented paths throw; offline HTTP limitations documented
  • No investigation notes, logs or images committed
  • No new third-party dependencies
  • Generic behavior; no title-specific dispatch
  • Depends on: none for build; HFW integration requirements listed above
  • AI-assisted: yes, Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812130353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2789). Originally posted by [tototomate123](https://github.com/tototomate123) on 2026-10-10T15:00:36Z. --- ### What Split from #1616, following its review. Set guest errno, invalidate failed file IDs/sizes and return the successful ForEach count. Match the 24-byte object: type at 0, cursor at 4, count at 8, capacity at 12 and pointer at 16, as asserted by [ampr_emu](https://github.com/drakmor/ampr_emu/blob/cfa85df379f6eeeb165d7badf9b648e266fe77b7/include/ampr_emu_command_buffer_types.h#L138-L143); its 32-bit type word is represented as two 16-bit fields. Compact gathers use 12 rather than 40 bytes to avoid HFW's 1 MiB buffer exhaustion. Opcode 29 and the three-word packing are **AnyPS5 internal encoding**, not console opcodes; existing 40-bit offsets and lengths 1 through 2^32 are retained. Keep that distinction in the header comment and record the reference/limits in TechnicalDebt. Three commits. ### Tested Linux x86-64, GCC 16.2.1, Release. `guest_ampr_markers` passes, including guest errno/failed output handling, constrained-buffer gather execution and size/offset boundary checks. Object field offsets are asserted at compile time. Conventions and whitespace checks pass on current main (`5edae353`). ### Depends on None for build. HFW integration also needs #2785 (relinker), #2786 (loader), #2787 (filesystem), #2788 (http), #2790 (shader). #1269 (media), #1339 (VRR), #1586 (unwind) and #1436 (imports) are now on main. Local image-table experiments are excluded; open #757 → #758 overlaps them, and #920 is closed without merging. Earlier combined integration reached menu/loading UI; these isolated branches have not been game-tested and gameplay is unverified. ### Checklist - [x] Based on current `main`; no duplicate implementation found beyond superseded #1616 - [x] One topic per PR - [x] No code comments except technical debt - [x] Unimplemented paths throw; offline HTTP limitations documented - [x] No investigation notes, logs or images committed - [x] No new third-party dependencies - [x] Generic behavior; no title-specific dispatch - [x] Depends on: none for build; HFW integration requirements listed above - [x] AI-assisted: yes, Codex
github-actions[bot] commented 2026-10-10 15:01:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T15:01:48Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6098843185 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2789#issuecomment-6098843185). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T15:01:48Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
adriadam10 commented 2026-10-11 07:21:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:21:20Z.


Checked on Linux (GCC, Release) with the PR rebased onto current main: guest_ampr_markers and guest_ampr_threads pass (96/96 in the scoped ctest); the new test code doesn't build without the change. The 24-byte object layout matches the ampr_emu assertions, the compact gather round-trips 40-bit offsets and lengths 1..2^32 through submit, and the errno now goes to the guest errno.

Added as our own commit: a TechnicalDebt line recording that the ForEach return value (count of resolved paths) is not confirmed on a title; ampr_emu only passes the resolver's count through.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106625905 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2789#issuecomment-6106625905). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:21:20Z. --- Checked on Linux (GCC, Release) with the PR rebased onto current `main`: `guest_ampr_markers` and `guest_ampr_threads` pass (96/96 in the scoped ctest); the new test code doesn't build without the change. The 24-byte object layout matches the ampr_emu assertions, the compact gather round-trips 40-bit offsets and lengths 1..2^32 through submit, and the errno now goes to the guest errno. Added as our own commit: a TechnicalDebt line recording that the `ForEach` return value (count of resolved paths) is not confirmed on a title; ampr_emu only passes the resolver's count through. Merging once CI is green.
Mouhand-Kaddo commented 2026-10-11 07:31:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:31:40Z.


Additional platform validation of standalone PR head b299350a7a008cc3ce2a39c8c6140390faa1ab3e (2026-10-11):

Windows: passed — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release, BUILD_TESTING=ON.

1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.

Checks: guest_ampr_markers.

Command after building: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_ampr_markers$".

No title/gameplay validation. These results cover the standalone head, not a merge with current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106703352 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2789#issuecomment-6106703352). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-11T07:31:40Z. --- <!-- anyps5-platform-validation:b299350a7a008cc3ce2a39c8c6140390faa1ab3e --> Additional platform validation of standalone PR head `b299350a7a008cc3ce2a39c8c6140390faa1ab3e` (2026-10-11): **Windows: passed** — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release, `BUILD_TESTING=ON`. 1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run. Checks: `guest_ampr_markers`. Command after building: `ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_ampr_markers$"`. No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2789
No description provided.