Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions core/libs/prx/libSceUserService/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,12 @@ int APS5_VABI sceUserServiceGetEvent(SceUserServiceEvent* event) {
}

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.
const int index = UserIndex(user_id);
if (presets == nullptr || index < 0) {
if (presets == nullptr) {
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
}
if (!IsUserLoggedIn(user_id)) {
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
}
presets->difficulty = 0;
presets->priority = 0;
presets->invert_vertical_view_for_1st_person_view = 0;
Expand Down
15 changes: 14 additions & 1 deletion core/libs/tests/GuestUserService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ int main() {
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
UserServiceGamePresets presets{};
presets.difficulty = 0x5a;
Require(sceUserServiceGetGamePresets(0, &presets) == USER_SERVICE_ERROR_INVALID_ARGUMENT && presets.difficulty == 0x5a);
for (int user_id : absent_users) {
Require(sceUserServiceGetGamePresets(user_id, &presets) == USER_SERVICE_ERROR_NOT_LOGGED_IN);
Require(presets.difficulty == 0x5a);
Require(sceUserServiceGetGamePresets(user_id, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
}
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID, &presets) == USER_SERVICE_OK && presets.difficulty == 0);
std::int32_t accessibilityValue = 0;
bool threwKeyremap = false;
Expand Down Expand Up @@ -209,6 +213,10 @@ int main() {
Require(value == 0x5a5a5a5a);
Require(setting.get(USER_SERVICE_INITIAL_USER_ID + 1, nullptr) == USER_SERVICE_ERROR_NOT_LOGGED_IN);
}
presets.difficulty = 0x5a;
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID + 1, &presets) == USER_SERVICE_ERROR_NOT_LOGGED_IN);
Require(presets.difficulty == 0x5a);
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID + 1, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);

UserServiceSetUserConnected_nid_postfix(1, true);
Require(sceUserServiceGetRegisteredUserIdList(&registered) == USER_SERVICE_OK);
Expand All @@ -232,6 +240,7 @@ int main() {
Require(setting.get(USER_SERVICE_INITIAL_USER_ID + 1, &value) == USER_SERVICE_OK);
Require(value == setting.value);
}
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID + 1, &presets) == USER_SERVICE_OK && presets.difficulty == 0);

UserServiceSetUserConnected_nid_postfix(1, false);
Require(sceUserServiceGetRegisteredUserIdList(&registered) == USER_SERVICE_OK);
Expand All @@ -255,4 +264,8 @@ int main() {
Require(value == 0x5a5a5a5a);
Require(setting.get(USER_SERVICE_INITIAL_USER_ID + 1, nullptr) == USER_SERVICE_ERROR_NOT_LOGGED_IN);
}
presets.difficulty = 0x5a;
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID + 1, &presets) == USER_SERVICE_ERROR_NOT_LOGGED_IN);
Require(presets.difficulty == 0x5a);
Require(sceUserServiceGetGamePresets(USER_SERVICE_INITIAL_USER_ID + 1, nullptr) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
}
1 change: 1 addition & 0 deletions docs/dev/debt/libSceUserService.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [sceUserServiceGetUserColor](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - the profile colour corresponds to user index (0: blue, 1: red, 2: green, 3: pink); colours 1, 2 and 3 are assumed, not measured
- [sceUserServiceGetUserName](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - `0x80960105`, which a PS5 (firmware 13.60) returns for a user id it does not know, has no known name; it is `USER_SERVICE_ERROR_UNKNOWN_USER` here. On the console a registered user who is not logged in still gets their name; here up to 4 users ("Player", "Player2", "Player3", "Player4") are supported; user names "Player2", "Player3" and "Player4" are assumed, not measured
- [sceUserServiceGetEvent](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - login and logout events queued dynamically on controller hotplug have no source and are assumed, not measured. Six titles disassembled for this entry drain the queue until the call returns nonzero. PPSA01494 01.100.002 (at 0x374C0C6), PPSA30839 01.003.000 (0x4DF3F0), PPSA31162 02.000.001 (0x550ED0) and PPSA34502 01.010.000 (0x30035C, 0x300433) act only on `event_type` 0 and 1, reading `user_id` at offset 4 for both, and skip other types. PPSA18194 01.004.003 (0x16D44A3) tells `NOT_INITIALIZED` (0x80960002) and `NO_EVENT` (0x80960007) apart and logs any other error. PPSA21564 01.007.000 copies each 8-byte event into a list at one site (0x2AFCA8) and discards them at the other (0x2B6CF3)
- [sceUserServiceGetGamePresets](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - system-wide game presets (difficulty, view inversion, subtitles, audio language) of a user's profile are unmeasured and not modelled, so all fields are reported as 0 ("not specified") allowing titles to use their defaults. PS5 firmware 13.42 disassembly verifies that checking a null presets pointer (returning 0x80960005, USER_SERVICE_ERROR_INVALID_ARGUMENT) precedes any user login check before dispatching IPC 0x30026; returning 0x80960009 (USER_SERVICE_ERROR_NOT_LOGGED_IN) for an unlogged user with a valid presets pointer is assumed from the service.
- [sceUserServiceGetAgeLevel](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - on a PS5 (firmware 13.60) the value is the age set in the user's parental restriction (0, 7, 12 and 15 were measured) and `0xFFFFFFFF` without one; a user who is not logged in returns `0x80960009` with or without an output. Parental restrictions are not modelled, so the initial user is always reported as unrestricted. PPSA12544 (Unity) only stores the value for its user profile. The one call in PPSA12544 (0x16a80a0), made only when bit 0x4 of its flags is set, writes the value to a field of its own object (offset 0x5170) and ends its chain of getters on any nonzero result; what it does with the value afterwards was not read.
- [sceUserServiceGetAccessibilityChatTranscription, PressAndHoldDelay, TriggerEffect, Vibration, ZoomEnabled, ZoomFollowFocus](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - report 0, 0, 1, 1, 0 and 1, what a PS5 (firmware 13.60) reports for a user whose accessibility settings are all at their defaults; the console reports the user's own settings (a changed vibration intensity read 3), which are not modelled. What each number means is unknown. A user who is not logged in returns `0x80960009` with or without an output. One title (PPSA04354) disassembled for this entry calls all six in a row (first at 0xea0efa) with its user ID, only when a flag bit (0x10) is set; a result other than 0 from any of them ends the block and is returned, and only when all six return 0 does it store the six values in its object.
- [sceUserServiceGetAccessibilityKeyremapEnable, sceUserServiceGetAccessibilityZoom](../../../core/libs/prx/libSceUserService/Export.cpp) (libSceUserService) - values reported by a console and their formats are unmeasured, so both throw.
Expand Down
Loading