summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-10 16:05:37 -0700
committerGravatar bunnei2021-05-10 20:34:38 -0700
commitda25a5986666c55de1421aed978f7e92e5a87c8f (patch)
tree9050ea95e173e1ec2b9e3e5853232926c22093b6
parenthle: service: sm: Use RegisterNamedService to register the service. (diff)
downloadyuzu-da25a5986666c55de1421aed978f7e92e5a87c8f.tar.gz
yuzu-da25a5986666c55de1421aed978f7e92e5a87c8f.tar.xz
yuzu-da25a5986666c55de1421aed978f7e92e5a87c8f.zip
hle: service: Implement IPC::CommandType::Close.
- This was not actually closing sessions before.
-rw-r--r--src/core/hle/kernel/k_server_session.cpp4
-rw-r--r--src/core/hle/service/service.cpp19
-rw-r--r--src/core/hle/service/service.h3
3 files changed, 15 insertions, 11 deletions
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index b28cc2499..8850d9af5 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -95,7 +95,7 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co
95 UNREACHABLE(); 95 UNREACHABLE();
96 return RESULT_SUCCESS; // Ignore error if asserts are off 96 return RESULT_SUCCESS; // Ignore error if asserts are off
97 } 97 }
98 return domain_request_handlers[object_id - 1]->HandleSyncRequest(context); 98 return domain_request_handlers[object_id - 1]->HandleSyncRequest(*this, context);
99 99
100 case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { 100 case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: {
101 LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id); 101 LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id);
@@ -135,7 +135,7 @@ ResultCode KServerSession::CompleteSyncRequest(HLERequestContext& context) {
135 // If there is no domain header, the regular session handler is used 135 // If there is no domain header, the regular session handler is used
136 } else if (hle_handler != nullptr) { 136 } else if (hle_handler != nullptr) {
137 // If this ServerSession has an associated HLE handler, forward the request to it. 137 // If this ServerSession has an associated HLE handler, forward the request to it.
138 result = hle_handler->HandleSyncRequest(context); 138 result = hle_handler->HandleSyncRequest(*this, context);
139 } 139 }
140 140
141 if (convert_to_domain) { 141 if (convert_to_domain) {
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index d7e09e8f1..e36c35a86 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -167,33 +167,36 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
167 handler_invoker(this, info->handler_callback, ctx); 167 handler_invoker(this, info->handler_callback, ctx);
168} 168}
169 169
170ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& context) { 170ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
171 Kernel::HLERequestContext& ctx) {
171 const auto guard = LockService(); 172 const auto guard = LockService();
172 173
173 switch (context.GetCommandType()) { 174 switch (ctx.GetCommandType()) {
174 case IPC::CommandType::Close: { 175 case IPC::CommandType::Close:
175 IPC::ResponseBuilder rb{context, 2}; 176 case IPC::CommandType::TIPC_Close: {
177 session.Close();
178 IPC::ResponseBuilder rb{ctx, 2};
176 rb.Push(RESULT_SUCCESS); 179 rb.Push(RESULT_SUCCESS);
177 return IPC::ERR_REMOTE_PROCESS_DEAD; 180 return IPC::ERR_REMOTE_PROCESS_DEAD;
178 } 181 }
179 case IPC::CommandType::ControlWithContext: 182 case IPC::CommandType::ControlWithContext:
180 case IPC::CommandType::Control: { 183 case IPC::CommandType::Control: {
181 system.ServiceManager().InvokeControlRequest(context); 184 system.ServiceManager().InvokeControlRequest(ctx);
182 break; 185 break;
183 } 186 }
184 case IPC::CommandType::RequestWithContext: 187 case IPC::CommandType::RequestWithContext:
185 case IPC::CommandType::Request: { 188 case IPC::CommandType::Request: {
186 InvokeRequest(context); 189 InvokeRequest(ctx);
187 break; 190 break;
188 } 191 }
189 default: 192 default:
190 UNIMPLEMENTED_MSG("command_type={}", context.GetCommandType()); 193 UNIMPLEMENTED_MSG("command_type={}", ctx.GetCommandType());
191 } 194 }
192 195
193 // If emulation was shutdown, we are closing service threads, do not write the response back to 196 // If emulation was shutdown, we are closing service threads, do not write the response back to
194 // memory that may be shutting down as well. 197 // memory that may be shutting down as well.
195 if (system.IsPoweredOn()) { 198 if (system.IsPoweredOn()) {
196 context.WriteToOutgoingCommandBuffer(context.GetThread()); 199 ctx.WriteToOutgoingCommandBuffer(ctx.GetThread());
197 } 200 }
198 201
199 return RESULT_SUCCESS; 202 return RESULT_SUCCESS;
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 16357b156..51e22a791 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -71,7 +71,8 @@ public:
71 Kernel::KClientPort& CreatePort(Kernel::KernelCore& kernel); 71 Kernel::KClientPort& CreatePort(Kernel::KernelCore& kernel);
72 72
73 /// Handles a synchronization request for the service. 73 /// Handles a synchronization request for the service.
74 ResultCode HandleSyncRequest(Kernel::HLERequestContext& context) override; 74 ResultCode HandleSyncRequest(Kernel::KServerSession& session,
75 Kernel::HLERequestContext& context) override;
75 76
76protected: 77protected:
77 /// Member-function pointer type of SyncRequest handlers. 78 /// Member-function pointer type of SyncRequest handlers.