From 5c7545198eb65fdb4de7e5774c2e11d02e6fe143 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 7 Mar 2024 00:27:22 +0200 Subject: [PATCH] more userservice,systemservice functions implemented --- src/core/hle/libraries/libs.h | 2 +- src/core/libraries/libscesystemservice.cpp | 6 ++++-- src/core/libraries/libscesystemservice.h | 15 ++++++++++----- src/core/libraries/libsceuserservice.cpp | 11 +++++++---- src/core/libraries/libsceuserservice.h | 4 ++-- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/core/hle/libraries/libs.h b/src/core/hle/libraries/libs.h index 4695be8d..bb86827b 100644 --- a/src/core/hle/libraries/libs.h +++ b/src/core/hle/libraries/libs.h @@ -41,7 +41,7 @@ { LOG_WARN_IF(true, "dummy {}()\n", __func__); } #define PRINT_UNIMPLEMENTED_FUNCTION_NAME() \ - { LOG_ERROR_IF(true, "{}()\n", __func__); } + { LOG_ERROR_IF(true, "Unimplemented {}()\n", __func__); } namespace OldLibraries { diff --git a/src/core/libraries/libscesystemservice.cpp b/src/core/libraries/libscesystemservice.cpp index 545d3ca9..d45a781b 100644 --- a/src/core/libraries/libscesystemservice.cpp +++ b/src/core/libraries/libscesystemservice.cpp @@ -1708,8 +1708,10 @@ int PS4_SYSV_ABI sceSystemServiceGetAppType() { return ORBIS_OK; } -int PS4_SYSV_ABI sceSystemServiceGetDisplaySafeAreaInfo() { - PRINT_UNIMPLEMENTED_FUNCTION_NAME(); +s32 PS4_SYSV_ABI sceSystemServiceGetDisplaySafeAreaInfo(SystemServiceDisplaySafeAreaInfo* info) { + // TODO error handling + PRINT_FUNCTION_NAME(); + info->ratio = 1.0f; return ORBIS_OK; } diff --git a/src/core/libraries/libscesystemservice.h b/src/core/libraries/libscesystemservice.h index 7c7683f3..1eee5b97 100644 --- a/src/core/libraries/libscesystemservice.h +++ b/src/core/libraries/libscesystemservice.h @@ -3,9 +3,9 @@ #pragma once -#include "library_common.h" +#include "library_common.h" -namespace Libraries::SystemService{ +namespace Libraries::SystemService { struct SceSystemServiceStatus { s32 eventNum; @@ -17,6 +17,11 @@ struct SceSystemServiceStatus { u8 reserved[]; }; +struct SystemServiceDisplaySafeAreaInfo { + float ratio; + uint8_t reserved[128]; +}; + int PS4_SYSV_ABI sceAppMessagingClearEventFlag(); int PS4_SYSV_ABI sceAppMessagingReceiveMsg(); int PS4_SYSV_ABI sceAppMessagingSendMsg(); @@ -357,7 +362,7 @@ int PS4_SYSV_ABI sceSystemServiceGetAppIdOfBigApp(); int PS4_SYSV_ABI sceSystemServiceGetAppIdOfMiniApp(); int PS4_SYSV_ABI sceSystemServiceGetAppStatus(); int PS4_SYSV_ABI sceSystemServiceGetAppType(); -int PS4_SYSV_ABI sceSystemServiceGetDisplaySafeAreaInfo(); +s32 PS4_SYSV_ABI sceSystemServiceGetDisplaySafeAreaInfo(SystemServiceDisplaySafeAreaInfo* info); int PS4_SYSV_ABI sceSystemServiceGetEventForDaemon(); int PS4_SYSV_ABI sceSystemServiceGetGpuLoadEmulationMode(); int PS4_SYSV_ABI sceSystemServiceGetHdrToneMapLuminance(); @@ -487,5 +492,5 @@ int PS4_SYSV_ABI sceSystemServiceReenableVoiceRecognition(); int PS4_SYSV_ABI Func_6B1CDB955F0EBD65(); int PS4_SYSV_ABI Func_CB5E885E225F69F0(); -void RegisterlibSceSystemService(Core::Loader::SymbolsResolver * sym); -} \ No newline at end of file +void RegisterlibSceSystemService(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::SystemService \ No newline at end of file diff --git a/src/core/libraries/libsceuserservice.cpp b/src/core/libraries/libsceuserservice.cpp index fe84f0e3..a97aacdf 100644 --- a/src/core/libraries/libsceuserservice.cpp +++ b/src/core/libraries/libsceuserservice.cpp @@ -1020,8 +1020,10 @@ int PS4_SYSV_ABI sceUserServiceGetTraditionalChineseInputType() { return ORBIS_OK; } -int PS4_SYSV_ABI sceUserServiceGetUserColor() { - PRINT_UNIMPLEMENTED_FUNCTION_NAME(); +s32 PS4_SYSV_ABI sceUserServiceGetUserColor(int user_id,int *color) { + // TODO fix me better + PRINT_DUMMY_FUNCTION_NAME(); + *color=0; // blue return ORBIS_OK; } @@ -1040,8 +1042,9 @@ int PS4_SYSV_ABI sceUserServiceGetUserGroupNum() { return ORBIS_OK; } -int PS4_SYSV_ABI sceUserServiceGetUserName() { - PRINT_UNIMPLEMENTED_FUNCTION_NAME(); +s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::size_t size) { + // TODO error checking and configurable username + snprintf(user_name, size, "%s", "shadps4"); return ORBIS_OK; } diff --git a/src/core/libraries/libsceuserservice.h b/src/core/libraries/libsceuserservice.h index d0b3522a..e675e581 100644 --- a/src/core/libraries/libsceuserservice.h +++ b/src/core/libraries/libsceuserservice.h @@ -216,11 +216,11 @@ int PS4_SYSV_ABI sceUserServiceGetTopMenuLimitItem(); int PS4_SYSV_ABI sceUserServiceGetTopMenuNotificationFlag(); int PS4_SYSV_ABI sceUserServiceGetTopMenuTutorialFlag(); int PS4_SYSV_ABI sceUserServiceGetTraditionalChineseInputType(); -int PS4_SYSV_ABI sceUserServiceGetUserColor(); +s32 PS4_SYSV_ABI sceUserServiceGetUserColor(int user_id, int* color); int PS4_SYSV_ABI sceUserServiceGetUserGroupName(); int PS4_SYSV_ABI sceUserServiceGetUserGroupNameList(); int PS4_SYSV_ABI sceUserServiceGetUserGroupNum(); -int PS4_SYSV_ABI sceUserServiceGetUserName(); +s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::size_t size); int PS4_SYSV_ABI sceUserServiceGetUserStatus(); int PS4_SYSV_ABI sceUserServiceGetVibrationEnabled(); int PS4_SYSV_ABI sceUserServiceGetVoiceRecognitionLastUsedOsk();