feat(audioin): implement sceAudioInHqOpen #570
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/570"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T22:23:55Z.
What
sceAudioInHqOpenwas a throwing stub. It takes the same parameters assceAudioInOpenandopens an input port in the same way; the "Hq" variant only differs by the high-quality formats it
accepts, which
sceAudioInOpenalready validates. It now forwards tosceAudioInOpen, as it doesin shadPS4.
Tested
Extends the existing
guest_audio_invalidation with twosceAudioInHqOpencalls (invalid typeand invalid size) that go through the shared validation path.
Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11;
ctest -R guest_audio_inpasses(both
guest_audio_in_captureandguest_audio_in_no_device). Onmainthe stub throwsnot implemented, so the test aborts without the change.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:43:58Z.
Thanks. The NID recomputes (nya-R5gDYhM is sceAudioInHqOpen), and the two new rows go through the shared validation as described. One thing before it goes in: the claim that the HQ port differs from
sceAudioInOpenonly in the formats it accepts comes from shadPS4, which forwards it unchanged, but the other emulator sources don't agree. BryKytyPS5 (a KytyPS5 fork,src/libs/audio.cpp,OpenPort(..., asynchronous = true)) treats the HQ port differently in two ways:len == 128andfreq == 48000. A length of 256 returnsINVALID_SIZEand 16000 Hz returnsINVALID_FREQ, while forwarding accepts both.sceAudioInOpen's port waits until it haslenframes.Neither source is the console, so I can't say which is right. Under the exact-or-throw rule, I'd accept only what both agree on (type 0 or 1, index 0, 128 samples at 48000 Hz, the same params), throw for 256 samples and 16000 Hz on the HQ path, and add a line under "Unknown function info" in docs/dev/TechnicalDebt.md saying that an HQ port captures with the same blocking cadence as
sceAudioInOpenand that the real cadence is unknown. A test row with 256 samples (expecting the throw) would then cover the difference.Small one: a param of 0x10 now reaches
sceAudioInOpen'sNotImplemented_nid_no_patch(__func__), so the message namessceAudioInOpeninstead ofsceAudioInHqOpen.For context, PPSA21564 imports
sceAudioInHqOpen, but it hasn't been called in my runs (on main it throws), so this doesn't change anything I can observe yet.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T21:20:49Z.
Are you still working on this? The points from 10-04 are still open:
sceAudioInHqOpenrather thansceAudioInOpen.PPSA21564 imports
sceAudioInHqOpen, so it's worth finishing.Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-06T21:52:20Z.
Done. sceAudioInHqOpen now throws (reporting its own name) for the 256-sample length and 16000 Hz that shadPS4 and KytyPS5 disagree on, and forwards the agreed 128/48000 format to sceAudioInOpen. Added an "Unknown function info" line for the capture cadence, and the guest_audio_in rows use a valid HQ length now. guest_audio_in passes here.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-07T03:45:45Z.
Thanks for finishing all three points; it passed our regression runs too.
One question remains, the same as on #571 and #572: which title calls
sceAudioInHqOpen? The owner has asked us to merge only changes a title needs. If you know one, please name it with the log line where it stops onmain, and it can go in. If not, we'd rather close it for now and reopen it once a title reaches it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T15:54:29Z.
Review: CHANGES_REQUESTED
Checked the code against the references: KytyPS5
AudioInHqOpengoes throughOpenPort(..., true), shadPS4 forwards tosceAudioInOpen, and SharpProspero documents the HQ port as 48 kHz / 128-sample grain.sceAudioInOpenonly accepts len 128/256 and freq 48000/16000, so the 128/48000 pair is the only one that reaches an open port and the throw for 256 / 16000 is consistent with Dean's earlier request. Two things left:core/libs/tests/GuestAudioIn.cpp:44-45: the new rows only cover the error paths (type 2, len 512). Nothing opens an HQ port, so the forwarding itself is untested. Please add a success row (sceAudioInHqOpen(user, 0, 0, 128, 48000, 2) > 0, thensceAudioInInputreturns 128 andsceAudioInClosereturns 0), e.g. inTestNoDevice, and ideally one case per throw (256 samples, 16000 Hz) if the guest test harness can catch it.sceAudioInOpen; please update it with the 128/48000 restriction.On Dean's question about the title:
sceAudioInHqOpenis in the import list of Astro's Playroom (PPSA01325) as an unimplemented stub, and Dean noted PPSA21564 imports it too. If you have a log line of where either stops onmain, add it to the description.Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T13:55:43Z.
On which title calls it: Astro Bot (PPSA21567 v01.019.000, retail) calls
sceAudioInHqOpenfrom its microphone setup. The call site in the convertedeboot.bin(AnyPS5app.elf, code at vaddr 0) chooses between the two opens on a per-object flag:The HQ call is
(userId, 1, 0, 128, 48000, 2), which is the format this PR forwards. These are the only two AudioIn open call sites in the executable. The title'ssce_modulemodules import neither function.What I can't give is a stop on
main. In my runs, scripted input from boot through the intro cutscene never reached this code (I logged both entry points), and Astro Bot also needs #759 to boot on currentmain. So this is a static call site, not a runtime log line.Found and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T18:08:15Z.
Closing for now: the points from 2026-10-07 are still open. If you pick it back up, please comment here and it can be reopened.
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T08:31:22Z.
A title reaches this on
mainnow: Astro's Playroom (PPSA01325). Onmain7b5214d4(Linux, RTX 5080) it loads, logsLoadLevelResources: openingand stops withWith this PR's head
703249dcmerged onto that commit (it merges cleanly) the title gets past the call, loadspausemenuandtimeattack_menuand stops later on an unrelated AGC error,sampling the depth plane of depth surface ... is not implemented. The two audio-in tests pass on the merged tree. One run each.Pull request closed