ams: support building unit test programs on windows/linux/macos
This commit is contained in:
@@ -36,9 +36,12 @@ namespace ams::usb {
|
||||
/* Connect to usb:ds. */
|
||||
/* NOTE: Here, Nintendo does m_domain.InitializeByDomain<...>(...); m_domain.SetSessionCount(1); */
|
||||
{
|
||||
Service srv;
|
||||
R_TRY(sm::GetService(std::addressof(srv), sm::ServiceName::Encode("usb:ds")));
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
os::NativeHandle h;
|
||||
R_TRY(sm::GetServiceHandle(std::addressof(h), sm::ServiceName::Encode("usb:ds")));
|
||||
|
||||
::Service srv;
|
||||
::serviceCreate(&srv, h);
|
||||
R_ABORT_UNLESS(serviceConvertToDomain(std::addressof(srv)));
|
||||
|
||||
using Allocator = decltype(m_allocator);
|
||||
@@ -51,6 +54,9 @@ namespace ams::usb {
|
||||
} else {
|
||||
m_ds_service = ObjectFactory::CreateSharedEmplaced<ds::IDsService, RemoteDsService>(std::addressof(m_allocator), srv, std::addressof(m_allocator));
|
||||
}
|
||||
#else
|
||||
AMS_ABORT("TODO");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Bind the client process. */
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
Result RemoteDsEndpoint::PostBufferAsync(sf::Out<u32> out_urb_id, u64 address, u32 size) {
|
||||
const struct {
|
||||
u32 size;
|
||||
@@ -62,5 +63,6 @@ namespace ams::usb {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatchIn(std::addressof(m_srv), 5, in);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteDsEndpoint {
|
||||
private:
|
||||
Service m_srv;
|
||||
@@ -33,5 +34,6 @@ namespace ams::usb {
|
||||
Result SetZlt(bool zlt);
|
||||
};
|
||||
static_assert(ds::IsIDsEndpoint<RemoteDsEndpoint>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
Result RemoteDsInterface::RegisterEndpoint(u8 endpoint_address, sf::Out<sf::SharedPointer<usb::ds::IDsEndpoint>> out) {
|
||||
Service srv;
|
||||
|
||||
@@ -149,6 +150,7 @@ namespace ams::usb {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteDsInterface {
|
||||
private:
|
||||
using Allocator = sf::ExpHeapAllocator;
|
||||
@@ -44,5 +45,6 @@ namespace ams::usb {
|
||||
Result Disable();
|
||||
};
|
||||
static_assert(ds::IsIDsInterface<RemoteDsInterface>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
Result RemoteDsRootService::GetService(sf::Out<sf::SharedPointer<usb::ds::IDsService>> out) {
|
||||
Service srv;
|
||||
|
||||
@@ -29,5 +30,6 @@ namespace ams::usb {
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteDsRootService {
|
||||
private:
|
||||
using Allocator = sf::ExpHeapAllocator;
|
||||
@@ -32,5 +33,6 @@ namespace ams::usb {
|
||||
Result GetService(sf::Out<sf::SharedPointer<usb::ds::IDsService>> out);
|
||||
};
|
||||
static_assert(ds::IsIDsRootService<RemoteDsRootService>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
Result RemoteDsService::Bind(usb::ComplexId complex_id, sf::CopyHandle &&process_h) {
|
||||
if (hos::GetVersion() >= hos::Version_11_0_0) {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
@@ -115,5 +116,6 @@ namespace ams::usb {
|
||||
serviceAssumeDomain(std::addressof(m_srv));
|
||||
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 10 : 11);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace ams::usb {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteDsService {
|
||||
private:
|
||||
using Allocator = sf::ExpHeapAllocator;
|
||||
@@ -42,5 +43,6 @@ namespace ams::usb {
|
||||
Result Disable();
|
||||
};
|
||||
static_assert(ds::IsIDsService<RemoteDsService>);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user