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 @@ -177,6 +177,16 @@ if(BUILD_TESTING)
configure_windows_unwind(savedata_replace_file_failure_tests)
add_test(NAME savedata_replace_file_failure COMMAND savedata_replace_file_failure_tests)

add_test_executable(guest_share_extended_tests tests/GuestShareExtended.cpp)
target_include_directories(guest_share_extended_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(guest_share_extended_tests PRIVATE libSceShare.native libc)
configure_windows_unwind(guest_share_extended_tests)
add_test(NAME guest_share_extended COMMAND guest_share_extended_tests)
if(WIN32)
set_tests_properties(guest_share_extended PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceShare.native>")
endif()

if(MINGW)
target_compile_options(savedata_core_write_replacement_tests PRIVATE -fasynchronous-unwind-tables)
target_compile_options(savedata_native_write_replacement_tests PRIVATE -fasynchronous-unwind-tables)
Expand Down
25 changes: 25 additions & 0 deletions core/libs/prx/libSceShare.native/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,29 @@ int APS5_VABI sceShareUnregisterContentEventCallback(void* callback) {
return 0;
}

int APS5_VABI sceShareCaptureScreenshotExtended(const void* extended_param, int32_t* req_id) {
constexpr std::int32_t REQUEST_ID_INVALID = -1;
constexpr std::int32_t ERROR_NOT_SUPPORTED = static_cast<std::int32_t>(0x81960007);
(void)extended_param;
if (req_id != nullptr) {
*req_id = REQUEST_ID_INVALID;
}
return ERROR_NOT_SUPPORTED;
}

int APS5_VABI sceShareCaptureVideoClipExtended(void) {
NotImplemented_nid_no_patch(__func__);
return 0;
}

int APS5_VABI sceShareGetRunningStatus(void) {
NotImplemented_nid_no_patch(__func__);
return 0;
}

int APS5_VABI sceShareSetContentParamForApplicationTitle(void) {
NotImplemented_nid_no_patch(__func__);
return 0;
}

}
48 changes: 48 additions & 0 deletions core/libs/tests/GuestShareExtended.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstdint>
#include <cstdlib>
#include <stdexcept>

extern "C" {
int APS5_VABI sceShareCaptureScreenshotExtended(const void* extended_param, std::int32_t* req_id);
int APS5_VABI sceShareCaptureVideoClipExtended();
int APS5_VABI sceShareGetRunningStatus();
int APS5_VABI sceShareSetContentParamForApplicationTitle();
}

namespace {

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

template <typename TCall>
bool NotImplemented(TCall call) {
try {
call();
} catch (const std::runtime_error&) {
return true;
}
return false;
}

}

int main() {
constexpr std::int32_t notSupported = static_cast<std::int32_t>(0x81960007);
std::uint8_t param[64]{};

std::int32_t reqId = 7;
Require(sceShareCaptureScreenshotExtended(param, &reqId) == notSupported);
Require(reqId == -1);

reqId = 7;
Require(sceShareCaptureScreenshotExtended(nullptr, &reqId) == notSupported);
Require(reqId == -1);

Require(sceShareCaptureScreenshotExtended(param, nullptr) == notSupported);
Require(sceShareCaptureScreenshotExtended(nullptr, nullptr) == notSupported);

Require(NotImplemented([] { sceShareCaptureVideoClipExtended(); }));
Require(NotImplemented([] { sceShareGetRunningStatus(); }));
Require(NotImplemented([] { sceShareSetContentParamForApplicationTitle(); }));
return 0;
}
Loading