diff --git a/README.md b/README.md index c7b5bc9d3..ff7aea70c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Converter for native execution of PlayStation 5 ELF binaries on Linux through bi ## Status -Execution reaches `_start`, stack unwinding and exception handling tables are built. All unimplemented stub functions throw std::runtime_error. `what()` is printed to stderr and the process terminates. Now: `sceSystemServiceHideSplashScreen not implemented` +Execution reaches `_start`, stack unwinding and exception handling tables are built. All unimplemented stub functions throw std::runtime_error. `what()` is printed to stderr and the process terminates. +Now: `sceUserServiceInitialize not implemented` ## Disclaimer diff --git a/core/libs/prx/libSceSystemService/Export.cpp b/core/libs/prx/libSceSystemService/Export.cpp index dfb18df48..43f7f78a1 100644 --- a/core/libs/prx/libSceSystemService/Export.cpp +++ b/core/libs/prx/libSceSystemService/Export.cpp @@ -1,7 +1,9 @@ -#include #include +#include +#include #include "SceTypes.hpp" #include "prx/libc/include/General.hpp" +#include "prx/libSceSystemService/SystemService.hpp" extern "C" { @@ -29,21 +31,32 @@ int sceSystemServiceGetNoticeScreenSkipFlag(bool* value) { } int sceSystemServiceGetStatus(SystemServiceStatus* status) { - (void)status; - NotImplemented_nid_no_patch(__func__); - return 0; + if (status == nullptr) { + return SYSTEM_SERVICE_ERROR_PARAMETER; + } + *status = SystemServiceStatus{}; + return SYSTEM_SERVICE_OK; } int sceSystemServiceHideSplashScreen(void) { - NotImplemented_nid_no_patch(__func__); - return 0; + return SYSTEM_SERVICE_OK; } -int sceSystemServiceParamGetInt(int param_id, int* value) { - (void)param_id; - (void)value; - NotImplemented_nid_no_patch(__func__); - return 0; +int sceSystemServiceParamGetInt(int paramId, int* value) { + if (value == nullptr) { + return SYSTEM_SERVICE_ERROR_PARAMETER; + } + switch (paramId) { + case SYSTEM_SERVICE_PARAM_ID_LANG: *value = SYSTEM_SERVICE_PARAM_LANG_ENGLISH_US; break; + case SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT: *value = SYSTEM_SERVICE_PARAM_DATE_FORMAT_DDMMYYYY; break; + case SYSTEM_SERVICE_PARAM_ID_TIME_FORMAT: *value = SYSTEM_SERVICE_PARAM_TIME_FORMAT_24HOUR; break; + case SYSTEM_SERVICE_PARAM_ID_TIME_ZONE: *value = 0; break; + case SYSTEM_SERVICE_PARAM_ID_SUMMERTIME: *value = 0; break; + case SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL: *value = SYSTEM_SERVICE_PARAM_GAME_PARENTAL_OFF; break; + case SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN: *value = SYSTEM_SERVICE_PARAM_ENTER_BUTTON_CROSS; break; + default: *value = 0; break; + } + return SYSTEM_SERVICE_OK; } int sceSystemServiceParamGetString(int param_id, char* buf, size_t buf_size) { @@ -60,9 +73,12 @@ int sceSystemServicePowerTick(void) { } int sceSystemServiceReceiveEvent(SystemServiceEvent* event) { - (void)event; - NotImplemented_nid_no_patch(__func__); - return 0; + if (event == nullptr) { + return SYSTEM_SERVICE_ERROR_PARAMETER; + } + event->event_type = -1; + std::memset(event->data, 0, sizeof(event->data)); + return SYSTEM_SERVICE_ERROR_NO_EVENT; } int sceSystemServiceReportAbnormalTermination(const void* info) { diff --git a/core/libs/prx/libSceSystemService/SystemService.hpp b/core/libs/prx/libSceSystemService/SystemService.hpp new file mode 100644 index 000000000..7a2c84a12 --- /dev/null +++ b/core/libs/prx/libSceSystemService/SystemService.hpp @@ -0,0 +1,24 @@ +#ifndef CORE_LIBS_PRX_LIBSCESYSTEMSERVICE_SYSTEMSERVICE_HPP +#define CORE_LIBS_PRX_LIBSCESYSTEMSERVICE_SYSTEMSERVICE_HPP + +#include + +constexpr int SYSTEM_SERVICE_OK = 0; +constexpr int SYSTEM_SERVICE_ERROR_PARAMETER = -2136932349; +constexpr int SYSTEM_SERVICE_ERROR_NO_EVENT = -2136932348; + +constexpr int SYSTEM_SERVICE_PARAM_ID_LANG = 1; +constexpr int SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT = 2; +constexpr int SYSTEM_SERVICE_PARAM_ID_TIME_FORMAT = 3; +constexpr int SYSTEM_SERVICE_PARAM_ID_TIME_ZONE = 4; +constexpr int SYSTEM_SERVICE_PARAM_ID_SUMMERTIME = 5; +constexpr int SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL = 7; +constexpr int SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN = 1000; + +constexpr int SYSTEM_SERVICE_PARAM_LANG_ENGLISH_US = 1; +constexpr int SYSTEM_SERVICE_PARAM_DATE_FORMAT_DDMMYYYY = 1; +constexpr int SYSTEM_SERVICE_PARAM_TIME_FORMAT_24HOUR = 1; +constexpr int SYSTEM_SERVICE_PARAM_GAME_PARENTAL_OFF = 0; +constexpr int SYSTEM_SERVICE_PARAM_ENTER_BUTTON_CROSS = 1; + +#endif