mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-30 22:45:17 -04:00
strat: use sf::NativeHandle for ipc templating
This commit is contained in:
parent
d97e97258e
commit
69777cf792
41 changed files with 447 additions and 454 deletions
|
@ -53,7 +53,7 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
Result ManagerImpl::GetEvent(ams::sf::OutCopyHandle out) {
|
||||
out.SetValue(this->system_event.GetReadableHandle());
|
||||
out.SetValue(this->system_event.GetReadableHandle(), false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,12 @@ namespace ams::fs::impl {
|
|||
private:
|
||||
virtual Result DoBindEvent(os::SystemEventType *out, os::EventClearMode clear_mode) override {
|
||||
/* Get the handle. */
|
||||
sf::CopyHandle handle;
|
||||
sf::NativeHandle handle;
|
||||
AMS_FS_R_TRY(m_object->GetEventHandle(std::addressof(handle)));
|
||||
|
||||
/* Create the system event. */
|
||||
os::AttachReadableHandleToSystemEvent(out, handle, true, clear_mode);
|
||||
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), clear_mode);
|
||||
handle.Detach();
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
|
|
@ -181,10 +181,11 @@ namespace ams::gpio {
|
|||
Result BindInterrupt(os::SystemEventType *event, GpioPadSession *session) {
|
||||
AMS_ASSERT(session->_event == nullptr);
|
||||
|
||||
ams::sf::CopyHandle handle;
|
||||
ams::sf::NativeHandle handle;
|
||||
R_TRY(GetInterface(session)->BindInterrupt(std::addressof(handle)));
|
||||
|
||||
os::AttachReadableHandleToSystemEvent(event, handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(event, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
handle.Detach();
|
||||
|
||||
session->_event = event;
|
||||
return ResultSuccess();
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace ams::gpio {
|
|||
Result BindInterrupt(ams::sf::OutCopyHandle out) {
|
||||
::Event ev;
|
||||
R_TRY(::gpioPadBindInterrupt(std::addressof(this->srv), std::addressof(ev)));
|
||||
out.SetValue(ev.revent);
|
||||
out.SetValue(ev.revent, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ namespace ams::htc::server {
|
|||
|
||||
Result HtcServiceObject::GetHostConnectionEvent(sf::OutCopyHandle out) {
|
||||
/* Set the output handle. */
|
||||
*out = m_observer.GetConnectEvent()->GetReadableHandle();
|
||||
out.SetValue(m_observer.GetConnectEvent()->GetReadableHandle(), false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result HtcServiceObject::GetHostDisconnectionEvent(sf::OutCopyHandle out) {
|
||||
/* Set the output handle. */
|
||||
*out = m_observer.GetDisconnectEvent()->GetReadableHandle();
|
||||
out.SetValue(m_observer.GetDisconnectEvent()->GetReadableHandle(), false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,8 @@ namespace ams::htc::server {
|
|||
|
||||
Result HtcServiceObject::RunOnHostStart(sf::Out<u32> out_id, sf::OutCopyHandle out, const sf::InBuffer &args) {
|
||||
/* Begin the run on host task. */
|
||||
R_TRY(m_misc_impl.RunOnHostBegin(out_id.GetPointer(), out.GetHandlePointer(), reinterpret_cast<const char *>(args.GetPointer()), args.GetSize()));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(m_misc_impl.RunOnHostBegin(out_id.GetPointer(), std::addressof(event_handle), reinterpret_cast<const char *>(args.GetPointer()), args.GetSize()));
|
||||
|
||||
/* Add the task id to our set. */
|
||||
{
|
||||
|
@ -95,8 +96,8 @@ namespace ams::htc::server {
|
|||
m_set.insert(*out_id);
|
||||
}
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out.SetManaged(true);
|
||||
/* Set the output event. */
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ namespace ams::htcs::client {
|
|||
Result Accept(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address) { AMS_ABORT("Not Implemented"); }
|
||||
Result Recv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result Send(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::InAutoSelectBuffer &buffer, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle mem_handle, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle &&mem_handle, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result SendStartOld(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle mem_handle, s64 aligned_size, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle &&mem_handle, s64 aligned_size, s32 flags) { AMS_ABORT("Not Implemented"); }
|
||||
Result ContinueSendOld(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id) { AMS_ABORT("Not Implemented"); }
|
||||
|
||||
Result Close(sf::Out<s32> out_err, sf::Out<s32> out_res);
|
||||
|
@ -138,7 +138,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteManager::StartSelect(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray<s32> &read_handles, const sf::InMapAliasArray<s32> &write_handles, const sf::InMapAliasArray<s32> &exception_handles, s64 tv_sec, s64 tv_usec) {
|
||||
return ::htcsStartSelect(out_task_id.GetPointer(), out_event.GetHandlePointer(), read_handles.GetPointer(), read_handles.GetSize(), write_handles.GetPointer(), write_handles.GetSize(), exception_handles.GetPointer(), exception_handles.GetSize(), tv_sec, tv_usec);
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsStartSelect(out_task_id.GetPointer(), std::addressof(event_handle), read_handles.GetPointer(), read_handles.GetSize(), write_handles.GetPointer(), write_handles.GetSize(), exception_handles.GetPointer(), exception_handles.GetSize(), tv_sec, tv_usec));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteManager::EndSelect(sf::Out<s32> out_err, sf::Out<s32> out_count, const sf::OutMapAliasArray<s32> &read_handles, const sf::OutMapAliasArray<s32> &write_handles, const sf::OutMapAliasArray<s32> &exception_handles, u32 task_id) {
|
||||
|
@ -172,7 +176,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteSocket::AcceptStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event) {
|
||||
return ::htcsSocketAcceptStart(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer());
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsSocketAcceptStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle)));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteSocket::AcceptResults(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address, u32 task_id) {
|
||||
|
@ -187,7 +195,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteSocket::RecvStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags) {
|
||||
return ::htcsSocketRecvStart(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer(), mem_size, flags);
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsSocketRecvStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), mem_size, flags));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteSocket::RecvResults(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
|
@ -195,7 +207,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteSocket::SendStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags) {
|
||||
return ::htcsSocketSendStart(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer(), buffer.GetPointer(), buffer.GetSize(), flags);
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsSocketSendStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), buffer.GetPointer(), buffer.GetSize(), flags));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteSocket::SendResults(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id) {
|
||||
|
@ -203,7 +219,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteSocket::StartSend(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags) {
|
||||
return ::htcsSocketStartSend(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer(), out_max_size.GetPointer(), size, flags);
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsSocketStartSend(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), out_max_size.GetPointer(), size, flags));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteSocket::ContinueSend(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id) {
|
||||
|
@ -215,7 +235,11 @@ namespace ams::htcs::client {
|
|||
}
|
||||
|
||||
Result RemoteSocket::StartRecv(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags) {
|
||||
return ::htcsSocketStartRecv(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer(), size, flags);
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(::htcsSocketStartRecv(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), size, flags));
|
||||
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteSocket::EndRecv(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) {
|
||||
|
|
|
@ -496,11 +496,12 @@ namespace ams::htcs {
|
|||
/* Begin the accept. */
|
||||
sf::SharedPointer<tma::ISocket> res = nullptr;
|
||||
u32 task_id = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(socket->AcceptStart(std::addressof(task_id), std::addressof(event_handle)))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
@ -562,11 +563,12 @@ namespace ams::htcs {
|
|||
/* Begin the select. */
|
||||
s32 res = -1;
|
||||
u32 task_id = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(g_manager->StartSelect(std::addressof(task_id), std::addressof(event_handle), InArray(read, num_read), InArray(write, num_write), InArray(except, num_except), tv_sec, tv_usec))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
@ -596,11 +598,12 @@ namespace ams::htcs {
|
|||
|
||||
/* Start the receive. */
|
||||
u32 task_id = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(socket->StartRecv(std::addressof(task_id), std::addressof(event_handle), static_cast<s64>(buffer_size), flags))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
@ -627,11 +630,12 @@ namespace ams::htcs {
|
|||
/* Start the send. */
|
||||
u32 task_id = 0;
|
||||
s64 max_size = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(socket->StartSend(std::addressof(task_id), std::addressof(event_handle), std::addressof(max_size), static_cast<s64>(buffer_size), flags))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
@ -697,11 +701,12 @@ namespace ams::htcs {
|
|||
/* Start the receive. */
|
||||
s64 res = -1;
|
||||
u32 task_id = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(socket->RecvStart(std::addressof(task_id), std::addressof(event_handle), static_cast<s32>(recv_size), flags))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
@ -729,11 +734,12 @@ namespace ams::htcs {
|
|||
/* Start the send. */
|
||||
s64 res = -1;
|
||||
u32 task_id = 0;
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
if (R_SUCCEEDED(socket->SendStart(std::addressof(task_id), std::addressof(event_handle), sf::InNonSecureAutoSelectBuffer(buffer, buffer_size), flags))) {
|
||||
/* Create system event. */
|
||||
os::SystemEventType event;
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* When we're done, clean up the event. */
|
||||
ON_SCOPE_EXIT { os::DestroySystemEvent(std::addressof(event)); };
|
||||
|
|
|
@ -79,10 +79,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the select. */
|
||||
R_TRY(manager->StartSelect(out_task_id.GetPointer(), out_event.GetHandlePointer(), read_handles.ToSpan(), write_handles.ToSpan(), exception_handles.ToSpan(), tv_sec, tv_usec));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->StartSelect(out_task_id.GetPointer(), std::addressof(event_handle), read_handles.ToSpan(), write_handles.ToSpan(), exception_handles.ToSpan(), tv_sec, tv_usec));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,10 +118,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the accept. */
|
||||
R_TRY(manager->AcceptStart(out_task_id.GetPointer(), out_event.GetHandlePointer(), m_desc));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->AcceptStart(out_task_id.GetPointer(), std::addressof(event_handle), m_desc));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -147,10 +148,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the recv. */
|
||||
R_TRY(manager->RecvStart(out_task_id.GetPointer(), out_event.GetHandlePointer(), mem_size, m_desc, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->RecvStart(out_task_id.GetPointer(), std::addressof(event_handle), mem_size, m_desc, flags));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -164,13 +166,14 @@ namespace ams::htcs::server {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result SocketServiceObject::RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle mem_handle, s32 flags) {
|
||||
Result SocketServiceObject::RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle &&mem_handle, s32 flags) {
|
||||
/* Check that the transfer memory size is okay. */
|
||||
R_UNLESS(util::IsIntValueRepresentable<size_t>(aligned_size), htcs::ResultInvalidSize());
|
||||
|
||||
/* Attach the transfer memory. */
|
||||
os::TransferMemoryType tmem;
|
||||
os::AttachTransferMemory(std::addressof(tmem), static_cast<size_t>(aligned_size), mem_handle.GetValue(), true);
|
||||
os::AttachTransferMemory(std::addressof(tmem), static_cast<size_t>(aligned_size), mem_handle.GetOsHandle(), mem_handle.IsManaged());
|
||||
mem_handle.Detach();
|
||||
ON_SCOPE_EXIT { os::DestroyTransferMemory(std::addressof(tmem)); };
|
||||
|
||||
/* Map the transfer memory. */
|
||||
|
@ -182,10 +185,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the large receive. */
|
||||
R_TRY(manager->RecvStart(out_task_id.GetPointer(), out_event.GetHandlePointer(), unaligned_size_start + aligned_size + unaligned_size_end, m_desc, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->RecvStart(out_task_id.GetPointer(), std::addressof(event_handle), unaligned_size_start + aligned_size + unaligned_size_end, m_desc, flags));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -193,7 +197,7 @@ namespace ams::htcs::server {
|
|||
return this->SendStart(out_task_id, out_event, sf::InNonSecureAutoSelectBuffer(buffer.GetPointer(), buffer.GetSize()), flags);
|
||||
}
|
||||
|
||||
Result SocketServiceObject::SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle mem_handle, s64 aligned_size, s32 flags) {
|
||||
Result SocketServiceObject::SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle &&mem_handle, s64 aligned_size, s32 flags) {
|
||||
/* Check that the sizes are okay. */
|
||||
R_UNLESS(util::IsIntValueRepresentable<s64>(start_buffer.GetSize()), htcs::ResultInvalidSize());
|
||||
R_UNLESS(util::IsIntValueRepresentable<s64>(end_buffer.GetSize()), htcs::ResultInvalidSize());
|
||||
|
@ -201,7 +205,8 @@ namespace ams::htcs::server {
|
|||
|
||||
/* Attach the transfer memory. */
|
||||
os::TransferMemoryType tmem;
|
||||
os::AttachTransferMemory(std::addressof(tmem), static_cast<size_t>(aligned_size), mem_handle.GetValue(), true);
|
||||
os::AttachTransferMemory(std::addressof(tmem), static_cast<size_t>(aligned_size), mem_handle.GetOsHandle(), mem_handle.IsManaged());
|
||||
mem_handle.Detach();
|
||||
ON_SCOPE_EXIT { os::DestroyTransferMemory(std::addressof(tmem)); };
|
||||
|
||||
/* Map the transfer memory. */
|
||||
|
@ -217,10 +222,11 @@ namespace ams::htcs::server {
|
|||
const char *pointers[NumBuffers] = { reinterpret_cast<const char *>(start_buffer.GetPointer()), static_cast<const char *>(address), reinterpret_cast<const char *>(end_buffer.GetPointer()) };
|
||||
s64 sizes[NumBuffers] = { static_cast<s64>(start_buffer.GetSize()), aligned_size, static_cast<s64>(end_buffer.GetSize()) };
|
||||
|
||||
R_TRY(manager->SendLargeStart(out_task_id.GetPointer(), out_event.GetHandlePointer(), pointers, sizes, NumBuffers, m_desc, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->SendLargeStart(out_task_id.GetPointer(), std::addressof(event_handle), pointers, sizes, NumBuffers, m_desc, flags));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -239,13 +245,14 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the send. */
|
||||
R_TRY(manager->StartSend(out_task_id.GetPointer(), out_event.GetHandlePointer(), m_desc, size, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->StartSend(out_task_id.GetPointer(), std::addressof(event_handle), m_desc, size, flags));
|
||||
|
||||
/* Set the output max size to the size. */
|
||||
*out_max_size = size;
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -268,10 +275,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the recv. */
|
||||
R_TRY(manager->StartRecv(out_task_id.GetPointer(), out_event.GetHandlePointer(), size, m_desc, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->StartRecv(out_task_id.GetPointer(), std::addressof(event_handle), size, m_desc, flags));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
@ -293,10 +301,11 @@ namespace ams::htcs::server {
|
|||
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
|
||||
|
||||
/* Start the send. */
|
||||
R_TRY(manager->SendStart(out_task_id.GetPointer(), out_event.GetHandlePointer(), reinterpret_cast<const char *>(buffer.GetPointer()), buffer.GetSize(), m_desc, flags));
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY(manager->SendStart(out_task_id.GetPointer(), std::addressof(event_handle), reinterpret_cast<const char *>(buffer.GetPointer()), buffer.GetSize(), m_desc, flags));
|
||||
|
||||
/* Mark the output event as managed. */
|
||||
out_event.SetManaged(true);
|
||||
/* Set the output event handle. */
|
||||
out_event.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ namespace ams::htcs::server {
|
|||
Result AcceptResults(sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address, u32 task_id);
|
||||
Result RecvStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags);
|
||||
Result RecvResults(sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id);
|
||||
Result RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle mem_handle, s32 flags);
|
||||
Result RecvLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle &&mem_handle, s32 flags);
|
||||
Result SendStartOld(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags);
|
||||
Result SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle mem_handle, s64 aligned_size, s32 flags);
|
||||
Result SendLargeStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle &&mem_handle, s64 aligned_size, s32 flags);
|
||||
Result SendResults(sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id);
|
||||
Result StartSend(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags);
|
||||
Result ContinueSendOld(sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id);
|
||||
|
|
|
@ -32,13 +32,13 @@ namespace ams::pgl {
|
|||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
::Event ev;
|
||||
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(this->observer), std::addressof(ev)));
|
||||
out.SetValue(ev.revent);
|
||||
out.SetValue(ev.revent, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||
return ::pglEventObserverGetProcessEventInfo(std::addressof(this->observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer()));
|
||||
return ::pglEventObserverGetProcessEventInfo(std::addressof(this->observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace ams::pgl::srv {
|
|||
}
|
||||
|
||||
Result ShellEventObserverCmif::GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
out.SetValue(this->GetEvent().GetReadableHandle());
|
||||
out.SetValue(this->GetEvent().GetReadableHandle(), false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,14 @@ namespace ams::sf::hipc {
|
|||
ServerSession *session;
|
||||
bool is_mitm_session;
|
||||
private:
|
||||
Result CloneCurrentObjectImpl(os::NativeHandle *out_client_handle, ServerSessionManager *tagged_manager) {
|
||||
Result CloneCurrentObjectImpl(sf::OutMoveHandle &out_client_handle, ServerSessionManager *tagged_manager) {
|
||||
/* Clone the object. */
|
||||
cmif::ServiceObjectHolder &&clone = this->session->srv_obj_holder.Clone();
|
||||
R_UNLESS(clone, sf::hipc::ResultDomainObjectNotFound());
|
||||
|
||||
/* Create new session handles. */
|
||||
os::NativeHandle server_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out_client_handle));
|
||||
os::NativeHandle server_handle, client_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(std::addressof(server_handle), std::addressof(client_handle)));
|
||||
|
||||
/* Register with manager. */
|
||||
if (!is_mitm_session) {
|
||||
|
@ -53,6 +53,8 @@ namespace ams::sf::hipc {
|
|||
R_ABORT_UNLESS(tagged_manager->RegisterMitmSession(server_handle, std::move(clone), std::move(new_forward_service)));
|
||||
}
|
||||
|
||||
/* Set output client handle. */
|
||||
out_client_handle.SetValue(client_handle, false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
public:
|
||||
|
@ -113,36 +115,47 @@ namespace ams::sf::hipc {
|
|||
auto &&object = domain->GetObject(object_id);
|
||||
if (!object) {
|
||||
R_UNLESS(this->is_mitm_session, sf::hipc::ResultDomainObjectNotFound());
|
||||
return cmifCopyFromCurrentDomain(this->session->forward_service->session, object_id.value, out.GetHandlePointer());
|
||||
|
||||
os::NativeHandle handle;
|
||||
R_TRY(cmifCopyFromCurrentDomain(this->session->forward_service->session, object_id.value, std::addressof(handle)));
|
||||
|
||||
out.SetValue(handle, false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
if (!this->is_mitm_session || object_id.value != serviceGetObjectId(this->session->forward_service.get())) {
|
||||
/* Create new session handles. */
|
||||
os::NativeHandle server_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out.GetHandlePointer()));
|
||||
os::NativeHandle server_handle, client_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(std::addressof(server_handle), std::addressof(client_handle)));
|
||||
|
||||
/* Register. */
|
||||
R_ABORT_UNLESS(this->manager->RegisterSession(server_handle, std::move(object)));
|
||||
|
||||
/* Set output client handle. */
|
||||
out.SetValue(client_handle, false);
|
||||
} else {
|
||||
/* Copy from the target domain. */
|
||||
os::NativeHandle new_forward_target;
|
||||
R_TRY(cmifCopyFromCurrentDomain(this->session->forward_service->session, object_id.value, &new_forward_target));
|
||||
|
||||
/* Create new session handles. */
|
||||
os::NativeHandle server_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out.GetHandlePointer()));
|
||||
os::NativeHandle server_handle, client_handle;
|
||||
R_ABORT_UNLESS(hipc::CreateSession(std::addressof(server_handle), std::addressof(client_handle)));
|
||||
|
||||
/* Register. */
|
||||
std::shared_ptr<::Service> new_forward_service = std::move(ServerSession::CreateForwardService());
|
||||
serviceCreate(new_forward_service.get(), new_forward_target);
|
||||
R_ABORT_UNLESS(this->manager->RegisterMitmSession(server_handle, std::move(object), std::move(new_forward_service)));
|
||||
|
||||
/* Set output client handle. */
|
||||
out.SetValue(client_handle, false);
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result CloneCurrentObject(sf::OutMoveHandle out) {
|
||||
return this->CloneCurrentObjectImpl(out.GetHandlePointer(), this->manager);
|
||||
return this->CloneCurrentObjectImpl(out, this->manager);
|
||||
}
|
||||
|
||||
void QueryPointerBufferSize(sf::Out<u16> out) {
|
||||
|
@ -150,7 +163,7 @@ namespace ams::sf::hipc {
|
|||
}
|
||||
|
||||
Result CloneCurrentObjectEx(sf::OutMoveHandle out, u32 tag) {
|
||||
return this->CloneCurrentObjectImpl(out.GetHandlePointer(), this->manager->GetSessionManagerByTag(tag));
|
||||
return this->CloneCurrentObjectImpl(out, this->manager->GetSessionManagerByTag(tag));
|
||||
}
|
||||
};
|
||||
static_assert(IsIHipcManager<HipcManagerImpl>);
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace ams::sprofile::srv {
|
|||
}
|
||||
|
||||
Result GetEventHandle(sf::OutCopyHandle out) {
|
||||
out.SetValue(m_event.GetReadableHandle());
|
||||
out.SetValue(m_event.GetReadableHandle(), false);
|
||||
return ResultSuccess();
|
||||
}
|
||||
public:
|
||||
|
|
|
@ -54,14 +54,15 @@ namespace ams::usb {
|
|||
}
|
||||
|
||||
/* Bind the client process. */
|
||||
R_TRY(m_ds_service->Bind(complex_id, dd::GetCurrentProcessHandle()));
|
||||
R_TRY(m_ds_service->Bind(complex_id, sf::CopyHandle(dd::GetCurrentProcessHandle(), false)));
|
||||
|
||||
/* Get the state change event. */
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
R_TRY(m_ds_service->GetStateChangeEvent(std::addressof(event_handle)));
|
||||
|
||||
/* Attach the state change event handle to our event. */
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_state_change_event), event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_state_change_event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* Mark ourselves as initialized. */
|
||||
m_is_initialized = true;
|
||||
|
@ -250,17 +251,21 @@ namespace ams::usb {
|
|||
auto intf_guard = SCOPE_GUARD { m_client->DeleteInterface(m_interface_num); m_interface = nullptr; };
|
||||
|
||||
/* Get events. */
|
||||
sf::CopyHandle setup_event_handle;
|
||||
sf::CopyHandle ctrl_in_event_handle;
|
||||
sf::CopyHandle ctrl_out_event_handle;
|
||||
sf::NativeHandle setup_event_handle;
|
||||
sf::NativeHandle ctrl_in_event_handle;
|
||||
sf::NativeHandle ctrl_out_event_handle;
|
||||
R_TRY(m_interface->GetSetupEvent(std::addressof(setup_event_handle)));
|
||||
R_TRY(m_interface->GetCtrlInCompletionEvent(std::addressof(ctrl_in_event_handle)));
|
||||
R_TRY(m_interface->GetCtrlOutCompletionEvent(std::addressof(ctrl_out_event_handle)));
|
||||
|
||||
/* Attach events. */
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_setup_event), setup_event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_ctrl_in_completion_event), ctrl_in_event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_ctrl_out_completion_event), ctrl_out_event_handle.GetValue(), true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_setup_event), setup_event_handle.GetOsHandle(), setup_event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_ctrl_in_completion_event), ctrl_in_event_handle.GetOsHandle(), ctrl_in_event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_ctrl_out_completion_event), ctrl_out_event_handle.GetOsHandle(), ctrl_out_event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
|
||||
setup_event_handle.Detach();
|
||||
ctrl_in_event_handle.Detach();
|
||||
ctrl_out_event_handle.Detach();
|
||||
|
||||
/* Increment our client's reference count. */
|
||||
++m_client->m_reference_count;
|
||||
|
@ -635,7 +640,7 @@ namespace ams::usb {
|
|||
auto ep_guard = SCOPE_GUARD { m_interface->DeleteEndpoint(m_address); m_endpoint = nullptr; };
|
||||
|
||||
/* Get completion event. */
|
||||
sf::CopyHandle event_handle;
|
||||
sf::NativeHandle event_handle;
|
||||
R_TRY(m_endpoint->GetCompletionEvent(std::addressof(event_handle)));
|
||||
|
||||
/* Increment our interface's reference count. */
|
||||
|
@ -643,7 +648,8 @@ namespace ams::usb {
|
|||
++m_interface->m_client->m_reference_count;
|
||||
|
||||
/* Attach our event. */
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_completion_event), event_handle, true, os::EventClearMode_ManualClear);
|
||||
os::AttachReadableHandleToSystemEvent(std::addressof(m_completion_event), event_handle.GetOsHandle(), event_handle.IsManaged(), os::EventClearMode_ManualClear);
|
||||
event_handle.Detach();
|
||||
|
||||
/* Mark initialized. */
|
||||
m_is_initialized = true;
|
||||
|
|
|
@ -35,10 +35,15 @@ namespace ams::usb {
|
|||
|
||||
Result RemoteDsEndpoint::GetCompletionEvent(sf::OutCopyHandle out) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), 2,
|
||||
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY((serviceDispatch(std::addressof(m_srv), 2,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = out.GetHandlePointer(),
|
||||
);
|
||||
.out_handles = std::addressof(event_handle),
|
||||
)));
|
||||
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteDsEndpoint::GetUrbReport(sf::Out<usb::UrbReport> out) {
|
||||
|
|
|
@ -35,10 +35,15 @@ namespace ams::usb {
|
|||
|
||||
Result RemoteDsInterface::GetSetupEvent(sf::OutCopyHandle out) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), 1,
|
||||
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY((serviceDispatch(std::addressof(m_srv), 1,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = out.GetHandlePointer(),
|
||||
);
|
||||
.out_handles = std::addressof(event_handle),
|
||||
)));
|
||||
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteDsInterface::GetSetupPacket(const sf::OutBuffer &out) {
|
||||
|
@ -71,10 +76,15 @@ namespace ams::usb {
|
|||
|
||||
Result RemoteDsInterface::GetCtrlInCompletionEvent(sf::OutCopyHandle out) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 5 : 7,
|
||||
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY((serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 5 : 7,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = out.GetHandlePointer(),
|
||||
);
|
||||
.out_handles = std::addressof(event_handle),
|
||||
)));
|
||||
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteDsInterface::GetCtrlInUrbReport(sf::Out<usb::UrbReport> out) {
|
||||
|
@ -84,10 +94,15 @@ namespace ams::usb {
|
|||
|
||||
Result RemoteDsInterface::GetCtrlOutCompletionEvent(sf::OutCopyHandle out) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 7 : 9,
|
||||
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY((serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 7 : 9,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = out.GetHandlePointer(),
|
||||
);
|
||||
.out_handles = std::addressof(event_handle),
|
||||
)));
|
||||
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteDsInterface::GetCtrlOutUrbReport(sf::Out<usb::UrbReport> out) {
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
namespace ams::usb {
|
||||
|
||||
Result RemoteDsService::Bind(usb::ComplexId complex_id, sf::CopyHandle process_h) {
|
||||
Result RemoteDsService::Bind(usb::ComplexId complex_id, sf::CopyHandle &&process_h) {
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
R_TRY(serviceDispatchIn(std::addressof(m_srv), 0, complex_id,
|
||||
.in_num_handles = 1,
|
||||
.in_handles = { process_h.GetValue() }
|
||||
.in_handles = { process_h.GetOsHandle() }
|
||||
));
|
||||
} else {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
|
@ -33,7 +33,7 @@ namespace ams::usb {
|
|||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
R_TRY(serviceDispatch(std::addressof(m_srv), 1,
|
||||
.in_num_handles = 1,
|
||||
.in_handles = { process_h.GetValue() })
|
||||
.in_handles = { process_h.GetOsHandle() })
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,15 @@ namespace ams::usb {
|
|||
|
||||
Result RemoteDsService::GetStateChangeEvent(sf::OutCopyHandle out) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 2 : 3,
|
||||
|
||||
os::NativeHandle event_handle;
|
||||
R_TRY((serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 2 : 3,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
.out_handles = out.GetHandlePointer(),
|
||||
);
|
||||
.out_handles = std::addressof(event_handle),
|
||||
)));
|
||||
|
||||
out.SetValue(event_handle, true);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RemoteDsService::GetState(sf::Out<usb::UsbState> out) {
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::usb {
|
|||
RemoteDsService(Service &srv, sf::ExpHeapAllocator *allocator) : m_srv(srv), m_allocator(allocator) { /* ... */ }
|
||||
virtual ~RemoteDsService() { serviceClose(std::addressof(m_srv)); }
|
||||
public:
|
||||
Result Bind(usb::ComplexId complex_id, sf::CopyHandle process_h);
|
||||
Result Bind(usb::ComplexId complex_id, sf::CopyHandle &&process_h);
|
||||
Result RegisterInterface(sf::Out<sf::SharedPointer<usb::ds::IDsInterface>> out, u8 bInterfaceNumber);
|
||||
Result GetStateChangeEvent(sf::OutCopyHandle out);
|
||||
Result GetState(sf::Out<usb::UsbState> out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue