AnyPS5/core/libs/prx/libSceUserService/Export.cpp

141 lines
4.1 KiB
C++

#include <cstddef>
#include <cstdint>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
#include <atomic>
#include "prx/libSceUserService/UserService.hpp"
extern "C" {
int APS5_VABI sceUserServiceGetAccessibilityChatTranscription(int user_id, int32_t* chat_transcription) {
(void)user_id;
(void)chat_transcription;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetAccessibilityPressAndHoldDelay(int user_id, int32_t* press_and_hold_delay) {
(void)user_id;
(void)press_and_hold_delay;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetAccessibilityTriggerEffect(int user_id, int32_t* trigger_effect) {
(void)user_id;
(void)trigger_effect;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetAccessibilityVibration(int user_id, int32_t* vibration) {
(void)user_id;
(void)vibration;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetAccessibilityZoomEnabled(int user_id, int32_t* zoom_enabled) {
(void)user_id;
(void)zoom_enabled;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetAgeLevel(int user_id, uint32_t* age_level) {
(void)user_id;
(void)age_level;
NotImplemented_nid_no_patch(__func__);
return 0;
}
// The initial user is reported as logging in once; afterwards there are no user events.
int APS5_VABI sceUserServiceGetEvent(SceUserServiceEvent* event) {
if (event == nullptr) {
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
}
static std::atomic<bool> loginReported{false};
if (loginReported.exchange(true)) {
return USER_SERVICE_ERROR_NO_EVENT;
}
constexpr std::uint32_t EventTypeLogin = 0;
event->event_type = EventTypeLogin;
event->user_id = USER_SERVICE_INITIAL_USER_ID;
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceGetGamePresets(int user_id, UserServiceGamePresets* presets) {
// System-wide game presets (difficulty, view inversion, subtitles, audio language) of the user's
// profile. A fresh console has none set: every field is 0, "not specified", and the title falls
// back to its own defaults. this_size is the caller's.
if (presets == nullptr || user_id != USER_SERVICE_INITIAL_USER_ID) {
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
}
presets->difficulty = 0;
presets->priority = 0;
presets->invert_vertical_view_for_1st_person_view = 0;
presets->invert_horizontal_view_for_1st_person_view = 0;
presets->invert_vertical_view_for_3rd_person_view = 0;
presets->invert_horizontal_view_for_3rd_person_view = 0;
presets->display_sub_titles = 0;
presets->audio_language = 0;
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceGetInitialUser(int* user_id) {
if (user_id == nullptr) {
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
}
*user_id = USER_SERVICE_INITIAL_USER_ID;
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceGetLoginUserIdList(UserServiceLoginUserIdList* user_id_list) {
if (user_id_list == nullptr) {
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
}
user_id_list->user_id[0] = USER_SERVICE_INITIAL_USER_ID;
user_id_list->user_id[1] = USER_SERVICE_USER_ID_INVALID;
user_id_list->user_id[2] = USER_SERVICE_USER_ID_INVALID;
user_id_list->user_id[3] = USER_SERVICE_USER_ID_INVALID;
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceGetUserName(int user_id, char* name, size_t size) {
(void)user_id;
(void)name;
(void)size;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceGetUserNumber(int user_id, int32_t* number) {
(void)user_id;
(void)number;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceUserServiceInitialize(const void* params) {
(void)params;
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceInitialize2(void) {
return USER_SERVICE_OK;
}
int APS5_VABI sceUserServiceTerminate(void) {
return USER_SERVICE_OK;
}
// No PSN account exists, so the platform privacy setting reports the feature as not permitted.
int APS5_VABI sceUserServiceGetPlatformPrivacyWs1(int32_t user_id, int32_t* value) {
(void)user_id;
if (!value) return static_cast<int>(0x80960002);
*value = 0;
return 0;
}
}