mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 16:52:46 +01:00
service: Add CreatePort function (that does not register/install).
This commit is contained in:
parent
97d52b9f89
commit
03bf0739a4
2 changed files with 12 additions and 0 deletions
|
@ -74,6 +74,16 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
|
|||
AddNamedPort(service_name, std::move(client_port));
|
||||
}
|
||||
|
||||
Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() {
|
||||
ASSERT(port == nullptr);
|
||||
Kernel::SharedPtr<Kernel::ServerPort> server_port;
|
||||
Kernel::SharedPtr<Kernel::ClientPort> client_port;
|
||||
std::tie(server_port, client_port) = Kernel::ServerPort::CreatePortPair(max_sessions, service_name);
|
||||
port = MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)).Unwrap();
|
||||
port->SetHleHandler(shared_from_this());
|
||||
return client_port;
|
||||
}
|
||||
|
||||
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) {
|
||||
handlers.reserve(handlers.size() + n);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
void InstallAsService(SM::ServiceManager& service_manager);
|
||||
/// Creates a port pair and registers it on the kernel's global port registry.
|
||||
void InstallAsNamedPort();
|
||||
/// Creates and returns an unregistered port for the service.
|
||||
Kernel::SharedPtr<Kernel::ClientPort> CreatePort();
|
||||
|
||||
void InvokeRequest(Kernel::HLERequestContext& ctx);
|
||||
|
||||
|
|
Loading…
Reference in a new issue