1
0
Fork 0
forked from suyu/suyu

Merge pull request #1874 from lioncash/bindings

hle/service, hle/sm: Minor cleanup
This commit is contained in:
bunnei 2018-12-07 18:31:04 -05:00 committed by GitHub
commit b9e80e97b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 19 deletions

View file

@ -70,10 +70,6 @@
#include "core/hle/service/vi/vi.h" #include "core/hle/service/vi/vi.h"
#include "core/hle/service/wlan/wlan.h" #include "core/hle/service/wlan/wlan.h"
using Kernel::ClientPort;
using Kernel::ServerPort;
using Kernel::SharedPtr;
namespace Service { namespace Service {
/** /**
@ -110,10 +106,8 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
ASSERT(port == nullptr); ASSERT(port == nullptr);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
SharedPtr<ServerPort> server_port; auto [server_port, client_port] =
SharedPtr<ClientPort> client_port; Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
std::tie(server_port, client_port) =
ServerPort::CreatePortPair(kernel, max_sessions, service_name);
server_port->SetHleHandler(shared_from_this()); server_port->SetHleHandler(shared_from_this());
kernel.AddNamedPort(service_name, std::move(client_port)); kernel.AddNamedPort(service_name, std::move(client_port));
} }
@ -122,11 +116,9 @@ Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() {
ASSERT(port == nullptr); ASSERT(port == nullptr);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] =
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
port = MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)).Unwrap(); port = MakeResult(std::move(server_port)).Unwrap();
port->SetHleHandler(shared_from_this()); port->SetHleHandler(shared_from_this());
return client_port; return client_port;
} }
@ -152,8 +144,7 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
} }
buf.push_back('}'); buf.push_back('}');
LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf)); UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf));
UNIMPLEMENTED();
} }
void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) { void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {

View file

@ -54,13 +54,11 @@ ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService
return ERR_ALREADY_REGISTERED; return ERR_ALREADY_REGISTERED;
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = Core::System::GetInstance().Kernel();
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] =
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name);
registered_services.emplace(std::move(name), std::move(client_port)); registered_services.emplace(std::move(name), std::move(client_port));
return MakeResult<Kernel::SharedPtr<Kernel::ServerPort>>(std::move(server_port)); return MakeResult(std::move(server_port));
} }
ResultCode ServiceManager::UnregisterService(const std::string& name) { ResultCode ServiceManager::UnregisterService(const std::string& name) {
@ -83,7 +81,7 @@ ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> ServiceManager::GetServicePort(
return ERR_SERVICE_NOT_REGISTERED; return ERR_SERVICE_NOT_REGISTERED;
} }
return MakeResult<Kernel::SharedPtr<Kernel::ClientPort>>(it->second); return MakeResult(it->second);
} }
ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ServiceManager::ConnectToService( ResultVal<Kernel::SharedPtr<Kernel::ClientSession>> ServiceManager::ConnectToService(