Merge pull request #4494 from FearlessTobi/port-1874

Port yuzu-emu/yuzu#1874: "hle/service, hle/sm: Minor cleanup"
This commit is contained in:
Weiyi Wang 2018-12-08 22:08:30 -05:00 committed by GitHub
commit 80f1076a07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View File

@ -54,11 +54,6 @@
#include "core/hle/service/ssl_c.h" #include "core/hle/service/ssl_c.h"
#include "core/hle/service/y2r_u.h" #include "core/hle/service/y2r_u.h"
using Kernel::ClientPort;
using Kernel::ServerPort;
using Kernel::ServerSession;
using Kernel::SharedPtr;
namespace Service { namespace Service {
const std::array<ServiceModuleInfo, 40> service_module_map{ const std::array<ServiceModuleInfo, 40> service_module_map{
@ -143,9 +138,7 @@ void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager)
void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) { void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
ASSERT(port == nullptr); ASSERT(port == nullptr);
SharedPtr<ServerPort> server_port; auto [server_port, client_port] = kernel.CreatePortPair(max_sessions, service_name);
SharedPtr<ClientPort> client_port;
std::tie(server_port, client_port) = kernel.CreatePortPair(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));
} }
@ -176,7 +169,8 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(u32* cmd_buf, const Funct
cmd_buf[1] = 0; cmd_buf[1] = 0;
} }
void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_session) { void ServiceFrameworkBase::HandleSyncRequest(
Kernel::SharedPtr<Kernel::ServerSession> server_session) {
Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel(); Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel();
auto thread = kernel.GetThreadManager().GetCurrentThread(); auto thread = kernel.GetThreadManager().GetCurrentThread();
// TODO(wwylele): avoid GetPointer // TODO(wwylele): avoid GetPointer
@ -224,7 +218,7 @@ static bool AttemptLLE(const ServiceModuleInfo& service_module) {
service_module.name); service_module.name);
return false; return false;
} }
SharedPtr<Kernel::Process> process; Kernel::SharedPtr<Kernel::Process> process;
loader->Load(process); loader->Load(process);
LOG_DEBUG(Service, "Service module \"{}\" has been successfully loaded.", service_module.name); LOG_DEBUG(Service, "Service module \"{}\" has been successfully loaded.", service_module.name);
return true; return true;

View File

@ -40,12 +40,10 @@ ResultVal<Kernel::SharedPtr<Kernel::ServerPort>> ServiceManager::RegisterService
if (registered_services.find(name) != registered_services.end()) if (registered_services.find(name) != registered_services.end())
return ERR_ALREADY_REGISTERED; return ERR_ALREADY_REGISTERED;
Kernel::SharedPtr<Kernel::ServerPort> server_port; auto [server_port, client_port] = system.Kernel().CreatePortPair(max_sessions, name);
Kernel::SharedPtr<Kernel::ClientPort> client_port;
std::tie(server_port, client_port) = system.Kernel().CreatePortPair(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));
} }
ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> ServiceManager::GetServicePort( ResultVal<Kernel::SharedPtr<Kernel::ClientPort>> ServiceManager::GetServicePort(
@ -57,7 +55,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(