Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/libs/prx/libScePad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ if(BUILD_TESTING)
endif()
endif()

if(BUILD_TESTING)
add_test_executable(guest_pad_device_model_queries_tests ${LIBS_INCLUDE_DIR}/tests/GuestPadDeviceModelQueries.cpp)
target_include_directories(guest_pad_device_model_queries_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_pad_device_model_queries_tests PRIVATE libScePad libc)
configure_windows_unwind(guest_pad_device_model_queries_tests)
add_test(NAME guest_pad_device_model_queries COMMAND guest_pad_device_model_queries_tests)
if(WIN32)
set_tests_properties(guest_pad_device_model_queries PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libScePad>")
endif()
endif()

if(BUILD_TESTING)
add_test_executable(pad_rumble_intensity_tests tests/PadRumbleIntensity.cpp)
target_include_directories(pad_rumble_intensity_tests PRIVATE ${LIBS_INCLUDE_DIR})
Expand Down
6 changes: 4 additions & 2 deletions core/libs/prx/libScePad/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,8 @@ int APS5_VABI scePadSetProfileIndicatorAnimation(std::int32_t handle, std::uint8
}

int APS5_VABI scePadIsCoPilot(std::int32_t handle) {
NotImplemented_nid_no_patch(__func__);
if (!Pad::IsInitialized()) return PAD_ERROR_NOT_INITIALIZED;
(void)handle;
return 0;
}

Expand Down Expand Up @@ -1084,7 +1085,8 @@ int APS5_VABI scePadGetBluetoothAddress(std::int32_t handle, std::uint64_t* addr
}

int APS5_VABI scePadIsMoveReproductionModel(std::int32_t handle) {
NotImplemented_nid_no_patch(__func__);
if (!Pad::IsInitialized()) return PAD_ERROR_NOT_INITIALIZED;
(void)handle;
return 0;
}

Expand Down
22 changes: 22 additions & 0 deletions core/libs/tests/GuestPadDeviceModelQueries.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "SceTypes.hpp"
#include "prx/libScePad/include/Pad.hpp"
#include <cstdlib>
#include <initializer_list>

static void Require(bool value) { if (!value) std::abort(); }

int main() {
for (int handle : {-1, 0, PAD_HANDLE, PAD_HANDLE + 1, PAD_SPECIAL_HANDLE, PAD_REMOTE_HANDLE, 12345}) {
Require(scePadIsCoPilot(handle) == PAD_ERROR_NOT_INITIALIZED);
Require(scePadIsMoveReproductionModel(handle) == PAD_ERROR_NOT_INITIALIZED);
}
Require(scePadInit_nid_postfix() == PAD_OK);
const int handle = scePadOpen_nid_postfix(0x10000000, 0, 0, nullptr);
Require(handle > 0);
Require(scePadIsCoPilot(handle) == 0);
Require(scePadIsMoveReproductionModel(handle) == 0);
Require(scePadClose_nid_postfix(handle) == PAD_OK);
Require(scePadIsCoPilot(handle) == 0);
Require(scePadIsMoveReproductionModel(handle) == 0);
return 0;
}
14 changes: 14 additions & 0 deletions docs/dev/debt/libScePad.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@
- [scePadDisableVibration, scePadIsLightBarBaseBrightnessControllable](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - `scePadDisableVibration(true)` stops active running motors on the port without disabling vibration for subsequent `scePadSetVibration` calls; `scePadIsLightBarBaseBrightnessControllable` reports 1 for standard DualSense handles and 0 for special handles while the modifier is a no-op.
- [libScePad internal data and device control](../../../core/libs/prx/libScePad/Export.cpp) - kernel-owned version, telemetry, Lotus-button and update payload fields remain unresolved. Lotus-button parameter units and the three blinking byte meanings are unknown. Port information occupies 152 bytes; history records occupy 72 bytes; Leonardo unique data occupies 24 bytes. Their complete field semantics remain unresolved.
- [libScePad profile writes and virtual devices](../../../core/libs/prx/libScePad/Export.cpp) - profile writes take a handle, profile ID, profile pointer and a 32-bit result pointer; the profile payload direction and fields remain unresolved. Virtual-device creation takes an input record and an output ID pointer, whose width is not exposed by the wrapper. Component information copies 16 bytes; field meanings remain unknown. Virtual trigger state contains two 32-bit states and three control bytes, but the control semantics remain incomplete.
- [scePadIsCoPilot, scePadIsMoveReproductionModel](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - the `int (int handle)` signatures are recovered. Firmware 13.42's module, as BunnyFl read it for the [#15074](https://github.com/boykopovar/AnyPS5/pull/15074) review, returns `0x80920005` before `scePadInit` from both (`scePadIsCoPilot` at 0x158e0, `scePadIsMoveReproductionModel` at 0x11310); after it `scePadIsCoPilot` sends ioctl `0xc0184853` with sub-command `0x0a` and the handle, and returns the kernel's answer without validating the handle itself; the rest of `scePadIsMoveReproductionModel` is untraced. This host keeps the init check like `scePadGetBluetoothAddress` and answers false for every handle after init: the library reports one DualSense to every title and no co-pilot pairing or Move exists here, so no handle can hold one. Like `scePadIsDS4Connected`, the after-init answer is this host's choice, not a console measurement.
- [scePadGetIdleCount, scePadGetControllerIdleCount](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - the `uint64_t (int userId)` and `int (int handle, uint64_t*)` argument registers are recovered. What the counter counts (time since the last input, or since open), its unit and when it resets are unknown; no console measurement or disassembly note exists, [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/pad/pad.cpp) stubs scePadGetIdleCount (OK, nothing written) and does not export the controller variant, and [duaLib](https://github.com/WujekFoliarz/duaLib/blob/master/src/include/duaLib.h) exposes neither call. Both exports still throw.
- [scePadGetCapability, scePadGetDeviceId, scePadGetDeviceInfo, scePadGetActiveTime](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - argument registers recovered: a device id with a 32-bit capability output, a handle with a 32-bit device-id output, a device id with `PadDeviceInfo`, and a handle with a 32-bit type and a 64-bit active time. The device-id space behind the handles, the capability bits, the `PadDeviceInfo` layout and the active-time types and units are unknown; nothing is measured; shadPS4 stubs scePadGetCapability, scePadGetDeviceId and scePadGetDeviceInfo and does not export scePadGetActiveTime. All still throw.
- [scePadMbusInit, scePadMbusTerm, scePadConnectPort, scePadDisconnectPort, scePadDisconnectDevice](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - argument registers recovered. These manage the system's pad ports and its Mbus presence (scePadUnknown_n3kSX62fgNo sends to ShellCore over Mbus, see above); titles are not expected to call them, and their validation and effects are not measured - shadPS4 accepts them as empty stubs. All still throw.
- [scePadOpenExt2, scePadDeviceOpen, scePadGetDataInternal](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - argument registers recovered (`uint64_t` device-id opens; a `uint8_t`-port internal read into `PadData`). The device-id space, the open validation order and the internal read's behaviour for a withdrawn pad are unknown; shadPS4 stubs all three as empty. All still throw.
- [scePadSwitchConnection, scePadSetPS4BcVibrationMode, scePadSetShareButtonMaskForRemotePlay, scePadRemoteControlInsertData, scePadRemoteControlInsertDataForAston](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - argument registers recovered (a handle with switch flags; a vibration-mode byte; a share-button mask byte; a byte buffer each for the remote injections). What the flags switch between, which backward-compatibility vibration modes exist, which mask bits are valid and what the injected packets contain are unknown; no measurement exists; shadPS4 stubs scePadSwitchConnection and scePadSetShareButtonMaskForRemotePlay, and scePadSetPS4BcVibrationMode and the two remote-control injections have no public reimplementation. All still throw.
- [scePadGetFeatureReport2, scePadSetFeatureReport2](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - same handle, report-id, buffer and byte-count registers as scePadGetFeatureReport and scePadSetFeatureReport (see the report entry above); what separates the two generations is unknown. Both still throw.
- [scePadSetButtonRemappingInfo, scePadSetProcessPrivilegeOfButtonRemapping](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - `PadButtonRemappingInfo` is 16 bytes: 14 mapping bytes, a reserved byte and a mode byte at offset 15. Which mode values are valid, what the mapping bytes encode and which processes earn the remapping privilege are unknown; not measured, and shadPS4 stubs both. Both still throw.
- [scePadSetLotusIrCodeSetStart, scePadSetLotusIrCodeSetData, scePadSetLotusIrCodeSetEnd, scePadGetLotusIrCodeSetResult, scePadSetLotusEnableIrKey, scePadSetLotusDisableIrKey](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - the Lotus (Access controller) IR-code programming sequence: start names a code set, a code and a data size, data takes a packet index and bytes, end closes the sequence and the result call writes a 32-bit result and a device byte. The packet framing, the code-set space and the result codes are unknown; nothing is measured or reimplemented publicly. All still throw.
- [scePadSetTriggerEffectExt, scePadGetTriggerEffectInternalState](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - the `PadTriggerEffectExtended` and `PadTriggerInternalState` layouts are unresolved, unlike the 120-byte scePadSetTriggerEffect parameter and the 56-byte VR records (see above); which modes the extended form adds and what the internal state reports are unknown. Both still throw.
- [scePadSetProfileEditMode, scePadGetProfileEditMode, scePadGetProfileEditModeLeonardo, scePadSetSelectButtonCustomizeMode, scePadGetSelectButtonCustomizeMode, scePadSetToggleAllReleaseLeonardo, scePadSetProfileIndicatorAnimation](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - argument registers recovered (edit mode takes a handle, a bool and a profile number; the mode getter writes a 32-bit value; the rest take a handle, plus one animation byte). What the Access controller's edit modes and profile numbers mean, which select-button customizations exist and which animation values are valid are unknown; nothing is measured. All still throw.
- [scePadGetControllerTypeLeonardo, scePadSetControllerTypeLeonardo](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - a device id with a 32-bit controller-type output or input. The Leonardo type values are unknown; [duaLib](https://github.com/WujekFoliarz/duaLib/blob/master/src/include/duaLib.h)'s `s_SceControllerType` covers only DualShock 4 (1) and DualSense (2). Both still throw.
- [scePadStartRecording, scePadStopRecording](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - both take no arguments. Whether recording fills the 72-byte history records scePadReadHistory returns (see above), from which moment, and how start and stop pair is unknown; shadPS4 accepts both as empty stubs. Both still throw.
- [scePadRegisterCollaboInputMgrProcess](../../../core/libs/prx/libScePad/Export.cpp) (libScePad) - takes no arguments. What registering the calling process with the collaboration input manager grants, which processes may call it and what it returns on success or refusal are unknown; no console measurement or disassembly note exists, and shadPS4 does not expose the export at all. Still throws.

### Functional

Expand Down
Loading