Просмотр исходного кода

Merge pull request #1621 from lioncash/ipc

 hle_ipc: Make GetDomainMessageHeader return a regular pointer
bunnei 7 лет назад
Родитель
Сommit
adf26ae668
3 измененных файлов с 9 добавлено и 6 удалено
  1. 1 2
      src/core/hle/ipc_helpers.h
  2. 6 2
      src/core/hle/kernel/hle_ipc.h
  3. 2 2
      src/core/hle/kernel/server_session.cpp

+ 1 - 2
src/core/hle/ipc_helpers.h

@@ -117,8 +117,7 @@ public:
 
 
         AlignWithPadding();
         AlignWithPadding();
 
 
-        const bool request_has_domain_header{context.GetDomainMessageHeader() != nullptr};
-        if (context.Session()->IsDomain() && request_has_domain_header) {
+        if (context.Session()->IsDomain() && context.HasDomainMessageHeader()) {
             IPC::DomainMessageHeader domain_header{};
             IPC::DomainMessageHeader domain_header{};
             domain_header.num_objects = num_domain_objects;
             domain_header.num_objects = num_domain_objects;
             PushRaw(domain_header);
             PushRaw(domain_header);

+ 6 - 2
src/core/hle/kernel/hle_ipc.h

@@ -161,8 +161,12 @@ public:
         return buffer_c_desciptors;
         return buffer_c_desciptors;
     }
     }
 
 
-    const std::shared_ptr<IPC::DomainMessageHeader>& GetDomainMessageHeader() const {
-        return domain_message_header;
+    const IPC::DomainMessageHeader* GetDomainMessageHeader() const {
+        return domain_message_header.get();
+    }
+
+    bool HasDomainMessageHeader() const {
+        return domain_message_header != nullptr;
     }
     }
 
 
     /// Helper function to read a buffer using the appropriate buffer descriptor
     /// Helper function to read a buffer using the appropriate buffer descriptor

+ 2 - 2
src/core/hle/kernel/server_session.cpp

@@ -63,7 +63,7 @@ void ServerSession::Acquire(Thread* thread) {
 }
 }
 
 
 ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
 ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
-    auto& domain_message_header = context.GetDomainMessageHeader();
+    auto* const domain_message_header = context.GetDomainMessageHeader();
     if (domain_message_header) {
     if (domain_message_header) {
         // Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
         // Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
         context.SetDomainRequestHandlers(domain_request_handlers);
         context.SetDomainRequestHandlers(domain_request_handlers);
@@ -111,7 +111,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
 
 
     ResultCode result = RESULT_SUCCESS;
     ResultCode result = RESULT_SUCCESS;
     // If the session has been converted to a domain, handle the domain request
     // If the session has been converted to a domain, handle the domain request
-    if (IsDomain() && context.GetDomainMessageHeader()) {
+    if (IsDomain() && context.HasDomainMessageHeader()) {
         result = HandleDomainSyncRequest(context);
         result = HandleDomainSyncRequest(context);
         // If there is no domain header, the regular session handler is used
         // If there is no domain header, the regular session handler is used
     } else if (hle_handler != nullptr) {
     } else if (hle_handler != nullptr) {