From eeab34277a3b1fb63cc4f322ac63d99ad0efe082 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Wed, 13 Mar 2024 13:10:34 +0200 Subject: [PATCH] added error codes in system service --- src/core/libraries/error_codes.h | 5 ++++- src/core/libraries/libscesystemservice.cpp | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/core/libraries/error_codes.h b/src/core/libraries/error_codes.h index d98fb09b7..398e7e8d0 100644 --- a/src/core/libraries/error_codes.h +++ b/src/core/libraries/error_codes.h @@ -190,4 +190,7 @@ #define ORBIS_USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED 0x80960006 #define ORBIS_USER_SERVICE_ERROR_NO_EVENT 0x80960007 #define ORBIS_USER_SERVICE_ERROR_NOT_LOGGED_IN 0x80960009 -#define ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT 0x8096000A \ No newline at end of file +#define ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT 0x8096000A + +// SystemService library +#define ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER 0x80A10003 diff --git a/src/core/libraries/libscesystemservice.cpp b/src/core/libraries/libscesystemservice.cpp index daee508ff..becee8a26 100644 --- a/src/core/libraries/libscesystemservice.cpp +++ b/src/core/libraries/libscesystemservice.cpp @@ -1710,8 +1710,11 @@ int PS4_SYSV_ABI sceSystemServiceGetAppType() { s32 PS4_SYSV_ABI sceSystemServiceGetDisplaySafeAreaInfo(OrbisSystemServiceDisplaySafeAreaInfo* info) { - // TODO error handling LOG_INFO(Lib_SystemService, "called"); + if (info == nullptr) { + LOG_ERROR(Lib_SystemService, "OrbisSystemServiceDisplaySafeAreaInfo is null"); + return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER; + } info->ratio = 1.0f; return ORBIS_OK; } @@ -1757,6 +1760,11 @@ int PS4_SYSV_ABI sceSystemServiceGetRenderingMode() { } s32 PS4_SYSV_ABI sceSystemServiceGetStatus(OrbisSystemServiceStatus* status) { + LOG_TRACE(Lib_SystemService, "called"); + if (status == nullptr) { + LOG_ERROR(Lib_SystemService, "OrbisSystemServiceStatus is null"); + return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER; + } OrbisSystemServiceStatus st = {}; st.eventNum = 0; st.isSystemUiOverlaid = false; @@ -1874,9 +1882,12 @@ int PS4_SYSV_ABI sceSystemServiceNavigateToGoHome() { } s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value) { + // TODO this probably should be stored in config for UI configuration LOG_INFO(Lib_SystemService, "called"); - int v = 0; - + if (value == nullptr) { + LOG_ERROR(Lib_SystemService, "value is null"); + return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER; + } switch (param_id) { case ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG: *value = ORBIS_SYSTEM_PARAM_LANG_ENGLISH_US; @@ -1899,6 +1910,10 @@ s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value) { case ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN: *value = ORBIS_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS; break; + default: + LOG_ERROR(Lib_SystemService, "param_id {} unsupported!", + param_id); // shouldn't go there but log it + *value = 0; // return a dummy value } return ORBIS_OK;