Repository navigation
feat(libSceBluetoothHid): implement sceBluetoothHidThreadParamInitialize - #12638
oneandonlydean merged 1 commit into
Conversation
sceBluetoothHidThreadParamInitialize threw NotImplemented. It now fills the thread parameter block that sceBluetoothHidRegisterCallback reads: the 32-bit priority at offset 0, the 64-bit affinity mask at offset 8 and 0 in the 32 bits at offset 16, leaving bytes 4 to 7 and 20 to 23 as they were, and returns 0. A null block returns 0x81540001. This follows BunnyFl's native x86-64 run of firmware 13.42's libSceBluetoothHid, not a console: boykopovar#11124 (comment) The test checks the run's bytes for (700, 0x3f) and the null answer. The run does not show the success value, range checks, bytes 20 to 23 or calls before sceBluetoothHidInit; the debt entry records them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Progress report (3a2b919 → b2b07ce)📈 System libraries: 45.92% (+0.01%, +1 implemented functions) ✅ 1 implemented
Changed libraries (implemented exports)
|
|
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.
|
|
Windows run of this head (
AI-assisted: yes (Claude Code). |
|
@Lindamea1 reviewed at b2b07ce: PASS. Null gives InvalidArgument (0x81540001). Otherwise it stores priority, affinityMask and a cleared reserved field and returns 0, matching the cited 13.42 module run byte for byte, with padding left untouched. The debt entry lists what that run doesn't cover. GuestBluetoothHid (registered) asserts the bytes and the null cases. @adriadam10 exact-head CI is green (run 40790158087); we'll merge this in the next train unless you'd rather merge it yourself. |
What
sceBluetoothHidThreadParamInitialize(BluetoothHidThreadParam* param, int32_t priority, uint64_t affinityMask)threwNotImplemented(Export.cppL133-L136). It now fills the thread parameter block thatsceBluetoothHidRegisterCallbackreads:paramreturns0x81540001, the existingInvalidArgument(L23).priorityin the 32 bits at offset 0,affinityMaskin the 64 bits at offset 8 and 0 in the 32 bits at offset 16 (reserved), and returns 0. The three members are stored one by one, with no struct assignment ormemset, so bytes 4 to 7 (padding) and 20 to 23 (tailPadding) keep what the caller left there.sceBluetoothHidParamInitialize(L121-L126), it checks no range, keeps no library state and does not needsceBluetoothHidInit.The struct and the declaration already exist on
main(Api.hppL9-L15, L59), with the offsets pinned by thestatic_asserts atExport.cppL11-L13. Only the body changes.References:
libSceBluetoothHid.sprxon x86-64, not a console, fourth bullet of this comment:sceBluetoothHidThreadParamInitialize(thread, priority, affinity)writes theintpriority at +0, the 64-bit affinity at +8 and 0 at +0x10. With (700, 0x3f) the bytes werebc 02 00 00 | 5a 5a 5a 5a | 3f 00 … | 00 00 00 00, the four bytes at +4 keeping their 0x5a fill. A null pointer returns0x81540001. The second and third bullets showsceBluetoothHidRegisterCallbackreading these fields: anintat +0, a 64-bit value at +8 and anintat +0x10, which it accepted as 0 and refused with0x81540001as 1. feat: answer the NpWebApi2 multipart calls and sceBluetoothHidParamInitialize from their sources #11124 used the same run forsceBluetoothHidParamInitialize.(uint* param, uint value1, ulong value2): a 32-bit priority and a 64-bit affinity, as declared onmain.Not covered by the run: the value returned on success, range checks of the priority or the affinity mask, bytes 20 to 23 and calls before
sceBluetoothHidInit. The run covers one input, (700, 0x3f), and a null block. The 0 on success is unverified: it is what the same run'ssceBluetoothHidParamInitializereturns, and SharpProspero's class comment, L11-L12, gives 0 on success for every call of the library. The same lines saysceBluetoothHidInitmust run first; likesceBluetoothHidParamInitializeonmain, this function does not check that. A new entry indocs/dev/debt/libSceBluetoothHid.mdrecords these gaps, and thesceBluetoothHidParamInitializeentry drops its closing clause (L10: "The same run coverssceBluetoothHidThreadParamInitialize, still unimplemented here").Unchanged:
sceBluetoothHidRegisterCallbackstill throws for a non-null thread block after itsreservedcheck (L42-L45, from aaf286859), because the host has no event-watcher thread to apply the priority and affinity to. A title that passes the block built here tosceBluetoothHidRegisterCallbackstill stops there, so this PR moves no title forward. No title is known to importsceBluetoothHidThreadParamInitialize: the exports that cb00552dd added, with signatures taken from one title, do not include it, and it came from the firmware export database in 173c827c6.Test, in
guest_bluetooth_hid(core/libs/tests/GuestBluetoothHid.cpp), after the existingsceBluetoothHidParamInitializechecks (L101-L117): aBluetoothHidThreadParamfilled with 0x5a and initialised with (700, 0x3f) must return 0 and hold the run's bytes:bc 02 00 00at 0 to 3,5a 5a 5a 5aat 4 to 7,3fand seven00at 8 to 15, and00 00 00 00at 16 to 19. A null block must return0x81540001with (700, 0x3f) and with (0, 0). Bytes 20 to 23, other values and calls beforesceBluetoothHidInitare not checked, as the run does not cover them.Overlap:
tools/pr_overlap.pyagainst the open PRs on 2026-10-28 reports only #9138, which conflicts withmainand sharesExport.cppanddocs/dev/debt/libSceBluetoothHid.md. Against its merge base, #9138 editssceBluetoothHidGetDeviceName,sceBluetoothHidGetInputReportandsceBluetoothHidSetOutputReport, adds a Silent stubs entry for them and appends a comment line to each file. It touches neithersceBluetoothHidThreadParamInitializenor the debt entries changed here, so neither PR needs to go first.gh pr list --state open --search ThreadParamInitializefinds no PR;--search BluetoothHidfinds only #7658, which changes no BluetoothHid file.Tested
Gentoo Linux, kernel 7.2.8, GCC 16.2.1, Release,
BUILD_TESTING=ON, Ninja, this branch onmain319621b.ctest --test-dir build -R '^guest_bluetooth_hid$|public_headers' --output-on-failure -j8 --timeout 300: 66/66 passed (guest_bluetooth_hid,public_headersand the 64public_headers_compile_*batches).ctest --test-dir build -R '^guest_bluetooth_hid$' --output-on-failure, three more times: 1/1 passed each time, in under 0.01 s.main'sExport.cpp(git show 319621ba2:core/libs/prx/libSceBluetoothHid/Export.cpp) and this test, rebuilt,guest_bluetooth_hidaborts withterminate called after throwing an instance of 'std::runtime_error',what(): sceBluetoothHidThreadParamInitialize not implemented.tools/select_tests.pydump,select,ninja -C build -f select.ninja selected,tools/select_tests.py ctest build --output-on-failure -j8): 487 of the 2745 tests selected, 487/487 passed, none skipped.python3 tools/check_test_registration.py build: 1515 test executables, 0 built and not run, none new.python3 tools/check_conventions.py --base 319621ba2: all checks passed.x86_64-w64-mingw32-g++16.2.0 with-std=gnu++20 -fsyntax-only -Wall -Wextra -D_WIN32_WINNT=0x0602 -I core/libs -I core/libs/nid/include -I core/libs/prx/libkernelonExport.cppandGuestBluetoothHid.cpp: no errors. The only warnings are-Wunused-parameteron the unchanged stubs atExport.cpplines 77 to 128.Not tested: no console, no title, no Windows or macOS build or run.
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)🤖 Generated with Claude Code