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
10 changes: 10 additions & 0 deletions core/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ if(BUILD_TESTING)
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceRudp>")
endif()

add_test_executable(guest_react_native_vsh_tests tests/GuestReactNativeVsh.cpp)
target_include_directories(guest_react_native_vsh_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_react_native_vsh_tests PRIVATE libReactNative.Modules.Vsh libc)
configure_windows_unwind(guest_react_native_vsh_tests)
add_test(NAME guest_react_native_vsh COMMAND guest_react_native_vsh_tests)
if(WIN32)
set_tests_properties(guest_react_native_vsh PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libReactNative.Modules.Vsh>")
endif()

add_test_executable(guest_rudp_context_queries_tests tests/GuestRudpContextQueries.cpp)
target_include_directories(guest_rudp_context_queries_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_rudp_context_queries_tests PRIVATE libSceRudp libc)
Expand Down
17 changes: 12 additions & 5 deletions core/libs/prx/libReactNative.Modules.Vsh/Export.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
#include <cstdint>
#include <cstddef>
#include <cstring>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"

namespace {

constexpr int REMOTEPLAY_CONNECTION_STATUS_DISCONNECT = 0;
constexpr int SHARE_ERROR_INVALID_PARAM = static_cast<int>(0x81960002);

}

extern "C" {

int APS5_VABI RemotePlayGetConnectionStatus(int user_id, int* status) {
(void)user_id;
(void)status;
NotImplemented_nid_no_patch(__func__);
if (!status) APS5_INVALID_ARG_EX;
*status = REMOTEPLAY_CONNECTION_STATUS_DISCONNECT;
return 0;
}

int APS5_VABI ShareGetCurrentStatus(uint32_t feature_flag, ShareCurrentStatus* status) {
(void)feature_flag;
(void)status;
NotImplemented_nid_no_patch(__func__);
if (feature_flag == 0 || status == nullptr) return SHARE_ERROR_INVALID_PARAM;
std::memset(status, 0, sizeof(*status));
return 0;
}

Expand Down
36 changes: 36 additions & 0 deletions core/libs/tests/GuestReactNativeVsh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "prx/libc/include/general/VabiMacros.hpp"

#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <stdexcept>

extern "C" {
int APS5_VABI RemotePlayGetConnectionStatus(int user_id, int* status);
int APS5_VABI ShareGetCurrentStatus(std::uint32_t feature_flag, void* status);
}

static void Require(bool value) { if (!value) std::abort(); }

int main() {
int connection = -1;
Require(RemotePlayGetConnectionStatus(1, &connection) == 0 && connection == 0);
bool threw = false;
try {
RemotePlayGetConnectionStatus(1, nullptr);
} catch (const std::invalid_argument&) {
threw = true;
}
Require(threw);

constexpr int invalidParam = static_cast<int>(0x81960002);
std::uint8_t status[18];
std::memset(status, 0x5a, sizeof(status));
Require(ShareGetCurrentStatus(1, status) == 0);
for (std::size_t index = 0; index < sizeof(status); ++index) Require(status[index] == (index < 16 ? 0 : 0x5a));
std::memset(status, 0x5a, sizeof(status));
Require(ShareGetCurrentStatus(0, status) == invalidParam && status[0] == 0x5a);
Require(ShareGetCurrentStatus(1, nullptr) == invalidParam);
return 0;
}
1 change: 1 addition & 0 deletions docs/dev/TechnicalDebt.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ Throughout the project, every function at every stage either **does exactly what
- [uDGXwUKqi8s](../../core/libs/prx/libkernel/Unimplemented.cpp) (libkernel) - unknown name, signature
- [LinuxProtFromSce](../../core/libs/prx/libkernel/DirectMemory/DirectMemory.cpp) (libkernel) - protection bits 0x100 and 0x200 are accepted and assumed not to affect host CPU access; host protection is derived only from the read, write and execute bits
- [_sceUlobjmgrRegisterObject](../../core/libs/prx/ulobjmgr/Export.cpp) (ulobjmgr) - parameters taken from shadPS4 (PS4): a nonzero 64-bit object, a nonzero 32-bit kind and a 32-bit id output; the meaning of the first two and the PS5 signature are unverified. The id bound of `_sceUlobjmgrUnregisterObject` (below 0x4000) and the raw `EINVAL` (22) return also come from shadPS4
- [RemotePlayGetConnectionStatus, ShareGetCurrentStatus](../../core/libs/prx/libReactNative.Modules.Vsh/Export.cpp) (libReactNative.Modules.Vsh) - these shell module wrappers are assumed to take the arguments of `sceRemoteplayGetConnectionStatus` and `sceShareGetCurrentStatus` and to answer as those do here: no Remote Play session (status 0, disconnected, and a null status throws), and the libSceShare validation with an all-zero 16-byte share status. `ShareInitialize` and `ShareTerminate` still throw
- [sceShareGetCurrentStatus](../../core/libs/prx/libSceShare/Export.cpp) (libSceShare) - validation (feature flag non-zero, status non-null) and the all-zero 16-byte status taken from the [KytyPS5](https://github.com/KytyPS5/KytyPS5) reimplementation, not confirmed on a PS5 title; the meaning of the recording status values is unknown
- [sceShareGetRunningStatus](../../core/libs/prx/libSceShare/Export.cpp) (libSceShare) - only the first 32-bit word of the status is known: PPSA01317 treats bits 0x3c of it as a running share feature and gives the call a 40-byte buffer. The host never records or broadcasts, so it stores 0 in that word and leaves the rest untouched; a null status returns `INVALID_PARAM` by analogy with `sceShareGetCurrentStatus`
- [sceShareSetContentParamForApplicationTitle](../../core/libs/prx/libSceShare/Export.cpp) (libSceShare) - imported by PPSA12544's Unity plugins; the signature follows [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/main/src/libs/libShare.cpp), not confirmed on a PS5 title. The application title is only checked for null, as KytyPS5 does, since nothing is captured
Expand Down
Loading