Repository navigation
Conversation
…a length of 0 On a PS5 (firmware 11.60, payload process) sceAudioOutOpen with a length of 0 returns 0x80260006. main already answers this way; the test keeps it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Probe sources (built with ps5-payload-sdk v0.45; sceAudioOutOpen probe.c (run at 17:49 UTC)/* Probe K: sceAudioOutOpen (debt libSceAudioOut.md lines 89, 90 and 91, main 399e7fb57e; title cases from [local notes file]). Every port that opens is closed at once; no sample is ever output.
Arguments: (userId, type, index, len, freq, param). userId 0xFF is the system ID the titles pass. Nothing is
written, nothing is sent. */
#include <dlfcn.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ps5/kernel.h> /* only for kernel_get_fw_version() */
#ifndef PROBE_NAME
#define PROBE_NAME "unnamed"
#endif
#ifndef PROBE_BUILD
#define PROBE_BUILD "unbuilt"
#endif
static int cases = 0;
static void probe_header(void) {
char utc[32];
time_t now = time(0);
struct tm tmv;
gmtime_r(&now, &tmv);
strftime(utc, sizeof utc, "%Y-%m-%dT%H:%M:%SZ", &tmv);
printf("PROBE\t%s\tfw=0x%08x\tbuild=%s\tpid=%d\tutc=%s\n", PROBE_NAME, kernel_get_fw_version(), PROBE_BUILD,
getpid(), utc);
fflush(stdout);
}
static void probe_case(const char* id, const char* call, long ret, int err, const char* extra) {
printf("CASE\t%s\t%s\t%ld\t%d\t%s\n", id, call, ret, err, extra ? extra : "-");
fflush(stdout);
cases++;
}
static void probe_end(void) {
printf("END\t%d\n", cases);
fflush(stdout);
}
typedef int (*fn_init)(void);
typedef int (*fn_open)(int, int, int, uint32_t, uint32_t, uint32_t);
typedef int (*fn_close)(int);
struct open_case { const char* id; int user; int type; int index; uint32_t len; uint32_t freq; uint32_t param; };
static const struct open_case table[] = {
/* title forms (I's case set) */
{"t1", 0xFF, 0, 0, 1024, 48000, 1},
{"t2", 0xFF, 0, 0, 1024, 48000, 4},
{"t3", 0xFF, 0, 0, 256, 48000, 5},
{"t4", 0xFF, 0xA, 0, 1024, 48000, 1},
{"t5", 0xFF, 1, 0, 256, 48000, 5},
{"t6", 0xFF, 3, 0, 1024, 48000, 1},
{"t7", 0xFF, 4, 0, 1024, 48000, 1},
{"t8", 0xFF, 0, 0, 1024, 48000, 0},
/* line 89: format low byte above 7 and higher bits */
{"f1", 0xFF, 0, 0, 1024, 48000, 7},
{"f2", 0xFF, 0, 0, 1024, 48000, 8},
{"f3", 0xFF, 0, 0, 1024, 48000, 0xFF},
{"f4", 0xFF, 0, 0, 1024, 48000, 0x101},
{"f5", 0xFF, 0, 0, 1024, 48000, 0x01000001},
{"f6", 0xFF, 0, 0, 1024, 48000, 0x80000001},
/* line 90: length and frequency outside the PS4 comparators' set */
{"l1", 0xFF, 0, 0, 0, 48000, 1},
{"l2", 0xFF, 0, 0, 1, 48000, 1},
{"l3", 0xFF, 0, 0, 255, 48000, 1},
{"l4", 0xFF, 0, 0, 257, 48000, 1},
{"l5", 0xFF, 0, 0, 2048, 48000, 1},
{"l6", 0xFF, 0, 0, 2304, 48000, 1},
{"l7", 0xFF, 0, 0, 4096, 48000, 1},
{"q1", 0xFF, 0, 0, 1024, 0, 1},
{"q2", 0xFF, 0, 0, 1024, 44100, 1},
{"q3", 0xFF, 0, 0, 1024, 96000, 1},
{"q4", 0xFF, 0, 0, 1024, 1, 1},
/* line 91: index other than 0 */
{"i1", 0xFF, 0, 1, 1024, 48000, 1},
{"i2", 0xFF, 0, 2, 1024, 48000, 1},
};
int main(void) {
char extra[64];
char call[128];
probe_header();
errno = 0;
void* lib = dlopen("libSceAudioOut.sprx", RTLD_LAZY);
probe_case("0", "load libSceAudioOut.sprx", lib ? 0 : -1, errno, lib ? "loaded" : dlerror());
if (!lib) { probe_end(); return 0; }
fn_init aoInit = (fn_init)dlsym(lib, "sceAudioOutInit");
fn_open aoOpen = (fn_open)dlsym(lib, "sceAudioOutOpen");
fn_close aoClose = (fn_close)dlsym(lib, "sceAudioOutClose");
if (!aoInit || !aoOpen || !aoClose) { probe_case("0b", "dlsym of the audio out functions", -1, 0, "missing"); probe_end(); return 0; }
errno = 0;
long r = aoInit();
snprintf(extra, sizeof extra, "0x%08x", (unsigned)r);
probe_case("1", "sceAudioOutInit()", r, errno, extra);
for (size_t i = 0; i < sizeof table / sizeof table[0]; ++i) {
const struct open_case* c = &table[i];
snprintf(call, sizeof call, "sceAudioOutOpen(0x%x, %d, %d, %u, %u, 0x%x)", c->user, c->type, c->index, c->len, c->freq, c->param);
errno = 0;
r = aoOpen(c->user, c->type, c->index, c->len, c->freq, c->param);
int e = errno;
snprintf(extra, sizeof extra, "0x%08x", (unsigned)r);
probe_case(c->id, call, r, e, extra);
if (r >= 0) {
char cid[16];
snprintf(cid, sizeof cid, "%sc", c->id);
errno = 0;
long cr = aoClose((int)r);
snprintf(extra, sizeof extra, "0x%08x", (unsigned)cr);
probe_case(cid, "sceAudioOutClose(handle from the case above)", cr, errno, extra);
}
}
probe_end();
return 0;
}raw output (run at 17:49 UTC)sceAudioOutOpen probe.c (run at 18:20 UTC)/* Probe K: sceAudioOutOpen (debt libSceAudioOut.md lines 89, 90 and 91, main 399e7fb57e; title cases from [local notes file]). Every port that opens is closed at once; no sample is ever output.
Arguments: (userId, type, index, len, freq, param). userId 0xFF is the system ID the titles pass. Nothing is
written, nothing is sent. */
#include <dlfcn.h>
#include <errno.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ps5/kernel.h> /* only for kernel_get_fw_version() */
#ifndef PROBE_NAME
#define PROBE_NAME "unnamed"
#endif
#ifndef PROBE_BUILD
#define PROBE_BUILD "unbuilt"
#endif
/* Self limit: on a timeout the runner can only close the connection, not end the process on the console. The probe
ends itself after at most PROBE_MAX_S seconds (the build script sets the timeout minus 10 s). */
#ifndef PROBE_MAX_S
#define PROBE_MAX_S 50
#endif
static void probe_alarm(int sig) {
static const char msg[] = "TIMEOUT\tprobe self limit\n";
(void)sig;
(void)!write(1, msg, sizeof msg - 1);
_exit(124);
}
static int cases = 0;
static void probe_header(void) {
char utc[32];
time_t now = time(0);
struct tm tmv;
gmtime_r(&now, &tmv);
strftime(utc, sizeof utc, "%Y-%m-%dT%H:%M:%SZ", &tmv);
printf("PROBE\t%s\tfw=0x%08x\tbuild=%s\tpid=%d\tutc=%s\n", PROBE_NAME, kernel_get_fw_version(), PROBE_BUILD,
getpid(), utc);
fflush(stdout);
}
static void probe_case(const char* id, const char* call, long ret, int err, const char* extra) {
printf("CASE\t%s\t%s\t%ld\t%d\t%s\n", id, call, ret, err, extra ? extra : "-");
fflush(stdout);
cases++;
}
static void probe_end(void) {
printf("END\t%d\n", cases);
fflush(stdout);
}
typedef int (*fn_init)(void);
typedef int (*fn_open)(int, int, int, uint32_t, uint32_t, uint32_t);
typedef int (*fn_close)(int);
struct open_case { const char* id; int user; int type; int index; uint32_t len; uint32_t freq; uint32_t param; };
static const struct open_case table[] = {
/* title forms (I's case set) */
{"t1", 0xFF, 0, 0, 1024, 48000, 1},
{"t2", 0xFF, 0, 0, 1024, 48000, 4},
{"t3", 0xFF, 0, 0, 256, 48000, 5},
{"t4", 0xFF, 0xA, 0, 1024, 48000, 1},
{"t5", 0xFF, 1, 0, 256, 48000, 5},
{"t6", 0xFF, 3, 0, 1024, 48000, 1},
{"t7", 0xFF, 4, 0, 1024, 48000, 1},
{"t8", 0xFF, 0, 0, 1024, 48000, 0},
/* line 89: format low byte above 7 and higher bits */
{"f1", 0xFF, 0, 0, 1024, 48000, 7},
{"f2", 0xFF, 0, 0, 1024, 48000, 8},
{"f3", 0xFF, 0, 0, 1024, 48000, 0xFF},
{"f4", 0xFF, 0, 0, 1024, 48000, 0x101},
{"f5", 0xFF, 0, 0, 1024, 48000, 0x01000001},
{"f6", 0xFF, 0, 0, 1024, 48000, 0x80000001},
/* line 90: length and frequency outside the PS4 comparators' set */
{"l1", 0xFF, 0, 0, 0, 48000, 1},
{"l2", 0xFF, 0, 0, 1, 48000, 1},
{"l3", 0xFF, 0, 0, 255, 48000, 1},
{"l4", 0xFF, 0, 0, 257, 48000, 1},
{"l5", 0xFF, 0, 0, 2048, 48000, 1},
{"l6", 0xFF, 0, 0, 2304, 48000, 1},
{"l7", 0xFF, 0, 0, 4096, 48000, 1},
{"q1", 0xFF, 0, 0, 1024, 0, 1},
{"q2", 0xFF, 0, 0, 1024, 44100, 1},
{"q3", 0xFF, 0, 0, 1024, 96000, 1},
{"q4", 0xFF, 0, 0, 1024, 1, 1},
/* line 91: index other than 0 */
{"i1", 0xFF, 0, 1, 1024, 48000, 1},
{"i2", 0xFF, 0, 2, 1024, 48000, 1},
};
int main(void) {
signal(SIGALRM, probe_alarm);
alarm(PROBE_MAX_S);
char extra[64];
char call[128];
probe_header();
errno = 0;
void* lib = dlopen("libSceAudioOut.sprx", RTLD_LAZY);
probe_case("0", "load libSceAudioOut.sprx", lib ? 0 : -1, errno, lib ? "loaded" : dlerror());
if (!lib) { probe_end(); return 0; }
fn_init aoInit = (fn_init)dlsym(lib, "sceAudioOutInit");
fn_open aoOpen = (fn_open)dlsym(lib, "sceAudioOutOpen");
fn_close aoClose = (fn_close)dlsym(lib, "sceAudioOutClose");
if (!aoInit || !aoOpen || !aoClose) { probe_case("0b", "dlsym of the audio out functions", -1, 0, "missing"); probe_end(); return 0; }
errno = 0;
long r = aoInit();
snprintf(extra, sizeof extra, "0x%08x", (unsigned)r);
probe_case("1", "sceAudioOutInit()", r, errno, extra);
for (size_t i = 0; i < sizeof table / sizeof table[0]; ++i) {
const struct open_case* c = &table[i];
snprintf(call, sizeof call, "sceAudioOutOpen(0x%x, %d, %d, %u, %u, 0x%x)", c->user, c->type, c->index, c->len, c->freq, c->param);
errno = 0;
r = aoOpen(c->user, c->type, c->index, c->len, c->freq, c->param);
int e = errno;
snprintf(extra, sizeof extra, "0x%08x", (unsigned)r);
probe_case(c->id, call, r, e, extra);
if (r >= 0) {
char cid[16];
snprintf(cid, sizeof cid, "%sc", c->id);
errno = 0;
long cr = aoClose((int)r);
snprintf(extra, sizeof extra, "0x%08x", (unsigned)cr);
probe_case(cid, "sceAudioOutClose(handle from the case above)", cr, errno, extra);
}
}
probe_end();
return 0;
}raw output (run at 18:20 UTC)AI-assisted (Claude Code). 🤖 Generated with Claude Code |
gabichuuuuu
left a comment
There was a problem hiding this comment.
Windows run of head b8c31cb698, merged onto main 0bae53facd in one tree with eight other open PRs that touch different files (all nine merged cleanly). Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release, BUILD_TESTING=ON.
audio_out_buffer_size_any_indexwith--repeat until-fail:5: 5 / 5 pass.audio_out_buffer_size_invalid_lengthwith--repeat until-fail:5: 5 / 5 pass.- This PR only adds tests, so there's no negative control.
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change adds a focused regression test for the zero-length return code and verifies that no audio device is opened; I found no blocking defect in the changed code.
What I ran
- Reviewed head
b8c31cb698ce7c659cf31d1bf63631391a979a15against the prepared diff and repository source usingrepo_read.py. - No tests or build commands run by me. The description reports an AddressSanitizer test run on Ubuntu 24.04 under WSL2 with GCC 13.3.0; that report was not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Test dispatch and registration are consistent. |
| Tests run by reviewer | not run | Author reports the new test and related audio tests passed. |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- I read both changed files,
core/libs/prx/libSceAudioOut/CMakeLists.txtandcore/libs/prx/libSceAudioOut/tests/AudioOutBufferSize.cpp, plus the relevantsceAudioOutOpenimplementation incore/libs/prx/libSceAudioOut/src/AudioOut.cpp. - No files were listed as excluded in the provided manifest;
review/files.jsonwas unavailable through the reader, so exclusions beyond the manifest were not verified. - The reported console measurement, author’s test runs, and behavior on other firmware or title processes were not independently verified.
To get this to a good state
Nothing is required.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
What
Adds a test that
sceAudioOutOpenwith a length of 0 returns 0x80260006 and opens no device.mainalready answers this way, so the test passes onmainand changes no code. The debt entry for the call says: "a length of 0 returnsSCE_AUDIO_OUT_ERROR_INVALID_SIZE(0x80260006) and a frequency of 0 returnsSCE_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ(0x80260008); every other length and frequency is accepted, which is not measured on hardware." A PS5 returns the same code for a length of 0; the debt entry is not changed here, and what the console does with other lengths is outside this test.Tested
Measured on a PS5 with firmware 11.60 (
kernel_get_fw_version0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr), on 2026-11-06 at 17:49 UTC and 18:20 UTC (two runs, identical); the console's own clock read about 1 h 41 min more (see the first comment). A title process may differ.sceAudioOutOpen(0xff, 0, 0, len, 48000, 0x1)mainThe new test
audio_out_buffer_size_invalid_lengthpasses onmain095ff72367on Ubuntu 24.04 under WSL2 with GCC 13.3.0 and an AddressSanitizer build, and all 66audio_out*tests pass. As a negative control, with the length check removed fromsceAudioOutOpenthe test fails ("length 0 did not return SCE_AUDIO_OUT_ERROR_INVALID_SIZE").tools/check_conventions.py --base upstream/mainpasses.Overlap: the 19 other open pull requests that change
AudioOutBufferSize.cppor the library'sCMakeLists.txt(theforeachlist of buffer-size modes and the lines after it) were checked on 2026-11-08 between 21:05 UTC and 21:16 UTC againstmain0bae53facd. Four already conflict withmainwithout this change (#12863, #5021, #12315 and #14212), and none conflicts only with this change, because the new test registers itself on its own line after theforeachloop. The other fifteen merge cleanly with and without it, among them #16737, #16736, #16641, #16614 and #16597, which edit other parts of the same files. #17126 and #17270 (a different author) check a zero length in other tests without a console measurement; they do not conflict with this change.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).
🤖 Generated with Claude Code