From 6066c89607761999cb0e068d2d0a89178df5e8f8 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 1 Apr 2024 14:45:27 +0300 Subject: [PATCH] scePadGetControllerInformation added , dummy scePadSetMotionSensorState --- src/common/types.h | 2 +- src/core/hle/kernel/memory_management.cpp | 2 +- src/core/hle/libraries/libpad/pad.cpp | 26 +++++++++++++++++++++-- src/core/hle/libraries/libpad/pad.h | 23 ++++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/common/types.h b/src/common/types.h index f3c0862c..313d2fa2 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -6,7 +6,7 @@ #include #include -using s08 = std::int8_t; +using s8 = std::int8_t; using s16 = std::int16_t; using s32 = std::int32_t; using s64 = std::int64_t; diff --git a/src/core/hle/kernel/memory_management.cpp b/src/core/hle/kernel/memory_management.cpp index d6aa8cdb..9cee047d 100644 --- a/src/core/hle/kernel/memory_management.cpp +++ b/src/core/hle/kernel/memory_management.cpp @@ -18,7 +18,7 @@ bool is16KBAligned(u64 n) { } u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { - LOG_WARNING(Kernel_Vmm, "(STUBBED) called"); + LOG_WARNING(Kernel_Vmm, "called"); return SCE_KERNEL_MAIN_DMEM_SIZE; } diff --git a/src/core/hle/libraries/libpad/pad.cpp b/src/core/hle/libraries/libpad/pad.cpp index 3d3f3b8d..f224367f 100644 --- a/src/core/hle/libraries/libpad/pad.cpp +++ b/src/core/hle/libraries/libpad/pad.cpp @@ -11,13 +11,13 @@ namespace OldLibraries::LibPad { int PS4_SYSV_ABI scePadInit() { - LOG_WARNING(Lib_Pad, "(STUBBED) called"); + 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, "(STUBBED) called user_id = {} type = {} index = {}", user_id, type, index); + LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", user_id, type, index); return 1; // dummy } @@ -48,10 +48,32 @@ int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) { return SCE_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; +} + +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("gjP9-KQzoUk", "libScePad", 1, "libScePad", 1, 1, scePadGetControllerInformation); + LIB_FUNCTION("clVvL4ZDntw", "libScePad", 1, "libScePad", 1, 1, scePadSetMotionSensorState); } } // namespace OldLibraries::LibPad diff --git a/src/core/hle/libraries/libpad/pad.h b/src/core/hle/libraries/libpad/pad.h index fc0bad2e..f2f5d663 100644 --- a/src/core/hle/libraries/libpad/pad.h +++ b/src/core/hle/libraries/libpad/pad.h @@ -12,6 +12,16 @@ class SymbolsResolver; namespace OldLibraries::LibPad { +#define ORBIS_PAD_PORT_TYPE_STANDARD 0 +#define ORBIS_PAD_PORT_TYPE_SPECIAL 2 + +#define ORBIS_PAD_DEVICE_CLASS_PAD 0 +#define ORBIS_PAD_DEVICE_CLASS_GUITAR 1 +#define ORBIS_PAD_DEVICE_CLASS_DRUMS 2 + +#define ORBIS_PAD_CONNECTION_TYPE_STANDARD 0 +#define ORBIS_PAD_CONNECTION_TYPE_REMOTE 2 + enum ScePadButton : u32 { L3 = 0x00000002, R3 = 0x00000004, @@ -95,6 +105,19 @@ struct ScePadData { 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);