From 487d0ff1fac49ccd2f0643d7e64b91c1f5335e49 Mon Sep 17 00:00:00 2001 From: Omar Elmahy Date: Thu, 29 Oct 2026 10:00:43 +0000 Subject: [PATCH] test(libSceSocialScreenDialog): cover null result precedence in sceSocialScreenDialogGetResult matching firmware 13.42 In sceSocialScreenDialogGetResult, verify that a null result pointer returns COMMON_DIALOG_ERROR_ARG_NULL before checking NOT_FINISHED when initialized, matching PS5 firmware 13.42 module disassembly (offset 0x360) and native execution data. Assert this error precedence and sentinel preservation in GuestSocialScreenDialog.cpp, and cite the native firmware evidence in docs/dev/debt/libSceSocialScreenDialog.md. --- core/libs/tests/GuestSocialScreenDialog.cpp | 14 +++++++++++--- docs/dev/debt/libSceSocialScreenDialog.md | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/libs/tests/GuestSocialScreenDialog.cpp b/core/libs/tests/GuestSocialScreenDialog.cpp index c86884d5f1..40138bb298 100644 --- a/core/libs/tests/GuestSocialScreenDialog.cpp +++ b/core/libs/tests/GuestSocialScreenDialog.cpp @@ -2,6 +2,7 @@ #include "prx/libc/include/general/VabiMacros.hpp" #include #include +#include namespace { @@ -15,12 +16,14 @@ constexpr int kErrAlreadyInitialized = static_cast(0x80B80004); constexpr int kErrNotFinished = static_cast(0x80B80005); constexpr int kErrArgNull = static_cast(0x80B8000D); constexpr int kResultUserCanceled = 1; +constexpr std::int32_t kSentinel = static_cast(0x5a5a5a5a); } int main() { std::int64_t param = 0; - std::int32_t result[2] = {-1, -1}; + std::int32_t result[2]; + std::memset(result, 0x5a, sizeof(result)); Require(sceSocialScreenDialogTerminate() == kErrNotInitialized); Require(sceSocialScreenDialogOpen(nullptr) == kErrNotInitialized); @@ -37,7 +40,11 @@ int main() { Require(sceSocialScreenDialogUpdateStatus() == kStatusInitialized); Require(sceSocialScreenDialogOpen(nullptr) == kErrArgNull); + std::memset(result, 0x5a, sizeof(result)); + Require(sceSocialScreenDialogGetResult(nullptr) == kErrArgNull); Require(sceSocialScreenDialogGetResult(result) == kErrNotFinished); + Require(result[0] == kSentinel); + Require(result[1] == kSentinel); Require(sceSocialScreenDialogOpen(¶m) == 0); Require(sceSocialScreenDialogGetStatus() == kStatusFinished); @@ -46,7 +53,7 @@ int main() { Require(sceSocialScreenDialogGetResult(nullptr) == kErrArgNull); Require(sceSocialScreenDialogGetResult(result) == 0); Require(result[0] == kResultUserCanceled); - Require(result[1] == -1); + Require(result[1] == kSentinel); Require(sceSocialScreenDialogClose() == 0); Require(sceSocialScreenDialogTerminate() == 0); @@ -60,9 +67,10 @@ int main() { Require(sceSocialScreenDialogUpdateStatus() == kStatusInitialized); Require(sceSocialScreenDialogClose() == 0); Require(sceSocialScreenDialogUpdateStatus() == kStatusFinished); - result[0] = -1; + std::memset(result, 0x5a, sizeof(result)); Require(sceSocialScreenDialogGetResult(result) == 0); Require(result[0] == kResultUserCanceled); + Require(result[1] == kSentinel); Require(sceSocialScreenDialogTerminate() == 0); Require(sceSocialScreenDialogTerminate() == kErrNotInitialized); Require(sceSocialScreenDialogOpen(nullptr) == kErrNotInitialized); diff --git a/docs/dev/debt/libSceSocialScreenDialog.md b/docs/dev/debt/libSceSocialScreenDialog.md index b1b16a216d..69c053996f 100644 --- a/docs/dev/debt/libSceSocialScreenDialog.md +++ b/docs/dev/debt/libSceSocialScreenDialog.md @@ -2,4 +2,4 @@ ### Silent stubs -- [libSceSocialScreenDialog](../../../core/libs/prx/libSceSocialScreenDialog/Export.cpp) - the social screen dialog runs the common-dialog state machine but shows nothing and reports the user as having cancelled, as there is no second-screen viewer. The signatures are from [Orbital's type database](https://github.com/AlexAltea/orbital/blob/b321fcdbd700cc02da1cb1ad25412781d5ec73c6/tools/ida/db_types.json); the result layout beyond the leading `int32_t` result code is not known, so nothing else is written. +- [libSceSocialScreenDialog](../../../core/libs/prx/libSceSocialScreenDialog/Export.cpp) - the social screen dialog runs the common-dialog state machine but shows nothing and reports the user as having cancelled, as there is no second-screen viewer. In `sceSocialScreenDialogGetResult`, PS5 firmware 13.42 module disassembly (offset 0x360) and native execution data confirm that a null result pointer is checked before NOT_FINISHED (returning COMMON_DIALOG_ERROR_ARG_NULL). The signatures are from [Orbital's type database](https://github.com/AlexAltea/orbital/blob/b321fcdbd700cc02da1cb1ad25412781d5ec73c6/tools/ida/db_types.json); the result layout beyond the leading `int32_t` result code is not known, so nothing else is written.