feat(libs): implement homebrew libc and kernel runtime exports #683

Merged
nicolasabosch merged 1 commit from upstream-pr/683 into main 2026-10-06 03:27:09 +00:00
nicolasabosch commented 2026-10-05 15:18:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nicolasabosch on 2026-10-05T15:18:04Z.


What

Implement seven runtime imports required by native homebrew: access, fdopen, setbuf, lldiv, _Getmbcurmax, pipe, and sceKernelDebugOutText.

access resolves guest paths and reports guest errno; Windows checks the read-only attribute and the file ACL, including execute permission. fdopen wraps an existing descriptor without reopening or truncating it and transfers ownership only on success. Pipes preserve binary data. Debug text is written literally rather than interpreted as a format string. The integer and buffering functions use the guest ABI and existing libc stream/locale conventions.

Tested

  • Windows 11, bundled MinGW, Release, rebased on main fe98276f: this branch builds and passes guest_access, guest_math, guest_standard_streams, and guest_filesystem (4/4).

  • Regression cases include guest cwd/aliases, missing paths, invalid arguments, read-only files, denied execute ACLs, signed 64-bit division, descriptor ownership, embedded NUL/CRLF/0x1a pipe data, EOF, and literal debug text.

  • Integration with #684 (Windows import binding) and #685 (raw AGC compute): the original integration based on af92452f built and passed 290/290 CTest tests. DOOM Shareware homebrew PPSA99666 01.001.000 reached E1M1; movement and shooting were checked in a real window. This integration also used #553 (UserService); #614 is already on main. Original game files were unchanged.

  • The rebase includes #677, the upstream fix for the Linux agc_driver_flat_cache_bits timeout. Updated Linux and Windows CI pass. No Linux gameplay or audible audio verification claimed. A separate pre-existing, excluded guest_locale_tests executable fails its locale exception checks even with its source restored; the new multibyte query is covered by guest_standard_streams.

  • Updated integration on main fe98276f with the repaired #683/#684/#685 and #553: full build plus the runtime libs target succeeded; all nine focused integration tests passed. DOOM Shareware reached E1M1 again with movement and shooting through AGC compute presentation. Profiling recorded 3,798 dispatch-cache hits in 3,800 dispatches with zero evictions. This is cache-use evidence, not an FPS benchmark. Cold shader compilation can still exceed the homebrew frame deadline and trigger its CPU scaler; a warm restart used AGC. The startup UCRT diagnostic remains. Updated Linux and Windows CI pass.

Checklist

  • Based on main fe98276f; open PRs checked for the same functions
  • One runtime-library topic; new PR
  • No code comments added
  • No silent stubs or success replacements for unsupported paths
  • No investigation files, images, logs, or third-party code added to the repository
  • Generic behavior
  • Depends on: none for this change; the game integration requires the sibling fixes and #553
  • AI-assisted: yes

In-game screenshots

Two E1M1 gameplay captures from the integrated DOOM Shareware homebrew run, showing the final integration build and movement/shooting. The integration dependencies and limits are described above.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4747090325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/683). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-10-05T15:18:04Z. --- ### What Implement seven runtime imports required by native homebrew: `access`, `fdopen`, `setbuf`, `lldiv`, `_Getmbcurmax`, `pipe`, and `sceKernelDebugOutText`. `access` resolves guest paths and reports guest errno; Windows checks the read-only attribute and the file ACL, including execute permission. `fdopen` wraps an existing descriptor without reopening or truncating it and transfers ownership only on success. Pipes preserve binary data. Debug text is written literally rather than interpreted as a format string. The integer and buffering functions use the guest ABI and existing libc stream/locale conventions. ### Tested - Windows 11, bundled MinGW, Release, rebased on main `fe98276f`: this branch builds and passes `guest_access`, `guest_math`, `guest_standard_streams`, and `guest_filesystem` (4/4). - Regression cases include guest cwd/aliases, missing paths, invalid arguments, read-only files, denied execute ACLs, signed 64-bit division, descriptor ownership, embedded NUL/CRLF/0x1a pipe data, EOF, and literal debug text. - Integration with #684 (Windows import binding) and #685 (raw AGC compute): the original integration based on `af92452f` built and passed 290/290 CTest tests. DOOM Shareware homebrew PPSA99666 01.001.000 reached E1M1; movement and shooting were checked in a real window. This integration also used #553 (UserService); #614 is already on main. Original game files were unchanged. - The rebase includes #677, the upstream fix for the Linux `agc_driver_flat_cache_bits` timeout. Updated Linux and Windows CI pass. No Linux gameplay or audible audio verification claimed. A separate pre-existing, excluded `guest_locale_tests` executable fails its locale exception checks even with its source restored; the new multibyte query is covered by `guest_standard_streams`. - Updated integration on main `fe98276f` with the repaired #683/#684/#685 and #553: full build plus the runtime `libs` target succeeded; all nine focused integration tests passed. DOOM Shareware reached E1M1 again with movement and shooting through AGC compute presentation. Profiling recorded 3,798 dispatch-cache hits in 3,800 dispatches with zero evictions. This is cache-use evidence, not an FPS benchmark. Cold shader compilation can still exceed the homebrew frame deadline and trigger its CPU scaler; a warm restart used AGC. The startup UCRT diagnostic remains. Updated Linux and Windows CI pass. ### Checklist - [x] Based on main `fe98276f`; open PRs checked for the same functions - [x] One runtime-library topic; new PR - [x] No code comments added - [x] No silent stubs or success replacements for unsupported paths - [x] No investigation files, images, logs, or third-party code added to the repository - [x] Generic behavior - [x] Depends on: none for this change; the game integration requires the sibling fixes and #553 - [x] AI-assisted: yes ### In-game screenshots [Two E1M1 gameplay captures from the integrated DOOM Shareware homebrew run](https://github.com/boykopovar/AnyPS5/pull/685#issuecomment-5997547697), showing the final integration build and movement/shooting. The integration dependencies and limits are described above.
github-actions[bot] commented 2026-10-05 15:21:06 +00:00 (Migrated from github.com)

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


Progress report (fe98276 → 7789c0a)

📈 System libraries: 81.64% (+0.04%, +7 implemented functions)

✅ 7 implemented
Library Name
libc _Getmbcurmax_nid_postfix
libc access_nid_postfix
libc fdopen_nid_postfix
libc lldiv_nid_postfix
libc setbuf_nid_postfix
libkernel pipe_nid_postfix
libkernel sceKernelDebugOutText
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5997476960 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/683#issuecomment-5997476960). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-05T15:21:06Z. --- <!-- progress-report --> ### Progress report (fe98276 → 7789c0a) 📈 **System libraries**: 81.64% (+0.04%, +7 implemented functions) <details> <summary>✅ 7 implemented</summary> | Library | Name | | - | - | | libc | `_Getmbcurmax_nid_postfix` | | libc | `access_nid_postfix` | | libc | `fdopen_nid_postfix` | | libc | `lldiv_nid_postfix` | | libc | `setbuf_nid_postfix` | | libkernel | `pipe_nid_postfix` | | libkernel | `sceKernelDebugOutText` | </details>
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!683
No description provided.