From 0aa29428e11f1fe8ed982bcfd8fa288a9ac9c4d9 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sat, 15 Jun 2024 18:43:01 +0300 Subject: [PATCH] new pad module structured using modulegenerator , added common pad structures and function signatures --- src/core/libraries/libs.cpp | 2 +- src/core/libraries/pad/old_pad.cpp | 126 ++++++ src/core/libraries/pad/old_pad.h | 128 ++++++ src/core/libraries/pad/pad.cpp | 656 ++++++++++++++++++++++++----- src/core/libraries/pad/pad.h | 343 +++++++++++---- src/sdl_window.cpp | 20 +- 6 files changed, 1090 insertions(+), 185 deletions(-) create mode 100644 src/core/libraries/pad/old_pad.cpp create mode 100644 src/core/libraries/pad/old_pad.h diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index b4c77f90..f163a9d8 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -40,7 +40,6 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::Kernel::LibKernel_Register(sym); Libraries::VideoOut::RegisterLib(sym); Libraries::GnmDriver::RegisterlibSceGnmDriver(sym); - Libraries::LibPad::padSymbolsRegister(sym); if (!Config::isLleLibc()) { Libraries::LibC::libcSymbolsRegister(sym); } @@ -71,6 +70,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::PngDec::RegisterlibScePngDec(sym); Libraries::PlayGo::RegisterlibScePlayGo(sym); Libraries::Usbd::RegisterlibSceUsbd(sym); + Libraries::Pad::RegisterlibScePad(sym); } } // namespace Libraries diff --git a/src/core/libraries/pad/old_pad.cpp b/src/core/libraries/pad/old_pad.cpp new file mode 100644 index 00000000..e2f73afe --- /dev/null +++ b/src/core/libraries/pad/old_pad.cpp @@ -0,0 +1,126 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "common/singleton.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" +#include "core/libraries/pad/pad.h" +#include "input/controller.h" + +namespace Libraries::LibPad { + +int PS4_SYSV_ABI scePadInit() { + LOG_WARNING(Lib_Pad, "(DUMMY) called"); + return SCE_OK; +} + +int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId user_id, s32 type, + s32 index, const ScePadOpenParam* pParam) { + LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", user_id, type, index); + return 1; // dummy +} + +int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { + auto* controller = Common::Singleton::Instance(); + + int connectedCount = 0; + bool isConnected = false; + Input::State state; + + controller->readState(&state, &isConnected, &connectedCount); + pData->buttons = state.buttonsState; + pData->leftStick.x = 128; // dummy + pData->leftStick.y = 128; // dummy + pData->rightStick.x = 0; // dummy + pData->rightStick.y = 0; // dummy + pData->analogButtons.r2 = 0; // dummy + pData->analogButtons.l2 = 0; // dummy + pData->orientation.x = 0; + pData->orientation.y = 0; + pData->orientation.z = 0; + pData->orientation.w = 0; + pData->timestamp = state.time; + pData->connected = true; // isConnected; //TODO fix me proper + pData->connectedCount = 1; // connectedCount; + pData->deviceUniqueDataLen = 0; + + return SCE_OK; +} + +int PS4_SYSV_ABI scePadRead(int handle, ScePadData* pData, int num) { + int connected_count = 0; + bool connected = false; + Input::State states[64]; + auto* controller = Common::Singleton::Instance(); + int ret_num = controller->ReadStates(states, num, &connected, &connected_count); + + if (!connected) { + ret_num = 1; + } + + for (int i = 0; i < ret_num; i++) { + pData[i].buttons = states[i].buttonsState; + pData[i].leftStick.x = 128; // dummy + pData[i].leftStick.y = 128; // dummy + pData[i].rightStick.x = 0; // dummy + pData[i].rightStick.y = 0; // dummy + pData[i].analogButtons.l2 = 0; // dummy + pData[i].analogButtons.r2 = 0; // dummy + pData[i].orientation.x = 0.0f; + pData[i].orientation.y = 0.0f; + pData[i].orientation.z = 0.0f; + pData[i].orientation.w = 1.0f; + pData[i].acceleration.x = 0.0f; + pData[i].acceleration.y = 0.0f; + pData[i].acceleration.z = 0.0f; + pData[i].angularVelocity.x = 0.0f; + pData[i].angularVelocity.y = 0.0f; + pData[i].angularVelocity.z = 0.0f; + pData[i].touchData.touchNum = 0; + pData[i].touchData.touch[0].x = 0; + pData[i].touchData.touch[0].y = 0; + pData[i].touchData.touch[0].id = 1; + pData[i].touchData.touch[1].x = 0; + pData[i].touchData.touch[1].y = 0; + pData[i].touchData.touch[1].id = 2; + pData[i].connected = connected; + pData[i].timestamp = states[i].time; + pData[i].connectedCount = connected_count; + pData[i].deviceUniqueDataLen = 0; + } + + return ret_num; +} + +s32 PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadInformation* info) { + LOG_INFO(Lib_Pad, "called handle = {}", handle); + info->touchpadDensity = 1; + info->touchResolutionX = 1920; + info->touchResolutionY = 950; + info->stickDeadzoneL = 2; + info->stickDeadzoneR = 2; + info->connectionType = ORBIS_PAD_CONNECTION_TYPE_STANDARD; + info->count = 1; + info->connected = 1; + info->deviceClass = ORBIS_PAD_PORT_TYPE_STANDARD; + return SCE_OK; +} + +s32 PS4_SYSV_ABI scePadSetMotionSensorState(s32 handle, bool enable) { + LOG_INFO(Lib_Pad, "(DUMMY) called handle = {} enabled = {}", handle, + (enable ? "true" : "false")); + return SCE_OK; +} + +void padSymbolsRegister(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit); + LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen); + LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState); + LIB_FUNCTION("q1cHNfGycLI", "libScePad", 1, "libScePad", 1, 1, scePadRead); + + LIB_FUNCTION("gjP9-KQzoUk", "libScePad", 1, "libScePad", 1, 1, scePadGetControllerInformation); + LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState); +} + +} // namespace Libraries::LibPad diff --git a/src/core/libraries/pad/old_pad.h b/src/core/libraries/pad/old_pad.h new file mode 100644 index 00000000..7895da7e --- /dev/null +++ b/src/core/libraries/pad/old_pad.h @@ -0,0 +1,128 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" +#include "src/core/libraries/system/userservice.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::LibPad { + +constexpr s8 ORBIS_PAD_PORT_TYPE_STANDARD = 0; +constexpr s8 ORBIS_PAD_PORT_TYPE_SPECIAL = 2; + +constexpr s8 ORBIS_PAD_DEVICE_CLASS_PAD = 0; +constexpr s8 ORBIS_PAD_DEVICE_CLASS_GUITAR = 1; +constexpr s8 ORBIS_PAD_DEVICE_CLASS_DRUMS = 2; + +constexpr s8 ORBIS_PAD_CONNECTION_TYPE_STANDARD = 0; +constexpr s8 ORBIS_PAD_CONNECTION_TYPE_REMOTE = 2; + +enum ScePadButton : u32 { + L3 = 0x00000002, + R3 = 0x00000004, + OPTIONS = 0x00000008, + UP = 0x00000010, + RIGHT = 0x00000020, + DOWN = 0x00000040, + LEFT = 0x00000080, + L2 = 0x00000100, + R2 = 0x00000200, + L1 = 0x00000400, + R1 = 0x00000800, + TRIANGLE = 0x00001000, + CIRCLE = 0x00002000, + CROSS = 0x00004000, + SQUARE = 0x00008000, + TOUCH_PAD = 0x00100000, + INTERCEPTED = 0x80000000, +}; + +struct ScePadOpenParam { + u8 reserve[8]; +}; + +struct ScePadAnalogStick { + u8 x; + u8 y; +}; +struct ScePadAnalogButtons { + u8 l2; + u8 r2; + u8 padding[2]; +}; + +struct SceFQuaternion { + float x, y, z, w; +}; + +struct SceFVector3 { + float x, y, z; +}; + +struct ScePadTouch { + u16 x; + u16 y; + u8 id; + u8 reserve[3]; +}; + +constexpr int SCE_PAD_MAX_TOUCH_NUM = 2; + +typedef struct ScePadTouchData { + u8 touchNum; + u8 reserve[3]; + u32 reserve1; + ScePadTouch touch[SCE_PAD_MAX_TOUCH_NUM]; +} ScePadTouchData; + +struct ScePadExtensionUnitData { + u32 extensionUnitId; + u8 reserve[1]; + u8 dataLength; + u8 data[10]; +}; + +struct ScePadData { + u32 buttons; + ScePadAnalogStick leftStick; + ScePadAnalogStick rightStick; + ScePadAnalogButtons analogButtons; + SceFQuaternion orientation; + SceFVector3 acceleration; + SceFVector3 angularVelocity; + ScePadTouchData touchData; + bool connected; + u64 timestamp; + ScePadExtensionUnitData extensionUnitData; + uint8_t connectedCount; + uint8_t reserve[2]; + uint8_t deviceUniqueDataLen; + uint8_t deviceUniqueData[12]; +}; + +struct OrbisPadInformation { + float touchpadDensity; + u16 touchResolutionX; + u16 touchResolutionY; + u8 stickDeadzoneL; + u8 stickDeadzoneR; + u8 connectionType; + u8 count; + s8 connected; + s8 deviceClass; + u8 unknown[8]; +}; + +int PS4_SYSV_ABI scePadInit(); +int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 type, + s32 index, const ScePadOpenParam* pParam); +int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData); + +void padSymbolsRegister(Core::Loader::SymbolsResolver* sym); + +}; // namespace Libraries::LibPad diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index e2f73afe..fc927f52 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -1,126 +1,580 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +// Generated By moduleGenerator #include "common/logging/log.h" -#include "common/singleton.h" #include "core/libraries/error_codes.h" #include "core/libraries/libs.h" -#include "core/libraries/pad/pad.h" -#include "input/controller.h" +#include "pad.h" -namespace Libraries::LibPad { +namespace Libraries::Pad { + +int PS4_SYSV_ABI scePadClose(s32 handle) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadConnectPort() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation( + s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDeviceClassParseData(s32 handle, const OrbisPadData* pData, + OrbisPadDeviceClassData* pDeviceClassData) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDeviceOpen() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDisableVibration() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDisconnectDevice() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadDisconnectPort() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadEnableAutoDetect() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadEnableExtensionPort() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadEnableSpecificDeviceClass() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadEnableUsbConnection() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetBluetoothAddress() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetCapability() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerInformation* pInfo) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetDataInternal() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetDeviceId() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetDeviceInfo() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetExtControllerInformation() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetExtensionUnitInfo() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetFeatureReport() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetHandle(s32 userId, s32 type, s32 index) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetIdleCount() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetInfo() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetInfoByPortType() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetLicenseControllerInformation() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetMotionSensorPosition() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetMotionTimerUnit() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetSphereRadius() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadGetVersionInfo() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} int PS4_SYSV_ABI scePadInit() { - LOG_WARNING(Lib_Pad, "(DUMMY) called"); - return SCE_OK; + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId user_id, s32 type, - s32 index, const ScePadOpenParam* pParam) { - LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", user_id, type, index); - return 1; // dummy +int PS4_SYSV_ABI scePadIsBlasterConnected() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { - auto* controller = Common::Singleton::Instance(); - - int connectedCount = 0; - bool isConnected = false; - Input::State state; - - controller->readState(&state, &isConnected, &connectedCount); - pData->buttons = state.buttonsState; - pData->leftStick.x = 128; // dummy - pData->leftStick.y = 128; // dummy - pData->rightStick.x = 0; // dummy - pData->rightStick.y = 0; // dummy - pData->analogButtons.r2 = 0; // dummy - pData->analogButtons.l2 = 0; // dummy - pData->orientation.x = 0; - pData->orientation.y = 0; - pData->orientation.z = 0; - pData->orientation.w = 0; - pData->timestamp = state.time; - pData->connected = true; // isConnected; //TODO fix me proper - pData->connectedCount = 1; // connectedCount; - pData->deviceUniqueDataLen = 0; - - return SCE_OK; +int PS4_SYSV_ABI scePadIsDS4Connected() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -int PS4_SYSV_ABI scePadRead(int handle, ScePadData* pData, int num) { - int connected_count = 0; - bool connected = false; - Input::State states[64]; - auto* controller = Common::Singleton::Instance(); - int ret_num = controller->ReadStates(states, num, &connected, &connected_count); - - if (!connected) { - ret_num = 1; - } - - for (int i = 0; i < ret_num; i++) { - pData[i].buttons = states[i].buttonsState; - pData[i].leftStick.x = 128; // dummy - pData[i].leftStick.y = 128; // dummy - pData[i].rightStick.x = 0; // dummy - pData[i].rightStick.y = 0; // dummy - pData[i].analogButtons.l2 = 0; // dummy - pData[i].analogButtons.r2 = 0; // dummy - pData[i].orientation.x = 0.0f; - pData[i].orientation.y = 0.0f; - pData[i].orientation.z = 0.0f; - pData[i].orientation.w = 1.0f; - pData[i].acceleration.x = 0.0f; - pData[i].acceleration.y = 0.0f; - pData[i].acceleration.z = 0.0f; - pData[i].angularVelocity.x = 0.0f; - pData[i].angularVelocity.y = 0.0f; - pData[i].angularVelocity.z = 0.0f; - pData[i].touchData.touchNum = 0; - pData[i].touchData.touch[0].x = 0; - pData[i].touchData.touch[0].y = 0; - pData[i].touchData.touch[0].id = 1; - pData[i].touchData.touch[1].x = 0; - pData[i].touchData.touch[1].y = 0; - pData[i].touchData.touch[1].id = 2; - pData[i].connected = connected; - pData[i].timestamp = states[i].time; - pData[i].connectedCount = connected_count; - pData[i].deviceUniqueDataLen = 0; - } - - return ret_num; +int PS4_SYSV_ABI scePadIsLightBarBaseBrightnessControllable() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -s32 PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadInformation* info) { - LOG_INFO(Lib_Pad, "called handle = {}", handle); - info->touchpadDensity = 1; - info->touchResolutionX = 1920; - info->touchResolutionY = 950; - info->stickDeadzoneL = 2; - info->stickDeadzoneR = 2; - info->connectionType = ORBIS_PAD_CONNECTION_TYPE_STANDARD; - info->count = 1; - info->connected = 1; - info->deviceClass = ORBIS_PAD_PORT_TYPE_STANDARD; - return SCE_OK; +int PS4_SYSV_ABI scePadIsMoveConnected() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -s32 PS4_SYSV_ABI scePadSetMotionSensorState(s32 handle, bool enable) { - LOG_INFO(Lib_Pad, "(DUMMY) called handle = {} enabled = {}", handle, - (enable ? "true" : "false")); - return SCE_OK; +int PS4_SYSV_ABI scePadIsMoveReproductionModel() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; } -void padSymbolsRegister(Core::Loader::SymbolsResolver* sym) { - LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit); - LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen); - LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState); - LIB_FUNCTION("q1cHNfGycLI", "libScePad", 1, "libScePad", 1, 1, scePadRead); +int PS4_SYSV_ABI scePadIsValidHandle() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} +int PS4_SYSV_ABI scePadMbusInit() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadMbusTerm() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadOpenExt() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadOpenExt2() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadOutputReport() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadBlasterForTracker() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadExt() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadForTracker() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadHistory() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadReadStateExt() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadResetLightBar(s32 handle) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadResetLightBarAll() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadResetLightBarAllByPortType() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadResetOrientation(s32 handle) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadResetOrientationForTracker() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetAngularVelocityDeadbandState(s32 handle, bool bEnable) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetAutoPowerOffCount() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetButtonRemappingInfo() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetConnection() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetExtensionReport() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetFeatureReport() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetForceIntercepted() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetLightBar(s32 handle, const OrbisPadLightBarParam* pParam) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetLightBarBaseBrightness() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetLightBarBlinking() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetLightBarForTracker() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetLoginUserNumber() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetMotionSensorState(s32 handle, bool bEnable) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetProcessFocus() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetProcessPrivilege() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetProcessPrivilegeOfButtonRemapping() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetShareButtonMaskForRemotePlay() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetTiltCorrectionState(s32 handle, bool bEnable) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetUserColor() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetVibration(s32 handle, const OrbisPadVibrationParam* pParam) { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetVibrationForce() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSetVrTrackingMode() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadShareOutputData() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadStartRecording() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadStopRecording() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadSwitchConnection() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVertualDeviceAddDevice() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVirtualDeviceAddDevice() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVirtualDeviceDeleteDevice() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVirtualDeviceDisableButtonRemapping() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVirtualDeviceGetRemoteSetting() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI scePadVirtualDeviceInsertData() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI Func_28B998C7D8A3DA1D() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI Func_298D21481F94C9FA() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI Func_51E514BCD3A05CA5() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI Func_89C9237E393DA243() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI Func_EF103E845B6F0420() { + LOG_ERROR(Lib_Pad, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterlibScePad(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("6ncge5+l5Qs", "libScePad", 1, "libScePad", 1, 1, scePadClose); + LIB_FUNCTION("kazv1NzSB8c", "libScePad", 1, "libScePad", 1, 1, scePadConnectPort); + LIB_FUNCTION("AcslpN1jHR8", "libScePad", 1, "libScePad", 1, 1, + scePadDeviceClassGetExtendedInformation); + LIB_FUNCTION("IHPqcbc0zCA", "libScePad", 1, "libScePad", 1, 1, scePadDeviceClassParseData); + LIB_FUNCTION("d7bXuEBycDI", "libScePad", 1, "libScePad", 1, 1, scePadDeviceOpen); + LIB_FUNCTION("0aziJjRZxqQ", "libScePad", 1, "libScePad", 1, 1, scePadDisableVibration); + LIB_FUNCTION("pnZXireDoeI", "libScePad", 1, "libScePad", 1, 1, scePadDisconnectDevice); + LIB_FUNCTION("9ez71nWSvD0", "libScePad", 1, "libScePad", 1, 1, scePadDisconnectPort); + LIB_FUNCTION("77ooWxGOIVs", "libScePad", 1, "libScePad", 1, 1, scePadEnableAutoDetect); + LIB_FUNCTION("+cE4Jx431wc", "libScePad", 1, "libScePad", 1, 1, scePadEnableExtensionPort); + LIB_FUNCTION("E1KEw5XMGQQ", "libScePad", 1, "libScePad", 1, 1, scePadEnableSpecificDeviceClass); + LIB_FUNCTION("DD-KiRLBqkQ", "libScePad", 1, "libScePad", 1, 1, scePadEnableUsbConnection); + LIB_FUNCTION("Q66U8FdrMaw", "libScePad", 1, "libScePad", 1, 1, scePadGetBluetoothAddress); + LIB_FUNCTION("qtasqbvwgV4", "libScePad", 1, "libScePad", 1, 1, scePadGetCapability); LIB_FUNCTION("gjP9-KQzoUk", "libScePad", 1, "libScePad", 1, 1, scePadGetControllerInformation); + LIB_FUNCTION("Uq6LgTJEmQs", "libScePad", 1, "libScePad", 1, 1, scePadGetDataInternal); + LIB_FUNCTION("hDgisSGkOgw", "libScePad", 1, "libScePad", 1, 1, scePadGetDeviceId); + LIB_FUNCTION("4rS5zG7RFaM", "libScePad", 1, "libScePad", 1, 1, scePadGetDeviceInfo); + LIB_FUNCTION("hGbf2QTBmqc", "libScePad", 1, "libScePad", 1, 1, + scePadGetExtControllerInformation); + LIB_FUNCTION("1DmZjZAuzEM", "libScePad", 1, "libScePad", 1, 1, scePadGetExtensionUnitInfo); + LIB_FUNCTION("PZSoY8j0Pko", "libScePad", 1, "libScePad", 1, 1, scePadGetFeatureReport); + LIB_FUNCTION("u1GRHp+oWoY", "libScePad", 1, "libScePad", 1, 1, scePadGetHandle); + LIB_FUNCTION("kiA9bZhbnAg", "libScePad", 1, "libScePad", 1, 1, scePadGetIdleCount); + LIB_FUNCTION("1Odcw19nADw", "libScePad", 1, "libScePad", 1, 1, scePadGetInfo); + LIB_FUNCTION("4x5Im8pr0-4", "libScePad", 1, "libScePad", 1, 1, scePadGetInfoByPortType); + LIB_FUNCTION("vegw8qax5MI", "libScePad", 1, "libScePad", 1, 1, + scePadGetLicenseControllerInformation); + LIB_FUNCTION("WPIB7zBWxVE", "libScePad", 1, "libScePad", 1, 1, scePadGetMotionSensorPosition); + LIB_FUNCTION("k4+nDV9vbT0", "libScePad", 1, "libScePad", 1, 1, scePadGetMotionTimerUnit); + LIB_FUNCTION("do-JDWX+zRs", "libScePad", 1, "libScePad", 1, 1, scePadGetSphereRadius); + LIB_FUNCTION("QuOaoOcSOw0", "libScePad", 1, "libScePad", 1, 1, scePadGetVersionInfo); + LIB_FUNCTION("hv1luiJrqQM", "libScePad", 1, "libScePad", 1, 1, scePadInit); + LIB_FUNCTION("bi0WNvZ1nug", "libScePad", 1, "libScePad", 1, 1, scePadIsBlasterConnected); + LIB_FUNCTION("mEC+xJKyIjQ", "libScePad", 1, "libScePad", 1, 1, scePadIsDS4Connected); + LIB_FUNCTION("d2Qk-i8wGak", "libScePad", 1, "libScePad", 1, 1, + scePadIsLightBarBaseBrightnessControllable); + LIB_FUNCTION("4y9RNPSBsqg", "libScePad", 1, "libScePad", 1, 1, scePadIsMoveConnected); + LIB_FUNCTION("9e56uLgk5y0", "libScePad", 1, "libScePad", 1, 1, scePadIsMoveReproductionModel); + LIB_FUNCTION("pFTi-yOrVeQ", "libScePad", 1, "libScePad", 1, 1, scePadIsValidHandle); + LIB_FUNCTION("CfwUlQtCFi4", "libScePad", 1, "libScePad", 1, 1, scePadMbusInit); + LIB_FUNCTION("s7CvzS+9ZIs", "libScePad", 1, "libScePad", 1, 1, scePadMbusTerm); + LIB_FUNCTION("xk0AcarP3V4", "libScePad", 1, "libScePad", 1, 1, scePadOpen); + LIB_FUNCTION("WFIiSfXGUq8", "libScePad", 1, "libScePad", 1, 1, scePadOpenExt); + LIB_FUNCTION("71E9e6n+2R8", "libScePad", 1, "libScePad", 1, 1, scePadOpenExt2); + LIB_FUNCTION("DrUu8cPrje8", "libScePad", 1, "libScePad", 1, 1, scePadOutputReport); + LIB_FUNCTION("q1cHNfGycLI", "libScePad", 1, "libScePad", 1, 1, scePadRead); + LIB_FUNCTION("fm1r2vv5+OU", "libScePad", 1, "libScePad", 1, 1, scePadReadBlasterForTracker); + LIB_FUNCTION("QjwkT2Ycmew", "libScePad", 1, "libScePad", 1, 1, scePadReadExt); + LIB_FUNCTION("2NhkFTRnXHk", "libScePad", 1, "libScePad", 1, 1, scePadReadForTracker); + LIB_FUNCTION("3u4M8ck9vJM", "libScePad", 1, "libScePad", 1, 1, scePadReadHistory); + LIB_FUNCTION("YndgXqQVV7c", "libScePad", 1, "libScePad", 1, 1, scePadReadState); + LIB_FUNCTION("5Wf4q349s+Q", "libScePad", 1, "libScePad", 1, 1, scePadReadStateExt); + LIB_FUNCTION("DscD1i9HX1w", "libScePad", 1, "libScePad", 1, 1, scePadResetLightBar); + LIB_FUNCTION("+4c9xRLmiXQ", "libScePad", 1, "libScePad", 1, 1, scePadResetLightBarAll); + LIB_FUNCTION("+Yp6+orqf1M", "libScePad", 1, "libScePad", 1, 1, + scePadResetLightBarAllByPortType); + LIB_FUNCTION("rIZnR6eSpvk", "libScePad", 1, "libScePad", 1, 1, scePadResetOrientation); + LIB_FUNCTION("jbAqAvLEP4A", "libScePad", 1, "libScePad", 1, 1, + scePadResetOrientationForTracker); + LIB_FUNCTION("r44mAxdSG+U", "libScePad", 1, "libScePad", 1, 1, + scePadSetAngularVelocityDeadbandState); + LIB_FUNCTION("ew647HuKi2Y", "libScePad", 1, "libScePad", 1, 1, scePadSetAutoPowerOffCount); + LIB_FUNCTION("MbTt1EHYCTg", "libScePad", 1, "libScePad", 1, 1, scePadSetButtonRemappingInfo); + LIB_FUNCTION("MLA06oNfF+4", "libScePad", 1, "libScePad", 1, 1, scePadSetConnection); + LIB_FUNCTION("bsbHFI0bl5s", "libScePad", 1, "libScePad", 1, 1, scePadSetExtensionReport); + LIB_FUNCTION("xqgVCEflEDY", "libScePad", 1, "libScePad", 1, 1, scePadSetFeatureReport); + LIB_FUNCTION("lrjFx4xWnY8", "libScePad", 1, "libScePad", 1, 1, scePadSetForceIntercepted); + LIB_FUNCTION("RR4novUEENY", "libScePad", 1, "libScePad", 1, 1, scePadSetLightBar); + LIB_FUNCTION("dhQXEvmrVNQ", "libScePad", 1, "libScePad", 1, 1, scePadSetLightBarBaseBrightness); + LIB_FUNCTION("etaQhgPHDRY", "libScePad", 1, "libScePad", 1, 1, scePadSetLightBarBlinking); + LIB_FUNCTION("iHuOWdvQVpg", "libScePad", 1, "libScePad", 1, 1, scePadSetLightBarForTracker); + LIB_FUNCTION("o-6Y99a8dKU", "libScePad", 1, "libScePad", 1, 1, scePadSetLoginUserNumber); LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState); -} + LIB_FUNCTION("flYYxek1wy8", "libScePad", 1, "libScePad", 1, 1, scePadSetProcessFocus); + LIB_FUNCTION("DmBx8K+jDWw", "libScePad", 1, "libScePad", 1, 1, scePadSetProcessPrivilege); + LIB_FUNCTION("FbxEpTRDou8", "libScePad", 1, "libScePad", 1, 1, + scePadSetProcessPrivilegeOfButtonRemapping); + LIB_FUNCTION("yah8Bk4TcYY", "libScePad", 1, "libScePad", 1, 1, + scePadSetShareButtonMaskForRemotePlay); + LIB_FUNCTION("vDLMoJLde8I", "libScePad", 1, "libScePad", 1, 1, scePadSetTiltCorrectionState); + LIB_FUNCTION("z+GEemoTxOo", "libScePad", 1, "libScePad", 1, 1, scePadSetUserColor); + LIB_FUNCTION("yFVnOdGxvZY", "libScePad", 1, "libScePad", 1, 1, scePadSetVibration); + LIB_FUNCTION("8BOObG94-tc", "libScePad", 1, "libScePad", 1, 1, scePadSetVibrationForce); + LIB_FUNCTION("--jrY4SHfm8", "libScePad", 1, "libScePad", 1, 1, scePadSetVrTrackingMode); + LIB_FUNCTION("zFJ35q3RVnY", "libScePad", 1, "libScePad", 1, 1, scePadShareOutputData); + LIB_FUNCTION("80XdmVYsNPA", "libScePad", 1, "libScePad", 1, 1, scePadStartRecording); + LIB_FUNCTION("gAHvg6JPIic", "libScePad", 1, "libScePad", 1, 1, scePadStopRecording); + LIB_FUNCTION("Oi7FzRWFr0Y", "libScePad", 1, "libScePad", 1, 1, scePadSwitchConnection); + LIB_FUNCTION("0MB5x-ieRGI", "libScePad", 1, "libScePad", 1, 1, scePadVertualDeviceAddDevice); + LIB_FUNCTION("N7tpsjWQ87s", "libScePad", 1, "libScePad", 1, 1, scePadVirtualDeviceAddDevice); + LIB_FUNCTION("PFec14-UhEQ", "libScePad", 1, "libScePad", 1, 1, scePadVirtualDeviceDeleteDevice); + LIB_FUNCTION("pjPCronWdxI", "libScePad", 1, "libScePad", 1, 1, + scePadVirtualDeviceDisableButtonRemapping); + LIB_FUNCTION("LKXfw7VJYqg", "libScePad", 1, "libScePad", 1, 1, + scePadVirtualDeviceGetRemoteSetting); + LIB_FUNCTION("IWOyO5jKuZg", "libScePad", 1, "libScePad", 1, 1, scePadVirtualDeviceInsertData); + LIB_FUNCTION("KLmYx9ij2h0", "libScePad", 1, "libScePad", 1, 1, Func_28B998C7D8A3DA1D); + LIB_FUNCTION("KY0hSB+Uyfo", "libScePad", 1, "libScePad", 1, 1, Func_298D21481F94C9FA); + LIB_FUNCTION("UeUUvNOgXKU", "libScePad", 1, "libScePad", 1, 1, Func_51E514BCD3A05CA5); + LIB_FUNCTION("ickjfjk9okM", "libScePad", 1, "libScePad", 1, 1, Func_89C9237E393DA243); + LIB_FUNCTION("7xA+hFtvBCA", "libScePad", 1, "libScePad", 1, 1, Func_EF103E845B6F0420); +}; -} // namespace Libraries::LibPad +} // namespace Libraries::Pad \ No newline at end of file diff --git a/src/core/libraries/pad/pad.h b/src/core/libraries/pad/pad.h index 7895da7e..4b48890c 100644 --- a/src/core/libraries/pad/pad.h +++ b/src/core/libraries/pad/pad.h @@ -4,125 +4,322 @@ #pragma once #include "common/types.h" -#include "src/core/libraries/system/userservice.h" namespace Core::Loader { class SymbolsResolver; } -namespace Libraries::LibPad { +namespace Libraries::Pad { -constexpr s8 ORBIS_PAD_PORT_TYPE_STANDARD = 0; -constexpr s8 ORBIS_PAD_PORT_TYPE_SPECIAL = 2; +constexpr int ORBIS_PAD_MAX_TOUCH_NUM = 2; +constexpr int ORBIS_PAD_MAX_DEVICE_UNIQUE_DATA_SIZE = 12; -constexpr s8 ORBIS_PAD_DEVICE_CLASS_PAD = 0; -constexpr s8 ORBIS_PAD_DEVICE_CLASS_GUITAR = 1; -constexpr s8 ORBIS_PAD_DEVICE_CLASS_DRUMS = 2; - -constexpr s8 ORBIS_PAD_CONNECTION_TYPE_STANDARD = 0; -constexpr s8 ORBIS_PAD_CONNECTION_TYPE_REMOTE = 2; - -enum ScePadButton : u32 { - L3 = 0x00000002, - R3 = 0x00000004, - OPTIONS = 0x00000008, - UP = 0x00000010, - RIGHT = 0x00000020, - DOWN = 0x00000040, - LEFT = 0x00000080, - L2 = 0x00000100, - R2 = 0x00000200, - L1 = 0x00000400, - R1 = 0x00000800, - TRIANGLE = 0x00001000, - CIRCLE = 0x00002000, - CROSS = 0x00004000, - SQUARE = 0x00008000, - TOUCH_PAD = 0x00100000, - INTERCEPTED = 0x80000000, +enum OrbisPadDeviceClass { + ORBIS_PAD_DEVICE_CLASS_INVALID = -1, + ORBIS_PAD_DEVICE_CLASS_STANDARD = 0, + ORBIS_PAD_DEVICE_CLASS_GUITAR = 1, + ORBIS_PAD_DEVICE_CLASS_DRUM = 2, + ORBIS_PAD_DEVICE_CLASS_DJ_TURNTABLE = 3, + ORBIS_PAD_DEVICE_CLASS_DANCEMAT = 4, + ORBIS_PAD_DEVICE_CLASS_NAVIGATION = 5, + ORBIS_PAD_DEVICE_CLASS_STEERING_WHEEL = 6, + ORBIS_PAD_DEVICE_CLASS_STICK = 7, + ORBIS_PAD_DEVICE_CLASS_FLIGHT_STICK = 8, + ORBIS_PAD_DEVICE_CLASS_GUN = 9, }; -struct ScePadOpenParam { - u8 reserve[8]; +struct OrbisPadDeviceClassExtendedInformation { + OrbisPadDeviceClass deviceClass; + u8 reserved[4]; + union { + struct { + u8 capability; + u8 reserved1[1]; + u16 maxPhysicalWheelAngle; + u8 reserved2[8]; + } steeringWheel; + struct { + u8 capability; + u8 quantityOfSelectorSwitch; + u8 reserved[10]; + } guitar; + struct { + u8 capability; + u8 reserved[11]; + } drum; + struct { + u8 capability; + u8 reserved[11]; + } flightStick; + u8 data[12]; + } classData; }; -struct ScePadAnalogStick { - u8 x; - u8 y; +struct OrbisPadDeviceClassData { + OrbisPadDeviceClass deviceClass; + bool bDataValid; + union { + struct { + float steeringWheelAngle; + u16 steeringWheel; + u16 acceleratorPedal; + u16 brakePedal; + u16 clutchPedal; + u16 handBrake; + u8 gear; + u8 reserved[1]; + } steeringWheel; + struct { + u8 toneNumber; + u8 whammyBar; + u8 tilt; + u8 fret; + u8 fretSolo; + u8 reserved[11]; + } guitar; + struct { + u8 snare; + u8 tom1; + u8 tom2; + u8 floorTom; + u8 hihatCymbal; + u8 rideCymbal; + u8 crashCymbal; + u8 reserved[9]; + } drum; + struct { + u16 stickAxisX; + u16 stickAxisY; + u8 stickTwist; + u8 throttle; + u8 trigger; + u8 rudderPedal; + u8 brakePedalLeft; + u8 brakePedalRight; + u8 antennaKnob; + u8 rangeKnob; + u8 reserved[4]; + } flightStick; + struct { + u8 dataLen; + u8 reserved[3]; + u8 data[ORBIS_PAD_MAX_DEVICE_UNIQUE_DATA_SIZE]; + } others; + } classData; }; -struct ScePadAnalogButtons { + +struct OrbisPadAnalogButtons { u8 l2; u8 r2; u8 padding[2]; }; -struct SceFQuaternion { +struct OrbisPadAnalogStick { + u8 x; + u8 y; +}; + +enum OrbisPadButtonDataOffset { + ORBIS_PAD_BUTTON_L3 = 0x00000002, + ORBIS_PAD_BUTTON_R3 = 0x00000004, + ORBIS_PAD_BUTTON_OPTIONS = 0x00000008, + ORBIS_PAD_BUTTON_UP = 0x00000010, + ORBIS_PAD_BUTTON_RIGHT = 0x00000020, + ORBIS_PAD_BUTTON_DOWN = 0x00000040, + ORBIS_PAD_BUTTON_LEFT = 0x00000080, + ORBIS_PAD_BUTTON_L2 = 0x00000100, + ORBIS_PAD_BUTTON_R2 = 0x00000200, + ORBIS_PAD_BUTTON_L1 = 0x00000400, + ORBIS_PAD_BUTTON_R1 = 0x00000800, + ORBIS_PAD_BUTTON_TRIANGLE = 0x00001000, + ORBIS_PAD_BUTTON_CIRCLE = 0x00002000, + ORBIS_PAD_BUTTON_CROSS = 0x00004000, + ORBIS_PAD_BUTTON_SQUARE = 0x00008000, + ORBIS_PAD_BUTTON_TOUCH_PAD = 0x00100000, + ORBIS_PAD_BUTTON_INTERCEPTED = 0x80000000, +}; + +struct OrbisFQuaternion { float x, y, z, w; }; -struct SceFVector3 { +struct OrbisFVector3 { float x, y, z; }; -struct ScePadTouch { +struct OrbisPadTouch { u16 x; u16 y; u8 id; u8 reserve[3]; }; -constexpr int SCE_PAD_MAX_TOUCH_NUM = 2; - -typedef struct ScePadTouchData { +struct OrbisPadTouchData { u8 touchNum; u8 reserve[3]; u32 reserve1; - ScePadTouch touch[SCE_PAD_MAX_TOUCH_NUM]; -} ScePadTouchData; + OrbisPadTouch touch[ORBIS_PAD_MAX_TOUCH_NUM]; +}; -struct ScePadExtensionUnitData { +struct OrbisPadExtensionUnitData { u32 extensionUnitId; u8 reserve[1]; u8 dataLength; u8 data[10]; }; -struct ScePadData { +struct OrbisPadData { u32 buttons; - ScePadAnalogStick leftStick; - ScePadAnalogStick rightStick; - ScePadAnalogButtons analogButtons; - SceFQuaternion orientation; - SceFVector3 acceleration; - SceFVector3 angularVelocity; - ScePadTouchData touchData; + OrbisPadAnalogStick leftStick; + OrbisPadAnalogStick rightStick; + OrbisPadAnalogButtons analogButtons; + OrbisFQuaternion orientation; + OrbisFVector3 acceleration; + OrbisFVector3 angularVelocity; + OrbisPadTouchData touchData; bool connected; u64 timestamp; - ScePadExtensionUnitData extensionUnitData; - uint8_t connectedCount; - uint8_t reserve[2]; - uint8_t deviceUniqueDataLen; - uint8_t deviceUniqueData[12]; + OrbisPadExtensionUnitData extensionUnitData; + u8 connectedCount; + u8 reserve[2]; + u8 deviceUniqueDataLen; + u8 deviceUniqueData[ORBIS_PAD_MAX_DEVICE_UNIQUE_DATA_SIZE]; }; -struct OrbisPadInformation { - float touchpadDensity; - u16 touchResolutionX; - u16 touchResolutionY; - u8 stickDeadzoneL; - u8 stickDeadzoneR; +struct OrbisPadTouchPadInformation { + float pixelDensity; + struct { + u8 x; + u8 y; + } resolution; +}; + +struct OrbisPadStickInformation { + u8 deadZoneLeft; + u8 deadZoneRight; +}; + +struct OrbisPadControllerInformation { + OrbisPadTouchPadInformation touchPadInfo; + OrbisPadStickInformation stickInfo; u8 connectionType; - u8 count; - s8 connected; - s8 deviceClass; - u8 unknown[8]; + u8 connectedCount; + bool connected; + OrbisPadDeviceClass deviceClass; + u8 reserve[8]; }; +struct OrbisPadOpenParam { + u8 reserve[8]; +}; + +struct OrbisPadLightBarParam { + u8 r; + u8 g; + u8 b; + u8 reserve[1]; +}; + +struct OrbisPadVibrationParam { + u8 largeMotor; + u8 smallMotor; +}; + +int PS4_SYSV_ABI scePadClose(s32 handle); +int PS4_SYSV_ABI scePadConnectPort(); +int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation( + s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo); +int PS4_SYSV_ABI scePadDeviceClassParseData(s32 handle, const OrbisPadData* pData, + OrbisPadDeviceClassData* pDeviceClassData); +int PS4_SYSV_ABI scePadDeviceOpen(); +int PS4_SYSV_ABI scePadDisableVibration(); +int PS4_SYSV_ABI scePadDisconnectDevice(); +int PS4_SYSV_ABI scePadDisconnectPort(); +int PS4_SYSV_ABI scePadEnableAutoDetect(); +int PS4_SYSV_ABI scePadEnableExtensionPort(); +int PS4_SYSV_ABI scePadEnableSpecificDeviceClass(); +int PS4_SYSV_ABI scePadEnableUsbConnection(); +int PS4_SYSV_ABI scePadGetBluetoothAddress(); +int PS4_SYSV_ABI scePadGetCapability(); +int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerInformation* pInfo); +int PS4_SYSV_ABI scePadGetDataInternal(); +int PS4_SYSV_ABI scePadGetDeviceId(); +int PS4_SYSV_ABI scePadGetDeviceInfo(); +int PS4_SYSV_ABI scePadGetExtControllerInformation(); +int PS4_SYSV_ABI scePadGetExtensionUnitInfo(); +int PS4_SYSV_ABI scePadGetFeatureReport(); +int PS4_SYSV_ABI scePadGetHandle(s32 userId, s32 type, s32 index); +int PS4_SYSV_ABI scePadGetIdleCount(); +int PS4_SYSV_ABI scePadGetInfo(); +int PS4_SYSV_ABI scePadGetInfoByPortType(); +int PS4_SYSV_ABI scePadGetLicenseControllerInformation(); +int PS4_SYSV_ABI scePadGetMotionSensorPosition(); +int PS4_SYSV_ABI scePadGetMotionTimerUnit(); +int PS4_SYSV_ABI scePadGetSphereRadius(); +int PS4_SYSV_ABI scePadGetVersionInfo(); int PS4_SYSV_ABI scePadInit(); -int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 type, - s32 index, const ScePadOpenParam* pParam); -int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData); +int PS4_SYSV_ABI scePadIsBlasterConnected(); +int PS4_SYSV_ABI scePadIsDS4Connected(); +int PS4_SYSV_ABI scePadIsLightBarBaseBrightnessControllable(); +int PS4_SYSV_ABI scePadIsMoveConnected(); +int PS4_SYSV_ABI scePadIsMoveReproductionModel(); +int PS4_SYSV_ABI scePadIsValidHandle(); +int PS4_SYSV_ABI scePadMbusInit(); +int PS4_SYSV_ABI scePadMbusTerm(); +int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, + const OrbisPadOpenParam* pParam); +int PS4_SYSV_ABI scePadOpenExt(); +int PS4_SYSV_ABI scePadOpenExt2(); +int PS4_SYSV_ABI scePadOutputReport(); +int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num); +int PS4_SYSV_ABI scePadReadBlasterForTracker(); +int PS4_SYSV_ABI scePadReadExt(); +int PS4_SYSV_ABI scePadReadForTracker(); +int PS4_SYSV_ABI scePadReadHistory(); +int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData); +int PS4_SYSV_ABI scePadReadStateExt(); +int PS4_SYSV_ABI scePadResetLightBar(s32 handle); +int PS4_SYSV_ABI scePadResetLightBarAll(); +int PS4_SYSV_ABI scePadResetLightBarAllByPortType(); +int PS4_SYSV_ABI scePadResetOrientation(s32 handle); +int PS4_SYSV_ABI scePadResetOrientationForTracker(); +int PS4_SYSV_ABI scePadSetAngularVelocityDeadbandState(s32 handle, bool bEnable); +int PS4_SYSV_ABI scePadSetAutoPowerOffCount(); +int PS4_SYSV_ABI scePadSetButtonRemappingInfo(); +int PS4_SYSV_ABI scePadSetConnection(); +int PS4_SYSV_ABI scePadSetExtensionReport(); +int PS4_SYSV_ABI scePadSetFeatureReport(); +int PS4_SYSV_ABI scePadSetForceIntercepted(); +int PS4_SYSV_ABI scePadSetLightBar(s32 handle, const OrbisPadLightBarParam* pParam); +int PS4_SYSV_ABI scePadSetLightBarBaseBrightness(); +int PS4_SYSV_ABI scePadSetLightBarBlinking(); +int PS4_SYSV_ABI scePadSetLightBarForTracker(); +int PS4_SYSV_ABI scePadSetLoginUserNumber(); +int PS4_SYSV_ABI scePadSetMotionSensorState(s32 handle, bool bEnable); +int PS4_SYSV_ABI scePadSetProcessFocus(); +int PS4_SYSV_ABI scePadSetProcessPrivilege(); +int PS4_SYSV_ABI scePadSetProcessPrivilegeOfButtonRemapping(); +int PS4_SYSV_ABI scePadSetShareButtonMaskForRemotePlay(); +int PS4_SYSV_ABI scePadSetTiltCorrectionState(s32 handle, bool bEnable); +int PS4_SYSV_ABI scePadSetUserColor(); +int PS4_SYSV_ABI scePadSetVibration(s32 handle, const OrbisPadVibrationParam* pParam); +int PS4_SYSV_ABI scePadSetVibrationForce(); +int PS4_SYSV_ABI scePadSetVrTrackingMode(); +int PS4_SYSV_ABI scePadShareOutputData(); +int PS4_SYSV_ABI scePadStartRecording(); +int PS4_SYSV_ABI scePadStopRecording(); +int PS4_SYSV_ABI scePadSwitchConnection(); +int PS4_SYSV_ABI scePadVertualDeviceAddDevice(); +int PS4_SYSV_ABI scePadVirtualDeviceAddDevice(); +int PS4_SYSV_ABI scePadVirtualDeviceDeleteDevice(); +int PS4_SYSV_ABI scePadVirtualDeviceDisableButtonRemapping(); +int PS4_SYSV_ABI scePadVirtualDeviceGetRemoteSetting(); +int PS4_SYSV_ABI scePadVirtualDeviceInsertData(); +int PS4_SYSV_ABI Func_28B998C7D8A3DA1D(); +int PS4_SYSV_ABI Func_298D21481F94C9FA(); +int PS4_SYSV_ABI Func_51E514BCD3A05CA5(); +int PS4_SYSV_ABI Func_89C9237E393DA243(); +int PS4_SYSV_ABI Func_EF103E845B6F0420(); -void padSymbolsRegister(Core::Loader::SymbolsResolver* sym); - -}; // namespace Libraries::LibPad +void RegisterlibScePad(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::Pad \ No newline at end of file diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index ce9ff729..acbcb97d 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -96,36 +96,36 @@ void WindowSDL::onResize() { } void WindowSDL::onKeyPress(const SDL_Event* event) { - using Libraries::LibPad::ScePadButton; + using Libraries::Pad::OrbisPadButtonDataOffset; u32 button = 0; switch (event->key.keysym.sym) { case SDLK_UP: - button = ScePadButton::UP; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_UP; break; case SDLK_DOWN: - button = ScePadButton::DOWN; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_DOWN; break; case SDLK_LEFT: - button = ScePadButton::LEFT; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_LEFT; break; case SDLK_RIGHT: - button = ScePadButton::RIGHT; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_RIGHT; break; case SDLK_KP_8: - button = ScePadButton::TRIANGLE; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TRIANGLE; break; case SDLK_KP_6: - button = ScePadButton::CIRCLE; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_CIRCLE; break; case SDLK_KP_2: - button = ScePadButton::CROSS; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_CROSS; break; case SDLK_KP_4: - button = ScePadButton::SQUARE; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_SQUARE; break; case SDLK_RETURN: - button = ScePadButton::OPTIONS; + button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_OPTIONS; break; default: break;