Skip to content

sftap: NeedHeadroom handshake for SwitchU donor remounts - #56

Draft
bshurikan wants to merge 2 commits into
TomasUribe:masterfrom
bshurikan:feat/sftap-switchu-headroom
Draft

bshurikan wants to merge 2 commits into
TomasUribe:masterfrom
bshurikan:feat/sftap-switchu-headroom

Conversation

@bshurikan

@bshurikan bshurikan commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Before donor remount beside SwitchU (100D up, or SwitchU has AckHeadroom'd this boot), set reserved3 bit 6 (NeedHeadroom) and wait for reclaim.
  • Stock users: no wait on remount until/unless SwitchU has ACK'd at least once this boot (review: was always 2s).
  • New sftap cmd 15 AckHeadroom(u32 free_kb); file fallback need_headroom / ft_headroom_ready.
  • Requested MB via GetDonorCap (cmd 13) while NeedHeadroom is set — not shot_fails.
  • HBL 100D as Album for Beside margins; anti-thrash clear; no donor launch on timeout while SwitchU holds the pool.
  • Bump sftap max sessions to 4.

Pairs with SwitchU draft PoloNX/SwitchU#177.

Test plan

  • Without SwitchU: HOME to game remount does not log NeedHeadroom / 2s wait
  • With SwitchU: 100D up then NeedHeadroom + ACK; GetDonorCap returns ask MB; shot_fails stays screenshot fails
  • Second+ HOME after a title: Album/hbmenu stream when pool has room
  • Overlay / manager GetStatus still works

Before launching the donor, set StreamStatus reserved3 bit 6 and wait up to 2s for SwitchU AckHeadroom (cmd 15) or ft_headroom_ready, so HOME↔game remounts stop racing SwitchU soft-land refill. Bumps sftap max sessions to 4.
@bshurikan
bshurikan marked this pull request as draft October 27, 2026 11:47
@TomasUribe

Copy link
Copy Markdown
Owner

Thanks! Two things before it can go in: (1) without SwitchU every donor remount now waits the full 2 s - that's 2 s more after each HOME -> game for everyone else. Could the wait run only once SwitchU has acked at least once this boot (the first remount without waiting)? (2) Please don't reuse shot_fails for the MB - the overlay and app show it as screenshot failures; GetDonorCap or a new field would be cleaner.

Stock remounts no longer pay a 2s wait unless SwitchU has AckHeadroom'd this boot (or 100D is up). Requested MB is GetDonorCap while NeedHeadroom is set. Also: HBL 100D as Album margins, anti-thrash clear, and no donor launch on timeout beside SwitchU.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bshurikan

bshurikan commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks - both addressed on the latest commits (PR stays draft while we soak SwitchU coexistence):

  1. Stock remount wait: NeedHeadroom wait only runs when 100D is up or SwitchU has AckHeadroom'd at least once this boot. Without SwitchU, HOME→game remounts no longer pay the 2 s delay.

  2. Requested MB: no longer overloads shot_fails. While NeedHeadroom is set, the MB is via GetDonorCap (cmd 13); shot_fails stays screenshot failures for the overlay/app. File fallback need_headroom still works for older clients.

SwitchU side should read GetDonorCap when bit 6 is set (we're updating that on the menu PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants