فهرست منبع

IPC: Fixed pushing ResultCodes into the command buffer.

They should have 32 bits of padding after the error code now.
Subv 8 سال پیش
والد
کامیت
80f6df5414
2فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 7 5
      src/core/hle/ipc_helpers.h
  2. 2 2
      src/core/hle/service/sm/sm.cpp

+ 7 - 5
src/core/hle/ipc_helpers.h

@@ -142,6 +142,13 @@ void RequestBuilder::PushRaw(const T& value) {
     index += (sizeof(T) + 3) / 4; // round up to word length
     index += (sizeof(T) + 3) / 4; // round up to word length
 }
 }
 
 
+template <>
+inline void RequestBuilder::Push(ResultCode value) {
+    // Result codes are actually 64-bit in the IPC buffer, but only the high part is discarded.
+    Push(value.raw);
+    Push<u32>(0);
+}
+
 template <>
 template <>
 inline void RequestBuilder::Push(u8 value) {
 inline void RequestBuilder::Push(u8 value) {
     PushRaw(value);
     PushRaw(value);
@@ -163,11 +170,6 @@ inline void RequestBuilder::Push(bool value) {
     Push(static_cast<u8>(value));
     Push(static_cast<u8>(value));
 }
 }
 
 
-template <>
-inline void RequestBuilder::Push(ResultCode value) {
-    Push(value.raw);
-}
-
 template <typename First, typename... Other>
 template <typename First, typename... Other>
 void RequestBuilder::Push(const First& first_value, const Other&... other_values) {
 void RequestBuilder::Push(const First& first_value, const Other&... other_values) {
     Push(first_value);
     Push(first_value);

+ 2 - 2
src/core/hle/service/sm/sm.cpp

@@ -107,7 +107,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
 
 
     auto client_port = service_manager->GetServicePort(name);
     auto client_port = service_manager->GetServicePort(name);
     if (client_port.Failed()) {
     if (client_port.Failed()) {
-        IPC::RequestBuilder rb = rp.MakeBuilder(1, 0, 0);
+        IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 0);
         rb.Push(client_port.Code());
         rb.Push(client_port.Code());
         LOG_ERROR(Service_SM, "called service=%s -> error 0x%08X", name.c_str(),
         LOG_ERROR(Service_SM, "called service=%s -> error 0x%08X", name.c_str(),
                   client_port.Code().raw);
                   client_port.Code().raw);
@@ -120,7 +120,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
         LOG_DEBUG(Service_SM, "called service=%s -> session=%u", name.c_str(),
         LOG_DEBUG(Service_SM, "called service=%s -> session=%u", name.c_str(),
                   (*session)->GetObjectId());
                   (*session)->GetObjectId());
         IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 1);
         IPC::RequestBuilder rb = rp.MakeBuilder(2, 0, 1);
-        rb.Push<u64>(0);
+        rb.Push(session.Code());
         rb.PushMoveObjects(std::move(session).Unwrap());
         rb.PushMoveObjects(std::move(session).Unwrap());
     }
     }
 }
 }