Skip to content

feat(libScePad): implement scePadGetAccessibilityControllerState (zBsgF0q8DIM) - #7909

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
parl0v:feat/pad-accessibility-controller-state
Oct 19, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
parl0v:feat/pad-accessibility-controller-state

Conversation

@parl0v

@parl0v parl0v commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

What

zBsgF0q8DIM is scePadGetAccessibilityControllerState: compute_nid("scePadGetAccessibilityControllerState") in tools/nid_names.py gives zBsgF0q8DIM. The name is not in the aerolib list; I found it with a dictionary search over pad vocabulary. This replaces the APS5_EXPORT alias and the throwing scePadUnknown_zBsgF0q8DIM with the named function and its real signature, so the patched libScePad.prx exports the same NID from the name.

Signature, errors and their order come from a static analysis of the OS 10.01 system module (libScePad.sprx). At pseudocode level:

int32_t scePadGetAccessibilityControllerState(int32_t handle, uint32_t *state)
{
    if (!initialized)           return 0x80920005;
    if (state == NULL)          return 0x80920001;
    if (!is_open_handle(handle)) return 0x80920003;
    device = driver_device_of(handle);
    if (no device)              { *state = 0; return 0; }
    if (driver has no answer)   { *state = 1; return 0; }
    *state = driver_value(device); return 0;
}
  • The handle is looked up in the library's open-handle table under its mutex, after the NULL check.
  • The value comes from the pad driver: one ioctl gets the device id behind the handle, a second one (sub-op 0xC) reads a per-device 32-bit value. The same driver query backs scePadGetUsbDetectionState (sub-op 5) and scePadIsCoPilot (sub-op 0xA).
  • The output is a 32-bit value, not a bool.

The implementation keeps the three checks in the same order (Pad::IsInitialized(), PAD_ERROR_INVALID_ARG, PAD_HANDLE) and, for the open handle, writes 0 and returns 0. The emulated pad is a DualSense, not an Access controller, so 0 is my reading of the name. It is inferred: the value a console reports for a DualSense is not measured, and the module writes 1 when the driver has no answer, so a console might report 1 for a DualSense. The debt entry records this.

Title evidence: Marvel's Wolverine (PPSA03671) imports it (#4962, #5516), but the #4962 scan and a later run in #5516 found no call site, so no title is known to call it. When #6281 was closed, the reason given was that a silent 0 would hide an unknown function. With this change the function is no longer unknown: the name matches the NID, the error paths are those of the system module, and only the DualSense value is inferred. Thanks to fdfawef324 for #4962, which declared the import.

My other libScePad pull request (n3kSX62fgNo) touches the same three files; the two merge cleanly in either order.

Tested

Windows 10 (19045), WinLibs GCC 15.2.0, Release, Ninja, main f3bb6a4 plus this commit:

  • ctest -R "^guest_pad": guest_pad and guest_pad_vibration_mode pass.
  • guest_pad checks:
    • before scePadInit: 0x80920005 with a NULL and with a valid pointer, output left alone;
    • with a pad open: NULL with a bad handle gives INVALID_ARG (the NULL check comes first), a bad handle gives INVALID_HANDLE with the output left alone, and the open handle gives 0 with *state == 0.
  • On main the new test does not link (undefined reference to scePadGetAccessibilityControllerState). With main's throwing body under the new name, guest_pad aborts with scePadGetAccessibilityControllerState not implemented.
  • The patched libScePad.prx exports zBsgF0q8DIM (objdump -p).
  • python tools/check_conventions.py --base origin/main with this title and body passes.

The title was not run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none. PPSA03671 Marvel's Wolverine (PPSA03671) #5516 imports it, but no call site is known.
  • GPUs tested: n/a
  • AI-assisted: yes

…gF0q8DIM)

The name hashes to zBsgF0q8DIM. Signature and error order follow the
OS 10.01 system module: NOT_INITIALIZED, INVALID_ARG for a NULL output,
INVALID_HANDLE for a bad handle. The emulated pad is not an Access
controller and reports 0.
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 19, 2026
@github-actions

Copy link
Copy Markdown

Progress report (4b462ef → acd1e0e)

📈 System libraries: 81.69% (+0.02%, +1 implemented, -1 removed functions)

✅ 1 implemented
Library Name
libScePad scePadGetAccessibilityControllerState
🗑️ 1 removed
Library Name
libScePad scePadUnknown_zBsgF0q8DIM

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7881 core/libs/tests/GuestPad.cpp L30

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.

Pull request Shared files not compared
PR 5038 core/libs/prx/libScePad/Export.cpp
docs/dev/debt/libScePad.md
PR 6044 core/libs/tests/GuestPad.cpp

@oneandonlydean oneandonlydean self-assigned this Oct 19, 2026
@oneandonlydean
oneandonlydean merged commit dbac9fa into boykopovar:main Oct 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants