Skip to content
Closed
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
2 changes: 1 addition & 1 deletion core/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ if(BUILD_TESTING)
add_test(NAME patched_libraries COMMAND patched_libraries_tests ${PATCHED_DIR})
add_test_executable(guest_offline_imports_tests tests/GuestOfflineImports.cpp)
target_include_directories(guest_offline_imports_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_offline_imports_tests PRIVATE libSceHttp libSceNpEntitlementAccess libSceRudp libc)
target_link_libraries(guest_offline_imports_tests PRIVATE libSceHttp libSceNpEntitlementAccess libSceNpSessionSignaling libSceRudp libc)
configure_windows_unwind(guest_offline_imports_tests)
add_test(NAME guest_offline_imports COMMAND guest_offline_imports_tests)
if(WIN32)
Expand Down
13 changes: 6 additions & 7 deletions core/libs/prx/libSceNpSessionSignaling/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ int APS5_VABI sceNpSessionSignalingTerminate(void) {
}

int32_t APS5_VABI sceNpSessionSignalingGetConnectionStatus(int32_t context_id, int32_t connection_id, int32_t* status, void* peer_address, uint16_t* peer_port) {
(void)context_id;
(void)connection_id;
(void)status;
(void)peer_address;
(void)peer_port;
NotImplemented_nid_no_patch(__func__);
return 0;
(void)context_id;
(void)connection_id;
(void)peer_address;
(void)peer_port;
if (!status) return SCE_NP_SESSION_SIGNALING_ERROR_INVALID_ARGUMENT;
return SCE_NP_SESSION_SIGNALING_ERROR_UNAVAILABLE;
}

int32_t APS5_VABI sceNpSessionSignalingGetLocalNetInfo(int32_t context_id, void* info) {
Expand Down
15 changes: 15 additions & 0 deletions core/libs/tests/GuestOfflineImports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ int APS5_VABI sceNpEntitlementAccessRequestUnifiedEntitlementInfoList();
int APS5_VABI sceNpEntitlementAccessPollUnifiedEntitlementInfoList();
int APS5_VABI sceNpEntitlementAccessRequestServiceEntitlementInfoList();
int APS5_VABI sceNpEntitlementAccessPollServiceEntitlementInfoList();
int APS5_VABI sceNpSessionSignalingGetConnectionStatus(std::int32_t, std::int32_t, std::int32_t*, void*, std::uint16_t*);
int APS5_VABI sceRudpInit_nid_postfix(void*, int);
int APS5_VABI sceRudpGetStatus(void*, std::size_t);
int APS5_VABI sceRudpTerminate();
Expand Down Expand Up @@ -67,6 +68,20 @@ int main() {
Require(sceNpEntitlementAccessRequestServiceEntitlementInfoList() == signedOut);
Require(sceNpEntitlementAccessPollServiceEntitlementInfoList() == signedOut);

constexpr int signalingInvalidArgument = static_cast<int>(0x80553303);
constexpr int signalingUnavailable = static_cast<int>(0x80552D06);
std::int32_t connectionStatus = 0x12345678;
std::uint16_t peerPort = 0x2345;
std::array<unsigned char, 16> peerAddress{};
peerAddress.fill(0xA5);
Require(sceNpSessionSignalingGetConnectionStatus(1, 1, nullptr, peerAddress.data(), &peerPort) == signalingInvalidArgument);
Require(sceNpSessionSignalingGetConnectionStatus(1, 1, &connectionStatus, peerAddress.data(), &peerPort) == signalingUnavailable);
Require(connectionStatus == 0x12345678);
Require(peerPort == 0x2345);
for (unsigned char octet : peerAddress) Require(octet == 0xA5);
Require(sceNpSessionSignalingGetConnectionStatus(0, 0, &connectionStatus, nullptr, nullptr) == signalingUnavailable);
Require(connectionStatus == 0x12345678);

std::array<unsigned char, 248> status;
status.fill(0x5a);
const auto originalStatus = status;
Expand Down
1 change: 1 addition & 0 deletions docs/dev/TechnicalDebt.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Throughout the project, every function at every stage either **does exactly what

### Functional

- [Offline session connection status](../../core/libs/prx/libSceNpSessionSignaling/Export.cpp) (libSceNpSessionSignaling) reports `UNAVAILABLE` for valid output pointers and `INVALID_ARGUMENT` for a null status pointer because AnyPS5 does not establish PSN signaling sessions. Output buffers are left unchanged on failure. Error precedence for invalid context/connection identifiers and the console's exact responses are unverified on PS5 hardware.
- [libSceHttp2 asynchronous requests](../../core/libs/prx/libSceHttp2/Export.cpp) (libSceHttp2) never reach the network: `sceHttp2SendRequestAsync` accepts the request, queues a completion whose result is the library's network error and triggers the user event named by the kqueue option (equeue at offset 0, event id at 8, user data at 16, layout inferred from PPSA17221); `sceHttp2WaitAsync` returns that completion. The completion's `event_type` value is unknown and left 0. PPSA17221 completes its request object only after `sceHttp2SendRequestAsync` returns, and its handler for a synchronous failure calls `shared_from_this` before that, so a send must not fail synchronously. A kqueue option or user event that is missing, an extra option, and a wait with no completed operation throw
- [sceKernelWriteThrottlingStatus](../../core/libs/prx/libkernel/File/src/Stdio.cpp) (libkernel) reports no write throttling: the host SSD has no write budget, so the first qword of the 32-byte status is set to `UINT32_MAX` and the rest is zeroed. PPSA17221 reads only that qword: it multiplies it by 64 KiB and compares the product with byte thresholds up to 0x4AF00000 to pick one of five tiers. When the call fails the title assumes 0x4B000001 bytes, which selects the same top tier as `UINT32_MAX`. What the value measures on hardware (a remaining budget or a rate) and the meaning of the other three qwords are unknown
- [Wide-character conversions](../../core/libs/prx/libc/src/Strings.cpp) (libc) - `wcsrtombs` and [`swprintf`](../../core/libs/prx/libc/src/Formatting.cpp) still pass guest strings to the host's `wchar_t` functions. The guest's `wchar_t` is 16 bits, so on Linux, where the host's is 32 bits, they misread and miswrite guest strings. The wide `wcsto*` functions parse the ASCII prefix of the guest string, as the C locale accepts only ASCII white space and digits
Expand Down
Loading